nss: upgrade to release 3.73
[LibreOffice.git] / writerfilter / source / ooxml / OOXMLParserState.hxx
blob422ba0b776ef93042b1c2172945a19d4945f3211
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::ooxml
28 /**
29 * Struct to store our 'alternate state'. If multiple mc:AlternateContent
30 * elements arrive, then while the inner ones are active, the original state is
31 * saved away, and once they inner goes out of scope, the original state is
32 * restored.
34 struct SavedAlternateState
36 bool m_bDiscardChildren;
37 bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead?
40 class OOXMLParserState final : public virtual SvRefBase
42 bool mbInSectionGroup;
43 bool mbInParagraphGroup;
44 bool mbInCharacterGroup;
45 bool mbLastParagraphInSection;
46 bool mbForwardEvents;
47 unsigned int mnContexts;
48 unsigned int mnHandle;
49 OOXMLDocumentImpl* mpDocument;
50 OOXMLPropertySet::Pointer_t mpCharacterProps;
51 std::stack<OOXMLPropertySet::Pointer_t> mCellProps;
52 std::stack<OOXMLPropertySet::Pointer_t> mRowProps;
53 std::stack<OOXMLPropertySet::Pointer_t> mTableProps;
54 bool inTxbxContent;
55 // these 4 save when inTxbxContent
56 bool savedInParagraphGroup;
57 bool savedInCharacterGroup;
58 bool savedLastParagraphInSection;
59 std::vector<SavedAlternateState> maSavedAlternateStates;
60 std::vector<OOXMLPropertySet::Pointer_t> mvPostponedBreaks;
62 public:
63 typedef tools::SvRef<OOXMLParserState> Pointer_t;
65 OOXMLParserState();
66 ~OOXMLParserState() override;
68 bool isInSectionGroup() const { return mbInSectionGroup; }
69 void setInSectionGroup(bool bInSectionGroup);
71 void setLastParagraphInSection(bool bLastParagraphInSection);
72 bool isLastParagraphInSection() const { return mbLastParagraphInSection; }
74 std::vector<SavedAlternateState>& getSavedAlternateStates() { return maSavedAlternateStates; }
76 bool isInParagraphGroup() const { return mbInParagraphGroup; }
77 void setInParagraphGroup(bool bInParagraphGroup);
79 bool isInCharacterGroup() const { return mbInCharacterGroup; }
80 void setInCharacterGroup(bool bInCharacterGroup);
82 void setForwardEvents(bool bForwardEvents);
83 bool isForwardEvents() const { return mbForwardEvents; }
85 std::string getHandle() const;
86 void setHandle();
88 void setDocument(OOXMLDocumentImpl* pDocument);
89 OOXMLDocumentImpl* getDocument() const { return mpDocument; }
91 void setXNoteId(const sal_Int32 rId);
92 sal_Int32 getXNoteId() const;
94 const OUString& getTarget() const;
96 void resolveCharacterProperties(Stream& rStream);
97 void setCharacterProperties(const OOXMLPropertySet::Pointer_t& pProps);
98 void resolveCellProperties(Stream& rStream);
99 void setCellProperties(const OOXMLPropertySet::Pointer_t& pProps);
100 void resolveRowProperties(Stream& rStream);
101 void setRowProperties(const OOXMLPropertySet::Pointer_t& pProps);
102 void resolveTableProperties(Stream& rStream);
103 void setTableProperties(const OOXMLPropertySet::Pointer_t& pProps);
104 // tdf#108714
105 void resolvePostponedBreak(Stream& rStream);
106 void setPostponedBreak(const OOXMLPropertySet::Pointer_t& pProps);
108 void startTable();
109 void endTable();
111 void incContextCount();
113 void startTxbxContent();
114 void endTxbxContent();
118 #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPARSERSTATE_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */