diff options
author | Susobhan Ghosh <susobhang70@gmail.com> | 2016-06-22 13:54:50 +0530 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-07-08 14:09:01 +0000 |
commit | af69de6344d94f4fe3f469d425fe8c0117ab33cd (patch) | |
tree | 2caa49ab02749916a01782f85e351f8f43cfda73 | |
parent | 1c39db584f9f1877a9fa5ce00e8d19dd997d8078 (diff) |
Use PageNumberListBox in cui
Change-Id: Id7e71ade1946b5f33701a71073f1cc5a7870af6a
Reviewed-on: https://gerrit.libreoffice.org/26564
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r-- | cui/source/inc/numpages.hxx | 13 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 72 | ||||
-rw-r--r-- | cui/source/tabpages/page.cxx | 4 | ||||
-rw-r--r-- | cui/uiconfig/ui/pageformatpage.ui | 106 |
4 files changed, 7 insertions, 188 deletions
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index 381345fd7a1b..5344aaf177cd 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -358,19 +358,6 @@ public: ListBox& GetCharFmtListBox() {return *m_pCharFmtLB;} void SetModified(bool bRepaint = true); virtual void PageCreated(const SfxAllItemSet& aSet) override; - - /** Get the numberings provided by the i18n framework (CTL, Asian, ...) and - add them to the listbox. Extended numbering schemes present in the - resource and already in the listbox but not offered by the i18n - framework per configuration are removed. - - @param nDoNotRemove - A value that shall not be removed, i.e. the ugly 0x88 - (SVX_NUM_BITMAP|0x80) - Pass ::std::numeric_limits<sal_uInt16>::max() if there is no such - restriction. - */ - static void GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 nDoNotRemove ); }; diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 9f9deaf380c7..1d9d220408e8 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -80,6 +80,7 @@ #include <comphelper/string.hxx> #include <vcl/cvtgrf.hxx> #include <vcl/graphicfilter.hxx> +#include <svx/SvxNumOptionsTabPageHelper.hxx> using namespace css; using namespace css::uno; @@ -107,13 +108,6 @@ static const sal_Char cSuffix[] = "Suffix"; static const sal_Char cBulletChar[] = "BulletChar"; static const sal_Char cBulletFontName[] = "BulletFontName"; -static Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider() -{ - Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); - Reference<XDefaultNumberingProvider> xRet = text::DefaultNumberingProvider::create(xContext); - return xRet; -} - static SvxNumSettings_Impl* lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps) { const PropertyValue* pValues = rLevelProps.getConstArray(); @@ -196,7 +190,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(vcl::Window* pParent, m_pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl)); m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl)); - Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider(); + Reference<XDefaultNumberingProvider> xDefNum = SvxNumOptionsTabPageHelper::GetNumberingProvider(); if(xDefNum.is()) { Sequence< Sequence< PropertyValue > > aNumberings; @@ -558,7 +552,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(vcl::Window* pParent, m_pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl)); m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl)); - Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider(); + Reference<XDefaultNumberingProvider> xDefNum = SvxNumOptionsTabPageHelper::GetNumberingProvider(); if(xDefNum.is()) { Sequence<Reference<XIndexAccess> > aOutlineAccess; @@ -1088,64 +1082,6 @@ IMPL_LINK_NOARG_TYPED(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, Button*, voi } } -// static -void SvxNumOptionsTabPage::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 nDoNotRemove ) -{ - - Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider(); - Reference<XNumberingTypeInfo> xInfo(xDefNum, UNO_QUERY); - - // Extended numbering schemes present in the resource but not offered by - // the i18n framework per configuration must be removed from the listbox. - // Do not remove a special entry matching nDoNotRemove. - const sal_uInt16 nDontRemove = SAL_MAX_UINT16; - ::std::vector< sal_uInt16> aRemove( rFmtLB.GetEntryCount(), nDontRemove); - for (size_t i=0; i<aRemove.size(); ++i) - { - sal_uInt16 nEntryData = (sal_uInt16)reinterpret_cast<sal_uLong>(rFmtLB.GetEntryData( - sal::static_int_cast< sal_Int32 >(i))); - if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && nEntryData != nDoNotRemove) - aRemove[i] = nEntryData; - } - if(xInfo.is()) - { - Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes( ); - const sal_Int16* pTypes = aTypes.getConstArray(); - for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) - { - sal_Int16 nCurrent = pTypes[nType]; - if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N) - { - bool bInsert = true; - for(sal_Int32 nEntry = 0; nEntry < rFmtLB.GetEntryCount(); nEntry++) - { - sal_uInt16 nEntryData = (sal_uInt16)reinterpret_cast<sal_uLong>(rFmtLB.GetEntryData(nEntry)); - if(nEntryData == (sal_uInt16) nCurrent) - { - bInsert = false; - aRemove[nEntry] = nDontRemove; - break; - } - } - if(bInsert) - { - OUString aIdent = xInfo->getNumberingIdentifier( nCurrent ); - sal_Int32 nPos = rFmtLB.InsertEntry(aIdent); - rFmtLB.SetEntryData(nPos, reinterpret_cast<void*>((sal_uLong)nCurrent)); - } - } - } - } - for (unsigned short i : aRemove) - { - if (i != nDontRemove) - { - sal_Int32 nPos = rFmtLB.GetEntryPos( reinterpret_cast<void*>((sal_uLong)i)); - rFmtLB.RemoveEntry( nPos); - } - } -} - // tabpage numbering options SvxNumOptionsTabPage::SvxNumOptionsTabPage(vcl::Window* pParent, const SfxItemSet& rSet) @@ -1246,7 +1182,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(vcl::Window* pParent, // Get advanced numbering types from the component. // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that. - GetI18nNumbering( *m_pFmtLB, (SVX_NUM_BITMAP | 0x80)); + SvxNumOptionsTabPageHelper::GetI18nNumbering( *m_pFmtLB, (SVX_NUM_BITMAP | 0x80)); } SvxNumOptionsTabPage::~SvxNumOptionsTabPage() diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index afb4f0d007ea..65bc2d1ddc96 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -59,7 +59,7 @@ #include <svx/xdef.hxx> #include <svx/unobrushitemhelper.hxx> -#include <numpages.hxx> +#include <svx/SvxNumOptionsTabPageHelper.hxx> // static ---------------------------------------------------------------- @@ -349,7 +349,7 @@ SvxPageDescPage::SvxPageDescPage( vcl::Window* pParent, const SfxItemSet& rAttr m_pBottomMarginEdit->SetLast(m_pBottomMarginEdit->Normalize(aDrawinglayerOpt.GetMaximumPaperBottomMargin()), FUNIT_MM); // Get the i18n framework numberings and add them to the listbox. - SvxNumOptionsTabPage::GetI18nNumbering( *m_pNumberFormatBox, ::std::numeric_limits<sal_uInt16>::max()); + SvxNumOptionsTabPageHelper::GetI18nNumbering( *m_pNumberFormatBox, ::std::numeric_limits<sal_uInt16>::max()); } diff --git a/cui/uiconfig/ui/pageformatpage.ui b/cui/uiconfig/ui/pageformatpage.ui index 2a25d38bd7a4..03495847bc5e 100644 --- a/cui/uiconfig/ui/pageformatpage.ui +++ b/cui/uiconfig/ui/pageformatpage.ui @@ -1,110 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> <interface> <requires lib="gtk+" version="3.0"/> <requires lib="LibreOffice" version="1.0"/> - <object class="GtkListStore" id="liststoreNumberFormat"> - <columns> - <!-- column-name gchararray1 --> - <column type="gchararray"/> - <!-- column-name gint1 --> - <column type="gint"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">1, 2, 3, ...</col> - <col id="1">4</col> - </row> - <row> - <col id="0" translatable="yes">A, B, C, ...</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes">a, b, c, ...</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes">I, II, III, ...</col> - <col id="1">2</col> - </row> - <row> - <col id="0" translatable="yes">i, ii, iii, ...</col> - <col id="1">3</col> - </row> - <row> - <col id="0" translatable="yes">None</col> - <col id="1">5</col> - </row> - <row> - <col id="0" translatable="yes">A, .., AA, .., AAA, ...</col> - <col id="1">9</col> - </row> - <row> - <col id="0" translatable="yes">a, .., aa, .., aaa, ...</col> - <col id="1">10</col> - </row> - <row> - <col id="0" translatable="yes">Native Numbering</col> - <col id="1">12</col> - </row> - <row> - <col id="0" translatable="yes">А, Б, .., Аа, Аб, ... (Bulgarian)</col> - <col id="1">38</col> - </row> - <row> - <col id="0" translatable="yes">а, б, .., аа, аб, ... (Bulgarian)</col> - <col id="1">39</col> - </row> - <row> - <col id="0" translatable="yes">А, Б, .., Аа, Бб, ... (Bulgarian)</col> - <col id="1">40</col> - </row> - <row> - <col id="0" translatable="yes">а, б, .., аа, бб, ... (Bulgarian)</col> - <col id="1">41</col> - </row> - <row> - <col id="0" translatable="yes">А, Б, .., Аа, Аб, ... (Russian)</col> - <col id="1">42</col> - </row> - <row> - <col id="0" translatable="yes">а, б, .., аа, аб, ... (Russian)</col> - <col id="1">43</col> - </row> - <row> - <col id="0" translatable="yes">А, Б, .., Аа, Бб, ... (Russian)</col> - <col id="1">44</col> - </row> - <row> - <col id="0" translatable="yes">а, б, .., аа, бб, ... (Russian)</col> - <col id="1">45</col> - </row> - <row> - <col id="0" translatable="yes">А, Б, .., Аа, Аб, ... (Serbian)</col> - <col id="1">48</col> - </row> - <row> - <col id="0" translatable="yes">а, б, .., аа, аб, ... (Serbian)</col> - <col id="1">49</col> - </row> - <row> - <col id="0" translatable="yes">А, Б, .., Аа, Бб, ... (Serbian)</col> - <col id="1">50</col> - </row> - <row> - <col id="0" translatable="yes">а, б, .., аа, бб, ... (Serbian)</col> - <col id="1">51</col> - </row> - <row> - <col id="0" translatable="yes">Α, Β, Γ, ... (Greek Upper Letter)</col> - <col id="1">52</col> - </row> - <row> - <col id="0" translatable="yes">α, β, γ, ... (Greek Lower Letter)</col> - <col id="1">53</col> - </row> - </data> - </object> <object class="GtkListStore" id="liststorePageLayout"> <columns> <!-- column-name gchararray1 --> @@ -697,10 +594,9 @@ </packing> </child> <child> - <object class="GtkComboBox" id="comboLayoutFormat"> + <object class="svxcorelo-PageNumberListBox" id="comboLayoutFormat"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststoreNumberFormat</property> </object> <packing> <property name="left_attach">1</property> |