[Libreoffice-commits] .: 2 commits - writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Mon Jun 11 03:25:44 PDT 2012
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 15 +++++++++++++++
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 ++
2 files changed, 17 insertions(+)
New commits:
commit e08ab74b918be1473d91ed234ee7870cab137c7e
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Jun 11 12:17:10 2012 +0200
fdo#49659 handle RTF import of tables at the very end of the document
If the documents ends with a table, both Word/Writer produces a
non-table empty paragraph after that table. However, it's valid not to
emit that empty paragraph, so handle the situation in the importer.
Change-Id: I8ea163f2de62954f3891f8f48e81d89f6e29ce6f
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index c2c1b60..caff491 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -249,6 +249,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_bNeedPap(true),
m_bNeedCr(false),
m_bNeedPar(true),
+ m_bNeedFinalPar(false),
m_aListTableSprms(),
m_aSettingsTableAttributes(),
m_aSettingsTableSprms(),
@@ -481,6 +482,12 @@ void RTFDocumentImpl::sectBreak(bool bFinal = false)
// If there is no paragraph in this section, then insert a dummy one, as required by Writer
if (m_bNeedPar)
dispatchSymbol(RTF_PAR);
+ // It's allowed to not have a non-table paragraph at the end of an RTF doc, add it now if required.
+ if (m_bNeedFinalPar && bFinal)
+ {
+ dispatchFlag(RTF_PARD);
+ dispatchSymbol(RTF_PAR);
+ }
while (m_nHeaderFooterPositions.size())
{
std::pair<Id, sal_uInt32> aPair = m_nHeaderFooterPositions.front();
@@ -1437,6 +1444,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
m_bNeedPap = true;
if (!m_aStates.top().aFrame.inFrame())
m_bNeedPar = false;
+ m_bNeedFinalPar = false;
}
break;
case RTF_SECT:
@@ -1541,6 +1549,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
tableBreak();
m_bNeedPap = true;
+ m_bNeedFinalPar = true;
m_aTableBuffer.clear();
m_aStates.top().nCells = 0;
m_aStates.top().aTableCellsSprms.clear();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 93ed15d..9bb994d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -444,6 +444,8 @@ namespace writerfilter {
/// If we need to emit a CR at the end of substream.
bool m_bNeedCr;
bool m_bNeedPar;
+ /// If set, an empty paragraph will be added at the end of the document.
+ bool m_bNeedFinalPar;
/// The list table and list override table combined.
RTFSprms m_aListTableSprms;
/// The settings table attributes.
commit c5c3ce5e625a31d78a21fbbc339ee30ba99f3044
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Jun 11 11:19:19 2012 +0200
fdo#49659 fix RTF import of pictures with inner groups
One would think that with {\pict{\foo1}}, the inner group has no effect
in the outer group, but this turns out to be valid, so we should handle
it as well.
Change-Id: I64b933ad1cd5946f22d27669e9240d9e1875bde3
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b2a6962..c2c1b60 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -620,6 +620,10 @@ int RTFDocumentImpl::resolvePict(bool bInline)
else
pStream = m_pBinaryData.get();
+ if (!pStream->Tell())
+ // No destination text? Then we'll get it later.
+ return 0;
+
// Store, and get its URL.
pStream->Seek(0);
uno::Reference<io::XInputStream> xInputStream(new utl::OInputStreamWrapper(pStream));
@@ -3529,6 +3533,8 @@ int RTFDocumentImpl::popState()
if (aState.nFieldStatus == FIELD_INSTRUCTION)
singleChar(0x15);
}
+ else if (m_aStates.size() && m_aStates.top().nDestinationState == DESTINATION_PICT)
+ m_aStates.top().aPicture = aState.aPicture;
else if (bPopShapeProperties)
{
m_aStates.top().aShape = aShape;
More information about the Libreoffice-commits
mailing list