[Libreoffice-commits] core.git: include/svx svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Nov 17 23:39:33 UTC 2018
include/svx/colorwindow.hxx | 2
svx/source/tbxctrls/tbcontrl.cxx | 124 ++++++++-------------------------------
2 files changed, 29 insertions(+), 97 deletions(-)
New commits:
commit eb5b353b523ec4d7d6588e2fae5b8b4117bfc2b1
Author: Maxim Monastirsky <momonasmon at gmail.com>
AuthorDate: Sun Nov 11 01:38:01 2018 +0200
Commit: Maxim Monastirsky <momonasmon at gmail.com>
CommitDate: Sun Nov 18 00:39:12 2018 +0100
Simplify color status handling
Change-Id: I9335fa2ab94f69853b45f070499d7e18aac458c3
Reviewed-on: https://gerrit.libreoffice.org/63499
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
index 5611e4d3e2bd..53605eb9ca12 100644
--- a/include/svx/colorwindow.hxx
+++ b/include/svx/colorwindow.hxx
@@ -40,7 +40,7 @@ class SVX_DLLPUBLIC ColorStatus
public:
ColorStatus();
~ColorStatus();
- bool statusChanged( const css::frame::FeatureStateEvent& rEvent );
+ void statusChanged( const css::frame::FeatureStateEvent& rEvent );
Color GetColor();
};
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 6a3e96edb831..a379d919f268 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1772,20 +1772,8 @@ void SvxColorWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent
}
else
{
- Color aColor(COL_TRANSPARENT);
-
- if (mrColorStatus.statusChanged(rEvent))
- {
- aColor = mrColorStatus.GetColor();
- }
- else if (rEvent.IsEnabled)
- {
- sal_Int32 nValue;
- if (rEvent.State >>= nValue)
- aColor = Color(nValue);
- }
-
- SelectEntry(aColor);
+ mrColorStatus.statusChanged(rEvent);
+ SelectEntry(mrColorStatus.GetColor());
}
}
@@ -1801,20 +1789,8 @@ void ColorWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent )
}
else
{
- Color aColor(COL_TRANSPARENT);
-
- if (mrColorStatus.statusChanged(rEvent))
- {
- aColor = mrColorStatus.GetColor();
- }
- else if (rEvent.IsEnabled)
- {
- sal_Int32 nValue;
- if (rEvent.State >>= nValue)
- aColor = Color(nValue);
- }
-
- SelectEntry(aColor);
+ mrColorStatus.statusChanged(rEvent);
+ SelectEntry(mrColorStatus.GetColor());
}
}
@@ -1937,83 +1913,48 @@ ColorStatus::~ColorStatus()
{
}
-bool ColorStatus::statusChanged( const css::frame::FeatureStateEvent& rEvent )
+void ColorStatus::statusChanged( const css::frame::FeatureStateEvent& rEvent )
{
Color aColor( COL_TRANSPARENT );
+ css::table::BorderLine2 aTable;
- if ( rEvent.FeatureURL.Complete == ".uno:FrameLineColor" )
+ if ( rEvent.State >>= aTable )
{
- if ( rEvent.IsEnabled )
- rEvent.State >>= aColor;
-
- maColor = aColor;
- return true;
- }
- else
- {
- css::table::BorderLine2 aTable;
- if ( rEvent.IsEnabled )
- rEvent.State >>= aTable;
-
SvxBorderLine aLine;
SvxBoxItem::LineToSvxLine( aTable, aLine, false );
if ( !aLine.isEmpty() )
aColor = aLine.GetColor();
-
- if ( rEvent.FeatureURL.Complete == ".uno:BorderTLBR" )
- {
- maTLBRColor = aColor;
- return true;
- }
- else if ( rEvent.FeatureURL.Complete == ".uno:BorderBLTR" )
- {
- maBLTRColor = aColor;
- return true;
- }
}
+ else
+ rEvent.State >>= aColor;
- return false;
+ if ( rEvent.FeatureURL.Path == "BorderTLBR" )
+ maTLBRColor = aColor;
+ else if ( rEvent.FeatureURL.Path == "BorderBLTR" )
+ maBLTRColor = aColor;
+ else
+ maColor = aColor;
}
Color ColorStatus::GetColor()
{
- bool bHasColor = maColor != COL_TRANSPARENT;
- bool bHasTLBRColor = maTLBRColor != COL_TRANSPARENT;
- bool bHasBLTRColor = maBLTRColor != COL_TRANSPARENT;
+ Color aColor( maColor );
- if ( !bHasColor && bHasTLBRColor && !bHasBLTRColor )
- return maTLBRColor;
- else if ( !bHasColor && !bHasTLBRColor && bHasBLTRColor )
- return maBLTRColor;
- else if ( bHasColor && bHasTLBRColor && !bHasBLTRColor )
- {
- if ( maColor == maTLBRColor )
- return maColor;
- else
- return maBLTRColor;
- }
- else if ( bHasColor && !bHasTLBRColor && bHasBLTRColor )
- {
- if ( maColor == maBLTRColor )
- return maColor;
- else
- return maTLBRColor;
- }
- else if ( !bHasColor && bHasTLBRColor && bHasBLTRColor )
+ if ( maTLBRColor != COL_TRANSPARENT )
{
- if ( maTLBRColor == maBLTRColor )
- return maTLBRColor;
- else
- return maColor;
+ if ( aColor != maTLBRColor && aColor != COL_TRANSPARENT )
+ return COL_TRANSPARENT;
+ aColor = maTLBRColor;
}
- else if ( bHasColor && bHasTLBRColor && bHasBLTRColor )
+
+ if ( maBLTRColor != COL_TRANSPARENT )
{
- if ( maColor == maTLBRColor && maColor == maBLTRColor )
- return maColor;
- else
+ if ( aColor != maBLTRColor && aColor != COL_TRANSPARENT )
return COL_TRANSPARENT;
+ return maBLTRColor;
}
- return maColor;
+
+ return aColor;
}
@@ -3205,17 +3146,8 @@ void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent&
bool bValue;
if ( !m_bSplitButton )
{
- Color aColor( COL_TRANSPARENT );
-
- if ( m_aColorStatus.statusChanged( rEvent ) )
- {
- aColor = m_aColorStatus.GetColor();
- }
- else if ( rEvent.IsEnabled )
- {
- rEvent.State >>= aColor;
- }
- m_xBtnUpdater->Update( aColor );
+ m_aColorStatus.statusChanged( rEvent );
+ m_xBtnUpdater->Update( m_aColorStatus.GetColor() );
}
else if ( rEvent.State >>= bValue )
pToolBox->CheckItem( nId, bValue );
More information about the Libreoffice-commits
mailing list