LibreOffice Module xmloff (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
xmloff::FormCellBindingHelper Class Reference

encapsulates functionality related to binding a form control to a spreadsheet cell More...

#include <formcellbinding.hxx>

Public Member Functions

 FormCellBindingHelper (const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const css::uno::Reference< css::frame::XModel > &_rxDocument)
 ctor More...
 
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> More...
 
css::uno::Reference< css::form::binding::XListEntrySource > createCellListSourceFromStringAddress (const OUString &_rAddress) const
 gets a cell range list source binding for the given address More...
 
OUString getStringAddressFromCellBinding (const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding) const
 creates a string representation for the given value binding's address More...
 
OUString getStringAddressFromCellListSource (const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource) const
 creates a string representation for the given list source's range address More...
 
css::uno::Reference< css::form::binding::XValueBinding > getCurrentBinding () const
 returns the current binding of our control model, if any. More...
 
css::uno::Reference< css::form::binding::XListEntrySource > getCurrentListSource () const
 returns the current external list source of the control model, if any More...
 
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 <member>isCellBindingAllowed</member> returning <TRUE>) More...
 
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 by <member>isListCellRangeAllowed</member> returning <TRUE>) More...
 
bool isCellBindingAllowed () const
 checks whether it's possible to bind the control model to a spreadsheet cell More...
 
bool isListCellRangeAllowed () const
 checks whether it's possible to bind the control model to a range of spreadsheet cells supplying the list entries More...
 

Static Public Member Functions

static bool livesInSpreadsheetDocument (const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel)
 determines whether the given control model lives in a spreadsheet document More...
 
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 More...
 
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 spreadsheet cells supplying the list entries More...
 
