[Libreoffice-commits] core.git: sd/inc sd/qa sd/source sd/uiconfig

Caolán McNamara caolanm at redhat.com
Mon Apr 30 10:49:40 UTC 2018


 sd/inc/sdabstdlg.hxx                    |    2 -
 sd/qa/unit/dialogs-test.cxx             |    3 +-
 sd/source/ui/dlg/morphdlg.cxx           |   35 ++++++++++----------------------
 sd/source/ui/dlg/sddlgfact.cxx          |   19 ++++++++++-------
 sd/source/ui/dlg/sddlgfact.hxx          |   11 ++++++++--
 sd/source/ui/func/fumorph.cxx           |    2 -
 sd/source/ui/inc/morphdlg.hxx           |   27 ++++++++----------------
 sd/uiconfig/sdraw/ui/crossfadedialog.ui |   11 ++++++++--
 8 files changed, 55 insertions(+), 55 deletions(-)

New commits:
commit 8d2fe4c81c6f6bde3571beaa02abc0a9eba038e8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Apr 29 21:29:13 2018 +0100

    weld MorphDlg
    
    Change-Id: I6f47606e8d66c9bf9a32d221f223d734397b8570
    Reviewed-on: https://gerrit.libreoffice.org/53636
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index 0f96f96ea62e..571d8369e2d7 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -187,7 +187,7 @@ public:
     virtual VclPtr<AbstractSdSnapLineDlg>      CreateSdSnapLineDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) = 0;
     virtual VclPtr<AbstractSdInsertLayerDlg>   CreateSdInsertLayerDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) = 0;
     virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName) = 0;
-    virtual VclPtr<AbstractMorphDlg>           CreateMorphDlg(vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) = 0;
+    virtual VclPtr<AbstractMorphDlg>           CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) = 0;
     virtual VclPtr<SfxAbstractTabDialog>       CreateSdOutlineBulletTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) = 0;
     virtual VclPtr<SfxAbstractTabDialog>       CreateSdParagraphTabDlg(vcl::Window* pWindow, const SfxItemSet* pAttr) = 0;
     virtual VclPtr<AbstractSdStartPresDlg>     CreateSdStartPresentationDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs,
diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index 3fac39df3ed5..89e036af3442 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -402,8 +402,9 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID)
             SdrObject* pSdrObj = pSdPage->GetObj(0);
             // using one SdrObject is okay, none crashes
             CPPUNIT_ASSERT(pSdrObj);
+            auto const parent = Application::GetDefDialogParent();
             pRetval = getSdAbstractDialogFactory()->CreateMorphDlg(
-                Application::GetDefDialogParent(),
+                parent == nullptr ? nullptr : parent->GetFrameWeld(),
                 pSdrObj,
                 pSdrObj);
             break;
diff --git a/sd/source/ui/dlg/morphdlg.cxx b/sd/source/ui/dlg/morphdlg.cxx
index df12096702e1..434a57d7f034 100644
--- a/sd/source/ui/dlg/morphdlg.cxx
+++ b/sd/source/ui/dlg/morphdlg.cxx
@@ -33,14 +33,12 @@ using namespace com::sun::star;
 
 namespace sd {
 
-MorphDlg::MorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 )
-    : ModalDialog(pParent, "CrossFadeDialog",
-        "modules/sdraw/ui/crossfadedialog.ui")
+MorphDlg::MorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 )
+    : GenericDialogController(pParent, "modules/sdraw/ui/crossfadedialog.ui", "CrossFadeDialog")
+    , m_xMtfSteps(m_xBuilder->weld_spin_button("increments"))
+    , m_xCbxAttributes(m_xBuilder->weld_check_button("attributes"))
+    , m_xCbxOrientation(m_xBuilder->weld_check_button("orientation"))
 {
-    get(m_pMtfSteps, "increments");
-    get(m_pCbxAttributes, "attributes");
-    get(m_pCbxOrientation, "orientation");
-
     LoadSettings();
 
     SfxItemPool &   rPool = pObj1->GetObjectItemPool();
@@ -58,21 +56,12 @@ MorphDlg::MorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObjec
     if ( ( ( eLineStyle1 == drawing::LineStyle_NONE ) || ( eLineStyle2 == drawing::LineStyle_NONE ) ) &&
          ( ( eFillStyle1 != drawing::FillStyle_SOLID ) || ( eFillStyle2 != drawing::FillStyle_SOLID ) ) )
     {
-        m_pCbxAttributes->Disable();
+        m_xCbxAttributes->set_sensitive(false);
     }
 }
 
 MorphDlg::~MorphDlg()
 {
-    disposeOnce();
-}
-
-void MorphDlg::dispose()
-{
-    m_pMtfSteps.clear();
-    m_pCbxAttributes.clear();
-    m_pCbxOrientation.clear();
-    ModalDialog::dispose();
 }
 
 void MorphDlg::LoadSettings()
