[Libreoffice-commits] core.git: 4 commits - sw/inc sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Sun Dec 28 10:26:27 PST 2014


 sw/inc/fmtclds.hxx                               |    4 ++
 sw/inc/fmtfollowtextflow.hxx                     |    2 +
 sw/inc/fmtwrapinfluenceonobjpos.hxx              |    2 +
 sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx |    9 ++++++
 sw/source/core/bastyp/init.cxx                   |    3 --
 sw/source/core/docnode/nodedump.cxx              |   28 +++++++-------------
 sw/source/core/layout/atrfrm.cxx                 |   32 +++++++++++++++++++++++
 sw/source/uibase/utlui/attrdesc.cxx              |    9 ++++++
 writerfilter/source/filter/RtfFilter.cxx         |    9 ++----
 9 files changed, 74 insertions(+), 24 deletions(-)

New commits:
commit 337aa303284b42c4fb13bff4beffdcf445a715cd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Dec 28 18:43:54 2014 +0100

    Factor out SwFmtCol::dumpAsXml() from docnode
    
    Change-Id: Ic41b981c989aec658e95889b72bd76ecacb13a9a

diff --git a/sw/inc/fmtclds.hxx b/sw/inc/fmtclds.hxx
index 3370a98..a98e39f 100644
--- a/sw/inc/fmtclds.hxx
+++ b/sw/inc/fmtclds.hxx
@@ -54,6 +54,8 @@ public:
     sal_uInt16 GetLower() const { return nLower; }
     sal_uInt16 GetLeft () const { return nLeft; }
     sal_uInt16 GetRight() const { return nRight; }
+
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 typedef boost::ptr_vector<SwColumn> SwColumns;
@@ -160,6 +162,8 @@ public:
     /** As above except that it @return the width of PrtArea -
      that corresponds to what constitutes the column for the user. */
     sal_uInt16 CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const;
+
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 inline const SwFmtCol &SwAttrSet::GetCol(bool bInP) const
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index a3771f0..8ebd230 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -449,6 +449,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case RES_WRAP_INFLUENCE_ON_OBJPOS:
                 static_cast<const SwFmtWrapInfluenceOnObjPos*>(pItem)->dumpAsXml(writer);
                 break;
+            case RES_COL:
+                static_cast<const SwFmtCol*>(pItem)->dumpAsXml(writer);
+                break;
             default: bDone = false; break;
         }
         if (bDone)
@@ -506,13 +509,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case XATTR_FILLBMP_STRETCH:
                 pWhich = "fill bitmap stretch";
                 break;
-            case RES_COL:
-            {
-                pWhich = "columns formatting";
-                const SwFmtCol* pFmtCol = static_cast<const SwFmtCol*>(pItem);
-                oValue = "number of columns: " + OString::number(pFmtCol->GetColumns().size());
-                break;
-            }
             case RES_PROTECT:
                 pWhich = "protect";
                 break;
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 9da00f2..a0f0bd2 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -790,6 +790,17 @@ bool SwColumn::operator==( const SwColumn &rCmp ) const
             GetLower() == rCmp.GetLower();
 }
 
+void SwColumn::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swColumn"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWish"), BAD_CAST(OString::number(nWish).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nUpper"), BAD_CAST(OString::number(nUpper).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLower"), BAD_CAST(OString::number(nLower).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLeft"), BAD_CAST(OString::number(nLeft).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nRight"), BAD_CAST(OString::number(nRight).getStr()));
+    xmlTextWriterEndElement(pWriter);
+}
+
 SwFmtCol::SwFmtCol( const SwFmtCol& rCpy )
     : SfxPoolItem( RES_COL ),
     m_eLineStyle( rCpy.m_eLineStyle ),
@@ -1116,6 +1127,27 @@ bool SwFmtCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     return bRet;
 }
 
