From 7418a5ab18955a76b38512ef757c873d149d6c02 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Wed, 20 Nov 2013 13:39:18 +0100 Subject: Related bnc#837302: Don't introduce a redlined delete and the end of doc. Conflicts: writerfilter/source/dmapper/DomainMapper_Impl.cxx Change-Id: I5c3903a40b69867684707d33acbc92b1f80a93ec Reviewed-on: https://gerrit.libreoffice.org/6898 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna Signed-off-by: Andras Timar --- sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 +++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index d7a5c8bc5527..1372151e1c93 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -800,6 +800,17 @@ void Test::testBnc837302() getRun(xParagraph, 3, "AAA"); // interestingly the 'Insert' is set on the _previous_ run CPPUNIT_ASSERT_EQUAL(OUString("Insert"), getProperty(getRun(xParagraph, 2), "RedlineType")); + + // make sure we don't introduce a redlined delete in the 2nd paragraph + xParagraph = getParagraph(2); + OUString aProperty; + try + { + // throws when not present + aProperty = getProperty(getRun(xParagraph, 1), "RedlineType"); + } + catch (const beans::UnknownPropertyException&) {} + CPPUNIT_ASSERT_EQUAL(OUString(), aProperty); } CPPUNIT_TEST_SUITE_REGISTRATION(Test); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index ded106d238e5..131559f4edd8 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -318,7 +318,21 @@ void DomainMapper_Impl::RemoveLastParagraph( ) #else if (xCursor->getString() == "\r\n") #endif + { + uno::Reference xDocProps(GetTextDocument(), uno::UNO_QUERY); + const OUString aRecordChanges("RecordChanges"); + uno::Any aPreviousValue(xDocProps->getPropertyValue(aRecordChanges)); + + // disable redlining for this operation, otherwise we might + // end up with an unwanted recorded deletion + xDocProps->setPropertyValue(aRecordChanges, uno::Any(sal_False)); + + // delete xCursor->setString(OUString()); + + // restore again + xDocProps->setPropertyValue(aRecordChanges, aPreviousValue); + } } } catch( const uno::Exception& ) -- cgit v1.2.3