Coverage Report

Created: 2026-06-13 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libetonyek/src/lib/IWORKStyle.h
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/*
3
 * This file is part of the libetonyek project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 */
9
10
#ifndef IWORKSTYLE_H_INCLUDED
11
#define IWORKSTYLE_H_INCLUDED
12
13
#include "IWORKStyle_fwd.h"
14
15
#include <boost/any.hpp>
16
#include <boost/optional.hpp>
17
18
#include "IWORKPropertyMap.h"
19
#include "IWORKStylesheet.h"
20
21
namespace libetonyek
22
{
23
24
class IWORKStyleStack;
25
26
/** Represents a hierarchical style.
27
  */
28
class IWORKStyle
29
{
30
public:
31
  IWORKStyle(const IWORKPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
32
  IWORKStyle(const IWORKPropertyMap &props, const boost::optional<std::string> &ident, const IWORKStylePtr_t &parent);
33
34
  /** Find the parent style by its ID.
35
    *
36
    * @arg[in] stylesheet the stylesheet to use for looking for parent.
37
    * @return @c true if the parent style has been found, @c false otherwise.
38
    */
39
  bool link(const IWORKStylesheetPtr_t &stylesheet);
40
41
  /** Copy attributes from parent style (recursively).
42
    *
43
    * @todo Will this have any effect on performance anyway?
44
    */
45
  void flatten();
46
47
  /** Get the style's property map.
48
    */
49
  const IWORKPropertyMap &getPropertyMap() const;
50
51
  /** Get the style's property map.
52
    */
53
  IWORKPropertyMap &getPropertyMap();
54
55
  /** Check for the presence of a property.
56
    *
57
    * @returns true if the property is present
58
    */
59
  template<class Property>
60
  bool has() const
61
49.7k
  {
62
49.7k
    return m_props.has<Property>(true);
63
49.7k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::Alignment>() const
Line
Count
Source
61
38
  {
62
38
    return m_props.has<Property>(true);
63
38
  }
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::DropCap>() const
bool libetonyek::IWORKStyle::has<libetonyek::property::VerticalAlignment>() const
Line
Count
Source
61
1.95k
  {
62
1.95k
    return m_props.has<Property>(true);
63
1.95k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::ListLevelStyles>() const
Line
Count
Source
61
1.33k
  {
62
1.33k
    return m_props.has<Property>(true);
63
1.33k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::SFTTableBandedCellFillProperty>() const
Line
Count
Source
61
36
  {
62
36
    return m_props.has<Property>(true);
63
36
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::SFTTableBandedRowsProperty>() const
Line
Count
Source
61
33
  {
62
33
    return m_props.has<Property>(true);
63
33
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::Opacity>() const
Line
Count
Source
61
2.18k
  {
62
2.18k
    return m_props.has<Property>(true);
63
2.18k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::Fill>() const
Line
Count
Source
61
3.79k
  {
62
3.79k
    return m_props.has<Property>(true);
63
3.79k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::Stroke>() const
Line
Count
Source
61
2.18k
  {
62
2.18k
    return m_props.has<Property>(true);
63
2.18k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::TailLineEnd>() const
Line
Count
Source
61
2.18k
  {
62
2.18k
    return m_props.has<Property>(true);
63
2.18k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::HeadLineEnd>() const
Line
Count
Source
61
2.18k
  {
62
2.18k
    return m_props.has<Property>(true);
63
2.18k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::Shadow>() const
Line
Count
Source
61
2.18k
  {
62
2.18k
    return m_props.has<Property>(true);
63
2.18k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::Padding>() const
Line
Count
Source
61
1.82k
  {
62
1.82k
    return m_props.has<Property>(true);
63
1.82k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::ExternalTextWrap>() const
Line
Count
Source
61
2.21k
  {
62
2.21k
    return m_props.has<Property>(true);
63
2.21k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::LayoutStyle>() const
Line
Count
Source
61
169
  {
62
169
    return m_props.has<Property>(true);
63
169
  }
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::ListLabelGeometries>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::ListLabelIndents>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::ListTextIndents>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::ListLabelTypes>() const
bool libetonyek::IWORKStyle::has<libetonyek::property::SFTStrokeProperty>() const
Line
Count
Source
61
126
  {
62
126
    return m_props.has<Property>(true);
63
126
  }
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::SFTCellStylePropertyNumberFormat>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::SFTCellStylePropertyDateTimeFormat>() const
bool libetonyek::IWORKStyle::has<libetonyek::property::ListLabelGeometry>() const
Line
Count
Source
61
6.20k
  {
62
6.20k
    return m_props.has<Property>(true);
63
6.20k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::ListLabelIndent>() const
Line
Count
Source
61
6.20k
  {
62
6.20k
    return m_props.has<Property>(true);
63
6.20k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::ListTextIndent>() const
Line
Count
Source
61
6.20k
  {
62
6.20k
    return m_props.has<Property>(true);
63
6.20k
  }
bool libetonyek::IWORKStyle::has<libetonyek::property::ListLabelTypeInfo>() const
Line
Count
Source
61
8.65k
  {
62
8.65k
    return m_props.has<Property>(true);
63
8.65k
  }
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::OddPageMaster>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::EvenPageMaster>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::FirstPageMaster>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::ListStyle>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::SFTHeaderColumnRepeatsProperty>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::SFTHeaderRowRepeatsProperty>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::SFTDefaultBodyCellStyleProperty>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::SFTDefaultHeaderRowCellStyleProperty>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::SFTDefaultHeaderColumnCellStyleProperty>() const
Unexecuted instantiation: bool libetonyek::IWORKStyle::has<libetonyek::property::SFTDefaultFooterRowCellStyleProperty>() const
64
65
  /** Retrieve the value of a property.
66
    *
67
    * @returns the found value
68
    */
69
  template<class Property>
70
  const typename IWORKPropertyInfo<Property>::ValueType &get() const
71
24.8k
  {
72
24.8k
    return m_props.get<Property>(true);
73
24.8k
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::Alignment>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::Alignment>() const
Line
Count
Source
71
29
  {
72
29
    return m_props.get<Property>(true);
73
29
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::VerticalAlignment>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::VerticalAlignment>() const
Line
Count
Source
71
263
  {
72
263
    return m_props.get<Property>(true);
73
263
  }
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::DropCap>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::DropCap>() const
libetonyek::IWORKPropertyInfo<libetonyek::property::ListLevelStyles>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListLevelStyles>() const
Line
Count
Source
71
1.33k
  {
72
1.33k
    return m_props.get<Property>(true);
73
1.33k
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::SFTTableBandedCellFillProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTTableBandedCellFillProperty>() const
Line
Count
Source
71
32
  {
72
32
    return m_props.get<Property>(true);
73
32
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::SFTTableBandedRowsProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTTableBandedRowsProperty>() const
Line
Count
Source
71
31
  {
72
31
    return m_props.get<Property>(true);
73
31
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::Opacity>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::Opacity>() const
Line
Count
Source
71
1.92k
  {
72
1.92k
    return m_props.get<Property>(true);
73
1.92k
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::Fill>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::Fill>() const
Line
Count
Source
71
3.00k
  {
72
3.00k
    return m_props.get<Property>(true);
73
3.00k
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::Stroke>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::Stroke>() const
Line
Count
Source
71
1.95k
  {
72
1.95k
    return m_props.get<Property>(true);
73
1.95k
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::TailLineEnd>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::TailLineEnd>() const
Line
Count
Source
71
45
  {
72
45
    return m_props.get<Property>(true);
73
45
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::HeadLineEnd>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::HeadLineEnd>() const
Line
Count
Source
71
50
  {
72
50
    return m_props.get<Property>(true);
73
50
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::Shadow>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::Shadow>() const
Line
Count
Source
71
1.94k
  {
72
1.94k
    return m_props.get<Property>(true);
73
1.94k
  }
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::Padding>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::Padding>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::ExternalTextWrap>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ExternalTextWrap>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::LayoutStyle>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::LayoutStyle>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::ListLabelGeometries>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListLabelGeometries>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::ListLabelIndents>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListLabelIndents>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::ListTextIndents>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListTextIndents>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::ListLabelTypes>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListLabelTypes>() const
libetonyek::IWORKPropertyInfo<libetonyek::property::SFTStrokeProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTStrokeProperty>() const
Line
Count
Source
71
126
  {
72
126
    return m_props.get<Property>(true);
73
126
  }
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::SFTCellStylePropertyNumberFormat>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTCellStylePropertyNumberFormat>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::SFTCellStylePropertyDateTimeFormat>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTCellStylePropertyDateTimeFormat>() const
libetonyek::IWORKPropertyInfo<libetonyek::property::ListLabelGeometry>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListLabelGeometry>() const
Line
Count
Source
71
2.18k
  {
72
2.18k
    return m_props.get<Property>(true);
73
2.18k
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::ListLabelIndent>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListLabelIndent>() const
Line
Count
Source
71
1.93k
  {
72
1.93k
    return m_props.get<Property>(true);
73
1.93k
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::ListTextIndent>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListTextIndent>() const
Line
Count
Source
71
2.00k
  {
72
2.00k
    return m_props.get<Property>(true);
73
2.00k
  }
libetonyek::IWORKPropertyInfo<libetonyek::property::ListLabelTypeInfo>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListLabelTypeInfo>() const
Line
Count
Source
71
8.01k
  {
72
8.01k
    return m_props.get<Property>(true);
73
8.01k
  }
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::OddPageMaster>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::OddPageMaster>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::EvenPageMaster>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::EvenPageMaster>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::FirstPageMaster>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::FirstPageMaster>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::ListStyle>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::ListStyle>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::SFTHeaderColumnRepeatsProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTHeaderColumnRepeatsProperty>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::SFTHeaderRowRepeatsProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTHeaderRowRepeatsProperty>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::SFTDefaultBodyCellStyleProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTDefaultBodyCellStyleProperty>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::SFTDefaultHeaderRowCellStyleProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTDefaultHeaderRowCellStyleProperty>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::SFTDefaultHeaderColumnCellStyleProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTDefaultHeaderColumnCellStyleProperty>() const
Unexecuted instantiation: libetonyek::IWORKPropertyInfo<libetonyek::property::SFTDefaultFooterRowCellStyleProperty>::ValueType const& libetonyek::IWORKStyle::get<libetonyek::property::SFTDefaultFooterRowCellStyleProperty>() const
74
75
  const boost::optional<std::string> &getIdent() const;
76
77
  void setParent(const IWORKStylePtr_t parent);
78
79
  /// Creates the list level properties of a list style if it does not exists
80
  void createListLevelStyles();
81
82
protected:
83
  const boost::optional<std::string> &getParentIdent() const;
84
  const IWORKStylePtr_t getParent() const;
85
86
private:
87
  IWORKPropertyMap m_props;
88
89
  const boost::optional<std::string> m_ident;
90
  const boost::optional<std::string> m_parentIdent;
91
  IWORKStylePtr_t m_parent;
92
};
93
94
}
95
96
#endif // IWORKSTYLE_H_INCLUDED
97
98
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */