rework TextUnderlinePopup to be a PopupWindowController
Change-Id: I149777b827dd00e00e62b461836122861864f829 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86697 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -19,23 +19,26 @@
|
||||
#ifndef INCLUDED_SVX_SIDEBAR_TEXT_TEXTUNDERLINEPOPUP_HXX
|
||||
#define INCLUDED_SVX_SIDEBAR_TEXT_TEXTUNDERLINEPOPUP_HXX
|
||||
|
||||
#include <sfx2/tbxctrl.hxx>
|
||||
#include <svtools/popupwindowcontroller.hxx>
|
||||
#include <svx/svxdllapi.h>
|
||||
|
||||
namespace svx {
|
||||
|
||||
class SVX_DLLPUBLIC TextUnderlinePopup final : public SfxToolBoxControl
|
||||
class SVX_DLLPUBLIC TextUnderlinePopup final : public svt::PopupWindowController
|
||||
{
|
||||
public:
|
||||
SFX_DECL_TOOLBOX_CONTROL();
|
||||
|
||||
TextUnderlinePopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
|
||||
TextUnderlinePopup(const css::uno::Reference<css::uno::XComponentContext>& rContext);
|
||||
virtual ~TextUnderlinePopup() override;
|
||||
|
||||
// XInitialization
|
||||
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
|
||||
using svt::ToolboxController::createPopupWindow;
|
||||
virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
|
||||
|
||||
virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName() override;
|
||||
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
|
||||
|
||||
// XInitialization
|
||||
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override;
|
||||
};
|
||||
|
||||
} // end of namespace svx
|
||||
|
@@ -1404,6 +1404,17 @@
|
||||
<value>com.sun.star.comp.svx.ColorToolBoxControl</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="UnderlineToolBoxControl" oor:op="replace">
|
||||
<prop oor:name="Command">
|
||||
<value>.uno:Underline</value>
|
||||
</prop>
|
||||
<prop oor:name="Module">
|
||||
<value/>
|
||||
</prop>
|
||||
<prop oor:name="Controller">
|
||||
<value>com.sun.star.comp.svx.UnderlineToolBoxControl</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="XLineColorToolBox" oor:op="replace">
|
||||
<prop oor:name="Command">
|
||||
<value>.uno:XLineColor</value>
|
||||
|
@@ -153,7 +153,6 @@ void ScDLL::Init()
|
||||
SvxClipBoardControl ::RegisterControl(SID_PASTE_UNFORMATTED, pMod );
|
||||
SvxUndoRedoControl ::RegisterControl(SID_UNDO, pMod );
|
||||
SvxUndoRedoControl ::RegisterControl(SID_REDO, pMod );
|
||||
svx::TextUnderlinePopup ::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod );
|
||||
svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
|
||||
sc::ScNumberFormatControl ::RegisterControl(SID_NUMBER_TYPE_FORMAT, pMod );
|
||||
|
||||
|
@@ -215,8 +215,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
|
||||
SvxClipBoardControl::RegisterControl( SID_PASTE, pMod );
|
||||
SvxClipBoardControl::RegisterControl( SID_PASTE_UNFORMATTED, pMod );
|
||||
|
||||
svx::TextUnderlinePopup::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod);
|
||||
|
||||
#if HAVE_FEATURE_AVMEDIA
|
||||
::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
|
||||
#endif
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <sfx2/dispatch.hxx>
|
||||
#include <sfx2/viewfrm.hxx>
|
||||
#include <sfx2/sidebar/Theme.hxx>
|
||||
#include <svx/TextUnderlinePopup.hxx>
|
||||
#include <editeng/editids.hrc>
|
||||
#include <editeng/udlnitem.hxx>
|
||||
#include <vcl/button.hxx>
|
||||
@@ -29,8 +30,8 @@
|
||||
|
||||
namespace svx {
|
||||
|
||||
TextUnderlineControl::TextUnderlineControl(sal_uInt16 nId, vcl::Window* pParent)
|
||||
: SfxPopupWindow(nId, pParent, "TextUnderlineControl", "svx/ui/textunderlinecontrol.ui")
|
||||
TextUnderlineControl::TextUnderlineControl(TextUnderlinePopup* pControl, vcl::Window* pParent)
|
||||
: ToolbarPopup(pControl->getFrameInterface(), pParent, "TextUnderlineControl", "svx/ui/textunderlinecontrol.ui")
|
||||
{
|
||||
get(maNone, "none");
|
||||
get(maSingle, "single");
|
||||
@@ -82,7 +83,7 @@ void TextUnderlineControl::dispose()
|
||||
maWave.clear();
|
||||
maMoreOptions.clear();
|
||||
|
||||
SfxPopupWindow::dispose();
|
||||
ToolbarPopup::dispose();
|
||||
}
|
||||
|
||||
FontLineStyle TextUnderlineControl::getLineStyle(Button const * pButton)
|
||||
|
@@ -23,15 +23,17 @@
|
||||
#include <sfx2/bindings.hxx>
|
||||
#include <vcl/button.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <svtools/toolbarmenu.hxx>
|
||||
#include <svtools/valueset.hxx>
|
||||
#include <sfx2/tbxctrl.hxx>
|
||||
|
||||
namespace svx {
|
||||
|
||||
class TextUnderlineControl : public SfxPopupWindow
|
||||
class TextUnderlinePopup;
|
||||
|
||||
class TextUnderlineControl final : public svtools::ToolbarPopup
|
||||
{
|
||||
public:
|
||||
explicit TextUnderlineControl(sal_uInt16 nId, vcl::Window* pParent);
|
||||
explicit TextUnderlineControl(TextUnderlinePopup* pControl, vcl::Window* pParent);
|
||||
virtual ~TextUnderlineControl() override;
|
||||
virtual void dispose() override;
|
||||
|
||||
|
@@ -23,10 +23,8 @@
|
||||
|
||||
using namespace svx;
|
||||
|
||||
SFX_IMPL_TOOLBOX_CONTROL(TextUnderlinePopup, SvxUnderlineItem);
|
||||
|
||||
TextUnderlinePopup::TextUnderlinePopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
|
||||
: SfxToolBoxControl(nSlotId, nId, rTbx)
|
||||
TextUnderlinePopup::TextUnderlinePopup(const css::uno::Reference<css::uno::XComponentContext>& rContext)
|
||||
: PopupWindowController(rContext, nullptr, OUString())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -34,21 +32,37 @@ TextUnderlinePopup::~TextUnderlinePopup()
|
||||
{
|
||||
}
|
||||
|
||||
void TextUnderlinePopup::initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
|
||||
void TextUnderlinePopup::initialize( const css::uno::Sequence< css::uno::Any >& rArguments )
|
||||
{
|
||||
SfxToolBoxControl::initialize(aArguments);
|
||||
if (GetToolBox().GetItemCommand(GetId()) == m_aCommandURL)
|
||||
GetToolBox().SetItemBits(GetId(), ToolBoxItemBits::DROPDOWN | GetToolBox().GetItemBits(GetId()));
|
||||
PopupWindowController::initialize(rArguments);
|
||||
|
||||
ToolBox* pToolBox = nullptr;
|
||||
sal_uInt16 nId = 0;
|
||||
if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL)
|
||||
pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId));
|
||||
}
|
||||
|
||||
VclPtr<SfxPopupWindow> TextUnderlinePopup::CreatePopupWindow()
|
||||
VclPtr<vcl::Window> TextUnderlinePopup::createPopupWindow(vcl::Window* pParent)
|
||||
{
|
||||
VclPtr<TextUnderlineControl> pControl = VclPtr<TextUnderlineControl>::Create(GetSlotId(), &GetToolBox());
|
||||
pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
|
||||
SetPopupWindow(pControl);
|
||||
|
||||
return pControl;
|
||||
return VclPtr<TextUnderlineControl>::Create(this, pParent);
|
||||
}
|
||||
|
||||
OUString TextUnderlinePopup::getImplementationName()
|
||||
{
|
||||
return "com.sun.star.comp.svx.UnderlineToolBoxControl";
|
||||
}
|
||||
|
||||
css::uno::Sequence<OUString> TextUnderlinePopup::getSupportedServiceNames()
|
||||
{
|
||||
return { "com.sun.star.frame.ToolbarController" };
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
|
||||
com_sun_star_comp_svx_UnderlineToolBoxControl_get_implementation(
|
||||
css::uno::XComponentContext* rContext,
|
||||
css::uno::Sequence<css::uno::Any> const & )
|
||||
{
|
||||
return cppu::acquire(new TextUnderlinePopup(rContext));
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -112,4 +112,8 @@
|
||||
constructor="com_sun_star_comp_svx_CharacterSpacingToolBoxControl_get_implementation">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.svx.UnderlineToolBoxControl"
|
||||
constructor="com_sun_star_comp_svx_UnderlineToolBoxControl_get_implementation">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
@@ -274,7 +274,6 @@ void SwDLL::RegisterControls()
|
||||
SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
|
||||
SvxTbxCtlDraw::RegisterControl(SID_TRACK_CHANGES_BAR, pMod );
|
||||
SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod );
|
||||
svx::TextUnderlinePopup::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod);
|
||||
svx::ParaAboveSpacingControl::RegisterControl(SID_ATTR_PARA_ABOVESPACE, pMod);
|
||||
svx::ParaBelowSpacingControl::RegisterControl(SID_ATTR_PARA_BELOWSPACE, pMod);
|
||||
svx::ParaLeftSpacingControl::RegisterControl(SID_ATTR_PARA_LEFTSPACE, pMod);
|
||||
|
Reference in New Issue
Block a user