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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Nov 17 16:50:11 UTC 2018


 sw/UIConfig_swriter.mk                     |    1 
 sw/source/ui/dialog/swdlgfact.cxx          |    2 
 sw/source/ui/fmtui/tmpdlg.cxx              |  152 +++++++++++------------------
 sw/source/uibase/inc/tmpdlg.hxx            |    4 
 sw/uiconfig/swriter/ui/comboboxfragment.ui |    8 +
 5 files changed, 69 insertions(+), 98 deletions(-)

New commits:
commit 35d548e414903c9f513c0899a2bab475ff56d0f0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Nov 17 15:33:54 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Nov 17 17:49:45 2018 +0100

    weld writer numbering styles dialog
    
    Change-Id: I697fa74a21acec550fcacd2a8d8468dfb21afcac
    Reviewed-on: https://gerrit.libreoffice.org/63495
    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/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 0ab905433e7d..37dffed460ed 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -112,6 +112,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/columndialog \
 	sw/uiconfig/swriter/ui/columnpage \
 	sw/uiconfig/swriter/ui/columnwidth \
+	sw/uiconfig/swriter/ui/comboboxfragment \
 	sw/uiconfig/swriter/ui/conditionpage \
 	sw/uiconfig/swriter/ui/converttexttable \
 	sw/uiconfig/swriter/ui/createaddresslist \
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index c773d98038ac..83ae9b85ba41 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -1008,7 +1008,7 @@ VclPtr<SfxAbstractApplyTabDialog> SwAbstractDialogFactory_Impl::CreateTemplateDi
                                                 SwWrtShell*         pActShell,
                                                 bool                bNew )
 {
-    if (nRegion == SfxStyleFamily::Page)
+    if (nRegion == SfxStyleFamily::Page || nRegion == SfxStyleFamily::Pseudo)
     {
         return VclPtr<AbstractApplyTabController_Impl>::Create(o3tl::make_unique<SwTemplateDlgController>(pParent ? pParent->GetFrameWeld() : nullptr, rBase, nRegion, sPage, pActShell, bNew));
     }
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 43a520866966..20344ea0ed9b 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -100,10 +100,6 @@ SwTemplateDlg::SwTemplateDlg(vcl::Window* pParent,
     , m_nHeaderId(0)
     , m_nFooterId(0)
     , m_nPageId(0)
-    , m_nBulletId(0)
-    , m_nNumId(0)
-    , m_nNumOptId(0)
-    , m_nNumPosId(0)
 {
     nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
@@ -250,54 +246,6 @@ SwTemplateDlg::SwTemplateDlg(vcl::Window* pParent,
 
         break;
         }
-        // page styles
-        case SfxStyleFamily::Page:
-        {
-            // 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_nHeaderId = AddTabPage("header",  SvxHeaderPage::Create, SvxHeaderPage::GetRanges);
-            m_nFooterId = AddTabPage("footer", SvxFooterPage::Create, SvxFooterPage::GetRanges);
-
-            OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
-            OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
-            m_nPageId = AddTabPage("page",
-                                            pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ),
-                                            pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) );
-            if (0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
-            {
-                OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
-                OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
-                m_nBorderId = AddTabPage("borders",
-                                pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
-                m_nColumnId = AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
-                AddTabPage("footnotes", SwFootNotePage::Create, SwFootNotePage::GetRanges );
-                AddTabPage("textgrid", SwTextGridPage::Create, SwTextGridPage::GetRanges );
-                SvtCJKOptions aCJKOptions;
-                if(!aCJKOptions.IsAsianTypographyEnabled())
-                    RemoveTabPage("textgrid");
-            }
-            else
-            {
-                RemoveTabPage("borders");
-                RemoveTabPage("columns");
-                RemoveTabPage("footnotes");
-                RemoveTabPage("textgrid");
-            }
-        }
-        break;
-        // numbering styles
-        case SfxStyleFamily::Pseudo:
-        {
-            AddTabPage("numbering", RID_SVXPAGE_PICK_SINGLE_NUM);
-            m_nBulletId = AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
-            m_nNumId = AddTabPage("outline", RID_SVXPAGE_PICK_NUM);
-            AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
-            m_nNumOptId = AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
-            m_nNumPosId = AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
-        }
-        break;
 
         default:
             OSL_ENSURE(false, "wrong family");
@@ -494,47 +442,6 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
             rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
         rPage.PageCreated(aNewSet);
     }
-    else if (nId == m_nNumId)
-    {
-        aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
-        aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
-        rPage.PageCreated(aSet);
-    }
-    else if (nId == m_nNumOptId)
-    {
-
-        aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
-        aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
-        // collect character styles
-        ScopedVclPtrInstance< ListBox > rCharFormatLB(this);
-        rCharFormatLB->Clear();
-        rCharFormatLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone );
-        SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
-        ::FillCharStyleListBox(*rCharFormatLB.get(),  pDocShell);
-
-        std::vector<OUString> aList;
-        aList.reserve(rCharFormatLB->GetEntryCount());
-        for (sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++)
-            aList.push_back(rCharFormatLB->GetEntry(j));
-
-        aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
-        FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) !=  nullptr);
-        aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
-        rPage.PageCreated(aSet);
-    }
-    else if (nId == m_nNumPosId)
-    {
-        SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
-        FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebDocShell*>( pDocShell) !=  nullptr );
-
-        aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
-        rPage.PageCreated(aSet);
-    }
-    else if (nId == m_nBulletId)
-    {
-        aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
-        rPage.PageCreated(aSet);
-    }
     else if (nId == m_nHeaderId)
     {
         if(0 == (nHtmlMode & HTMLMODE_ON ))
@@ -638,6 +545,17 @@ SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent,
             }
         }
         break;