static bool isCellBinding (const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
 checks whether a given binding is a spreadsheet cell binding More...
 
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 More...
 
static bool isCellRangeListSource (const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource)
 checks whether a given list source is a spreadsheet cell list source More...
 

Private Member Functions

bool convertStringAddress (const OUString &_rAddressDescription, css::table::CellAddress &_rAddress) const
 creates an address object from a string representation of a cell address More...
 
bool convertStringAddress (const OUString &_rAddressDescription, css::table::CellRangeAddress &_rAddress) const
 creates an address range object from a string representation of a cell range address More...
 
bool isSpreadsheetDocumentWhichSupplies (const OUString &_rService) const
 determines if our document is a spreadsheet document, and can supply the given service More...
 
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 More...
 
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 More...
 

Static Private Member Functions

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 More...
 
static bool doesComponentSupport (const css::uno::Reference< css::uno::XInterface > &_rxComponent, const OUString &_rService)
 checks whether a given component supports a given service More...
 

Private Attributes

css::uno::Reference< css::beans::XPropertySetm_xControlModel
 
css::uno::Reference< css::sheet::XSpreadsheetDocument > m_xDocument
 

Detailed Description

encapsulates functionality related to binding a form control to a spreadsheet cell

Definition at line 36 of file formcellbinding.hxx.

Constructor & Destructor Documentation

◆ FormCellBindingHelper()

xmloff::FormCellBindingHelper::FormCellBindingHelper ( const css::uno::Reference< css::beans::XPropertySet > &  _rxControlModel,
const css::uno::Reference< css::frame::XModel > &  _rxDocument 
)

ctor

Parameters
_rxControlModelthe control model which is or will be bound
_rxDocumentthe document. If this is <NULL>, the document will be obtained from the model itself by walk on up the chain of its ancestors.
This parameter can be used if the control model is not (yet) part of a document model.

Definition at line 94 of file formcellbinding.cxx.

References m_xControlModel, m_xDocument, and m_xDocument.

Member Function Documentation

◆ convertStringAddress() [1/2]

bool xmloff::FormCellBindingHelper::convertStringAddress ( const OUString &  _rAddressDescription,
css::table::CellAddress &  _rAddress 
) const
private

creates an address object from a string representation of a cell address

Referenced by createCellBindingFromStringAddress(), and createCellListSourceFromStringAddress().

◆ convertStringAddress() [2/2]

bool xmloff::FormCellBindingHelper::convertStringAddress ( const OUString &  _rAddressDescription,
css::table::CellRangeAddress &  _rAddress 
) const
private

creates an address range object from a string representation of a cell range address

◆ createCellBindingFromStringAddress()

Reference< XValueBinding > xmloff::FormCellBindingHelper::createCellBindingFromStringAddress ( const OUString &  _rAddress,
bool  _bUseIntegerBinding 
) const

gets a cell binding for the given address @precond isCellBindingAllowed returns <TRUE>

Definition at line 138 of file formcellbinding.cxx.

References Any, convertStringAddress(), createDocumentDependentInstance(), m_xDocument, xmloff::PROPERTY_BOUND_CELL, xmloff::SERVICE_CELLVALUEBINDING, and xmloff::SERVICE_LISTINDEXCELLBINDING.

◆ createCellListSourceFromStringAddress()

Reference< XListEntrySource > xmloff::FormCellBindingHelper::createCellListSourceFromStringAddress ( const OUString &  _rAddress) const

gets a cell range list source binding for the given address

Definition at line 159 of file formcellbinding.cxx.

References Any, convertStringAddress(), createDocumentDependentInstance(), xmloff::PROPERTY_LIST_CELL_RANGE, and xmloff::SERVICE_CELLRANGELISTSOURCE.

◆ createDocumentDependentInstance()

Reference< XInterface > xmloff::FormCellBindingHelper::createDocumentDependentInstance ( const OUString &  _rService,
const OUString &  _rArgumentName,
const css::uno::Any &  _rArgumentValue 
) const
private

uses the document (it's factory interface, respectively) to create a component instance

Parameters
_rServicethe service name
_rArgumentNamethe name of the single argument to pass during creation. May be empty, in this case no arguments are passed
_rArgumentValuethe value of the instantiation argument. Not evaluated if <arg>_rArgumentName</arg> is empty.

Definition at line 367 of file formcellbinding.cxx.

References Any, Exception, and m_xDocument.

Referenced by createCellBindingFromStringAddress(), createCellListSourceFromStringAddress(), and doConvertAddressRepresentations().

◆ doConvertAddressRepresentations()

bool xmloff::FormCellBindingHelper::doConvertAddressRepresentations ( const OUString &  _rInputProperty,
const css::uno::Any &  _rInputValue,
const OUString &  _rOutputProperty,
css::uno::Any &  _rOutputValue,
bool  _bIsRange 
) const
private

converts an address representation into another one

Parameters
_rInputPropertythe input property name for the conversion service
_rInputValuethe input property value for the conversion service
_rOutputPropertythe output property name for the conversion service
_rOutputValuethe output property value for the conversion service
_bIsRangeif <TRUE>, the RangeAddressConversion service will be used, else the AddressConversion service
Returns
<TRUE> if any only if the conversion was successful
See also
css::table::CellAddressConversion
css::table::CellRangeAddressConversion

Definition at line 400 of file formcellbinding.cxx.

References Any, createDocumentDependentInstance(), Exception, xmloff::SERVICE_ADDRESS_CONVERSION, xmloff::SERVICE_RANGEADDRESS_CONVERSION, TOOLS_WARN_EXCEPTION, and xConverter.

Referenced by getStringAddressFromCellBinding(), and getStringAddressFromCellListSource().

◆ doesComponentSupport()

bool xmloff::FormCellBindingHelper::doesComponentSupport ( const css::uno::Reference< css::uno::XInterface > &  _rxComponent,
const OUString &  _rService 
)
staticprivate

checks whether a given component supports a given service

Definition at line 326 of file formcellbinding.cxx.

Referenced by isCellBinding(), isCellIntegerBinding(), and isCellRangeListSource().

◆ getCurrentBinding()

Reference< XValueBinding > xmloff::FormCellBindingHelper::getCurrentBinding ( ) const

returns the current binding of our control model, if any.

Definition at line 333 of file formcellbinding.cxx.

References m_xControlModel.

◆ getCurrentListSource()

Reference< XListEntrySource > xmloff::FormCellBindingHelper::getCurrentListSource ( ) const

returns the current external list source of the control model, if any

Definition at line 342 of file formcellbinding.cxx.

References m_xControlModel, and xSink.

◆ getStringAddressFromCellBinding()

OUString xmloff::FormCellBindingHelper::getStringAddressFromCellBinding ( const css::uno::Reference< css::form::binding::XValueBinding > &  _rxBinding) const

creates a string representation for the given value binding's address

If the sheet of the bound cell is the same as the sheet which our control belongs to, then the sheet name is omitted in the resulting string representation.

@precond The binding is a valid cell binding, or <NULL>

See also
isCellBinding

Definition at line 177 of file formcellbinding.cxx.

References Any, doConvertAddressRepresentations(), Exception, isCellBinding(), xmloff::PROPERTY_ADDRESS, xmloff::PROPERTY_BOUND_CELL, xmloff::PROPERTY_FILE_REPRESENTATION, and TOOLS_WARN_EXCEPTION.

◆ getStringAddressFromCellListSource()

OUString xmloff::FormCellBindingHelper::getStringAddressFromCellListSource ( const css::uno::Reference< css::form::binding::XListEntrySource > &  _rxSource) const

creates a string representation for the given list source's range address

If the sheet of the cell range which acts as list source is the same as the sheet which our control belongs to, then the sheet name is omitted in the resulting string representation.

@precond The object is a valid cell range list source, or <NULL>

See also
isCellRangeListSource

Definition at line 206 of file formcellbinding.cxx.

References Any, doConvertAddressRepresentations(), Exception, isCellRangeListSource(), xmloff::PROPERTY_ADDRESS, xmloff::PROPERTY_FILE_REPRESENTATION, xmloff::PROPERTY_LIST_CELL_RANGE, and TOOLS_WARN_EXCEPTION.

◆ isCellBinding()

bool xmloff::FormCellBindingHelper::isCellBinding ( const css::uno::Reference< css::form::binding::XValueBinding > &  _rxBinding)
static

checks whether a given binding is a spreadsheet cell binding

Definition at line 311 of file formcellbinding.cxx.

References doesComponentSupport(), and xmloff::SERVICE_CELLVALUEBINDING.

Referenced by xmloff::OControlExport::examine(), and getStringAddressFromCellBinding().

◆ isCellBindingAllowed() [1/2]

bool xmloff::FormCellBindingHelper::isCellBindingAllowed ( ) const

checks whether it's possible to bind the control model to a spreadsheet cell

Definition at line 288 of file formcellbinding.cxx.

References isSpreadsheetDocumentWhichSupplies(), m_xControlModel, and xmloff::SERVICE_CELLVALUEBINDING.

Referenced by xmloff::OFormLayerXMLImport_Impl::documentDone().

◆ isCellBindingAllowed() [2/2]

static bool xmloff::FormCellBindingHelper::isCellBindingAllowed ( const css::uno::Reference< css::frame::XModel > &  _rxDocument)
static

checks whether within the given document, it's possible to bind control models to spreadsheet cells

◆ isCellIntegerBinding()

bool xmloff::FormCellBindingHelper::isCellIntegerBinding ( const css::uno::Reference< css::form::binding::XValueBinding > &  _rxBinding)
static

checks whether a given binding is a spreadsheet cell binding, exchanging integer values

Definition at line 316 of file formcellbinding.cxx.

References doesComponentSupport(), and xmloff::SERVICE_LISTINDEXCELLBINDING.

Referenced by xmloff::OControlExport::exportCellBindingAttributes().

◆ isCellRangeListSource()

bool xmloff::FormCellBindingHelper::isCellRangeListSource ( const css::uno::Reference< css::form::binding::XListEntrySource > &  _rxSource)
static

checks whether a given list source is a spreadsheet cell list source

Definition at line 321 of file formcellbinding.cxx.

References doesComponentSupport(), and xmloff::SERVICE_CELLRANGELISTSOURCE.

Referenced by xmloff::OControlExport::examine(), and getStringAddressFromCellListSource().

◆ isListCellRangeAllowed() [1/2]

bool xmloff::FormCellBindingHelper::isListCellRangeAllowed ( ) const

checks whether it's possible to bind the control model to a range of spreadsheet cells supplying the list entries

Definition at line 275 of file formcellbinding.cxx.

References isSpreadsheetDocumentWhichSupplies(), m_xControlModel, xmloff::SERVICE_CELLRANGELISTSOURCE, and xSink.

Referenced by xmloff::OFormLayerXMLImport_Impl::documentDone().

◆ isListCellRangeAllowed() [2/2]

static bool xmloff::FormCellBindingHelper::isListCellRangeAllowed ( const css::uno::Reference< css::frame::XModel > &  _rxDocument)
static

checks whether within the given document, it's possible to bind the control model to a range of spreadsheet cells supplying the list entries

◆ isSpreadsheetDocumentWhichSupplies() [1/2]

static bool xmloff::FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies ( const css::uno::Reference< css::sheet::XSpreadsheetDocument > &  _rxDocument,
const OUString &  _rService 
)
staticprivate

determines if our document is a spreadsheet document, and can supply the given service

◆ isSpreadsheetDocumentWhichSupplies() [2/2]

bool xmloff::FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies ( const OUString &  _rService) const
private

determines if our document is a spreadsheet document, and can supply the given service

Definition at line 262 of file formcellbinding.cxx.

References isSpreadsheetDocumentWhichSupplies(), and m_xDocument.

Referenced by isCellBindingAllowed(), isListCellRangeAllowed(), and isSpreadsheetDocumentWhichSupplies().

◆ livesInSpreadsheetDocument()

bool xmloff::FormCellBindingHelper::livesInSpreadsheetDocument ( const css::uno::Reference< css::beans::XPropertySet > &  _rxControlModel)
static

determines whether the given control model lives in a spreadsheet document

If this method returns <FALSE>, you cannot instantiate a CellBindingHelper with this model, since then no of its functionality will be available.

Definition at line 105 of file formcellbinding.cxx.

Referenced by xmloff::OControlExport::examine().

◆ setBinding()

void xmloff::FormCellBindingHelper::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 <member>isCellBindingAllowed</member> returning <TRUE>)

Definition at line 351 of file formcellbinding.cxx.

References m_xControlModel.

◆ setListSource()

void xmloff::FormCellBindingHelper::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 by <member>isListCellRangeAllowed</member> returning <TRUE>)

Definition at line 359 of file formcellbinding.cxx.

References m_xControlModel, and xSink.

Member Data Documentation

◆ m_xControlModel

css::uno::Reference< css::beans::XPropertySet > xmloff::FormCellBindingHelper::m_xControlModel
private

◆ m_xDocument

css::uno::Reference< css::sheet::XSpreadsheetDocument > xmloff::FormCellBindingHelper::m_xDocument
private

The documentation for this class was generated from the following files: