LibreOffice Module xmloff (master)  1
formcellbinding.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_FORMCELLBINDING_HXX
21 #define INCLUDED_XMLOFF_SOURCE_FORMS_FORMCELLBINDING_HXX
22 
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
25 #include <com/sun/star/table/CellAddress.hpp>
26 #include <com/sun/star/table/CellRangeAddress.hpp>
27 #include <com/sun/star/form/binding/XValueBinding.hpp>
28 #include <com/sun/star/form/binding/XListEntrySource.hpp>
29 #include <com/sun/star/frame/XModel.hpp>
30 
31 namespace xmloff
32 {
33 
34  //= FormCellBindingHelper
38  {
39  css::uno::Reference< css::beans::XPropertySet >
40  m_xControlModel; // the model we work for
41  css::uno::Reference< css::sheet::XSpreadsheetDocument >
42  m_xDocument; // the document where the model lives
43 
44  public:
49  static bool livesInSpreadsheetDocument(
50  const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel
51  );
52 
63  const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
64  const css::uno::Reference< css::frame::XModel >& _rxDocument
65  );
66 
71  css::uno::Reference< css::form::binding::XValueBinding >
73  const OUString& _rAddress,
74  bool _bUseIntegerBinding
75  ) const;
76 
79  css::uno::Reference< css::form::binding::XListEntrySource >
80  createCellListSourceFromStringAddress( const OUString& _rAddress ) const;
81 
92  const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
93  ) const;
94 
106  const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
107  ) const;
108 
111  css::uno::Reference< css::form::binding::XValueBinding >
112  getCurrentBinding( ) const;
113 
116  css::uno::Reference< css::form::binding::XListEntrySource >
117  getCurrentListSource( ) const;
118 
124  void setBinding(
125  const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
126  );
127 
133  void setListSource(
134  const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
135  );
136 
139  bool isCellBindingAllowed( ) const;
140 
143  static bool isCellBindingAllowed(
144  const css::uno::Reference< css::frame::XModel >& _rxDocument
145  );
146 
150  bool isListCellRangeAllowed( ) const;
151 
155  static bool isListCellRangeAllowed(
156  const css::uno::Reference< css::frame::XModel >& _rxDocument
157  );
158 
161  static bool isCellBinding(
162  const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
163  );
164 
168  static bool isCellIntegerBinding(
169  const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
170  );
171 
174  static bool isCellRangeListSource(
175  const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
176  );
177 
178  private:
182  const OUString& _rAddressDescription,
183  css::table::CellAddress& /* [out] */ _rAddress
184  ) const;
185 
189  const OUString& _rAddressDescription,
190  css::table::CellRangeAddress& /* [out] */ _rAddress
191  ) const;
192 
196  bool isSpreadsheetDocumentWhichSupplies( const OUString& _rService ) const;
197 
202  const css::uno::Reference< css::sheet::XSpreadsheetDocument >& _rxDocument,
203  const OUString& _rService
204  );
205 
208  static bool doesComponentSupport(
209  const css::uno::Reference< css::uno::XInterface >& _rxComponent,
210  const OUString& _rService
211  );
212 
223  css::uno::Reference< css::uno::XInterface >
225  const OUString& _rService,
226  const OUString& _rArgumentName,
227  const css::uno::Any& _rArgumentValue
228  ) const;
229 
251  const OUString& _rInputProperty,
252  const css::uno::Any& _rInputValue,
253  const OUString& _rOutputProperty,
254  css::uno::Any& _rOutputValue,
255  bool _bIsRange
256  ) const;
257  };
258 
259 } // namespace xmloff
260 
261 #endif // INCLUDED_XMLOFF_SOURCE_FORMS_FORMCELLBINDING_HXX
262 
263 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool isCellRangeListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource)
checks whether a given list source is a spreadsheet cell list source
css::uno::Reference< css::beans::XPropertySet > m_xControlModel
css::uno::Reference< css::uno::XInterface > createDocumentDependentInstance(const OUString &_rService, const OUString &_rArgumentName, const css::uno::Any &_rArgumentValue) const
uses the document (it's factory interface, respectively) to create a component instance ...
FormCellBindingHelper(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const css::uno::Reference< css::frame::XModel > &_rxDocument)
ctor
static bool livesInSpreadsheetDocument(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel)
determines whether the given control model lives in a spreadsheet document
css::uno::Reference< css::sheet::XSpreadsheetDocument > m_xDocument
encapsulates functionality related to binding a form control to a spreadsheet cell ...
static bool isCellBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
checks whether a given binding is a spreadsheet cell binding
css::uno::Reference< css::form::binding::XValueBinding > createCellBindingFromStringAddress(const OUString &_rAddress, bool _bUseIntegerBinding) const
gets a cell binding for the given address isCellBindingAllowed returns
void setBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
sets a new binding for our control model the control model is bindable (which is implied by ...
static bool isCellIntegerBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
checks whether a given binding is a spreadsheet cell binding, exchanging integer values ...
bool convertStringAddress(const OUString &_rAddressDescription, css::table::CellAddress &_rAddress) const
creates an address object from a string representation of a cell address
css::uno::Reference< css::form::binding::XListEntrySource > createCellListSourceFromStringAddress(const OUString &_rAddress) const
gets a cell range list source binding for the given address
bool isSpreadsheetDocumentWhichSupplies(const OUString &_rService) const
determines if our document is a spreadsheet document, and can supply the given service ...
css::uno::Reference< css::form::binding::XListEntrySource > getCurrentListSource() const
returns the current external list source of the control model, if any
OUString getStringAddressFromCellListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource) const
creates a string representation for the given list source's range address
bool doConvertAddressRepresentations(const OUString &_rInputProperty, const css::uno::Any &_rInputValue, const OUString &_rOutputProperty, css::uno::Any &_rOutputValue, bool _bIsRange) const
converts an address representation into another one
OUString getStringAddressFromCellBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding) const
creates a string representation for the given value binding's address
void setListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource)
sets a list source for our control model the control model is a list sink (which is implied by
static bool doesComponentSupport(const css::uno::Reference< css::uno::XInterface > &_rxComponent, const OUString &_rService)
checks whether a given component supports a given service
bool isListCellRangeAllowed() const
checks whether it's possible to bind the control model to a range of spreadsheet cells supplying the ...
css::uno::Reference< css::form::binding::XValueBinding > getCurrentBinding() const
returns the current binding of our control model, if any.
bool isCellBindingAllowed() const
checks whether it's possible to bind the control model to a spreadsheet cell