LibreOffice Module extensions (master) 1
cellbindinghelper.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/frame/XModel.hpp>
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/sheet/XSpreadsheet.hpp>
30
31
32namespace pcr
33{
34
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:
50 const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel,
51 const css::uno::Reference< css::frame::XModel >& _rxContextDocument
52 );
53
59 static bool isSpreadsheetDocument(
60 const css::uno::Reference< css::frame::XModel >& _rxContextDocument
61 );
62
67 css::uno::Reference< css::form::binding::XValueBinding >
69 const OUString& _rAddress,
70 bool _bSupportIntegerExchange
71 ) const;
72
76 css::uno::Reference< css::form::binding::XValueBinding >
78 const css::table::CellAddress& _rAddress,
79 bool _bSupportIntegerExchange
80 ) const;
81
84 css::uno::Reference< css::form::binding::XListEntrySource >
85 createCellListSourceFromStringAddress( const OUString& _rAddress ) const;
86
97 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
98 ) const;
99
109 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding,
110 css::table::CellAddress& _rAddress
111 ) const;
112
124 const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
125 ) const;
126
129 css::uno::Reference< css::form::binding::XValueBinding >
130 getCurrentBinding( ) const;
131
134 css::uno::Reference< css::form::binding::XListEntrySource >
135 getCurrentListSource( ) const;
136
142 void setBinding(
143 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
144 );
145
151 void setListSource(
152 const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
153 );
154
157 bool isCellBindingAllowed( ) const;
158
162 bool isCellIntegerBindingAllowed( ) const;
163
167 bool isListCellRangeAllowed( ) const;
168
171 static bool isCellBinding(
172 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
173 );
174
178 static bool isCellIntegerBinding(
179 const css::uno::Reference< css::form::binding::XValueBinding >& _rxBinding
180 );
181
184 static bool isCellRangeListSource(
185 const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource
186 );
187
191 sal_Int16 getControlSheetIndex(
192 css::uno::Reference< css::sheet::XSpreadsheet >& _out_rxSheet
193 ) const;
194
195 private:
199 const OUString& _rAddressDescription,
200 css::table::CellAddress& /* [out] */ _rAddress
201 ) const;
202
206 const OUString& _rAddressDescription,
207 css::table::CellRangeAddress& /* [out] */ _rAddress
208 ) const;
209
213 bool isSpreadsheetDocumentWhichSupplies( const OUString& _rService ) const;
214
217 static bool doesComponentSupport(
218 const css::uno::Reference< css::uno::XInterface >& _rxComponent,
219 const OUString& _rService
220 );
221
232 css::uno::Reference< css::uno::XInterface >
234 const OUString& _rService,
235 const OUString& _rArgumentName,
236 const css::uno::Any& _rArgumentValue
237 ) const;
238
260 const OUString& _rInputProperty,
261 const css::uno::Any& _rInputValue,
262 const OUString& _rOutputProperty,
263 css::uno::Any& _rOutputValue,
264 bool _bIsRange
265 ) const;
266 };
267
268
269} // namespace pcr
270
271
272/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
encapsulates functionality related to binding a form control to a spreadsheet cell
sal_Int16 getControlSheetIndex(css::uno::Reference< css::sheet::XSpreadsheet > &_out_rxSheet) const
retrieves the index of the sheet which our control belongs to
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
static bool isCellRangeListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource)
checks whether a given list source is a spreadsheet cell list source
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 _bSupportIntegerExchange) const
gets a cell binding for the given address @precond isCellBindingAllowed returns <TRUE>
css::uno::Reference< css::form::binding::XValueBinding > getCurrentBinding() const
returns the current binding of our control model, if any.
bool isCellIntegerBindingAllowed() const
checks whether it's possible to bind the control model to a spreadsheet cell, with exchanging integer...
static bool isCellBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
checks whether a given binding is a spreadsheet cell binding
bool getAddressFromCellBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding, css::table::CellAddress &_rAddress) const
creates an address object for the given value binding's 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
bool isCellBindingAllowed() const
checks whether it's possible to bind the control model to a spreadsheet cell
static bool doesComponentSupport(const css::uno::Reference< css::uno::XInterface > &_rxComponent, const OUString &_rService)
checks whether a given component supports a given service
static bool isSpreadsheetDocument(const css::uno::Reference< css::frame::XModel > &_rxContextDocument)
determines whether the given model is a spreadsheet document model
bool isSpreadsheetDocumentWhichSupplies(const OUString &_rService) const
determines if our document is a spreadsheet document, and can supply the given service
bool convertStringAddress(const OUString &_rAddressDescription, css::table::CellRangeAddress &_rAddress) const
creates an address range object from a string representation of a cell range address
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 ...
css::uno::Reference< css::form::binding::XValueBinding > createCellBindingFromAddress(const css::table::CellAddress &_rAddress, bool _bSupportIntegerExchange) const
creates a cell binding (supporting integer exchange, if requested) for the given address object
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
css::uno::Reference< css::form::binding::XListEntrySource > getCurrentListSource() const
returns the current external list source of the control model, if any
CellBindingHelper(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const css::uno::Reference< css::frame::XModel > &_rxContextDocument)
ctor
css::uno::Reference< css::sheet::XSpreadsheetDocument > m_xDocument
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 ...
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 convertStringAddress(const OUString &_rAddressDescription, css::table::CellAddress &_rAddress) const
creates an address object from a string representation of a cell address
bool isListCellRangeAllowed() const
checks whether it's possible to bind the control model to range of spreadsheet cells supplying the li...
css::uno::Reference< css::beans::XPropertySet > m_xControlModel
css::uno::Reference< css::form::binding::XListEntrySource > createCellListSourceFromStringAddress(const OUString &_rAddress) const
gets a cell range list source binding for the given address
a property handler for any virtual string properties
Definition: browserline.cxx:39