diff options
Diffstat (limited to 'framework/source/fwi/uielement')
-rw-r--r-- | framework/source/fwi/uielement/constitemcontainer.cxx | 36 | ||||
-rw-r--r-- | framework/source/fwi/uielement/itemcontainer.cxx | 14 | ||||
-rw-r--r-- | framework/source/fwi/uielement/rootitemcontainer.cxx | 24 |
3 files changed, 28 insertions, 46 deletions
diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx index 9dee39a6e76d..40865c8f1b81 100644 --- a/framework/source/fwi/uielement/constitemcontainer.cxx +++ b/framework/source/fwi/uielement/constitemcontainer.cxx @@ -34,7 +34,7 @@ using namespace com::sun::star::beans; using namespace com::sun::star::container; const int PROPHANDLE_UINAME = 1; -constexpr OUStringLiteral PROPNAME_UINAME = u"UIName"; +constexpr OUString PROPNAME_UINAME = u"UIName"_ustr; namespace framework { @@ -147,7 +147,7 @@ Reference< XIndexAccess > ConstItemContainer::deepCopyContainer( const Reference Reference< XIndexAccess > xReturn; if ( rSubContainer.is() ) { - ItemContainer* pSource = comphelper::getFromUnoTunnel<ItemContainer>( rSubContainer ); + ItemContainer* pSource = dynamic_cast<ItemContainer*>( rSubContainer.get() ); rtl::Reference<ConstItemContainer> pSubContainer; if ( pSource ) pSubContainer = new ConstItemContainer( *pSource ); @@ -159,18 +159,6 @@ Reference< XIndexAccess > ConstItemContainer::deepCopyContainer( const Reference return xReturn; } -// XUnoTunnel -sal_Int64 ConstItemContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) -{ - return comphelper::getSomethingImpl(rIdentifier, this); -} - -const Sequence< sal_Int8 >& ConstItemContainer::getUnoTunnelId() noexcept -{ - static const comphelper::UnoIdInit theConstItemContainerUnoTunnelId; - return theConstItemContainerUnoTunnelId.getSeq(); -} - // XElementAccess sal_Bool SAL_CALL ConstItemContainer::hasElements() { @@ -187,7 +175,18 @@ Any SAL_CALL ConstItemContainer::getByIndex( sal_Int32 Index ) { if ( sal_Int32( m_aItemVector.size()) <= Index ) throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) ); - return makeAny( m_aItemVector[Index] ); + return Any( m_aItemVector[Index] ); +} + +namespace +{ + std::vector<comphelper::PropertyMapEntry> makePropertyMap(const css::uno::Sequence<css::beans::Property>& rProps) + { + std::vector<comphelper::PropertyMapEntry> aEntries; + for (auto const& it : rProps) + aEntries.emplace_back(it.Name, it.Handle, it.Type, it.Attributes, 0); + return aEntries; + } } // XPropertySet @@ -195,7 +194,8 @@ Reference< XPropertySetInfo > SAL_CALL ConstItemContainer::getPropertySetInfo() { // Create structure of propertysetinfo for baseclass "OPropertySetHelper". // (Use method "getInfoHelper()".) - static Reference< XPropertySetInfo > xInfo(new comphelper::PropertySetInfo(getInfoHelper().getProperties())); + static std::vector<comphelper::PropertyMapEntry> aPropertyInfos(makePropertyMap(getInfoHelper().getProperties())); + static Reference< XPropertySetInfo > xInfo(new comphelper::PropertySetInfo(aPropertyInfos)); return xInfo; } @@ -207,7 +207,7 @@ void SAL_CALL ConstItemContainer::setPropertyValue( const OUString&, const Any& Any SAL_CALL ConstItemContainer::getPropertyValue( const OUString& PropertyName ) { if ( PropertyName == PROPNAME_UINAME ) - return makeAny( m_aUIName ); + return Any( m_aUIName ); throw UnknownPropertyException(PropertyName); } @@ -239,7 +239,7 @@ void SAL_CALL ConstItemContainer::setFastPropertyValue( sal_Int32, const css::un Any SAL_CALL ConstItemContainer::getFastPropertyValue( sal_Int32 nHandle ) { if ( nHandle == PROPHANDLE_UINAME ) - return makeAny( m_aUIName ); + return Any( m_aUIName ); throw UnknownPropertyException(OUString::number(nHandle)); } diff --git a/framework/source/fwi/uielement/itemcontainer.cxx b/framework/source/fwi/uielement/itemcontainer.cxx index 8cee8440ee41..22bd077fced3 100644 --- a/framework/source/fwi/uielement/itemcontainer.cxx +++ b/framework/source/fwi/uielement/itemcontainer.cxx @@ -31,8 +31,8 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; -constexpr OUStringLiteral WRONG_TYPE_EXCEPTION - = u"Type must be css::uno::Sequence< css::beans::PropertyValue >"; +constexpr OUString WRONG_TYPE_EXCEPTION + = u"Type must be css::uno::Sequence< css::beans::PropertyValue >"_ustr; namespace framework { @@ -122,7 +122,7 @@ Reference< XIndexAccess > ItemContainer::deepCopyContainer( const Reference< XIn Reference< XIndexAccess > xReturn; if ( rSubContainer.is() ) { - ConstItemContainer* pSource = comphelper::getFromUnoTunnel<ConstItemContainer>( rSubContainer ); + ConstItemContainer* pSource = dynamic_cast<ConstItemContainer*>( rSubContainer.get() ); rtl::Reference<ItemContainer> pSubContainer; if ( pSource ) pSubContainer = new ItemContainer( *pSource, rMutex ); @@ -134,12 +134,6 @@ Reference< XIndexAccess > ItemContainer::deepCopyContainer( const Reference< XIn return xReturn; } -const Sequence< sal_Int8 >& ItemContainer::getUnoTunnelId() noexcept -{ - static const comphelper::UnoIdInit theItemContainerUnoTunnelId; - return theItemContainerUnoTunnelId.getSeq(); -} - // XElementAccess sal_Bool SAL_CALL ItemContainer::hasElements() { @@ -160,7 +154,7 @@ Any SAL_CALL ItemContainer::getByIndex( sal_Int32 Index ) if ( sal_Int32( m_aItemVector.size()) <= Index ) throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) ); - return makeAny( m_aItemVector[Index] ); + return Any( m_aItemVector[Index] ); } // XIndexContainer diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx index a91742cb598e..652f0dd8029f 100644 --- a/framework/source/fwi/uielement/rootitemcontainer.cxx +++ b/framework/source/fwi/uielement/rootitemcontainer.cxx @@ -34,11 +34,11 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; -constexpr OUStringLiteral WRONG_TYPE_EXCEPTION - = u"Type must be css::uno::Sequence< css::beans::PropertyValue >"; +constexpr OUString WRONG_TYPE_EXCEPTION + = u"Type must be css::uno::Sequence< css::beans::PropertyValue >"_ustr; const int PROPHANDLE_UINAME = 1; -constexpr OUStringLiteral PROPNAME_UINAME = u"UIName"; +constexpr OUString PROPNAME_UINAME = u"UIName"_ustr; namespace framework { @@ -126,7 +126,7 @@ Reference< XIndexAccess > RootItemContainer::deepCopyContainer( const Reference< Reference< XIndexAccess > xReturn; if ( rSubContainer.is() ) { - ConstItemContainer* pSource = comphelper::getFromUnoTunnel<ConstItemContainer>( rSubContainer ); + ConstItemContainer* pSource = dynamic_cast<ConstItemContainer*>( rSubContainer.get() ); rtl::Reference<ItemContainer> pSubContainer; if ( pSource ) pSubContainer = new ItemContainer( *pSource, m_aShareMutex ); @@ -138,18 +138,6 @@ Reference< XIndexAccess > RootItemContainer::deepCopyContainer( const Reference< return xReturn; } -// XUnoTunnel -sal_Int64 RootItemContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) -{ - return comphelper::getSomethingImpl(rIdentifier, this); -} - -const Sequence< sal_Int8 >& RootItemContainer::getUnoTunnelId() noexcept -{ - static const comphelper::UnoIdInit theRootItemContainerUnoTunnelId; - return theRootItemContainerUnoTunnelId.getSeq(); -} - // XElementAccess sal_Bool SAL_CALL RootItemContainer::hasElements() { @@ -170,7 +158,7 @@ Any SAL_CALL RootItemContainer::getByIndex( sal_Int32 Index ) if ( sal_Int32( m_aItemVector.size()) <= Index ) throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) ); - return makeAny( m_aItemVector[Index] ); + return Any( m_aItemVector[Index] ); } // XIndexContainer @@ -239,7 +227,7 @@ sal_Bool SAL_CALL RootItemContainer::convertFastPropertyValue( Any& aConve { case PROPHANDLE_UINAME: bReturn = PropHelper::willPropertyBeChanged( - css::uno::makeAny(m_aUIName), + css::uno::Any(m_aUIName), aValue, aOldValue, aConvertedValue); |