summaryrefslogtreecommitdiff
path: root/writerfilter/source/filter/WriterFilter.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-03-12 12:43:10 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-03-24 20:32:16 +0100
commitc4dab726caaa73be9f9c731312080143b0a0b89d (patch)
treea07fef06a61f5f89adff50a06fdffa5d1fe577dd /writerfilter/source/filter/WriterFilter.cxx
parent531863e28b626f4af04f999295f79ecc347c2165 (diff)
ofz#21168 sw,writerfilter: limit writerfilter hack to writerfilter
The problem is that at the end of WW8 import, a delete redline is inserted that ends up calling DeleteAndJoin from inside AppendRedline(). A fly is anchored AT_CHAR at (node 46, offset 0) and the deletion goes from (node 46, offset 0) to (node 48, offset 13) hence the special case check in IsDestroyFrameAnchoredAtChar() for the IsInReading() prevents it from being deleted, and then its anchor is still registered at the node 46 when it gets deleted. So try to restrict the WriterfilterHack to writerfilter, so it won't affect WW8 import. Unfortunately this is far less obvious than expected, because import can happen for creating a new file, in which case it's all done via UNO in writerfilter, or when inserting into an existing file, in which case SwReader::Read() is used. The SwDocShell's pMedium can't be used becuse in insert file case it will be the loaded file, not the inserted file. There isn't any obvious alternative to adding a silly UNO property for the writerfilter to use. Change-Id: Ia7fdc9bb1925202f6692ebee6e4b6b1fe50e5345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90384 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'writerfilter/source/filter/WriterFilter.cxx')
-rw-r--r--writerfilter/source/filter/WriterFilter.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 7afc9c536637..a043dcb2764a 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -155,6 +155,8 @@ sal_Bool WriterFilter::filter(const uno::Sequence<beans::PropertyValue>& rDescri
}
if (m_xDstDoc.is())
{
+ uno::Reference<beans::XPropertySet> const xDocProps(m_xDstDoc, uno::UNO_QUERY);
+ xDocProps->setPropertyValue("UndocumentedWriterfilterHack", uno::makeAny(true));
utl::MediaDescriptor aMediaDesc(rDescriptor);
bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
bool bSkipImages
@@ -280,6 +282,9 @@ sal_Bool WriterFilter::filter(const uno::Sequence<beans::PropertyValue>& rDescri
pStream.clear();
+ // note: pStream.clear calls RemoveLastParagraph()
+ xDocProps->setPropertyValue("UndocumentedWriterfilterHack", uno::makeAny(false));
+
return true;
}
return false;