[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - chart2/source cui/source extensions/source include/svtools include/svx sd/source svtools/source svx/source

Caolán McNamara caolanm at redhat.com
Thu Jun 21 08:00:04 UTC 2018


 chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx |    4 +-
 cui/source/tabpages/tpcolor.cxx                              |   10 +++---
 extensions/source/propctrlr/formcomponenthandler.cxx         |    5 +--
 include/svtools/colrdlg.hxx                                  |    8 +----
 include/svx/PaletteManager.hxx                               |    2 -
 include/svx/bmpmask.hxx                                      |    4 +-
 sd/source/filter/html/pubdlg.cxx                             |   12 +++----
 sd/source/ui/slideshow/slideshowimpl.cxx                     |    4 +-
 svtools/source/dialogs/colrdlg.cxx                           |   16 ++++------
 svx/source/dialog/_bmpmask.cxx                               |   17 +++++------
 svx/source/engine3d/float3d.cxx                              |    5 +--
 svx/source/tbxctrls/PaletteManager.cxx                       |    6 +--
 svx/source/tbxctrls/tbcontrl.cxx                             |    2 -
 13 files changed, 45 insertions(+), 50 deletions(-)

New commits:
commit 649be5feb4e162f83e9ff5fc8a68b463e723bc07
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 20 14:15:01 2018 +0100

    move SvColorDialog to welded arguments
    
    Change-Id: Ieb04fc4684caa6df47b123ab06e280f2d204375a
    Reviewed-on: https://gerrit.libreoffice.org/56174
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index ac1f95d7265d..bbe28b0ed0ea 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -390,9 +390,9 @@ IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, v
     bool bIsAmbientLight = (pButton==m_pBtn_AmbientLight_Color);
     SvxColorListBox* pListBox = bIsAmbientLight ? m_pLB_AmbientLight.get() : m_pLB_LightSource.get();
 
-    SvColorDialog aColorDlg( this );
+    SvColorDialog aColorDlg;
     aColorDlg.SetColor( pListBox->GetSelectEntryColor() );
-    if( aColorDlg.Execute() == RET_OK )
+    if( aColorDlg.Execute(GetFrameWeld()) == RET_OK )
     {
         Color aColor( aColorDlg.GetColor());
         lcl_selectColor( *pListBox, aColor );
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 113d1f9fb8a8..724a075b22d5 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -388,14 +388,14 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, weld::Button&, void)
 
 IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, weld::Button&, void)
 {
-    std::unique_ptr<SvColorDialog> pColorDlg(new SvColorDialog( GetParentDialog() ));
+    SvColorDialog aColorDlg;
 
-    pColorDlg->SetColor (aCurrentColor);
-    pColorDlg->SetMode( svtools::ColorPickerMode::Modify );
+    aColorDlg.SetColor (aCurrentColor);
+    aColorDlg.SetMode( svtools::ColorPickerMode::Modify );
 
-    if( pColorDlg->Execute() == RET_OK )
+    if (aColorDlg.Execute(GetFrameWeld()) == RET_OK)
     {
-        Color aPreviewColor = pColorDlg->GetColor();
+        Color aPreviewColor = aColorDlg.GetColor();
         aCurrentColor = aPreviewColor;
         UpdateColorValues( false );
         // fill ItemSet and pass it on to XOut
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 06e7cb3d6398..63b56afcbdf0 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2843,11 +2843,12 @@ namespace pcr
     {
         ::Color aColor;
         OSL_VERIFY( impl_getPropertyValue_throw( impl_getPropertyNameFromId_nothrow( _nColorPropertyId ) ) >>= aColor );
-        SvColorDialog aColorDlg( impl_getDefaultDialogParent_nothrow() );
+        SvColorDialog aColorDlg;
         aColorDlg.SetColor( aColor );
 
         _rClearBeforeDialog.clear();
-        if ( !aColorDlg.Execute() )
+        vcl::Window* pParent = impl_getDefaultDialogParent_nothrow();
+        if (!aColorDlg.Execute(pParent ? pParent->GetFrameWeld() : nullptr))
             return false;
 
         _out_rNewValue <<= aColorDlg.GetColor();
diff --git a/include/svtools/colrdlg.hxx b/include/svtools/colrdlg.hxx
index 69def8510b35..f89ec0f5419a 100644
--- a/include/svtools/colrdlg.hxx
+++ b/include/svtools/colrdlg.hxx
@@ -21,10 +21,9 @@
 #define INCLUDED_SVTOOLS_COLRDLG_HXX
 
 #include <svtools/svtdllapi.h>
-#include <vcl/vclptr.hxx>
 #include <tools/color.hxx>
 
-namespace vcl { class Window; }
+namespace weld { class Window; }
 
 namespace svtools
 {
@@ -36,7 +35,7 @@ namespace svtools
 class SVT_DLLPUBLIC SvColorDialog final
 {
 public:
-    SvColorDialog( vcl::Window* pParent );
+    SvColorDialog();
     ~SvColorDialog();
 
     void            SetColor( const Color& rColor );
@@ -44,10 +43,9 @@ public:
 
     void            SetMode( svtools::ColorPickerMode eMode );
 
-    short           Execute();
+    short           Execute(weld::Window* pParent);
 
 private:
-    VclPtr<vcl::Window> mpParent;
     Color               maColor;
     svtools::ColorPickerMode meMode;
 };
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index d4b6fd1a2298..ed8f639374f3 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -74,7 +74,7 @@ public:
     void        AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
 
     void        SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater);
-    void        PopupColorPicker(vcl::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
+    void        PopupColorPicker(weld::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
 
     void        SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction);
 
diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx
index a471ffcf880a..75c31f56459c 100644
--- a/include/svx/bmpmask.hxx
+++ b/include/svx/bmpmask.hxx
@@ -89,7 +89,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMaskChildWindow : public SfxChildWindo
 
 class MaskData;
 class MaskSet;
-class ColorWindow;
+class BmpColorWindow;
 class SvxColorListBox;
 
 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow
@@ -98,7 +98,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow
     friend class MaskSet;
 
     VclPtr<ToolBox>            m_pTbxPipette;
-    VclPtr<ColorWindow>        m_pCtlPipette;
+    VclPtr<BmpColorWindow>     m_pCtlPipette;
     VclPtr<PushButton>         m_pBtnExec;
 
     VclPtr<CheckBox>           m_pCbx1;
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index cf6d21f88559..538eb71e57bd 100644
--- a/sd/source/filter/html/pubdlg.cxx
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -1060,36 +1060,36 @@ IMPL_LINK_NOARG(SdPublishingDlg, ButtonsHdl, ValueSet*, void)
 // Fill the SfxItemSet with the settings of the dialog
 IMPL_LINK( SdPublishingDlg, ColorHdl, Button *, pButton, void)
 {
-    SvColorDialog aDlg(this);
+    SvColorDialog aDlg;
 
     if(pButton == pPage6_Back)
     {
         aDlg.SetColor( m_aBackColor );
-        if(aDlg.Execute() == RET_OK )
+        if(aDlg.Execute(GetFrameWeld()) == RET_OK )
             m_aBackColor = aDlg.GetColor();
     }
     else if(pButton == pPage6_Text)
     {
         aDlg.SetColor( m_aTextColor );
-        if(aDlg.Execute() == RET_OK )
+        if(aDlg.Execute(GetFrameWeld()) == RET_OK )
             m_aTextColor = aDlg.GetColor();
     }
     else if(pButton == pPage6_Link)
     {
         aDlg.SetColor( m_aLinkColor );
-        if(aDlg.Execute() == RET_OK )
+        if(aDlg.Execute(GetFrameWeld()) == RET_OK )
             m_aLinkColor = aDlg.GetColor();
     }
     else if(pButton == pPage6_VLink)
     {
         aDlg.SetColor( m_aVLinkColor );
-        if(aDlg.Execute() == RET_OK )
+        if(aDlg.Execute(GetFrameWeld()) == RET_OK )
             m_aVLinkColor = aDlg.GetColor();
     }
     else if(pButton == pPage6_ALink)
     {
         aDlg.SetColor( m_aALinkColor );
-        if(aDlg.Execute() == RET_OK )
+        if(aDlg.Execute(GetFrameWeld()) == RET_OK )
             m_aALinkColor = aDlg.GetColor();
     }
 
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index b3c78d89978e..0ab2165262e3 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -2100,10 +2100,10 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu, bool )
     {
         //Open a color picker based on SvColorDialog
         ::Color aColor( mnUserPaintColor );
-        SvColorDialog aColorDlg( mpShowWindow);
+        SvColorDialog aColorDlg;
         aColorDlg.SetColor( aColor );
 
-        if (aColorDlg.Execute() )
+        if (aColorDlg.Execute(mpShowWindow->GetFrameWeld()))
         {
             aColor = aColorDlg.GetColor();
             setPenColor(sal_Int32(aColor));
diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx
index 8c60e753f2bf..bd2cc410f61f 100644
--- a/svtools/source/dialogs/colrdlg.cxx
+++ b/svtools/source/dialogs/colrdlg.cxx
@@ -29,7 +29,7 @@
 #include <toolkit/helper/vclunohelper.hxx>
 
 #include <svtools/colrdlg.hxx>
-#include <vcl/window.hxx>
+#include <vcl/weld.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -37,29 +37,25 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::ui::dialogs;
 
 
-SvColorDialog::SvColorDialog( vcl::Window* pWindow )
-: mpParent( pWindow )
-, meMode( svtools::ColorPickerMode::Select )
+SvColorDialog::SvColorDialog()
+    : meMode(svtools::ColorPickerMode::Select)
 {
 }
 
 SvColorDialog::~SvColorDialog()
 {
 }
-
 void SvColorDialog::SetColor( const Color& rColor )
 {
     maColor = rColor;
 }
 
-
 void SvColorDialog::SetMode( svtools::ColorPickerMode eMode )
 {
     meMode = eMode;
 }
 
-
-short SvColorDialog::Execute()
+short SvColorDialog::Execute(weld::Window* pParent)
 {
     short ret = 0;
     try
@@ -67,7 +63,9 @@ short SvColorDialog::Execute()
         const OUString sColor( "Color" );
         Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
 
-        Reference< css::awt::XWindow > xParent( VCLUnoHelper::GetInterface( mpParent ) );
+        Reference<css::awt::XWindow> xParent;
+        if (pParent)
+            xParent = pParent->GetXWindow();;
 
         Reference< XExecutableDialog > xDialog = css::cui::ColorPicker::createWithParent(xContext, xParent);
         Reference< XPropertyAccess > xPropertyAccess( xDialog, UNO_QUERY_THROW );
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 0256b719e9a4..cd797af7552f 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -55,13 +55,13 @@
 
 SFX_IMPL_DOCKINGWINDOW_WITHID( SvxBmpMaskChildWindow, SID_BMPMASK )
 
-class ColorWindow : public Control
+class BmpColorWindow : public Control
 {
     Color       aColor;
 
 
 public:
-    explicit ColorWindow(vcl::Window* pParent)
+    explicit BmpColorWindow(vcl::Window* pParent)
         : Control(pParent, WB_BORDER)
         , aColor( COL_WHITE )
     {
@@ -147,15 +147,14 @@ void MaskSet::KeyInput( const KeyEvent& rKEvt )
 
 void MaskSet::onEditColor()
 {
-    std::unique_ptr<SvColorDialog> pColorDlg(new SvColorDialog( GetParent() ));
+    SvColorDialog aColorDlg;
 
-    pColorDlg->SetColor(GetItemColor(1));
+    aColorDlg.SetColor(GetItemColor(1));
 
-    if( pColorDlg->Execute() )
-        SetItemColor( 1, pColorDlg->GetColor() );
+    if (aColorDlg.Execute(GetFrameWeld()))
+        SetItemColor(1, aColorDlg.GetColor());
 }
 
-
 class MaskData
 {
     VclPtr<SvxBmpMask>     pMask;
@@ -310,7 +309,7 @@ IMPL_LINK_NOARG(MaskData, ExecHdl, Button*, void)
             { &aBItem });
 }
 
-void ColorWindow::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& /*Rect*/)
+void BmpColorWindow::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& /*Rect*/)
 {
     rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
     rRenderContext.SetLineColor(aColor);
@@ -361,7 +360,7 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window*
     m_pTbxPipette->SetItemBits(m_pTbxPipette->GetItemId(0),
         ToolBoxItemBits::AUTOCHECK);
     get(m_pBtnExec, "replace");
-    m_pCtlPipette = VclPtr<ColorWindow>::Create(get<Window>("toolgrid"));
+    m_pCtlPipette = VclPtr<BmpColorWindow>::Create(get<Window>("toolgrid"));
     m_pCtlPipette->Show();
     m_pCtlPipette->set_grid_left_attach(1);
     m_pCtlPipette->set_grid_top_attach(0);
diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx
index 98f9fb485df3..b0763c522ed2 100644
--- a/svx/source/engine3d/float3d.cxx
+++ b/svx/source/engine3d/float3d.cxx
@@ -2506,10 +2506,9 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void )
     }
 }
 
-
 IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void)
 {
-    SvColorDialog aColorDlg( this );
+    SvColorDialog aColorDlg;
     SvxColorListBox* pLb;
 
     if( pBtn == m_pBtnLightColor )
@@ -2526,7 +2525,7 @@ IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void)
     Color aColor = pLb->GetSelectEntryColor();
 
     aColorDlg.SetColor( aColor );
-    if( aColorDlg.Execute() == RET_OK )
+    if( aColorDlg.Execute(GetFrameWeld()) == RET_OK )
     {
         aColor = aColorDlg.GetColor();
         LBSelectColor(pLb, aColor);
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 48bd555893ee..27c84cdbfd56 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -357,14 +357,14 @@ void PaletteManager::SetColorSelectFunction(const std::function<void(const OUStr
     maColorSelectFunction = aColorSelectFunction;
 }
 
-void PaletteManager::PopupColorPicker(vcl::Window* pParent, const OUString& aCommand, const Color& rInitialColor)
+void PaletteManager::PopupColorPicker(weld::Window* pParent, const OUString& aCommand, const Color& rInitialColor)
 {
     // The calling object goes away during aColorDlg.Execute(), so we must copy this
     OUString aCommandCopy = aCommand;
-    SvColorDialog aColorDlg(pParent);
+    SvColorDialog aColorDlg;
     aColorDlg.SetColor(rInitialColor);
     aColorDlg.SetMode(svtools::ColorPickerMode::Modify);
-    if( aColorDlg.Execute() == RET_OK )
+    if (aColorDlg.Execute(pParent) == RET_OK)
     {
         if (mpBtnUpdater)
             mpBtnUpdater->Update( aColorDlg.GetColor() );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index ae103afddc21..b9e58be778ae 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1513,7 +1513,7 @@ IMPL_LINK_NOARG(SvxColorWindow, OpenPickerClickHdl, Button*, void)
 
     if ( IsInPopupMode() )
         EndPopupMode();
-    mxPaletteManager->PopupColorPicker(mxParentWindow, maCommand, GetSelectEntryColor().first);
+    mxPaletteManager->PopupColorPicker(mxParentWindow->GetFrameWeld(), maCommand, GetSelectEntryColor().first);
 }
 
 void SvxColorWindow::StartSelection()


More information about the Libreoffice-commits mailing list