Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _XMLOFF_FORMS_LAYERIMPORT_HXX_
30 : : #define _XMLOFF_FORMS_LAYERIMPORT_HXX_
31 : :
32 : : #include <com/sun/star/xml/sax/XAttributeList.hpp>
33 : : #include <com/sun/star/form/XFormsSupplier2.hpp>
34 : : #include <rtl/ref.hxx>
35 : : #include "formattributes.hxx"
36 : : #include "callbacks.hxx"
37 : : #include "eventimport.hxx"
38 : : #include <tools/ref.hxx>
39 : :
40 : : class SvXMLImport;
41 : : class SvXMLImportContext;
42 : : class SvXMLStyleContext;
43 : :
44 : : SV_DECL_REF( SvXMLStylesContext )
45 : : // unfortunately, we can't put this into our namespace, as the macro expands to (amongst others) a forward
46 : : // declaration of the class name, which then would be in the namespace, too
47 : :
48 : : //.........................................................................
49 : : namespace xmloff
50 : : {
51 : : //.........................................................................
52 : :
53 : : class OAttribute2Property;
54 : :
55 : : //=====================================================================
56 : : //= OFormLayerXMLImport_Impl
57 : : //=====================================================================
58 : : class OFormLayerXMLImport_Impl
59 : : : public ODefaultEventAttacherManager
60 : : {
61 : : friend class OFormLayerXMLImport;
62 : :
63 : : protected:
64 : : SvXMLImport& m_rImporter;
65 : : OAttribute2Property m_aAttributeMetaData;
66 : :
67 : : /// the supplier for the forms of the currently imported page
68 : : ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier2 >
69 : : m_xCurrentPageFormsSupp;
70 : : SvXMLStylesContext* m_pAutoStyles;
71 : :
72 : : protected:
73 : : DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, MapString2PropertySet );
74 : : DECLARE_STL_MAP( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >, MapString2PropertySet, ODrawPageCompare, MapDrawPage2Map);
75 : :
76 : : MapDrawPage2Map m_aControlIds; // ids of the controls on all known page
77 : : MapDrawPage2MapIterator m_aCurrentPageIds; // ifs of the controls on the current page
78 : :
79 : : typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, ::rtl::OUString >
80 : : ModelStringPair;
81 : : ::std::vector< ModelStringPair >
82 : : m_aControlReferences; // control reference descriptions for current page
83 : : ::std::vector< ModelStringPair >
84 : : m_aCellValueBindings; // information about controls bound to spreadsheet cells
85 : : ::std::vector< ModelStringPair >
86 : : m_aCellRangeListSources;// information about controls bound to spreadsheet cell range list sources
87 : :
88 : : ::std::vector< ModelStringPair >
89 : : m_aXFormsValueBindings; // collect xforms:bind attributes to be resolved
90 : :
91 : : ::std::vector< ModelStringPair >
92 : : m_aXFormsListBindings; // collect forms:xforms-list-source attributes to be resolved
93 : :
94 : : ::std::vector< ModelStringPair >
95 : : m_aXFormsSubmissions; // collect xforms:submission attributes to be resolved
96 : :
97 : : public:
98 : : // IControlIdMap
99 : : void registerControlId(
100 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
101 : : const ::rtl::OUString& _rId);
102 : : void registerControlReferences(
103 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
104 : : const ::rtl::OUString& _rReferringControls);
105 : :
106 : : // OFormLayerXMLImport_Impl
107 : 140 : inline OAttribute2Property& getAttributeMap() { return m_aAttributeMetaData; }
108 : 770 : inline SvXMLImport& getGlobalContext() { return m_rImporter; }
109 : : const SvXMLStyleContext* getStyleElement(const ::rtl::OUString& _rStyleName) const;
110 : : void enterEventContext();
111 : : void leaveEventContext();
112 : : void applyControlNumberStyle(
113 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
114 : : const ::rtl::OUString& _rControlNumerStyleName
115 : : );
116 : : void registerCellValueBinding(
117 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
118 : : const ::rtl::OUString& _rCellAddress
119 : : );
120 : :
121 : : void registerCellRangeListSource(
122 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
123 : : const ::rtl::OUString& _rCellRangeAddress
124 : : );
125 : :
126 : : void registerXFormsValueBinding(
127 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
128 : : const ::rtl::OUString& _rBindingID
129 : : );
130 : :
131 : : void registerXFormsListBinding(
132 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
133 : : const ::rtl::OUString& _rBindingID
134 : : );
135 : :
136 : : void registerXFormsSubmission(
137 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
138 : : const ::rtl::OUString& _rSubmissionID
139 : : );
140 : :
141 : : protected:
142 : : OFormLayerXMLImport_Impl(SvXMLImport& _rImporter);
143 : : virtual ~OFormLayerXMLImport_Impl();
144 : :
145 : : /** start importing the forms of the given page
146 : : */
147 : : void startPage(
148 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
149 : :
150 : : /** end importing the forms of the current page
151 : : */
152 : : void endPage();
153 : :
154 : : /** creates an import context for the office:forms element
155 : : */
156 : : SvXMLImportContext* createOfficeFormsContext(
157 : : SvXMLImport& _rImport,
158 : : sal_uInt16 _nPrefix,
159 : : const rtl::OUString& _rLocalName);
160 : :
161 : : /** create an <type>SvXMLImportContext</type> instance which is able to import the <form:form>
162 : : element.
163 : : */
164 : : SvXMLImportContext* createContext(
165 : : const sal_uInt16 _nPrefix,
166 : : const rtl::OUString& _rLocalName,
167 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttribs);
168 : :
169 : : /** get the control with the given id
170 : : */
171 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
172 : : lookupControlId(const ::rtl::OUString& _rControlId);
173 : :
174 : : /** announces the auto-style context to the form importer
175 : : */
176 : : void setAutoStyleContext(SvXMLStylesContext* _pNewContext);
177 : :
178 : : /** to be called when the document has been completely imported
179 : :
180 : : <p>For some documents (currently: only some spreadsheet documents) it's necessary
181 : : do to a post processing, since not all information from the file can be processed
182 : : if the document is not completed, yet.</p>
183 : : */
184 : : void documentDone( );
185 : : };
186 : :
187 : : //.........................................................................
188 : : } // namespace xmloff
189 : : //.........................................................................
190 : :
191 : : #endif // _XMLOFF_FORMS_LAYERIMPORT_HXX_
192 : :
193 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|