sc/source/filter/inc/rtfexp.hxx |    8 ++
 sc/source/filter/rtf/rtfexp.cxx |  135 +++++++++++++++++++++++++++++++---------
 2 files changed, 113 insertions(+), 30 deletions(-)

New commits:
commit b3158f8ce5df7403db9dd8ca7a7b180e991521fe
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Jul 25 15:36:52 2023 -0400
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Fri Aug 4 14:44:27 2023 +0200

    sc: filter: rtf: add method "WriteFontTable"
    
    Write the font table while visiting column/row and
    get the unique index to reference it.
    
    "The \fonttbl control word introduces the font table group.
    Unique \fN control words define each font available in the document,
    and are used to reference that font throughout the document."
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I20c5d1128972f5ec9b9b2e246f466bdb173ef8a4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154906
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155261
    (cherry picked from commit 2d5732b254134da7942687ea3b1bb04859cc9c34)
    (cherry picked from commit c3b32a95236edeadd9450c7b989a259e82476b8f)

diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx
index 1c9f1bd7a4af..9d0b204540c7 100644
--- a/sc/source/filter/inc/rtfexp.hxx
+++ b/sc/source/filter/inc/rtfexp.hxx
@@ -28,12 +28,14 @@ class ScRTFExport : public ScExportBase
 {
     std::unique_ptr<sal_uLong[]>  m_pCellX;     // cumulative range in a table
     std::map<OUString, sal_Int32> m_pFontTable;
+    SvMemoryStream m_aFontStrm;
     SvMemoryStream m_aDocStrm;
 
     int                 AddFont( const SvxFontItem& rFontItem );
     void                WriteTab( SCTAB nTab );
     void                WriteRow( SCTAB nTab, SCROW nRow );
     void                WriteCell( SCTAB nTab,  SCROW nRow, SCCOL nCol );
+    void                WriteFontTable(const SvxFontItem& rFontItem, int 
nIndex);
 
 public:
 
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 070308171d17..e53a488d06b5 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -19,6 +19,9 @@
 
 #include <scitems.hxx>
 
+#include <rtl/tencinfo.h>
+#include <osl/thread.h>
+
 #include <editeng/wghtitem.hxx>
 #include <editeng/postitem.hxx>
 #include <editeng/udlnitem.hxx>
@@ -60,6 +63,8 @@ void ScRTFExport::Write()
     rStrm.WriteChar( '{' ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RTF );
     rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ANSI ).WriteCharPtr( 
SAL_NEWLINE_STRING );
 
+    m_aFontStrm.WriteChar( '{' ).WriteOString( OOO_STRING_SVTOOLS_RTF_FONTTBL 
);
+
     // Data
     for ( SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); nTab++ )
     {
@@ -68,6 +73,9 @@ void ScRTFExport::Write()
         WriteTab( nTab );
     }
 
+    m_aFontStrm.WriteChar( '}' );
+    m_aFontStrm.Seek(0);
+    rStrm.WriteStream(m_aFontStrm);
     m_aDocStrm.Seek(0);
     rStrm.WriteStream(m_aDocStrm);
     rStrm.WriteChar( '}' ).WriteOString( SAL_NEWLINE_STRING );
@@ -148,6 +156,51 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
     m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_ROW ).WriteOString( 
SAL_NEWLINE_STRING );
 }
 
