Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / source / filter / inc / extlstcontext.hxx
blob8635c602952336362aac8f7f1e2b8e913b0634b1
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 #pragma once
12 #include "excelhandlers.hxx"
13 #include <oox/core/contexthandler.hxx>
14 #include "condformatbuffer.hxx"
16 #include <vector>
17 #include <memory>
19 extern sal_Int32 rStyleIdx; // Holds index of the <extlst> <cfRule> style (Will be reset by finalize import)
21 struct ScDataBarFormatData;
22 namespace oox { class AttributeList; }
23 namespace oox::xls { class WorkbookFragment; }
24 namespace oox::xls { class WorksheetFragment; }
26 namespace oox::xls {
28 class ExtCfRuleContext : public WorksheetContextBase
30 public:
31 explicit ExtCfRuleContext( WorksheetContextBase& rFragment, ScDataBarFormatData* pDataBar );
33 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
34 virtual void onStartElement( const AttributeList& rAttribs ) override;
36 private:
37 ScDataBarFormatData* mpTarget;
39 bool mbFirstEntry;
42 struct ExtCondFormatRuleModel
44 sal_Int32 nPriority;
45 ScConditionMode eOperator;
46 OUString aFormula;
47 OUString aStyle;
50 class ExtConditionalFormattingContext : public WorksheetContextBase
52 public:
53 explicit ExtConditionalFormattingContext(WorksheetContextBase& rFragment);
55 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
56 virtual void onStartElement( const AttributeList& rAttribs ) override;
57 virtual void onCharacters(const OUString& rCharacters) override;
58 virtual void onEndElement() override;
60 private:
61 ExtCondFormatRuleModel maModel;
62 sal_Int32 nFormulaCount;
63 OUString aChars; // Characters of between xml elements.
64 sal_Int32 nPriority; // Priority of last cfRule element.
65 ScConditionMode eOperator; // Used only when cfRule type is "cellIs"
66 bool isPreviousElementF; // Used to distinguish alone <sqref> from <f> and <sqref>
67 std::vector<std::unique_ptr<ScFormatEntry> > maEntries;
68 std::unique_ptr<IconSetRule> mpCurrentRule;
69 std::vector<sal_Int32> maPriorities;
70 std::vector<ExtCondFormatRuleModel> maModels;
73 /**
74 * Handle ExtLst entries in xlsx. These entries are a way to extend the standard
75 * without actually changing it
77 * Needed right now for data bars
79 * ExtLstLocalContext is for the entry in the datastructure that needs to be extended
81 class ExtLstLocalContext : public WorksheetContextBase
83 public:
84 explicit ExtLstLocalContext( WorksheetContextBase& rFragment, ScDataBarFormatData* pTarget ); // until now a ExtLst always extends an existing entry
86 protected:
87 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
88 virtual void onStartElement( const AttributeList& rAttribs ) override;
89 virtual void onCharacters( const OUString& rChars ) override;
91 private:
92 ScDataBarFormatData* mpTarget;
95 /**
96 * A single ext entry. Will be skipped until the actual entry with the correct uri is found
98 class ExtGlobalContext : public WorksheetContextBase
100 public:
101 explicit ExtGlobalContext( WorksheetContextBase& rFragment );
103 protected:
104 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
105 virtual void onStartElement( const AttributeList& rAttribs ) override;
107 private:
111 * Used for the actual ExtLst containing the new extended definition.
112 * Uses the saved data from the ExtLstLocalContext
114 class ExtLstGlobalContext : public WorksheetContextBase
116 public:
117 explicit ExtLstGlobalContext( WorksheetFragment& rFragment );
119 protected:
120 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
123 class ExtGlobalWorkbookContext : public WorkbookContextBase
125 public:
126 explicit ExtGlobalWorkbookContext( WorkbookContextBase& rFragment );
128 protected:
129 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
130 virtual void onStartElement( const AttributeList& rAttribs ) override;
132 private:
135 class ExtLstGlobalWorkbookContext : public WorkbookContextBase
137 public:
138 explicit ExtLstGlobalWorkbookContext( WorkbookFragment& rFragment );
140 protected:
141 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
144 } //namespace oox::xls
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */