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 #pragma once
21 
22 #include <sal/config.h>
23 
24 #include <memory>
25 #include <o3tl/sorted_vector.hxx>
26 
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
29 #include <xmloff/xmlexp.hxx>
30 #include "propertyexport.hxx"
31 #include "callbacks.hxx"
32 #include "controlelement.hxx"
33 #include "valueproperties.hxx"
34 
35 class SvXMLElementExport;
36 namespace xmloff
37 {
38 
39  //= OElementExport
41  {
42  protected:
43  css::uno::Sequence< css::script::ScriptEventDescriptor >
45 
46  std::unique_ptr<SvXMLElementExport> m_pXMLElement; // XML element doing the concrete startElement etc.
47 
48  public:
50  const css::uno::Reference< css::beans::XPropertySet >& _rxProps,
51  const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rEvents);
52  virtual ~OElementExport();
53 
54  void doExport();
55 
56  protected:
58  virtual const char* getXMLElementName() const = 0;
60  virtual void examine();
62  virtual void exportAttributes();
64  virtual void exportSubTags();
65 
68  void exportEvents();
69 
72  virtual void exportServiceNameAttribute();
73 
75  virtual void implStartElement(const char* _pName);
76 
78  virtual void implEndElement();
79  };
80 
81  //= OControlExport
85  :public OControlElement
87  ,public OElementExport
88  {
89  protected:
91  // used below
92 
93  OUString m_sControlId; // the control id to use when exporting
94  OUString m_sReferringControls; // list of referring controls (i.e. their id's)
95  sal_Int16 m_nClassId; // class id of the control we're representing
96  ElementType m_eType; // (XML) type of the control we're representing
97  CCAFlags m_nIncludeCommon; // common control attributes to include
98  DAFlags m_nIncludeDatabase; // common database attributes to include
99  SCAFlags m_nIncludeSpecial; // special attributes to include
100  EAFlags m_nIncludeEvents; // events to include
101  BAFlags m_nIncludeBindings; // binding attributes to include
102 
103  std::unique_ptr<SvXMLElementExport> m_pOuterElement; // XML element doing the concrete startElement etc. for the outer element
104 
105  public:
118  const css::uno::Reference< css::beans::XPropertySet >& _rxControl,
119  const OUString& _rControlId,
120  const OUString& _rReferringControls,
121  const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents);
122 
123  protected:
125  virtual void implStartElement(const char* _pName) override;
126 
128  virtual void implEndElement() override;
129 
131  virtual const char* getOuterXMLElementName() const;
132 
133  // get the name of the XML element
134  virtual const char* getXMLElementName() const override;
135 
138  virtual void examine() override;
139 
141  void exportOuterAttributes();
142 
144  void exportInnerAttributes();
145 
147  virtual void exportAttributes() override;
148 
151  void exportSubTags() override;
152 
159 
165 
171 
176 
180 
194 
200 
207  void getSequenceInt16PropertyAsSet(const OUString& _rPropertyName, Int16Set& _rOut);
208 
212  void exportCellBindingAttributes( bool _bIncludeListLinkageType );
213 
216 
220 
223 
228 
232 
240  bool controlHasActiveDataBinding() const;
241 
244  OUString getScalarListSourceValue() const;
245 
257  };
258 
259  //= OColumnExport
263  {
264  public:
269  const css::uno::Reference< css::beans::XPropertySet >& _rxControl,
270  const OUString& _rControlId,
271  const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents);
272 
273  virtual ~OColumnExport() override;
274 
275  protected:
276  // OControlExport overridables
277  virtual const char* getOuterXMLElementName() const override;
278  virtual void exportServiceNameAttribute() override;
279  virtual void exportAttributes() override;
280 
281  // OElementExport overridables
282  virtual void examine() override;
283  };
284 
285  //= OFormExport
292  :public OControlElement
293  ,public OElementExport
294  {
296  public:
299  OFormExport(IFormsExportContext& _rContext,
300  const css::uno::Reference< css::beans::XPropertySet >& _rxForm,
301  const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents
302  );
303 
304  protected:
305  virtual const char* getXMLElementName() const override;
306  virtual void exportSubTags() override;
307  virtual void exportAttributes() override;
308  };
309 } // namespace xmloff
310 
311 /* 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