[Libreoffice-commits] .: 4 commits - sfx2/inc sfx2/source

Caolán McNamara caolan at kemper.freedesktop.org
Sat Nov 13 13:05:51 PST 2010


 sfx2/inc/sfx2/objsh.hxx         |   27 +++-----------
 sfx2/source/dialog/templdlg.cxx |   26 --------------
 sfx2/source/doc/docvor.cxx      |   23 +++---------
 sfx2/source/doc/objcont.cxx     |   73 ++++++++--------------------------------
 4 files changed, 27 insertions(+), 122 deletions(-)

New commits:
commit f1871a23ac4825b2a253ac63b9205ab9aebc7f9f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 13 20:52:41 2010 +0000

    tidy code
    
    devirtualize non-overridden virtuals, remove unused parameters, and
    logically shrink based on that to minimum required

diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 130b9f4..f9eb6ae 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -553,22 +553,16 @@ public:
                                     SfxStyleSheetBasePool* ) const;
 
 
-    virtual sal_uInt16 			GetContentCount(
-                                        sal_uInt16 nIdx1 = INDEX_IGNORE,
-                                        sal_uInt16 nIdx2 = INDEX_IGNORE );
-    virtual sal_Bool   			CanHaveChilds(
-                                        sal_uInt16 nIdx1,
-                                            sal_uInt16 nIdx2 = INDEX_IGNORE );
-    virtual void   				GetContent( String &,
+    sal_uInt16                  GetContentCount(sal_uInt16 nIdx);
+    bool                        CanHaveChilds( sal_uInt16 nIdx1, sal_uInt16 nIdx2 );
+    void                        GetContent( String &,
                                         Bitmap &rClosedBitmap,
                                         Bitmap &rOpenedBitmap,
-                                        sal_Bool   &bCanDelete,
+                                        bool &bCanDelete,
                                         sal_uInt16 nPos,
-                                        sal_uInt16 nIdx1,
-                                        sal_uInt16 nIdx2 = INDEX_IGNORE );
+                                        sal_uInt16 nIdx1 );
 
-    virtual void                TriggerHelpPI(
-                                    sal_uInt16 nIdx1, sal_uInt16 nIdx2, sal_uInt16 nIdx3);
+    void                TriggerHelpPI(sal_uInt16 nIdx1, sal_uInt16 nIdx2);
 
     virtual Bitmap 				GetStyleFamilyBitmap(SfxStyleFamily eFamily);
 
commit c98643446524eaae7774e1b2cb315ce616b116f2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 13 20:23:06 2010 +0000

    tidy up hicontrast remains
    
    remove unused parameters, shrink code accordingly, devirtualize
    methods which are not overridden anywhere and only used by docvor.cxx

diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index 5f500ff..f9071e6 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -531,7 +531,7 @@ BOOL SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, BOOL bSelect )
 
     Path aPath(this, pEntry);
     GetObjectShell(aPath)->TriggerHelpPI(
-        aPath[nLevel+1], aPath[nLevel+2], aPath[nLevel+3]);
+        aPath[nLevel+1], aPath[nLevel+2]);
     return SvTreeListBox::Select(pEntry,bSelect);
 }
 
