Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3479

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/79/3479/1

fix fdo#47018 Impress pasting destroy bullet

Implements the attributes loading from SvStream in pasting.

This is a modification of commit a95cce27295f9cd255fa72eaded00972e3efb69b
which has been reverted in commit 98d594abd42c5aa33d6981f4dd19582c2d345705
due to unnecessary change in editeng/source/items/frmitems.cxx

Change-Id: I11ba65f8a4972ab1a6d4f30337a0a779f22cdd35
---
M editeng/inc/editeng/numitem.hxx
M editeng/source/items/numitem.cxx
2 files changed, 106 insertions(+), 28 deletions(-)



diff --git a/editeng/inc/editeng/numitem.hxx b/editeng/inc/editeng/numitem.hxx
index 86f4aef..546f82d 100644
--- a/editeng/inc/editeng/numitem.hxx
+++ b/editeng/inc/editeng/numitem.hxx
@@ -157,10 +157,12 @@
     explicit SvxNumberFormat( sal_Int16 nNumberingType,
                      SvxNumPositionAndSpaceMode ePositionAndSpaceMode = LABEL_WIDTH_AND_POSITION );
     SvxNumberFormat(const SvxNumberFormat& rFormat);
+    SvxNumberFormat( SvStream & rStream );
 
     virtual ~SvxNumberFormat();
 
-    SvStream&       Store(SvStream &rStream, FontToSubsFontConverter pConverter);
+    SvStream&       Store(SvStream &rStream);
+    SvxNumberFormat* Create(SvStream& rStream );
 
     SvxNumberFormat& operator=( const SvxNumberFormat&  );
     sal_Bool            operator==( const SvxNumberFormat&  ) const;
@@ -252,6 +254,7 @@
                         eDefaultNumberFormatPositionAndSpaceMode
                                 = SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
     SvxNumRule(const SvxNumRule& rCopy);
+    SvxNumRule(SvStream &rStream);
     virtual ~SvxNumRule();
 
     int                     operator==( const SvxNumRule& ) const;
@@ -260,7 +263,7 @@
     SvxNumRule&             operator=( const SvxNumRule&  );
 
     SvStream&               Store(SvStream &rStream);
-
+    SvxNumRule*             Create(SvStream &rStream);
     const SvxNumberFormat*  Get(sal_uInt16 nLevel)const;
     const SvxNumberFormat&  GetLevel(sal_uInt16 nLevel)const;
     void                    SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, sal_Bool 
bIsValid = sal_True);
@@ -294,9 +297,9 @@
     virtual ~SvxNumBulletItem();
 
     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const;
-    virtual SfxPoolItem*     Create(SvStream &, sal_uInt16) const;
+    virtual SfxPoolItem*     Create(SvStream &rStream, sal_uInt16 nItemVersion) const;
     sal_uInt16  GetVersion( sal_uInt16 nFileVersion ) const;
-    virtual SvStream&        Store(SvStream &, sal_uInt16 nItemVersion ) const;
+    virtual SvStream&        Store(SvStream &rStream, sal_uInt16 nItemVersion ) const;
     virtual int              operator==( const SfxPoolItem& ) const;
 
     SvxNumRule*             GetNumRule() const {return pNumRule;}
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 7c3ec9c..32b0d96 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -28,6 +28,7 @@
 #include <editeng/editids.hrc>
 #include <editeng/editrids.hrc>
 #include <editeng/numdef.hxx>
+#include <editeng/eeitem.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/window.hxx>
 #include <vcl/svapp.hxx>
@@ -177,21 +178,67 @@
     *this = rFormat;
 }
 
+SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
+{
+    sal_uInt16 nTmp16;
+    sal_Int32  nTmp32;
+    rStream >> nTmp16; // Version number
+
+    rStream >> nTmp16; SetNumberingType( nTmp16 );
+    rStream >> nTmp16; eNumAdjust = ( SvxAdjust )nTmp16;
+    rStream >> nTmp16; nInclUpperLevels = nTmp16;
+    rStream >> nStart;
+    rStream >> nTmp16; cBullet = (sal_Unicode)nTmp16;
+
+    rStream >> nFirstLineOffset;
+    rStream >> nAbsLSpace;
+    rStream >> nLSpace;
+
+    rStream >> nCharTextDistance;
+
+    sPrefix = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
+    sSuffix = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
+    sCharStyleName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
+
+    sal_uInt16 hasGraphicBrush = 0;
+    rStream >> hasGraphicBrush;
+    if ( hasGraphicBrush )
+    {
+        pGraphicBrush = new SvxBrushItem( SID_ATTR_BRUSH );
+        pGraphicBrush = (SvxBrushItem*)(pGraphicBrush->Create( rStream, BRUSH_GRAPHIC_VERSION ));
+    }
+    else pGraphicBrush = 0;
+    rStream >> nTmp16; eVertOrient = nTmp16;
+
+    sal_uInt16 hasBulletFont = 0;
+    rStream >> hasBulletFont;
+    if ( hasBulletFont )
+    {
+        pBulletFont = new Font( );
+        rStream >> *pBulletFont;
+    }
+    else pBulletFont = NULL;
+    rStream >> aGraphicSize;
+
+    rStream >> nBulletColor;
+    rStream >> nBulletRelSize;
+    rStream >> nTmp16; SetShowSymbol( nTmp16 );
+
+    rStream >> nTmp16; mePositionAndSpaceMode = ( SvxNumPositionAndSpaceMode )nTmp16;
+    rStream >> nTmp16; meLabelFollowedBy = ( LabelFollowedBy )nTmp16;
+    rStream >> nTmp32; mnListtabPos = nTmp32;
+    rStream >> nTmp32; mnFirstLineIndent = nTmp32;
+    rStream >> nTmp32; mnIndentAt = nTmp32;
+
+}
 SvxNumberFormat::~SvxNumberFormat()
 {
     delete pGraphicBrush;
     delete pBulletFont;
 }
 
