Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / writerfilter / source / ooxml / OOXMLParserState.hxx
blob5e9811e2ac5196c53de497b99842c7be7e121ea5
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPARSERSTATE_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPARSERSTATE_HXX
22 #include <stack>
23 #include "OOXMLDocumentImpl.hxx"
24 #include "OOXMLPropertySet.hxx"
26 namespace writerfilter {
27 namespace ooxml
30 /**
31 * Struct to store our 'alternate state'. If multiple mc:AlternateContent
32 * elements arrive, then while the inner ones are active, the original state is
33 * saved away, and once they inner goes out of scope, the original state is
34 * restored.
36 struct SavedAlternateState
38 bool m_bDiscardChildren;
39 bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead?
42 class OOXMLParserState final : public virtual SvRefBase
44 bool mbInSectionGroup;
45 bool mbInParagraphGroup;
46 bool mbInCharacterGroup;
47 bool mbLastParagraphInSection;
48 bool mbForwardEvents;
49 unsigned int mnContexts;
50 unsigned int mnHandle;
51 OOXMLDocumentImpl* mpDocument;
52 OOXMLPropertySet::Pointer_t mpCharacterProps;
53 std::stack<OOXMLPropertySet::Pointer_t> mCellProps;
54 std::stack<OOXMLPropertySet::Pointer_t> mRowProps;
55 std::stack<OOXMLPropertySet::Pointer_t> mTableProps;
56 bool inTxbxContent;
57 // these 4 save when inTxbxContent
58 bool savedInParagraphGroup;
59 bool savedInCharacterGroup;
60 bool savedLastParagraphInSection;
61 std::vector<SavedAlternateState> maSavedAlternateStates;
62 std::vector<OOXMLPropertySet::Pointer_t> mvPostponedBreaks;
64 public:
65 typedef tools::SvRef<OOXMLParserState> Pointer_t;
67 OOXMLParserState();
68 ~OOXMLParserState() override;
70 bool isInSectionGroup() const { return mbInSectionGroup;}
71 void setInSectionGroup(bool bInSectionGroup);
73 void setLastParagraphInSection(bool bLastParagraphInSection);
74 bool isLastParagraphInSection() const { return mbLastParagraphInSection;}
76 std::vector<SavedAlternateState>& getSavedAlternateStates() { return maSavedAlternateStates; }
78 bool isInParagraphGroup() const { return mbInParagraphGroup;}
79 void setInParagraphGroup(bool bInParagraphGroup);
81 bool isInCharacterGroup() const { return mbInCharacterGroup;}
82 void setInCharacterGroup(bool bInCharacterGroup);
84 void setForwardEvents(bool bForwardEvents);
85 bool isForwardEvents() const { return mbForwardEvents;}
87 std::string getHandle() const;
88 void setHandle();
90 void setDocument(OOXMLDocumentImpl* pDocument);
91 OOXMLDocumentImpl* getDocument() const { return mpDocument;}
93 void setXNoteId(const sal_Int32 rId);
94 sal_Int32 getXNoteId() const;
96 const OUString & getTarget() const;
98 void resolveCharacterProperties(Stream & rStream);
99 void setCharacterProperties(const OOXMLPropertySet::Pointer_t& pProps);
100 void resolveCellProperties(Stream & rStream);
101 void setCellProperties(const OOXMLPropertySet::Pointer_t& pProps);
102 void resolveRowProperties(Stream & rStream);
103 void setRowProperties(const OOXMLPropertySet::Pointer_t& pProps);
104 void resolveTableProperties(Stream & rStream);
105 void setTableProperties(const OOXMLPropertySet::Pointer_t& pProps);
106 // tdf#108714
107 void resolvePostponedBreak(Stream & rStream);
108 void setPostponedBreak(const OOXMLPropertySet::Pointer_t& pProps);
110 void startTable();
111 void endTable();
113 void incContextCount();
115 void startTxbxContent();
116 void endTxbxContent();
122 #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPARSERSTATE_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */