diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2020-02-13 14:41:10 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2020-02-13 21:21:27 +0100 |
commit | 98bc216781d52af7242b671595ec88a9468d6704 (patch) | |
tree | df3344734517846bb3671615115965fa1f4b946d /svx | |
parent | 3b8c42a94b5448364d47daa103b3452f54990524 (diff) |
Restore simple undo and redo buttons for the basctl module
Changed in commit c34edadf5bd3d1d9f3c9c056af28b8964d8f1ca0
("rework SvxUndoRedoControl to be a PopupWindowController"),
but the dropdowns do not work in that module.
These buttons used to be managed by SvxSimpleUndoRedoController,
but that's no longer the case. The reason is that
ToolBarManager::CreateControllers checks first for controllers
registered in Controller.xcu, and only if none found it checks
for sfx2 controllers. So SvxSimpleUndoRedoController by using
a sfx2-style registration, has no chance to be ever selected
for .uno:Undo or .uno:Redo.
This commit removes the unused controller, and restores the
previous behavior with the other controller.
Change-Id: Ia774195511e41ab11562856fe1cf2ec7f170710a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88606
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/lboxctrl.cxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 25 |
2 files changed, 1 insertions, 26 deletions
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index 0f8b12019263..5497381f02dc 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -154,7 +154,7 @@ void SvxUndoRedoControl::initialize( const css::uno::Sequence< css::uno::Any >& ToolBox* pToolBox = nullptr; sal_uInt16 nId = 0; - if (getToolboxId(nId, &pToolBox)) + if (getToolboxId(nId, &pToolBox) && getModuleName() != "com.sun.star.script.BasicIDE") { pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWN | pToolBox->GetItemBits(nId)); aDefaultTooltip = pToolBox->GetQuickHelpText(nId); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 8096ac0168f1..c0398e5783d6 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -133,7 +133,6 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem ); -SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem ); class SvxStyleBox_Impl : public ComboBox { @@ -3646,30 +3645,6 @@ com_sun_star_comp_svx_FrameToolBoxControl_get_implementation( return cppu::acquire( new SvxFrameToolBoxControl( rContext ) ); } -SvxSimpleUndoRedoController::SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) - :SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - aDefaultText = rTbx.GetItemText( nId ); -} - -SvxSimpleUndoRedoController::~SvxSimpleUndoRedoController() -{ -} - -void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState ) -{ - const SfxStringItem* pItem = dynamic_cast<const SfxStringItem*>( pState ); - ToolBox& rBox = GetToolBox(); - if ( pItem && eState != SfxItemState::DISABLED ) - { - OUString aNewText( MnemonicGenerator::EraseAllMnemonicChars( pItem->GetValue() ) ); - rBox.SetQuickHelpText( GetId(), aNewText ); - } - if ( eState == SfxItemState::DISABLED ) - rBox.SetQuickHelpText( GetId(), aDefaultText ); - rBox.EnableItem( GetId(), eState != SfxItemState::DISABLED ); -} - SvxCurrencyToolBoxControl::SvxCurrencyToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext ) : PopupWindowController( rContext, nullptr, OUString() ), m_eLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() ), |