[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Nov 25 14:39:02 UTC 2018


 sw/source/ui/dialog/swdlgfact.cxx |    7 -
 sw/source/ui/fmtui/tmpdlg.cxx     |  203 ++++++++------------------------------
 sw/source/uibase/inc/tmpdlg.hxx   |   32 -----
 3 files changed, 47 insertions(+), 195 deletions(-)

New commits:
commit 2fc2f235b94de9f70a28aee90564745cda313489
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Nov 24 14:54:03 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Nov 25 15:38:40 2018 +0100

    SwTemplateDlg is now unused
    
    Change-Id: If7de6baf5d2770d18926ee744a5c0fc6283c0195
    Reviewed-on: https://gerrit.libreoffice.org/63973
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index d50b657610a9..dee9cc849fe2 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -1007,12 +1007,7 @@ VclPtr<SfxAbstractApplyTabDialog> SwAbstractDialogFactory_Impl::CreateTemplateDi
                                                 SwWrtShell*         pActShell,
                                                 bool                bNew )
 {
-    if (nRegion != SfxStyleFamily::Frame)
-    {
-        return VclPtr<AbstractApplyTabController_Impl>::Create(o3tl::make_unique<SwTemplateDlgController>(pParent ? pParent->GetFrameWeld() : nullptr, rBase, nRegion, sPage, pActShell, bNew));
-    }
-    VclPtr<SfxTabDialog> pDlg = VclPtr<SwTemplateDlg>::Create(pParent, rBase, nRegion, sPage, pActShell);
-    return VclPtr<AbstractApplyTabDialog_Impl>::Create(pDlg);
+    return VclPtr<AbstractApplyTabController_Impl>::Create(o3tl::make_unique<SwTemplateDlgController>(pParent ? pParent->GetFrameWeld() : nullptr, rBase, nRegion, sPage, pActShell, bNew));
 }
 
 VclPtr<AbstractGlossaryDlg> SwAbstractDialogFactory_Impl::CreateGlossaryDlg(SfxViewFrame* pViewFrame,
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 796bb064e408..a35b833e251f 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -66,163 +66,6 @@
 #include <svx/flagsdef.hxx>
 
 // the dialog's carrier
-SwTemplateDlg::SwTemplateDlg(vcl::Window* pParent,
-                             SfxStyleSheetBase& rBase,
-                             SfxStyleFamily nRegion,
-                             const OString& sPage,
-                             SwWrtShell* pActShell)
-    : SfxStyleDialog(pParent,
-                    "TemplateDialog" + OUString::number(static_cast<sal_uInt16>(nRegion)),
-                    "modules/swriter/ui/templatedialog" +
-                        OUString::number(static_cast<sal_uInt16>(nRegion)) + ".ui",
-                    rBase)
-    , nType(nRegion)
-    , pWrtShell(pActShell)
-    , m_nAreaId(0)
-    , m_nTransparenceId(0)
-    , m_nBorderId(0)
-    , m_nTypeId(0)
-    , m_nOptionsId(0)
-    , m_nWrapId(0)
-    , m_nColumnId(0)
-    , m_nMacroId(0)
-{
-    nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
-    SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
-    // stitch TabPages together
-    switch( nRegion )
-    {
-        // frame styles
-        case SfxStyleFamily::Frame:
-        {
-            m_nTypeId = AddTabPage("type", SwFramePage::Create,
-                                        SwFramePage::GetRanges);
-            m_nOptionsId = AddTabPage("options", SwFrameAddPage::Create,
-                                        SwFrameAddPage::GetRanges);
-            m_nWrapId = AddTabPage("wrap", SwWrapTabPage::Create,
-                                        SwWrapTabPage::GetRanges);
-
-            // add Area and Transparence TabPages
-            m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
-            m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
-
-            m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
-
-            m_nColumnId = AddTabPage("columns", SwColumnPage::Create,
-                                        SwColumnPage::GetRanges );
-
-            m_nMacroId = AddTabPage("macros", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), nullptr);
-
-        break;
-        }
-
-        default:
-            OSL_ENSURE(false, "wrong family");
-    }
-
-    if (!sPage.isEmpty())
-        SetCurPageId(sPage);
-}
-
-short SwTemplateDlg::Ok()
-{
-    short nRet = SfxTabDialog::Ok();
-    if( RET_OK == nRet )
-    {
-        const SfxPoolItem *pOutItem, *pExItem;
-        if( SfxItemState::SET == m_pExampleSet->GetItemState(
-            SID_ATTR_NUMBERING_RULE, false, &pExItem ) &&
-            ( !GetOutputItemSet() ||
-            SfxItemState::SET != GetOutputItemSet()->GetItemState(
-            SID_ATTR_NUMBERING_RULE, false, &pOutItem ) ||
-            *pExItem != *pOutItem ))
-        {
-            if( GetOutputItemSet() )
-                const_cast<SfxItemSet*>(GetOutputItemSet())->Put( *pExItem );
-            else
-                nRet = RET_CANCEL;
-        }
-    }
-    else
-        //JP 09.01.98 Bug #46446#:
-        // that's the Ok-Handler, so OK has to be default!
-        nRet = RET_OK;
-    return nRet;
-}
-
-void SwTemplateDlg::RefreshInputSet()
-{
-    SfxItemSet* pInSet = GetInputSetImpl();
-    pInSet->ClearItem();
-    pInSet->SetParent( &GetStyleSheet().GetItemSet() );
-}
-
-void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
-{
-    // set style's and metric's names
-    OUString sNumCharFormat, sBulletCharFormat;
-    SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFormat);
-    SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFormat);
-    SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
-
-    if (nId == m_nTypeId)
-    {
-        static_cast<SwFramePage&>(rPage).SetNewFrame( true );
-        static_cast<SwFramePage&>(rPage).SetFormatUsed( true );
-    }
-    else if (nId == m_nOptionsId)
-    {
-        static_cast<SwFrameAddPage&>(rPage).SetFormatUsed(true);
-        static_cast<SwFrameAddPage&>(rPage).SetNewFrame(true);
-    }
-    else if (nId == m_nWrapId)
-    {
-        static_cast<SwWrapTabPage&>(rPage).SetFormatUsed( true, false );
-    }
-    else if (nId == m_nColumnId)
-    {
-        if( nType == SfxStyleFamily::Frame )
-            static_cast<SwColumnPage&>(rPage).SetFrameMode(true);
-        static_cast<SwColumnPage&>(rPage).SetFormatUsed( true );
-    }
-    else if (nId == m_nMacroId)
-    {
-        SfxAllItemSet aNewSet(*aSet.GetPool());
-        aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
-        if ( pWrtShell )
-            rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
-        rPage.PageCreated(aNewSet);
-    }
-    else if (nId == m_nBorderId)
-    {
-        if( SfxStyleFamily::Frame == nType )
-        {
-            aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::FRAME)));
-        }
-        rPage.PageCreated(aSet);
-    }
-    // inits for Area and Transparency TabPages
-    // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
-    // the color table) need to be added as items (e.g. SvxColorTableItem) to make
-    // these pages find the needed attributes for fill style suggestions.
-    // These are added in SwDocStyleSheet::GetItemSet() for the SfxStyleFamily::Para on
-    // demand, but could also be directly added from the DrawModel.
-    else if (nId == m_nAreaId)
-    {
-        aSet.Put(GetStyleSheet().GetItemSet());
-
-        // add flag for direct graphic content selection
-        aSet.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
-
-        rPage.PageCreated(aSet);
-    }
-    else if (nId == m_nTransparenceId)
-    {
-        rPage.PageCreated(GetStyleSheet().GetItemSet());
-    }
-}
-
-// the dialog's carrier
 SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent,
                                                  SfxStyleSheetBase& rBase,
                                                  SfxStyleFamily nRegion,
