Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / filter / inc / extlstcontext.hxx
blob3f2085d5ed81c4b521a98353f846033237187773
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_EXTLSTCONTEXT_HXX
11 #define INCLUDED_SC_SOURCE_FILTER_INC_EXTLSTCONTEXT_HXX
13 #include "excelhandlers.hxx"
14 #include <oox/core/contexthandler.hxx>
15 #include "condformatbuffer.hxx"
17 #include <vector>
18 #include <memory>
20 extern sal_Int32 rStyleIdx; // Holds index of the <extlst> <cfRule> style (Will be reset by finalize import)
22 struct ScDataBarFormatData;
23 namespace oox { class AttributeList; }
24 namespace oox { namespace xls { class WorkbookFragment; } }
25 namespace oox { namespace xls { class WorksheetFragment; } }
27 namespace oox {
28 namespace xls {
30 class ExtCfRuleContext : public WorksheetContextBase
32 public:
33 explicit ExtCfRuleContext( WorksheetContextBase& rFragment, ScDataBarFormatData* pDataBar );
35 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
36 virtual void onStartElement( const AttributeList& rAttribs ) override;
38 private:
39 ScDataBarFormatData* const mpTarget;
41 bool mbFirstEntry;
44 class ExtConditionalFormattingContext : public WorksheetContextBase
46 public:
47 explicit ExtConditionalFormattingContext(WorksheetContextBase& rFragment);
49 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
50 virtual void onStartElement( const AttributeList& rAttribs ) override;
51 virtual void onCharacters(const OUString& rCharacters) override;
52 virtual void onEndElement() override;
54 private:
55 OUString aChars; // Characters of between xml elements.
56 OUString rStyle; // Style of the corresponding condition
57 sal_Int32 nPriority; // Priority of last cfRule element.
58 ScConditionMode eOperator; // Used only when cfRule type is "cellIs"
59 bool isPreviousElementF; // Used to distinguish alone <sqref> from <f> and <sqref>
60 std::vector<std::unique_ptr<ScFormatEntry> > maEntries;
61 std::vector< OUString > rFormulas; // It holds formulas for a range, there can be more formula for same range.
62 std::unique_ptr<IconSetRule> mpCurrentRule;
63 std::vector<sal_Int32> maPriorities;
66 /**
67 * Handle ExtLst entries in xlsx. These entries are a way to extend the standard
68 * without actually changing it
70 * Needed right now for data bars
72 * ExtLstLocalContext is for the entry in the datastructure that needs to be extended
74 class ExtLstLocalContext : public WorksheetContextBase
76 public:
77 explicit ExtLstLocalContext( WorksheetContextBase& rFragment, ScDataBarFormatData* pTarget ); // until now a ExtLst always extends an existing entry
79 protected:
80 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
81 virtual void onStartElement( const AttributeList& rAttribs ) override;
82 virtual void onCharacters( const OUString& rChars ) override;
84 private:
85 ScDataBarFormatData* mpTarget;
88 /**
89 * A single ext entry. Will be skipped until the actual entry with the correct uri is found
91 class ExtGlobalContext : public WorksheetContextBase
93 public:
94 explicit ExtGlobalContext( WorksheetContextBase& rFragment );
96 protected:
97 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
98 virtual void onStartElement( const AttributeList& rAttribs ) override;
100 private:
104 * Used for the actual ExtLst containing the new extended definition.
105 * Uses the saved data from the ExtLstLocalContext
107 class ExtLstGlobalContext : public WorksheetContextBase
109 public:
110 explicit ExtLstGlobalContext( WorksheetFragment& rFragment );
112 protected:
113 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
116 class ExtGlobalWorkbookContext : public WorkbookContextBase
118 public:
119 explicit ExtGlobalWorkbookContext( WorkbookContextBase& rFragment );
121 protected:
122 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
123 virtual void onStartElement( const AttributeList& rAttribs ) override;
125 private:
128 class ExtLstGlobalWorkbookContext : public WorkbookContextBase
130 public:
131 explicit ExtLstGlobalWorkbookContext( WorkbookFragment& rFragment );
133 protected:
134 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
137 } //namespace xls
138 } //namespace oox
140 #endif
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */