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

Muthu Subramanian sumuthu at kemper.freedesktop.org
Tue Jan 31 23:31:34 PST 2012


 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         |  132 ++++++++++++++++++++-------------------
 svx/source/tbxctrls/tbcontrl.cxx |   60 ++++++++++-------
 6 files changed, 116 insertions(+), 92 deletions(-)

New commits:
commit 4daa3f54437730fe4e509082faa0d3509c62cea0
Author: Winfried Donkers <W.Donkers at dci-electronics.nl>
Date:   Wed Feb 1 13:17:26 2012 +0530

    fdo#34425: [Feature] Persist bgcolor toolbar button.
    
    This is to avoid background color selection evertime.

diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 0a57bf6..4675a2e 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 cdbd93b..32f218d 100644
--- a/svx/inc/svx/tbcontrl.hxx
+++ b/svx/inc/svx/tbcontrl.hxx
@@ -104,7 +104,7 @@
         Note:           Analysis of BrushItem:
                         Brush-FillColor() is misused as switch,
                         to distinguish whether a new style
-			or a new color has been set
+                        or a new color has been set
 
                         GetFillColor() == COL_BLACK -> GetStyle() ,
                         GetFillColor() == COL_WHITE -> GetColor()
@@ -319,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..067a0ca 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -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,26 +2305,29 @@ 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 ( bChoiceFromPalette )
     {
-        if ( SFX_ITEM_DONTCARE != eState )
+        bChoiceFromPalette = sal_False;
+        if ( nSID == SID_ATTR_CHAR_COLOR_EXT ||
+                nSID == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT )
         {
-            const SfxBoolItem* pBool = PTR_CAST( SfxBoolItem, pState );
-            rTbx.CheckItem( nId, pBool && pBool->GetValue());
+            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 );
         }
-        rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
-    }
-    else
-    {
-        if ( SFX_ITEM_DONTCARE != eState )
-           pItem = PTR_CAST( SvxColorItem, pState );
-
-        if ( pItem )
+        else
         {
-            pBtnUpdater->Update( pItem->GetValue() );
-            mLastColor = pItem->GetValue();
+            if ( SFX_ITEM_DONTCARE != eState )
+                pItem = PTR_CAST( SvxColorItem, pState );
+
+            if ( pItem )
+            {
+                pBtnUpdater->Update( pItem->GetValue() );
+                mLastColor = pItem->GetValue();
+            }
         }
     }
 }
@@ -2332,15 +2338,23 @@ 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 );
commit afc2de3e042401cee079b0bb65873ac7beca1769
Author: Winfried Donkers <W.Donkers at dci-electronics.nl>
Date:   Wed Feb 1 13:06:42 2012 +0530

    German comments translations.

diff --git a/svx/inc/svx/tbcontrl.hxx b/svx/inc/svx/tbcontrl.hxx
index ad465ef..cdbd93b 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:
-
-                        GetFillColor() == COL_BLACK -> GetStyle() auswerten,
-                        GetFillColor() == COL_WHITE -> GetColor() auswerten
+        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() ,
+                        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;


More information about the Libreoffice-commits mailing list