[Libreoffice-commits] core.git: 6 commits - include/svtools include/svx include/vcl officecfg/registry reportdesign/Library_rptui.mk reportdesign/source reportdesign/util sc/source sd/source sd/uiconfig starmath/uiconfig svtools/source svx/source svx/uiconfig svx/util sw/source vcl/source
Maxim Monastirsky
momonasmon at gmail.com
Sun Sep 24 12:54:25 UTC 2017
include/svtools/toolbarmenu.hxx | 5
include/svx/colorbox.hxx | 2
include/svx/colorwindow.hxx | 3
include/svx/tbcontrl.hxx | 23 -
include/vcl/dockwin.hxx | 5
include/vcl/menubtn.hxx | 4
include/vcl/toolbox.hxx | 1
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 84 +++-
reportdesign/Library_rptui.mk | 1
reportdesign/source/ui/dlg/Condition.cxx | 3
reportdesign/source/ui/inc/toolboxcontroller.hxx | 87 ----
reportdesign/source/ui/misc/rptuiservices.cxx | 3
reportdesign/source/ui/misc/toolboxcontroller.cxx | 210 ----------
reportdesign/util/rptui.component | 3
sc/source/ui/app/scdll.cxx | 9
sd/source/ui/app/sddll.cxx | 6
sd/uiconfig/simpress/ui/dockinganimation.ui | 1
starmath/uiconfig/smath/ui/dockingelements.ui | 1
svtools/source/control/toolbarmenu.cxx | 13
svx/source/tbxctrls/tbcontrl.cxx | 158 +++++--
svx/uiconfig/ui/colorwindow.ui | 5
svx/uiconfig/ui/docking3deffects.ui | 1
svx/uiconfig/ui/dockingcolorreplace.ui | 1
svx/uiconfig/ui/dockingfontwork.ui | 1
svx/util/svxcore.component | 4
sw/source/uibase/app/swmodule.cxx | 9
vcl/source/control/menubtn.cxx | 16
vcl/source/window/dockmgr.cxx | 33 +
vcl/source/window/dockwin.cxx | 58 +-
vcl/source/window/toolbox.cxx | 5
30 files changed, 306 insertions(+), 449 deletions(-)
New commits:
commit 10e5729fb07d6b4c66182596bd86734d0ab386b9
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Sep 24 03:11:51 2017 +0300
tdf#106762 Avoid warning when opening and closing the color picker
... from the Drawing toolbar in Impress. The warning was
"DockingWindow has become non-layout because extra children
have been added directly to it.", but this DockingWindow is
actually a ToolBox which set as the parent of the color picker,
although it isn't really a parent in layout terms.
Change-Id: Id1384653ceda938ca0cc300c35467e562984bca1
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 09f912ef3ba6..3ee08e7fea24 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -299,6 +299,7 @@ public:
virtual void Resizing( Size& rSize ) override;
virtual Size GetOptimalSize() const override;
virtual void doDeferredInit(WinBits nBits) override;
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
/// Insert a command (like '.uno:Save').
virtual void InsertItem( const OUString& rCommand,
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 810c589a8333..70d031d4ee69 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1308,6 +1308,11 @@ void ToolBox::doDeferredInit(WinBits nBits)
mbIsDeferredInit = false;
}
+void ToolBox::queue_resize(StateChangedType eReason)
+{
+ Window::queue_resize(eReason);
+}
+
ToolBox::ToolBox( vcl::Window* pParent, WinBits nStyle ) :
DockingWindow( WindowType::TOOLBOX )
{
commit bf9360e6f5e38c9de3b38d9748a84d4d1c5067f9
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Sep 19 14:26:24 2017 +0300
tdf#106762 Keep the previous m_xColorWindow lifecycle
Some logic here seems to depend on it.
Change-Id: I62a2eeba1511a9be77030f726ceaa67e3ca3ace8
diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx
index be6165cdc5aa..7b0f8905249c 100644
--- a/include/svx/colorbox.hxx
+++ b/include/svx/colorbox.hxx
@@ -74,6 +74,8 @@ public:
void SaveValue() { m_aSaveColor = GetSelectEntryColor(); }
bool IsValueChangedFromSaved() const { return m_aSaveColor != GetSelectEntryColor(); }
+
+ DECL_LINK(WindowEventListener, VclWindowEvent&, void);
};
/** A wrapper for SvxColorListBox. */
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 5d8237f07fa0..605568a88a28 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -3351,6 +3351,15 @@ void SvxColorListBox::ShowPreview(const NamedColor &rColor)
SetText(rColor.second);
}
+IMPL_LINK(SvxColorListBox, WindowEventListener, VclWindowEvent&, rWindowEvent, void)
+{
+ if (rWindowEvent.GetId() == VclEventId::WindowEndPopupMode)
+ {
+ m_xColorWindow.disposeAndClear();
+ SetPopover(nullptr);
+ }
+}
+
IMPL_LINK_NOARG(SvxColorListBox, MenuActivateHdl, MenuButton *, void)
{
if (!m_xColorWindow || m_xColorWindow->isDisposed())
@@ -3373,6 +3382,9 @@ void SvxColorListBox::createColorWindow()
xFrame,
this,
m_aColorWrapper);
+
+ m_xColorWindow->AddEventListener(LINK(this, SvxColorListBox, WindowEventListener));
+
SetNoSelection();
if (m_bShowNoneButton)
m_xColorWindow->ShowNoneButton();
commit e867b197540cfc8b75bb1108c8bcd7a0ff65d347
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Sep 17 23:35:55 2017 +0300
tdf#106762 Base SvxColorToolBoxControl on svt::PopupWindowController
This allows us to support tearoff without breaking gtk3/wayland.
SvxColorWindow no longer inherits from FloatingWindow, so several
call sites need also to be changed to use DockingManager.
Change-Id: I5d0bc611bbd2a8b9bfd4335212d0ae7e8fc10593
diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx
index 5f990ef0dcad..88174253548a 100644
--- a/include/svtools/toolbarmenu.hxx
+++ b/include/svtools/toolbarmenu.hxx
@@ -50,6 +50,9 @@ public:
ToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame,
vcl::Window* pParentWindow,
WinBits nBits );
+ ToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame,
+ vcl::Window* pParentWindow,
+ const OString& rID, const OUString& rUIXMLDescription );
virtual ~ToolbarPopup() override;
virtual void dispose() override;
@@ -64,6 +67,8 @@ protected:
virtual void statusChanged(const css::frame::FeatureStateEvent& Event );
private:
+ void init();
+
css::uno::Reference< css::frame::XFrame > mxFrame;
rtl::Reference< svt::FrameStatusListener > mxStatusListener;
};
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
index 3f826fa217e4..a782307df9fa 100644
--- a/include/svx/colorwindow.hxx
+++ b/include/svx/colorwindow.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SVX_SOURCE_TBXCTRLS_COLORWINDOW_HXX
#include <sfx2/tbxctrl.hxx>
+#include <svtools/toolbarmenu.hxx>
#include <svtools/valueset.hxx>
#include <svl/lstner.hxx>
#include <rtl/ustring.hxx>
@@ -48,7 +49,7 @@ typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunct
#define COL_NONE_COLOR TRGB_COLORDATA(0x80, 0xFF, 0xFF, 0xFF)
-class SVX_DLLPUBLIC SvxColorWindow : public SfxPopupWindow
+class SVX_DLLPUBLIC SvxColorWindow : public svtools::ToolbarPopup
{
private:
const sal_uInt16 theSlotId;
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 22fd4e72910f..b9b8eb0db7b1 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -205,25 +205,34 @@ friend class SfxStyleControllerItem_Impl;
typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction;
-class SVX_DLLPUBLIC SvxColorToolBoxControl : public cppu::ImplInheritanceHelper< SfxToolBoxControl,
+class SVX_DLLPUBLIC SvxColorToolBoxControl : public cppu::ImplInheritanceHelper< svt::PopupWindowController,
css::frame::XSubToolbarController >
{
std::unique_ptr<svx::ToolboxButtonColorUpdater> m_xBtnUpdater;
std::unique_ptr<PaletteManager> m_xPaletteManager;
BorderColorStatus m_aBorderColorStatus;
bool m_bSplitButton;
+ sal_uInt16 m_nSlotId;
ColorSelectFunction m_aColorSelectFunction;
DECL_LINK(SelectedHdl, const NamedColor&, void);
public:
- SFX_DECL_TOOLBOX_CONTROL();
- SvxColorToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
+ explicit SvxColorToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
virtual ~SvxColorToolBoxControl() override;
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) override;
+
+ // XUpdatable
+ virtual void SAL_CALL update() override;
+
// XStatusListener
virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
- virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
- virtual void Select(sal_uInt16 nSelectModifier) override;
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 nSelectModifier ) override;
+
+ using svt::ToolboxController::createPopupWindow;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
// XSubToolbarController
virtual sal_Bool SAL_CALL opensSubToolbar() override;
@@ -231,6 +240,10 @@ public:
virtual void SAL_CALL functionSelected( const OUString& rCommand ) override;
virtual void SAL_CALL updateImage() override;
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
void setColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
void EnsurePaletteManager();
};
diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index da725103c1c7..dfbb39962139 100644
--- a/include/vcl/menubtn.hxx
+++ b/include/vcl/menubtn.hxx
@@ -36,7 +36,7 @@ private:
Timer* mpMenuTimer;
VclPtr<PopupMenu> mpMenu;
- VclPtr<FloatingWindow> mpFloatingWindow;
+ VclPtr<Window> mpFloatingWindow;
sal_uInt16 mnCurItemId;
bool mbDelayMenu;
Link<MenuButton*,void> maActivateHdl;
@@ -75,7 +75,7 @@ public:
void SetPopupMenu(PopupMenu* pNewMenu);
PopupMenu* GetPopupMenu() const { return mpMenu; }
- void SetPopover(FloatingWindow* pFloatingWindow);
+ void SetPopover(Window* pWindow);
sal_uInt16 GetCurItemId() const { return mnCurItemId; }
OString GetCurItemIdent() const;
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 64fbbf30f4fc..103d14d1f672 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -1221,37 +1221,103 @@
<value>com.sun.star.comp.svx.CurrencyToolBoxControl</value>
</prop>
</node>
- <node oor:name="c4" oor:op="replace" install:module="reportbuilder">
+ <node oor:name="FontColorToolBox" oor:op="replace">
<prop oor:name="Command">
<value>.uno:FontColor</value>
</prop>
<prop oor:name="Module">
- <value>com.sun.star.report.ReportDefinition</value>
+ <value/>
</prop>
<prop oor:name="Controller">
- <value>com.sun.star.report.ReportToolboxController</value>
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
</prop>
</node>
- <node oor:name="c5" oor:op="replace" install:module="reportbuilder">
+ <node oor:name="BackgroundColorToolBox" oor:op="replace">
<prop oor:name="Command">
<value>.uno:BackgroundColor</value>
</prop>
<prop oor:name="Module">
- <value>com.sun.star.report.ReportDefinition</value>
+ <value/>
</prop>
<prop oor:name="Controller">
- <value>com.sun.star.report.ReportToolboxController</value>
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
</prop>
</node>
- <node oor:name="c6" oor:op="replace" install:module="reportbuilder">
+ <node oor:name="ColorToolBox" oor:op="replace">
<prop oor:name="Command">
<value>.uno:Color</value>
</prop>
<prop oor:name="Module">
- <value>com.sun.star.report.ReportDefinition</value>
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
+ </prop>
+ </node>
+ <node oor:name="BackColorToolBox" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:BackColor</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
+ </prop>
+ </node>
+ <node oor:name="CharBackColorToolBox" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:CharBackColor</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
+ </prop>
+ </node>
+ <node oor:name="Extrusion3DColorToolBox" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:Extrusion3DColor</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
+ </prop>
+ </node>
+ <node oor:name="XLineColorToolBox" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:XLineColor</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
+ </prop>
+ </node>
+ <node oor:name="FillColorToolBox" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:FillColor</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
+ </prop>
+ </node>
+ <node oor:name="FrameLineColorToolBox" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:FrameLineColor</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
</prop>
<prop oor:name="Controller">
- <value>com.sun.star.report.ReportToolboxController</value>
+ <value>com.sun.star.comp.svx.ColorToolBoxControl</value>
</prop>
</node>
<node oor:name="FontNameToolBox" oor:op="replace">
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index 8c9b93a2892c..3ac335ebdf1b 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -238,7 +238,8 @@ IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void)
pToolBox,
m_aColorWrapper);
- m_pColorFloat->StartPopupMode(pToolBox, FloatWinPopupFlags::GrabFocus);
+ m_pColorFloat->EnableDocking();
+ vcl::Window::GetDockingManager()->StartPopupMode(pToolBox, m_pColorFloat, FloatWinPopupFlags::GrabFocus);
}
IMPL_LINK_NOARG( Condition, OnFormatAction, ToolBox*, void )
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index f857c6593888..6d557f7a2d0b 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -157,13 +157,7 @@ void ScDLL::Init()
SvxFillToolBoxControl ::RegisterControl(0, pMod);
SvxLineStyleToolBoxControl ::RegisterControl(0, pMod);
SvxLineWidthToolBoxControl ::RegisterControl(0, pMod);
- SvxColorToolBoxControl ::RegisterControl(SID_ATTR_LINE_COLOR, pMod);
- SvxColorToolBoxControl ::RegisterControl(SID_ATTR_FILL_COLOR, pMod);
SvxStyleToolBoxControl ::RegisterControl(SID_STYLE_APPLY, pMod);
- SvxColorToolBoxControl ::RegisterControl(SID_ATTR_CHAR_COLOR, pMod);
- SvxColorToolBoxControl ::RegisterControl(SID_BACKGROUND_COLOR, pMod);
- SvxColorToolBoxControl ::RegisterControl(SID_ATTR_CHAR_BACK_COLOR, pMod);
- SvxColorToolBoxControl ::RegisterControl(SID_FRAME_LINECOLOR, pMod);
SvxClipBoardControl ::RegisterControl(SID_PASTE, pMod );
SvxUndoRedoControl ::RegisterControl(SID_UNDO, pMod );
SvxUndoRedoControl ::RegisterControl(SID_REDO, pMod );
@@ -208,9 +202,6 @@ void ScDLL::Init()
SvxPosSizeStatusBarControl ::RegisterControl(SID_ATTR_SIZE, pMod);
- // CustomShape extrusion controller
- SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
-
// Child Windows
ScInputWindowWrapper ::RegisterChildWindow(true, pMod, SfxChildWindowFlags::TASK|SfxChildWindowFlags::FORCEDOCK);
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index b487624c151b..4e2c083d27d8 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -181,12 +181,8 @@ void SdDLL::RegisterControllers(SdModule* pMod)
SvxFillToolBoxControl::RegisterControl(0, pMod);
SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
SvxLineWidthToolBoxControl::RegisterControl(0, pMod);
- SvxColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod);
- SvxColorToolBoxControl::RegisterControl(SID_ATTR_FILL_COLOR, pMod);
SvxStyleToolBoxControl::RegisterControl(0, pMod);
- SvxColorToolBoxControl::RegisterControl( SID_ATTR_CHAR_COLOR, pMod );
- SvxColorToolBoxControl::RegisterControl( SID_ATTR_CHAR_BACK_COLOR, pMod );
SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE, pMod );
SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod );
@@ -221,7 +217,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
SvxClipBoardControl::RegisterControl( SID_PASTE, pMod );
SvxClipBoardControl::RegisterControl( SID_PASTE_UNFORMATTED, pMod );
- SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
svx::ParaLineSpacingPopup::RegisterControl(SID_ATTR_PARA_LINESPACE, pMod);
svx::TextCharacterSpacingPopup::RegisterControl(SID_ATTR_CHAR_KERNING, pMod);
svx::TextUnderlinePopup::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod);
@@ -230,7 +225,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod );
SdTemplateControl::RegisterControl( SID_STATUS_LAYOUT, pMod );
SvxTableToolBoxControl::RegisterControl(SID_INSERT_TABLE, pMod );
- SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod );
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 822a85892564..3a77a9f80225 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -1428,6 +1428,19 @@ ToolbarPopup::ToolbarPopup( const css::uno::Reference<css::frame::XFrame>& rFram
: DockingWindow(pParentWindow, nBits)
, mxFrame( rFrame )
{
+ init();
+}
+
+ToolbarPopup::ToolbarPopup( const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParentWindow,
+ const OString& rID, const OUString& rUIXMLDescription )
+ : DockingWindow(pParentWindow, rID, rUIXMLDescription, rFrame)
+ , mxFrame( rFrame )
+{
+ init();
+}
+
+void ToolbarPopup::init()
+{
vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
if ( pWindow )
static_cast<SystemWindow*>(pWindow)->GetTaskPaneList()->AddWindow( this );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index ad4fd0ea3b24..5d8237f07fa0 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -33,7 +33,6 @@
#include <vcl/vclptr.hxx>
#include <svtools/valueset.hxx>
#include <svtools/ctrlbox.hxx>
-#include <svtools/toolbarmenu.hxx>
#include <svl/style.hxx>
#include <svtools/ctrltool.hxx>
#include <svtools/borderhelper.hxx>
@@ -1251,9 +1250,7 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
vcl::Window* pParentWindow,
std::function<void(const OUString&, const NamedColor&)> const & aFunction):
- SfxPopupWindow( nSlotId, pParentWindow,
- "palette_popup_window", "svx/ui/colorwindow.ui",
- rFrame ),
+ ToolbarPopup( rFrame, pParentWindow, "palette_popup_window", "svx/ui/colorwindow.ui" ),
theSlotId( nSlotId ),
maCommand( rCommand ),
mrPaletteManager( rPaletteManager ),
@@ -1374,11 +1371,12 @@ void SvxColorWindow::dispose()
mpButtonNoneColor.clear();
mpButtonPicker.clear();
mpAutomaticSeparator.clear();
- SfxPopupWindow::dispose();
+ ToolbarPopup::dispose();
}
void SvxColorWindow::KeyInput( const KeyEvent& rKEvt )
{
+ mpColorSet->GrabFocus();
mpColorSet->KeyInput(rKEvt);
}
@@ -1510,6 +1508,7 @@ IMPL_LINK_NOARG(SvxColorWindow, OpenPickerClickHdl, Button*, void)
void SvxColorWindow::StartSelection()
{
mpColorSet->StartSelection();
+ mpRecentColorSet->StartSelection();
}
void SvxColorWindow::SetNoSelection()
@@ -2756,28 +2755,77 @@ com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation(
return cppu::acquire( new SvxFontNameToolBoxControl() );
}
-SvxColorToolBoxControl::SvxColorToolBoxControl(
- sal_uInt16 nSlotId,
- sal_uInt16 nId,
- ToolBox& rTbx ):
- ImplInheritanceHelper( nSlotId, nId, rTbx ),
- m_bSplitButton(typeid(rTbx) != typeid(sfx2::sidebar::SidebarToolBox)),
+SvxColorToolBoxControl::SvxColorToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext ) :
+ ImplInheritanceHelper( rContext, nullptr, OUString() ),
+ m_bSplitButton(true),
+ m_nSlotId(0),
m_aColorSelectFunction(PaletteManager::DispatchColorCommand)
{
- switch( nSlotId )
+}
+
+namespace {
+
+sal_uInt16 MapCommandToSlotId(const OUString& rCommand)
+{
+ if (rCommand == ".uno:Color")
+ return SID_ATTR_CHAR_COLOR;
+ else if (rCommand == ".uno:FontColor")
+ return SID_ATTR_CHAR_COLOR2;
+ else if (rCommand == ".uno:BackColor")
+ return SID_ATTR_CHAR_COLOR_BACKGROUND;
+ else if (rCommand == ".uno:CharBackColor")
+ return SID_ATTR_CHAR_BACK_COLOR;
+ else if (rCommand == ".uno:BackgroundColor")
+ return SID_BACKGROUND_COLOR;
+ else if (rCommand == ".uno:Extrusion3DColor")
+ return SID_EXTRUSION_3D_COLOR;
+ else if (rCommand == ".uno:XLineColor")
+ return SID_ATTR_LINE_COLOR;
+ else if (rCommand == ".uno:FillColor")
+ return SID_ATTR_FILL_COLOR;
+ else if (rCommand == ".uno:FrameLineColor")
+ return SID_FRAME_LINECOLOR;
+
+ SAL_WARN("svx.tbxcrtls", "Unknown color command: " << rCommand);
+ return 0;
+}
+
+}
+
+void SvxColorToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any>& rArguments )
+{
+ PopupWindowController::initialize( rArguments );
+
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( !getToolboxId( nId, &pToolBox ) )
+ {
+ SAL_WARN("svx.tbxcrtls", "ToolBox not found!");
+ return;
+ }
+
+ m_nSlotId = MapCommandToSlotId( m_aCommandURL );
+ if ( m_nSlotId == SID_ATTR_LINE_COLOR || m_nSlotId == SID_ATTR_FILL_COLOR ||
+ m_nSlotId == SID_FRAME_LINECOLOR || m_nSlotId == SID_BACKGROUND_COLOR )
+ // Sidebar uses wide buttons for those.
+ m_bSplitButton = typeid( *pToolBox ) != typeid( sfx2::sidebar::SidebarToolBox );
+
+ m_xBtnUpdater.reset( new svx::ToolboxButtonColorUpdater( m_nSlotId, nId, pToolBox ) );
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( m_bSplitButton ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) );
+}
+
+void SvxColorToolBoxControl::update()
+{
+ PopupWindowController::update();
+
+ switch( m_nSlotId )
{
case SID_ATTR_CHAR_COLOR2:
addStatusListener( ".uno:CharColorExt");
- SAL_FALLTHROUGH;
-
- case SID_ATTR_CHAR_COLOR:
- case SID_ATTR_CHAR_BACK_COLOR:
- m_bSplitButton = true;
break;
case SID_ATTR_CHAR_COLOR_BACKGROUND:
addStatusListener( ".uno:CharBackgroundExt");
- m_bSplitButton = true;
break;
case SID_FRAME_LINECOLOR:
@@ -2785,9 +2833,6 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
addStatusListener( ".uno:BorderBLTR");
break;
}
-
- rTbx.SetItemBits( nId, rTbx.GetItemBits( nId ) | ( m_bSplitButton ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) );
- m_xBtnUpdater.reset( new svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ) );
}
void SvxColorToolBoxControl::EnsurePaletteManager()
@@ -2811,7 +2856,7 @@ void SvxColorToolBoxControl::setColorSelectFunction(const ColorSelectFunction& a
m_xPaletteManager->SetColorSelectFunction(aColorSelectFunction);
}
-VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow()
+VclPtr<vcl::Window> SvxColorToolBoxControl::createPopupWindow( vcl::Window* pParent )
{
EnsurePaletteManager();
@@ -2819,16 +2864,14 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow()
m_aCommandURL,
*m_xPaletteManager,
m_aBorderColorStatus,
- GetSlotId(),
+ m_nSlotId,
m_xFrame,
- &GetToolBox(),
+ pParent,
m_aColorSelectFunction);
OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( m_aCommandURL, m_sModuleName );
pColorWin->SetText( aWindowTitle );
- pColorWin->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
pColorWin->StartSelection();
- SetPopupWindow(pColorWin);
if ( m_bSplitButton )
pColorWin->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) );
return pColorWin;
@@ -2843,8 +2886,13 @@ IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const NamedColor&, rColor, void)
void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent& rEvent )
{
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( !getToolboxId( nId, &pToolBox ) )
+ return;
+
if ( rEvent.FeatureURL.Complete == m_aCommandURL )
- GetToolBox().EnableItem( GetId(), rEvent.IsEnabled );
+ pToolBox->EnableItem( nId, rEvent.IsEnabled );
bool bValue;
if ( !m_bSplitButton )
@@ -2866,23 +2914,21 @@ void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent&
m_xPaletteManager->SetLastColor(aColor);
}
else if ( rEvent.State >>= bValue )
- GetToolBox().CheckItem( GetId(), bValue );
+ pToolBox->CheckItem( nId, bValue );
}
-void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
+void SvxColorToolBoxControl::execute(sal_Int16 /*nSelectModifier*/)
{
if ( !m_bSplitButton )
{
// Open the popup also when Enter key is pressed.
- css::uno::Reference< css::awt::XWindow > xWin = createPopupWindow();
- if ( xWin.is() )
- xWin->setFocus();
+ createPopupWindow();
return;
}
OUString aCommand = m_aCommandURL;
- switch( GetSlotId() )
+ switch( m_nSlotId )
{
case SID_ATTR_CHAR_COLOR2 :
aCommand = ".uno:CharColorExt";
@@ -2899,7 +2945,7 @@ void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
auto aArgs( comphelper::InitPropertySequence( {
{ m_aCommandURL.copy(5), css::uno::makeAny( m_xPaletteManager->GetLastColor().GetColor() ) }
} ) );
- Dispatch( aCommand, aArgs );
+ dispatchCommand( aCommand, aArgs );
OUString sColorName = ("#" + aColor.AsRGBHexString().toAsciiUpperCase());
m_xPaletteManager->AddRecentColor(aColor, sColorName);
@@ -2915,10 +2961,15 @@ sal_Bool SvxColorToolBoxControl::opensSubToolbar()
void SvxColorToolBoxControl::updateImage()
{
- Image aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aCommandURL, m_xFrame, GetToolBox().GetImageSize());
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( !getToolboxId( nId, &pToolBox ) )
+ return;
+
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aCommandURL, m_xFrame, pToolBox->GetImageSize());
if ( !!aImage )
{
- GetToolBox().SetItemImage( GetId(), aImage );
+ pToolBox->SetItemImage( nId, aImage );
EnsurePaletteManager();
m_xBtnUpdater->Update(m_xPaletteManager->GetLastColor(), true);
}
@@ -2933,21 +2984,22 @@ void SvxColorToolBoxControl::functionSelected( const OUString& /*rCommand*/ )
{
}
-SfxToolBoxControl* SvxColorToolBoxControl::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx )
+OUString SvxColorToolBoxControl::getImplementationName()
{
- return new SvxColorToolBoxControl( nSlotId, nId, rTbx );
+ return OUString( "com.sun.star.comp.svx.ColorToolBoxControl" );
}
-void SvxColorToolBoxControl::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod)
+css::uno::Sequence<OUString> SvxColorToolBoxControl::getSupportedServiceNames()
{
- if ( nSlotId == SID_ATTR_LINE_COLOR )
- SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, typeid(XLineColorItem), nSlotId ) );
- else if ( nSlotId == SID_ATTR_FILL_COLOR )
- SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, typeid(XFillColorItem), nSlotId ) );
- else if ( nSlotId == SID_ATTR_CHAR_BACK_COLOR )
- SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, typeid(SvxBackgroundColorItem), nSlotId ) );
- else
- SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, typeid(SvxColorItem), nSlotId ) );
+ return { "com.sun.star.frame.ToolbarController" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_svx_ColorToolBoxControl_get_implementation(
+ css::uno::XComponentContext* rContext,
+ css::uno::Sequence<css::uno::Any> const & )
+{
+ return cppu::acquire( new SvxColorToolBoxControl( rContext ) );
}
// class SvxFrameToolBoxControl --------------------------------------------
diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui
index 14a9635f5430..1d983505567b 100644
--- a/svx/uiconfig/ui/colorwindow.ui
+++ b/svx/uiconfig/ui/colorwindow.ui
@@ -27,10 +27,7 @@
<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>
+ <property name="type_hint">dock</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
diff --git a/svx/util/svxcore.component b/svx/util/svxcore.component
index 490e39c9e56b..aa1cac6fcae4 100644
--- a/svx/util/svxcore.component
+++ b/svx/util/svxcore.component
@@ -44,6 +44,10 @@
constructor="com_sun_star_comp_svx_FrameToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
+ <implementation name="com.sun.star.comp.svx.ColorToolBoxControl"
+ constructor="com_sun_star_comp_svx_ColorToolBoxControl_get_implementation">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
<implementation name="com.sun.star.comp.svx.CurrencyToolBoxControl"
constructor="com_sun_star_comp_svx_CurrencyToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 72af465176a9..47567ec52256 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -305,7 +305,6 @@ void SwDLL::RegisterControls()
PageOrientationPopup::RegisterControl(SID_ATTR_PAGE_ORIENTATION, pMod);
PageColumnPopup::RegisterControl(SID_ATTR_PAGE_COLUMN, pMod);
PageSizePopup::RegisterControl(SID_ATTR_PAGE_SIZE, pMod);
- SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
SvxClipBoardControl::RegisterControl(SID_PASTE, pMod );
SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod );
@@ -315,16 +314,8 @@ void SwDLL::RegisterControls()
SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod );
SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
- SvxColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
- SvxColorToolBoxControl::RegisterControl(SID_ATTR_FILL_COLOR, pMod);
- SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_BACK_COLOR, pMod);
- SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR, pMod );
- SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2, pMod );
- SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod );
SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod );
- SvxColorToolBoxControl::RegisterControl( SID_BACKGROUND_COLOR, pMod );
- SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT, pMod );
SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME, pMod );
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index 92a3b96719e0..5771f24ab289 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -18,6 +18,7 @@
*/
#include <vcl/decoview.hxx>
+#include <vcl/dockwin.hxx>
#include <vcl/event.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/menu.hxx>
@@ -55,7 +56,14 @@ void MenuButton::ExecuteMenu()
{
Point aPos(GetParent()->OutputToScreenPixel(GetPosPixel()));
tools::Rectangle aRect(aPos, aSize );
- mpFloatingWindow->StartPopupMode(aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus);
+ FloatWinPopupFlags nFlags = FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus;
+ if (mpFloatingWindow->GetType() == WindowType::FLOATINGWINDOW)
+ static_cast<FloatingWindow*>(mpFloatingWindow.get())->StartPopupMode(aRect, nFlags);
+ else
+ {
+ mpFloatingWindow->EnableDocking();
+ vcl::Window::GetDockingManager()->StartPopupMode(mpFloatingWindow, aRect, nFlags);
+ }
}
SetPressed(false);
if (mnCurItemId)
@@ -170,12 +178,12 @@ void MenuButton::SetPopupMenu(PopupMenu* pNewMenu)
mpMenu = pNewMenu;
}
-void MenuButton::SetPopover(FloatingWindow* pFloatingWindow)
+void MenuButton::SetPopover(Window* pWindow)
{
- if (pFloatingWindow == mpFloatingWindow)
+ if (pWindow == mpFloatingWindow)
return;
- mpFloatingWindow = pFloatingWindow;
+ mpFloatingWindow = pWindow;
}
//class MenuToggleButton ----------------------------------------------------
commit 8bd418a6b8253a9d725981743a0375e2c8bb911e
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Sep 17 15:45:11 2017 +0300
rptui::OToolboxController becomes unused, tdf#106762 related
It was a wrapper around the color controller, because the latter
used sfx2 registration. This will no longer be an issue, as we're
moving to officecfg based registration.
Change-Id: I45e1d8aeefdb62f5bd9b3dfac29910c77f0cd103
diff --git a/reportdesign/Library_rptui.mk b/reportdesign/Library_rptui.mk
index f4e24c0e2f53..eef0ce6a36e6 100644
--- a/reportdesign/Library_rptui.mk
+++ b/reportdesign/Library_rptui.mk
@@ -71,7 +71,6 @@ $(eval $(call gb_Library_add_exception_objects,rptui,\
reportdesign/source/ui/misc/rptuiservices \
reportdesign/source/ui/misc/RptUndo \
reportdesign/source/ui/misc/statusbarcontroller \
- reportdesign/source/ui/misc/toolboxcontroller \
reportdesign/source/ui/misc/UITools \
reportdesign/source/ui/report/DesignView \
reportdesign/source/ui/report/dlgedclip \
diff --git a/reportdesign/source/ui/inc/toolboxcontroller.hxx b/reportdesign/source/ui/inc/toolboxcontroller.hxx
deleted file mode 100644
index 83291253e5bc..000000000000
--- a/reportdesign/source/ui/inc/toolboxcontroller.hxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_TOOLBOXCONTROLLER_HXX
-#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_TOOLBOXCONTROLLER_HXX
-
-#include <sal/config.h>
-
-#include <map>
-
-#include <rtl/ref.hxx>
-#include <svtools/toolboxcontroller.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/frame/XSubToolbarController.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-class SvxColorToolBoxControl;
-namespace rptui
-{
- typedef ::cppu::ImplHelper2 < css::lang::XServiceInfo,
- css::frame::XSubToolbarController> TToolboxController_BASE;
- typedef rtl::Reference<SvxColorToolBoxControl> TToolbarHelper;
-
- class OToolboxController : public ::svt::ToolboxController
- ,public TToolboxController_BASE
- {
- typedef std::map<OUString, sal_Bool> TCommandState;
- TCommandState m_aStates;
- TToolbarHelper m_pToolbarController;
- OToolboxController(const OToolboxController&) = delete;
- void operator =(const OToolboxController&) = delete;
- public:
- OToolboxController(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
- virtual ~OToolboxController() override;
-
- // XInterface
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
- virtual void SAL_CALL acquire() throw () override;
- virtual void SAL_CALL release() throw () override;
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName() override;
- virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
- // need by registration
- /// @throws css::uno::RuntimeException
- static OUString getImplementationName_Static();
- /// @throws css::uno::RuntimeException
- static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
- static css::uno::Reference< css::uno::XInterface > SAL_CALL
- create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
-
- // XInitialization
- virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
- // XStatusListener
- virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
- // XToolbarController
- virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override;
- virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override;
-
- // XSubToolbarController
- virtual sal_Bool SAL_CALL opensSubToolbar( ) override;
- virtual OUString SAL_CALL getSubToolbarName( ) override;
- virtual void SAL_CALL functionSelected( const OUString& aCommand ) override;
- virtual void SAL_CALL updateImage( ) override;
- };
-
-} // rptui
-
-#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_TOOLBOXCONTROLLER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/ui/misc/rptuiservices.cxx b/reportdesign/source/ui/misc/rptuiservices.cxx
index 2424445129c0..3f949d713f03 100644
--- a/reportdesign/source/ui/misc/rptuiservices.cxx
+++ b/reportdesign/source/ui/misc/rptuiservices.cxx
@@ -19,7 +19,6 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
#include "ReportController.hxx"
-#include "toolboxcontroller.hxx"
#include "statusbarcontroller.hxx"
#include "DefaultInspection.hxx"
#include "ReportComponentHandler.hxx"
@@ -41,8 +40,6 @@ namespace
cppu::ImplementationEntry entries[] = {
{ &OReportController::create, &OReportController::getImplementationName_Static, &OReportController::getSupportedServiceNames_Static,
&cppu::createSingleComponentFactory, nullptr, 0 },
- { &OToolboxController::create, &OToolboxController::getImplementationName_Static, &OToolboxController::getSupportedServiceNames_Static,
- &cppu::createSingleComponentFactory, nullptr, 0 },
{ &OStatusbarController::create, &OStatusbarController::getImplementationName_Static, &OStatusbarController::getSupportedServiceNames_Static,
&cppu::createSingleComponentFactory, nullptr, 0 },
{ &DefaultComponentInspectorModel::create, &DefaultComponentInspectorModel::getImplementationName_Static, &DefaultComponentInspectorModel::getSupportedServiceNames_static,
diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx
deleted file mode 100644
index 1622f53b895b..000000000000
--- a/reportdesign/source/ui/misc/toolboxcontroller.cxx
+++ /dev/null
@@ -1,210 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#include "toolboxcontroller.hxx"
-#include <com/sun/star/ui/ImageType.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <vcl/menu.hxx>
-#include <com/sun/star/ui/XUIConfigurationManager.hpp>
-#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-#include <com/sun/star/ui/XImageManager.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/util/Color.hpp>
-#include <vcl/svapp.hxx>
-#include <vcl/toolbox.hxx>
-#include <svtools/miscopt.hxx>
-#include <unotools/moduleoptions.hxx>
-#include <svtools/menuoptions.hxx>
-#include <osl/mutex.hxx>
-#include <svx/svxids.hrc>
-#include <svx/tbcontrl.hxx>
-
-#include <cppuhelper/supportsservice.hxx>
-
-namespace rptui
-{
- using namespace svt;
- using namespace com::sun::star;
- using namespace com::sun::star::uno;
- using namespace com::sun::star::beans;
- using namespace com::sun::star::lang;
- using namespace frame;
- using namespace util;
- using namespace ui;
-
-OUString SAL_CALL OToolboxController::getImplementationName()
-{
- return getImplementationName_Static();
-}
-
-
-OUString OToolboxController::getImplementationName_Static()
-{
- return OUString("com.sun.star.report.comp.ReportToolboxController");
-}
-
-Sequence< OUString> OToolboxController::getSupportedServiceNames_Static()
-{
- Sequence<OUString> aSupported { "com.sun.star.report.ReportToolboxController" };
- return aSupported;
-}
-
-sal_Bool SAL_CALL OToolboxController::supportsService( const OUString& ServiceName )
-{
- return cppu::supportsService(this, ServiceName);
-}
-
-Sequence< OUString> SAL_CALL OToolboxController::getSupportedServiceNames()
-{
- return getSupportedServiceNames_Static();
-}
-
-Reference< XInterface > OToolboxController::create(Reference< XComponentContext > const & xContext)
-{
- return * new OToolboxController(xContext);
-}
-
-OToolboxController::OToolboxController(const Reference< XComponentContext >& _rxORB)
- : m_pToolbarController(nullptr)
-{
- osl_atomic_increment(&m_refCount);
- m_xContext = _rxORB;
- osl_atomic_decrement(&m_refCount);
-
-}
-
-OToolboxController::~OToolboxController()
-{
-}
-
-// XInterface
-Any SAL_CALL OToolboxController::queryInterface( const Type& _rType )
-{
- Any aReturn = ToolboxController::queryInterface(_rType);
- if (!aReturn.hasValue())
- aReturn = TToolboxController_BASE::queryInterface(_rType);
- return aReturn;
-}
-
-void SAL_CALL OToolboxController::acquire() throw ()
-{
- ToolboxController::acquire();
-}
-
-void SAL_CALL OToolboxController::release() throw ()
-{
- ToolboxController::release();
-}
-
-void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments )
-{
- ToolboxController::initialize(_rArguments);
- SolarMutexGuard aSolarMutexGuard;
- ::osl::MutexGuard aGuard(m_aMutex);
- sal_uInt16 nToolBoxId = 1;
-
- VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get());
- if ( pToolBox )
- {
- const ToolBox::ImplToolItems::size_type nCount = pToolBox->GetItemCount();
- for (ToolBox::ImplToolItems::size_type nPos = 0; nPos < nCount; ++nPos)
- {
- const sal_uInt16 nItemId = pToolBox->GetItemId(nPos);
- if ( pToolBox->GetItemCommand(nItemId) == m_aCommandURL )
- {
- nToolBoxId = nItemId;
- break;
- }
- }
- if ( m_aCommandURL == ".uno:FontColor" || m_aCommandURL == ".uno:Color" )
- {
- m_aStates.emplace(OUString(".uno:FontColor"),true);
- m_aStates.emplace(OUString(".uno:Color"),true);
- m_pToolbarController = new SvxColorToolBoxControl(SID_ATTR_CHAR_COLOR2,nToolBoxId,*pToolBox);
- }
- else
- {
- m_aStates.emplace(OUString(".uno:BackgroundColor"),true);
- m_pToolbarController = new SvxColorToolBoxControl(SID_BACKGROUND_COLOR,nToolBoxId,*pToolBox);
- }
-
- TCommandState::const_iterator aIter = m_aStates.begin();
- for (; aIter != m_aStates.end(); ++aIter)
- addStatusListener(aIter->first);
-
- if ( m_pToolbarController.is() )
- m_pToolbarController->initialize(_rArguments);
- // check if paste special is allowed, when not don't add DROPDOWN
- pToolBox->SetItemBits(nToolBoxId,pToolBox->GetItemBits(nToolBoxId) | ToolBoxItemBits::DROPDOWN);
- }
-}
-
-void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event )
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- TCommandState::iterator aFind = m_aStates.find( Event.FeatureURL.Complete );
- if ( aFind != m_aStates.end() && m_pToolbarController.is() )
- m_pToolbarController->statusChanged( Event );
-}
-
-Reference< awt::XWindow > SAL_CALL OToolboxController::createPopupWindow()
-{
- // execute the menu
- SolarMutexGuard aSolarMutexGuard;
- ::osl::MutexGuard aGuard(m_aMutex);
-
- Reference< awt::XWindow > xRet;
- if ( m_pToolbarController.is() )
- xRet = m_pToolbarController->createPopupWindow();
-
- return xRet;
-}
-
-void SAL_CALL OToolboxController::execute( sal_Int16 KeyModifier )
-{
- if ( m_pToolbarController.is() )
- m_pToolbarController->execute( KeyModifier );
-}
-
-sal_Bool SAL_CALL OToolboxController::opensSubToolbar()
-{
- return true;
-}
-
-OUString SAL_CALL OToolboxController::getSubToolbarName()
-{
- return OUString();
-}
-
-void SAL_CALL OToolboxController::functionSelected( const OUString& /*rCommand*/ )
-{
-}
-
-void SAL_CALL OToolboxController::updateImage( )
-{
- SolarMutexGuard aSolarMutexGuard;
- ::osl::MutexGuard aGuard(m_aMutex);
- if ( m_pToolbarController.is() )
- m_pToolbarController->updateImage();
-}
-
-} // rptui
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/util/rptui.component b/reportdesign/util/rptui.component
index bb2058b50d22..bb7d4a5dd842 100644
--- a/reportdesign/util/rptui.component
+++ b/reportdesign/util/rptui.component
@@ -34,9 +34,6 @@
<implementation name="com.sun.star.report.comp.ReportDesign">
<service name="com.sun.star.sdb.ReportDesign"/>
</implementation>
- <implementation name="com.sun.star.report.comp.ReportToolboxController">
- <service name="com.sun.star.report.ReportToolboxController"/>
- </implementation>
<implementation name="com.sun.star.report.comp.StatusbarController">
<service name="com.sun.star.frame.StatusbarController"/>
</implementation>
commit 8f1e01fc89ca5d5f03d172f038e2310ba2ac5580
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Sep 18 09:57:39 2017 +0300
Support non-ToolBox popup case in DockingManager, tdf#106762 prep
Change-Id: I54d4de28336b70dbd07923377e6cceb67079fa80
diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx
index 723aef49d4a6..00e8f58d87fa 100644
--- a/include/vcl/dockwin.hxx
+++ b/include/vcl/dockwin.hxx
@@ -111,6 +111,7 @@ private:
DECL_LINK( PopupModeEnd, FloatingWindow*, void );
void ImplEnableStartDocking() { mbStartDockingEnabled = true; }
bool ImplStartDockingEnabled() { return mbStartDockingEnabled; }
+ void ImplPreparePopupMode( FloatWinPopupFlags nFlags );
public:
ImplDockingWindowWrapper( const vcl::Window *pWindow );
@@ -133,6 +134,7 @@ public:
void Unlock();
bool IsLocked() const { return mbLocked;}
+ void StartPopupMode( const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags );
void StartPopupMode( ToolBox* pParentToolBox, FloatWinPopupFlags nPopupModeFlags );
bool IsInPopupMode() const;
@@ -187,6 +189,7 @@ public:
void Unlock( const vcl::Window *pWin );
bool IsLocked( const vcl::Window *pWin );
+ void StartPopupMode( const vcl::Window *pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags );
void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin );
void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin, FloatWinPopupFlags nPopupModeFlags );
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index bc3eb2cc5b42..67569f773ee4 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -332,6 +332,13 @@ void DockingManager::SetFloatingMode( const vcl::Window *pWindow, bool bFloating
pWrapper->SetFloatingMode( bFloating );
}
+void DockingManager::StartPopupMode( const vcl::Window *pWindow, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags )
+{
+ ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
+ if( pWrapper )
+ pWrapper->StartPopupMode( rRect, nFlags );
+}
+
void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWindow, FloatWinPopupFlags nFlags )
{
ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
@@ -915,12 +922,8 @@ void ImplDockingWindowWrapper::ShowTitleButton( TitleButton nButton, bool bVisib
}
}
-void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWinPopupFlags nFlags )
+void ImplDockingWindowWrapper::ImplPreparePopupMode( FloatWinPopupFlags nFlags )
{
- // do nothing if window is floating
- if( IsFloatingMode() )
- return;
-
GetWindow()->Show( false, ShowFlags::NoFocusChange );
// prepare reparenting
@@ -966,6 +969,15 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
// set mpFloatWin not until all window positioning is done !!!
// (SetPosPixel etc. check for valid mpFloatWin pointer)
mpFloatWin = pWin;
+}
+
+void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWinPopupFlags nFlags )
+{
+ // do nothing if window is floating
+ if( IsFloatingMode() )
+ return;
+
+ ImplPreparePopupMode( nFlags );
// if the subtoolbar was opened via keyboard make sure that key events
// will go into subtoolbar
@@ -983,6 +995,17 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
}
}
+void ImplDockingWindowWrapper::StartPopupMode( const tools::Rectangle& rRect, FloatWinPopupFlags nFlags )
+{
+ // do nothing if window is floating
+ if( IsFloatingMode() )
+ return;
+
+ ImplPreparePopupMode( nFlags );
+ mpFloatWin->StartPopupMode( rRect, nFlags );
+ GetWindow()->Show();
+}
+
IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd, FloatingWindow*, void)
{
GetWindow()->Show( false, ShowFlags::NoFocusChange );
commit ad769c30d2a709786a769f75fa5e04b33edf0809
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Sep 17 15:38:06 2017 +0300
Adjust DockingWindow layout calculation, tdf#106762 prep
This is needed for the color widget to have the correct size at
initial show, and to keep this size after selecting a different
palette.
The parent FloatingWindow will assume that the border width stays
outside the space that was allocated to the DockingWindow (see
VclContainer::setLayoutPosSize), and yet DockingWindow tries to
handle the border width as part of its allocated space. One option
could be to let FloatingWindow handle this alone, but this won't
work for other possible parents. The current solution is to load
and store the border width in a way that can be used internally,
but not visible to the outside world via get_border_width().
Change-Id: Id51152cf64eef719368e29253eb93e99834489cd
diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx
index 92637db78771..723aef49d4a6 100644
--- a/include/vcl/dockwin.hxx
+++ b/include/vcl/dockwin.hxx
@@ -244,7 +244,7 @@ protected:
private:
SAL_DLLPRIVATE void ImplInitDockingWindowData();
- SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
+ SAL_DLLPRIVATE void setPosSizeOnContainee();
DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void );
DockingWindow (const DockingWindow &) = delete;
diff --git a/sd/uiconfig/simpress/ui/dockinganimation.ui b/sd/uiconfig/simpress/ui/dockinganimation.ui
index 9fc5a1fea4c9..3c44f27cf176 100644
--- a/sd/uiconfig/simpress/ui/dockinganimation.ui
+++ b/sd/uiconfig/simpress/ui/dockinganimation.ui
@@ -55,7 +55,6 @@
<property name="stock">gtk-goto-last</property>
</object>
<object class="GtkWindow" id="DockingAnimation">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/starmath/uiconfig/smath/ui/dockingelements.ui b/starmath/uiconfig/smath/ui/dockingelements.ui
index 652ae360d439..01ef235c60a6 100644
--- a/starmath/uiconfig/smath/ui/dockingelements.ui
+++ b/starmath/uiconfig/smath/ui/dockingelements.ui
@@ -3,7 +3,6 @@
<interface domain="sm">
<requires lib="gtk+" version="3.0"/>
<object class="GtkWindow" id="DockingElements">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/svx/uiconfig/ui/docking3deffects.ui b/svx/uiconfig/ui/docking3deffects.ui
index f491b35ed0d7..2e0e47ecc465 100644
--- a/svx/uiconfig/ui/docking3deffects.ui
+++ b/svx/uiconfig/ui/docking3deffects.ui
@@ -256,7 +256,6 @@
<property name="pixbuf">svx/res/normflat.png</property>
</object>
<object class="GtkWindow" id="Docking3DEffects">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/svx/uiconfig/ui/dockingcolorreplace.ui b/svx/uiconfig/ui/dockingcolorreplace.ui
index 77a44d403feb..1d7454ed3465 100644
--- a/svx/uiconfig/ui/dockingcolorreplace.ui
+++ b/svx/uiconfig/ui/dockingcolorreplace.ui
@@ -10,7 +10,6 @@
<property name="page_increment">10</property>
</object>
<object class="GtkWindow" id="DockingColorReplace">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/svx/uiconfig/ui/dockingfontwork.ui b/svx/uiconfig/ui/dockingfontwork.ui
index b1abc2dea0fb..b17936df2e43 100644
--- a/svx/uiconfig/ui/dockingfontwork.ui
+++ b/svx/uiconfig/ui/dockingfontwork.ui
@@ -10,7 +10,6 @@
<property name="page_increment">1</property>
</object>
<object class="GtkWindow" id="DockingFontwork">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index e50bcf08f76b..64a6aa4673c1 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -707,9 +707,12 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
if ( bFloatMode )
{
- Show( false, ShowFlags::NoFocusChange );
+ // set deferred properties early, so border width will end up
+ // in our mpWindowImpl->mnBorderWidth, not in mpBorderWindow.
+ // (see its usage in setPosSizeOnContainee and GetOptimalSize.)
+ setDeferredProperties();
- sal_Int32 nBorderWidth = get_border_width();
+ Show( false, ShowFlags::NoFocusChange );
maDockPos = Window::GetPosPixel();
@@ -757,19 +760,13 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
ToggleFloatingMode();
- set_border_width(nBorderWidth);
-
if ( bVisible )
Show();
-
- mpFloatWin->queue_resize();
}
else
{
Show( false, ShowFlags::NoFocusChange );
- sal_Int32 nBorderWidth = get_border_width();
-
// store FloatingData in FloatingWindow
maFloatPos = mpFloatWin->GetPosPixel();
mbDockBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Docking );
@@ -795,8 +792,6 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
ToggleFloatingMode();
- set_border_width(nBorderWidth);
-
if ( bVisible )
Show();
}
@@ -844,19 +839,7 @@ void DockingWindow::setPosSizePixel( long nX, long nY,
}
if (::isLayoutEnabled(this))
- {
- Size aSize(GetSizePixel());
-
- sal_Int32 nBorderWidth = get_border_width();
-
- aSize.Width() -= 2 * nBorderWidth;
- aSize.Height() -= 2 * nBorderWidth;
-
- Point aPos(nBorderWidth, nBorderWidth);
- Window *pBox = GetWindow(GetWindowType::FirstChild);
- assert(pBox);
- VclContainer::setLayoutAllocation(*pBox, aPos, aSize);
- }
+ setPosSizeOnContainee();
}
Point DockingWindow::GetPosPixel() const
@@ -998,8 +981,6 @@ void DockingWindow::setOptimalLayoutSize()
maLayoutIdle.Stop();
//resize DockingWindow to fit requisition on initial show
- Window *pBox = GetWindow(GetWindowType::FirstChild);
-
Size aSize = get_preferred_size();
Size aMax(bestmaxFrameSizeForScreenSize(GetDesktopRectPixel().GetSize()));
@@ -1008,19 +989,23 @@ void DockingWindow::setOptimalLayoutSize()
aSize.Height() = std::min(aMax.Height(), aSize.Height());
SetMinOutputSizePixel(aSize);
- SetSizePixel(aSize);
- setPosSizeOnContainee(aSize, *pBox);
+ setPosSizeOnContainee();
}
-void DockingWindow::setPosSizeOnContainee(Size aSize, Window &rBox)
+void DockingWindow::setPosSizeOnContainee()
{
- sal_Int32 nBorderWidth = get_border_width();
+ Size aSize = GetOutputSizePixel();
+
+ // Can't use get_border_width() here, because we don't want
+ // the border to be also visible to the floating window.
+ sal_Int32 nBorderWidth = mpWindowImpl->mnBorderWidth;
aSize.Width() -= 2 * nBorderWidth;
aSize.Height() -= 2 * nBorderWidth;
- Point aPos(nBorderWidth, nBorderWidth);
- VclContainer::setLayoutAllocation(rBox, aPos, aSize);
+ Window* pBox = GetWindow(GetWindowType::FirstChild);
+ assert(pBox);
+ VclContainer::setLayoutAllocation(*pBox, Point(nBorderWidth, nBorderWidth), aSize);
}
Size DockingWindow::GetOptimalSize() const
@@ -1030,12 +1015,14 @@ Size DockingWindow::GetOptimalSize() const
Size aSize = VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
- sal_Int32 nBorderWidth = get_border_width();
+ // Can't use get_border_width() here, because we don't want
+ // the border to be also visible to the floating window.
+ sal_Int32 nBorderWidth = mpWindowImpl->mnBorderWidth;
aSize.Height() += 2 * nBorderWidth;
aSize.Width() += 2 * nBorderWidth;
- return Window::CalcWindowSize(aSize);
+ return aSize;
}
void DockingWindow::queue_resize(StateChangedType eReason)
@@ -1064,10 +1051,7 @@ IMPL_LINK_NOARG(DockingWindow, ImplHandleLayoutTimerHdl, Timer*, void)
SAL_WARN("vcl.layout", "DockingWindow has become non-layout because extra children have been added directly to it.");
return;
}
-
- Window *pBox = GetWindow(GetWindowType::FirstChild);
- assert(pBox);
- setPosSizeOnContainee(GetSizePixel(), *pBox);
+ setPosSizeOnContainee();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list