+void ScRTFExport::WriteFontTable(const SvxFontItem& rFontItem, int nIndex)
+{
+    m_aFontStrm.WriteChar( '{' );
+    m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_F );
+    m_aFontStrm.WriteOString( OString::number(nIndex) );
+
+    FontFamily eFamily = rFontItem.GetFamily();
+    if (eFamily == FAMILY_DONTKNOW)
+        m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FNIL );
+    else if (eFamily == FAMILY_DECORATIVE)
+        m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FDECOR );
+    else if (eFamily == FAMILY_MODERN)
+        m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FMODERN );
+    else if (eFamily == FAMILY_ROMAN)
+        m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FROMAN );
+    else if (eFamily == FAMILY_SCRIPT)
+        m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FSCRIPT );
+    else if (eFamily == FAMILY_SWISS)
+        m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FSWISS );
+
+    m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FPRQ );
+
+    sal_uInt16 nVal = 0;
+    FontPitch ePitch = rFontItem.GetPitch();
+    if ( ePitch == PITCH_FIXED )
+        nVal = 1;
+    else if ( ePitch == PITCH_VARIABLE )
+        nVal = 2;
+    m_aFontStrm.WriteOString( OString::number(nVal) );
+
+    rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252;
+    rtl_TextEncoding eChrSet = rFontItem.GetCharSet();
+    if (IsStarSymbol(rFontItem.GetFamilyName()))
+        eChrSet = RTL_TEXTENCODING_UTF8;
+    else if( RTL_TEXTENCODING_DONTKNOW == eChrSet )
+        eChrSet = osl_getThreadTextEncoding();
+
+    m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FCHARSET );
+    m_aFontStrm.WriteOString( 
OString::number(rtl_getBestWindowsCharsetFromTextEncoding( eChrSet )) );
+
+    m_aFontStrm.WriteChar( ' ' );
+    RTFOutFuncs::Out_String( m_aFontStrm, rFontItem.GetFamilyName(), eDestEnc 
);
+    m_aFontStrm.WriteOString( ";}" );
+}
+
 int ScRTFExport::AddFont(const SvxFontItem& rFontItem)
 {
     auto nRet = m_pFontTable.size();
@@ -155,6 +208,7 @@ int ScRTFExport::AddFont(const SvxFontItem& rFontItem)
     if (itFont == m_pFontTable.end())
     {
         m_pFontTable[rFontItem.GetFamilyName()] = nRet;
+        WriteFontTable(rFontItem, nRet);
     }
     else
     {
@@ -204,11 +258,15 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, 
SCCOL nCol )
 
     bool bResetAttr(false);
 
+    const SvxFontItem&          rFontItem       = pAttr->GetItem( ATTR_FONT );
     const SvxHorJustifyItem&    rHorJustifyItem = pAttr->GetItem( 
ATTR_HOR_JUSTIFY );
     const SvxWeightItem&        rWeightItem     = pAttr->GetItem( 
ATTR_FONT_WEIGHT );
     const SvxPostureItem&       rPostureItem    = pAttr->GetItem( 
ATTR_FONT_POSTURE );
     const SvxUnderlineItem&     rUnderlineItem  = pAttr->GetItem( 
ATTR_FONT_UNDERLINE );
 
+    m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_F )
+        .WriteOString( OString::number(AddFont(rFontItem)) );
+
     const char* pChar;
 
     switch( rHorJustifyItem.GetValue() )
commit 72a0a9544e7d9ff25160ebe44e530c85a062e049
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Jul 25 15:31:22 2023 -0400
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Fri Aug 4 14:44:13 2023 +0200

    sc: filter: rtf: add method "AddFont"
    
    Create a map font name associated with unique index.
    
    "The \fonttbl control word introduces the font table group.
    Unique \fN control words define each font available in the document,
    and are used to reference that font throughout the document"..
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I028226cb539865f1980f953385c887a3bd4b8e3f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154905
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155260
    (cherry picked from commit 81d59f2c125dff57fdfa17b119d6007f25ef500a)
    (cherry picked from commit cd96b37a41c2b59b579b07969c1ff12936b8df34)

diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx
index 14ee8ec023f7..1c9f1bd7a4af 100644
--- a/sc/source/filter/inc/rtfexp.hxx
+++ b/sc/source/filter/inc/rtfexp.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include <map>
 #include <memory>
 #include "expbase.hxx"
 #include <tools/solar.h>
@@ -26,8 +27,10 @@
 class ScRTFExport : public ScExportBase
 {
     std::unique_ptr<sal_uLong[]>  m_pCellX;     // cumulative range in a table
+    std::map<OUString, sal_Int32> m_pFontTable;
     SvMemoryStream m_aDocStrm;
 
+    int                 AddFont( const SvxFontItem& rFontItem );
     void                WriteTab( SCTAB nTab );
     void                WriteRow( SCTAB nTab, SCROW nRow );
     void                WriteCell( SCTAB nTab,  SCROW nRow, SCCOL nCol );
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 152b8ff5d57f..070308171d17 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -22,6 +22,7 @@
 #include <editeng/wghtitem.hxx>
 #include <editeng/postitem.hxx>
 #include <editeng/udlnitem.hxx>
+#include <editeng/fontitem.hxx>
 #include <editeng/justifyitem.hxx>
 #include <svtools/rtfout.hxx>
 #include <svtools/rtfkeywd.hxx>
@@ -147,6 +148,22 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
     m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_ROW ).WriteOString( 
SAL_NEWLINE_STRING );
 }
 
