LibreOffice Module extensions (master) 1
|
encapsulates functionality related to binding a form control to a spreadsheet cell More...
#include <cellbindinghelper.hxx>
Public Member Functions | |
CellBindingHelper (const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const css::uno::Reference< css::frame::XModel > &_rxContextDocument) | |
ctor More... | |
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> More... | |
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 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... | |
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 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 | isCellIntegerBindingAllowed () const |
checks whether it's possible to bind the control model to a spreadsheet cell, with exchanging integer values More... | |
bool | isListCellRangeAllowed () const |
checks whether it's possible to bind the control model to range of spreadsheet cells supplying the list entries More... | |
sal_Int16 | getControlSheetIndex (css::uno::Reference< css::sheet::XSpreadsheet > &_out_rxSheet) const |
retrieves the index of the sheet which our control belongs to More... | |
Static Public Member Functions | |
static bool | isSpreadsheetDocument (const css::uno::Reference< css::frame::XModel > &_rxContextDocument) |
determines whether the given model is a spreadsheet document model 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 | 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::XPropertySet > | m_xControlModel |
css::uno::Reference< css::sheet::XSpreadsheetDocument > | m_xDocument |
encapsulates functionality related to binding a form control to a spreadsheet cell
Definition at line 37 of file cellbindinghelper.hxx.
pcr::CellBindingHelper::CellBindingHelper | ( | const css::uno::Reference< css::beans::XPropertySet > & | _rxControlModel, |
const css::uno::Reference< css::frame::XModel > & | _rxContextDocument | ||
) |
ctor
_rxControlModel | the control model which is or will be bound |
Definition at line 77 of file cellbindinghelper.cxx.
References isSpreadsheetDocumentWhichSupplies(), m_xControlModel, m_xDocument, and SERVICE_ADDRESS_CONVERSION.
|
private |
creates an address object from a string representation of a cell address
Referenced by createCellBindingFromStringAddress(), and createCellListSourceFromStringAddress().
|
private |
creates an address range object from a string representation of a cell range address
Reference< XValueBinding > pcr::CellBindingHelper::createCellBindingFromAddress | ( | const css::table::CellAddress & | _rAddress, |
bool | _bSupportIntegerExchange | ||
) | const |
creates a cell binding (supporting integer exchange, if requested) for the given address object
Definition at line 208 of file cellbindinghelper.cxx.
References Any, createDocumentDependentInstance(), PROPERTY_BOUND_CELL, SERVICE_SHEET_CELL_BINDING, and SERVICE_SHEET_CELL_INT_BINDING.
Referenced by createCellBindingFromStringAddress().
Reference< XValueBinding > pcr::CellBindingHelper::createCellBindingFromStringAddress | ( | const OUString & | _rAddress, |
bool | _bSupportIntegerExchange | ||
) | const |
gets a cell binding for the given address @precond isCellBindingAllowed returns <TRUE>
Definition at line 220 of file cellbindinghelper.cxx.
References convertStringAddress(), createCellBindingFromAddress(), and m_xDocument.
Reference< XListEntrySource > pcr::CellBindingHelper::createCellListSourceFromStringAddress | ( | const OUString & | _rAddress | ) | const |
gets a cell range list source binding for the given address
Definition at line 236 of file cellbindinghelper.cxx.
References Any, convertStringAddress(), createDocumentDependentInstance(), PROPERTY_LIST_CELL_RANGE, and SERVICE_SHEET_CELLRANGE_LISTSOURCE.
|
private |
uses the document (it's factory interface, respectively) to create a component instance
_rService | the service name |
_rArgumentName | the name of the single argument to pass during creation. May be empty, in this case no arguments are passed |
_rArgumentValue | the value of the instantiation argument. Not evaluated if <arg>_rArgumentName</arg> is empty. |
Definition at line 255 of file cellbindinghelper.cxx.
References Any, Exception, m_xDocument, and Sequence.
Referenced by createCellBindingFromAddress(), createCellListSourceFromStringAddress(), and doConvertAddressRepresentations().
|
private |
converts an address representation into another one
_rInputProperty | the input property name for the conversion service |
_rInputValue | the input property value for the conversion service |
_rOutputProperty | the output property name for the conversion service |
_rOutputValue | the output property value for the conversion service |
_bIsRange | if <TRUE>, the RangeAddressConversion service will be used, else the AddressConversion service |
Definition at line 159 of file cellbindinghelper.cxx.
References Any, createDocumentDependentInstance(), Exception, getControlSheetIndex(), PROPERTY_REFERENCE_SHEET, SERVICE_ADDRESS_CONVERSION, SERVICE_RANGEADDRESS_CONVERSION, TOOLS_WARN_EXCEPTION, and xConverter.
Referenced by getStringAddressFromCellBinding(), and getStringAddressFromCellListSource().
|
staticprivate |
checks whether a given component supports a given service
Definition at line 492 of file cellbindinghelper.cxx.
Referenced by isCellBinding(), isCellIntegerBinding(), and isCellRangeListSource().
bool pcr::CellBindingHelper::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
@precond The binding is a valid cell binding, or <NULL>
Definition at line 285 of file cellbindinghelper.cxx.
References Exception, isCellBinding(), m_xDocument, PROPERTY_BOUND_CELL, and TOOLS_WARN_EXCEPTION.
Referenced by getStringAddressFromCellBinding().
sal_Int16 pcr::CellBindingHelper::getControlSheetIndex | ( | css::uno::Reference< css::sheet::XSpreadsheet > & | _out_rxSheet | ) | const |
retrieves the index of the sheet which our control belongs to
Definition at line 96 of file cellbindinghelper.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, i, m_xControlModel, and m_xDocument.
Referenced by doConvertAddressRepresentations().
Reference< XValueBinding > pcr::CellBindingHelper::getCurrentBinding | ( | ) | const |
returns the current binding of our control model, if any.
Definition at line 500 of file cellbindinghelper.cxx.
References m_xControlModel.
Reference< XListEntrySource > pcr::CellBindingHelper::getCurrentListSource | ( | ) | const |
returns the current external list source of the control model, if any
Definition at line 510 of file cellbindinghelper.cxx.
References m_xControlModel, and xSink.
OUString pcr::CellBindingHelper::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>
Definition at line 313 of file cellbindinghelper.cxx.
References Any, doConvertAddressRepresentations(), getAddressFromCellBinding(), PROPERTY_ADDRESS, and PROPERTY_UI_REPRESENTATION.
OUString pcr::CellBindingHelper::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>
Definition at line 330 of file cellbindinghelper.cxx.
References Any, doConvertAddressRepresentations(), Exception, isCellRangeListSource(), m_xDocument, PROPERTY_ADDRESS, PROPERTY_LIST_CELL_RANGE, PROPERTY_UI_REPRESENTATION, and TOOLS_WARN_EXCEPTION.
|
static |
checks whether a given binding is a spreadsheet cell binding
Definition at line 474 of file cellbindinghelper.cxx.
References doesComponentSupport(), and SERVICE_SHEET_CELL_BINDING.
Referenced by getAddressFromCellBinding(), and pcr::CellBindingPropertyHandler::getPropertyValue().
bool pcr::CellBindingHelper::isCellBindingAllowed | ( | ) | const |
checks whether it's possible to bind the control model to a spreadsheet cell
Definition at line 440 of file cellbindinghelper.cxx.
References Exception, isSpreadsheetDocumentWhichSupplies(), m_xControlModel, PROPERTY_CLASSID, SERVICE_SHEET_CELL_BINDING, and TOOLS_WARN_EXCEPTION.
|
static |
checks whether a given binding is a spreadsheet cell binding, exchanging integer values
Definition at line 480 of file cellbindinghelper.cxx.
References doesComponentSupport(), and SERVICE_SHEET_CELL_INT_BINDING.
Referenced by pcr::CellBindingPropertyHandler::getPropertyValue(), and pcr::CellBindingPropertyHandler::setPropertyValue().
bool pcr::CellBindingHelper::isCellIntegerBindingAllowed | ( | ) | const |
checks whether it's possible to bind the control model to a spreadsheet cell, with exchanging integer values
Definition at line 403 of file cellbindinghelper.cxx.
References Exception, isSpreadsheetDocumentWhichSupplies(), m_xControlModel, PROPERTY_CLASSID, SERVICE_SHEET_CELL_INT_BINDING, and TOOLS_WARN_EXCEPTION.
|
static |
checks whether a given list source is a spreadsheet cell list source
Definition at line 486 of file cellbindinghelper.cxx.
References doesComponentSupport(), and SERVICE_SHEET_CELLRANGE_LISTSOURCE.
Referenced by pcr::CellBindingPropertyHandler::getPropertyValue(), and getStringAddressFromCellListSource().
bool pcr::CellBindingHelper::isListCellRangeAllowed | ( | ) | const |
checks whether it's possible to bind the control model to range of spreadsheet cells supplying the list entries
Definition at line 389 of file cellbindinghelper.cxx.
References isSpreadsheetDocumentWhichSupplies(), m_xControlModel, SERVICE_SHEET_CELLRANGE_LISTSOURCE, and xSink.
|
static |
determines whether the given model is a spreadsheet document model
If this method returns <FALSE>, you cannot instantiate a CellBindingHelper with the document, since then no of its functionality will be available.
Definition at line 90 of file cellbindinghelper.cxx.
Referenced by pcr::CellBindingPropertyHandler::onNewComponent().
|
private |
determines if our document is a spreadsheet document, and can supply the given service
Definition at line 363 of file cellbindinghelper.cxx.
References m_xDocument, and SERVICE_SPREADSHEET_DOCUMENT.
Referenced by CellBindingHelper(), isCellBindingAllowed(), isCellIntegerBindingAllowed(), and isListCellRangeAllowed().
void pcr::CellBindingHelper::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 520 of file cellbindinghelper.cxx.
References m_xControlModel.
void pcr::CellBindingHelper::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 529 of file cellbindinghelper.cxx.
References m_xControlModel, and xSink.
|
private |
Definition at line 40 of file cellbindinghelper.hxx.
Referenced by CellBindingHelper(), getControlSheetIndex(), getCurrentBinding(), getCurrentListSource(), isCellBindingAllowed(), isCellIntegerBindingAllowed(), isListCellRangeAllowed(), setBinding(), and setListSource().
|
private |
Definition at line 42 of file cellbindinghelper.hxx.
Referenced by CellBindingHelper(), createCellBindingFromStringAddress(), createDocumentDependentInstance(), getAddressFromCellBinding(), getControlSheetIndex(), getStringAddressFromCellListSource(), and isSpreadsheetDocumentWhichSupplies().