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

Michael Stahl mstahl at redhat.com
Wed Aug 28 14:34:34 PDT 2013


 editeng/source/items/numitem.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 4b798d89a55714218dc9a7de161f93f9c4d6fc80
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Aug 28 23:19:43 2013 +0200

    fdo#68648: SvxNumRule: serialize the aFmtsSet flags too
    
    The constructor of SvxNumRule initializes aFmts[i] with a format but
    always sets aFmtsSet[i] to false, so SvxNumRule::Store()
    and SvxNumRule::SvxNumRule(SvStream &rStream) need to be able
    to round-trip that combination to prevent spurious numberings.
    
    It is unlikely that this class is serialized in the table auto-format
    files but i haven't checked; this change does not change the size of the
    serialization so shouldn't cause trouble anyway.
    
    (regression from a95cce27295f9cd255fa72eaded00972e3efb69b)
    
    Change-Id: I589ea108ac069624aaa7b26cdc3bfe8182b15851

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 1a9e800..e4684d8 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -693,15 +693,15 @@ SvxNumRule::SvxNumRule( SvStream &rStream )
     for (sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
     {
         rStream >> nTmp16;
-        sal_Bool hasNumberingFormat = nTmp16;
+        sal_Bool hasNumberingFormat = nTmp16 & 1;
+        aFmtsSet[i] = nTmp16 & 2; // fdo#68648 reset flag
         if ( hasNumberingFormat ){
             aFmts[i] = new SvxNumberFormat( rStream );
-            aFmtsSet[i] = sal_True;
         }
         else
         {
             aFmts[i] = 0;
-            aFmtsSet[i] = sal_False;
+            aFmtsSet[i] = sal_False; // actually only false is valid
         }
     }
     //second nFeatureFlags for new versions
@@ -726,9 +726,10 @@ SvStream& SvxNumRule::Store( SvStream &rStream )
     sal_Bool bConvertBulletFont = ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_50 ) && ( rStream.GetVersion() );
     for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
     {
+        sal_uInt16 nSetFlag(aFmtsSet[i] ? 2 : 0); // fdo#68648 store that too
         if(aFmts[i])
         {
-            rStream << sal_uInt16(1);
+            rStream << sal_uInt16(1 | nSetFlag);
             if(bConvertBulletFont && aFmts[i]->GetBulletFont())
             {
                 if(!pConverter)
@@ -739,7 +740,7 @@ SvStream& SvxNumRule::Store( SvStream &rStream )
             aFmts[i]->Store(rStream, pConverter);
         }
         else
-            rStream << sal_uInt16(0);
+            rStream << sal_uInt16(0 | nSetFlag);
     }
     //second save of nFeatureFlags for new versions
     rStream<<(sal_uInt16)nFeatureFlags;


More information about the Libreoffice-commits mailing list