Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Attached the patch for fdo34425.
Also, I translated the german comments in tbcontrl.hxx (plus corrected one typing error in it)

Winfried
From edc9e766596ca7ef1d297e285a948ac05d03b994 Mon Sep 17 00:00:00 2001
From: Winfried Donkers <osc@dci-electronics.nl>
Date: Sat, 21 Jan 2012 11:34:26 +0100
Subject: [PATCH] patch for fdo 34425 and translated german comments in
 tbcontrl.hxx

---
 sc/source/ui/app/scdll.cxx       |    2 +-
 sc/source/ui/inc/tabvwsh.hxx     |    4 +
 sc/source/ui/view/formatsh.cxx   |    9 ++-
 sc/source/ui/view/tabvwsh4.cxx   |    1 +
 svx/inc/svx/tbcontrl.hxx         |  130 +++++++++++++++++++------------------
 svx/source/tbxctrls/tbcontrl.cxx |   74 +++++++++++++---------
 6 files changed, 122 insertions(+), 98 deletions(-)

diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 9cf9555..a325fc2 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -204,7 +204,7 @@ void ScDLL::Init()
     SvxFontNameToolBoxControl       ::RegisterControl(SID_ATTR_CHAR_FONT,       pMod);
 //  SvxFontHeightToolBoxControl     ::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod);
     SvxFontColorToolBoxControl      ::RegisterControl(SID_ATTR_CHAR_COLOR,      pMod);
-    SvxColorToolBoxControl          ::RegisterControl(SID_BACKGROUND_COLOR,     pMod);
+    SvxFontColorExtToolBoxControl   ::RegisterControl(SID_BACKGROUND_COLOR,     pMod);
     SvxFrameToolBoxControl          ::RegisterControl(SID_ATTR_BORDER,          pMod);
     SvxFrameLineStyleToolBoxControl ::RegisterControl(SID_FRAME_LINESTYLE,      pMod);
     SvxFrameLineColorToolBoxControl ::RegisterControl(SID_FRAME_LINECOLOR,      pMod);
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 05e6838..1bd0fb1 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -108,6 +108,7 @@ private:
     static sal_uInt16           nInsertCtrlState;
     static sal_uInt16           nInsCellsCtrlState;
     static sal_uInt16           nInsObjCtrlState;
+    static Color                aBackgroundColor;
 
     SvxHtmlOptions          aHTMLOpt;
     ObjectSelectionType     eCurOST;
@@ -423,6 +424,9 @@ public:
 
     bool    ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
 
+    void    SetBackgroundColor( const Color& aCol ) { aBackgroundColor = aCol; }
+    Color   GetBackgroundColor()                    { return aBackgroundColor; }
+
     using ScTabView::ShowCursor;
 
     // ugly hack to call Define Names from Manage Names
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 1718741..bbb44ae 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1452,13 +1452,12 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
 
             case SID_BACKGROUND_COLOR:
                 {
-                    //  SID_BACKGROUND_COLOR without arguments -> set transparent background
-
+                    //  SID_BACKGROUND_COLOR without arguments -> set background to last used color
                     SvxBrushItem        aBrushItem( (const SvxBrushItem&)
                                             pTabViewShell->GetSelectionPattern()->
                                                 GetItem( ATTR_BACKGROUND ) );
 
-                    aBrushItem.SetColor( COL_TRANSPARENT );
+                    aBrushItem.SetColor( pTabViewShell->GetBackgroundColor()  );
 
                     pTabViewShell->ApplyAttr( aBrushItem );
                 }
@@ -1643,7 +1642,9 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                                             pTabViewShell->GetSelectionPattern()->
                                                 GetItem( ATTR_BACKGROUND ) );
 
-                    aBrushItem.SetColor( rNewColorItem.GetValue() );
+                    Color aSet = rNewColorItem.GetValue();
+                    pTabViewShell->SetBackgroundColor( aSet );
+                    aBrushItem.SetColor( aSet );
 
                     pTabViewShell->ApplyAttr( aBrushItem );
                 }
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index f8e2ab8..5ad0d03 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -109,6 +109,7 @@ using namespace com::sun::star;
 sal_uInt16 ScTabViewShell::nInsertCtrlState = SID_INSERT_GRAPHIC;
 sal_uInt16 ScTabViewShell::nInsCellsCtrlState = 0;
 sal_uInt16 ScTabViewShell::nInsObjCtrlState = SID_INSERT_DIAGRAM;
+Color      ScTabViewShell::aBackgroundColor = COL_TRANSPARENT;
 
 // -----------------------------------------------------------------------
 
