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

Matteo Casalin matteo.casalin at yahoo.com
Thu Jul 9 00:24:39 PDT 2015


 sw/source/filter/ww8/docxattributeoutput.cxx |   41 +++++++++++++++++++++------
 sw/source/filter/ww8/docxattributeoutput.hxx |    4 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx  |   13 +++++---
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    2 -
 4 files changed, 45 insertions(+), 15 deletions(-)

New commits:
commit 96b264edf2765e9d1893757d1f1f7c718b1df36d
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Jul 9 09:19:44 2015 +0200

    These functions and data can be local
    
    Change-Id: Ife2351bc8f0a3ee261b525aeb4e8e254174a42a0

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 9a17f98..ddad776 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -890,6 +890,9 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties()
     }
 }
 
+namespace
+{
+
 /// Outputs an item set, that contains the formatting of the paragraph marker.
 void lcl_writeParagraphMarkerProperties(DocxAttributeOutput& rAttributeOutput, const SfxItemSet& rParagraphMarkerProperties)
 {
@@ -921,6 +924,8 @@ void lcl_writeParagraphMarkerProperties(DocxAttributeOutput& rAttributeOutput, c
     }
 }
 
+}
+
 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.
@@ -3086,6 +3091,9 @@ void DocxAttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t /*
 {
 }
 
+namespace
+{
+
 /// Does the same as comphelper::string::padToLength(), but extends the start, not the end.
 OString lcl_padStartToLength(OString const & aString, sal_Int32 nLen, sal_Char cFill)
 {
@@ -3101,6 +3109,8 @@ OString lcl_padStartToLength(OString const & aString, sal_Int32 nLen, sal_Char c
         return aString;
 }
 
+}
+
 void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
     bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
@@ -3715,6 +3725,9 @@ sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, const OUString& rN
     return 0;
 }
 
+namespace
+{
+
 DocxStringTokenMap const aDefaultTokens[] = {
     {"defQFormat", XML_defQFormat},
     {"defUnhideWhenUsed", XML_defUnhideWhenUsed},
@@ -3735,6 +3748,8 @@ DocxStringTokenMap const aExceptionTokens[] = {
     {0, 0}
 };
 
+}
+
 void DocxAttributeOutput::LatentStyles()
 {
     // Do we have latent styles available?
@@ -3787,6 +3802,9 @@ void DocxAttributeOutput::LatentStyles()
     m_pSerializer->endElementNS(XML_w, XML_latentStyles);
 }
 
+namespace
+{
+
 /// Should the font size we have written out as a default one?
 bool lcl_isDefaultFontSize(const SvxFontHeightItem& rFontHeight, SwDoc* pDoc)
 {
@@ -3802,6 +3820,8 @@ bool lcl_isDefaultFontSize(const SvxFontHeightItem& rFontHeight, SwDoc* pDoc)
     return bRet;
 }
 
+}
+
 void DocxAttributeOutput::OutputDefaultItem(const SfxPoolItem& rHt)
 {
     bool bMustWrite = true;
@@ -5319,6 +5339,9 @@ void DocxAttributeOutput::EndStyleProperties( bool bParProp )
     }
 }
 
+namespace
+{
+
 void lcl_OutlineLevel(sax_fastparser::FSHelperPtr pSerializer, sal_uInt16 nLevel)
 {
     if (nLevel >= WW8ListManager::nMaxLevel)
@@ -5329,6 +5352,8 @@ void lcl_OutlineLevel(sax_fastparser::FSHelperPtr pSerializer, sal_uInt16 nLevel
             FSEND);
 }
 
+}
+
 void DocxAttributeOutput::OutlineNumbering(sal_uInt8 const nLvl)
 {
     lcl_OutlineLevel(m_pSerializer, nLvl);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 9d164f8..7ba1699 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1547,6 +1547,9 @@ void RtfAttributeOutput::WriteHeaderFooter_Impl(const SwFrameFormat& rFormat, bo
     m_aRun = aRun;
 }
 
+namespace
+{
+
 void lcl_TextFrameShadow(std::vector< std::pair<OString, OString> >& rFlyProperties, const SwFrameFormat& rFrameFormat)
 {
     SvxShadowItem aShadowItem = rFrameFormat.GetShadow();
@@ -1630,6 +1633,8 @@ void lcl_TextFrameRelativeSize(std::vector< std::pair<OString, OString> >& rFlyP
     }
 }
 
+}
+
 void RtfAttributeOutput::writeTextFrame(const sw::Frame& rFrame, bool bTextBox)
 {
     RtfStringBuffer aRunText;
commit 75d0b1ecd914ee06f51621983671da70d0e183fa
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Jul 9 08:46:42 2015 +0200

    Do not downcast opened bookmarks, neither (and just in case)
    
    Change-Id: I603940c64a1580a73c4f5c59b403caecd0ac75a5

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5b022d8..9a17f98 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1295,7 +1295,7 @@ void DocxAttributeOutput::DoWriteBookmarks()
         const OString& rName = *it;
 
         // Output the bookmark
-        sal_uInt16 nId = m_nNextBookmarkId++;
+        const sal_Int32 nId = m_nNextBookmarkId++;
         m_rOpenedBookmarksIds[rName] = nId;
         m_pSerializer->singleElementNS( XML_w, XML_bookmarkStart,
             FSNS( XML_w, XML_id ), OString::number( nId ).getStr(  ),
@@ -1312,7 +1312,7 @@ void DocxAttributeOutput::DoWriteBookmarks()
         const OString& rName = *it;
 
         // Get the id of the bookmark
-        std::map< OString, sal_uInt16 >::iterator pPos = m_rOpenedBookmarksIds.find( rName );
+        std::map< OString, sal_Int32 >::iterator pPos = m_rOpenedBookmarksIds.find( rName );
         if ( pPos != m_rOpenedBookmarksIds.end(  ) )
         {
             const sal_Int32 nId = ( *pPos ).second;
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index c0cf834..6c2a63c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -776,7 +776,7 @@ private:
     std::vector<OString> m_rAnnotationMarksEnd;
 
     /// Maps of the bookmarks ids
-    std::map<OString, sal_uInt16> m_rOpenedBookmarksIds;
+    std::map<OString, sal_Int32> m_rOpenedBookmarksIds;
 
     /// Name of the last opened bookmark.
     OString m_sLastOpenedBookmark;
commit db9e64c2a499c1c3da9d3c1b4e123af04f937933
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Jul 9 08:21:06 2015 +0200

    Better support more than 65k annotations
    
    There isn't really a limit for the annotation count in the RTF/DOCX spec.
    Thanks Miklos for hints on this.
    
    Change-Id: Ib4493b518acb3cabe04312c37b5c6a9c6072cb7e

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7d4fc73..5b022d8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1315,7 +1315,7 @@ void DocxAttributeOutput::DoWriteBookmarks()
         std::map< OString, sal_uInt16 >::iterator pPos = m_rOpenedBookmarksIds.find( rName );
         if ( pPos != m_rOpenedBookmarksIds.end(  ) )
         {
-            sal_uInt16 nId = ( *pPos ).second;
+            const sal_Int32 nId = ( *pPos ).second;
             m_pSerializer->singleElementNS( XML_w, XML_bookmarkEnd,
                 FSNS( XML_w, XML_id ), OString::number( nId ).getStr(  ),
                 FSEND );
@@ -1341,7 +1341,7 @@ void DocxAttributeOutput::DoWriteAnnotationMarks()
         */
         if ( m_rOpenedAnnotationMarksIds.end() == m_rOpenedAnnotationMarksIds.find( rName ) )
         {
-            sal_uInt16 nId = m_nNextAnnotationMarkId++;
+            const sal_Int32 nId = m_nNextAnnotationMarkId++;
             m_rOpenedAnnotationMarksIds[rName] = nId;
             m_pSerializer->singleElementNS( XML_w, XML_commentRangeStart,
                 FSNS( XML_w, XML_id ), OString::number( nId ).getStr(  ),
@@ -1358,10 +1358,10 @@ void DocxAttributeOutput::DoWriteAnnotationMarks()
         const OString& rName = *it;
 
         // Get the id of the annotation mark
-        std::map< OString, sal_uInt16 >::iterator pPos = m_rOpenedAnnotationMarksIds.find( rName );
+        std::map< OString, sal_Int32 >::iterator pPos = m_rOpenedAnnotationMarksIds.find( rName );
         if ( pPos != m_rOpenedAnnotationMarksIds.end(  ) )
         {
-            sal_uInt16 nId = ( *pPos ).second;
+            const sal_Int32 nId = ( *pPos ).second;
             m_pSerializer->singleElementNS( XML_w, XML_commentRangeEnd,
                 FSNS( XML_w, XML_id ), OString::number( nId ).getStr(  ),
                 FSEND );
@@ -6528,7 +6528,7 @@ void DocxAttributeOutput::PostitField( const SwField* pField )
     const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField);
     OString aName = OUStringToOString(pPostItField->GetName(), RTL_TEXTENCODING_UTF8);
     sal_Int32 nId = 0;
-    std::map< OString, sal_uInt16 >::iterator it = m_rOpenedAnnotationMarksIds.find(aName);
+    std::map< OString, sal_Int32 >::iterator it = m_rOpenedAnnotationMarksIds.find(aName);
     if (it != m_rOpenedAnnotationMarksIds.end())
         // If the postit field has an annotation mark associated, we already have an id.
         nId = it->second;
@@ -6547,7 +6547,7 @@ void DocxAttributeOutput::WritePostitFieldReference()
         // In case this file is inside annotation marks, we want to write the
         // comment reference after the annotation mark is closed, not here.
         OString idname = OUStringToOString(m_postitFields[m_postitFieldsMaxId].first->GetName(), RTL_TEXTENCODING_UTF8);
-        std::map< OString, sal_uInt16 >::iterator it = m_rOpenedAnnotationMarksIds.find( idname );
+        std::map< OString, sal_Int32 >::iterator it = m_rOpenedAnnotationMarksIds.find( idname );
         if ( it == m_rOpenedAnnotationMarksIds.end(  ) )
             m_pSerializer->singleElementNS( XML_w, XML_commentReference, FSNS( XML_w, XML_id ), idstr.getStr(), FSEND );
         ++m_postitFieldsMaxId;
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 04d745e..c0cf834 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -782,7 +782,7 @@ private:
     OString m_sLastOpenedBookmark;
 
     /// Maps of the annotation marks ids
-    std::map<OString, sal_uInt16> m_rOpenedAnnotationMarksIds;
+    std::map<OString, sal_Int32> m_rOpenedAnnotationMarksIds;
 
     /// Name of the last opened annotation mark.
     OString m_sLastOpenedAnnotationMark;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index e374a9a..9d164f8 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1490,7 +1490,7 @@ void RtfAttributeOutput::WriteAnnotationMarks_Impl(std::vector< OUString >& rSta
         OString rName = OUStringToOString(*i, RTL_TEXTENCODING_UTF8);
 
         // Output the annotation mark
-        sal_uInt16 nId = m_nNextAnnotationMarkId++;
+        const sal_Int32 nId = m_nNextAnnotationMarkId++;
         m_rOpenedAnnotationMarksIds[rName] = nId;
         m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATRFSTART " ");
         m_aRun->append(OString::number(nId).getStr());
@@ -1503,10 +1503,10 @@ void RtfAttributeOutput::WriteAnnotationMarks_Impl(std::vector< OUString >& rSta
         OString rName = OUStringToOString(*i, RTL_TEXTENCODING_UTF8);
 
         // Get the id of the annotation mark
-        std::map<OString, sal_uInt16>::iterator it = m_rOpenedAnnotationMarksIds.find(rName);
+        std::map<OString, sal_Int32>::iterator it = m_rOpenedAnnotationMarksIds.find(rName);
         if (it != m_rOpenedAnnotationMarksIds.end())
         {
-            sal_uInt16 nId = it->second;
+            const sal_Int32 nId = it->second;
             m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATRFEND " ");
             m_aRun->append(OString::number(nId).getStr());
             m_aRun->append('}');
@@ -3292,7 +3292,7 @@ void RtfAttributeOutput::PostitField(const SwField* pField)
     const SwPostItField& rPField = *static_cast<const SwPostItField*>(pField);
 
     OString aName = OUStringToOString(rPField.GetName(), RTL_TEXTENCODING_UTF8);
-    std::map<OString, sal_uInt16>::iterator it = m_rOpenedAnnotationMarksIds.find(aName);
+    std::map<OString, sal_Int32>::iterator it = m_rOpenedAnnotationMarksIds.find(aName);
     if (it != m_rOpenedAnnotationMarksIds.end())
     {
         // In case this field is inside annotation marks, we want to write the
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 0696486..076fdaf 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -515,7 +515,7 @@ private:
     sal_Int32 m_nNextAnnotationMarkId;
     sal_Int32 m_nCurrentAnnotationMarkId;
     /// Maps annotation mark names to ID's.
-    std::map<OString, sal_uInt16> m_rOpenedAnnotationMarksIds;
+    std::map<OString, sal_Int32> m_rOpenedAnnotationMarksIds;
 
     /*
      * The current table helper.


More information about the Libreoffice-commits mailing list