LibreOffice Module xmloff (master)  1
layerimport.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 <map>
25 #include <unordered_map>
26 
27 #include <com/sun/star/xml/sax/XAttributeList.hpp>
28 #include <com/sun/star/drawing/XDrawPage.hpp>
29 #include <com/sun/star/form/XFormsSupplier2.hpp>
30 #include <rtl/ref.hxx>
31 #include "formattributes.hxx"
32 #include "eventimport.hxx"
33 
34 class SvXMLImport;
35 class SvXMLImportContext;
36 class SvXMLStyleContext;
37 class SvXMLStylesContext;
38 
39  // unfortunately, we can't put this into our namespace, as the macro expands to (amongst others) a forward
40  // declaration of the class name, which then would be in the namespace, too
41 
42 namespace xmloff
43 {
44 
45  class OAttribute2Property;
46 
47  //= OFormLayerXMLImport_Impl
50  {
51  friend class OFormLayerXMLImport;
52 
55 
57  css::uno::Reference< css::form::XFormsSupplier2 >
60 
61  typedef std::map< OUString, css::uno::Reference< css::beans::XPropertySet > > MapString2PropertySet;
62  typedef std::unordered_map<css::uno::Reference<css::drawing::XDrawPage>, MapString2PropertySet> MapDrawPage2Map;
63 
64  MapDrawPage2Map m_aControlIds; // ids of the controls on all known page
65  MapDrawPage2Map::iterator m_aCurrentPageIds; // ifs of the controls on the current page
66 
67  typedef ::std::pair< css::uno::Reference< css::beans::XPropertySet >, OUString >
69  ::std::vector< ModelStringPair >
70  m_aControlReferences; // control reference descriptions for current page
71  ::std::vector< ModelStringPair >
72  m_aCellValueBindings; // information about controls bound to spreadsheet cells
73  ::std::vector< ModelStringPair >
74  m_aCellRangeListSources;// information about controls bound to spreadsheet cell range list sources
75 
76  ::std::vector< ModelStringPair >
77  m_aXFormsValueBindings; // collect xforms:bind attributes to be resolved
78 
79  ::std::vector< ModelStringPair >
80  m_aXFormsListBindings; // collect forms:xforms-list-source attributes to be resolved
81 
82  ::std::vector< ModelStringPair >
83  m_aXFormsSubmissions; // collect xforms:submission attributes to be resolved
84 
85  public:
86  // IControlIdMap
87  void registerControlId(
88  const css::uno::Reference< css::beans::XPropertySet >& _rxControl,
89  const OUString& _rId);
91  const css::uno::Reference< css::beans::XPropertySet >& _rxControl,
92  const OUString& _rReferringControls);
93 
94  // OFormLayerXMLImport_Impl
97  const SvXMLStyleContext* getStyleElement(const OUString& _rStyleName) const;
98  void enterEventContext();
99  void leaveEventContext();
101  const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
102  const OUString& _rControlNumberStyleName
103  );
105  const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
106  const OUString& _rCellAddress
107  );
108 
110  const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
111  const OUString& _rCellRangeAddress
112  );
113 
115  const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
116  const OUString& _rBindingID
117  );
118 
120  const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
121  const OUString& _rBindingID
122  );
123 
125  const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
126  const OUString& _rSubmissionID
127  );
128 
129  ~OFormLayerXMLImport_Impl() override;
130 
131  private:
132  explicit OFormLayerXMLImport_Impl(SvXMLImport& _rImporter);
133 
136  void startPage(
137  const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage);
138 
141  void endPage();
142 
146  SvXMLImport& _rImport);
147 
152  sal_Int32 nElement,
153  const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttribs);
154 
157  css::uno::Reference< css::beans::XPropertySet >
158  lookupControlId(const OUString& _rControlId);
159 
162  void setAutoStyleContext(SvXMLStylesContext* _pNewContext);
163 
170  void documentDone( );
171  };
172 
173 } // namespace xmloff
174 
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void registerCellValueBinding(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rCellAddress)
void registerXFormsValueBinding(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rBindingID)
void endPage()
end importing the forms of the current page
void registerCellRangeListSource(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rCellRangeAddress)
some kind of opposite to the OAttributeMetaData class.
void setAutoStyleContext(SvXMLStylesContext *_pNewContext)
announces the auto-style context to the form importer
::std::vector< ModelStringPair > m_aXFormsValueBindings
Definition: layerimport.hxx:77
rtl::Reference< SvXMLStylesContext > m_xAutoStyles
Definition: layerimport.hxx:59
::std::vector< ModelStringPair > m_aXFormsListBindings
Definition: layerimport.hxx:80
std::unordered_map< css::uno::Reference< css::drawing::XDrawPage >, MapString2PropertySet > MapDrawPage2Map
Definition: layerimport.hxx:62
::std::vector< ModelStringPair > m_aCellRangeListSources
Definition: layerimport.hxx:74
void registerControlId(const css::uno::Reference< css::beans::XPropertySet > &_rxControl, const OUString &_rId)
::std::pair< css::uno::Reference< css::beans::XPropertySet >, OUString > ModelStringPair
Definition: layerimport.hxx:68
SvXMLImportContext * createContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxAttribs)
create an SvXMLImportContext instance which is able to import the element...
void registerControlReferences(const css::uno::Reference< css::beans::XPropertySet > &_rxControl, const OUString &_rReferringControls)
::std::vector< ModelStringPair > m_aCellValueBindings
Definition: layerimport.hxx:72
void registerXFormsSubmission(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rSubmissionID)
OAttribute2Property m_aAttributeMetaData
Definition: layerimport.hxx:54
void applyControlNumberStyle(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rControlNumberStyleName)
allows you to import a element
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
void documentDone()
to be called when the document has been completely imported
::std::vector< ModelStringPair > m_aControlReferences
Definition: layerimport.hxx:70
void startPage(const css::uno::Reference< css::drawing::XDrawPage > &_rxDrawPage)
start importing the forms of the given page
OAttribute2Property & getAttributeMap()
Definition: layerimport.hxx:95
static SvXMLImportContext * createOfficeFormsContext(SvXMLImport &_rImport)
creates an import context for the office:forms element
void registerXFormsListBinding(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rBindingID)
::std::vector< ModelStringPair > m_aXFormsSubmissions
Definition: layerimport.hxx:83
std::map< OUString, css::uno::Reference< css::beans::XPropertySet > > MapString2PropertySet
Definition: layerimport.hxx:61
MapDrawPage2Map::iterator m_aCurrentPageIds
Definition: layerimport.hxx:65
css::uno::Reference< css::form::XFormsSupplier2 > m_xCurrentPageFormsSupp
the supplier for the forms of the currently imported page
Definition: layerimport.hxx:58
OFormLayerXMLImport_Impl(SvXMLImport &_rImporter)
Definition: layerimport.cxx:64
css::uno::Reference< css::beans::XPropertySet > lookupControlId(const OUString &_rControlId)
get the control with the given id
const SvXMLStyleContext * getStyleElement(const OUString &_rStyleName) const