diff --git a/svx/inc/svx/tbcontrl.hxx b/svx/inc/svx/tbcontrl.hxx
index ad465ef..f74c20e 100644
--- a/svx/inc/svx/tbcontrl.hxx
+++ b/svx/inc/svx/tbcontrl.hxx
@@ -30,130 +30,133 @@
 
 /*--------------------------------------------------------------*\
 
-    Beschreibung:
+    Description:
     -------------
-    ToolBox-Controler fuer:
-        Font-Name, Font-Hoehe, Font-Farbe
-        Vorder-/Hintergrundfarbe /-Muster
-        Rahmen, Linien
-        (Absatz-)Vorlagen
+    ToolBox-Controller for:
+        Font-Name, Font-Height, Font-Color
+        Fore-/Background color /-patterns
+        Frames, Lines
+        (indentation-)templates
 
-    Bedienung:
+    Use:
     ----------
         SvxFontNameToolBoxControl
         -------------------------
-        Item-Typ:       SvxFontItem
+        Item type:      SvxFontItem
         Execute-Id:     SID_ATTR_CHAR_FONT
                         -> SvxFontItem
-        Zusatzdaten
-        aus DocShell:   SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
+        Additional information
+        from DocShell:   SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
 
         SvxFontHeightToolBoxControl
         ---------------------------
-        Item-Typ:       SvxFontHeightItem
+        Item type:      SvxFontHeightItem
         Execute-Id:     SID_ATTR_CHAR_FONTHEIGHT
                         -> SvxFontHeightItem
-        Zusatzdaten
-        aus DocShell:   SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
+        Additional information
+        from DocShell:   SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
 
         SvxFontColorToolBoxControl
         --------------------------
-        Item-Typ:       SvxFontColorItem
+        Item type:      SvxFontColorItem
         Execute-Id:     SID_ATTR_CHAR_COLOR
                         -> SvxFontColorItem
-        Zusatzdaten
-        aus DocShell:   z.Zt. keine
-                        in Zukunft: Farbpalette
+        Additional information
+        from DocShell:  presently none
+                        in future: color palette
 
         class SvxFontColorExtToolBoxControl
         -----------------------------------
-        fuer die Zeichenfarbe
-        Item-Typ        SvxColorItem
+        for font color
+        Item type:      SvxColorItem
                     und SfxBoolItem
-        Execute-Id      SID_ATTR_CHAR_COLOR
+        Execute-Id      SID_ATTR_CHAR_COLOR2
                     und SID_ATTR_CHAR_COLOR_EXT
 
-        fuer den Zeichenhintergrund
+        for character background color (writer)
         Item-Typ        SvxColorItem
                     und SfxBoolItem
         Execute-Id      SID_ATTR_CHAR_COLOR_BACKGROUND
                     und SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
 
+        for  cell background color (calc)
+        Item-Typ        SvxColorItem
+                    und SfxBoolItem
+        Execute-Id      SID_ATTR_CHAR_COLOR_BACKGROUND
+
         SvxColorToolBoxControl
         --------------------------------
-        Item-Typ:       SvxBrushItem
+        Item type:      SvxBrushItem
         Execute-Id:     SID_BACKGROUND_COLOR
                         -> SvxColorItem
-        Zusatzdaten
-        aus DocShell:   z.Zt. keine
-                        in Zukunft: Farbpalette
+        Additional information
+        from DocShell:   presently none
+                        in future: color palette
 
         SvxPatternToolBoxControl
         ------------------------
-        Item-Typ:       SvxBrushItem
+        Item type:      SvxBrushItem
         Execute-Id:     SID_BACKGROUND_PATTERN
                         -> SvxBrushItem
-        Zusatzdaten
-        aus DocShell:   z.Zt. keine
-                        in Zukunft: Farbpalette
-        Bemerkung:      Auswertung des BrushItems:
-                        Die Brush-FillColor() wird als Schalter
-                        missbraucht, um zu unterscheiden, ob ein
-                        neuer Style oder eine neue Farbe
-                        gesetzt wurde:
+        Additional information
+        from DocShell:   presently none
+                        in future: color palette
+        Note:           Analysis of BrushItem:
+                        Brush-FillColor() is misused as switch,
+                        to distinguish whether a new style
+                       or a new color has been set
 
-                        GetFillColor() == COL_BLACK -> GetStyle() auswerten,
-                        GetFillColor() == COL_WHITE -> GetColor() auswerten
+                        GetFillColor() == COL_BLACK -> GetStyle() ,
+                        GetFillColor() == COL_WHITE -> GetColor()
 
         SvxFrameToolBoxControl
         ----------------------
-        Item-Typ:       SvxBoxItem
+        Item type:      SvxBoxItem
         Execute-Id:     SID_ATTR_BORDER
                         -> SvxBoxItem & SvxBoxInfoItem
-        Zusatzdaten
-        aus DocShell:   keine
-        Bemerkung:      liefert je nach gewaehltem ValueSet-Item
-                        nur SvxBoxItem oder zusaetzlich SvxBoxInfoItem
-                        Wird dem Controller ein SfxUInt16Item mit einem
-                        Wert != 0 geschickt, so wird der Paragraph-Mode
-                        eingeschaltet, d.h. die letzte Zeile wird
-                        ausgeblendet. Ein Wert == 0 schaltet wieder in
-                        den Tabellenmodus.
+        Additional information
+        from DocShell:  none
+        Bemerkung:      provides dependant of chosen ValueSet-Item
+                        only SvxBoxItem or additionally SvxBoxInfoItem
+                        If the Controller ein SfxUInt16Item receives a
+                        value != 0, paragraph mode will be switched on,
+                        i.e. the last line will be hidden.
+                        A value == 0 switches again to Tabel mode.
 
         SvxFrameLineStyleToolBoxControl
         -------------------------------
-        Item-Typ:       SvxLineItem
+        Item type:      SvxLineItem
         Execute-Id:     SID_FRAME_LINESTYLE
                         -> SvxLineItem
-        Zusatzdaten
-        aus DocShell:   keine
-        Bemerkung:      liefert ein SvxLineItem, welches eine SvxBorderLine
-                        ohne Farbinformation liefert.
+        Additional information
+        from DocShell:  none
+        Bemerkung:      provides a SvxLineItem, which provides a SvxBorderLine
+                        without color information.
 
         SvxFrameLineColorToolBoxControl
         -------------------------------
-        Item-Typ:       SvxColorItem
+        Item type:      SvxColorItem
         Execute-Id:     SID_FRAME_LINECOLOR
                         -> SvxColorItem
-        Zusatzdaten
-        aus DocShell:   keine
+        Additional information
+        from DocShell:   none
 
         SvxStyleToolBoxControl
         ----------------------
-        Item-Typ:       SfxTemplateItem
+        Item type:      SfxTemplateItem
         Execute-Id:     SID_TEMPLATE_APPLY
                         -> StyleName (SfxStringItem)
                         -> eStyleFamily (SfxUInt16Item)
-        Zusatzdaten
-        aus DocShell:   keine
-        Bemerkung:      Umschalten der Familie ueber Invalidate
-                        an den Bindings (->SfxStyleControllerItem)
+        Additional information
+        from DocShell:  none
+        Bemerkung:      Switch family by Invalidate
+                        at the Bindings (->SfxStyleControllerItem)
 
 \*--------------------------------------------------------------*/
 
 // include ---------------------------------------------------------------
 
