1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #ifndef INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX 21 #define INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX 22 23 #include <sal/config.h> 24 #include <xmloff/dllapi.h> 25 #include <rtl/ustring.hxx> 26 #include <salhelper/simplereferenceobject.hxx> 27 #include <memory> 28 29 namespace com::sun::star::awt { 30 class XControlModel; 31 } 32 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; } 36 37 class SvXMLExport; 38 39 namespace xmloff 40 { 41 42 43 class OFormLayerXMLExport_Impl; 44 class OFormsRootExport; 45 46 47 //= OFormLayerXMLExport 48 49 /** provides functionality for exporting a complete form layer. 50 */ 51 class XMLOFF_DLLPUBLIC OFormLayerXMLExport final 52 :public ::salhelper::SimpleReferenceObject 53 { 54 // impl class 55 std::unique_ptr<OFormLayerXMLExport_Impl> m_pImpl; 56 57 virtual ~OFormLayerXMLExport() override; 58 59 public: 60 OFormLayerXMLExport(SvXMLExport& _rContext); 61 62 /** initializes some internal structures for fast access to the given page 63 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> 66 67 @return 68 <TRUE/> if the page has been examined before. If <FALSE/> is returned, this is a serious error. 69 70 @see getControlId 71 @see examineForms 72 */ 73 bool seekPage( 74 const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage); 75 76 /** get the id for the given control 77 78 <p>The page the control belongs to must have been examined and sought to.</p> 79 80 @param _rxControl 81 the control which's id should be retrieved. Must not be <NULL/>. 82 83 @see examineForms 84 @see seekPage 85 86 */ 87 OUString getControlId( 88 const css::uno::Reference< css::beans::XPropertySet >& _rxControl); 89 90 /** retrieves the style name for the control's number style. 91 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> 94 95 @param _rxControl 96 the control which's id should be retrieved. Must not be <NULL/>. 97 98 @see examineForms 99 @see seekPage 100 */ 101 OUString getControlNumberStyle( 102 const css::uno::Reference< css::beans::XPropertySet >& _rxControl ); 103 104 /** examines the forms collection given. 105 106 <p>This method will collect all form layer related data of the given draw page</p> 107 108 @param _rxDrawPage 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. 111 */ 112 void examineForms(const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage); 113 114 /** exports the structure of a form layer 115 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> 119 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 122 <listing> 123 <Forms> 124 ... // all the forms stuff here 125 </Forms> 126 </listing> 127 you have to start the Forms element yourself.</p> 128 129 @param _rxDrawPage 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. 132 */ 133 void exportForms(const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage); 134 135 /** exports the XForms model data 136 */ 137 void exportXForms() const; 138 139 /** determines whether the given page contains logical forms 140 */ 141 static bool pageContainsForms( const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage ); 142 143 /** determines whether the given page contains XForm instances 144 */ 145 bool documentContainsXForms() const; 146 147 /** exports the automatic controls number styles 148 */ 149 void exportAutoControlNumberStyles(); 150 151 /** exports the auto-styles collected during the examineForms calls 152 */ 153 void exportAutoStyles(); 154 155 /** exclude the given control (model) from export. 156 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> 161 */ 162 void excludeFromExport( const css::uno::Reference< css::awt::XControlModel >& _rxControl ); 163 }; 164 165 166 //= OOfficeFormsExport 167 168 /// export helper for the office::forms element 169 class XMLOFF_DLLPUBLIC OOfficeFormsExport 170 { 171 private: 172 std::unique_ptr<OFormsRootExport> m_pImpl; 173 174 public: 175 OOfficeFormsExport( SvXMLExport& _rExp ); 176 ~OOfficeFormsExport(); 177 }; 178 179 180 } // namespace xmloff 181 182 183 #endif // INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX 184 185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 186