Kaydet (Commit) e5246a6b authored tarafından Oliver Specht's avatar Oliver Specht

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/20592Reviewed-by: 's avatarOliver Specht <oliver.specht@cib.de>
Tested-by: 's avatarOliver Specht <oliver.specht@cib.de>
üst a5fb58ca
...@@ -598,6 +598,7 @@ void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet ) ...@@ -598,6 +598,7 @@ void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet )
aBgdColor = pBgdAttr->GetColor(); aBgdColor = pBgdAttr->GetColor();
sal_uInt16 nCol = GetItemId_Impl(*m_pBackgroundColorSet, aBgdColor); sal_uInt16 nCol = GetItemId_Impl(*m_pBackgroundColorSet, aBgdColor);
m_pBackgroundColorSet->SelectItem( nCol ); m_pBackgroundColorSet->SelectItem( nCol );
m_pBackgroundColorSet->SaveValue();
m_pPreviewWin1->NotifyChange( aBgdColor ); m_pPreviewWin1->NotifyChange( aBgdColor );
} }
} }
...@@ -682,7 +683,7 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet ) ...@@ -682,7 +683,7 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
{ {
// Brush-treatment: // Brush-treatment:
if ( rOldItem.GetColor() != aBgdColor || if ( rOldItem.GetColor() != aBgdColor ||
(SfxItemState::DEFAULT >= eOldItemState && !m_pBackgroundColorSet->IsNoSelection())) (SfxItemState::DEFAULT >= eOldItemState && m_pBackgroundColorSet->GetSavedValue() != m_pBackgroundColorSet->GetSelectItemId()))
{ {
bModified = true; bModified = true;
rCoreSet->Put( SvxBrushItem( aBgdColor, nWhich ) ); rCoreSet->Put( SvxBrushItem( aBgdColor, nWhich ) );
...@@ -1423,6 +1424,7 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr, ...@@ -1423,6 +1424,7 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
{ {
m_pBackgroundColorSet->SelectItem( nCol ); m_pBackgroundColorSet->SelectItem( nCol );
} }
m_pBackgroundColorSet->SaveValue();
m_pPreviewWin1->NotifyChange( aBgdColor ); m_pPreviewWin1->NotifyChange( aBgdColor );
......
...@@ -212,6 +212,7 @@ private: ...@@ -212,6 +212,7 @@ private:
long mnUserItemWidth; long mnUserItemWidth;
long mnUserItemHeight; long mnUserItemHeight;
sal_uInt16 mnSelItemId; sal_uInt16 mnSelItemId;
sal_uInt16 mnSavedItemId;
sal_uInt16 mnHighItemId; sal_uInt16 mnHighItemId;
sal_uInt16 mnCols; sal_uInt16 mnCols;
sal_uInt16 mnCurCol; sal_uInt16 mnCurCol;
...@@ -349,6 +350,8 @@ public: ...@@ -349,6 +350,8 @@ public:
{ {
return mnSelItemId; return mnSelItemId;
} }
void SaveValue() { mnSavedItemId = GetSelectItemId(); }
sal_Int32 GetSavedValue() const { return mnSavedItemId; }
bool IsItemSelected( sal_uInt16 nItemId ) const bool IsItemSelected( sal_uInt16 nItemId ) const
{ {
return !mbNoSelection && (nItemId == mnSelItemId); return !mbNoSelection && (nItemId == mnSelItemId);
......
...@@ -69,6 +69,7 @@ void ValueSet::ImplInit() ...@@ -69,6 +69,7 @@ void ValueSet::ImplInit()
mnUserItemHeight = 0; mnUserItemHeight = 0;
mnFirstLine = 0; mnFirstLine = 0;
mnSelItemId = 0; mnSelItemId = 0;
mnSavedItemId = 0;
mnHighItemId = 0; mnHighItemId = 0;
mnCols = 0; mnCols = 0;
mnCurCol = 0; mnCurCol = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment