xref: /AOO41X/main/xmloff/source/text/XMLSectionImportContext.hxx (revision ecfe53c5d1886e1e0d215b0d140d05282ab1c477)
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 
24 #ifndef _XMLOFF_XMLSECTIONIMPORTCONTEXT_HXX_
25 #define _XMLOFF_XMLSECTIONIMPORTCONTEXT_HXX_
26 
27 #include <xmloff/xmlictxt.hxx>
28 #include <com/sun/star/uno/Reference.h>
29 #include <com/sun/star/uno/Sequence.h>
30 
31 namespace com { namespace sun { namespace star {
32     namespace text { class XTextRange;  }
33     namespace beans { class XPropertySet; }
34     namespace xml { namespace sax { class XAttributeList; } }
35 } } }
36 namespace rtl { class OUString; }
37 class XMLTextImportHelper;
38 
39 
40 /**
41  * Import text sections.
42  *
43  * This context may *also* be used for index header sections. The
44  * differentiates its behaviour based on GetLocalName().
45  */
46 class XMLSectionImportContext : public SvXMLImportContext
47 {
48     /// start position; ranges aquired via getStart(),getEnd() don't move
49     ::com::sun::star::uno::Reference<
50         ::com::sun::star::text::XTextRange> xStartRange;
51 
52     /// end position
53     ::com::sun::star::uno::Reference<
54         ::com::sun::star::text::XTextRange> xEndRange;
55 
56     /// TextSection (as XPropertySet) for passing down to data source elements
57     ::com::sun::star::uno::Reference<
58         ::com::sun::star::beans::XPropertySet> xSectionPropertySet;
59 
60     const ::rtl::OUString sTextSection;
61     const ::rtl::OUString sIndexHeaderSection;
62     const ::rtl::OUString sCondition;
63     const ::rtl::OUString sIsVisible;
64     const ::rtl::OUString sProtectionKey;
65     const ::rtl::OUString sIsProtected;
66     const ::rtl::OUString sIsCurrentlyVisible;
67     const ::rtl::OUString sEmpty;
68 
69     ::rtl::OUString sXmlId;
70     ::rtl::OUString sStyleName;
71     ::rtl::OUString sName;
72     ::rtl::OUString sCond;
73     ::com::sun::star::uno::Sequence<sal_Int8> aSequence;
74     sal_Bool bProtect;
75     sal_Bool bCondOK;
76     sal_Bool bIsVisible;
77     sal_Bool bValid;
78     sal_Bool bSequenceOK;
79     sal_Bool bIsCurrentlyVisible;
80     sal_Bool bIsCurrentlyVisibleOK;
81 
82     sal_Bool bHasContent;
83 
84 public:
85 
86     TYPEINFO();
87 
88     XMLSectionImportContext(
89         SvXMLImport& rImport,
90         sal_uInt16 nPrfx,
91         const ::rtl::OUString& rLocalName );
92 
93     ~XMLSectionImportContext();
94 
95 protected:
96 
97     virtual void StartElement(
98         const ::com::sun::star::uno::Reference<
99             ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
100 
101     virtual void EndElement();
102 
103     virtual SvXMLImportContext *CreateChildContext(
104         sal_uInt16 nPrefix,
105         const ::rtl::OUString& rLocalName,
106         const ::com::sun::star::uno::Reference<
107             ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
108 
109     void ProcessAttributes(
110         const ::com::sun::star::uno::Reference<
111             ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
112 };
113 
114 #endif
115