diff options
author | Jan Holesovsky <kendy@collabora.com> | 2013-11-20 13:39:18 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2013-11-29 16:46:55 +0100 |
commit | d6840bf9c653955aae4ee5de884f895655106ec7 (patch) | |
tree | 016846cba248169576e0d9e18e37a22d4d91cc29 | |
parent | 57c95104ae6436dc9afa74bea780bf1e9da242fa (diff) |
Related bnc#837302: Don't introduce a redlined delete and the end of doc.
Change-Id: I5c3903a40b69867684707d33acbc92b1f80a93ec
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index f68b3b62b900..792d6e8f403f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -512,6 +512,17 @@ void Test::testBnc837302() getRun(xParagraph, 3, "AAA"); // interestingly the 'Insert' is set on the _previous_ run CPPUNIT_ASSERT_EQUAL(OUString("Insert"), getProperty<OUString>(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<OUString>(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 07654c6f80a1..acfc55e1d67f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -315,7 +315,21 @@ void DomainMapper_Impl::RemoveLastParagraph( ) // If this is a text on a shape, possibly the text has the trailing // newline removed already. if (xCursor->getString() == "\n") + { + uno::Reference<beans::XPropertySet> 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& ) |