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 <rtl/ustring.hxx>
26 #include <salhelper/simplereferenceobject.hxx>
29 namespace com::sun::star::awt
{
33 namespace com::sun::star::drawing
{ class XDrawPage
; }
34 namespace com::sun::star::beans
{ class XPropertySet
; }
35 namespace com::sun::star::uno
{ template <typename
> class Reference
; }
43 class OFormLayerXMLExport_Impl
;
44 class OFormsRootExport
;
47 //= OFormLayerXMLExport
49 /** provides functionality for exporting a complete form layer.
51 class XMLOFF_DLLPUBLIC OFormLayerXMLExport final
52 :public ::salhelper::SimpleReferenceObject
55 std::unique_ptr
<OFormLayerXMLExport_Impl
> m_pImpl
;
57 SAL_DLLPRIVATE
virtual ~OFormLayerXMLExport() override
;
60 SAL_DLLPRIVATE
OFormLayerXMLExport(SvXMLExport
& _rContext
);
62 /** initializes some internal structures for fast access to the given page
64 <p>This method has to be called before you use getControlId for controls on the given page.
65 This way a performance optimization can be done for faster access to the control ids</p>
68 <TRUE/> if the page has been examined before. If <FALSE/> is returned, this is a serious error.
74 const css::uno::Reference
< css::drawing::XDrawPage
>& _rxDrawPage
);
76 /** get the id for the given control
78 <p>The page the control belongs to must have been examined and sought to.</p>
81 the control which's id should be retrieved. Must not be <NULL/>.
87 SAL_DLLPRIVATE OUString
getControlId(
88 const css::uno::Reference
< css::beans::XPropertySet
>& _rxControl
);
90 /** retrieves the style name for the control's number style.
92 <p>For performance reasons, this method is allowed to be called for any controls, even those which
93 do not have a number style. In this case, an empty string is returned.</p>
96 the control which's id should be retrieved. Must not be <NULL/>.
101 SAL_DLLPRIVATE OUString
getControlNumberStyle(
102 const css::uno::Reference
< css::beans::XPropertySet
>& _rxControl
);
104 /** examines the forms collection given.
106 <p>This method will collect all form layer related data of the given draw page</p>
109 the draw page to examine. The object will be queried for a com.sun.star.form::XFormsSupplier
110 interface to obtain the forms container.
112 void examineForms(const css::uno::Reference
< css::drawing::XDrawPage
>& _rxDrawPage
);
114 /** exports the structure of a form layer
116 <p>This method does not export styles (e.g. font properties of the controls), or any references
117 external instances may have to the control models contained in the form layer (e.g. uno control
118 shapes in the drawing layer may have such references)</p>
120 <p>No top level element describing the whole collection is inserted. I.e. if within your document, you
121 expect the forms collection to be stored like
124 ... // all the forms stuff here
127 you have to start the Forms element yourself.</p>
130 the draw page to examine. The object will be queried for a com.sun.star.form::XFormsSupplier
131 interface to obtain the forms container.
133 void exportForms(const css::uno::Reference
< css::drawing::XDrawPage
>& _rxDrawPage
);
135 /** exports the XForms model data
137 void exportXForms() const;
139 /** determines whether the given page contains logical forms
141 static bool pageContainsForms( const css::uno::Reference
< css::drawing::XDrawPage
>& _rxDrawPage
);
143 /** determines whether the given page contains XForm instances
145 bool documentContainsXForms() const;
147 /** exports the automatic controls number styles
149 SAL_DLLPRIVATE
void exportAutoControlNumberStyles();
151 /** exports the auto-styles collected during the examineForms calls
153 void exportAutoStyles();
155 /** exclude the given control (model) from export.
157 <p>If your document contains form controls which are not to be exported for whatever reason,
158 you need to announce the models of these controls (can be retrieved from XControlShape::getControl)
159 to the form layer exporter.<br/>
160 Of course you have to do this before calling <member>exportForms</member></p>
162 SAL_DLLPRIVATE
void excludeFromExport( const css::uno::Reference
< css::awt::XControlModel
>& _rxControl
);
166 //= OOfficeFormsExport
168 /// export helper for the office::forms element
169 class XMLOFF_DLLPUBLIC OOfficeFormsExport
172 std::unique_ptr
<OFormsRootExport
> m_pImpl
;
175 OOfficeFormsExport( SvXMLExport
& _rExp
);
176 ~OOfficeFormsExport();
180 } // namespace xmloff
183 #endif // INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */