1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX
21 #define INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <com/sun/star/drawing/XDrawPage.hpp>
26 #include <com/sun/star/container/XIndexAccess.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/frame/XModel.hpp>
29 #include <rtl/ref.hxx>
30 #include <salhelper/simplereferenceobject.hxx>
31 #include <xmloff/xmlexppr.hxx>
33 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{
43 class OFormLayerXMLExport_Impl
;
44 class OFormsRootExport
;
47 //= OFormLayerXMLExport
49 /** provides functionallity for exporting a complete form layer.
51 class XMLOFF_DLLPUBLIC OFormLayerXMLExport
52 :public ::salhelper::SimpleReferenceObject
55 /// our export context
56 SvXMLExport
& m_rContext
;
58 OFormLayerXMLExport_Impl
* m_pImpl
;
61 virtual ~OFormLayerXMLExport();
64 OFormLayerXMLExport(SvXMLExport
& _rContext
);
66 /** initializes some internal structures for fast access to the given page
68 <p>This method has to be called before you use getControlId for controls on the given page.
69 This way a performance optimization can be done for faster access to the control ids</p>
72 <TRUE/> if the page has been examined before. If <FALSE/> is returned, this is a serious error.
78 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& _rxDrawPage
);
80 /** get the id for the given control
82 <p>The page the control belongs to must have been examined and sought to.</p>
85 the control which's id should be retrieved. Must not be <NULL/>.
91 OUString
getControlId(
92 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxControl
);
94 /** retrieves the style name for the control's number style.
96 <p>For performance reasons, this method is allowed to be called for any controls, even those which
97 do not have a number style. In this case, an empty string is returned.</p>
100 the control which's id should be retrieved. Must not be <NULL/>.
105 OUString
getControlNumberStyle(
106 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxControl
);
108 /** examines the forms collection given.
110 <p>This method will collect all form layer related data of the given draw page</p>
113 the draw page to examine. The object will be queried for a com.sun.star.form::XFormsSupplier
114 interface to obtain the forms container.
116 void examineForms(const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& _rxDrawPage
);
118 /** exports the structure of a form layer
120 <p>This method does not export styles (e.g. font properties of the controls), or any references
121 external instances may have to the control models contained in the form layer (e.g. uno control
122 shapes in the drawing layer may have such references)</p>
124 <p>No top level element describing the whole collection is inserted. I.e. if within your document, you
125 expect the forms collection to be stored like
128 .... // all the forms stuff here
131 you have to start the Forms element yourself.</p>
134 the draw page to examine. The object will be queried for a com.sun.star.form::XFormsSupplier
135 interface to obtain the forms container.
137 void exportForms(const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& _rxDrawPage
);
139 /** exports the XForms model data
141 void exportXForms() const;
143 /** determines whether the given page contains logical forms
145 static bool pageContainsForms( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& _rxDrawPage
);
147 /** determines whether the given page contains XForm instances
149 bool documentContainsXForms() const;
151 /** exports the automatic controls number styles
153 void exportAutoControlNumberStyles();
155 /** exports the auto-styles collected during the examineForms calls
157 void exportAutoStyles();
159 /** exclude the given control (model) from export.
161 <p>If your document contains form controls which are not to be exported for whatever reason,
162 you need to announce the models of these controls (can be retrieved from XControlShape::getControl)
163 to the form layer exporter.<br/>
164 Of course you have to do this before calling <member>exportForms</member></p>
166 void excludeFromExport( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& _rxControl
);
170 //= OOfficeFormsExport
172 /// export helper for the office::forms element
173 class XMLOFF_DLLPUBLIC OOfficeFormsExport
176 OFormsRootExport
* m_pImpl
;
179 OOfficeFormsExport( SvXMLExport
& _rExp
);
180 ~OOfficeFormsExport();
184 } // namespace xmloff
187 #endif // INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */