sw/source/filter/ww8/rtfattributeoutput.cxx | 10 ++++++++-- sw/source/filter/ww8/rtfattributeoutput.hxx | 5 +++++ sw/source/filter/ww8/rtfexport.cxx | 4 +++- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 3 ++- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 4 +++- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 +- writerfilter/source/rtftok/rtfsdrimport.cxx | 10 ++++++---- 7 files changed, 28 insertions(+), 10 deletions(-)
New commits: commit 33b5531fcc91d52196d6a5a1da976c8e0c5c6d97 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue Jun 26 16:39:17 2012 +0200 fdo#48335 two RTF export fixes 1) don't try to end not started runs (cherry picked from commit 5d505e5b1edee7f709e4baff70a971cb3fe851c2) Conflicts: sw/source/filter/ww8/rtfattributeoutput.cxx 2) 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. (cherry picked from commit a03895986308206cc13a6f5ae25138d4b4ad5d43) Change-Id: I05940e7ff649051ecae4a72ae73617a47ffca885 Signed-off-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 0c3533b..49df6ef 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -345,6 +345,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() ) { @@ -378,6 +380,7 @@ void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSing { OSL_TRACE("%s", OSL_THIS_FUNC); + m_bInRun = true; m_bSingleEmptyRun = bSingleEmptyRun; if (!m_bSingleEmptyRun) m_aRun.append('{'); @@ -393,8 +396,9 @@ void RtfAttributeOutput::EndRun() OSL_TRACE("%s", OSL_THIS_FUNC); m_aRun.append(m_rExport.sNewLine); m_aRun.append(m_aRunText.makeStringAndClear()); - if (!m_bSingleEmptyRun) + if (!m_bSingleEmptyRun && m_bInRun) m_aRun.append('}'); + m_bInRun = false; } void RtfAttributeOutput::StartRunProperties() @@ -3024,7 +3028,9 @@ RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport ) m_bHadFieldResult( false ), m_bTableRowEnded( false ), m_aCells(), - m_bSingleEmptyRun(false) + m_bSingleEmptyRun(false), + m_bInRun(false), + m_pPrevPageDesc(0) { OSL_TRACE("%s", OSL_THIS_FUNC); } diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 406f063..5af53dd 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -542,6 +542,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 ); @@ -552,6 +554,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 cf13e5f..4d46277 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -698,7 +698,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 364cb1e3f0915dd11766ba9ddf97b2cdea66df71 Author: Miklos Vajna <vmik...@suse.cz> Date: Fri Jun 22 18:55:15 2012 +0200 fdo#46966 dmapper: fix headery/footery default value The docx spec doesn't say what is the default value, the rtf spec says it's 720, not 1440. Change-Id: Icb331591d4f2f96a7786f808d99af5974e645f8e Signed-off-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index bafec8f..0974b84 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3381,7 +3381,8 @@ void DomainMapper_Impl::SetPageMarginTwip( PageMarElement eElement, sal_Int32 nV _PageMar::_PageMar() { - header = footer = top = bottom = ConversionHelper::convertTwipToMM100( sal_Int32(1440)); + header = footer = ConversionHelper::convertTwipToMM100(sal_Int32(720)); + top = bottom = ConversionHelper::convertTwipToMM100( sal_Int32(1440)); right = left = ConversionHelper::convertTwipToMM100( sal_Int32(1800)); gutter = 0; } commit b8e664a17abac2cad8aae9909dbd8c2da3d8557c Author: Miklos Vajna <vmik...@suse.cz> Date: Wed Jul 18 22:47:03 2012 +0200 fdo#52066 fix RTF import of rectangle shape without text in it We used to always add a paragraph on shapes, which breaks import of abused rectangle shapes with minimal height, used as lines. Change-Id: Ice240bad68bc030e7889c46f72c45646307f17e5 Signed-off-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e293599..3fb9491 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3648,9 +3648,11 @@ void RTFDocumentImpl::setDestinationText(OUString& rString) m_aStates.top().aDestinationText.append(rString); } -void RTFDocumentImpl::replayShapetext() +bool RTFDocumentImpl::replayShapetext() { + bool bRet = !m_aShapetextBuffer.empty(); replayBuffer(m_aShapetextBuffer); + return bRet; } bool RTFDocumentImpl::getSkipUnknown() diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index d7347e4..d42a401 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -364,7 +364,7 @@ namespace writerfilter { /// Resolve a picture: If not inline, then anchored. int resolvePict(bool bInline); void runBreak(); - void replayShapetext(); + bool replayShapetext(); bool getSkipUnknown(); void setSkipUnknown(bool bSkipUnknown); diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 46664f5..e89a8c7 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -326,10 +326,12 @@ void RTFSdrImport::resolve(RTFShape& rShape) // Send it to dmapper m_rImport.Mapper().startShape(xShape); m_rImport.Mapper().startParagraphGroup(); - m_rImport.replayShapetext(); - m_rImport.Mapper().startCharacterGroup(); - m_rImport.runBreak(); - m_rImport.Mapper().endCharacterGroup(); + if (m_rImport.replayShapetext()) + { + m_rImport.Mapper().startCharacterGroup(); + m_rImport.runBreak(); + m_rImport.Mapper().endCharacterGroup(); + } m_rImport.Mapper().endParagraphGroup(); m_rImport.Mapper().endShape(); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits