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

Oliver Specht oliver.specht at cib.de
Thu Dec 10 22:42:48 PST 2015


 cui/source/tabpages/backgrnd.cxx    |    4 +++-
 include/svtools/valueset.hxx        |    3 +++
 svtools/source/control/valueset.cxx |    1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit e5246a6b679cfd15ba9ec6db23448066f34c7c08
Author: Oliver Specht <oliver.specht at cib.de>
Date:   Thu Dec 10 12:22:07 2015 +0100

    tdf#96382: background color is not applied unintentionally
    
    background color attribute should only be applied in a dialog
    if the user selects it
    
    Change-Id: Idf03840f7332a8cdbbfd616ce47ac26b3602d840
    Reviewed-on: https://gerrit.libreoffice.org/20592
    Reviewed-by: Oliver Specht <oliver.specht at cib.de>
    Tested-by: Oliver Specht <oliver.specht at cib.de>

diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index d85a6a8..6504b11 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -598,6 +598,7 @@ void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet )
             aBgdColor = pBgdAttr->GetColor();
             sal_uInt16 nCol = GetItemId_Impl(*m_pBackgroundColorSet, aBgdColor);
             m_pBackgroundColorSet->SelectItem( nCol );
+            m_pBackgroundColorSet->SaveValue();
             m_pPreviewWin1->NotifyChange( aBgdColor );
         }
     }
@@ -682,7 +683,7 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
             {
                 // Brush-treatment:
                 if ( rOldItem.GetColor() != aBgdColor ||
-                     (SfxItemState::DEFAULT >= eOldItemState && !m_pBackgroundColorSet->IsNoSelection()))
+                     (SfxItemState::DEFAULT >= eOldItemState && m_pBackgroundColorSet->GetSavedValue() != m_pBackgroundColorSet->GetSelectItemId()))
                 {
                     bModified = true;
                     rCoreSet->Put( SvxBrushItem( aBgdColor, nWhich ) );
@@ -1423,6 +1424,7 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
         {
             m_pBackgroundColorSet->SelectItem( nCol );
         }
+        m_pBackgroundColorSet->SaveValue();
 
         m_pPreviewWin1->NotifyChange( aBgdColor );
 
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 30aaffe..e4fac32 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -212,6 +212,7 @@ private:
     long            mnUserItemWidth;
     long            mnUserItemHeight;
     sal_uInt16      mnSelItemId;
+    sal_uInt16      mnSavedItemId;
     sal_uInt16      mnHighItemId;
     sal_uInt16      mnCols;
     sal_uInt16      mnCurCol;
@@ -349,6 +350,8 @@ public:
     {
         return mnSelItemId;
     }
+    void                SaveValue() { mnSavedItemId = GetSelectItemId(); }
+    sal_Int32           GetSavedValue() const { return mnSavedItemId; }
     bool IsItemSelected( sal_uInt16 nItemId ) const
     {
         return !mbNoSelection && (nItemId == mnSelItemId);
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index b62d6ce..e6481b9 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -69,6 +69,7 @@ void ValueSet::ImplInit()
     mnUserItemHeight    = 0;
     mnFirstLine         = 0;
     mnSelItemId         = 0;
+    mnSavedItemId       = 0;
     mnHighItemId        = 0;
     mnCols              = 0;
     mnCurCol            = 0;


More information about the Libreoffice-commits mailing list