[Libreoffice-commits] core.git: sd/source sd/uiconfig

Rohan Kumar rohankanojia420 at gmail.com
Wed Mar 1 10:59:11 UTC 2017


 sd/source/ui/dlg/prltempl.cxx          |    1 +
 sd/source/ui/func/futempl.cxx          |   22 ++++++++++++++++++++++
 sd/source/ui/inc/prltempl.hxx          |    1 +
 sd/uiconfig/sdraw/ui/drawprtldialog.ui |   14 ++++++++++++++
 4 files changed, 38 insertions(+)

New commits:
commit a04abc59ae24690992a771305a4e89451c77c289
Author: Rohan Kumar <rohankanojia420 at gmail.com>
Date:   Sat Jan 21 01:31:34 2017 +0530

    tdf#96681 Lack of UI to change the text background color of a style
    
    Added Highlighting tab to Edit Style button in impress
    
    Change-Id: I9426f583da4078cd380823bbaa30ce1941ffa3bd
    Reviewed-on: https://gerrit.libreoffice.org/23684
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx
index 7c25490..03dfaf4 100644
--- a/sd/source/ui/dlg/prltempl.cxx
+++ b/sd/source/ui/dlg/prltempl.cxx
@@ -149,6 +149,7 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
     mnTab =  AddTabPage( "RID_SVXPAGE_TABULATOR", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TABULATOR ), nullptr );
     mnAsian = AddTabPage( "RID_SVXPAGE_PARA_ASIAN", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PARA_ASIAN ), nullptr );
     mnAlign = AddTabPage( "RID_SVXPAGE_ALIGN_PARAGRAPH", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGN_PARAGRAPH ), nullptr );
+    mnBackground = AddTabPage( "RID_SVXPAGE_BACKGROUND", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), nullptr);
 
     SvtCJKOptions aCJKOptions;
     if( !aCJKOptions.IsAsianTypographyEnabled() )
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index bd97800..30893d8 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -36,6 +36,8 @@
 #include <editeng/editeng.hxx>
 #include <editeng/lrspitem.hxx>
 #include <svx/svdopage.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/brushitem.hxx>
 #include <svx/svditer.hxx>
 #include <svx/sdr/properties/properties.hxx>
 
@@ -103,6 +105,10 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
     SfxStyleSheetBase* pStyleSheet = nullptr;
 
     const SfxPoolItem* pItem;
+    static const sal_uInt16 aRanges[] = {
+        EE_ITEMS_START, EE_ITEMS_END,
+        SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR
+    };
     SfxStyleFamily nFamily = (SfxStyleFamily)USHRT_MAX;
     if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY,
         false, &pItem ))
@@ -299,6 +305,15 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
                 ScopedVclPtr<SfxAbstractTabDialog> pPresDlg;
                 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
                 bool bOldDocInOtherLanguage = false;
+                SfxItemSet aNewAttr(mpViewShell->GetPool(), aRanges);
+
+                if( aNewAttr.GetItemState( XATTR_FILLBACKGROUND, true, &pItem ) == SfxItemState::SET)
+                {
+                    Color aBackColor = static_cast<const SvxBackgroundColorItem*>(pItem)->GetValue();
+                    SvxBrushItem aBrushItem(aBackColor, XATTR_FILLBACKGROUND);
+                    aNewAttr.ClearItem(XATTR_FILLBACKGROUND);
+                    aNewAttr.Put(aBrushItem);
+                }
 
                 SfxStyleFamily eFamily = pStyleSheet->GetFamily();
 
@@ -399,6 +414,13 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
                             SfxItemSet aTempSet(*pOutSet);
                             static_cast<SdStyleSheet*>(pStyleSheet)->AdjustToFontHeight(aTempSet);
 
+                            const SvxBrushItem* pBrushItem = static_cast<const SvxBrushItem*>(aTempSet.GetItem(XATTR_FILLBACKGROUND));
+                            if( pBrushItem )
+                            {
+                               SvxBackgroundColorItem aBackColorItem( pBrushItem->GetColor(), EE_CHAR_BKGCOLOR);
+                               aTempSet.ClearItem(XATTR_FILLBACKGROUND);
+                               aTempSet.Put(aBackColorItem);
+                            }
                             /* Special treatment: reset the INVALIDS to
                                NULL-Pointer (otherwise INVALIDs or pointer point
                                to DefaultItems in the template; both would
diff --git a/sd/source/ui/inc/prltempl.hxx b/sd/source/ui/inc/prltempl.hxx
index e2b8bc6..0694e86 100644
--- a/sd/source/ui/inc/prltempl.hxx
+++ b/sd/source/ui/inc/prltempl.hxx
@@ -61,6 +61,7 @@ private:
     sal_uInt16            mnTab;
     sal_uInt16            mnAsian;
     sal_uInt16            mnAlign;
+    sal_uInt16            mnBackground;
 
     PresentationObjects ePO;
 
diff --git a/sd/uiconfig/sdraw/ui/drawprtldialog.ui b/sd/uiconfig/sdraw/ui/drawprtldialog.ui
index c5c5fa2..561f630 100644
--- a/sd/uiconfig/sdraw/ui/drawprtldialog.ui
+++ b/sd/uiconfig/sdraw/ui/drawprtldialog.ui
@@ -298,6 +298,20 @@
                 <property name="tab_fill">False</property>
               </packing>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="RID_SVXPAGE_BACKGROUND">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Highlighting</property>
+              </object>
+              <packing>
+                <property name="position">15</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>


More information about the Libreoffice-commits mailing list