@@ -359,6 +202,24 @@ SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent,
             AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
         }
         break;
+        case SfxStyleFamily::Frame:
+        {
+            AddTabPage("type", SwFramePage::Create, SwFramePage::GetRanges);
+            AddTabPage("options", SwFrameAddPage::Create, SwFrameAddPage::GetRanges);
+            AddTabPage("wrap", SwWrapTabPage::Create, SwWrapTabPage::GetRanges);
+
+            // add Area and Transparence TabPages
+            AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
+            AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
+
+            AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
+
+            AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
+
+            AddTabPage("macros", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), nullptr);
+
+        break;
+        }
         default:
             OSL_ENSURE(false, "wrong family");
     }
@@ -643,6 +504,34 @@ void SwTemplateDlgController::PageCreated(const OString& rId, SfxTabPage &rPage
             rPage.PageCreated(aSet);
         }
     }
+    else if (rId == "type")
+    {
+        static_cast<SwFramePage&>(rPage).SetNewFrame( true );
+        static_cast<SwFramePage&>(rPage).SetFormatUsed( true );
+    }
+    else if (rId == "options")
+    {
+        static_cast<SwFrameAddPage&>(rPage).SetFormatUsed(true);
+        static_cast<SwFrameAddPage&>(rPage).SetNewFrame(true);
+    }
+    else if (rId == "wrap")
+    {
+        static_cast<SwWrapTabPage&>(rPage).SetFormatUsed( true, false );
+    }
+    else if (rId == "columns")
+    {
+        if( nType == SfxStyleFamily::Frame )
+            static_cast<SwColumnPage&>(rPage).SetFrameMode(true);
+        static_cast<SwColumnPage&>(rPage).SetFormatUsed( true );
+    }
+    else if (rId == "macros")
+    {
+        SfxAllItemSet aNewSet(*aSet.GetPool());
+        aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
+        if ( pWrtShell )
+            rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
+        rPage.PageCreated(aNewSet);
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/tmpdlg.hxx b/sw/source/uibase/inc/tmpdlg.hxx
index 0aa4f040d545..7b1358ba184a 100644
--- a/sw/source/uibase/inc/tmpdlg.hxx
+++ b/sw/source/uibase/inc/tmpdlg.hxx
@@ -25,38 +25,6 @@ class SfxItemSet;
 class SwWrtShell;
 
 // the tab dialog carrier of TabPages
-class SwTemplateDlg: public SfxStyleDialog
-{
-
-    SfxStyleFamily const  nType;
-    sal_uInt16      nHtmlMode;
-    SwWrtShell*     pWrtShell;
-
-    sal_uInt16 m_nAreaId;
-    sal_uInt16 m_nTransparenceId;
-    sal_uInt16 m_nBorderId;
-    sal_uInt16 m_nTypeId;
-    sal_uInt16 m_nOptionsId;
-    sal_uInt16 m_nWrapId;
-    sal_uInt16 m_nColumnId;
-    sal_uInt16 m_nMacroId;
-
-public:
-    /// @param sPage
-    /// Identifies name of page to open at by default
-    SwTemplateDlg(  vcl::Window*        pParent,
-                    SfxStyleSheetBase&  rBase,
-                    SfxStyleFamily      nRegion,
-                    const OString&      sPage,
-                    SwWrtShell*         pActShell );
-
-    virtual void RefreshInputSet() override;
-
-    virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override;
-    virtual short Ok() override;
-};
-
-// the tab dialog carrier of TabPages
 class SwTemplateDlgController : public SfxStyleDialogController
 {
 


More information about the Libreoffice-commits mailing list