diff options
Diffstat (limited to 'extensions/source/propctrlr/cellbindinghelper.cxx')
-rw-r--r-- | extensions/source/propctrlr/cellbindinghelper.cxx | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx index 4b93d048ddaa..bd2c6d41989c 100644 --- a/extensions/source/propctrlr/cellbindinghelper.cxx +++ b/extensions/source/propctrlr/cellbindinghelper.cxx @@ -32,10 +32,11 @@ #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <unotools/transliterationwrapper.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include "formstrings.hxx" #include <algorithm> +#include <utility> namespace pcr @@ -51,7 +52,6 @@ namespace pcr using namespace ::com::sun::star::table; using namespace ::com::sun::star::form; using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::form::binding; namespace @@ -63,7 +63,7 @@ namespace pcr OUString m_sReference; public: - explicit StringCompare( const OUString& _rReference ) : m_sReference( _rReference ) { } + explicit StringCompare( OUString _aReference ) : m_sReference(std::move( _aReference )) { } bool operator()( std::u16string_view _rCompare ) { @@ -146,7 +146,7 @@ namespace pcr Any aAddress; return doConvertAddressRepresentations( PROPERTY_UI_REPRESENTATION, - makeAny( _rAddressDescription ), + Any( _rAddressDescription ), PROPERTY_ADDRESS, aAddress, false @@ -162,7 +162,7 @@ namespace pcr Reference< XPropertySet > xConverter( createDocumentDependentInstance( - _bIsRange ? OUString(SERVICE_RANGEADDRESS_CONVERSION) : OUString(SERVICE_ADDRESS_CONVERSION), + _bIsRange ? SERVICE_RANGEADDRESS_CONVERSION : SERVICE_ADDRESS_CONVERSION, OUString(), Any() ), @@ -174,7 +174,7 @@ namespace pcr try { Reference< XSpreadsheet > xSheet; - xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, makeAny( static_cast<sal_Int32>(getControlSheetIndex( xSheet )) ) ); + xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, Any( static_cast<sal_Int32>(getControlSheetIndex( xSheet )) ) ); xConverter->setPropertyValue( _rInputProperty, _rInputValue ); _rOutputValue = xConverter->getPropertyValue( _rOutputProperty ); bSuccess = true; @@ -195,7 +195,7 @@ namespace pcr Any aAddress; return doConvertAddressRepresentations( PROPERTY_UI_REPRESENTATION, - makeAny( _rAddressDescription ), + Any( _rAddressDescription ), PROPERTY_ADDRESS, aAddress, true @@ -207,9 +207,9 @@ namespace pcr Reference< XValueBinding > CellBindingHelper::createCellBindingFromAddress( const CellAddress& _rAddress, bool _bSupportIntegerExchange ) const { Reference< XValueBinding > xBinding( createDocumentDependentInstance( - _bSupportIntegerExchange ? OUString(SERVICE_SHEET_CELL_INT_BINDING) : OUString(SERVICE_SHEET_CELL_BINDING), + _bSupportIntegerExchange ? SERVICE_SHEET_CELL_INT_BINDING : SERVICE_SHEET_CELL_BINDING, PROPERTY_BOUND_CELL, - makeAny( _rAddress ) + Any( _rAddress ) ), UNO_QUERY ); return xBinding; @@ -244,7 +244,7 @@ namespace pcr xSource.set(createDocumentDependentInstance( SERVICE_SHEET_CELLRANGE_LISTSOURCE, PROPERTY_LIST_CELL_RANGE, - makeAny( aRangeAddress ) + Any( aRangeAddress ) ), css::uno::UNO_QUERY); return xSource; @@ -264,13 +264,7 @@ namespace pcr { if ( !_rArgumentName.isEmpty() ) { - NamedValue aArg; - aArg.Name = _rArgumentName; - aArg.Value = _rArgumentValue; - - Sequence< Any > aArgs( 1 ); - aArgs[ 0 ] <<= aArg; - + Sequence aArgs{ Any(NamedValue(_rArgumentName, _rArgumentValue)) }; xReturn = xDocumentFactory->createInstanceWithArguments( _rService, aArgs ); } else @@ -322,7 +316,7 @@ namespace pcr if ( getAddressFromCellBinding( _rxBinding, aAddress ) ) { Any aStringAddress; - doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aAddress ), + doConvertAddressRepresentations( PROPERTY_ADDRESS, Any( aAddress ), PROPERTY_UI_REPRESENTATION, aStringAddress, false ); aStringAddress >>= sAddress; @@ -351,7 +345,7 @@ namespace pcr xSourceProps->getPropertyValue( PROPERTY_LIST_CELL_RANGE ) >>= aRangeAddress; Any aStringAddress; - doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aRangeAddress ), + doConvertAddressRepresentations( PROPERTY_ADDRESS, Any( aRangeAddress ), PROPERTY_UI_REPRESENTATION, aStringAddress, true ); aStringAddress >>= sAddress; } @@ -375,15 +369,16 @@ namespace pcr Reference< XMultiServiceFactory > xDocumentFactory( m_xDocument, UNO_QUERY ); OSL_ENSURE( xDocumentFactory.is(), "CellBindingHelper::isSpreadsheetDocumentWhichSupplies: spreadsheet document, but no factory?" ); - Sequence< OUString > aAvailableServices; if ( xDocumentFactory.is() ) - aAvailableServices = xDocumentFactory->getAvailableServiceNames( ); + { + const Sequence<OUString> aAvailableServices = xDocumentFactory->getAvailableServiceNames( ); - bYesItIs = std::any_of( - aAvailableServices.begin(), - aAvailableServices.end(), - StringCompare( _rService ) - ); + bYesItIs = std::any_of( + aAvailableServices.begin(), + aAvailableServices.end(), + StringCompare( _rService ) + ); + } } return bYesItIs; @@ -477,19 +472,19 @@ namespace pcr bool CellBindingHelper::isCellBinding( const Reference< XValueBinding >& _rxBinding ) { - return doesComponentSupport( _rxBinding.get(), SERVICE_SHEET_CELL_BINDING ); + return doesComponentSupport( _rxBinding, SERVICE_SHEET_CELL_BINDING ); } bool CellBindingHelper::isCellIntegerBinding( const Reference< XValueBinding >& _rxBinding ) { - return doesComponentSupport( _rxBinding.get(), SERVICE_SHEET_CELL_INT_BINDING ); + return doesComponentSupport( _rxBinding, SERVICE_SHEET_CELL_INT_BINDING ); } bool CellBindingHelper::isCellRangeListSource( const Reference< XListEntrySource >& _rxSource ) { - return doesComponentSupport( _rxSource.get(), SERVICE_SHEET_CELLRANGE_LISTSOURCE ); + return doesComponentSupport( _rxSource, SERVICE_SHEET_CELLRANGE_LISTSOURCE ); } @@ -500,7 +495,6 @@ namespace pcr return bDoes; } - Reference< XValueBinding > CellBindingHelper::getCurrentBinding( ) const { Reference< XValueBinding > xBinding; @@ -510,17 +504,14 @@ namespace pcr return xBinding; } - Reference< XListEntrySource > CellBindingHelper::getCurrentListSource( ) const { - Reference< XListEntrySource > xSource; Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); - if ( xSink.is() ) - xSource = xSink->getListEntrySource(); - return xSource; + if (xSink.is()) + return xSink->getListEntrySource(); + return Reference<XListEntrySource>(); } - void CellBindingHelper::setBinding( const Reference< XValueBinding >& _rxBinding ) { Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY ); @@ -529,7 +520,6 @@ namespace pcr xBindable->setValueBinding( _rxBinding ); } - void CellBindingHelper::setListSource( const Reference< XListEntrySource >& _rxSource ) { Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); @@ -538,7 +528,6 @@ namespace pcr xSink->setListEntrySource( _rxSource ); } - } // namespace pcr |