1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _XMLOFF_XMLSECTIONIMPORTCONTEXT_HXX_
29 #define _XMLOFF_XMLSECTIONIMPORTCONTEXT_HXX_
30 
31 #include <xmloff/xmlictxt.hxx>
32 #include <com/sun/star/uno/Reference.h>
33 #include <com/sun/star/uno/Sequence.h>
34 
35 namespace com { namespace sun { namespace star {
36 	namespace text { class XTextRange;	}
37 	namespace beans { class XPropertySet; }
38 	namespace xml { namespace sax { class XAttributeList; } }
39 } } }
40 namespace rtl {	class OUString; }
41 class XMLTextImportHelper;
42 
43 
44 /**
45  * Import text sections.
46  *
47  * This context may *also* be used for index header sections. The
48  * differentiates its behaviour based on GetLocalName().
49  */
50 class XMLSectionImportContext : public SvXMLImportContext
51 {
52 	/// start position; ranges aquired via getStart(),getEnd() don't move
53 	::com::sun::star::uno::Reference<
54 		::com::sun::star::text::XTextRange> xStartRange;
55 
56 	/// end position
57 	::com::sun::star::uno::Reference<
58 		::com::sun::star::text::XTextRange> xEndRange;
59 
60 	/// TextSection (as XPropertySet) for passing down to data source elements
61 	::com::sun::star::uno::Reference<
62 		::com::sun::star::beans::XPropertySet> xSectionPropertySet;
63 
64 	const ::rtl::OUString sTextSection;
65 	const ::rtl::OUString sIndexHeaderSection;
66 	const ::rtl::OUString sCondition;
67 	const ::rtl::OUString sIsVisible;
68 	const ::rtl::OUString sProtectionKey;
69 	const ::rtl::OUString sIsProtected;
70 	const ::rtl::OUString sIsCurrentlyVisible;
71 	const ::rtl::OUString sEmpty;
72 
73 	::rtl::OUString sXmlId;
74 	::rtl::OUString sStyleName;
75 	::rtl::OUString sName;
76 	::rtl::OUString sCond;
77 	::com::sun::star::uno::Sequence<sal_Int8> aSequence;
78 	sal_Bool bProtect;
79 	sal_Bool bCondOK;
80 	sal_Bool bIsVisible;
81 	sal_Bool bValid;
82 	sal_Bool bSequenceOK;
83     sal_Bool bIsCurrentlyVisible;
84     sal_Bool bIsCurrentlyVisibleOK;
85 
86 	sal_Bool bHasContent;
87 
88 public:
89 
90 	TYPEINFO();
91 
92 	XMLSectionImportContext(
93 		SvXMLImport& rImport,
94 		sal_uInt16 nPrfx,
95 		const ::rtl::OUString& rLocalName );
96 
97 	~XMLSectionImportContext();
98 
99 protected:
100 
101 	virtual void StartElement(
102 		const ::com::sun::star::uno::Reference<
103 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
104 
105 	virtual void EndElement();
106 
107 	virtual SvXMLImportContext *CreateChildContext(
108 		sal_uInt16 nPrefix,
109 		const ::rtl::OUString& rLocalName,
110 		const ::com::sun::star::uno::Reference<
111 			::com::sun::star::xml::sax::XAttributeList> & xAttrList );
112 
113 	void ProcessAttributes(
114 		const ::com::sun::star::uno::Reference<
115 			::com::sun::star::xml::sax::XAttributeList> & xAttrList );
116 };
117 
118 #endif
119