[Libreoffice-commits] core.git: comphelper/source include/comphelper sw/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jan 17 06:37:25 UTC 2017


 comphelper/source/property/ChainablePropertySet.cxx |   37 +++++++++-----------
 comphelper/source/property/MasterPropertySet.cxx    |    2 -
 include/comphelper/ChainablePropertySet.hxx         |    4 +-
 sw/source/uibase/uno/unomod.cxx                     |    2 -
 4 files changed, 22 insertions(+), 23 deletions(-)

New commits:
commit b2a4c1e085a14f79cb1765fe2ade443afc273b9a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 16 10:48:24 2017 +0200

    use rtl::Reference in ChainablePropertySet
    
    no need to store both a raw pointer and a smart pointer
    
    Change-Id: If0bde337e6d9fa575a2fc7104ecffa97a8c37c31
    Reviewed-on: https://gerrit.libreoffice.org/33159
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/comphelper/source/property/ChainablePropertySet.cxx b/comphelper/source/property/ChainablePropertySet.cxx
index 87958ba..1f7d8d9 100644
--- a/comphelper/source/property/ChainablePropertySet.cxx
+++ b/comphelper/source/property/ChainablePropertySet.cxx
@@ -33,8 +33,7 @@ using namespace ::com::sun::star::beans;
 
 ChainablePropertySet::ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, comphelper::SolarMutex* pMutex )
     throw()
-: mpInfo ( pInfo )
-, mpMutex ( pMutex )
+: mpMutex ( pMutex )
 , mxInfo ( pInfo )
 {
 }
@@ -48,7 +47,7 @@ ChainablePropertySet::~ChainablePropertySet()
 Reference< XPropertySetInfo > SAL_CALL ChainablePropertySet::getPropertySetInfo(  )
     throw(RuntimeException, std::exception)
 {
-    return mxInfo;
+    return mxInfo.get();
 }
 
 void SAL_CALL ChainablePropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
@@ -59,9 +58,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValue( const OUString& rPropertyN
     if (mpMutex)
         xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
 
-    PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName );
+    PropertyInfoHash::const_iterator aIter = mxInfo->maMap.find ( rPropertyName );
 
-    if( aIter == mpInfo->maMap.end())
+    if( aIter == mxInfo->maMap.end())
         throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) );
 
     _preSetValues();
@@ -77,9 +76,9 @@ Any SAL_CALL ChainablePropertySet::getPropertyValue( const OUString& rPropertyNa
     if (mpMutex)
         xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
 
-    PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName );
+    PropertyInfoHash::const_iterator aIter = mxInfo->maMap.find ( rPropertyName );
 
-    if( aIter == mpInfo->maMap.end())
+    if( aIter == mxInfo->maMap.end())
         throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) );
 
     Any aAny;
