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/.
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
23 #include "OOXMLDocumentImpl.hxx"
24 #include "OOXMLPropertySetImpl.hxx"
26 namespace writerfilter
{
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
36 struct SavedAlternateState
38 bool m_bDiscardChildren
;
39 bool m_bTookChoice
; ///< Did we take the Choice or want Fallback instead?
42 class OOXMLParserState
44 bool mbInSectionGroup
;
45 bool mbInParagraphGroup
;
46 bool mbInCharacterGroup
;
47 bool mbLastParagraphInSection
;
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
;
57 // these 4 save when inTxbxContent
58 bool savedInParagraphGroup
;
59 bool savedInCharacterGroup
;
60 bool savedLastParagraphInSection
;
61 std::vector
<SavedAlternateState
> maSavedAlternateStates
;
64 typedef std::shared_ptr
<OOXMLParserState
> Pointer_t
;
67 virtual ~OOXMLParserState();
69 bool isInSectionGroup() const { return mbInSectionGroup
;}
70 void setInSectionGroup(bool bInSectionGroup
);
72 void setLastParagraphInSection(bool bLastParagraphInSection
);
73 bool isLastParagraphInSection() const { return mbLastParagraphInSection
;}
75 std::vector
<SavedAlternateState
>& getSavedAlternateStates() { return maSavedAlternateStates
; }
77 bool isInParagraphGroup() const { return mbInParagraphGroup
;}
78 void setInParagraphGroup(bool bInParagraphGroup
);
80 bool isInCharacterGroup() const { return mbInCharacterGroup
;}
81 void setInCharacterGroup(bool bInCharacterGroup
);
83 void setForwardEvents(bool bForwardEvents
);
84 bool isForwardEvents() const { return mbForwardEvents
;}
86 const std::string
getHandle() const;
89 void setDocument(OOXMLDocumentImpl
* pDocument
);
90 OOXMLDocumentImpl
* getDocument() const { return mpDocument
;}
92 void setXNoteId(const sal_Int32 rId
);
93 sal_Int32
getXNoteId() const;
95 const OUString
& getTarget() const;
97 void resolveCharacterProperties(Stream
& rStream
);
98 void setCharacterProperties(OOXMLPropertySet::Pointer_t pProps
);
99 void resolveCellProperties(Stream
& rStream
);
100 void setCellProperties(OOXMLPropertySet::Pointer_t pProps
);
101 void resolveRowProperties(Stream
& rStream
);
102 void setRowProperties(OOXMLPropertySet::Pointer_t pProps
);
103 void resolveTableProperties(Stream
& rStream
);
104 void setTableProperties(OOXMLPropertySet::Pointer_t pProps
);
109 void incContextCount();
111 void startTxbxContent();
112 void endTxbxContent();
118 #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPARSERSTATE_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */