summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2016-11-07 16:44:27 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2016-11-08 11:48:08 +0000
commitcc2d27ea1ef4018d0865095853e7d661f8070e1f (patch)
treeb6047cd914068d8ce1de9e29b50156690e8bbcff /cui
parent8bff616ae65f67f2eb2e6b81f1dbbbe2f9f7f5d9 (diff)
Change new colour only, keep active one on the initial value
Change-Id: Icfda455d275d0449725867fd7bf4ea3060e7dc26 Reviewed-on: https://gerrit.libreoffice.org/30691 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/cuitabarea.hxx4
-rw-r--r--cui/source/tabpages/tpcolor.cxx36
2 files changed, 24 insertions, 16 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 362777aa0e02..a6e9f1dde258 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -762,10 +762,10 @@ private:
DECL_LINK( SelectPaletteLBHdl, ListBox&, void );
DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void );
DECL_LINK( SelectColorModeHdl_Impl, RadioButton&, void );
- void ChangeColor(const Color &rNewColor);
+ void ChangeColor(const Color &rNewColor, bool bUpdatePreset = true);
void SetColorModel(ColorModel eModel);
void ChangeColorModel();
- void UpdateColorValues();
+ void UpdateColorValues( bool bUpdatePreset = true );
static sal_Int32 SearchColorList(OUString const & aColorName);
DECL_LINK( ModifiedHdl_Impl, Edit&, void );
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 88a7e17d34c3..a823fa71d88d 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -441,7 +441,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void)
{
Color aPreviewColor = pColorDlg->GetColor();
aCurrentColor = aPreviewColor;
- UpdateColorValues();
+ UpdateColorValues( false );
// fill ItemSet and pass it on to XOut
rXFSet.Put( XFillColorItem( OUString(), aPreviewColor ) );
//m_pCtlPreviewOld->SetAttributes( aXFillAttr );
@@ -527,7 +527,7 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void)
rXFSet.Put( XFillColorItem( OUString(), aColor ) );
m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() );
m_pCtlPreviewNew->Invalidate();
- ChangeColor(aColor);
+ ChangeColor(aColor, false);
if(pValSet == m_pValSetColorList)
{
@@ -575,11 +575,11 @@ IMPL_LINK(SvxColorTabPage, SelectColorModeHdl_Impl, RadioButton&, rRadioButton,
UpdateColorValues();
}
-void SvxColorTabPage::ChangeColor(const Color &rNewColor)
+void SvxColorTabPage::ChangeColor(const Color &rNewColor, bool bUpdatePreset )
{
aPreviousColor = rNewColor;
aCurrentColor = rNewColor;
- UpdateColorValues();
+ UpdateColorValues( bUpdatePreset );
// fill ItemSet and pass it on to XOut
rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) );
m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() );
@@ -620,7 +620,7 @@ void SvxColorTabPage::ChangeColorModel()
}
}
-void SvxColorTabPage::UpdateColorValues()
+void SvxColorTabPage::UpdateColorValues( bool bUpdatePreset )
{
if (eCM != ColorModel::RGB)
{
@@ -628,13 +628,17 @@ void SvxColorTabPage::UpdateColorValues()
ConvertColorValues (aCurrentColor, eCM);
m_pCcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) );
- m_pCpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
- m_pYcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) );
- m_pYpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
m_pMcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetBlue() ) );
- m_pMpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
+ m_pYcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) );
m_pKcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetTransparency() ) );
- m_pKpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetTransparency() ) );
+
+ if( bUpdatePreset )
+ {
+ m_pCpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
+ m_pMpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
+ m_pYpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
+ m_pKpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetTransparency() ) );
+ }
ConvertColorValues (aPreviousColor, ColorModel::RGB);
ConvertColorValues (aCurrentColor, ColorModel::RGB);
@@ -642,13 +646,17 @@ void SvxColorTabPage::UpdateColorValues()
else
{
m_pRcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) );
- m_pRpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
m_pGcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) );
- m_pGpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
m_pBcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetBlue() ) );
- m_pBpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
m_pHexcustom->SetColor( aCurrentColor.GetColor() );
- m_pHexpreset->SetColor( aPreviousColor.GetColor() );
+
+ if( bUpdatePreset )
+ {
+ m_pRpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
+ m_pGpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
+ m_pBpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
+ m_pHexpreset->SetColor( aPreviousColor.GetColor() );
+ }
}
}