+int ScRTFExport::AddFont(const SvxFontItem& rFontItem)
+{
+    auto nRet = m_pFontTable.size();
+    auto itFont(m_pFontTable.find(rFontItem.GetFamilyName()));
+    if (itFont == m_pFontTable.end())
+    {
+        m_pFontTable[rFontItem.GetFamilyName()] = nRet;
+    }
+    else
+    {
+        nRet = itFont->second;
+    }
+
+    return nRet;
+}
+
 void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol )
 {
     const ScPatternAttr* pAttr = pDoc->GetPattern( nCol, nRow, nTab );
commit e03fde39a6b93b0c027b8e0c7291bc5af5bacdaa
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Jul 25 15:28:39 2023 -0400
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Fri Aug 4 14:44:00 2023 +0200

    sc: filter: rtf: prefix m_* private members
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: If8389b6e63a90616131d0dd9fbb5a7b8b96ffe3d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154904
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155259
    (cherry picked from commit 3b310294851b91ca63eb2696bbada3caaeb79c10)
    (cherry picked from commit 3a2e38a8f3b1a324738c23ca59efc51544c2f29e)

diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx
index 9a4fe43d9d02..14ee8ec023f7 100644
--- a/sc/source/filter/inc/rtfexp.hxx
+++ b/sc/source/filter/inc/rtfexp.hxx
@@ -25,7 +25,7 @@
 
 class ScRTFExport : public ScExportBase
 {
-    std::unique_ptr<sal_uLong[]>  pCellX;     // cumulative range in a table
+    std::unique_ptr<sal_uLong[]>  m_pCellX;     // cumulative range in a table
     SvMemoryStream m_aDocStrm;
 
     void                WriteTab( SCTAB nTab );
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index f669c289e0ba..152b8ff5d57f 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -46,7 +46,7 @@ void ScFormatFilterPluginImpl::ScExportRTF( SvStream& rStrm, 
ScDocument* pDoc,
 ScRTFExport::ScRTFExport( SvStream& rStrmP, ScDocument* pDocP, const ScRange& 
rRangeP )
             :
             ScExportBase( rStrmP, pDocP, rRangeP ),
-            pCellX( new sal_uLong[ pDoc->MaxCol()+2 ] )
+            m_pCellX( new sal_uLong[ pDoc->MaxCol()+2 ] )
 {
 }
 
@@ -77,12 +77,12 @@ void ScRTFExport::WriteTab( SCTAB nTab )
     m_aDocStrm.WriteChar( '{' ).WriteOString( SAL_NEWLINE_STRING );
     if ( pDoc->HasTable( nTab ) )
     {
-        memset( &pCellX[0], 0, (pDoc->MaxCol()+2) * sizeof(sal_uLong) );
+        memset( &m_pCellX[0], 0, (pDoc->MaxCol()+2) * sizeof(sal_uLong) );
         SCCOL nCol;
         SCCOL nEndCol = aRange.aEnd.Col();
         for ( nCol = aRange.aStart.Col(); nCol <= nEndCol; nCol++ )
         {
-            pCellX[nCol+1] = pCellX[nCol] + pDoc->GetColWidth( nCol, nTab );
+            m_pCellX[nCol+1] = m_pCellX[nCol] + pDoc->GetColWidth( nCol, nTab 
);
         }
 
         SCROW nEndRow = aRange.aEnd.Row();
@@ -128,7 +128,7 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
         if ( pChar )
             m_aDocStrm.WriteOString( pChar );
 
-        m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CELLX ).WriteOString( 
OString::number(pCellX[nCol+1]) );
+        m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CELLX ).WriteOString( 
OString::number(m_pCellX[nCol+1]) );
         if ( (nCol & 0x0F) == 0x0F )
             m_aDocStrm.WriteOString( SAL_NEWLINE_STRING ); // Do not let lines 
get too long
     }
commit 24a8e87e8284e1224cfce9d1067f2028aa7ad895
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Jul 25 15:18:10 2023 -0400
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Fri Aug 4 14:42:40 2023 +0200

    sc: filter: rtf: use a separate document stream
    
    "An RTF file has the following syntax:
    '{' <header> <document>'}' "
    
    In order to build the header:
    
    <header>
            \rtf <charset> \deff? <fonttbl> <filetbl>? <colortbl>? 
<stylesheet>? <listtables>? <revtbl>?
    
    The font table should be created while visiting the column/rows.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: Id72a3c87acab6cfc7889cf81f7e83a0d73e378a2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154903
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155258
    (cherry picked from commit 98321ad324d386a9ad14a428fae949c3d7f5e3d3)
    (cherry picked from commit 647235f63f550eec23835a6c0574fe3b709cee41)

diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx
index 0d5e69f79d8e..9a4fe43d9d02 100644
--- a/sc/source/filter/inc/rtfexp.hxx
+++ b/sc/source/filter/inc/rtfexp.hxx
@@ -26,6 +26,7 @@
 class ScRTFExport : public ScExportBase
 {
     std::unique_ptr<sal_uLong[]>  pCellX;     // cumulative range in a table
+    SvMemoryStream m_aDocStrm;
 
     void                WriteTab( SCTAB nTab );
     void                WriteRow( SCTAB nTab, SCROW nRow );
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 340e3cdab7c7..f669c289e0ba 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -63,16 +63,18 @@ void ScRTFExport::Write()
     for ( SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); nTab++ )
     {
         if ( nTab > aRange.aStart.Tab() )
-            rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PAR );
+            m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_PAR );
         WriteTab( nTab );
     }
 
