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#pragma once
21
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
24#include <com/sun/star/table/CellAddress.hpp>
25#include <com/sun/star/table/CellRangeAddress.hpp>
26#include <com/sun/star/form/binding/XValueBinding.hpp>
27#include <com/sun/star/form/binding/XListEntrySource.hpp>
28#include <com/sun/star/frame/XModel.hpp>
29
30namespace xmloff
31{
32
33 //= FormCellBindingHelper
37 {
38 css::uno::Reference< css::beans::XPropertySet >
39 m_xControlModel; // the model we work for
40 css::uno::Reference< css::sheet::XSpreadsheetDocument >
41 m_xDocument; // the document where the model lives
42
43 public:
49 const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel
50 );
51
62 const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
63 const css::uno::Reference< css::frame::XModel >& _rxDocument
64 );
65
70 css::uno::Reference< css::form::binding::XValueBinding >
72 const OUString& _rAddress,
73 bool _bUseIntegerBinding
74 ) const;
75
78 css::uno::Reference< css::form::binding::XListEntrySource >
79 createCellListSourceFromStringAddress( const OUString& _rAddress ) const;
80
91 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
92 ) const;
93
105 const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
106 ) const;
107
110 css::uno::Reference< css::form::binding::XValueBinding >
111 getCurrentBinding( ) const;
112
115 css::uno::Reference< css::form::binding::XListEntrySource >
116 getCurrentListSource( ) const;
117
123 void setBinding(
124 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
125 );
126
132 void setListSource(
133 const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
134 );
135
138 bool isCellBindingAllowed( ) const;
139
143 const css::uno::Reference< css::frame::XModel >& _rxDocument
144 );
145
149 bool isListCellRangeAllowed( ) const;
150
155 const css::uno::Reference< css::frame::XModel >& _rxDocument
156 );
157
160 static bool isCellBinding(
161 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
162 );
163
167 static bool isCellIntegerBinding(
168 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
169 );
170
173 static bool isCellRangeListSource(
174 const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
175 );
176
177 private:
181 const OUString& _rAddressDescription,
182 css::table::CellAddress& /* [out] */ _rAddress
183 ) const;
184
188 const OUString& _rAddressDescription,
189 css::table::CellRangeAddress& /* [out] */ _rAddress
190 ) const;
191
195 bool isSpreadsheetDocumentWhichSupplies( const OUString& _rService ) const;
196
201 const css::uno::Reference< css::sheet::XSpreadsheetDocument >& _rxDocument,
202 const OUString& _rService
203 );
204
207 static bool doesComponentSupport(
208 const css::uno::Reference< css::uno::XInterface >& _rxComponent,
209 const OUString& _rService
210 );
211
222 css::uno::Reference< css::uno::XInterface >
224 const OUString& _rService,
225 const OUString& _rArgumentName,
226 const css::uno::Any& _rArgumentValue
227 ) const;
228
250 const OUString& _rInputProperty,
251 const css::uno::Any& _rInputValue,
252 const OUString& _rOutputProperty,
253 css::uno::Any& _rOutputValue,
254 bool _bIsRange
255 ) const;
256 };
257
258} // namespace xmloff
259
260/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
encapsulates functionality related to binding a form control to a spreadsheet cell
bool convertStringAddress(const OUString &_rAddressDescription, css::table::CellAddress &_rAddress) const
creates an address object from a string representation of a cell address
bool isCellBindingAllowed() const
checks whether it's possible to bind the control model to a spreadsheet cell
static bool isListCellRangeAllowed(const css::uno::Reference< css::frame::XModel > &_rxDocument)
checks whether within the given document, it's possible to bind the control model to a range of sprea...
bool convertStringAddress(const OUString &_rAddressDescription, css::table::CellRangeAddress &_rAddress) const
creates an address range object from a string representation of a cell range address
css::uno::Reference< css::form::binding::XValueBinding > getCurrentBinding() const
returns the current binding of our 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
css::uno::Reference< css::form::binding::XListEntrySource > getCurrentListSource() const
returns the current external list source of the control model, if any
css::uno::Reference< css::beans::XPropertySet > m_xControlModel
void setBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
sets a new binding for our control model @precond the control model is bindable (which is implied by ...
static bool isCellRangeListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource)
checks whether a given list source is a spreadsheet cell list source
static bool livesInSpreadsheetDocument(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel)
determines whether the given control model lives in a spreadsheet document
bool isSpreadsheetDocumentWhichSupplies(const OUString &_rService) const
determines if our document is a spreadsheet document, and can supply the given service
static bool doesComponentSupport(const css::uno::Reference< css::uno::XInterface > &_rxComponent, const OUString &_rService)
checks whether a given component supports a given service
OUString getStringAddressFromCellBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding) const
creates a string representation for the given value binding's address
css::uno::Reference< css::form::binding::XValueBinding > createCellBindingFromStringAddress(const OUString &_rAddress, bool _bUseIntegerBinding) const
gets a cell binding for the given address @precond isCellBindingAllowed returns <TRUE>
static bool isCellBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
checks whether a given binding is a spreadsheet cell binding
FormCellBindingHelper(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const css::uno::Reference< css::frame::XModel > &_rxDocument)
ctor
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
css::uno::Reference< css::form::binding::XListEntrySource > createCellListSourceFromStringAddress(const OUString &_rAddress) const
gets a cell range list source binding for the given address
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
void setListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource)
sets a list source for our control model @precond the control model is a list sink (which is implied ...
static bool isCellBindingAllowed(const css::uno::Reference< css::frame::XModel > &_rxDocument)
checks whether within the given document, it's possible to bind control models to spreadsheet cells
static bool isSpreadsheetDocumentWhichSupplies(const css::uno::Reference< css::sheet::XSpreadsheetDocument > &_rxDocument, const OUString &_rService)
determines if our document is a spreadsheet document, and can supply the given service
css::uno::Reference< css::sheet::XSpreadsheetDocument > m_xDocument
bool isListCellRangeAllowed() const
checks whether it's possible to bind the control model to a range of spreadsheet cells supplying the ...
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