diff options
author | Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa> | 2012-06-25 09:27:16 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-11-15 06:45:14 +0000 |
commit | cf05f252ea3af8f6a1543ec52081f53cbcb2cc07 (patch) | |
tree | 6853fbf5a565a8fdd0e7be485a42ff0efcefa1c9 | |
parent | a6e622029b8f1c450b9d535e94212bf06666acf3 (diff) |
fdo#42558 added Arabic Abjad and other known numberings to Page Numbering
(cherry picked from commit e5d61932cb6c92954d808cf8d65a460ea19d5799)
fdo#42558 consolidated duplicated code
* Moved almost identical code of
SvxNumOptionsTabPage::SvxNumOptionsTabPage() and
SvxPageDescPage::SvxPageDescPage() into static
SvxNumOptionsTabPage::GetI18nNumbering()
* Removed now unnecessary includes and using namespace directives
(cherry picked from commit 88a083f8be05449630c9e2af30474281fd0d8af2)
fdo#42558 Re-adding the "None" option to the page numbering
(cherry picked from commit 8c004e70aa44910d28d27e0b4cf837b3bbb85c5c)
Squashed all three commits into one.
Signed-off-by: Eike Rathke <erack@redhat.com>
Change-Id: I3be59d92da8444f12855fcfac78c465d2a547b2d
Reviewed-on: https://gerrit.libreoffice.org/1070
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
-rw-r--r-- | cui/source/inc/numpages.hxx | 13 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 113 | ||||
-rw-r--r-- | cui/source/tabpages/page.cxx | 21 | ||||
-rw-r--r-- | cui/source/tabpages/page.src | 29 |
4 files changed, 111 insertions, 65 deletions
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index 00f0ddd82ab2..ee2134c259d5 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -356,6 +356,19 @@ class SvxNumOptionsTabPage : public SfxTabPage ListBox& GetCharFmtListBox() {return aCharFmtLB;} void SetModified(sal_Bool bRepaint = sal_True); virtual void PageCreated(SfxAllItemSet aSet); + + /** 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 ad962f69cc84..1156021aeda9 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -1036,6 +1036,64 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, LinkBmpHdl_Impl) return 0; } +// 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 = 0xffff; + ::std::vector< sal_uInt16> aRemove( rFmtLB.GetEntryCount(), nDontRemove); + for (size_t i=0; i<aRemove.size(); ++i) + { + sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)rFmtLB.GetEntryData( + sal::static_int_cast< sal_uInt16 >(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) + { + sal_Bool bInsert = sal_True; + for(sal_uInt16 nEntry = 0; nEntry < rFmtLB.GetEntryCount(); nEntry++) + { + sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)rFmtLB.GetEntryData(nEntry); + if(nEntryData == (sal_uInt16) nCurrent) + { + bInsert = sal_False; + aRemove[nEntry] = nDontRemove; + break; + } + } + if(bInsert) + { + OUString aIdent = xInfo->getNumberingIdentifier( nCurrent ); + sal_uInt16 nPos = rFmtLB.InsertEntry(aIdent); + rFmtLB.SetEntryData(nPos,(void*)(sal_uLong)nCurrent); + } + } + } + } + for (size_t i=0; i<aRemove.size(); ++i) + { + if (aRemove[i] != nDontRemove) + { + sal_uInt16 nPos = rFmtLB.GetEntryPos( (void*)(sal_uLong)aRemove[i]); + rFmtLB.RemoveEntry( nPos); + } + } +} + // tabpage numeration options #define NUM_NO_GRAPHIC 1000 SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent, @@ -1126,60 +1184,9 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent, FreeResource(); - //get advanced numbering types from the component - 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. + // Get advanced numbering types from the component. // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that. - const sal_uInt16 nDontRemove = 0xffff; - ::std::vector< sal_uInt16> aRemove( aFmtLB.GetEntryCount(), nDontRemove); - for (size_t i=0; i<aRemove.size(); ++i) - { - sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData( - sal::static_int_cast< sal_uInt16 >(i)); - if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && - nEntryData != (SVX_NUM_BITMAP | 0x80)) - 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) - { - sal_Bool bInsert = sal_True; - for(sal_uInt16 nEntry = 0; nEntry < aFmtLB.GetEntryCount(); nEntry++) - { - sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(nEntry); - if(nEntryData == (sal_uInt16) nCurrent) - { - bInsert = sal_False; - aRemove[nEntry] = nDontRemove; - break; - } - } - if(bInsert) - { - OUString aIdent = xInfo->getNumberingIdentifier( nCurrent ); - sal_uInt16 nPos = aFmtLB.InsertEntry(aIdent); - aFmtLB.SetEntryData(nPos,(void*)(sal_uLong)nCurrent); - } - } - } - } - for (size_t i=0; i<aRemove.size(); ++i) - { - if (aRemove[i] != nDontRemove) - { - sal_uInt16 nPos = aFmtLB.GetEntryPos( (void*)(sal_uLong)aRemove[i]); - aFmtLB.RemoveEntry( nPos); - } - } + GetI18nNumbering( aFmtLB, (SVX_NUM_BITMAP | 0x80)); aBulletPB.SetAccessibleRelationMemberOf(&aFormatFL); aBulletPB.SetAccessibleRelationLabeledBy(&aStartFT); diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 417b311c99df..a1411badc566 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -70,6 +70,8 @@ #include <svl/aeitem.hxx> #include <sfx2/request.hxx> +#include <numpages.hxx> // for GetI18nNumbering() + // static ---------------------------------------------------------------- static const long MINBODY = 284; // 0,5 cm rounded up in twips @@ -86,7 +88,6 @@ static sal_uInt16 pRanges[] = SID_SWREGISTER_MODE, 0 }; - // ------- Mapping page layout ------------------------------------------ sal_uInt16 aArr[] = @@ -362,6 +363,9 @@ SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) : aPortraitBtn.SetAccessibleRelationMemberOf(&aOrientationFT); aLandscapeBtn.SetAccessibleRelationMemberOf(&aOrientationFT); + + // Get the i18n framework numberings and add them to the listbox. + SvxNumOptionsTabPage::GetI18nNumbering( aNumberFormatBox, ::std::numeric_limits<sal_uInt16>::max()); } // ----------------------------------------------------------------------- @@ -469,8 +473,13 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet ) aBspWin.SetUsage( nUse ); LayoutHdl_Impl( 0 ); - // adjust numeration type of the page style - aNumberFormatBox.SelectEntryPos( sal::static_int_cast< sal_uInt16 >(eNumType) ); + //adjust numeration type of the page style + //Get the Position of the saved NumType + for(int i=0; i<aNumberFormatBox.GetEntryCount(); i++) + if(eNumType == (sal_uInt16)(sal_uLong)aNumberFormatBox.GetEntryData(i)){ + aNumberFormatBox.SelectEntryPos( i ); + break; + } aPaperTrayBox.Clear(); sal_uInt8 nPaperBin = PAPERBIN_PRINTER_SETTINGS; @@ -805,12 +814,12 @@ sal_Bool SvxPageDescPage::FillItemSet( SfxItemSet& rSet ) bMod |= sal_True; } - + //Get the NumType value nPos = aNumberFormatBox.GetSelectEntryPos(); - + sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aNumberFormatBox.GetEntryData(nPos); if ( nPos != aNumberFormatBox.GetSavedValue() ) { - aPage.SetNumType( (SvxNumType)nPos ); + aPage.SetNumType( (SvxNumType)nEntryData ); bMod |= sal_True; } diff --git a/cui/source/tabpages/page.src b/cui/source/tabpages/page.src index 367c98a867d8..c50efcecf242 100644 --- a/cui/source/tabpages/page.src +++ b/cui/source/tabpages/page.src @@ -306,12 +306,29 @@ TabPage RID_SVXPAGE_PAGE DropDown = TRUE ; StringList [ en-US ] = { - < "A, B, C, ..." ; Default ; > ; - < "a, b, c, ..." ; Default ; > ; - < "I, II, III, ..." ; Default ; > ; - < "i, ii, iii, ..." ; Default ; > ; - < "1, 2, 3, ..." ; Default ; > ; - < "None" ; Default ; > ; + < "1, 2, 3, ..." ; 4/*SVX_NUM_ARABIC */; > ; + < "A, B, C, ..." ; 0/*SVX_NUM_CHARS_UPPER_LETTER */; > ; + < "a, b, c, ..." ; 1/*SVX_NUM_CHARS_LOWER_LETTER */; > ; + < "I, II, III, ..." ; 2/*SVX_NUM_ROMAN_UPPER */; > ; + < "i, ii, iii, ..." ; 3/*SVX_NUM_ROMAN_LOWER */; > ; + < "None" ; 5/*SVX_NUM_NUMBER_NONE */; > ; + < "A, .., AA, .., AAA, ..." ; 9/*SVX_NUM_CHARS_UPPER_LETTER_N*/; > ; + < "a, .., aa, .., aaa, ..." ; 10/*SVX_NUM_CHARS_LOWER_LETTER_N*/; > ; + < "Native Numbering" ; 12 /*NATIVE_NUMBERING */; > ; + < "А, Б, .., Аа, Аб, ... (Bulgarian)" ; 38 /*CHARS_CYRILLIC_UPPER_LETTER_BG */; > ; + < "а, б, .., аа, аб, ... (Bulgarian)" ; 39 /*CHARS_CYRILLIC_LOWER_LETTER_BG */; > ; + < "А, Б, .., Аа, Бб, ... (Bulgarian)" ; 40 /*CHARS_CYRILLIC_UPPER_LETTER_N_BG */; > ; + < "а, б, .., аа, бб, ... (Bulgarian)" ; 41 /*CHARS_CYRILLIC_LOWER_LETTER_N_BG */; > ; + < "А, Б, .., Аа, Аб, ... (Russian)" ; 42 /*CHARS_CYRILLIC_UPPER_LETTER_RU */; > ; + < "а, б, .., аа, аб, ... (Russian)" ; 43 /*CHARS_CYRILLIC_LOWER_LETTER_RU */; > ; + < "А, Б, .., Аа, Бб, ... (Russian)" ; 44 /*CHARS_CYRILLIC_UPPER_LETTER_N_RU */; > ; + < "а, б, .., аа, бб, ... (Russian)" ; 45 /*CHARS_CYRILLIC_LOWER_LETTER_N_RU */; > ; + < "А, Б, .., Аа, Аб, ... (Serbian)" ; 48 /*CHARS_CYRILLIC_UPPER_LETTER_SR */; > ; + < "а, б, .., аа, аб, ... (Serbian)" ; 49 /*CHARS_CYRILLIC_LOWER_LETTER_SR */; > ; + < "А, Б, .., Аа, Бб, ... (Serbian)" ; 50 /*CHARS_CYRILLIC_UPPER_LETTER_N_SR */; > ; + < "а, б, .., аа, бб, ... (Serbian)" ; 51 /*CHARS_CYRILLIC_LOWER_LETTER_N_SR */; > ; + < "Α, Β, Γ, ... (Greek Upper Letter)"; 52 /*CHARS_GREEK_UPPER_LETTER */; > ; + < "α, β, γ, ... (Greek Lower Letter)"; 53 /*CHARS_GREEK_LOWER_LETTER */; > ; }; }; FixedText FT_TBL_ALIGN |