diff options
-rw-r--r-- | include/sfx2/weldutils.hxx | 14 | ||||
-rw-r--r-- | include/svtools/popupwindowcontroller.hxx | 9 | ||||
-rw-r--r-- | include/svtools/toolbarmenu.hxx | 40 | ||||
-rw-r--r-- | include/svx/colorwindow.hxx | 10 | ||||
-rw-r--r-- | sfx2/source/toolbox/weldutils.cxx | 11 | ||||
-rw-r--r-- | svtools/source/control/toolbarmenu.cxx | 50 | ||||
-rw-r--r-- | svtools/source/uno/popupwindowcontroller.cxx | 6 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/bulletsnumbering.cxx | 202 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 21 | ||||
-rw-r--r-- | svx/uiconfig/ui/interimdockparent.ui | 30 | ||||
-rw-r--r-- | svx/uiconfig/ui/interimparent.ui | 14 | ||||
-rw-r--r-- | svx/uiconfig/ui/numberingwindow.ui | 2 | ||||
-rw-r--r-- | vcl/source/window/dockwin.cxx | 2 |
14 files changed, 191 insertions, 222 deletions
diff --git a/include/sfx2/weldutils.hxx b/include/sfx2/weldutils.hxx index 8ea999675ad1..cfcf545d9002 100644 --- a/include/sfx2/weldutils.hxx +++ b/include/sfx2/weldutils.hxx @@ -16,7 +16,6 @@ #include <com/sun/star/uno/Reference.hxx> #include <tools/link.hxx> #include <sfx2/dllapi.h> -#include <svtools/toolbarmenu.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -53,19 +52,6 @@ public: ~ToolbarUnoDispatcher(); }; -class SFX2_DLLPUBLIC WeldToolbarPopup : public svtools::ToolbarPopupBase -{ -protected: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::Container> m_xTopLevel; - -public: - WeldToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, weld::Widget* pParent, - const OUString& rUIFile, const OString& rId); - virtual ~WeldToolbarPopup() override; - weld::Container* getTopLevel() { return m_xTopLevel.get(); } -}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/popupwindowcontroller.hxx b/include/svtools/popupwindowcontroller.hxx index 1666c8ad1513..be39cc8e2b69 100644 --- a/include/svtools/popupwindowcontroller.hxx +++ b/include/svtools/popupwindowcontroller.hxx @@ -32,10 +32,8 @@ namespace vcl { class Window; } -namespace svtools -{ - class ToolbarPopupBase; -} +class InterimToolbarPopup; +class WeldToolbarPopup; namespace svt { @@ -69,7 +67,8 @@ public: virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override; protected: - std::unique_ptr<svtools::ToolbarPopupBase> mxPopover; + std::unique_ptr<WeldToolbarPopup> mxPopover; + VclPtr<InterimToolbarPopup> mxInterimPopover; private: std::unique_ptr<PopupWindowControllerImpl, o3tl::default_delete<PopupWindowControllerImpl>> mxImpl; diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx index 01c8652d3415..1ff5079e569a 100644 --- a/include/svtools/toolbarmenu.hxx +++ b/include/svtools/toolbarmenu.hxx @@ -26,6 +26,7 @@ #include <rtl/ref.hxx> #include <vcl/dockwin.hxx> +#include <vcl/weld.hxx> namespace com :: sun :: star :: frame { class XFrame; } namespace com :: sun :: star :: frame { struct FeatureStateEvent; } @@ -152,6 +153,45 @@ private: } // namespace svtools +class SVT_DLLPUBLIC WeldToolbarPopup : public svtools::ToolbarPopupBase +{ +private: + DECL_LINK(FocusHdl, weld::Widget&, void); + +protected: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Container> m_xTopLevel; + std::unique_ptr<weld::Container> m_xContainer; + +public: + WeldToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, + weld::Widget* pParent, const OUString& rUIFile, const OString& rId); + virtual ~WeldToolbarPopup() override; + weld::Container* getTopLevel() { return m_xTopLevel.get(); } + weld::Container* getContainer() { return m_xContainer.get(); } + + virtual void GrabFocus() = 0; +}; + +class SVT_DLLPUBLIC InterimToolbarPopup : public svtools::ToolbarPopup +{ +protected: + VclPtr<vcl::Window> m_xBox; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Container> m_xContainer; + + WeldToolbarPopup* m_pPopup; +public: + InterimToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParent, WeldToolbarPopup* pPopup); + weld::Container* getContainer() { return m_xContainer.get(); } + virtual void dispose() override; + virtual ~InterimToolbarPopup() override; + + virtual void GetFocus() override; + + using ToolbarPopup::EndPopupMode; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx index 257d1e6801f7..67e5aebdb353 100644 --- a/include/svx/colorwindow.hxx +++ b/include/svx/colorwindow.hxx @@ -126,11 +126,9 @@ public: weld::Widget* get_widget() const; }; -class SVX_DLLPUBLIC ColorWindow final : public svtools::ToolbarPopupBase +class SVX_DLLPUBLIC ColorWindow final : public WeldToolbarPopup { private: - std::unique_ptr<weld::Builder> m_xBuilder; - const sal_uInt16 theSlotId; OUString maCommand; weld::Window* const mpParentWindow; @@ -141,7 +139,6 @@ private: std::unique_ptr<ColorValueSet> mxColorSet; std::unique_ptr<ColorValueSet> mxRecentColorSet; - std::unique_ptr<weld::Container> mxTopLevel; std::unique_ptr<weld::ComboBox> mxPaletteListBox; std::unique_ptr<weld::Button> mxButtonAutoColor; std::unique_ptr<weld::Button> mxButtonNoneColor; @@ -169,7 +166,6 @@ public: const css::uno::Reference< css::frame::XFrame >& rFrame, weld::Window* pParentWindow, const MenuOrToolMenuButton &rMenuButton, ColorSelectFunction const& rColorSelectFunction); - weld::Container* getTopLevel() { return mxTopLevel.get(); } virtual ~ColorWindow() override; void ShowNoneButton(); void SetNoSelection(); @@ -178,11 +174,11 @@ public: void SelectEntry(const Color& rColor); NamedColor GetSelectEntryColor() const; - DECL_LINK(FocusHdl, weld::Widget&, void); - virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; void SetSelectedHdl( const Link<const NamedColor&, void>& rLink ) { maSelectedLink = rLink; } + + virtual void GrabFocus() override; }; #endif diff --git a/sfx2/source/toolbox/weldutils.cxx b/sfx2/source/toolbox/weldutils.cxx index 434f6c479d6a..52cf254d7b9a 100644 --- a/sfx2/source/toolbox/weldutils.cxx +++ b/sfx2/source/toolbox/weldutils.cxx @@ -132,15 +132,4 @@ void ToolbarUnoDispatcher::dispose() ToolbarUnoDispatcher::~ToolbarUnoDispatcher() { dispose(); } -WeldToolbarPopup::WeldToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, - weld::Widget* pParent, const OUString& rUIFile, - const OString& rId) - : ToolbarPopupBase(rFrame) - , m_xBuilder(Application::CreateBuilder(pParent, rUIFile)) - , m_xTopLevel(m_xBuilder->weld_container(rId)) -{ -} - -WeldToolbarPopup::~WeldToolbarPopup() {} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 247987305bbc..7b12d910a81e 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -30,6 +30,7 @@ #include <vcl/settings.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> +#include <vcl/svapp.hxx> #include <svtools/framestatuslistener.hxx> #include <svtools/valueset.hxx> @@ -1514,8 +1515,57 @@ void ToolbarMenu::SetSelectHdl( const Link<ToolbarMenu*,void>& rLink ) mpImpl->maSelectHdl = rLink; } +} + +WeldToolbarPopup::WeldToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, + weld::Widget* pParent, const OUString& rUIFile, + const OString& rId) + : ToolbarPopupBase(rFrame) + , m_xBuilder(Application::CreateBuilder(pParent, rUIFile)) + , m_xTopLevel(m_xBuilder->weld_container(rId)) + , m_xContainer(m_xBuilder->weld_container("container")) +{ + m_xTopLevel->connect_focus_in(LINK(this, WeldToolbarPopup, FocusHdl)); +} + +WeldToolbarPopup::~WeldToolbarPopup() +{ +} + +IMPL_LINK_NOARG(WeldToolbarPopup, FocusHdl, weld::Widget&, void) +{ + GrabFocus(); +} + +InterimToolbarPopup::InterimToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParent, WeldToolbarPopup* pPopup) + : ToolbarPopup(rFrame, pParent, "InterimDockParent", "svx/ui/interimdockparent.ui") + , m_xBox(get<vcl::Window>("box")) + , m_xBuilder(Application::CreateInterimBuilder(m_xBox.get(), "svx/ui/interimparent.ui")) + , m_xContainer(m_xBuilder->weld_container("container")) + , m_pPopup(pPopup) +{ + // move the WeldToolbarPopup contents into this interim toolbar so welded contents can appear as a dropdown in an unwelded toolbar + m_pPopup->getTopLevel()->move(m_pPopup->getContainer(), m_xContainer.get()); +} +void InterimToolbarPopup::GetFocus() +{ + ToolbarPopup::GetFocus(); + m_pPopup->GrabFocus(); } +void InterimToolbarPopup::dispose() +{ + // move the contents back where it belongs + m_xContainer->move(m_pPopup->getContainer(), m_pPopup->getTopLevel()); + m_xContainer.reset(); + m_xBox.clear(); + ToolbarPopup::dispose(); +} + +InterimToolbarPopup::~InterimToolbarPopup() +{ + disposeOnce(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index cc283adbdf42..7b1e3357424d 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -176,6 +176,7 @@ sal_Bool SAL_CALL PopupWindowController::supportsService( const OUString& Servic // XComponent void SAL_CALL PopupWindowController::dispose() { + mxInterimPopover.clear(); mxPopover.reset(); mxImpl.reset(); svt::ToolboxController::dispose(); @@ -238,7 +239,10 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() void PopupWindowController::EndPopupMode() { - m_pToolbar->set_menu_item_active(m_aCommandURL.toUtf8(), false); + if (m_pToolbar) + m_pToolbar->set_menu_item_active(m_aCommandURL.toUtf8(), false); + else if (mxInterimPopover) + mxInterimPopover->EndPopupMode(); } } diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 529ab820c4c1..070e52ade41f 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -62,6 +62,8 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/headfootformatpage \ svx/uiconfig/ui/imapdialog \ svx/uiconfig/ui/imapmenu \ + svx/uiconfig/ui/interimdockparent \ + svx/uiconfig/ui/interimparent \ svx/uiconfig/ui/linkwarndialog \ svx/uiconfig/ui/mediaplayback \ svx/uiconfig/ui/namespacedialog \ diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx index 157d01ad3b14..d33f790a5250 100644 --- a/svx/source/tbxctrls/bulletsnumbering.cxx +++ b/svx/source/tbxctrls/bulletsnumbering.cxx @@ -16,6 +16,7 @@ #include <svtools/popupwindowcontroller.hxx> #include <svtools/toolbarmenu.hxx> #include <sfx2/weldutils.hxx> +#include <sfx2/tbxctrl.hxx> #include <svx/strings.hrc> #include <svx/dialmgr.hxx> #include <svx/numvset.hxx> @@ -27,24 +28,7 @@ namespace { class NumberingToolBoxControl; -class NumberingPopup : public svtools::ToolbarMenu -{ - NumberingPageType const mePageType; - NumberingToolBoxControl& mrController; - VclPtr<SvxNumValueSet> mpValueSet; - DECL_LINK( VSSelectToolbarMenuHdl, ToolbarMenu*, void ); - DECL_LINK( VSSelectValueSetHdl, ValueSet*, void ); - void VSSelectHdl(void const *); -public: - NumberingPopup( NumberingToolBoxControl& rController, - vcl::Window* pParent, NumberingPageType ePageType ); - virtual ~NumberingPopup() override; - virtual void dispose() override; - - virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; -}; - -class SvxNumberingPopup : public WeldToolbarPopup +class NumberingPopup : public WeldToolbarPopup { NumberingPageType const mePageType; NumberingToolBoxControl& mrController; @@ -53,10 +37,11 @@ class SvxNumberingPopup : public WeldToolbarPopup std::unique_ptr<weld::Button> mxMoreButton; DECL_LINK(VSSelectValueSetHdl, SvtValueSet*, void); DECL_LINK(VSButtonClickSetHdl, weld::Button&, void); - DECL_LINK(FocusHdl, weld::Widget&, void); + + virtual void GrabFocus() override; public: - SvxNumberingPopup(NumberingToolBoxControl& rController, weld::Toolbar* pParent, NumberingPageType ePageType); + NumberingPopup(NumberingToolBoxControl& rController, weld::Widget* pParent, NumberingPageType ePageType); virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; }; @@ -81,74 +66,8 @@ public: } -NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController, - vcl::Window* pParent, NumberingPageType ePageType ) : - ToolbarMenu( rController.getFrameInterface(), pParent, WB_STDPOPUP ), - mePageType( ePageType ), - mrController( rController ) -{ - WinBits nBits = WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT; - mpValueSet = VclPtr<SvxNumValueSet>::Create( this, nBits ); - mpValueSet->init( mePageType ); - - if ( mePageType != NumberingPageType::BULLET ) - { - css::uno::Reference< css::text::XDefaultNumberingProvider > xDefNum = css::text::DefaultNumberingProvider::create( mrController.getContext() ); - if ( xDefNum.is() ) - { - css::lang::Locale aLocale = GetSettings().GetLanguageTag().getLocale(); - css::uno::Reference< css::text::XNumberingFormatter > xFormat( xDefNum, css::uno::UNO_QUERY ); - - if ( mePageType == NumberingPageType::SINGLENUM ) - { - css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aNumberings( - xDefNum->getDefaultContinuousNumberingLevels( aLocale ) ); - mpValueSet->SetNumberingSettings( aNumberings, xFormat, aLocale ); - } - else if ( mePageType == NumberingPageType::OUTLINE ) - { - css::uno::Sequence< css::uno::Reference< css::container::XIndexAccess > > aOutline( - xDefNum->getDefaultOutlineNumberings( aLocale ) ); - mpValueSet->SetOutlineNumberingSettings( aOutline, xFormat, aLocale ); - } - } - } - - Size aItemSize(LogicToPixel(Size(30, 42), MapMode(MapUnit::MapAppFont))); - mpValueSet->SetExtraSpacing( 2 ); - mpValueSet->SetOutputSizePixel( mpValueSet->CalcWindowSizePixel( aItemSize ) ); - mpValueSet->SetColor( GetSettings().GetStyleSettings().GetFieldColor() ); - - appendEntry( 0, mpValueSet ); - appendSeparator(); - - OUString aMoreItemText; - if ( mePageType == NumberingPageType::BULLET ) - { - aMoreItemText = SvxResId( RID_SVXSTR_MOREBULLETS ); - AddStatusListener( ".uno:CurrentBulletListType" ); - } - else if ( mePageType == NumberingPageType::SINGLENUM ) - { - aMoreItemText = SvxResId( RID_SVXSTR_MORENUMBERING ); - AddStatusListener( ".uno:CurrentNumListType" ); - } - else - { - aMoreItemText = SvxResId( RID_SVXSTR_MORE ); - AddStatusListener( ".uno:CurrentOutlineType" ); - } - - appendEntry( 1, aMoreItemText, - vcl::CommandInfoProvider::GetImageForCommand( ".uno:OutlineBullet", mrController.getFrameInterface() ) ); - - SetOutputSizePixel( getMenuSize() ); - mpValueSet->SetSelectHdl( LINK( this, NumberingPopup, VSSelectValueSetHdl ) ); - SetSelectHdl( LINK( this, NumberingPopup, VSSelectToolbarMenuHdl ) ); -} - -SvxNumberingPopup::SvxNumberingPopup(NumberingToolBoxControl& rController, - weld::Toolbar* pParent, NumberingPageType ePageType) +NumberingPopup::NumberingPopup(NumberingToolBoxControl& rController, + weld::Widget* pParent, NumberingPageType ePageType) : WeldToolbarPopup(rController.getFrameInterface(), pParent, "svx/ui/numberingwindow.ui", "NumberingWindow") , mePageType(ePageType) , mrController(rController) @@ -156,8 +75,6 @@ SvxNumberingPopup::SvxNumberingPopup(NumberingToolBoxControl& rController, , mxValueSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxValueSet)) , mxMoreButton(m_xBuilder->weld_button("more")) { - m_xTopLevel->connect_focus_in(LINK(this, SvxNumberingPopup, FocusHdl)); - mxValueSet->SetStyle(WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT); mxValueSet->init(mePageType); @@ -213,33 +130,13 @@ SvxNumberingPopup::SvxNumberingPopup(NumberingToolBoxControl& rController, auto xImage = vcl::CommandInfoProvider::GetXGraphicForCommand(".uno:OutlineBullet", mrController.getFrameInterface()); mxMoreButton->set_image(xImage); mxMoreButton->set_label(aMoreItemText); - mxMoreButton->connect_clicked(LINK(this, SvxNumberingPopup, VSButtonClickSetHdl)); + mxMoreButton->connect_clicked(LINK(this, NumberingPopup, VSButtonClickSetHdl)); - mxValueSet->SetSelectHdl(LINK(this, SvxNumberingPopup, VSSelectValueSetHdl)); -} - -NumberingPopup::~NumberingPopup() -{ - disposeOnce(); -} - -void NumberingPopup::dispose() -{ - mpValueSet.clear(); - ToolbarMenu::dispose(); + mxValueSet->SetSelectHdl(LINK(this, NumberingPopup, VSSelectValueSetHdl)); } void NumberingPopup::statusChanged( const css::frame::FeatureStateEvent& rEvent ) { - mpValueSet->SetNoSelection(); - - sal_Int32 nSelItem; - if ( rEvent.State >>= nSelItem ) - mpValueSet->SelectItem( nSelItem ); -} - -void SvxNumberingPopup::statusChanged( const css::frame::FeatureStateEvent& rEvent ) -{ mxValueSet->SetNoSelection(); sal_Int32 nSelItem; @@ -247,12 +144,7 @@ void SvxNumberingPopup::statusChanged( const css::frame::FeatureStateEvent& rEve mxValueSet->SelectItem( nSelItem ); } -IMPL_LINK( NumberingPopup, VSSelectValueSetHdl, ValueSet*, pControl, void ) -{ - VSSelectHdl(pControl); -} - -IMPL_LINK_NOARG(SvxNumberingPopup, VSSelectValueSetHdl, SvtValueSet*, void) +IMPL_LINK_NOARG(NumberingPopup, VSSelectValueSetHdl, SvtValueSet*, void) { mrController.EndPopupMode(); @@ -274,12 +166,12 @@ IMPL_LINK_NOARG(SvxNumberingPopup, VSSelectValueSetHdl, SvtValueSet*, void) } } -IMPL_LINK_NOARG(SvxNumberingPopup, FocusHdl, weld::Widget&, void) +void NumberingPopup::GrabFocus() { mxValueSet->GrabFocus(); } -IMPL_LINK_NOARG(SvxNumberingPopup, VSButtonClickSetHdl, weld::Button&, void) +IMPL_LINK_NOARG(NumberingPopup, VSButtonClickSetHdl, weld::Button&, void) { mrController.EndPopupMode(); @@ -287,43 +179,6 @@ IMPL_LINK_NOARG(SvxNumberingPopup, VSButtonClickSetHdl, weld::Button&, void) mrController.dispatchCommand( ".uno:OutlineBullet", aArgs ); } -IMPL_LINK( NumberingPopup, VSSelectToolbarMenuHdl, ToolbarMenu*, pControl, void ) -{ - VSSelectHdl(pControl); -} - -void NumberingPopup::VSSelectHdl(void const * pControl) -{ - if ( IsInPopupMode() ) - EndPopupMode(); - - if ( pControl == mpValueSet ) - { - sal_uInt16 nSelItem = mpValueSet->GetSelectedItemId(); - if ( mePageType == NumberingPageType::BULLET ) - { - auto aArgs( comphelper::InitPropertySequence( { { "SetBullet", css::uno::makeAny( nSelItem ) } } ) ); - mrController.dispatchCommand( ".uno:SetBullet", aArgs ); - } - else if ( mePageType == NumberingPageType::SINGLENUM ) - { - auto aArgs( comphelper::InitPropertySequence( { { "SetNumber", css::uno::makeAny( nSelItem ) } } ) ); - mrController.dispatchCommand( ".uno:SetNumber", aArgs ); - } - else - { - auto aArgs( comphelper::InitPropertySequence( { { "SetOutline", css::uno::makeAny( nSelItem ) } } ) ); - mrController.dispatchCommand( ".uno:SetOutline", aArgs ); - } - } - else if ( getSelectedEntryId() == 1 ) - { - auto aArgs( comphelper::InitPropertySequence( { { "Page", css::uno::makeAny( OUString("customize") ) } } ) ); - mrController.dispatchCommand( ".uno:OutlineBullet", aArgs ); - } -} - - NumberingToolBoxControl::NumberingToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ): svt::PopupWindowController( rxContext, css::uno::Reference< css::frame::XFrame >(), OUString() ), mePageType( NumberingPageType::SINGLENUM ) @@ -332,7 +187,11 @@ NumberingToolBoxControl::NumberingToolBoxControl( const css::uno::Reference< css VclPtr<vcl::Window> NumberingToolBoxControl::createPopupWindow( vcl::Window* pParent ) { - return VclPtr<NumberingPopup>::Create( *this, pParent, mePageType ); + mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, mxPopover.get()); + + mxInterimPopover->Show(); + + return mxInterimPopover; } void SAL_CALL NumberingToolBoxControl::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) @@ -344,22 +203,25 @@ void SAL_CALL NumberingToolBoxControl::initialize( const css::uno::Sequence< css else if ( m_aCommandURL == ".uno:SetOutline" ) mePageType = NumberingPageType::OUTLINE; - if (m_pToolbar) - { - const OString aId(m_aCommandURL.toUtf8()); - - auto xPopover = std::make_unique<SvxNumberingPopup>(*this, m_pToolbar, mePageType); - - m_pToolbar->set_item_popover(aId, xPopover->getTopLevel()); - mxPopover = std::move(xPopover); - return; - } - ToolBoxItemBits nBits = ( mePageType == NumberingPageType::OUTLINE ) ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN; ToolBox* pToolBox = nullptr; sal_uInt16 nId = 0; - if ( getToolboxId( nId, &pToolBox ) ) + bool bVcl = getToolboxId(nId, &pToolBox); + + weld::Widget* pParent; + if (pToolBox) + pParent = pToolBox->GetFrameWeld(); + else + pParent = m_pToolbar; + mxPopover = std::make_unique<NumberingPopup>(*this, pParent, mePageType); + + if (bVcl) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | nBits ); + else if (m_pToolbar) + { + const OString aId(m_aCommandURL.toUtf8()); + m_pToolbar->set_item_popover(aId, mxPopover->getTopLevel()); + } } OUString SAL_CALL NumberingToolBoxControl::getImplementationName() diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index a63b13b3021a..93f589a7d03b 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1783,8 +1783,7 @@ ColorWindow::ColorWindow(const OUString& rCommand, weld::Window* pParentWindow, const MenuOrToolMenuButton& rMenuButton, ColorSelectFunction const & aFunction) - : ToolbarPopupBase(rFrame) - , m_xBuilder(Application::CreateBuilder(rMenuButton.get_widget(), "svx/ui/colorwindow.ui")) + : WeldToolbarPopup(rFrame, rMenuButton.get_widget(), "svx/ui/colorwindow.ui", "palette_popup_window") , theSlotId(nSlotId) , maCommand(rCommand) , mpParentWindow(pParentWindow) @@ -1794,7 +1793,6 @@ ColorWindow::ColorWindow(const OUString& rCommand, , maColorSelectFunction(aFunction) , mxColorSet(new ColorValueSet(m_xBuilder->weld_scrolled_window("colorsetwin"))) , mxRecentColorSet(new ColorValueSet(nullptr)) - , mxTopLevel(m_xBuilder->weld_container("palette_popup_window")) , mxPaletteListBox(m_xBuilder->weld_combo_box("palette_listbox")) , mxButtonAutoColor(m_xBuilder->weld_button("auto_color_button")) , mxButtonNoneColor(m_xBuilder->weld_button("none_color_button")) @@ -1865,8 +1863,7 @@ ColorWindow::ColorWindow(const OUString& rCommand, mxColorSet->SetSelectHdl(LINK( this, ColorWindow, SelectHdl)); mxRecentColorSet->SetSelectHdl(LINK( this, ColorWindow, SelectHdl)); - mxTopLevel->set_help_id(HID_POPUP_COLOR); - mxTopLevel->connect_focus_in(LINK(this, ColorWindow, FocusHdl)); + m_xTopLevel->set_help_id(HID_POPUP_COLOR); mxColorSet->SetHelpId(HID_POPUP_COLOR_CTRL); mxPaletteManager->ReloadColorSet(*mxColorSet); @@ -1887,7 +1884,7 @@ ColorWindow::ColorWindow(const OUString& rCommand, } } -IMPL_LINK_NOARG(ColorWindow, FocusHdl, weld::Widget&, void) +void ColorWindow::GrabFocus() { if (mxColorSet->IsNoSelection() && mpDefaultButton) mpDefaultButton->grab_focus(); @@ -3502,9 +3499,10 @@ void SvxColorToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any> if ( m_bSplitButton ) xPopover->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) ); - m_pToolbar->set_item_popover(aId, xPopover->getTopLevel()); mxPopover = std::move(xPopover); + m_pToolbar->set_item_popover(aId, mxPopover->getTopLevel()); + m_xBtnUpdater.reset(new svx::ToolboxButtonColorUpdater(m_nSlotId, aId, m_pToolbar, !m_bSplitButton, aCommandLabel, m_xFrame)); return; } @@ -3811,9 +3809,10 @@ namespace std::vector<OUString> m_aFormatEntries; LanguageType m_eFormatLanguage; DECL_LINK(RowActivatedHdl, weld::TreeView&, bool); - DECL_LINK(FocusHdl, weld::Widget&, void); DECL_LINK(OKHdl, weld::Button&, void); + virtual void GrabFocus() override; + public: CurrencyList_Impl(SvxCurrencyToolBoxControl* pControl, weld::Widget* pParent, OUString& rSelectedFormat, LanguageType& eSelectedLanguage) : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/currencywindow.ui", "CurrencyWindow") @@ -3824,8 +3823,6 @@ namespace , m_rSelectedFormat(rSelectedFormat) , m_eSelectedLanguage(eSelectedLanguage) { - m_xTopLevel->connect_focus_in(LINK(this, CurrencyList_Impl, FocusHdl)); - m_xCurrencyLb->set_size_request(-1, m_xCurrencyLb->get_height_rows(12)); std::vector< OUString > aList; @@ -3871,7 +3868,7 @@ namespace } }; - IMPL_LINK_NOARG(CurrencyList_Impl, FocusHdl, weld::Widget&, void) + void CurrencyList_Impl::GrabFocus() { m_xCurrencyLb->grab_focus(); } @@ -4302,7 +4299,7 @@ ColorListBox::ColorListBox(std::unique_ptr<weld::MenuButton> pControl, weld::Win IMPL_LINK(ColorListBox, ToggleHdl, weld::ToggleButton&, rButton, void) { if (rButton.get_active()) - getColorWindow()->FocusHdl(*m_xButton); + getColorWindow()->GrabFocus(); } ColorListBox::~ColorListBox() diff --git a/svx/uiconfig/ui/interimdockparent.ui b/svx/uiconfig/ui/interimdockparent.ui new file mode 100644 index 000000000000..45b9a794f3ad --- /dev/null +++ b/svx/uiconfig/ui/interimdockparent.ui @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkWindow" id="InterimDockParent"> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border_width">4</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">True</property> + <property name="type_hint">popup-menu</property> + <property name="skip_pager_hint">True</property> + <property name="deletable">False</property> + <child> + <placeholder/> + </child> + <child> + <object class="GtkBox" id="box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <placeholder/> + </child> + </object> + </child> + </object> +</interface> diff --git a/svx/uiconfig/ui/interimparent.ui b/svx/uiconfig/ui/interimparent.ui new file mode 100644 index 000000000000..b0330586a60a --- /dev/null +++ b/svx/uiconfig/ui/interimparent.ui @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkBox" id="container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <placeholder/> + </child> + </object> +</interface> diff --git a/svx/uiconfig/ui/numberingwindow.ui b/svx/uiconfig/ui/numberingwindow.ui index 60abdc3777e8..3985407910dc 100644 --- a/svx/uiconfig/ui/numberingwindow.ui +++ b/svx/uiconfig/ui/numberingwindow.ui @@ -7,7 +7,7 @@ <property name="no_show_all">True</property> <property name="border_width">4</property> <child> - <object class="GtkBox"> + <object class="GtkBox" id="container"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 108a7d5b3700..411de5bfc526 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -1052,7 +1052,7 @@ IMPL_LINK_NOARG(DockingWindow, ImplHandleLayoutTimerHdl, Timer*, void) { if (!isLayoutEnabled()) { - SAL_WARN("vcl.layout", "DockingWindow has become non-layout because extra children have been added directly to it."); + SAL_WARN_IF(GetWindow(GetWindowType::FirstChild), "vcl.layout", "DockingWindow has become non-layout because extra children have been added directly to it."); return; } setPosSizeOnContainee(); |