xref: /AOO41X/main/xmloff/inc/xmloff/formlayerimport.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_FORMLAYERIMPORT_HXX_
25 #define _XMLOFF_FORMLAYERIMPORT_HXX_
26 
27 #include "sal/config.h"
28 #include "xmloff/dllapi.h"
29 #include <vos/refernce.hxx>
30 #include <com/sun/star/drawing/XDrawPage.hpp>
31 #include <com/sun/star/xml/sax/XAttributeList.hpp>
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 #include <vos/ref.hxx>
34 #include <xmloff/xmlimppr.hxx>
35 
36 class SvXMLImport;
37 class SvXMLImportContext;
38 class SvXMLStylesContext;
39 class XMLPropStyleContext;
40 
41 //.........................................................................
42 namespace xmloff
43 {
44 //.........................................................................
45 
46     //=====================================================================
47     //= OFormLayerXMLImport
48     //=====================================================================
49     class OFormLayerXMLImport_Impl;
50     /** allows you to import a &lt;form:form&gt; element
51     */
52     class XMLOFF_DLLPUBLIC OFormLayerXMLImport
53                 :public ::vos::OReference
54     {
55         OFormLayerXMLImport_Impl*   m_pImpl;
56 
57     public:
58         OFormLayerXMLImport(SvXMLImport& _rImporter);
59         ~OFormLayerXMLImport();
60 
61         /** start importing the forms of the given page
62 
63             <p>starting the import of a new page (by using this method) invalidates the current page position
64             you may have set with <method>seekPage</method>.</p>
65 
66             @see endPage
67             @see seekPage
68         */
69         void startPage(
70             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
71 
72         /** creates an import context for the office:forms element
73         */
74         SvXMLImportContext* createOfficeFormsContext(
75             SvXMLImport& _rImport,
76             sal_uInt16 _nPrefix,
77             const rtl::OUString& _rLocalName);
78 
79         /** create an <type>SvXMLImportContext</type> instance which is able to import the &lt;form:form&gt;
80             element.
81 
82             <p>You must have called <method>startPage</method> before you can create such an import context.</p>
83 
84             @see startPage
85             @see endPage
86         */
87         SvXMLImportContext* createContext(
88             const sal_uInt16 _nPrefix,
89             const rtl::OUString& _rLocalName,
90             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttribs);
91 
92         /** lookup a control given by id.
93 
94             <p>The control must be part of the page which is currently beeing imported, or you must have used
95             seekPage for the page which the control belongs to.</p>
96 
97             <p>(And, of course, the control must have been imported already at the moment you call this.)</p>
98 
99             @see startPage
100             @see seekPage
101         */
102         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
103                 lookupControl(const ::rtl::OUString& _rId);
104 
105         /** end importing the forms of the current page
106 
107             <p>You must call this method if you want the import to be finished correctly. Without calling
108             it, you will lose information.</p>
109 
110             @see startPage
111             @see seekPage
112         */
113         void endPage();
114 
115         /** seek to the given page.
116 
117             <p>This method should be used if you want to call lookupControl outside of a startPage-endPage frame.</p>
118 
119             <p>You can't seek to a page which hasn't been imported yet. This means that you must have called
120             <method>endPage</method> for the page in question.</p>
121 
122             <p>The "current page" position you have set with this method is invalidated as soon as you call
123             <method>startPage</method> for a new page.</p>
124 
125             <p>You should not call seekPage while importing a page (i.e. between startPage and endPage). This will
126             smash this other page beeing imported (seeking back to it will not help you :).</p>
127 
128             @see lookupControl
129         */
130         void seekPage(
131             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
132 
133         /** announces the auto-style context to the form importer
134         */
135         void setAutoStyleContext(SvXMLStylesContext* _pNewContext);
136 
137         /** sets the given number style on the given control
138             @param _rxControlModel
139                 the control model which's style is to be set
140             @param _rControlNumerStyleName
141                 the style name for the control's number style
142         */
143         void applyControlNumberStyle(
144             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
145             const ::rtl::OUString& _rControlNumerStyleName
146         );
147 
148         /** to be called when the document has been completely imported
149 
150             <p>For some documents (currently: only some spreadsheet documents) it's necessary
151             do to a post processing, since not all information from the file can be processed
152             if the document is not completed, yet.</p>
153         */
154         void documentDone( );
155     };
156 
157 //.........................................................................
158 }   // namespace xmloff
159 //.........................................................................
160 
161 #endif // _XMLOFF_FORMLAYERIMPORT_HXX_
162 
163