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

Caolán McNamara caolanm at redhat.com
Tue Feb 21 09:03:59 UTC 2017


 cui/source/tabpages/chardlg.cxx  |   16 ++++++----
 svx/source/tbxctrls/tbcontrl.cxx |   61 +++++++++++++++++++++++----------------
 2 files changed, 46 insertions(+), 31 deletions(-)

New commits:
commit 0fa4efec2e58ecd8d749972f1e8c2a20d1c3a6bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 20 21:24:25 2017 +0000

    Resolves: tdf#106099 tweak to restore old behaviour
    
    wrt initial default color if none gets set.
    
    This doesn't fix the various bizarre things in font and replace by formats, just
    restore to its historical initial behaviour
    
    Change-Id: I82cc3f05d2f205947a140483537baae882e91530

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 28bc427..a73c223 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1447,35 +1447,44 @@ NamedColor SvxColorWindow::GetNoneColor() const
     return std::make_pair(aColor, sColorName);
 }
 
-NamedColor SvxColorWindow::GetAutoColor() const
+namespace
 {
-    Color aColor;
-    OUString sColorName;
-    switch (theSlotId)
+    NamedColor GetAutoColor(sal_uInt16 nSlotId)
     {
-        case SID_ATTR_CHAR_COLOR_BACKGROUND:
-        case SID_BACKGROUND_COLOR:
-        case SID_ATTR_CHAR_BACK_COLOR:
-            aColor = COL_TRANSPARENT;
-            sColorName = SVX_RESSTR(RID_SVXSTR_NOFILL);
-            break;
-        case SID_AUTHOR_COLOR:
-            aColor = COL_TRANSPARENT;
-            sColorName = SVX_RESSTR(RID_SVXSTR_BY_AUTHOR);
-            break;
-        case SID_BMPMASK_COLOR:
-            aColor = COL_TRANSPARENT;
-            sColorName = SVX_RESSTR(RID_SVXSTR_TRANSPARENT);
-            break;
-        case SID_ATTR_CHAR_COLOR:
-        case SID_ATTR_CHAR_COLOR2:
-        case SID_EXTRUSION_3D_COLOR:
-            aColor = COL_AUTO;
-            sColorName = SVX_RESSTR(RID_SVXSTR_AUTOMATIC);
-            break;
+        Color aColor;
+        OUString sColorName;
+        switch (nSlotId)
+        {
+            case SID_ATTR_CHAR_COLOR_BACKGROUND:
+            case SID_BACKGROUND_COLOR:
+            case SID_ATTR_CHAR_BACK_COLOR:
+                aColor = COL_TRANSPARENT;
+                sColorName = SVX_RESSTR(RID_SVXSTR_NOFILL);
+                break;
+            case SID_AUTHOR_COLOR:
+                aColor = COL_TRANSPARENT;
+                sColorName = SVX_RESSTR(RID_SVXSTR_BY_AUTHOR);
+                break;
+            case SID_BMPMASK_COLOR:
+                aColor = COL_TRANSPARENT;
+                sColorName = SVX_RESSTR(RID_SVXSTR_TRANSPARENT);
+                break;
+            case SID_ATTR_CHAR_COLOR:
+            case SID_ATTR_CHAR_COLOR2:
+            case SID_EXTRUSION_3D_COLOR:
+            default:
+                aColor = COL_AUTO;
+                sColorName = SVX_RESSTR(RID_SVXSTR_AUTOMATIC);
+                break;
+        }
+
+        return std::make_pair(aColor, sColorName);
     }
+}
 
-    return std::make_pair(aColor, sColorName);
+NamedColor SvxColorWindow::GetAutoColor() const
+{
+    return ::GetAutoColor(theSlotId);
 }
 
 IMPL_LINK(SvxColorWindow, AutoColorClickHdl, Button*, pButton, void)
@@ -3209,7 +3218,9 @@ SvxColorListBox::SvxColorListBox(vcl::Window* pParent, WinBits nStyle)
     , m_nSlotId(0)
     , m_bShowNoneButton(false)
 {
+    m_aSelectedColor = GetAutoColor(m_nSlotId);
     LockWidthRequest();
+    ShowPreview(m_aSelectedColor);
     SetActivateHdl(LINK(this, SvxColorListBox, MenuActivateHdl));
 }
 
commit 609670933a80f670d5f6adc4bcdd71781c43c9fa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 20 12:32:12 2017 +0000

    Related: tdf#106099 avoid casting LISTBOX_ENTRY_NOTFOUND to FontEmphasisMark
    
    Change-Id: I7119e47c71f96af27351665ee08ea42b0ae0a622

diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 0ce4e2d..2fa3116 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1498,12 +1498,16 @@ void SvxCharEffectsPage::UpdatePreview_Impl()
     rCTLFont.SetStrikeout( eStrikeout );
 
     nPos = m_pPositionLB->GetSelectEntryPos();
-    bool bUnder = ( CHRDLG_POSITION_UNDER == reinterpret_cast<sal_uLong>(m_pPositionLB->GetEntryData( nPos )) );
-    FontEmphasisMark eMark = (FontEmphasisMark)m_pEmphasisLB->GetSelectEntryPos();
-    eMark |= bUnder ? FontEmphasisMark::PosBelow : FontEmphasisMark::PosAbove;
-    rFont.SetEmphasisMark( eMark );
-    rCJKFont.SetEmphasisMark( eMark );
-    rCTLFont.SetEmphasisMark( eMark );
+    sal_Int32 nEmphasis = m_pEmphasisLB->GetSelectEntryPos();
+    if (nEmphasis != LISTBOX_ENTRY_NOTFOUND)
+    {
+        bool bUnder = ( CHRDLG_POSITION_UNDER == reinterpret_cast<sal_uLong>(m_pPositionLB->GetEntryData( nPos )) );
+        FontEmphasisMark eMark = (FontEmphasisMark)nEmphasis;
+        eMark |= bUnder ? FontEmphasisMark::PosBelow : FontEmphasisMark::PosAbove;
+        rFont.SetEmphasisMark( eMark );
+        rCJKFont.SetEmphasisMark( eMark );
+        rCTLFont.SetEmphasisMark( eMark );
+    }
 
     sal_Int32 nRelief = m_pReliefLB->GetSelectEntryPos();
     if (LISTBOX_ENTRY_NOTFOUND != nRelief)


More information about the Libreoffice-commits mailing list