-// ITEMID_...-Defines im *.cxx
+// ITEMID_...-Defines i *.cxx
 
 #include <rsc/rscsfx.hxx>
 #include <svl/lstner.hxx>
@@ -163,7 +166,7 @@
 
 #include <com/sun/star/awt/FontDescriptor.hpp>
 
-// wichtig im mit HeDaBu erzeugtem tbxctrls.hxx!!!
+// important im tbxctrls.hxx created HeDaBu !!!
 class SvxLineItem;
 class SvxBoxInfoItem;
 class SvxFontItem;
@@ -214,9 +217,9 @@ private:
     SfxStyleControllerItem_Impl*        pBoundItems [MAX_FAMILIES];
     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > 
m_xBoundItems[MAX_FAMILIES];
     SfxTemplateItem*                    pFamilyState[MAX_FAMILIES];
-    sal_uInt16                              nActFamily; // Id in der ToolBox = Position - 1
+    sal_uInt16                              nActFamily; // Id in the ToolBox = Position - 1
     sal_uInt16                              nActFilter; // FilterIdx
-    sal_uInt16                              nAppFilter; // Filter, den die App gesetzt hat
+    sal_uInt16                              nAppFilter; // Filter, that the App has set
     String                              aCurSel;
     sal_Bool                                bListening;
     Impl*                               pImpl;
@@ -316,6 +319,7 @@ class SVX_DLLPUBLIC SvxFontColorExtToolBoxControl : public SfxToolBoxControl
     //  SfxStatusForwarder          aForward;
     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
     Color                               mLastColor;
+    sal_Bool                            bChoiceFromPalette;
 
 public:
     SFX_DECL_TOOLBOX_CONTROL();
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 9d9745b..dc36bd3 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1560,7 +1560,7 @@ struct SvxStyleToolBoxControl::Impl
                         xParaStyles->getByName( rtl::OUString::createFromAscii( 
aWriterStyles[nStyle] )) >>= xStyle;
                         ::rtl::OUString sName;
                         
xStyle->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DisplayName"))) >>= sName;
-                        if( !sName.isEmpty() )
+                        if( sName.getLength() )
                             aDefaultStyles.push_back(sName);
                     }
                     catch( const uno::Exception& )
