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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 17 14:06:30 UTC 2018


 sd/inc/sdabstdlg.hxx                   |    2 
 sd/qa/unit/dialogs-test.cxx            |    3 
 sd/source/ui/dlg/dlgpage.cxx           |   29 ++++-----
 sd/source/ui/dlg/sddlgfact.cxx         |   40 ++++++++++++
 sd/source/ui/dlg/sddlgfact.hxx         |   22 ++++++
 sd/source/ui/func/fupage.cxx           |    2 
 sd/source/ui/inc/dlgpage.hxx           |    9 --
 sd/uiconfig/sdraw/ui/drawpagedialog.ui |  104 ++++++++++++++++++++++++++++-----
 8 files changed, 169 insertions(+), 42 deletions(-)

New commits:
commit a7e9db8338e93921ede5892545ce18655d08aad5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 16 14:24:12 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Sep 17 16:06:08 2018 +0200

    weld SdPageDlg
    
    Change-Id: Id9c78651d3eb315bf2e982eef48ef24071bfc79b
    Reviewed-on: https://gerrit.libreoffice.org/60550
    Tested-by: Jenkins
    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 332312ae77ba..f9c364c3a428 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -171,7 +171,7 @@ public:
     virtual VclPtr<AbstractCopyDlg>            CreateCopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView ) = 0;
     virtual VclPtr<AbstractSdCustomShowDlg>    CreateSdCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc) = 0;
     virtual VclPtr<SfxAbstractTabDialog>       CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) = 0;
-    virtual VclPtr<SfxAbstractTabDialog>       CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) = 0;
+    virtual VclPtr<SfxAbstractTabDialog>       CreateSdTabPageDialog(weld::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) = 0;
     virtual VclPtr<AbstractSdModifyFieldDlg>   CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) = 0;
     virtual VclPtr<AbstractSdSnapLineDlg>      CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) = 0;
     virtual VclPtr<AbstractSdInsertLayerDlg>   CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& rStr) = 0;
diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index dd9a6d989bec..1fe44cc04243 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -327,8 +327,9 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID)
             // CreateSdTabPageDialog(const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage = true) override;
             // needs a special SfxItemSet with merged content from page and other stuff, crashes without that (2nd page)
             // needs a 'SfxObjectShell* pDocShell', crashes without. Also sufficient: FillStyleItemSet with XFILL_NONE set
+            auto const parent = getViewShell()->GetActiveWindow();
             pRetval = getSdAbstractDialogFactory()->CreateSdTabPageDialog(
-                getViewShell()->GetActiveWindow(),
+                parent == nullptr ? nullptr : parent->GetFrameWeld(),
                 &getEmptyFillStyleSfxItemSet(),
                 getDocShell(),
                 true);
diff --git a/sd/source/ui/dlg/dlgpage.cxx b/sd/source/ui/dlg/dlgpage.cxx
index 75933ae73271..97e03977ef1a 100644
--- a/sd/source/ui/dlg/dlgpage.cxx
+++ b/sd/source/ui/dlg/dlgpage.cxx
@@ -33,12 +33,9 @@
 /**
  * Constructor of tab dialog: appends pages to the dialog
  */
-SdPageDlg::SdPageDlg( SfxObjectShell const * pDocSh, vcl::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage ) :
-        SfxTabDialog ( pParent
-                      ,"DrawPageDialog"
-                      ,"modules/sdraw/ui/drawpagedialog.ui"
-                      , pAttr ),
-        mpDocShell  ( pDocSh )
+SdPageDlg::SdPageDlg(SfxObjectShell const * pDocSh, weld::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage)
+    : SfxTabDialogController(pParent, "modules/sdraw/ui/drawpagedialog.ui", "DrawPageDialog", pAttr)
+    , mpDocShell(pDocSh)
 {
     SvxColorListItem const * pColorListItem = mpDocShell->GetItem( SID_COLOR_TABLE );
     SvxGradientListItem const * pGradientListItem = mpDocShell->GetItem( SID_GRADIENT_LIST );
@@ -54,28 +51,28 @@ SdPageDlg::SdPageDlg( SfxObjectShell const * pDocSh, vcl::Window* pParent, const
 
     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
 
-    mnPage = AddTabPage( "RID_SVXPAGE_PAGE", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), nullptr );
-    mnArea = AddTabPage( "RID_SVXPAGE_AREA", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), nullptr );
-    mnTransparence = AddTabPage( "RID_SVXPAGE_TRANSPARENCE", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), nullptr );
+    AddTabPage("RID_SVXPAGE_PAGE", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PAGE), nullptr);
+    AddTabPage("RID_SVXPAGE_AREA", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_AREA), nullptr);
+    AddTabPage("RID_SVXPAGE_TRANSPARENCE", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TRANSPARENCE), nullptr);
 
