summaryrefslogtreecommitdiff
path: root/sw/source/filter
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-25 14:35:46 +0100
commit0185241456971f06a7795fb4f304317027f50db9 (patch)
tree8cafdcb8db8449ad7e3abcbb7d530f094e544b6d /sw/source/filter
parent3d264dc8742733a797a3e315033851d0bda3bffd (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> (cherry picked from commit c4dab726caaa73be9f9c731312080143b0a0b89d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90951
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/basflt/shellio.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 708e13c2535b..cba064de3e09 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -25,6 +25,7 @@
#include <svl/fstathelper.hxx>
#include <unotools/moduleoptions.hxx>
#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/boxitem.hxx>
@@ -36,6 +37,7 @@
#include <fmtpdsc.hxx>
#include <swtypes.hxx>
#include <shellio.hxx>
+#include <iodetect.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentSettingAccess.hxx>
@@ -104,6 +106,10 @@ ErrCode SwReader::Read( const Reader& rOptions )
mxDoc->SetInReading( true );
mxDoc->SetInXMLImport( dynamic_cast< XMLReader* >(po) != nullptr );
+ mxDoc->SetInWriterfilterImport(pMedium && pMedium->GetFilter()
+ && (pMedium->GetFilter()->GetUserData() == FILTER_RTF
+ || pMedium->GetFilter()->GetUserData() == sRtfWH
+ || pMedium->GetFilter()->GetUserData() == FILTER_DOCX));
SwPaM *pPam;
if( pCursor )
@@ -341,6 +347,7 @@ ErrCode SwReader::Read( const Reader& rOptions )
mxDoc->SetInReading( false );
mxDoc->SetInXMLImport( false );
+ mxDoc->SetInWriterfilterImport(false);
mxDoc->InvalidateNumRules();
mxDoc->UpdateNumRule();