[Libreoffice-commits] .: 2 commits - svx/source

Joseph Powers jpowers at kemper.freedesktop.org
Mon Aug 29 07:18:59 PDT 2011


 svx/source/unodraw/XPropertyTable.cxx |   23 ++++-------------------
 svx/source/unodraw/unoctabl.cxx       |    8 ++++----
 2 files changed, 8 insertions(+), 23 deletions(-)

New commits:
commit 79fee152187615ce4735883ab5d5347e34de4e60
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Mon Aug 29 07:04:18 2011 -0700

    class SvxUnoXPropertyTable no longer needs to support class XProprtyTable
    
    It was supporting both XPropertyTable & XPropertyLis. XColorTable is now
    based on XPropertyList and it was the only on that was based on the Table
    class.
    
    TODO: we might be able to remove some of the "if(mpList)" statements; this
    needs more research.

diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index fc152e7..5e5f981 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -54,15 +54,13 @@ using namespace ::rtl;
 class SvxUnoXPropertyTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
 {
 private:
-    XPropertyTable* mpTable;
     XPropertyList*  mpList;
     sal_Int16 mnWhich;
 
-    long getCount() const { return mpList ? mpList->Count() : (mpTable?mpTable->Count():0); }
+    long getCount() const { return mpList ? mpList->Count() : 0; }
     XPropertyEntry* get( long index ) const;
 public:
     SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw();
-    SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw();
 
     virtual ~SvxUnoXPropertyTable() throw();
 
@@ -88,13 +86,8 @@ public:
     virtual sal_Bool SAL_CALL hasElements(  ) throw( uno::RuntimeException);
 };
 
-SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw()
-: mpTable( pTable ), mpList( NULL ), mnWhich( nWhich )
-{
-}
-
 SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw()
-: mpTable( NULL ), mpList( pList ), mnWhich( nWhich )
+: mpList( pList ), mnWhich( nWhich )
 {
 }
 
@@ -104,9 +97,7 @@ SvxUnoXPropertyTable::~SvxUnoXPropertyTable() throw()
 
 XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const
 {
-    if( mpTable )
-        return mpTable->Get( index, 0 );
-    else if( mpList )
+    if( mpList )
         return mpList->Get( index, 0 );
     else
         return NULL;
@@ -135,7 +126,7 @@ void SAL_CALL SvxUnoXPropertyTable::insertByName( const  OUString& aName, const
 {
     SolarMutexGuard aGuard;
 
-    if( NULL == mpList && NULL == mpTable )
+    if( NULL == mpList )
         throw lang::IllegalArgumentException();
 
     if( hasByName( aName ) )
@@ -150,8 +141,6 @@ void SAL_CALL SvxUnoXPropertyTable::insertByName( const  OUString& aName, const
 
     if( mpList )
         mpList->Insert( pNewEntry );
-    else
-        mpTable->Insert( mpTable->Count(), pNewEntry );
 }
 
 void SAL_CALL SvxUnoXPropertyTable::removeByName( const  OUString& Name )
@@ -172,8 +161,6 @@ void SAL_CALL SvxUnoXPropertyTable::removeByName( const  OUString& Name )
         {
             if( mpList )
                 delete mpList->Remove( i );
-            else
-                delete mpTable->Remove( i );
             return;
         }
     }
@@ -204,8 +191,6 @@ void SAL_CALL SvxUnoXPropertyTable::replaceByName( const  OUString& aName, const
 
             if( mpList )
                 delete mpList->Replace( pNewEntry, i );
-            else
-                delete mpTable->Replace( i, pNewEntry );
             return;
         }
     }
commit 10938788cee4387b2c8ada8b127142c8eef754b3
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Mon Aug 29 06:57:05 2011 -0700

    Fix my bug: XColorTable is based on XPropertyList not XPropertyTable
    
    I should have changed this in the "rebase patch".

diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx
index 6f039f1..094432a 100644
--- a/svx/source/unodraw/unoctabl.cxx
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -147,7 +147,7 @@ void SAL_CALL SvxUnoColorTable::insertByName( const OUString& aName, const uno::
 void SAL_CALL SvxUnoColorTable::removeByName( const OUString& Name )
     throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 {
-    long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( Name ) : -1;
+    long nIndex = pTable ? ((XPropertyList*)pTable)->Get( Name ) : -1;
     if( nIndex == -1 )
         throw container::NoSuchElementException();
 
@@ -162,7 +162,7 @@ void SAL_CALL SvxUnoColorTable::replaceByName( const OUString& aName, const uno:
     if( !(aElement >>= nColor) )
         throw lang::IllegalArgumentException();
 
-    long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+    long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1;
     if( nIndex == -1  )
         throw container::NoSuchElementException();
 
@@ -174,7 +174,7 @@ void SAL_CALL SvxUnoColorTable::replaceByName( const OUString& aName, const uno:
 uno::Any SAL_CALL SvxUnoColorTable::getByName( const  OUString& aName )
     throw( container::NoSuchElementException,  lang::WrappedTargetException, uno::RuntimeException)
 {
-    long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+    long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1;
     if( nIndex == -1 )
         throw container::NoSuchElementException();
 
@@ -202,7 +202,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getElementNames(  )
 sal_Bool SAL_CALL SvxUnoColorTable::hasByName( const OUString& aName )
     throw( uno::RuntimeException )
 {
-    long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+    long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1;
     return nIndex != -1;
 }
 


More information about the Libreoffice-commits mailing list