loplugin:mergeclasses merge SvxListBoxControl with SvxUndoRedoControl

Change-Id: I5ba9c9d970246d80bb60e27e3b703ec03376c35c
This commit is contained in:
Noel Grandin
2016-10-13 16:06:54 +02:00
parent 6bdfb75733
commit 0927bdaf6e
3 changed files with 11 additions and 52 deletions

View File

@@ -145,7 +145,6 @@ merge SvXMLExportItemMapper with SwXMLTableItemMapper_Impl
merge SvXMLImportItemMapper with SwXMLImportTableItemMapper_Impl merge SvXMLImportItemMapper with SwXMLImportTableItemMapper_Impl
merge SvXMLItemSetContext with SwXMLItemSetContext_Impl merge SvXMLItemSetContext with SwXMLItemSetContext_Impl
merge SvxCSS1Parser with SwCSS1Parser merge SvxCSS1Parser with SwCSS1Parser
merge SvxListBoxControl with SvxUndoRedoControl
merge SvxRTFParser with EditRTFParser merge SvxRTFParser with EditRTFParser
merge SvxShapeMaster with SdXShape merge SvxShapeMaster with SdXShape
merge SwAccessibleFrame with SwAccessibleContext merge SwAccessibleFrame with SwAccessibleContext

View File

@@ -29,39 +29,24 @@ class ToolBox;
class SvxPopupWindowListBox; class SvxPopupWindowListBox;
class SvxListBoxControl : public SfxToolBoxControl class SVX_DLLPUBLIC SvxUndoRedoControl : public SfxToolBoxControl
{ {
protected:
OUString aActionStr; OUString aActionStr;
VclPtr<SvxPopupWindowListBox> pPopupWin; VclPtr<SvxPopupWindowListBox> pPopupWin;
std::vector< OUString > aUndoRedoList;
OUString aDefaultTooltip;
void Impl_SetInfo( sal_Int32 nCount ); void Impl_SetInfo( sal_Int32 nCount );
DECL_LINK( PopupModeEndHdl, FloatingWindow*, void ); DECL_LINK( PopupModeEndHdl, FloatingWindow*, void );
DECL_LINK( SelectHdl, ListBox&, void ); DECL_LINK( SelectHdl, ListBox&, void );
public:
SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxListBoxControl() override;
virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
virtual void StateChanged( sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState ) override;
};
class SVX_DLLPUBLIC SvxUndoRedoControl : public SvxListBoxControl
{
std::vector< OUString > aUndoRedoList;
OUString aDefaultTooltip;
public: public:
SFX_DECL_TOOLBOX_CONTROL(); SFX_DECL_TOOLBOX_CONTROL();
SvxUndoRedoControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); SvxUndoRedoControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxUndoRedoControl() override; virtual ~SvxUndoRedoControl() override;
virtual void StateChanged( sal_uInt16 nSID, virtual void StateChanged( sal_uInt16 nSID,
SfxItemState eState, SfxItemState eState,
const SfxPoolItem* pState ) override; const SfxPoolItem* pState ) override;

View File

@@ -121,34 +121,7 @@ void SvxPopupWindowListBox::statusChanged( const css::frame::FeatureStateEvent&
SfxPopupWindow::statusChanged( rEvent ); SfxPopupWindow::statusChanged( rEvent );
} }
SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) IMPL_LINK_NOARG(SvxUndoRedoControl, PopupModeEndHdl, FloatingWindow*, void)
:SfxToolBoxControl( nSlotId, nId, rTbx ),
pPopupWin ( nullptr )
{
rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) );
rTbx.Invalidate();
}
SvxListBoxControl::~SvxListBoxControl()
{}
VclPtr<SfxPopupWindow> SvxListBoxControl::CreatePopupWindow()
{
OSL_FAIL( "not implemented" );
return nullptr;
}
void SvxListBoxControl::StateChanged(
sal_uInt16, SfxItemState, const SfxPoolItem* pState )
{
GetToolBox().EnableItem( GetId(),
SfxItemState::DISABLED != GetItemState(pState) );
}
IMPL_LINK_NOARG(SvxListBoxControl, PopupModeEndHdl, FloatingWindow*, void)
{ {
if( pPopupWin && FloatWinPopupFlags::NONE == pPopupWin->GetPopupModeFlags() && if( pPopupWin && FloatWinPopupFlags::NONE == pPopupWin->GetPopupModeFlags() &&
pPopupWin->IsUserSelected() ) pPopupWin->IsUserSelected() )
@@ -165,7 +138,7 @@ IMPL_LINK_NOARG(SvxListBoxControl, PopupModeEndHdl, FloatingWindow*, void)
} }
void SvxListBoxControl::Impl_SetInfo( sal_Int32 nCount ) void SvxUndoRedoControl::Impl_SetInfo( sal_Int32 nCount )
{ {
DBG_ASSERT( pPopupWin, "NULL pointer, PopupWindow missing" ); DBG_ASSERT( pPopupWin, "NULL pointer, PopupWindow missing" );
@@ -184,7 +157,7 @@ void SvxListBoxControl::Impl_SetInfo( sal_Int32 nCount )
} }
IMPL_LINK_NOARG(SvxListBoxControl, SelectHdl, ListBox&, void) IMPL_LINK_NOARG(SvxUndoRedoControl, SelectHdl, ListBox&, void)
{ {
if (pPopupWin) if (pPopupWin)
{ {
@@ -205,7 +178,8 @@ IMPL_LINK_NOARG(SvxListBoxControl, SelectHdl, ListBox&, void)
SFX_IMPL_TOOLBOX_CONTROL( SvxUndoRedoControl, SfxStringItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxUndoRedoControl, SfxStringItem );
SvxUndoRedoControl::SvxUndoRedoControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) SvxUndoRedoControl::SvxUndoRedoControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
: SvxListBoxControl( nSlotId, nId, rTbx ) :SfxToolBoxControl( nSlotId, nId, rTbx ),
pPopupWin ( nullptr )
{ {
rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) );
rTbx.Invalidate(); rTbx.Invalidate();
@@ -233,7 +207,8 @@ void SvxUndoRedoControl::StateChanged(
const OUString& aQuickHelpText = rItem.GetValue(); const OUString& aQuickHelpText = rItem.GetValue();
rBox.SetQuickHelpText( GetId(), aQuickHelpText ); rBox.SetQuickHelpText( GetId(), aQuickHelpText );
} }
SvxListBoxControl::StateChanged( nSID, eState, pState ); GetToolBox().EnableItem( GetId(),
SfxItemState::DISABLED != GetItemState(pState) );
} }
else else
{ {