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>
This commit is contained in:
Katarina Behrens
2016-11-07 16:44:27 +01:00
parent 8bff616ae6
commit cc2d27ea1e
2 changed files with 24 additions and 16 deletions

View File

@@ -762,10 +762,10 @@ private:
DECL_LINK( SelectPaletteLBHdl, ListBox&, void ); DECL_LINK( SelectPaletteLBHdl, ListBox&, void );
DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void ); DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void );
DECL_LINK( SelectColorModeHdl_Impl, RadioButton&, 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 SetColorModel(ColorModel eModel);
void ChangeColorModel(); void ChangeColorModel();
void UpdateColorValues(); void UpdateColorValues( bool bUpdatePreset = true );
static sal_Int32 SearchColorList(OUString const & aColorName); static sal_Int32 SearchColorList(OUString const & aColorName);
DECL_LINK( ModifiedHdl_Impl, Edit&, void ); DECL_LINK( ModifiedHdl_Impl, Edit&, void );

View File

@@ -441,7 +441,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void)
{ {
Color aPreviewColor = pColorDlg->GetColor(); Color aPreviewColor = pColorDlg->GetColor();
aCurrentColor = aPreviewColor; aCurrentColor = aPreviewColor;
UpdateColorValues(); UpdateColorValues( false );
// fill ItemSet and pass it on to XOut // fill ItemSet and pass it on to XOut
rXFSet.Put( XFillColorItem( OUString(), aPreviewColor ) ); rXFSet.Put( XFillColorItem( OUString(), aPreviewColor ) );
//m_pCtlPreviewOld->SetAttributes( aXFillAttr ); //m_pCtlPreviewOld->SetAttributes( aXFillAttr );
@@ -527,7 +527,7 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void)
rXFSet.Put( XFillColorItem( OUString(), aColor ) ); rXFSet.Put( XFillColorItem( OUString(), aColor ) );
m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() );
m_pCtlPreviewNew->Invalidate(); m_pCtlPreviewNew->Invalidate();
ChangeColor(aColor); ChangeColor(aColor, false);
if(pValSet == m_pValSetColorList) if(pValSet == m_pValSetColorList)
{ {
@@ -575,11 +575,11 @@ IMPL_LINK(SvxColorTabPage, SelectColorModeHdl_Impl, RadioButton&, rRadioButton,
UpdateColorValues(); UpdateColorValues();
} }
void SvxColorTabPage::ChangeColor(const Color &rNewColor) void SvxColorTabPage::ChangeColor(const Color &rNewColor, bool bUpdatePreset )
{ {
aPreviousColor = rNewColor; aPreviousColor = rNewColor;
aCurrentColor = rNewColor; aCurrentColor = rNewColor;
UpdateColorValues(); UpdateColorValues( bUpdatePreset );
// fill ItemSet and pass it on to XOut // fill ItemSet and pass it on to XOut
rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) ); rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) );
m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() );
@@ -620,7 +620,7 @@ void SvxColorTabPage::ChangeColorModel()
} }
} }
void SvxColorTabPage::UpdateColorValues() void SvxColorTabPage::UpdateColorValues( bool bUpdatePreset )
{ {
if (eCM != ColorModel::RGB) if (eCM != ColorModel::RGB)
{ {
@@ -628,13 +628,17 @@ void SvxColorTabPage::UpdateColorValues()
ConvertColorValues (aCurrentColor, eCM); ConvertColorValues (aCurrentColor, eCM);
m_pCcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) ); 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_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_pKcustom->SetValue( ColorToPercent_Impl( aCurrentColor.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() ) ); m_pKpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetTransparency() ) );
}
ConvertColorValues (aPreviousColor, ColorModel::RGB); ConvertColorValues (aPreviousColor, ColorModel::RGB);
ConvertColorValues (aCurrentColor, ColorModel::RGB); ConvertColorValues (aCurrentColor, ColorModel::RGB);
@@ -642,14 +646,18 @@ void SvxColorTabPage::UpdateColorValues()
else else
{ {
m_pRcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) ); m_pRcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) );
m_pRpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
m_pGcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) ); m_pGcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) );
m_pGpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
m_pBcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetBlue() ) ); m_pBcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetBlue() ) );
m_pBpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
m_pHexcustom->SetColor( aCurrentColor.GetColor() ); m_pHexcustom->SetColor( aCurrentColor.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() ); m_pHexpreset->SetColor( aPreviousColor.GetColor() );
} }
}
} }
sal_Int32 SvxColorTabPage::SearchColorList(OUString const & aColorName) sal_Int32 SvxColorTabPage::SearchColorList(OUString const & aColorName)