[Libreoffice] [PATCH] fontdialog: Convert switch with only 1 case to an if ()

Sebastian Spaeth Sebastian at SSpaeth.de
Tue Sep 28 08:26:41 PDT 2010


This is a switch statement that only ever checks 1 case and has no
default action, so make it an if().

Remove some commented out code in the switch while taking the git
blame anyway.
---
 extensions/source/propctrlr/fontdialog.cxx |   23 ++++++-----------------
 1 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx
index 8c663f6..da9157a 100644
--- a/extensions/source/propctrlr/fontdialog.cxx
+++ b/extensions/source/propctrlr/fontdialog.cxx
@@ -605,23 +605,12 @@ namespace pcr
     //------------------------------------------------------------------------
     void ControlCharacterDialog::PageCreated( sal_uInt16 _nId, SfxTabPage& _rPage )
     {
-        SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
-        switch ( _nId )
-        {
-            case TABPAGE_CHARACTERS:
-//CHINA001				static_cast<SvxCharNamePage&>(_rPage).SetFontList(
-//CHINA001				static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))
-//CHINA001				);
-//CHINA001				static_cast<SvxCharNamePage&>(_rPage).DisableControls( DISABLE_HIDE_LANGUAGE );
-
-//CHINA001 				SvxFontListItem aFontListItem( static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST) ));
-//CHINA001 				aSet.Put ( SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
-
-//				aSet.Put (SfxUInt16Item(SID_CFID_FONTLIST,CFID_FONTLIST));
-                aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))));
-                aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE));
-                _rPage.PageCreated(aSet);
-                break;
+        if ( _nId == TABPAGE_CHARACTERS ) {
+            SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+            aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))));
+            aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE));
+            _rPage.PageCreated(aSet);
+            break;
         }
     }
 
-- 
1.7.0.4



More information about the LibreOffice mailing list