+        // numbering styles
+        case SfxStyleFamily::Pseudo:
+        {
+            AddTabPage("numbering", RID_SVXPAGE_PICK_SINGLE_NUM);
+            AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
+            AddTabPage("outline", RID_SVXPAGE_PICK_NUM);
+            AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
+            AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
+            AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
+        }
+        break;
         default:
             OSL_ENSURE(false, "wrong family");
     }
@@ -784,6 +702,54 @@ void SwTemplateDlgController::PageCreated(const OString& rId, SfxTabPage &rPage
     {
         rPage.PageCreated(GetStyleSheet().GetItemSet());
     }
+    else if (rId == "bullets")
+    {
+        aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
+        rPage.PageCreated(aSet);
+    }
+    else if (rId == "outline")
+    {
+        if (SfxStyleFamily::Pseudo == nType)
+        {
+            aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
+            aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
+            rPage.PageCreated(aSet);
+        }
+    }
+    else if (rId == "customize")
+    {
+        aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
+        aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
+
+        // collect character styles
+        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/comboboxfragment.ui"));
+        std::unique_ptr<weld::ComboBox> xCharFormatLB(xBuilder->weld_combo_box("combobox"));
+        xCharFormatLB->clear();
+        xCharFormatLB->append_text(SwViewShell::GetShellRes()->aStrNone);
+        SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
+        ::FillCharStyleListBox(*xCharFormatLB,  pDocShell);
+
+        std::vector<OUString> aList;
+        aList.reserve(xCharFormatLB->get_count());
+        for (sal_Int32 j = 0; j < xCharFormatLB->get_count(); j++)
+            aList.push_back(xCharFormatLB->get_text(j));
+
+        aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
+        FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) !=  nullptr);
+        aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
+        rPage.PageCreated(aSet);
+    }
+    else if (rId == "position")
+    {
+        if (SfxStyleFamily::Pseudo == nType)
+        {
+            SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
+            FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebDocShell*>( pDocShell) !=  nullptr );
+
+            aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
+            rPage.PageCreated(aSet);
+        }
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/tmpdlg.hxx b/sw/source/uibase/inc/tmpdlg.hxx
index fcb1f8b4c18f..1e49aaa7090b 100644
--- a/sw/source/uibase/inc/tmpdlg.hxx
+++ b/sw/source/uibase/inc/tmpdlg.hxx
@@ -53,10 +53,6 @@ class SwTemplateDlg: public SfxStyleDialog
     sal_uInt16 m_nHeaderId;
     sal_uInt16 m_nFooterId;
     sal_uInt16 m_nPageId;
-    sal_uInt16 m_nBulletId;
-    sal_uInt16 m_nNumId;
-    sal_uInt16 m_nNumOptId;
-    sal_uInt16 m_nNumPosId;
 
 public:
     /// @param sPage
diff --git a/sw/uiconfig/swriter/ui/comboboxfragment.ui b/sw/uiconfig/swriter/ui/comboboxfragment.ui
new file mode 100644
index 000000000000..d9b9579ef0b4
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/comboboxfragment.ui
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkComboBoxText" id="combobox">
+    <property name="can_focus">False</property>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list