@@ -94,9 +83,9 @@ void MorphDlg::LoadSettings()
         bOrient = bAttrib = true;
     }
 
-    m_pMtfSteps->SetValue( nSteps );
-    m_pCbxOrientation->Check( bOrient );
-    m_pCbxAttributes->Check( bAttrib );
+    m_xMtfSteps->set_value(nSteps);
+    m_xCbxOrientation->set_active(bOrient);
+    m_xCbxAttributes->set_active(bAttrib);
 }
 
 void MorphDlg::SaveSettings() const
@@ -108,9 +97,9 @@ void MorphDlg::SaveSettings() const
     {
         SdIOCompat aCompat( *xOStm, StreamMode::WRITE, 1 );
 
-        xOStm->WriteUInt16( m_pMtfSteps->GetValue() )
-              .WriteBool( m_pCbxOrientation->IsChecked() )
-              .WriteBool( m_pCbxAttributes->IsChecked() );
+        xOStm->WriteUInt16( m_xMtfSteps->get_value() )
+              .WriteBool( m_xCbxOrientation->get_active() )
+              .WriteBool( m_xCbxAttributes->get_active() );
     }
 }
 
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index 8a517760a149..54e2d56a6712 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -55,7 +55,12 @@ IMPL_ABSTDLG_BASE(AbstractSdModifyFieldDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractSdSnapLineDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractSdInsertLayerDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractMorphDlg_Impl);
+
+short AbstractMorphDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
 IMPL_ABSTDLG_BASE(AbstractSdStartPresDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractSdPresLayoutDlg_Impl);
 IMPL_ABSTDLG_BASE(SdAbstractSfxDialog_Impl);
@@ -237,22 +242,22 @@ bool AbstractSdInsertPagesObjsDlg_Impl::IsRemoveUnnessesaryMasterPages() const
 
 void AbstractMorphDlg_Impl::SaveSettings() const
 {
-    pDlg->SaveSettings();
+    m_xDlg->SaveSettings();
 }
 
 sal_uInt16 AbstractMorphDlg_Impl::GetFadeSteps() const
 {
-    return pDlg->GetFadeSteps();
+    return m_xDlg->GetFadeSteps();
 }
 
 bool AbstractMorphDlg_Impl::IsAttributeFade() const
 {
-    return pDlg->IsAttributeFade();
+    return m_xDlg->IsAttributeFade();
 }
 
 bool AbstractMorphDlg_Impl::IsOrientationFade() const
 {
-    return pDlg->IsOrientationFade();
+    return m_xDlg->IsOrientationFade();
 }
 
 void AbstractSdStartPresDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
@@ -339,9 +344,9 @@ VclPtr<AbstractSdInsertPagesObjsDlg> SdAbstractDialogFactory_Impl::CreateSdInser
     return VclPtr<AbstractSdInsertPagesObjsDlg_Impl>::Create( VclPtr<SdInsertPagesObjsDlg>::Create( pParent, pDoc, pSfxMedium, rFileName ) );
 }
 
-VclPtr<AbstractMorphDlg> SdAbstractDialogFactory_Impl::CreateMorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2)
+VclPtr<AbstractMorphDlg> SdAbstractDialogFactory_Impl::CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2)
 {
-    return VclPtr<AbstractMorphDlg_Impl>::Create( VclPtr<::sd::MorphDlg>::Create( pParent, pObj1, pObj2 ) );
+    return VclPtr<AbstractMorphDlg_Impl>::Create(new ::sd::MorphDlg(pParent, pObj1, pObj2));
 }
 
 VclPtr<SfxAbstractTabDialog>  SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView )
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index 0186622d399a..97f407922a31 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -171,7 +171,14 @@ class AbstractSdInsertPagesObjsDlg_Impl : public AbstractSdInsertPagesObjsDlg
 
 class AbstractMorphDlg_Impl : public AbstractMorphDlg
 {
-    DECL_ABSTDLG_BASE(AbstractMorphDlg_Impl,::sd::MorphDlg)
+private:
+    std::unique_ptr<sd::MorphDlg> m_xDlg;
+public:
+    AbstractMorphDlg_Impl(::sd::MorphDlg* pDlg)
+        : m_xDlg(pDlg)
+    {
+    }
+    virtual short   Execute() override;
     virtual void            SaveSettings() const override;
     virtual sal_uInt16      GetFadeSteps() const override;
     virtual bool            IsAttributeFade() const override ;
@@ -234,7 +241,7 @@ public:
     virtual VclPtr<AbstractSdSnapLineDlg>      CreateSdSnapLineDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override;
     virtual VclPtr<AbstractSdInsertLayerDlg>   CreateSdInsertLayerDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override;
     virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) override;
