[Libreoffice-commits] core.git: editeng/source include/editeng

Nusaiba Al-Kindi noseeba1 at gmail.com
Thu Jan 21 11:39:52 PST 2016


 editeng/source/items/numitem.cxx |   21 +++++++++++++++++++++
 include/editeng/numitem.hxx      |    8 +++++---
 2 files changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 6517141b6233c5f9667031bc92f66109fddf5b76
Author: Nusaiba Al-Kindi <noseeba1 at gmail.com>
Date:   Thu Jan 21 15:38:03 2016 +0400

    tdf#42788: FORMATTING - Numbering/ordered list
    
    I changed the default numbering alignment of the Roman(upper/ lower) numbers list to the right
    instead of left with out any changes in the default alignment of other numbring type lists.
    In addition, numbering alignment can be changed by the user and any new list created will not
    be affected by the user choice (using the default settings for the new list).
    
    Change-Id: I7a6b7fb31bf40e26910e90538cd336e767f4c056
    Reviewed-on: https://gerrit.libreoffice.org/21439
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index b6247b4..23ca941 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -151,6 +151,7 @@ SvxNumberFormat::SvxNumberFormat( sal_Int16 eType,
                                   SvxNumPositionAndSpaceMode ePositionAndSpaceMode )
     : SvxNumberType(eType),
       eNumAdjust(SVX_ADJUST_LEFT),
+      mbNumAdjustChanged(false),
       nInclUpperLevels(0),
       nStart(1),
       cBullet(SVX_DEF_BULLET),
@@ -243,6 +244,25 @@ SvxNumberFormat::~SvxNumberFormat()
     delete pBulletFont;
 }
 
+void SvxNumberFormat::SetNumberingType(sal_Int16 nSet)
+{
+    if(!mbNumAdjustChanged)
+    {//Romain numbers alignment to right, issue-42788
+        if(nSet == SVX_NUM_ROMAN_UPPER || nSet == SVX_NUM_ROMAN_LOWER)
+            eNumAdjust = SVX_ADJUST_RIGHT;
+        else if (eNumAdjust == SVX_ADJUST_RIGHT && (GetNumberingType() == SVX_NUM_ROMAN_UPPER || GetNumberingType() == SVX_NUM_ROMAN_LOWER))
+            eNumAdjust = SVX_ADJUST_LEFT;
+    }
+
+    SvxNumberType::SetNumberingType(nSet);
+}
+
+void SvxNumberFormat::SetNumAdjust(SvxAdjust eSet)
+{
+    eNumAdjust = eSet;
+    mbNumAdjustChanged = true;
+}
+
 void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter)
 {
     if(pConverter && pBulletFont)
@@ -316,6 +336,7 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
 
     SetNumberingType(rFormat.GetNumberingType());
         eNumAdjust          = rFormat.eNumAdjust ;
+        mbNumAdjustChanged  = rFormat.mbNumAdjustChanged;
         nInclUpperLevels    = rFormat.nInclUpperLevels ;
         nStart              = rFormat.nStart ;
         cBullet             = rFormat.cBullet ;
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index d338a51..cefaf8f 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -60,12 +60,12 @@ class EDITENG_DLLPUBLIC SvxNumberType
 public:
     explicit SvxNumberType(sal_Int16 nType = css::style::NumberingType::ARABIC);
     SvxNumberType(const SvxNumberType& rType);
-    ~SvxNumberType();
+    virtual ~SvxNumberType();
 
     OUString        GetNumStr( sal_uLong nNo ) const;
     OUString        GetNumStr( sal_uLong nNo, const css::lang::Locale& rLocale ) const;
 
-    void            SetNumberingType(sal_Int16 nSet) {nNumType = nSet;}
+    virtual void    SetNumberingType(sal_Int16 nSet) {nNumType = nSet;}
     sal_Int16       GetNumberingType() const {return nNumType;}
 
     void            SetShowSymbol(bool bSet) {bShowSymbol = bSet;}
@@ -99,6 +99,7 @@ private:
     OUString       sSuffix;
 
     SvxAdjust           eNumAdjust;
+    bool                mbNumAdjustChanged;
 
     sal_uInt8           nInclUpperLevels;   // Take over numbers from the previous level.
     sal_uInt16          nStart;             // Start of counting
@@ -154,7 +155,8 @@ public:
     bool            operator==( const SvxNumberFormat&  ) const;
     bool            operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);}
 
-    void            SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;}
+    void            SetNumberingType(sal_Int16 nSet);
+    void            SetNumAdjust(SvxAdjust eSet);
     SvxAdjust       GetNumAdjust() const {return eNumAdjust;}
     void            SetPrefix(const OUString& rSet) { sPrefix = rSet;}
     const OUString&   GetPrefix() const { return sPrefix;}


More information about the Libreoffice-commits mailing list