LibreOffice Module xmloff (master)  1
elementexport.hxx
Go to the documentation of this file.
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_SOURCE_FORMS_ELEMENTEXPORT_HXX
21 #define INCLUDED_XMLOFF_SOURCE_FORMS_ELEMENTEXPORT_HXX
22 
23 #include <sal/config.h>
24 
25 #include <memory>
26 #include <o3tl/sorted_vector.hxx>
27 
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
30 #include <xmloff/xmlexp.hxx>
31 #include "propertyexport.hxx"
32 #include "callbacks.hxx"
33 #include "controlelement.hxx"
34 #include "valueproperties.hxx"
35 
36 class SvXMLElementExport;
37 namespace xmloff
38 {
39 
40  //= OElementExport
42  {
43  protected:
44  css::uno::Sequence< css::script::ScriptEventDescriptor >
46 
47  std::unique_ptr<SvXMLElementExport> m_pXMLElement; // XML element doing the concrete startElement etc.
48 
49  public:
51  const css::uno::Reference< css::beans::XPropertySet >& _rxProps,
52  const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rEvents);
53  virtual ~OElementExport();
54 
55  void doExport();
56 
57  protected:
59  virtual const char* getXMLElementName() const = 0;
61  virtual void examine();
63  virtual void exportAttributes();
65  virtual void exportSubTags();
66 
69  void exportEvents();
70 
73  virtual void exportServiceNameAttribute();
74 
76  virtual void implStartElement(const char* _pName);
77 
79  virtual void implEndElement();
80  };
81 
82  //= OControlExport
86  :public OControlElement
88  ,public OElementExport
89  {
90  protected:
92  // used below
93 
94  OUString m_sControlId; // the control id to use when exporting
95  OUString m_sReferringControls; // list of referring controls (i.e. their id's)
96  sal_Int16 m_nClassId; // class id of the control we're representing
97  ElementType m_eType; // (XML) type of the control we're representing
98  CCAFlags m_nIncludeCommon; // common control attributes to include
99  DAFlags m_nIncludeDatabase; // common database attributes to include
100  SCAFlags m_nIncludeSpecial; // special attributes to include
101  EAFlags m_nIncludeEvents; // events to include
102  BAFlags m_nIncludeBindings; // binding attributes to include
103 
104  std::unique_ptr<SvXMLElementExport> m_pOuterElement; // XML element doing the concrete startElement etc. for the outer element
105 
106  public:
119  const css::uno::Reference< css::beans::XPropertySet >& _rxControl,
120  const OUString& _rControlId,
121  const OUString& _rReferringControls,
122  const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents);
123 
124  protected:
126  virtual void implStartElement(const char* _pName) override;
127 
129  virtual void implEndElement() override;
130 
132  virtual const char* getOuterXMLElementName() const;
133 
134  // get the name of the XML element
135  virtual const char* getXMLElementName() const override;
136 
139  virtual void examine() override;
140 
142  void exportOuterAttributes();
143 
145  void exportInnerAttributes();
146 
148  virtual void exportAttributes() override;
149 
152  void exportSubTags() override;
153 
160 
166 
172 
177 
181 
195 
201 
208  void getSequenceInt16PropertyAsSet(const OUString& _rPropertyName, Int16Set& _rOut);
209 
213  void exportCellBindingAttributes( bool _bIncludeListLinkageType );
214 
217 
221 
224 
229 
233 
241  bool controlHasActiveDataBinding() const;
242 
245  OUString getScalarListSourceValue() const;
246 
258  };
259 
260  //= OColumnExport
264  {
265  public:
270  const css::uno::Reference< css::beans::XPropertySet >& _rxControl,
271  const OUString& _rControlId,
272  const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents);
273 
274  virtual ~OColumnExport() override;
275 
276  protected:
277  // OControlExport overridables
278  virtual const char* getOuterXMLElementName() const override;
279  virtual void exportServiceNameAttribute() override;
280  virtual void exportAttributes() override;
281 
282  // OElementExport overridables
283  virtual void examine() override;
284  };
285 
286  //= OFormExport
293  :public OControlElement
294  ,public OElementExport
295  {
297  public:
300  OFormExport(IFormsExportContext& _rContext,
301  const css::uno::Reference< css::beans::XPropertySet >& _rxForm,
302  const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents
303  );
304 
305  protected:
306  virtual const char* getXMLElementName() const override;
307  virtual void exportSubTags() override;
308  virtual void exportAttributes() override;
309  };
310 } // namespace xmloff
311 
312 #endif // INCLUDED_XMLOFF_SOURCE_FORMS_ELEMENTEXPORT_HXX
313 
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BAFlags
void exportXFormsSubmissionAttributes()
exports the attribute(s) for an XForms submission
DAFlags
OControlExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxControl, const OUString &_rControlId, const OUString &_rReferringControls, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rxEvents)
constructs an object capable of exporting controls
virtual void implStartElement(const char *_pName)
start the XML element
void exportDatabaseAttributes()
adds database attributes to the XMLExport context given
virtual void exportSubTags()
export any sub tags
void exportBindingAttributes()
adds the XML attributes which are related to binding controls to external values and/or list sources ...
virtual const char * getXMLElementName() const override
get the name of the XML element
OUString getScalarListSourceValue() const
retrieves the string specifying the ListSource of a list or combo box
SCAFlags
void exportCommonControlAttributes()
adds common control attributes to the XMLExport context given
o3tl::sorted_vector< sal_Int16 > Int16Set
provides export related tools for attribute handling
virtual void exportServiceNameAttribute()
add the service-name attribute to the export context
helper for translating between control types and XML tags
css::uno::Sequence< css::script::ScriptEventDescriptor > m_aEvents
void exportListSourceAsAttribute()
exports the ListSource property of a control as attribute
void exportOuterAttributes()
exports the attributes for the outer element
void exportSubTags() override
writes everything which needs to be represented as sub tag
virtual void exportSubTags() override
export any sub tags
virtual void exportAttributes() override
export the attributes
virtual void exportAttributes()
export the attributes
virtual const char * getOuterXMLElementName() const override
get the name of the outer XML element
std::unique_ptr< SvXMLElementExport > m_pXMLElement
virtual const char * getXMLElementName() const override
get the name of the XML element
CCAFlags
void exportXFormsBindAttributes()
exports the attribute(s) which bind this control to XForms
void exportImagePositionAttributes()
exports the attribute(s) for the ImagePosition property
virtual void exportAttributes() override
export the attributes
bool controlHasUserSuppliedListEntries() const
determines whether the list entries (of a combo or list box) are supplied by the user ...
virtual void implEndElement() override
ends the XML element
bool m_bCreateConnectionResourceElement
void exportXFormsListAttributes()
exports the attribute(s) which bind the list of a list control to XForms
void exportGenericHandlerAttributes()
adds the attributes which are handled via generic IPropertyHandlers
ElementType
virtual const char * getXMLElementName() const =0
get the name of the XML element
void exportCellBindingAttributes(bool _bIncludeListLinkageType)
exports the attribute which descrives a cell value binding of a control in a spreadsheet document ...
virtual void implStartElement(const char *_pName) override
start the XML element
void exportCellListSourceRange()
exports the attribute which descrives a cell range which acts as list source for a list-like control ...
virtual void implEndElement()
ends the XML element
Helper class for handling xml elements representing a form.
virtual ~OColumnExport() override
bool controlHasActiveDataBinding() const
determines whether the control we're exporting has an active data binding.
std::unique_ptr< SvXMLElementExport > m_pOuterElement
OElementExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxProps, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rEvents)
virtual void examine() override
examine the control.
virtual void exportAttributes() override
export the attributes
void exportInnerAttributes()
exports the attributes for the inner element
Helper class for handling xml elements representing a form control.
void getSequenceInt16PropertyAsSet(const OUString &_rPropertyName, Int16Set &_rOut)
gets a Sequence< sal_Int16 > property value as set of sal_Int16's
Helper class for exporting a grid column.
virtual const char * getOuterXMLElementName() const
get the name of the outer XML element
virtual void exportServiceNameAttribute() override
add the service-name attribute to the export context
OFormExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxForm, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rxEvents)
constructs an object capable of exporting controls
virtual void examine() override
examine the control.
void exportListSourceAsElements()
exports the ListSource property of a control as XML elements
void exportEvents()
exports the events (as script:events tag)
OColumnExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxControl, const OUString &_rControlId, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rxEvents)
ctor
void exportSpecialAttributes()
adds attributes which are special to a control type to the export context's attribute list ...
EAFlags
virtual void examine()
examine the element we're exporting