+void SwFmtCol::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swFmtCol"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eLineStyle"), BAD_CAST(OString::number(m_eLineStyle).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLineWidth"), BAD_CAST(OString::number(m_nLineWidth).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aLineColor"), BAD_CAST(m_aLineColor.AsRGBHexString().toUtf8().getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLineHeight"), BAD_CAST(OString::number(m_nLineHeight).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eAdj"), BAD_CAST(OString::number(m_eAdj).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidth"), BAD_CAST(OString::number(m_nWidth).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidthAdjustValue"), BAD_CAST(OString::number(m_aWidthAdjustValue).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bOrtho"), BAD_CAST(OString::boolean(m_bOrtho).getStr()));
+
+    xmlTextWriterStartElement(pWriter, BAD_CAST("aColumns"));
+    for (const SwColumn& rColumn : m_aColumns)
+        rColumn.dumpAsXml(pWriter);
+    xmlTextWriterEndElement(pWriter);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 // Partially implemented inline in hxx
 SwFmtSurround::SwFmtSurround( SwSurround eFly ) :
     SfxEnumItem( RES_SURROUND, sal_uInt16( eFly ) )
commit daebeae541d354c36e42434411e64755c70329e3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Dec 28 18:22:27 2014 +0100

    Factor out SwFmtWrapInfluenceOnObjPos::dumpAsXml() from docnode
    
    Change-Id: I8c52801178c5cf80398a19ebe40d336c69db8065

diff --git a/sw/inc/fmtwrapinfluenceonobjpos.hxx b/sw/inc/fmtwrapinfluenceonobjpos.hxx
index 046f09d..0e70e3b 100644
--- a/sw/inc/fmtwrapinfluenceonobjpos.hxx
+++ b/sw/inc/fmtwrapinfluenceonobjpos.hxx
@@ -56,6 +56,8 @@ public:
     /// to control, if value <ITERATIVE> has to be treated as <ONCE_CONCURRENT>
     sal_Int16 GetWrapInfluenceOnObjPos(
                         const bool _bIterativeAsOnceConcurrent = false ) const;
+
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 inline const SwFmtWrapInfluenceOnObjPos& SwAttrSet::GetWrapInfluenceOnObjPos(bool bInP) const
diff --git a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
index 067cd57..0224f4f 100644
--- a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
+++ b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
@@ -20,6 +20,7 @@
 #include <fmtwrapinfluenceonobjpos.hxx>
 #include <unomid.h>
 #include <osl/diagnose.h>
+#include <libxml/xmlwriter.h>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -138,4 +139,12 @@ sal_Int16 SwFmtWrapInfluenceOnObjPos::GetWrapInfluenceOnObjPos(
     return nWrapInfluenceOnPosition;
 }
 
+void SwFmtWrapInfluenceOnObjPos::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swFmtWrapInfluenceOnObjPos"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWrapInfluenceOnPosition"), BAD_CAST(OString::number(mnWrapInfluenceOnPosition).getStr()));
+    xmlTextWriterEndElement(pWriter);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index a8cd5a0..6d5454f 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -612,8 +612,7 @@ void _InitCore()
     aAttrTab[ RES_COLLAPSING_BORDERS - POOLATTR_BEGIN ] =   new SfxBoolItem( RES_COLLAPSING_BORDERS, false );
     // #i28701#
     // #i35017# - constant name has changed
-    aAttrTab[ RES_WRAP_INFLUENCE_ON_OBJPOS - POOLATTR_BEGIN ] =
-            new SwFmtWrapInfluenceOnObjPos( text::WrapInfluenceOnPosition::ONCE_CONCURRENT );
+    aAttrTab[ RES_WRAP_INFLUENCE_ON_OBJPOS - POOLATTR_BEGIN ] = new SwFmtWrapInfluenceOnObjPos( text::WrapInfluenceOnPosition::ONCE_CONCURRENT );
 
     aAttrTab[ RES_AUTO_STYLE - POOLATTR_BEGIN ] =           new SwFmtAutoFmt( RES_AUTO_STYLE );
     aAttrTab[ RES_FRMATR_STYLE_NAME - POOLATTR_BEGIN ] =    new SfxStringItem( RES_FRMATR_STYLE_NAME, OUString());
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 1d54236..a3771f0 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -37,6 +37,7 @@
 #include "pagedesc.hxx"
 #include "fchrfmt.hxx"
 #include "fmtfollowtextflow.hxx"
+#include "fmtwrapinfluenceonobjpos.hxx"
 #include <swmodule.hxx>
 #include <svl/itemiter.hxx>
 #include <svl/intitem.hxx>
@@ -445,6 +446,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case RES_FOLLOW_TEXT_FLOW:
                 static_cast<const SwFmtFollowTextFlow*>(pItem)->dumpAsXml(writer);
                 break;
+            case RES_WRAP_INFLUENCE_ON_OBJPOS:
+                static_cast<const SwFmtWrapInfluenceOnObjPos*>(pItem)->dumpAsXml(writer);
+                break;
             default: bDone = false; break;
         }
         if (bDone)
