1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef INCLUDE_OOXML_PARSER_STATE_HXX 24 #define INCLUDE_OOXML_PARSER_STATE_HXX 25 26 #include <stack> 27 #include <ooxml/OOXMLDocument.hxx> 28 #include "OOXMLPropertySetImpl.hxx" 29 30 #ifdef DEBUG 31 #include <resourcemodel/TagLogger.hxx> 32 #include <resourcemodel/XPathLogger.hxx> 33 #endif 34 35 namespace writerfilter { 36 namespace ooxml 37 { 38 39 using ::std::stack; 40 41 class OOXMLParserState 42 { 43 bool mbInSectionGroup; 44 bool mbInParagraphGroup; 45 bool mbInCharacterGroup; 46 bool mbLastParagraphInSection; 47 bool mbForwardEvents; 48 unsigned int mnContexts; 49 unsigned int mnHandle; 50 OOXMLDocument * mpDocument; 51 rtl::OUString msTarget; 52 OOXMLPropertySet::Pointer_t mpCharacterProps; 53 stack<OOXMLPropertySet::Pointer_t> mCellProps; 54 stack<OOXMLPropertySet::Pointer_t> mRowProps; 55 stack<OOXMLPropertySet::Pointer_t> mTableProps; 56 #ifdef DEBUG 57 XPathLogger m_xPathLogger; 58 #endif 59 60 public: 61 typedef boost::shared_ptr<OOXMLParserState> Pointer_t; 62 63 OOXMLParserState(); 64 virtual ~OOXMLParserState(); 65 66 bool isInSectionGroup() const; 67 void setInSectionGroup(bool bInSectionGroup); 68 69 void setLastParagraphInSection(bool bLastParagraphInSection); 70 bool isLastParagraphInSection() const; 71 72 bool isInParagraphGroup() const; 73 void setInParagraphGroup(bool bInParagraphGroup); 74 75 bool isInCharacterGroup() const; 76 void setInCharacterGroup(bool bInCharacterGroup); 77 78 void setForwardEvents(bool bForwardEvents); 79 bool isForwardEvents() const; 80 81 const string getHandle() const; 82 void setHandle(); 83 84 void setDocument(OOXMLDocument * pDocument); 85 OOXMLDocument * getDocument() const; 86 87 const rtl::OUString & getTarget() const; 88 89 void resolveCharacterProperties(Stream & rStream); 90 void setCharacterProperties(OOXMLPropertySet::Pointer_t pProps); 91 void resolveCellProperties(Stream & rStream); 92 void setCellProperties(OOXMLPropertySet::Pointer_t pProps); 93 void resolveRowProperties(Stream & rStream); 94 void setRowProperties(OOXMLPropertySet::Pointer_t pProps); 95 void resolveTableProperties(Stream & rStream); 96 void setTableProperties(OOXMLPropertySet::Pointer_t pProps); 97 98 void startTable(); 99 void endTable(); 100 101 void incContextCount(); 102 103 #ifdef DEBUG 104 public: 105 unsigned int getContextCount() const; 106 string toString() const; 107 XMLTag::Pointer_t toTag() const; 108 XPathLogger & getXPathLogger(); 109 #endif 110 111 }; 112 113 }} 114 115 #endif // INCLUDE_OOXML_PARSER_STATE_HXX 116