@@ -1593,7 +1593,7 @@ struct SvxStyleToolBoxControl::Impl
                             Reference< beans::XPropertySet > xStyle( xCellStyles->getByName( 
sStyleName), UNO_QUERY_THROW );
                             ::rtl::OUString sName;
                             
xStyle->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DisplayName"))) >>= sName;
-                            if( !sName.isEmpty() )
+                            if( sName.getLength() )
                                 aDefaultStyles.push_back(sName);
                         }
                     }
@@ -2244,14 +2244,16 @@ SvxFontColorExtToolBoxControl::SvxFontColorExtToolBoxControl(
     mLastColor( COL_AUTO )
 {
     rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
-    // The following commands are available at the writer module.
-    if ( SID_ATTR_CHAR_COLOR2 == nSlotId )
+    bChoiceFromPalette = sal_False;
+
+    // The following commands are available at the writer and the calc module.
+    if ( SID_ATTR_CHAR_COLOR2 == nSlotId || SID_ATTR_CHAR_COLOR == nSlotId )
         addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharColorExt" )));
     else
         addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharBackgroundExt" )));
 
-    sal_uInt16 nMode =  SID_ATTR_CHAR_COLOR2 == nSlotId
-        ? TBX_UPDATER_MODE_CHAR_COLOR_NEW : TBX_UPDATER_MODE_CHAR_COLOR_NEW;
+    sal_uInt16 nMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW;
+
     pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox(), nMode );
 }
 
@@ -2289,6 +2291,7 @@ SfxPopupWindow* SvxFontColorExtToolBoxControl::CreatePopupWindow()
         FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF );
     pColorWin->StartSelection();
     SetPopupWindow( pColorWin );
+    bChoiceFromPalette = sal_True;
     return pColorWin;
 }
 
@@ -2302,28 +2305,31 @@ void SvxFontColorExtToolBoxControl::StateChanged(
     sal_uInt16 nId = GetId();
     ToolBox& rTbx = GetToolBox();
     const SvxColorItem* pItem = 0;
-
-    if ( nSID == SID_ATTR_CHAR_COLOR_EXT ||
-         nSID == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT )
-    {
-        if ( SFX_ITEM_DONTCARE != eState )
-        {
-            const SfxBoolItem* pBool = PTR_CAST( SfxBoolItem, pState );
-            rTbx.CheckItem( nId, pBool && pBool->GetValue());
-        }
-        rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
-    }
-    else
+    if ( bChoiceFromPalette )
     {
-        if ( SFX_ITEM_DONTCARE != eState )
-           pItem = PTR_CAST( SvxColorItem, pState );
+        bChoiceFromPalette = sal_False;
+       if ( nSID == SID_ATTR_CHAR_COLOR_EXT ||
+            nSID == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT )
+       {
+            if ( SFX_ITEM_DONTCARE != eState )
+           {
+               const SfxBoolItem* pBool = PTR_CAST( SfxBoolItem, pState );
+               rTbx.CheckItem( nId, pBool && pBool->GetValue());
+           }
+           rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+       }
+       else
+       {
+           if ( SFX_ITEM_DONTCARE != eState )
+              pItem = PTR_CAST( SvxColorItem, pState );
 
-        if ( pItem )
-        {
-            pBtnUpdater->Update( pItem->GetValue() );
-            mLastColor = pItem->GetValue();
-        }
-    }
+           if ( pItem )
+           {
+              pBtnUpdater->Update( pItem->GetValue() );
+              mLastColor = pItem->GetValue();
+           }
+       }
+     }
 }
 
 // -----------------------------------------------------------------------
@@ -2332,16 +2338,24 @@ void SvxFontColorExtToolBoxControl::Select( sal_Bool )
 {
     OUString aCommand;
     OUString aParamName;
-    if ( SID_ATTR_CHAR_COLOR2 == GetSlotId() )
+    if ( SID_ATTR_CHAR_COLOR2 == GetSlotId() || SID_ATTR_CHAR_COLOR == GetSlotId() )
     {
         aCommand    = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharColorExt" ));
         aParamName  = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColorExt" ));
     }
     else
     {
-        aCommand    = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharBackgroundExt" ));
-        aParamName  = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharBackgroundExt" ));
-    }
+        if ( SID_BACKGROUND_COLOR == GetSlotId() )
+       {
+           aCommand    = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BackgroundColor" ));
+           aParamName  = OUString( RTL_CONSTASCII_USTRINGPARAM( "BackgroundColor" ));
+       }
+       else
+       {
+           aCommand    = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharBackgroundExt" ));
+           aParamName  = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharBackgroundExt" ));
+       }
+     }
 
     Sequence< PropertyValue > aArgs( 1 );
     aArgs[0].Name  = aParamName;
-- 
1.7.7


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.