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

Miklos Vajna vmiklos at collabora.co.uk
Fri Oct 17 12:27:14 PDT 2014


 sw/source/filter/ww8/attributeoutputbase.hxx |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx |   82 ++++++++++++---------------
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 
 sw/source/filter/ww8/rtfattributeoutput.cxx  |    2 
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    2 
 sw/source/filter/ww8/wrtw8nds.cxx            |    2 
 sw/source/filter/ww8/ww8attributeoutput.hxx  |    2 
 7 files changed, 45 insertions(+), 49 deletions(-)

New commits:
commit 68c9515daf6648646788b70825ffa261e1fadf60
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Oct 17 21:26:08 2014 +0200

    pParagraphMarkerProperties can easily be a reference
    
    Change-Id: Ida4309aeb69bde43f70415211490db657c7c7567

diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 0a644c2..1dffa63 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -162,7 +162,7 @@ public:
     virtual void StartParagraphProperties() = 0;
 
     /// Called after we end outputting the attributes.
-    virtual void EndParagraphProperties(const SfxItemSet* pParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted) = 0;
+    virtual void EndParagraphProperties(const SfxItemSet& rParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted) = 0;
 
     /// Empty paragraph.
     virtual void EmptyParagraph() = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 02aa301..3ba8512 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -903,7 +903,7 @@ void lcl_writeParagraphMarkerProperties(DocxAttributeOutput& rAttributeOutput, c
     }
 }
 
