[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

Jan Holesovsky kendy at collabora.com
Wed Nov 20 04:44:50 PST 2013


 sw/qa/extras/ooxmlexport/data/bnc837302.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx          |   32 ++++++++++++++++++++++
 sw/source/core/doc/docredln.cxx                   |    3 --
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   14 +++++++++
 4 files changed, 47 insertions(+), 2 deletions(-)

New commits:
commit 919d4a2c5977bb6066e5baf6bb960a21cd385911
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Nov 20 13:39:18 2013 +0100

    Related bnc#837302: Don't introduce a redlined delete and the end of doc.
    
    Change-Id: I5c3903a40b69867684707d33acbc92b1f80a93ec

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 13245c3..da830d6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1170,6 +1170,17 @@ DECLARE_OOXMLEXPORT_TEST(testBnc837302, "bnc837302.docx")
     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);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo68418, "fdo68418.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index cc2486b..d88ca49 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -300,7 +300,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& )
commit 6e0aa783f4112791de336007343e064abc46324e
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Nov 20 11:45:39 2013 +0100

    bnc#837302: Allow insertion of redlines with an empty author.
    
    No idea why that was not allowed (since the initial import in 2000), we need
    it for interoperability.
    
    Change-Id: I475fa63f9a4a3219a2b898b6f7d81e0603d32c18

diff --git a/sw/qa/extras/ooxmlexport/data/bnc837302.docx b/sw/qa/extras/ooxmlexport/data/bnc837302.docx
new file mode 100644
index 0000000..9d0c0af
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/bnc837302.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index f20cecd..13245c3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1161,6 +1161,17 @@ DECLARE_OOXMLEXPORT_TEST(testBnc834035, "bnc834035.odt")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[10]/w:hyperlink", "anchor", "_Toc363553908");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testBnc837302, "bnc837302.docx")
+{
+    // The problem was that text with empty author was not inserted as a redline
+    uno::Reference<text::XTextRange> xParagraph = getParagraph(1);
+
+    // previously 'AAA' was not an own run
+    getRun(xParagraph, 3, "AAA");
+    // interestingly the 'Insert' is set on the _previous_ run
+    CPPUNIT_ASSERT_EQUAL(OUString("Insert"), getProperty<OUString>(getRun(xParagraph, 2), "RedlineType"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFdo68418, "fdo68418.docx")
 {
     // The problem was that in 'MSWordExportBase::SectionProperties' function in 'wrt8sty.cxx'
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 04bd747..ee4db26 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -290,8 +290,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
     bool bMerged = false;
     _CHECK_REDLINE( this )
 
-    if( IsRedlineOn() && !IsShowOriginal( meRedlineMode ) &&
-        !pNewRedl->GetAuthorString().isEmpty() )
+    if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
     {
         pNewRedl->InvalidateRange();
 
commit ae3cfef7ea13f49f442862aba5264fc8839dd863
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Nov 20 11:42:39 2013 +0100

    DOCX export testing: Easy way to disable all tests but the interesting one.
    
    Change-Id: I274bf30216f357b82d5bdb1c926a7575346129f6

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5390ed5..f20cecd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -167,6 +167,16 @@ OUString Test::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString&
 
 #define DECLARE_OOXMLEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 
+// For testing during development of a tast, you want to use
+// DECLARE_OOXMLEXPORT_TEST_ONLY, and change the below to #if 1
+// Of course, don't forget to set back to #if 0 when you are done :-)
+#if 0
+#define DECLARE_OOXMLEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
+
+#undef DECLARE_OOXMLEXPORT_TEST
+#define DECLARE_OOXMLEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
+#endif
+
 DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx")
 {
     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);


More information about the Libreoffice-commits mailing list