[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 3 commits - sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Jun 27 05:56:57 PDT 2012


 sw/source/filter/ww8/rtfattributeoutput.cxx |   10 ++++++++--
 sw/source/filter/ww8/rtfattributeoutput.hxx |    5 +++++
 sw/source/filter/ww8/rtfexport.cxx          |    6 ++++--
 3 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 1f0da495692279762ecdadf918f5fbbaa576fd92
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jun 27 11:16:55 2012 +0200

    fdo#48335 RTF export: avoid fake page breaks on page style changes
    
    The problem was that a page break has been always exported when the page
    style changed -- but in case the page style changes just because of
    "first page"-like styles, we don't need that.
    
    Change-Id: I15527c8d3a2d1c441b4817cf94d61ea68dc5f92c

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index b7bbf22..6e9c8b2 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -350,6 +350,8 @@ void RtfAttributeOutput::StartParagraphProperties( const SwTxtNode& rNode )
     {
         const SwTxtNode* pTxtNode = static_cast< SwTxtNode* >( &aNextIndex.GetNode() );
         m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode );
+        // Save the current page description for now, so later we will be able to access the previous one.
+        m_pPrevPageDesc = pTxtNode->FindPageDesc(sal_False);
     }
     else if ( aNextIndex.GetNode().IsTableNode() )
     {
@@ -3032,7 +3034,8 @@ RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport )
     m_bTableRowEnded( false ),
     m_aCells(),
     m_bSingleEmptyRun(false),
-    m_bInRun(false)
+    m_bInRun(false),
+    m_pPrevPageDesc(0)
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
 }
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index a17bcca..2b67cc8 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -556,6 +556,9 @@ public:
 
     rtl::OStringBuffer m_aTabStop;
 
+    /// Access to the page style of the previous paragraph.
+    const SwPageDesc* m_pPrevPageDesc;
+
     // These are used by wwFont::WriteRtf()
     /// Start the font.
     void StartFont( const String& rFamilyName ) const;
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index eca168e..5636e8d 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -708,7 +708,9 @@ void RtfExport::PrepareNewPageDesc( const SfxItemSet* pSet,
     else if ( pNewPgDesc )
         m_pSections->AppendSection( pNewPgDesc, rNd, pFmt, nLnNm );
 
-    AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() );
+    // Don't insert a page break, when we're changing page style just because the next page has to be a different one.
+    if (!m_pAttrOutput->m_pPrevPageDesc || m_pAttrOutput->m_pPrevPageDesc->GetFollow() != pNewPgDesc)
+        AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() );
 }
 
 bool RtfExport::DisallowInheritingOutlineNumbering( const SwFmt& rFmt )
commit 6556179c639cf9db5b33bb405e969fb6bbc458a2
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jun 26 16:52:04 2012 +0200

    fdo#48335 don't export zoom factor when zoom type is not percent
    
    Change-Id: I1fb7e3d9d65f2f3388bb4851f5ad517ed1681f04

diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index efcea5b..eca168e 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -508,7 +508,7 @@ void RtfExport::ExportDocument_Impl()
     Strm() << m_pAttrOutput->m_aTabStop.makeStringAndClear().getStr() << sNewLine;
     // Zoom
     ViewShell *pViewShell(pDoc->GetCurrentViewShell());
-    if (pViewShell)
+    if (pViewShell && pViewShell->GetViewOptions()->GetZoomType() == SVX_ZOOM_PERCENT)
     {
         Strm() << OOO_STRING_SVTOOLS_RTF_VIEWSCALE;
         OutULong(pViewShell->GetViewOptions()->GetZoom());
commit 9537551a49d5f221e87a0e2b42ef973c58e542c8
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jun 26 16:39:17 2012 +0200

    fdo#48335 RTF export: don't try to end not started runs
    
    Change-Id: I022556acd0891cf24963d667d34f366496453630

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 9380cca..b7bbf22 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -383,6 +383,7 @@ void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSing
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
 
+    m_bInRun = true;
     m_bSingleEmptyRun = bSingleEmptyRun;
     if (!m_bSingleEmptyRun)
         m_aRun->append('{');
@@ -398,8 +399,9 @@ void RtfAttributeOutput::EndRun()
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
     m_aRun->append(m_rExport.sNewLine);
     m_aRun.appendAndClear(m_aRunText);
-    if (!m_bSingleEmptyRun)
+    if (!m_bSingleEmptyRun && m_bInRun)
         m_aRun->append('}');
+    m_bInRun = false;
 }
 
 void RtfAttributeOutput::StartRunProperties()
@@ -3029,7 +3031,8 @@ RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport )
     m_bHadFieldResult( false ),
     m_bTableRowEnded( false ),
     m_aCells(),
-    m_bSingleEmptyRun(false)
+    m_bSingleEmptyRun(false),
+    m_bInRun(false)
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
 }
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 3957de5..a17bcca 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -544,6 +544,8 @@ private:
 
     /// If we're in a paragraph that has a single empty run only.
     bool m_bSingleEmptyRun;
+
+    bool m_bInRun;
 public:
     RtfAttributeOutput( RtfExport &rExport );
 


More information about the Libreoffice-commits mailing list