-void DocxAttributeOutput::EndParagraphProperties( const SfxItemSet* pParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted)
+void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted)
 {
     // Call the 'Redline' function. This will add redline (change-tracking) information that regards to paragraph properties.
     // This includes changes like 'Bold', 'Underline', 'Strikethrough' etc.
@@ -920,52 +920,47 @@ void DocxAttributeOutput::EndParagraphProperties( const SfxItemSet* pParagraphMa
     m_pSerializer->mergeTopMarks( );
 
     // Write 'Paragraph Mark' properties
-    if ( pRedlineParagraphMarkerDeleted || pRedlineParagraphMarkerInserted || pParagraphMarkerProperties)
-    {
-        m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
-        // mark() before paragraph mark properties child elements.
-        InitCollectedRunProperties();
+    m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
+    // mark() before paragraph mark properties child elements.
+    InitCollectedRunProperties();
 
-        if(pParagraphMarkerProperties)
-        {
-            // The 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList' are used to hold information
-            // that should be collected by different properties in the core, and are all flushed together
-            // to the DOCX when the function 'WriteCollectedRunProperties' gets called.
-            // So we need to store the current status of these lists, so that we can revert back to them when
-            // we are done exporting the redline attributes.
-            ::sax_fastparser::FastAttributeList *pFontsAttrList_Original           = m_pFontsAttrList;
-            ::sax_fastparser::FastAttributeList *pEastAsianLayoutAttrList_Original = m_pEastAsianLayoutAttrList;
-            ::sax_fastparser::FastAttributeList *pCharLangAttrList_Original        = m_pCharLangAttrList;
-            m_pFontsAttrList           = NULL;
-            m_pEastAsianLayoutAttrList = NULL;
-            m_pCharLangAttrList        = NULL;
-
-            lcl_writeParagraphMarkerProperties(*this, *pParagraphMarkerProperties);
-
-            // Write the collected run properties that are stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
-            WriteCollectedRunProperties();
+    // The 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList' are used to hold information
+    // that should be collected by different properties in the core, and are all flushed together
+    // to the DOCX when the function 'WriteCollectedRunProperties' gets called.
+    // So we need to store the current status of these lists, so that we can revert back to them when
+    // we are done exporting the redline attributes.
+    ::sax_fastparser::FastAttributeList *pFontsAttrList_Original           = m_pFontsAttrList;
+    ::sax_fastparser::FastAttributeList *pEastAsianLayoutAttrList_Original = m_pEastAsianLayoutAttrList;
+    ::sax_fastparser::FastAttributeList *pCharLangAttrList_Original        = m_pCharLangAttrList;
+    m_pFontsAttrList           = NULL;
+    m_pEastAsianLayoutAttrList = NULL;
+    m_pCharLangAttrList        = NULL;
 
-            // Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
-            m_pFontsAttrList           = pFontsAttrList_Original;
-            m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original;
-            m_pCharLangAttrList        = pCharLangAttrList_Original;
-        }
-        if ( pRedlineParagraphMarkerDeleted )
-        {
-            StartRedline( pRedlineParagraphMarkerDeleted );
-            EndRedline( pRedlineParagraphMarkerDeleted );
-        }
-        if ( pRedlineParagraphMarkerInserted )
-        {
-            StartRedline( pRedlineParagraphMarkerInserted );
-            EndRedline( pRedlineParagraphMarkerInserted );
-        }
+    lcl_writeParagraphMarkerProperties(*this, rParagraphMarkerProperties);
 
-        // mergeTopMarks() after paragraph mark properties child elements.
-        m_pSerializer->mergeTopMarks();
-        m_pSerializer->endElementNS( XML_w, XML_rPr );
+    // Write the collected run properties that are stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
+    WriteCollectedRunProperties();
+
+    // Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
+    m_pFontsAttrList           = pFontsAttrList_Original;
+    m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original;
+    m_pCharLangAttrList        = pCharLangAttrList_Original;
+
+    if ( pRedlineParagraphMarkerDeleted )
+    {
+        StartRedline( pRedlineParagraphMarkerDeleted );
+        EndRedline( pRedlineParagraphMarkerDeleted );
+    }
+    if ( pRedlineParagraphMarkerInserted )
+    {
+        StartRedline( pRedlineParagraphMarkerInserted );
+        EndRedline( pRedlineParagraphMarkerInserted );
     }
 
+    // mergeTopMarks() after paragraph mark properties child elements.
+    m_pSerializer->mergeTopMarks();
+    m_pSerializer->endElementNS( XML_w, XML_rPr );
+
     if (!m_bWritingHeaderFooter && m_pCurrentFrame)
     {
         const SwFrmFmt& rFrmFmt = m_pCurrentFrame->GetFrmFmt();
@@ -5067,7 +5062,8 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
         // Write paragraph properties.
         StartParagraphProperties();
         aAttrIter.OutParaAttr(false);
-        EndParagraphProperties(0, 0, 0, 0);
+        SfxItemSet aParagraphMarkerProperties(m_rExport.pDoc->GetAttrPool());
+        EndParagraphProperties(aParagraphMarkerProperties, 0, 0, 0);
 
         do {
             const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 9fd636b..f373b86 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -168,7 +168,7 @@ public:
     virtual void StartParagraphProperties() SAL_OVERRIDE;
 
     /// Called after we end outputting the attributes.
-    virtual void EndParagraphProperties( const SfxItemSet* pParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted) SAL_OVERRIDE;
+    virtual void EndParagraphProperties(const SfxItemSet& rParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted) SAL_OVERRIDE;
 
     /// Start of the text run.
     virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false ) SAL_OVERRIDE;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 95c609e..bb0e6f5 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -385,7 +385,7 @@ void RtfAttributeOutput::StartParagraphProperties()
         m_aSectionHeaders.append(aPar.makeStringAndClear());
 }
 
-void RtfAttributeOutput::EndParagraphProperties(const SfxItemSet* /*pParagraphMarkerProperties*/, const SwRedlineData* /*pRedlineData*/, const SwRedlineData* /*pRedlineParagraphMarkerDeleted*/, const SwRedlineData* /*pRedlineParagraphMarkerInserted*/)
+void RtfAttributeOutput::EndParagraphProperties(const SfxItemSet& /*rParagraphMarkerProperties*/, const SwRedlineData* /*pRedlineData*/, const SwRedlineData* /*pRedlineParagraphMarkerDeleted*/, const SwRedlineData* /*pRedlineParagraphMarkerInserted*/)
 {
     m_aStyles.append(m_aStylesEnd.makeStringAndClear());
     m_rExport.Strm().WriteCharPtr(m_aStyles.makeStringAndClear().getStr());
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 87b23ee..a056849 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -59,7 +59,7 @@ public:
     virtual void StartParagraphProperties() SAL_OVERRIDE;
 
     /// Called after we end outputting the attributes.
-    virtual void EndParagraphProperties(const SfxItemSet* pParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted) SAL_OVERRIDE;
+    virtual void EndParagraphProperties(const SfxItemSet& rParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted) SAL_OVERRIDE;
 
     /// Start of the text run.
     virtual void StartRun(const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false) SAL_OVERRIDE;
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 549c79c..155c069 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2733,7 +2733,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
     const SwRedlineData* pRedlineParagraphMarkerDelete = AttrOutput().GetParagraphMarkerRedline( rNode, nsRedlineType_t::REDLINE_DELETE );
     const SwRedlineData* pRedlineParagraphMarkerInsert = AttrOutput().GetParagraphMarkerRedline( rNode, nsRedlineType_t::REDLINE_INSERT );
     const SwRedlineData* pParagraphRedlineData = aAttrIter.GetParagraphLevelRedline( );
-    AttrOutput().EndParagraphProperties(&aParagraphMarkerProperties, pParagraphRedlineData, pRedlineParagraphMarkerDelete, pRedlineParagraphMarkerInsert);
+    AttrOutput().EndParagraphProperties(aParagraphMarkerProperties, pParagraphRedlineData, pRedlineParagraphMarkerDelete, pRedlineParagraphMarkerInsert);
 
     AttrOutput().EndParagraph( pTextNodeInfoInner );
 
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 5074c96..8e7041b 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -42,7 +42,7 @@ public:
     virtual void StartParagraphProperties() SAL_OVERRIDE {}
 
     /// Called after we end outputting the attributes.
-    virtual void EndParagraphProperties( const SfxItemSet* /*pParagraphMarkerProperties*/, const SwRedlineData* /*pRedlineData*/, const SwRedlineData* /*pRedlineParagraphMarkerDeleted*/, const SwRedlineData* /*pRedlineParagraphMarkerInserted*/) SAL_OVERRIDE {}
+    virtual void EndParagraphProperties(const SfxItemSet& /*rParagraphMarkerProperties*/, const SwRedlineData* /*pRedlineData*/, const SwRedlineData* /*pRedlineParagraphMarkerDeleted*/, const SwRedlineData* /*pRedlineParagraphMarkerInserted*/) SAL_OVERRIDE {}
 
     /// Empty paragraph.
     virtual void EmptyParagraph() SAL_OVERRIDE;


More information about the Libreoffice-commits mailing list