-    rStrm.WriteChar( '}' ).WriteCharPtr( SAL_NEWLINE_STRING );
+    m_aDocStrm.Seek(0);
+    rStrm.WriteStream(m_aDocStrm);
+    rStrm.WriteChar( '}' ).WriteOString( SAL_NEWLINE_STRING );
 }
 
 void ScRTFExport::WriteTab( SCTAB nTab )
 {
-    rStrm.WriteChar( '{' ).WriteCharPtr( SAL_NEWLINE_STRING );
+    m_aDocStrm.WriteChar( '{' ).WriteOString( SAL_NEWLINE_STRING );
     if ( pDoc->HasTable( nTab ) )
     {
         memset( &pCellX[0], 0, (pDoc->MaxCol()+2) * sizeof(sal_uLong) );
@@ -89,13 +91,13 @@ void ScRTFExport::WriteTab( SCTAB nTab )
             WriteRow( nTab, nRow );
         }
     }
-    rStrm.WriteChar( '}' ).WriteCharPtr( SAL_NEWLINE_STRING );
+    m_aDocStrm.WriteChar( '}' ).WriteOString( SAL_NEWLINE_STRING );
 }
 
 void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
 {
-    rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteCharPtr( 
OOO_STRING_SVTOOLS_RTF_TRGAPH ).WriteCharPtr( "30" ).WriteCharPtr( 
OOO_STRING_SVTOOLS_RTF_TRLEFT ).WriteCharPtr( "-30" );
-    rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TRRH ).WriteOString( 
OString::number(pDoc->GetRowHeight(nRow, nTab)) );
+    m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteOString( 
OOO_STRING_SVTOOLS_RTF_TRGAPH ).WriteOString( "30" ).WriteOString( 
OOO_STRING_SVTOOLS_RTF_TRLEFT ).WriteOString( "-30" );
+    m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_TRRH ).WriteOString( 
OString::number(pDoc->GetRowHeight(nRow, nTab)) );
     SCCOL nCol;
     SCCOL nEndCol = aRange.aEnd.Col();
     for ( nCol = aRange.aStart.Col(); nCol <= nEndCol; nCol++ )
@@ -107,12 +109,12 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
         const char* pChar;
 
         if ( rMergeAttr.GetColMerge() != 0 )
