[Libreoffice-commits] core.git: Branch 'libreoffice-4-1-4' - 2 commits - sw/qa sw/source writerfilter/source

Jan Holesovsky kendy at collabora.com
Tue Dec 3 11:54:32 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 7418a5ab18955a76b38512ef757c873d149d6c02
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.
    
    Conflicts:
    	writerfilter/source/dmapper/DomainMapper_Impl.cxx
    
    Change-Id: I5c3903a40b69867684707d33acbc92b1f80a93ec
    Reviewed-on: https://gerrit.libreoffice.org/6898
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d7a5c8b..1372151 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<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 ded106d..131559f 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<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 6837d5ef4120c964735ba1a5d4f47c5ba76d5c1c
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.
    
    Signed-off-by: Andras Timar <andras.timar at collabora.com>
    
    Conflicts:
    
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    	sw/source/core/doc/docredln.cxx
    
    Change-Id: I475fa63f9a4a3219a2b898b6f7d81e0603d32c18
    Reviewed-on: https://gerrit.libreoffice.org/6897
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

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 c1bb45e..d7a5c8b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -77,6 +77,7 @@ public:
     void testBnc834035();
     void testCp1000015();
     void testFdo70812();
+    void testBnc837302();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -138,6 +139,7 @@ void Test::run()
         {"bnc834035.odt", &Test::testBnc834035},
         {"cp1000015.odt", &Test::testCp1000015},
         {"fdo70812.docx", &Test::testFdo70812},
+        {"bnc837302.docx", &Test::testBnc837302},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -789,6 +791,17 @@ void Test::testFdo70812()
     getParagraph(1, "Sample pages document.");
 }
 
+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 a6a92a1..1e9a073 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -293,8 +293,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
     bool bError = true;
     _CHECK_REDLINE( this )
 
-    if( IsRedlineOn() && !IsShowOriginal( meRedlineMode ) &&
-         pNewRedl->GetAuthorString().Len() )
+    if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
     {
         pNewRedl->InvalidateRange();
 


More information about the Libreoffice-commits mailing list