-SvStream&   SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter)
+SvStream&   SvxNumberFormat::Store(SvStream &rStream)
 {
-    if(pConverter && pBulletFont)
-    {
-        cBullet = ConvertFontToSubsFontChar(pConverter, cBullet);
-        String sFontName = GetFontToSubsFontName(pConverter);
-        pBulletFont->SetName(sFontName);
-    }
-
     rStream << (sal_uInt16)NUMITEM_VERSION_04;
 
     rStream << (sal_uInt16)GetNumberingType();
@@ -251,6 +298,11 @@
     rStream << ( sal_Int32 ) mnIndentAt;
 
     return rStream;
+}
+
+SvxNumberFormat* SvxNumberFormat::Create( SvStream &rStream )
+{
+    return new SvxNumberFormat( rStream );
 }
 
 SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
@@ -621,7 +673,41 @@
     }
 }
 
-SvStream&   SvxNumRule::Store(SvStream &rStream)
+SvxNumRule::SvxNumRule( SvStream &rStream )
+{
+    sal_uInt16 nTmp16;
+    rStream >> nTmp16; // NUM_ITEM_VERSION
+    rStream >> nLevelCount;
+
+    // first nFeatureFlags of old Versions
+    rStream >> nTmp16; nFeatureFlags = nTmp16;
+    rStream >> nTmp16; bContinuousNumbering = nTmp16;
+    rStream >> nTmp16; eNumberingType = ( SvxNumRuleType )nTmp16;
+
+    for (sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
+    {
+        rStream >> nTmp16;
+        sal_Bool hasNumberingFormat = nTmp16;
+        if ( hasNumberingFormat ){
+            aFmts[i] = new SvxNumberFormat( rStream );
+            aFmtsSet[i] = sal_True;
+        }
+        else
+        {
+            aFmts[i] = 0;
+            aFmtsSet[i] = sal_False;
+        }
+    }
+    //second nFeatureFlags for new versions
+    rStream >> nTmp16; nFeatureFlags = nTmp16;
+}
+
+SvxNumRule* SvxNumRule::Create( SvStream & rStream )
+{
+    return new SvxNumRule( rStream );
+}
+
+SvStream& SvxNumRule::Store( SvStream &rStream )
 {
     rStream<<(sal_uInt16)NUMITEM_VERSION_03;
     rStream<<nLevelCount;
@@ -630,33 +716,21 @@
     rStream<<(sal_uInt16)bContinuousNumbering;
     rStream<<(sal_uInt16)eNumberingType;
 
-    FontToSubsFontConverter pConverter = 0;
-    sal_Bool bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50;
     for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
     {
         if(aFmts[i])
         {
             rStream << sal_uInt16(1);
-            if(bConvertBulletFont && aFmts[i]->GetBulletFont())
-            {
-                if(!pConverter)
-                    pConverter =
-                        CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetName(),
-                                    FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS);
-            }
-            aFmts[i]->Store(rStream, pConverter);
+            aFmts[i]->Store(rStream);
         }
         else
             rStream << sal_uInt16(0);
     }
     //second save of nFeatureFlags for new versions
     rStream<<(sal_uInt16)nFeatureFlags;
-    if(pConverter)
-        DestroyFontToSubsFontConverter(pConverter);
 
     return rStream;
 }
-
 SvxNumRule::~SvxNumRule()
 {
     for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
@@ -843,9 +917,10 @@
 {
 }
 
-SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, sal_uInt16 n) const
+SfxPoolItem* SvxNumBulletItem::Create(SvStream &rStream, sal_uInt16 /*nItemVersion*/ ) const
 {
-    return SfxPoolItem::Create(s, n );
+    SvxNumRule aNumRule( rStream );
+    return new SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET );
 }
 
 SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) :

-- 
To view, visit https://gerrit.libreoffice.org/3479
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11ba65f8a4972ab1a6d4f30337a0a779f22cdd35
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Cao Cuong Ngo <cao.cuong.ngo@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.