@@ -135,11 +134,11 @@ void SAL_CALL ChainablePropertySet::setPropertyValues(const Sequence< OUString >
 
         const Any * pAny = rValues.getConstArray();
         const OUString * pString = rPropertyNames.getConstArray();
-        PropertyInfoHash::const_iterator aEnd = mpInfo->maMap.end(), aIter;
+        PropertyInfoHash::const_iterator aEnd = mxInfo->maMap.end(), aIter;
 
         for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pAny )
         {
-            aIter = mpInfo->maMap.find ( *pString );
+            aIter = mxInfo->maMap.find ( *pString );
             if ( aIter == aEnd )
                 throw RuntimeException( *pString, static_cast< XPropertySet* >( this ) );
 
@@ -168,11 +167,11 @@ Sequence< Any > SAL_CALL ChainablePropertySet::getPropertyValues(const Sequence<
 
         Any * pAny = aValues.getArray();
         const OUString * pString = rPropertyNames.getConstArray();
-        PropertyInfoHash::const_iterator aEnd = mpInfo->maMap.end(), aIter;
+        PropertyInfoHash::const_iterator aEnd = mxInfo->maMap.end(), aIter;
 
         for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pAny )
         {
-            aIter = mpInfo->maMap.find ( *pString );
+            aIter = mxInfo->maMap.find ( *pString );
             if ( aIter == aEnd )
                 throw RuntimeException( *pString, static_cast< XPropertySet* >( this ) );
 
@@ -206,8 +205,8 @@ void SAL_CALL ChainablePropertySet::firePropertiesChangeEvent( const Sequence< O
 PropertyState SAL_CALL ChainablePropertySet::getPropertyState( const OUString& PropertyName )
     throw(UnknownPropertyException, RuntimeException, std::exception)
 {
-    PropertyInfoHash::const_iterator aIter =  mpInfo->maMap.find( PropertyName );
-    if( aIter == mpInfo->maMap.end())
+    PropertyInfoHash::const_iterator aIter =  mxInfo->maMap.find( PropertyName );
+    if( aIter == mxInfo->maMap.end())
         throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
 
     PropertyState aState(PropertyState_AMBIGUOUS_VALUE);
@@ -229,12 +228,12 @@ Sequence< PropertyState > SAL_CALL ChainablePropertySet::getPropertyStates( cons
     {
         PropertyState * pState = aStates.getArray();
         const OUString * pString = rPropertyNames.getConstArray();
-        PropertyInfoHash::const_iterator aEnd = mpInfo->maMap.end(), aIter;
+        PropertyInfoHash::const_iterator aEnd = mxInfo->maMap.end(), aIter;
         _preGetPropertyState();
 
         for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pState )
         {
-            aIter = mpInfo->maMap.find ( *pString );
+            aIter = mxInfo->maMap.find ( *pString );
             if ( aIter == aEnd )
                 throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) );
 
@@ -248,9 +247,9 @@ Sequence< PropertyState > SAL_CALL ChainablePropertySet::getPropertyStates( cons
 void SAL_CALL ChainablePropertySet::setPropertyToDefault( const OUString& rPropertyName )
     throw(UnknownPropertyException, RuntimeException, std::exception)
 {
-    PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName );
+    PropertyInfoHash::const_iterator aIter = mxInfo->maMap.find ( rPropertyName );
 
-    if( aIter == mpInfo->maMap.end())
+    if( aIter == mxInfo->maMap.end())
         throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) );
     _setPropertyToDefault( *((*aIter).second) );
 }
@@ -258,9 +257,9 @@ void SAL_CALL ChainablePropertySet::setPropertyToDefault( const OUString& rPrope
 Any SAL_CALL ChainablePropertySet::getPropertyDefault( const OUString& rPropertyName )
     throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
 {
-    PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName );
+    PropertyInfoHash::const_iterator aIter = mxInfo->maMap.find ( rPropertyName );
 
-    if( aIter == mpInfo->maMap.end())
+    if( aIter == mxInfo->maMap.end())
         throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) );
     return _getPropertyDefault( *((*aIter).second) );
 }
diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx
index bd32900..32f3284 100644
--- a/comphelper/source/property/MasterPropertySet.cxx
+++ b/comphelper/source/property/MasterPropertySet.cxx
@@ -90,7 +90,7 @@ void MasterPropertySet::registerSlave ( ChainablePropertySet *pNewSet )
     throw()
 {
     maSlaveMap [ ++mnLastId ] = new SlaveData ( pNewSet );
-    mpInfo->add ( pNewSet->mpInfo->maMap, mnLastId );
+    mpInfo->add ( pNewSet->mxInfo->maMap, mnLastId );
 }
 
 void SAL_CALL MasterPropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
diff --git a/include/comphelper/ChainablePropertySet.hxx b/include/comphelper/ChainablePropertySet.hxx
index af074b0..3a7a7c9 100644
--- a/include/comphelper/ChainablePropertySet.hxx
+++ b/include/comphelper/ChainablePropertySet.hxx
@@ -26,6 +26,7 @@
 #include <comphelper/PropertyInfoHash.hxx>
 #include <comphelper/comphelperdllapi.h>
 #include <comphelper/solarmutex.hxx>
+#include <rtl/ref.hxx>
 
 namespace comphelper
 {
@@ -59,9 +60,8 @@ namespace comphelper
     {
         friend class MasterPropertySet;
     protected:
-        ChainablePropertySetInfo *mpInfo;
         SolarMutex* mpMutex;
-        css::uno::Reference < css::beans::XPropertySetInfo > mxInfo;
+        rtl::Reference < ChainablePropertySetInfo > mxInfo;
 
         virtual void _preSetValues ()
             throw (css::beans::UnknownPropertyException,
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 865b28a..f3ae864 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -548,7 +548,7 @@ SwXViewSettings::SwXViewSettings(SwView* pVw)
 {
     // This property only exists if we have a view (ie, not at the module )
     if ( !pView )
-        mpInfo->remove ( "HelpURL" );
+        mxInfo->remove ( "HelpURL" );
 
 }
 


More information about the Libreoffice-commits mailing list