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

Michael Stahl mstahl at redhat.com
Mon Feb 1 12:10:48 UTC 2016


 desktop/source/lib/init.cxx                                |   11 ++++--
 sw/qa/extras/htmlimport/htmlimport.cxx                     |    2 -
 sw/qa/extras/inc/swmodeltestbase.hxx                       |    1 
 sw/qa/extras/odfexport/odfexport.cxx                       |    2 -
 sw/qa/extras/odfimport/odfimport.cxx                       |    4 +-
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx                  |    4 +-
 sw/qa/extras/ooxmlimport/data/section_break_numbering.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                   |   22 ++++++++++---
 sw/qa/extras/rtfexport/rtfexport.cxx                       |    4 +-
 writerfilter/source/dmapper/DomainMapper.cxx               |   13 ++++++-
 10 files changed, 44 insertions(+), 19 deletions(-)

New commits:
commit 27b623d9743667d123532f0e5aac6f6f14fbc0a2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Feb 1 12:58:44 2016 +0100

    sw: for better or worse getParagraph() is 1-based
    
    Change-Id: I2bc99b4cbb86a368b6218b3c1a7dfc693858d1c9

diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx
index afd62ed..e6d9c92 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -116,7 +116,7 @@ DECLARE_HTMLIMPORT_TEST(testInlinedImagesPageAndParagraph, "PageAndParagraphFill
     if(nParagraphs)
     {
         // get the paragraph
-        uno::Reference< text::XTextRange > xPara = getParagraph( 0 );
+        uno::Reference<text::XTextRange> xPara = getParagraph(1);
         uno::Reference< beans::XPropertySet > xParagraphProperties( xPara, uno::UNO_QUERY);
 
         // check for Bitmap FillStyle, name empty, repeat
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index e9f974a..b154efe 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -464,6 +464,7 @@ protected:
 
     uno::Reference<text::XTextContent> getParagraphOrTable(int number, uno::Reference<text::XText> xText = uno::Reference<text::XText>()) const
     {
+        assert(number != 0); // this thing is 1-based
         uno::Reference<container::XEnumerationAccess> paraEnumAccess;
         if (xText.is())
             paraEnumAccess.set(xText, uno::UNO_QUERY);
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 6333b921..a5b1847 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -770,7 +770,7 @@ DECLARE_ODFEXPORT_TEST(testOdtBorderTypes, "border_types.odt")
 
 DECLARE_ODFEXPORT_TEST(testCellUserDefineAttr, "userdefattr-tablecell.odt")
 {
-    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(0), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
     uno::Reference<table::XCell> const xCellA1(xTable->getCellByName("A1"), uno::UNO_SET_THROW);
     uno::Reference<table::XCell> const xCellB1(xTable->getCellByName("B1"), uno::UNO_SET_THROW);
     uno::Reference<table::XCell> const xCellC1(xTable->getCellByName("C1"), uno::UNO_SET_THROW);
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index c944d44..c26a45d 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -282,7 +282,7 @@ DECLARE_ODFIMPORT_TEST(testPageStyleLayoutRight, "hello.odt")
 
 DECLARE_ODFIMPORT_TEST(testFdo61952, "hello.odt")
 {
-    uno::Reference<beans::XPropertySet> xPara(getParagraph(0), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY);
     xPara->setPropertyValue("PageDescName", uno::makeAny(OUString("Left Page")));
     xPara->setPropertyValue("PageDescName", uno::makeAny(OUString("Right Page")));
     xPara->setPropertyValue("PageDescName", uno::makeAny(OUString("Left Page")));
@@ -291,7 +291,7 @@ DECLARE_ODFIMPORT_TEST(testFdo61952, "hello.odt")
 
 DECLARE_ODFIMPORT_TEST(testFdo60842, "fdo60842.odt")
 {
-    uno::Reference<text::XTextContent> const xTable(getParagraphOrTable(0));
+    uno::Reference<text::XTextContent> const xTable(getParagraphOrTable(1));
     getCell(xTable, "A1", "");
     getCell(xTable, "B1", "18/02/2012");
     getCell(xTable, "C1", "USD"); // this is the cell with office:string-value
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index a850c81..f3cb5bc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -1091,14 +1091,14 @@ DECLARE_OOXMLEXPORT_TEST(testTableFloating, "table-floating.docx")
 DECLARE_OOXMLEXPORT_TEST(testFdo44689_start_page_0, "fdo44689_start_page_0.docx")
 {
     // The problem was that the import & export process did not analyze the 'start from page' attribute of a section
-    uno::Reference<beans::XPropertySet> xPara(getParagraph(0), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xPara, "PageNumberOffset"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo44689_start_page_7, "fdo44689_start_page_7.docx")
 {
     // The problem was that the import & export process did not analyze the 'start from page' attribute of a section
-    uno::Reference<beans::XPropertySet> xPara(getParagraph(0), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(sal_Int16(7), getProperty<sal_Int16>(xPara, "PageNumberOffset"));
 }
 
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 55853f1..2e43da1 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -799,9 +799,9 @@ DECLARE_OOXMLIMPORT_TEST(testN778836, "n778836.docx")
      * The problem was that the paragraph inherited margins from the numbering
      * and parent paragraph styles and the result was incorrect.
      */
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(1270), getProperty<sal_Int32>(getParagraph(0), "ParaRightMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(3810), getProperty<sal_Int32>(getParagraph(0), "ParaLeftMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty<sal_Int32>(getParagraph(0), "ParaFirstLineIndent"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1270), getProperty<sal_Int32>(getParagraph(1), "ParaRightMargin"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3810), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testN778140, "n778140.docx")
@@ -810,8 +810,8 @@ DECLARE_OOXMLIMPORT_TEST(testN778140, "n778140.docx")
      * The problem was that the paragraph top/bottom margins were incorrect due
      * to unhandled w:doNotUseHTMLParagraphAutoSpacing.
      */
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty<sal_Int32>(getParagraph(0), "ParaTopMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty<sal_Int32>(getParagraph(0), "ParaBottomMargin"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testN778828, "n778828.docx")
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 4a90271..235ec8e 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -876,8 +876,8 @@ DECLARE_RTFEXPORT_TEST(testNumOverrideStart, "num-override-start.rtf")
 DECLARE_RTFEXPORT_TEST(testFdo82006, "fdo82006.rtf")
 {
     // These were 176 (100 twips), as \sbauto and \sbbefore were ignored.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(0), "ParaTopMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(0), "ParaBottomMargin"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
 }
 
 DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt")
commit 57def64bec0853de7d6f4243e31e8e9650491914
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Feb 1 11:07:30 2016 +0100

    writerfilter: tdf#97417: don't insert numbering on end-of-section
    
    ... paragraph, it will be copied to every following paragraph.
    
    (Before commit 2b78f2cd7b9e4bab0f3b3b9119238f36a1bbc7b2 the properties
    of the end-of-section paragraph would be overwritten by the properties
    inside the header)
    
    Change-Id: Ibe095cf873a09ef9e12f898d09b5fd6f61c914c9

diff --git a/sw/qa/extras/ooxmlimport/data/section_break_numbering.docx b/sw/qa/extras/ooxmlimport/data/section_break_numbering.docx
new file mode 100644
index 0000000..8b5378a
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/section_break_numbering.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2fe18f8..55853f1 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -3001,6 +3001,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf60351, "tdf60351.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0),   aPolygon[5].Y);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf97417, "section_break_numbering.docx")
+{
+    // paragraph with numbering and section break was removed by writerfilter
+    // but its numbering was copied to all following paragraphs
+    CPPUNIT_ASSERT_MESSAGE("first paragraph missing numbering",
+        getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules").is());
+    uno::Reference<beans::XPropertySet> const xProps(getParagraph(2), uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("second paragraph erroneous numbering",
+        !xProps->getPropertyValue("NumberingRules").hasValue());
+
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf95970, "tdf95970.docx")
 {
     // First shape: the rotation should be -12.94 deg, it should be mirrored.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 4f2e981..96edc57 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3194,10 +3194,19 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
             bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection();
             // If the paragraph contains only the section properties and it has
             // no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section.
-            bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraph;
+            bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraph && !m_pImpl->GetIsDummyParaAddedForTableInSection();
+            if (bRemove)
+            {
+                // tdf#97417 delete numbering of the paragraph
+                // it will be deleted anyway, and the numbering would be copied
+                // to the next paragraph in sw SplitNode and then be applied to
+                // every following paragraph
+                m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->Erase(PROP_NUMBERING_RULES);
+                m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->Erase(PROP_NUMBERING_LEVEL);
+            }
             m_pImpl->SetParaSectpr(false);
             m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
-            if (bRemove && !m_pImpl->GetIsDummyParaAddedForTableInSection())
+            if (bRemove)
                 m_pImpl->RemoveLastParagraph();
         }
         else
commit 61e80cd9e3e425674e18221237b8b0574645f377
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Feb 1 12:31:32 2016 +0100

    libreofficekit: fix inverted condition
    
    ... that prevented loading the same URL multiple times.  Also make this
    exception-safe while at it.
    
    Change-Id: Ic71735fef1ad8f79a210279d4d03f1fd5fa8cf69

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dc1a04f..13e0f6c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -33,6 +33,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
 #include <comphelper/propertysequence.hxx>
+#include <comphelper/scopeguard.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
@@ -529,6 +530,12 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
         rtl::Reference<LOKInteractionHandler> const pInteraction(
             new LOKInteractionHandler(::comphelper::getProcessComponentContext(), pLib));
         auto const pair(pLib->mInteractionMap.insert(std::make_pair(aURL.toUtf8(), pInteraction)));
+        comphelper::ScopeGuard const g([&] () {
+                if (pair.second)
+                {
+                    pLib->mInteractionMap.erase(aURL.toUtf8());
+                }
+            });
         uno::Reference<task::XInteractionHandler2> const xInteraction(pInteraction.get());
         aFilterOptions[1].Name = "InteractionHandler";
         aFilterOptions[1].Value <<= xInteraction;
@@ -549,10 +556,6 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
                                             aFilterOptions);
 
         assert(!xComponent.is() || pair.second); // concurrent loading of same URL ought to fail
-        if (!pair.second)
-        {
-            pLib->mInteractionMap.erase(aURL.toUtf8());
-        }
 
         if (!xComponent.is())
         {


More information about the Libreoffice-commits mailing list