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 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 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 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 37 of file formcellbinding.hxx.

Constructor & Destructor Documentation

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

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().

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

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

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

Definition at line 138 of file formcellbinding.cxx.

References convertStringAddress(), createDocumentDependentInstance(), m_xDocument, makeAny(), PROPERTY_BOUND_CELL, SERVICE_CELLVALUEBINDING, and SERVICE_LISTINDEXCELLBINDING.

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 convertStringAddress(), createDocumentDependentInstance(), makeAny(), PROPERTY_LIST_CELL_RANGE, and SERVICE_CELLRANGELISTSOURCE.

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 366 of file formcellbinding.cxx.

References Exception, and m_xDocument.

Referenced by createCellBindingFromStringAddress(), createCellListSourceFromStringAddress(), and 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 401 of file formcellbinding.cxx.

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

Referenced by getStringAddressFromCellBinding(), and getStringAddressFromCellListSource().

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 325 of file formcellbinding.cxx.

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

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

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

Definition at line 332 of file formcellbinding.cxx.

References m_xControlModel.

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

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

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

Definition at line 341 of file formcellbinding.cxx.

References m_xControlModel, and xSink.

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

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.

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(), makeAny(), PROPERTY_ADDRESS, PROPERTY_BOUND_CELL, PROPERTY_FILE_REPRESENTATION, and TOOLS_WARN_EXCEPTION.

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

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.

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(), makeAny(), PROPERTY_ADDRESS, PROPERTY_FILE_REPRESENTATION, PROPERTY_LIST_CELL_RANGE, and TOOLS_WARN_EXCEPTION.

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

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 310 of file formcellbinding.cxx.

References doesComponentSupport(), and SERVICE_CELLVALUEBINDING.

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

bool xmloff::FormCellBindingHelper::isCellBindingAllowed ( ) const

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

Definition at line 287 of file formcellbinding.cxx.

References isSpreadsheetDocumentWhichSupplies(), m_xControlModel, and SERVICE_CELLVALUEBINDING.

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

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

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 315 of file formcellbinding.cxx.

References doesComponentSupport(), and SERVICE_LISTINDEXCELLBINDING.

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

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 320 of file formcellbinding.cxx.

References doesComponentSupport(), and SERVICE_CELLRANGELISTSOURCE.

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

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 274 of file formcellbinding.cxx.

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

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

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

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 261 of file formcellbinding.cxx.

References m_xDocument.

Referenced by isCellBindingAllowed(), and isListCellRangeAllowed().

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

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().

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

Definition at line 350 of file formcellbinding.cxx.

References m_xControlModel.

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

Definition at line 358 of file formcellbinding.cxx.

References m_xControlModel, and xSink.

Member Data Documentation

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

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