-            rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CLMGF );
+            m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CLMGF );
         else
         {
             const ScMergeFlagAttr& rMergeFlagAttr = pAttr->GetItem( 
ATTR_MERGE_FLAG );
             if ( rMergeFlagAttr.IsHorOverlapped() )
-                rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CLMRG );
+                m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CLMRG );
         }
 
         switch( rVerJustifyItem.GetValue() )
@@ -124,25 +126,25 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
             default:                           pChar = nullptr;           
break;
         }
         if ( pChar )
-            rStrm.WriteCharPtr( pChar );
+            m_aDocStrm.WriteOString( pChar );
 
-        rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELLX ).WriteOString( 
OString::number(pCellX[nCol+1]) );
+        m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CELLX ).WriteOString( 
OString::number(pCellX[nCol+1]) );
         if ( (nCol & 0x0F) == 0x0F )
-            rStrm.WriteCharPtr( SAL_NEWLINE_STRING ); // Do not let lines get 
too long
+            m_aDocStrm.WriteOString( SAL_NEWLINE_STRING ); // Do not let lines 
get too long
     }
-    rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PARD ).WriteCharPtr( 
OOO_STRING_SVTOOLS_RTF_PLAIN ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_INTBL 
).WriteCharPtr( SAL_NEWLINE_STRING );
+    m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_PARD ).WriteOString( 
OOO_STRING_SVTOOLS_RTF_PLAIN ).WriteOString( OOO_STRING_SVTOOLS_RTF_INTBL 
).WriteOString( SAL_NEWLINE_STRING );
 
-    sal_uLong nStrmPos = rStrm.Tell();
+    sal_uLong nStrmPos = m_aDocStrm.Tell();
     for ( nCol = aRange.aStart.Col(); nCol <= nEndCol; nCol++ )
     {
         WriteCell( nTab, nRow, nCol );
-        if ( rStrm.Tell() - nStrmPos > 255 )
+        if ( m_aDocStrm.Tell() - nStrmPos > 255 )
         {   // Do not let lines get too long
-            rStrm.WriteCharPtr( SAL_NEWLINE_STRING );
-            nStrmPos = rStrm.Tell();
+            m_aDocStrm.WriteOString( SAL_NEWLINE_STRING );
+            nStrmPos = m_aDocStrm.Tell();
         }
     }
-    rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ROW ).WriteCharPtr( 
SAL_NEWLINE_STRING );
+    m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_ROW ).WriteOString( 
SAL_NEWLINE_STRING );
 }
 
 void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol )
@@ -152,7 +154,7 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL 
nCol )
     const ScMergeFlagAttr& rMergeFlagAttr = pAttr->GetItem( ATTR_MERGE_FLAG );
     if ( rMergeFlagAttr.IsHorOverlapped() )
     {
-        rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELL );
+        m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CELL );
         return ;
     }
 
@@ -204,30 +206,30 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, 
SCCOL nCol )
         case SvxCellHorJustify::Repeat:
         default:                        pChar = OOO_STRING_SVTOOLS_RTF_QL;  
break;
     }
-    rStrm.WriteCharPtr( pChar );
+    m_aDocStrm.WriteOString( pChar );
 
     if ( rWeightItem.GetWeight() >= WEIGHT_BOLD )
     {   // bold
         bResetAttr = true;
-        rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_B );
+        m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_B );
     }
     if ( rPostureItem.GetPosture() != ITALIC_NONE )
     {   // italic
         bResetAttr = true;
-        rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_I );
+        m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_I );
     }
     if ( rUnderlineItem.GetLineStyle() != LINESTYLE_NONE )
     {   // underline
         bResetAttr = true;
-        rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_UL );
+        m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_UL );
     }
 
-    rStrm.WriteChar( ' ' );
-    RTFOutFuncs::Out_String( rStrm, aContent );
-    rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELL );
+    m_aDocStrm.WriteChar( ' ' );
+    RTFOutFuncs::Out_String( m_aDocStrm, aContent );
+    m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CELL );
 
     if ( bResetAttr )
-        rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PLAIN );
+        m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_PLAIN );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to