-    virtual VclPtr<AbstractMorphDlg>           CreateMorphDlg(vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) override;
+    virtual VclPtr<AbstractMorphDlg>           CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) override;
     virtual VclPtr<SfxAbstractTabDialog>       CreateSdOutlineBulletTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) override;
     virtual VclPtr<SfxAbstractTabDialog>       CreateSdParagraphTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr) override;
     virtual VclPtr<AbstractSdStartPresDlg>     CreateSdStartPresentationDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs,
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index 03aa0b0ad656..2a2b2355b93f 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -92,7 +92,7 @@ void FuMorph::DoExecute( SfxRequest& )
         SdrObject*  pPolyObj1 = pCloneObj1->ConvertToPolyObj(false, false);
         SdrObject*  pPolyObj2 = pCloneObj2->ConvertToPolyObj(false, false);
         SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
-        ScopedVclPtr<AbstractMorphDlg> pDlg(pFact ? pFact->CreateMorphDlg( static_cast< vcl::Window*>(mpWindow), pObj1, pObj2 ) : nullptr);
+        ScopedVclPtr<AbstractMorphDlg> pDlg(pFact ? pFact->CreateMorphDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, pObj1, pObj2) : nullptr);
         if(pPolyObj1 && pPolyObj2 && pDlg && (pDlg->Execute() == RET_OK))
         {
             B2DPolyPolygonList_impl aPolyPolyList;
diff --git a/sd/source/ui/inc/morphdlg.hxx b/sd/source/ui/inc/morphdlg.hxx
index d717a82b39d2..365bbefc5461 100644
--- a/sd/source/ui/inc/morphdlg.hxx
+++ b/sd/source/ui/inc/morphdlg.hxx
@@ -20,36 +20,27 @@
 #ifndef INCLUDED_SD_SOURCE_UI_INC_MORPHDLG_HXX
 #define INCLUDED_SD_SOURCE_UI_INC_MORPHDLG_HXX
 
-#include <vcl/button.hxx>
-#include <vcl/group.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/field.hxx>
-#include <vcl/dialog.hxx>
+#include <vcl/weld.hxx>
 
 class SdrObject;
 
 namespace sd {
 
-class MorphDlg
-    : public ModalDialog
+class MorphDlg : public weld::GenericDialogController
 {
 public:
-    MorphDlg (
-        vcl::Window* pParent,
-        const SdrObject* pObj1,
-        const SdrObject* pObj2);
+    MorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2);
     virtual ~MorphDlg() override;
-    virtual void dispose() override;
 
     void            SaveSettings() const;
-    sal_uInt16      GetFadeSteps() const { return static_cast<sal_uInt16>(m_pMtfSteps->GetValue()); }
-    bool            IsAttributeFade() const { return m_pCbxAttributes->IsChecked(); }
-    bool            IsOrientationFade() const { return m_pCbxOrientation->IsChecked(); }
+    sal_uInt16      GetFadeSteps() const { return static_cast<sal_uInt16>(m_xMtfSteps->get_value()); }
+    bool            IsAttributeFade() const { return m_xCbxAttributes->get_active(); }
+    bool            IsOrientationFade() const { return m_xCbxOrientation->get_active(); }
 
 private:
-    VclPtr<NumericField>   m_pMtfSteps;
-    VclPtr<CheckBox>       m_pCbxAttributes;
-    VclPtr<CheckBox>       m_pCbxOrientation;
+    std::unique_ptr<weld::SpinButton> m_xMtfSteps;
+    std::unique_ptr<weld::CheckButton> m_xCbxAttributes;
+    std::unique_ptr<weld::CheckButton> m_xCbxOrientation;
 
     void            LoadSettings();
 };
diff --git a/sd/uiconfig/sdraw/ui/crossfadedialog.ui b/sd/uiconfig/sdraw/ui/crossfadedialog.ui
index 1f05991398ed..5c62b1d26991 100644
--- a/sd/uiconfig/sdraw/ui/crossfadedialog.ui
+++ b/sd/uiconfig/sdraw/ui/crossfadedialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="sd">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="adjustment1">
@@ -13,6 +13,9 @@
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="crossfadedialog|CrossFadeDialog">Cross-fading</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
@@ -133,10 +136,10 @@
                       <object class="GtkLabel" id="label2">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" context="crossfadedialog|label2">Increments:</property>
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">increments</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -147,6 +150,7 @@
                       <object class="GtkSpinButton" id="increments">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="activates_default">True</property>
                         <property name="adjustment">adjustment1</property>
                       </object>
                       <packing>
@@ -182,5 +186,8 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list