summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-10-13 10:20:31 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2016-10-13 11:12:27 +0300
commit9125a4f3f63a7f49fd307908c181e999120063e0 (patch)
treeef7d47475a37b87cda0e97b766143ab3e4c55cb5
parentf1bae1b5c0ba7949f6a91ba938be18589f9accaa (diff)
Use FeatureStateEvent directly for status updates
... for SfxPopupWindow and SvxColorToolBoxControl (the latter shares BorderColorStatus with SvxColorWindow_Impl, so it was easier to convert it too). Change-Id: Ifcb23fe5809e467322d1cf4d790420886ac79b47
-rw-r--r--chart2/source/controller/sidebar/ChartColorWrapper.cxx15
-rw-r--r--include/sfx2/tbxctrl.hxx5
-rw-r--r--include/svx/linectrl.hxx5
-rw-r--r--include/svx/tbcontrl.hxx9
-rw-r--r--reportdesign/source/ui/misc/toolboxcontroller.cxx8
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx133
-rw-r--r--svx/source/tbxctrls/colorwindow.hxx4
-rw-r--r--svx/source/tbxctrls/lboxctrl.cxx12
-rw-r--r--svx/source/tbxctrls/linectrl.cxx10
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx106
10 files changed, 77 insertions, 230 deletions
diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
index 4b2c7694e14d..b2ff6196916d 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
@@ -11,9 +11,7 @@
#include "ChartController.hxx"
-#include <editeng/colritem.hxx>
#include <svx/tbcontrl.hxx>
-#include <svx/svxids.hrc>
namespace chart { namespace sidebar {
@@ -88,13 +86,14 @@ void ChartColorWrapper::updateData()
if (!xPropSet.is())
return;
- css::uno::Any aAny = xPropSet->getPropertyValue(maPropertyName);
- sal_uInt32 nColor = 0;
- aAny >>= nColor;
- Color aColor(nColor);
+ css::util::URL aUrl;
+ aUrl.Complete = ".uno:FillColor";
- SvxColorItem aItem(aColor, SID_ATTR_FILL_COLOR);
- mpControl->StateChanged(SID_ATTR_FILL_COLOR, SfxItemState::SET, &aItem);
+ css::frame::FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aUrl;
+ aEvent.IsEnabled = true;
+ aEvent.State = xPropSet->getPropertyValue(maPropertyName);
+ mpControl->statusChanged(aEvent);
}
} }
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index 60536f5d0c26..6185ce7a9685 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -95,10 +95,7 @@ protected:
void UnbindListener();
void AddStatusListener( const OUString& rCommandURL );
- // SfxStatusListenerInterface
- using FloatingWindow::StateChanged;
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState );
+ virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent );
public:
SfxPopupWindow( sal_uInt16 nId,
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index e29fe6c785aa..99c4dbc01328 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -77,8 +77,6 @@ public:
class SvxLineEndWindow : public SfxPopupWindow
{
- using FloatingWindow::StateChanged;
-
private:
XLineEndListRef pLineEndList;
VclPtr<ValueSet> aLineEndSet;
@@ -116,8 +114,7 @@ public:
void StartSelection();
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState ) override;
+ virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
};
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 174c16d839dd..21f07f2a9234 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -222,15 +222,13 @@ class BorderColorStatus
public:
BorderColorStatus();
~BorderColorStatus();
- void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
+ bool statusChanged( const css::frame::FeatureStateEvent& rEvent );
Color GetColor();
};
typedef std::function<void(const OUString&, const Color&)> ColorSelectFunction;
class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
{
- using SfxToolBoxControl::StateChanged;
-
std::unique_ptr<svx::ToolboxButtonColorUpdater> m_xBtnUpdater;
PaletteManager m_aPaletteManager;
BorderColorStatus m_aBorderColorStatus;
@@ -242,8 +240,9 @@ public:
SvxColorToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
virtual ~SvxColorToolBoxControl() override;
- virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState) override;
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override;
+
virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
virtual void Select(sal_uInt16 nSelectModifier) override;
diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx
index c103c2056f8d..5e058438c64d 100644
--- a/reportdesign/source/ui/misc/toolboxcontroller.cxx
+++ b/reportdesign/source/ui/misc/toolboxcontroller.cxx
@@ -38,7 +38,6 @@
#include <editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <svx/tbcontrl.hxx>
-#include <editeng/colritem.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -195,12 +194,7 @@ void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event
{
case SID_ATTR_CHAR_COLOR2:
case SID_BACKGROUND_COLOR:
- {
- util::Color nColor(COL_TRANSPARENT);
- Event.State >>= nColor;
- SvxColorItem aColorItem(::Color(nColor), 1);
- static_cast<SvxColorToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SfxItemState::SET : SfxItemState::DISABLED,&aColorItem);
- }
+ m_pToolbarController->statusChanged( Event );
break;
case SID_ATTR_CHAR_FONT:
{
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index ba6da54dd466..08f0ae97b7d6 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -754,121 +754,7 @@ SfxFrameStatusListener::~SfxFrameStatusListener()
void SAL_CALL SfxFrameStatusListener::statusChanged( const css::frame::FeatureStateEvent& rEvent )
throw ( css::uno::RuntimeException, std::exception )
{
- SfxViewFrame* pViewFrame = nullptr;
- Reference < XController > xController;
-
- SolarMutexGuard aGuard;
- if ( m_xFrame.is() )
- xController = m_xFrame->getController();
-
- Reference < XDispatchProvider > xProvider( xController, UNO_QUERY );
- if ( xProvider.is() )
- {
- Reference < XDispatch > xDisp = xProvider->queryDispatch( rEvent.FeatureURL, OUString(), 0 );
- if ( xDisp.is() )
- {
- Reference< XUnoTunnel > xTunnel( xDisp, UNO_QUERY );
- SfxOfficeDispatch* pDisp = nullptr;
- if ( xTunnel.is() )
- {
- sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier());
- pDisp = reinterpret_cast< SfxOfficeDispatch* >( sal::static_int_cast< sal_IntPtr >( nImplementation ));
- }
-
- if ( pDisp )
- pViewFrame = pDisp->GetDispatcher_Impl()->GetFrame();
- }
- }
-
- sal_uInt16 nSlotId = 0;
- SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( pViewFrame );
- const SfxSlot* pSlot = rPool.GetUnoSlot( rEvent.FeatureURL.Path );
- if ( pSlot )
- nSlotId = pSlot->GetSlotId();
-
- if ( nSlotId > 0 )
- {
- if ( rEvent.Requery )
- {
- // requery for the notified state
- addStatusListener( rEvent.FeatureURL.Complete );
- }
- else
- {
- SfxItemState eState = SfxItemState::DISABLED;
- SfxPoolItem* pItem = nullptr;
- if ( rEvent.IsEnabled )
- {
- eState = SfxItemState::DEFAULT;
- css::uno::Type aType = rEvent.State.getValueType();
-
- if ( aType == cppu::UnoType<void>::get() )
- {
- pItem = new SfxVoidItem( nSlotId );
- eState = SfxItemState::UNKNOWN;
- }
- else if ( aType == cppu::UnoType<bool>::get() )
- {
- bool bTemp = false;
- rEvent.State >>= bTemp ;
- pItem = new SfxBoolItem( nSlotId, bTemp );
- }
- else if ( aType == ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get())
- {
- sal_uInt16 nTemp = 0;
- rEvent.State >>= nTemp ;
- pItem = new SfxUInt16Item( nSlotId, nTemp );
- }
- else if ( aType == cppu::UnoType<sal_uInt32>::get() )
- {
- sal_uInt32 nTemp = 0;
- rEvent.State >>= nTemp ;
- pItem = new SfxUInt32Item( nSlotId, nTemp );
- }
- else if ( aType == cppu::UnoType<OUString>::get() )
- {
- OUString sTemp ;
- rEvent.State >>= sTemp ;
- pItem = new SfxStringItem( nSlotId, sTemp );
- }
- else if ( aType == cppu::UnoType< css::frame::status::ItemStatus>::get() )
- {
- ItemStatus aItemStatus;
- rEvent.State >>= aItemStatus;
- SfxItemState tmpState = (SfxItemState) aItemStatus.State;
- // make sure no-one tries to send us a combination of states
- if (tmpState != SfxItemState::UNKNOWN && tmpState != SfxItemState::DISABLED &&
- tmpState != SfxItemState::READONLY && tmpState != SfxItemState::DONTCARE &&
- tmpState != SfxItemState::DEFAULT && tmpState != SfxItemState::SET)
- throw css::uno::RuntimeException("unknown status");
- eState = tmpState;
- pItem = new SfxVoidItem( nSlotId );
- }
- else if ( aType == cppu::UnoType< css::frame::status::Visibility>::get() )
- {
- Visibility aVisibilityStatus;
- rEvent.State >>= aVisibilityStatus;
- pItem = new SfxVisibilityItem( nSlotId, aVisibilityStatus.bVisible );
- }
- else
- {
- if ( pSlot )
- pItem = pSlot->GetType()->CreateItem();
- if ( pItem )
- {
- pItem->SetWhich( nSlotId );
- pItem->PutValue( rEvent.State, 0 );
- }
- else
- pItem = new SfxVoidItem( nSlotId );
- }
- }
-
- if ( m_pCallee )
- m_pCallee->StateChanged( nSlotId, eState, pItem );
- delete pItem;
- }
- }
+ m_pCallee->statusChanged( rEvent );
}
SfxPopupWindow::SfxPopupWindow(
@@ -1060,22 +946,9 @@ void SfxPopupWindow::StartCascading()
}
-void SfxPopupWindow::StateChanged(
- sal_uInt16 /*nSID*/,
- SfxItemState eState,
- const SfxPoolItem* /*pState*/ )
-/* [Description]
-
- See also <SfxControllerItem::StateChanged()>. In addition the Popup
- will become hidden when eState==SfxItemState::DISABLED and in all other
- cases it will be shown again if it is floating. In general this requires
- to call the Base class.
-
- Due to the parent the presentation mode is handled in a special way.
-*/
-
+void SfxPopupWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent )
{
- if ( SfxItemState::DISABLED == eState )
+ if ( !rEvent.IsEnabled )
{
Hide();
}
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 22b6d8af9d5e..56b9ed27d70e 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -35,8 +35,6 @@ class BorderColorStatus;
class SvxColorWindow_Impl : public SfxPopupWindow
{
- using FloatingWindow::StateChanged;
-
private:
const sal_uInt16 theSlotId;
VclPtr<SvxColorValueSet> mpColorSet;
@@ -76,7 +74,7 @@ public:
void StartSelection();
virtual void KeyInput( const KeyEvent& rKEvt ) override;
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
+ virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
void SetSelectedHdl( const Link<const Color&, void>& rLink ) { maSelectedLink = rLink; }
};
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index cb81b3d342e8..1aab1bfd8fd3 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -50,8 +50,6 @@ class SvxPopupWindowListBox;
class SvxPopupWindowListBox: public SfxPopupWindow
{
- using FloatingWindow::StateChanged;
-
VclPtr<ListBox> m_pListBox;
ToolBox & rToolBox;
bool bUserSel;
@@ -64,8 +62,7 @@ public:
// SfxPopupWindow
virtual void PopupModeEnd() override;
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState ) override;
+ virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
inline ListBox & GetListBox() { return *m_pListBox; }
@@ -118,11 +115,10 @@ void SvxPopupWindowListBox::PopupModeEnd()
}
-void SvxPopupWindowListBox::StateChanged(
- sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+void SvxPopupWindowListBox::statusChanged( const css::frame::FeatureStateEvent& rEvent )
{
- rToolBox.EnableItem( nTbxId, ( SfxToolBoxControl::GetItemState( pState ) != SfxItemState::DISABLED) );
- SfxPopupWindow::StateChanged( nSID, eState, pState );
+ rToolBox.EnableItem( nTbxId, rEvent.IsEnabled );
+ SfxPopupWindow::statusChanged( rEvent );
}
SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index c0b1c3eb45a0..5d5a2f54d0eb 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -483,15 +483,15 @@ void SvxLineEndWindow::StartSelection()
}
-void SvxLineEndWindow::StateChanged(
- sal_uInt16 nSID, SfxItemState, const SfxPoolItem* pState )
+void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent )
{
- if ( nSID == SID_LINEEND_LIST )
+ if ( rEvent.FeatureURL.Complete == ".uno:LineEndListState" )
{
// The list of line ends (LineEndList) has changed
- if ( pState && dynamic_cast<const SvxLineEndListItem*>( pState) != nullptr)
+ css::uno::Reference< css::uno::XWeak > xWeak;
+ if ( rEvent.State >>= xWeak )
{
- pLineEndList = static_cast<const SvxLineEndListItem*>(pState)->GetLineEndList();
+ pLineEndList.set( static_cast< XLineEndList* >( xWeak.get() ) );
DBG_ASSERT( pLineEndList.is(), "LineEndList not found" );
aLineEndSet->Clear();
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 6ea8a30c53cd..e6309dd0c428 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -54,6 +54,7 @@
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <svtools/colorcfg.hxx>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -1466,38 +1467,28 @@ void SvxColorWindow_Impl::StartSelection()
mpColorSet->StartSelection();
}
-void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+void SvxColorWindow_Impl::statusChanged( const css::frame::FeatureStateEvent& rEvent )
{
- if ( nSID == SID_COLOR_TABLE )
+ if ( rEvent.IsEnabled && rEvent.FeatureURL.Complete == ".uno:ColorTableState"
+ && mrPaletteManager.GetPalette() == 0)
{
- if ( SfxItemState::DEFAULT == eState && mrPaletteManager.GetPalette() == 0 )
- {
- mrPaletteManager.ReloadColorSet(*mpColorSet);
- mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount());
- }
+ mrPaletteManager.ReloadColorSet(*mpColorSet);
+ mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount());
}
else
{
mpColorSet->SetNoSelection();
Color aColor( COL_TRANSPARENT );
- if ( nSID == SID_FRAME_LINECOLOR
- || nSID == SID_ATTR_BORDER_DIAG_TLBR
- || nSID == SID_ATTR_BORDER_DIAG_BLTR )
+ if ( mrBorderColorStatus.statusChanged( rEvent ) )
{
- mrBorderColorStatus.StateChanged( nSID, eState, pState );
aColor = mrBorderColorStatus.GetColor();
}
- else if ( SfxItemState::DEFAULT <= eState && pState )
+ else if ( rEvent.IsEnabled )
{
- if ( dynamic_cast<const SvxColorItem*>( pState) != nullptr )
- aColor = static_cast<const SvxColorItem*>(pState)->GetValue();
- else if ( dynamic_cast<const XLineColorItem*>( pState) != nullptr )
- aColor = static_cast<const XLineColorItem*>(pState)->GetColorValue();
- else if ( dynamic_cast<const XFillColorItem*>( pState) != nullptr )
- aColor = static_cast<const XFillColorItem*>(pState)->GetColorValue();
- else if ( dynamic_cast<const SvxBackgroundColorItem*>( pState) != nullptr )
- aColor = static_cast<const SvxBackgroundColorItem*>(pState)->GetValue();
+ sal_Int32 nValue;
+ if ( rEvent.State >>= nValue )
+ aColor = nValue;
}
if ( aColor == COL_TRANSPARENT )
@@ -1526,33 +1517,38 @@ BorderColorStatus::~BorderColorStatus()
{
}
-void BorderColorStatus::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState )
+bool BorderColorStatus::statusChanged( const css::frame::FeatureStateEvent& rEvent )
{
- if ( SfxItemState::DEFAULT <= eState && pState )
+ Color aColor( COL_TRANSPARENT );
+
+ if ( rEvent.FeatureURL.Complete == ".uno:FrameLineColor" )
+ {
+ sal_Int32 nValue;
+ if ( rEvent.IsEnabled && ( rEvent.State >>= nValue ) )
+ aColor = nValue;
+
+ maColor = aColor;
+ return true;
+ }
+ else
{
- if ( nSID == SID_FRAME_LINECOLOR && dynamic_cast<const SvxColorItem*>( pState) != nullptr )
+ css::table::BorderLine2 aTable;
+ if ( rEvent.IsEnabled && ( rEvent.State >>= aTable ) )
+ aColor = aTable.Color;
+
+ if ( rEvent.FeatureURL.Complete == ".uno:BorderTLBR" )
{
- maColor = static_cast< const SvxColorItem* >(pState)->GetValue();
+ maTLBRColor = aColor;
+ return true;
}
- else if ( dynamic_cast<const SvxLineItem*>( pState) != nullptr )
+ else if ( rEvent.FeatureURL.Complete == ".uno:BorderBLTR" )
{
- const SvxBorderLine* pLine = static_cast< const SvxLineItem* >(pState)->GetLine();
- Color aColor ( COL_TRANSPARENT );
- if ( pLine )
- aColor = pLine->GetColor();
-
- if ( nSID == SID_ATTR_BORDER_DIAG_TLBR )
- maTLBRColor = aColor;
- else if ( nSID == SID_ATTR_BORDER_DIAG_BLTR )
- maBLTRColor = aColor;
+ maBLTRColor = aColor;
+ return true;
}
}
- else if ( nSID == SID_FRAME_LINECOLOR )
- maColor = COL_TRANSPARENT;
- else if ( nSID == SID_ATTR_BORDER_DIAG_TLBR )
- maTLBRColor = COL_TRANSPARENT;
- else if ( nSID == SID_ATTR_BORDER_DIAG_BLTR )
- maBLTRColor = COL_TRANSPARENT;
+
+ return false;
}
Color BorderColorStatus::GetColor()
@@ -2709,34 +2705,32 @@ IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const Color&, rColor, void)
m_aPaletteManager.SetLastColor( rColor );
}
-void SvxColorToolBoxControl::StateChanged(
- sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent& rEvent )
+ throw ( css::uno::RuntimeException, std::exception )
{
- if ( nSID == SID_ATTR_CHAR_COLOR_EXT || nSID == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT )
- SfxToolBoxControl::StateChanged( nSID, eState, pState );
- else if ( !m_bSplitButton )
+ if ( rEvent.FeatureURL.Complete == m_aCommandURL )
+ GetToolBox().EnableItem( GetId(), rEvent.IsEnabled );
+
+ bool bValue;
+ if ( !m_bSplitButton )
{
Color aColor( COL_TRANSPARENT );
- if ( nSID == SID_FRAME_LINECOLOR
- || nSID == SID_ATTR_BORDER_DIAG_TLBR
- || nSID == SID_ATTR_BORDER_DIAG_BLTR )
+ if ( m_aBorderColorStatus.statusChanged( rEvent ) )
{
- m_aBorderColorStatus.StateChanged( nSID, eState, pState );
aColor = m_aBorderColorStatus.GetColor();
}
- else if ( SfxItemState::DEFAULT <= eState && pState )
+ else if ( rEvent.IsEnabled )
{
- if ( dynamic_cast<const SvxColorItem*>( pState) != nullptr )
- aColor = static_cast< const SvxColorItem* >(pState)->GetValue();
- else if ( dynamic_cast<const XLineColorItem*>( pState) != nullptr )
- aColor = static_cast< const XLineColorItem* >(pState)->GetColorValue();
- else if ( dynamic_cast<const XFillColorItem*>( pState) != nullptr )
- aColor = static_cast< const XFillColorItem* >(pState)->GetColorValue();
+ sal_Int32 nValue;
+ if ( rEvent.State >>= nValue )
+ aColor = nValue;
}
m_xBtnUpdater->Update( aColor );
m_aPaletteManager.SetLastColor(aColor);
}
+ else if ( rEvent.State >>= bValue )
+ GetToolBox().CheckItem( GetId(), bValue );
}
void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)