@@ -459,11 +463,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
         boost::optional<OString> oValue;
         switch (pItem->Which())
         {
-            case RES_WRAP_INFLUENCE_ON_OBJPOS:
-            {
-                pWhich = "frame wrap influence on object position";
-                break;
-            }
             case XATTR_FILLSTYLE:
             {
                 pWhich = "fill style";
commit d5ac1754bac8f81cb51adac82167bca9e9aa61af
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Dec 28 18:12:21 2014 +0100

    Factor out SwFmtFollowTextFlow::dumpAsXml() from core
    
    Change-Id: Iafd2db5d878857c517e79f84b8c9c6a806ccfe4b

diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx
index a0dcf6e..06cd43d 100644
--- a/sw/inc/fmtfollowtextflow.hxx
+++ b/sw/inc/fmtfollowtextflow.hxx
@@ -41,6 +41,8 @@ public:
                                     SfxMapUnit ePresMetric,
                                     OUString &rText,
                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
+
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 inline const SwFmtFollowTextFlow &SwAttrSet::GetFollowTextFlow(bool bInP) const
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 7078fc5..1d54236 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -36,6 +36,7 @@
 #include "fmtpdsc.hxx"
 #include "pagedesc.hxx"
 #include "fchrfmt.hxx"
+#include "fmtfollowtextflow.hxx"
 #include <swmodule.hxx>
 #include <svl/itemiter.hxx>
 #include <svl/intitem.hxx>
@@ -441,6 +442,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case RES_SURROUND:
                 static_cast<const SwFmtSurround*>(pItem)->dumpAsXml(writer);
                 break;
+            case RES_FOLLOW_TEXT_FLOW:
+                static_cast<const SwFmtFollowTextFlow*>(pItem)->dumpAsXml(writer);
+                break;
             default: bDone = false; break;
         }
         if (bDone)
@@ -455,11 +459,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
         boost::optional<OString> oValue;
         switch (pItem->Which())
         {
-            case RES_FOLLOW_TEXT_FLOW:
-            {
-                pWhich = "frame follow text flow";
-                break;
-            }
             case RES_WRAP_INFLUENCE_ON_OBJPOS:
             {
                 pWhich = "frame wrap influence on object position";
diff --git a/sw/source/uibase/utlui/attrdesc.cxx b/sw/source/uibase/utlui/attrdesc.cxx
index 52a04ad..26ca490 100644
--- a/sw/source/uibase/utlui/attrdesc.cxx
+++ b/sw/source/uibase/utlui/attrdesc.cxx
@@ -55,6 +55,7 @@
 #include <attrdesc.hrc>
 #include <fmtftntx.hxx>
 #include <fmtfollowtextflow.hxx>
+#include <libxml/xmlwriter.h>
 
 using namespace com::sun::star;
 
@@ -834,4 +835,12 @@ bool SwFmtFollowTextFlow::GetPresentation( SfxItemPresentation ePres,
     return true;
 }
 
+void SwFmtFollowTextFlow::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swFmtFollowTextFlow"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(GetValue()).getStr()));
+    xmlTextWriterEndElement(pWriter);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e9d0ad432aea1987c7cb37264908c53a9cf206b7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Dec 28 12:43:30 2014 +0100

    RtfFilter::filter: don't leak pIn
    
    Change-Id: I2510cd7faa48c0287498bdbc2511e29dbc62860a

diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index cd55a85..186b904 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -25,7 +25,7 @@
 #include <rtftok/RTFDocument.hxx>
 #include <com/sun/star/io/WrongFormatException.hpp>
 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
-#include <osl/diagnose.h>
+#include <memory>
 #include <unotools/localfilehelper.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/streamwrap.hxx>
@@ -77,10 +77,9 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescrip
         OUString aOutStr;
         if (!bIsNewDoc && pEnv && utl::LocalFileHelper::ConvertPhysicalNameToURL(OUString::fromUtf8(pEnv), aOutStr))
         {
-            SvStream* pOut = utl::UcbStreamHelper::CreateStream(aOutStr, STREAM_WRITE);
-            SvStream* pIn = utl::UcbStreamHelper::CreateStream(xInputStream);
+            std::unique_ptr<SvStream> pOut(utl::UcbStreamHelper::CreateStream(aOutStr, STREAM_WRITE));
+            std::unique_ptr<SvStream> pIn(utl::UcbStreamHelper::CreateStream(xInputStream));
             pOut->WriteStream(*pIn);
-            delete pOut;
             return true;
         }
 
@@ -109,7 +108,7 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescrip
         pDocument->resolve(*pStream);
         bResult = true;
         sal_uInt32 nEndTime = osl_getGlobalTimer();
-        SAL_INFO("writerfilter.profile", OSL_THIS_FUNC << " finished in " << nEndTime - nStartTime << " ms");
+        SAL_INFO("writerfilter.profile", "RtfFilter::filter: finished in " << nEndTime - nStartTime << " ms");
     }
     catch (const io::WrongFormatException& e)
     {


More information about the Libreoffice-commits mailing list