1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
12 #include "excelhandlers.hxx"
13 #include <oox/core/contexthandler.hxx>
14 #include "condformatbuffer.hxx"
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
; }
28 class ExtCfRuleContext
: public WorksheetContextBase
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
;
37 ScDataBarFormatData
* mpTarget
;
42 struct ExtCondFormatRuleModel
45 ScConditionMode eOperator
;
50 class ExtConditionalFormattingContext
: public WorksheetContextBase
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
;
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
;
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
84 explicit ExtLstLocalContext( WorksheetContextBase
& rFragment
, ScDataBarFormatData
* pTarget
); // until now a ExtLst always extends an existing entry
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
;
92 ScDataBarFormatData
* mpTarget
;
96 * A single ext entry. Will be skipped until the actual entry with the correct uri is found
98 class ExtGlobalContext
: public WorksheetContextBase
101 explicit ExtGlobalContext( WorksheetContextBase
& rFragment
);
104 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
105 virtual void onStartElement( const AttributeList
& rAttribs
) override
;
111 * Used for the actual ExtLst containing the new extended definition.
112 * Uses the saved data from the ExtLstLocalContext
114 class ExtLstGlobalContext
: public WorksheetContextBase
117 explicit ExtLstGlobalContext( WorksheetFragment
& rFragment
);
120 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
123 class ExtGlobalWorkbookContext
: public WorkbookContextBase
126 explicit ExtGlobalWorkbookContext( WorkbookContextBase
& rFragment
);
129 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
130 virtual void onStartElement( const AttributeList
& rAttribs
) override
;
135 class ExtLstGlobalWorkbookContext
: public WorkbookContextBase
138 explicit ExtLstGlobalWorkbookContext( WorkbookFragment
& rFragment
);
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: */