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>
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
36namespace xmloff
37{
38
39 //= OElementExport
41 {
42 css::uno::Sequence< css::script::ScriptEventDescriptor >
44
45 std::unique_ptr<SvXMLElementExport> m_pXMLElement; // XML element doing the concrete startElement etc.
46
47 public:
49 const css::uno::Reference< css::beans::XPropertySet >& _rxProps,
50 const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rEvents);
51 virtual ~OElementExport();
52
53 void doExport();
54
55 protected:
57 virtual const char* getXMLElementName() const = 0;
59 virtual void examine();
61 virtual void exportAttributes();
63 virtual void exportSubTags();
64
67 void exportEvents();
68
71 virtual void exportServiceNameAttribute();
72
74 virtual void implStartElement(const char* _pName);
75
77 virtual void implEndElement();
78 };
79
80 //= OControlExport
84 :public OControlElement
86 ,public OElementExport
87 {
88 protected:
90 // used below
91
92 OUString m_sControlId; // the control id to use when exporting
93 OUString m_sReferringControls; // list of referring controls (i.e. their id's)
94 sal_Int16 m_nClassId; // class id of the control we're representing
95 ElementType m_eType; // (XML) type of the control we're representing
96 CCAFlags m_nIncludeCommon; // common control attributes to include
97 DAFlags m_nIncludeDatabase; // common database attributes to include
98 SCAFlags m_nIncludeSpecial; // special attributes to include
99 EAFlags m_nIncludeEvents; // events to include
100 BAFlags m_nIncludeBindings; // binding attributes to include
101
102 std::unique_ptr<SvXMLElementExport> m_pOuterElement; // XML element doing the concrete startElement etc. for the outer element
103
104 public:
117 const css::uno::Reference< css::beans::XPropertySet >& _rxControl,
118 OUString _sControlId,
119 OUString _sReferringControls,
120 const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents);
121
122 protected:
124 virtual void implStartElement(const char* _pName) override;
125
127 virtual void implEndElement() override;
128
130 virtual const char* getOuterXMLElementName() const;
131
132 // get the name of the XML element
133 virtual const char* getXMLElementName() const override;
134
137 virtual void examine() override;
138
141
144
146 virtual void exportAttributes() override;
147
150 void exportSubTags() override;
151
158
164
170
175
179
193
199
206 void getSequenceInt16PropertyAsSet(const OUString& _rPropertyName, Int16Set& _rOut);
207
211 void exportCellBindingAttributes( bool _bIncludeListLinkageType );
212
215
219
222
227
231
239 bool controlHasActiveDataBinding() const;
240
243 OUString getScalarListSourceValue() const;
244
256 };
257
258 //= OColumnExport
262 {
263 public:
268 const css::uno::Reference< css::beans::XPropertySet >& _rxControl,
269 const OUString& _rControlId,
270 const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents);
271
272 virtual ~OColumnExport() override;
273
274 protected:
275 // OControlExport overridables
276 virtual const char* getOuterXMLElementName() const override;
277 virtual void exportServiceNameAttribute() override;
278 virtual void exportAttributes() override;
279
280 // OElementExport overridables
281 virtual void examine() override;
282 };
283
284 //= OFormExport
291 :public OControlElement
292 ,public OElementExport
293 {
295 public:
299 const css::uno::Reference< css::beans::XPropertySet >& _rxForm,
300 const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents
301 );
302
303 protected:
304 virtual const char* getXMLElementName() const override;
305 virtual void exportSubTags() override;
306 virtual void exportAttributes() override;
307 };
308} // namespace xmloff
309
310/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class for exporting a grid column.
virtual void examine() override
examine the control.
OColumnExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxControl, const OUString &_rControlId, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rxEvents)
ctor
virtual void exportServiceNameAttribute() override
add the service-name attribute to the export context
virtual ~OColumnExport() override
virtual const char * getOuterXMLElementName() const override
get the name of the outer XML element
virtual void exportAttributes() override
export the attributes
helper for translating between control types and XML tags
Helper class for handling xml elements representing a form control.
void exportCellBindingAttributes(bool _bIncludeListLinkageType)
exports the attribute which descrives a cell value binding of a control in a spreadsheet document
o3tl::sorted_vector< sal_Int16 > Int16Set
bool controlHasActiveDataBinding() const
determines whether the control we're exporting has an active data binding.
virtual void implEndElement() override
ends the XML element
void exportOuterAttributes()
exports the attributes for the outer element
std::unique_ptr< SvXMLElementExport > m_pOuterElement
void exportXFormsBindAttributes()
exports the attribute(s) which bind this control to XForms
virtual void implStartElement(const char *_pName) override
start the XML element
void exportXFormsListAttributes()
exports the attribute(s) which bind the list of a list control to XForms
void exportXFormsSubmissionAttributes()
exports the attribute(s) for an XForms submission
void getSequenceInt16PropertyAsSet(const OUString &_rPropertyName, Int16Set &_rOut)
gets a Sequence< sal_Int16 > property value as set of sal_Int16's
virtual void exportAttributes() override
export the attributes
void exportListSourceAsAttribute()
exports the ListSource property of a control as attribute
virtual const char * getXMLElementName() const override
get the name of the XML element
void exportSubTags() override
writes everything which needs to be represented as sub tag
void exportDatabaseAttributes()
adds database attributes to the XMLExport context given
void exportCommonControlAttributes()
adds common control attributes to the XMLExport context given
OControlExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxControl, OUString _sControlId, OUString _sReferringControls, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rxEvents)
constructs an object capable of exporting controls
bool controlHasUserSuppliedListEntries() const
determines whether the list entries (of a combo or list box) are supplied by the user
void exportBindingAttributes()
adds the XML attributes which are related to binding controls to external values and/or list sources
void exportListSourceAsElements()
exports the ListSource property of a control as XML elements
virtual void examine() override
examine the control.
void exportCellListSourceRange()
exports the attribute which descrives a cell range which acts as list source for a list-like control
void exportInnerAttributes()
exports the attributes for the inner element
virtual const char * getOuterXMLElementName() const
get the name of the outer XML element
void exportImagePositionAttributes()
exports the attribute(s) for the ImagePosition property
void exportGenericHandlerAttributes()
adds the attributes which are handled via generic IPropertyHandlers
void exportSpecialAttributes()
adds attributes which are special to a control type to the export context's attribute list
OUString getScalarListSourceValue() const
retrieves the string specifying the ListSource of a list or combo box
virtual void implEndElement()
ends the XML element
virtual void exportSubTags()
export any sub tags
void exportEvents()
exports the events (as script:events tag)
OElementExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxProps, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rEvents)
virtual void implStartElement(const char *_pName)
start the XML element
virtual void exportAttributes()
export the attributes
virtual const char * getXMLElementName() const =0
get the name of the XML element
std::unique_ptr< SvXMLElementExport > m_pXMLElement
virtual void examine()
examine the element we're exporting
css::uno::Sequence< css::script::ScriptEventDescriptor > m_aEvents
virtual void exportServiceNameAttribute()
add the service-name attribute to the export context
Helper class for handling xml elements representing a form.
virtual const char * getXMLElementName() const override
get the name of the XML element
virtual void exportSubTags() override
export any sub tags
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 exportAttributes() override
export the attributes
bool m_bCreateConnectionResourceElement
provides export related tools for attribute handling
SCAFlags
DAFlags
BAFlags
EAFlags
CCAFlags
ElementType