@@ -1187,19 +1187,18 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry )
             SfxObjectShellRef aRef = GetObjectShell(aPath);
             if(aRef.Is())
             {
-                const USHORT nCount = aRef->GetContentCount(
-                    aPath[nDocLevel+1], aPath[nDocLevel+2]);
+                const USHORT nCount = aRef->GetContentCount(aPath[nDocLevel+1]);
                 String aText;
                 Bitmap aClosedBmp, aOpenedBmp;
-                const BOOL bCanHaveChilds =
+                const bool bCanHaveChilds =
                     aRef->CanHaveChilds(aPath[nDocLevel+1],
                                         aPath[nDocLevel+2]);
                 for(USHORT i = 0; i < nCount; ++i)
                 {
-                    BOOL bDeletable;
+                    bool bDeletable;
                     aRef->GetContent(
                         aText, aClosedBmp, aOpenedBmp, bDeletable,
-                        i, aPath[nDocLevel+1], aPath[nDocLevel+2]);
+                        i, aPath[nDocLevel+1]);
 
                     // Create image with the correct mask color
                     Image aClosedImage( aClosedBmp, aMaskColor );
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index e647ed6..6ecc69f 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -329,11 +329,9 @@ void SfxObjectShell::SetOrganizerSearchMask(
 
 //--------------------------------------------------------------------
 
-USHORT SfxObjectShell::GetContentCount(
-    USHORT nIdx1,
-    USHORT /*nIdx2*/)
+sal_uInt16 SfxObjectShell::GetContentCount(sal_uInt16 nIdx)
 {
-    switch(nIdx1)
+    switch(nIdx)
     {
         case INDEX_IGNORE:
             return DEF_CONTENT_COUNT;
@@ -347,20 +345,14 @@ USHORT SfxObjectShell::GetContentCount(
         }
         case CONTENT_MACRO:
             break;
-/*
-        case CONTENT_CONFIG:
-            return ( GetConfigManager() ) ?
-                        GetConfigManager()->GetItemCount() : 0;
-            break;
- */
     }
     return 0;
 }
 
 
 //--------------------------------------------------------------------
-//TODO/CLEANUP: remove this method (it's virtual)
-void  SfxObjectShell::TriggerHelpPI(USHORT nIdx1, USHORT nIdx2, USHORT)
+//TODO/CLEANUP: remove this method
+void  SfxObjectShell::TriggerHelpPI(USHORT nIdx1, USHORT nIdx2)
 {
     if(nIdx1==CONTENT_STYLE && nIdx2 != INDEX_IGNORE) //StyleSheets
     {
@@ -369,38 +361,29 @@ void  SfxObjectShell::TriggerHelpPI(USHORT nIdx1, USHORT nIdx2, USHORT)
     }
 }
 
-BOOL   SfxObjectShell::CanHaveChilds(USHORT nIdx1,
-                                       USHORT nIdx2)
+bool SfxObjectShell::CanHaveChilds(sal_uInt16 nIdx1, sal_uInt16 nIdx2)
 {
-    switch(nIdx1) {
+    switch(nIdx1)
+    {
     case INDEX_IGNORE:
-        return TRUE;
+        return true;
     case CONTENT_STYLE:
-        return INDEX_IGNORE == nIdx2 || !GetStyleSheetPool()? FALSE: TRUE;
+        return INDEX_IGNORE == nIdx2 || !GetStyleSheetPool() ? false : true;
     case CONTENT_MACRO:
-//!!    return INDEX_IGNORE == nIdx2? FALSE: TRUE;
-        return FALSE;
-/*
-    case CONTENT_CONFIG:
-        return INDEX_IGNORE == nIdx2 ? FALSE : TRUE;
- */
+        return false;
     }
-    return FALSE;
+    return false;
 }
 
 //--------------------------------------------------------------------
 
-void   SfxObjectShell::GetContent(String &rText,
-                                  Bitmap &rClosedBitmap,
-                                  Bitmap &rOpenedBitmap,
-                                  BOOL &bCanDel,
-                                  USHORT i,
-                                  USHORT nIdx1,
-                                  USHORT /*nIdx2*/ )
+void SfxObjectShell::GetContent(String &rText,
+    Bitmap &rClosedBitmap, Bitmap &rOpenedBitmap,
+    bool &bCanDel, sal_uInt16 i, sal_uInt16 nIdx)
 {
-    bCanDel=TRUE;
+    bCanDel=true;
 
-    switch(nIdx1)
+    switch(nIdx)
     {
         case INDEX_IGNORE:
         {
commit ed9367d7ef823cdaf6097b45d2f91e3901c47bab
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 13 17:33:42 2010 +0000

    remove unused stuff behind unset ifdef since 2000

diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 15d3558..b671bbf 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -2205,32 +2205,6 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox
     // HilfePI antriggern, wenn von Call als Handler und Bereich erlaubt ist
     if( !pListBox || pListBox->IsSelected( pListBox->GetHdlEntry() ) )
     {
-#ifdef WIR_KOENNEN_WIEDER_HILFE_FUER_STYLESHEETS
-        SfxHelpPI* pHelpPI = SFX_APP()->GetHelpPI();
-        if ( pHelpPI && pListBox && IsInitialized() &&
-             GetSelectedEntry().Len() )
-        {
-            const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
-            const SfxStyleFamily eFam = pItem->GetFamily();
-            DBG_ASSERT(pStyleSheetPool, "Kein Pool");
-            // SfxStyleSheetBase* pStyle = pStyleSheetPool
-            //		? pStyleSheetPool->Find( GetSelectedEntry(), eFam ) : 0;
-            SfxStyleSheetBase *pStyle;
-            if ( pStyleSheetPool )
-                pStyle = pStyleSheetPool->Find ( GetSelectedEntry(), eFam );
-            else
-                pStyle = 0;
-
-            if ( pStyle )
-            {
-                String aHelpFile;
-                ULONG nHelpId=pStyle->GetHelpId(aHelpFile);
-                if ( nHelpId )
-                    pHelpPI->LoadTopic( nHelpId );
-            }
-        }
-#endif
-
         // nur, wenn Giesskanne an ist
         if ( IsInitialized() &&
              IsCheckedItem(SID_STYLE_WATERCAN) &&
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index c863877..e647ed6 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -366,17 +366,6 @@ void  SfxObjectShell::TriggerHelpPI(USHORT nIdx1, USHORT nIdx2, USHORT)
     {
         SfxStyleSheetBasePool *pStylePool = GetStyleSheetPool();
         SetOrganizerSearchMask(pStylePool);
-#ifdef WIR_KOENNEN_WIEDER_HILFE_FUER_STYLESHEETS
-        SfxStyleSheetBase *pStyle = (*pStylePool)[nIdx2];
-        if(pStyle)
-        {
-            String aHelpFile;
-            ULONG nHelpId=pStyle->GetHelpId(aHelpFile);
-            SfxHelpPI* pHelpPI = SFX_APP()->GetHelpPI();
-            if ( pHelpPI && nHelpId )
-                pHelpPI->LoadTopic( nHelpId );
-        }
-#endif
     }
 }
 
commit 069a9f61693d8f0aaa61fadd776693a229412708
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 13 17:32:14 2010 +0000

    remove unused HiContrast args

diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 76ae476..130b9f4 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -567,15 +567,6 @@ public:
                                         sal_uInt16 nIdx1,
                                         sal_uInt16 nIdx2 = INDEX_IGNORE );
 
-    virtual void   				GetContent( String &,
-                                        Bitmap &rClosedBitmap,
-                                        Bitmap &rOpenedBitmap,
-                                        BmpColorMode eColorMode,
-                                        sal_Bool   &bCanDelete,
-                                        sal_uInt16 nPos,
-                                        sal_uInt16 nIdx1,
-                                        sal_uInt16 nIdx2 = INDEX_IGNORE );
-
     virtual void                TriggerHelpPI(
                                     sal_uInt16 nIdx1, sal_uInt16 nIdx2, sal_uInt16 nIdx3);
 
diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index 179130e..5f500ff 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -1165,20 +1165,10 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry )
 */
 
 {
-    // wenn keine Childs vorhanden sind, gfs. Childs
-    // einfuegen
-    BmpColorMode eColorMode = BMP_COLOR_NORMAL;
-
-    if ( GetSettings().GetStyleSettings().GetHighContrastMode() )
-        eColorMode = BMP_COLOR_HIGHCONTRAST;
-
-
     if ( !GetModel()->HasChilds( pEntry ) )
     {
         WaitObject aWaitCursor( this );
 
-        // Choose the correct mask color dependent from eColorMode. This must be adopted if
-        // we change the mask color for normal images, too!
         Color aMaskColor( COL_LIGHTMAGENTA );
 
         // hier sind alle initial eingefuegt
@@ -1208,7 +1198,7 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry )
                 {
                     BOOL bDeletable;
                     aRef->GetContent(
-                        aText, aClosedBmp, aOpenedBmp, eColorMode, bDeletable,
+                        aText, aClosedBmp, aOpenedBmp, bDeletable,
                         i, aPath[nDocLevel+1], aPath[nDocLevel+2]);
 
                     // Create image with the correct mask color
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 97cbc54..c863877 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -401,24 +401,9 @@ BOOL   SfxObjectShell::CanHaveChilds(USHORT nIdx1,
 
 //--------------------------------------------------------------------
 
-void SfxObjectShell::GetContent(String &rText,
-                                Bitmap &rClosedBitmap,
-                                Bitmap &rOpenedBitmap,
-                                BOOL &bCanDel,
-                                USHORT i,
-                                USHORT nIdx1,
-                                USHORT nIdx2 )
-{
-    DBG_ERRORFILE( "Non high contrast method called. Please update calling code!" );
-    SfxObjectShell::GetContent( rText, rClosedBitmap, rOpenedBitmap, BMP_COLOR_NORMAL, bCanDel, i, nIdx1, nIdx2 );
-}
-
-//--------------------------------------------------------------------
-
 void   SfxObjectShell::GetContent(String &rText,
                                   Bitmap &rClosedBitmap,
                                   Bitmap &rOpenedBitmap,
-                                  BmpColorMode eColorMode,
                                   BOOL &bCanDel,
                                   USHORT i,
                                   USHORT nIdx1,


More information about the Libreoffice-commits mailing list