-    if(!bAreaPage)  // I have to add the page before I remove it !
+    if (!bAreaPage)  // I have to add the page before I remove it !
     {
-        RemoveTabPage( "RID_SVXPAGE_AREA" );
-        RemoveTabPage( "RID_SVXPAGE_TRANSPARENCE" );
+        RemoveTabPage("RID_SVXPAGE_AREA");
+        RemoveTabPage("RID_SVXPAGE_TRANSPARENCE");
     }
 }
 
-void SdPageDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
+void SdPageDlg::PageCreated(const OString& rId, SfxTabPage& rPage)
 {
     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
-    if (nId == mnPage)
+    if (rId == "RID_SVXPAGE_PAGE")
     {
         aSet.Put (SfxAllEnumItem(sal_uInt16(SID_ENUM_PAGE_MODE), SVX_PAGE_MODE_PRESENTATION));
         aSet.Put (SfxAllEnumItem(sal_uInt16(SID_PAPER_START), PAPER_A0));
         aSet.Put (SfxAllEnumItem(sal_uInt16(SID_PAPER_END), PAPER_E));
         rPage.PageCreated(aSet);
     }
-    else if (nId == mnArea)
+    else if (rId == "RID_SVXPAGE_AREA")
     {
         aSet.Put (SvxColorListItem(mpColorList,SID_COLOR_TABLE));
         aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST));
@@ -87,7 +84,7 @@ void SdPageDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
         aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,0));
         rPage.PageCreated(aSet);
     }
-    else if (nId == mnTransparence)
+    else if (rId == "RID_SVXPAGE_TRANSPARENCE")
     {
         aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,0));
         aSet.Put(SfxUInt16Item(SID_DLG_TYPE,1));
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index 22581ad31aaa..7173bfc0c533 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -164,6 +164,42 @@ void SdAbstractTabDialog_Impl::SetText( const OUString& rStr )
     pDlg->SetText( rStr );
 }
 
+short SdAbstractTabController_Impl::Execute()
+{
+    return m_xDlg->execute();
+}
+
+void SdAbstractTabController_Impl::SetCurPageId( const OString &rName )
+{
+    m_xDlg->SetCurPageId( rName );
+}
+
+const SfxItemSet* SdAbstractTabController_Impl::GetOutputItemSet() const
+{
+    return m_xDlg->GetOutputItemSet();
+}
+
+const sal_uInt16* SdAbstractTabController_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+    return m_xDlg->GetInputRanges( pItem );
+}
+
+void SdAbstractTabController_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+     m_xDlg->SetInputSet( pInSet );
+}
+
+bool SdAbstractTabController_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+    return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
+//From class Window.
+void SdAbstractTabController_Impl::SetText( const OUString& rStr )
+{
+    m_xDlg->set_title(rStr);
+}
+
 void AbstractBulletDialog_Impl::SetCurPageId( const OString& rName )
 {
     static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( rName );
@@ -353,9 +389,9 @@ VclPtr<SfxAbstractTabDialog>  SdAbstractDialogFactory_Impl::CreateSdTabCharDialo
     return VclPtr<SdAbstractTabDialog_Impl>::Create( VclPtr<SdCharDlg>::Create(pParent, pAttr, pDocShell) );
 }
 
-VclPtr<SfxAbstractTabDialog>  SdAbstractDialogFactory_Impl::CreateSdTabPageDialog(vcl::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage )
+VclPtr<SfxAbstractTabDialog>  SdAbstractDialogFactory_Impl::CreateSdTabPageDialog(weld::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage )
 {
-    return VclPtr<SdAbstractTabDialog_Impl>::Create( VclPtr<SdPageDlg>::Create( pDocShell, pParent, pAttr, bAreaPage ) );
+    return VclPtr<SdAbstractTabController_Impl>::Create(o3tl::make_unique<SdPageDlg>(pDocShell, pParent, pAttr, bAreaPage));
 }
 
 VclPtr<AbstractSdModifyFieldDlg> SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg(weld::Window* pParent, const SvxFieldData* pInField, const SfxItemSet& rSet)
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index 10880bd9b46f..16c0b0be361d 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -128,6 +128,26 @@ class SdAbstractTabDialog_Impl : public SfxAbstractTabDialog
     virtual void        SetText( const OUString& rStr ) override;
 };
 
