[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.0' - 2 commits - sw/qa sw/source writerfilter/source

Jan Holesovsky kendy at collabora.com
Fri Nov 29 08:19:55 PST 2013


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

New commits:
commit f72580006e9e88d3c374474b3e26678e49952366
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 f68b3b6..792d6e8 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 5db6df4..7d8203a 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& )
commit 75f1b02da8712d1ce5041a751e907c4d79c408c6
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.
    
    Conflicts:
    
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    	sw/source/core/doc/docredln.cxx
    
    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 e578be8..f68b3b6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -66,6 +66,7 @@ public:
     void testTableBorders();
     void testFdo51550();
     void testN789482();
+    void testBnc837302();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -104,6 +105,7 @@ void Test::run()
         {"table-borders.docx", &Test::testTableBorders},
         {"fdo51550.odt", &Test::testFdo51550},
         {"n789482.docx", &Test::testN789482},
+        {"bnc837302.docx", &Test::testBnc837302},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -501,6 +503,17 @@ void Test::testN789482()
     getRun(xParagraph, 5, " After.");
 }
 
+void Test::testBnc837302()
+{
+    // 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"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 729d144..d6edd76 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -297,8 +297,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
     bool bError = true;
     _CHECK_REDLINE( this )
 
-    if( IsRedlineOn() && !IsShowOriginal( eRedlineMode ) &&
-         pNewRedl->GetAuthorString().Len() )
+    if (IsRedlineOn() && !IsShowOriginal(eRedlineMode))
     {
         pNewRedl->InvalidateRange();
 


More information about the Libreoffice-commits mailing list