Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice 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 INCLUDED_SC_SOURCE_FILTER_INC_XEEXTLST_HXX
11 : #define INCLUDED_SC_SOURCE_FILTER_INC_XEEXTLST_HXX
12 :
13 : #include "xerecord.hxx"
14 : #include "xeroot.hxx"
15 :
16 : #include "colorscale.hxx"
17 :
18 : #include <memory>
19 :
20 : enum XclExpExtType
21 : {
22 : XclExpExtDataBarType
23 : };
24 :
25 20 : struct XclExpExtCondFormatData
26 : {
27 : // -1 means don't write priority
28 : sal_Int32 nPriority;
29 : OString aGUID;
30 : const ScFormatEntry* pEntry;
31 : };
32 :
33 : /**
34 : * Base class for ext entries. Extend this class to provide the needed functionality
35 : *
36 : * Right now the only supported subclass is XclExpExtCondFormat
37 : */
38 1 : class XclExpExt : public XclExpRecordBase, public XclExpRoot
39 : {
40 : public:
41 : explicit XclExpExt( const XclExpRoot& rRoot );
42 : virtual XclExpExtType GetType() = 0;
43 :
44 : protected:
45 : OString maURI;
46 : };
47 :
48 20 : class XclExpExtCfvo : public XclExpRecordBase, protected XclExpRoot
49 : {
50 : public:
51 : XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rPos, bool bFirst );
52 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
53 :
54 : private:
55 : ScColorScaleEntryType meType;
56 : OString maValue;
57 : bool mbFirst;
58 : };
59 :
60 : class XclExpExtNegativeColor
61 : {
62 : public:
63 : XclExpExtNegativeColor( const Color& rColor );
64 : void SaveXml( XclExpXmlStream& rStrm);
65 :
66 : private:
67 : Color maColor;
68 : };
69 :
70 : class XclExpExtAxisColor
71 : {
72 : public:
73 : XclExpExtAxisColor( const Color& maColor );
74 : void SaveXml( XclExpXmlStream& rStrm );
75 :
76 : private:
77 : Color maAxisColor;
78 : };
79 :
80 0 : class XclExpExtIcon : public XclExpRecordBase, protected XclExpRoot
81 : {
82 : public:
83 : explicit XclExpExtIcon( const XclExpRoot& rRoot, const std::pair<ScIconSetType, sal_Int32>& rCustomEntry);
84 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
85 :
86 : private:
87 : const char* pIconSetName;
88 : sal_Int32 nIndex;
89 : };
90 :
91 10 : class XclExpExtDataBar : public XclExpRecordBase, protected XclExpRoot
92 : {
93 : public:
94 : explicit XclExpExtDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, const ScAddress& rPos );
95 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
96 :
97 : private:
98 : databar::ScAxisPosition meAxisPosition;
99 : bool mbGradient;
100 : double mnMinLength;
101 : double mnMaxLength;
102 :
103 : std::unique_ptr<XclExpExtCfvo> mpLowerLimit;
104 : std::unique_ptr<XclExpExtCfvo> mpUpperLimit;
105 : std::unique_ptr<XclExpExtNegativeColor> mpNegativeColor;
106 : std::unique_ptr<XclExpExtAxisColor> mpAxisColor;
107 :
108 : };
109 :
110 0 : class XclExpExtIconSet : public XclExpRecordBase, protected XclExpRoot
111 : {
112 : public:
113 : explicit XclExpExtIconSet(const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, const ScAddress& rPos);
114 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
115 :
116 : private:
117 : XclExpRecordList<XclExpExtCfvo> maCfvos;
118 : XclExpRecordList<XclExpExtIcon> maCustom;
119 : bool mbCustom;
120 : bool mbReverse;
121 : bool mbShowValue;
122 : const char* mpIconSetName;
123 : };
124 :
125 : typedef std::shared_ptr<XclExpExtDataBar> XclExpExtDataBarRef;
126 :
127 10 : class XclExpExtCfRule : public XclExpRecordBase, protected XclExpRoot
128 : {
129 : public:
130 : XclExpExtCfRule( const XclExpRoot& rRoot, const ScFormatEntry& rFormat, const ScAddress& rPos, const OString& rId, sal_Int32 nPriority );
131 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
132 :
133 : private:
134 : XclExpRecordRef mxEntry;
135 : OString maId;
136 : const char* pType;
137 : sal_Int32 mnPriority;
138 : };
139 :
140 : typedef std::shared_ptr<XclExpExt> XclExpExtRef;
141 : typedef std::shared_ptr<XclExpExtCfRule> XclExpExtCfRuleRef;
142 :
143 10 : class XclExpExtConditionalFormatting : public XclExpRecordBase, protected XclExpRoot
144 : {
145 : public:
146 : explicit XclExpExtConditionalFormatting( const XclExpRoot& rRoot, std::vector<XclExpExtCondFormatData>& rData, const ScRangeList& rRange);
147 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
148 :
149 : private:
150 : XclExpRecordList<XclExpExtCfRule> maCfRules;
151 : ScRangeList maRange;
152 : };
153 :
154 : typedef std::shared_ptr<XclExpExtConditionalFormatting> XclExpExtConditionalFormattingRef;
155 :
156 2 : class XclExpExtCondFormat : public XclExpExt
157 : {
158 : public:
159 : XclExpExtCondFormat( const XclExpRoot& rRoot );
160 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
161 :
162 10 : virtual XclExpExtType GetType() SAL_OVERRIDE { return XclExpExtDataBarType; }
163 :
164 : void AddRecord( XclExpExtConditionalFormattingRef aFormat );
165 :
166 : private:
167 : XclExpRecordList< XclExpExtConditionalFormatting > maCF;
168 : };
169 :
170 458 : class XclExtLst : public XclExpRecordBase, public XclExpRoot
171 : {
172 : public:
173 : explicit XclExtLst( const XclExpRoot& rRoot);
174 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
175 :
176 : void AddRecord( XclExpExtRef aEntry );
177 :
178 : XclExpExtRef GetItem( XclExpExtType eType );
179 :
180 : private:
181 : XclExpRecordList< XclExpExt > maExtEntries;
182 : };
183 :
184 : typedef std::shared_ptr< XclExtLst > XclExtLstRef;
185 :
186 : #endif
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|