+class SdAbstractTabController_Impl : public SfxAbstractTabDialog
+{
+protected:
+    std::shared_ptr<SfxTabDialogController> m_xDlg;
+public:
+    explicit SdAbstractTabController_Impl(std::unique_ptr<SfxTabDialogController> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
+    virtual bool  StartExecuteAsync(AsyncContext &rCtx) override;
+    virtual void                SetCurPageId( const OString &rName ) override;
+    virtual const SfxItemSet*   GetOutputItemSet() const override;
+    virtual const sal_uInt16*   GetInputRanges( const SfxItemPool& pItem ) override;
+    virtual void                SetInputSet( const SfxItemSet* pInSet ) override;
+        //From class Window.
+    virtual void        SetText( const OUString& rStr ) override;
+};
+
+
 class AbstractBulletDialog_Impl : public SfxAbstractTabDialog
 {
     DECL_ABSTDLG_BASE( AbstractBulletDialog_Impl,SfxTabDialog )
@@ -291,7 +311,7 @@ public:
     virtual VclPtr<AbstractCopyDlg>            CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override;
     virtual VclPtr<AbstractSdCustomShowDlg>    CreateSdCustomShowDlg(weld::Window* pParent, SdDrawDocument& rDrawDoc) override;
     virtual VclPtr<SfxAbstractTabDialog>       CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) override;
-    virtual VclPtr<SfxAbstractTabDialog>       CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override;
+    virtual VclPtr<SfxAbstractTabDialog>       CreateSdTabPageDialog(weld::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override;
     virtual VclPtr<AbstractSdModifyFieldDlg>   CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) override;
     virtual VclPtr<AbstractSdSnapLineDlg>      CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override;
     virtual VclPtr<AbstractSdInsertLayerDlg>   CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override;
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index c5b38dba95be..a514f84be3cd 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -330,7 +330,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent)
     {
         // create the dialog
         SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
-        ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabPageDialog(mpViewShell->GetActiveWindow(), &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage) );
+        ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabPageDialog(mpViewShell->GetFrameWeld(), &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage) );
         if( pDlg->Execute() == RET_OK )
             pTempSet.reset( new SfxItemSet(*pDlg->GetOutputItemSet()) );
     }
diff --git a/sd/source/ui/inc/dlgpage.hxx b/sd/source/ui/inc/dlgpage.hxx
index 632ae583ebfa..b0ffd2aa7454 100644
--- a/sd/source/ui/inc/dlgpage.hxx
+++ b/sd/source/ui/inc/dlgpage.hxx
@@ -28,7 +28,7 @@ enum class ChangeType;
 /**
  * Page configuration-tab-dialog
  */
-class SdPageDlg : public SfxTabDialog
+class SdPageDlg : public SfxTabDialogController
 {
 private:
     const SfxObjectShell* mpDocShell;
@@ -38,14 +38,11 @@ private:
     XHatchListRef         mpHatchingList;
     XBitmapListRef        mpBitmapList;
     XPatternListRef       mpPatternList;
-    sal_uInt16            mnArea;
-    sal_uInt16            mnPage;
-    sal_uInt16            mnTransparence;
 public:
 
-    SdPageDlg( SfxObjectShell const * pDocSh, vcl::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage );
+    SdPageDlg(SfxObjectShell const * pDocSh, weld::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage);
 
-    virtual void PageCreated(sal_uInt16 nId, SfxTabPage& rPage) override;
+    virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
 };
 
 #endif // INCLUDED_SD_SOURCE_UI_INC_DLGPAGE_HXX
diff --git a/sd/uiconfig/sdraw/ui/drawpagedialog.ui b/sd/uiconfig/sdraw/ui/drawpagedialog.ui
index 1d21e7f6c36b..7e06dc3d51e6 100644
--- a/sd/uiconfig/sdraw/ui/drawpagedialog.ui
+++ b/sd/uiconfig/sdraw/ui/drawpagedialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sd">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="DrawPageDialog">
@@ -7,6 +7,9 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="drawpagedialog|DrawPageDialog">Page Setup</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -17,12 +20,10 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="ok">
-                <property name="label">gtk-ok</property>
+              <object class="GtkButton" id="reset">
+                <property name="label">gtk-revert-to-saved</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
               </object>
@@ -33,10 +34,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="cancel">
-                <property name="label">gtk-cancel</property>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
               </object>
@@ -47,8 +50,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="help">
-                <property name="label">gtk-help</property>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -58,12 +61,11 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">2</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="reset">
-                <property name="label">gtk-revert-to-saved</property>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -73,6 +75,7 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">3</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -86,9 +89,10 @@
         <child>
           <object class="GtkNotebook" id="tabcontrol">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can_focus">True</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
+            <property name="scrollable">True</property>
             <child>
               <object class="GtkGrid">
                 <property name="visible">True</property>
@@ -96,6 +100,30 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
             </child>
             <child type="tab">
@@ -115,6 +143,30 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
               <packing>
                 <property name="position">1</property>
@@ -138,6 +190,30 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
               <packing>
                 <property name="position">2</property>
@@ -164,10 +240,10 @@
       </object>
     </child>
     <action-widgets>
+      <action-widget response="0">reset</action-widget>
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
-      <action-widget response="0">reset</action-widget>
     </action-widgets>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list