[Libreoffice-commits] core.git: cui/source

Caolán McNamara caolanm at redhat.com
Wed Mar 29 16:05:22 UTC 2017


 cui/source/inc/chardlg.hxx      |    3 +++
 cui/source/tabpages/chardlg.cxx |   25 ++++++++++++++++++-------
 2 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit d7f1a1689d70b2d66d0f727b6a898ef1a971da9d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 29 17:03:29 2017 +0100

    Resolves: tdf#106080 fix explicitly setting automatic in search by format
    
    this is still somewhat broken in that what you see is not what you get
    if you don't explicitly set automatic, but clears the regression part
    of things in that the old broken behavior is restored instead of the
    new broken behavior
    
    Change-Id: I8f53a276ee60f5c9f2f28d3b92a13990cc20314a

diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index fcbbefe3a9c3..b24a431e2ce5 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -173,6 +173,9 @@ class SvxCharEffectsPage : public SvxCharBasePage
 
 private:
     static const sal_uInt16 pEffectsRanges[];
+    bool                       m_bOrigFontColor;
+    bool                       m_bNewFontColor;
+    Color                      m_aOrigFontColor;
     VclPtr<FixedText>          m_pFontColorFT;
     VclPtr<SvxColorListBox>    m_pFontColorLB;
 
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index fcd7a3a98d71..a126b3234d08 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1334,6 +1334,8 @@ void SvxCharNamePage::PageCreated(const SfxAllItemSet& aSet)
 
 SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& rInSet )
     : SvxCharBasePage(pParent, "EffectsPage", "cui/ui/effectspage.ui", rInSet)
+    , m_bOrigFontColor(false)
+    , m_bNewFontColor(false)
 {
     get(m_pFontColorFT, "fontcolorft");
     get(m_pFontColorLB, "fontcolorlb");
@@ -1555,6 +1557,7 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
     sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
     SfxItemState eState = rSet.GetItemState( nWhich );
 
+    m_bOrigFontColor = false;
     switch ( eState )
     {
         case SfxItemState::UNKNOWN:
@@ -1588,22 +1591,29 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
             m_pPreviewWin->Invalidate();
 
             m_pFontColorLB->SelectEntry(aColor);
+
+            m_aOrigFontColor = aColor;
+            m_bOrigFontColor = true;
             break;
         }
     }
+    m_bNewFontColor = false;
 }
 
 bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
 {
     sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
-    const SvxColorItem* pOld = static_cast<const SvxColorItem*>(GetOldItem( rSet, SID_ATTR_CHAR_COLOR ));
-    bool bChanged = true;
     const SfxItemSet& rOldSet = GetItemSet();
 
-    Color aSelectedColor = m_pFontColorLB->GetSelectEntryColor();
+    Color aSelectedColor;
+    bool bChanged = m_bNewFontColor;
 
-    if (pOld && pOld->GetValue() == aSelectedColor)
-        bChanged = false;
+    if (bChanged)
+    {
+        aSelectedColor = m_pFontColorLB->GetSelectEntryColor();
+        if (m_bOrigFontColor)
+            bChanged = aSelectedColor != m_aOrigFontColor;
+    }
 
     if (bChanged)
         rSet.Put( SvxColorItem( aSelectedColor, nWhich ) );
@@ -1673,8 +1683,10 @@ IMPL_LINK_NOARG(SvxCharEffectsPage, TristClickHdl_Impl, Button*, void)
 }
 
 
-IMPL_LINK_NOARG(SvxCharEffectsPage, ColorBoxSelectHdl_Impl, SvxColorListBox&, void)
+IMPL_LINK(SvxCharEffectsPage, ColorBoxSelectHdl_Impl, SvxColorListBox&, rBox, void)
 {
+    if (m_pFontColorLB == &rBox)
+        m_bNewFontColor = true;
     UpdatePreview_Impl();
 }
 
@@ -2109,7 +2121,6 @@ void SvxCharEffectsPage::ChangesApplied()
     m_pShadowBtn->SaveValue();
     m_pBlinkingBtn->SaveValue();
     m_pHiddenBtn->SaveValue();
-    m_pFontColorLB->SaveValue();
 }
 
 bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )


More information about the Libreoffice-commits mailing list