Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2587

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/87/2587/1

fdo#61343 fix DOCX import of OLE object after groupshape

Change-Id: I88d5e49cc3fb915d25c1b2576cdda1fffc9e2f23
(cherry picked from commit 344e4a25eac6505678f4ce8a6c1c8cef83c68276)
---
A sw/qa/extras/ooxmlimport/data/fdo61343.docx
M sw/qa/extras/ooxmlimport/ooxmlimport.cxx
M writerfilter/source/dmapper/DomainMapper_Impl.cxx
3 files changed, 25 insertions(+), 1 deletion(-)



diff --git a/sw/qa/extras/ooxmlimport/data/fdo61343.docx 
b/sw/qa/extras/ooxmlimport/data/fdo61343.docx
new file mode 100755
index 0000000..9ab9973
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/fdo61343.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 1ade3ed..3f5a070 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -113,6 +113,7 @@
     void testN779642();
     void testFdo53985();
     void testFdo59638();
+    void testFdo61343();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -178,6 +179,7 @@
         {"n779642.docx", &Test::testN779642},
         {"fdo53985.docx", &Test::testFdo53985},
         {"fdo59638.docx", &Test::testFdo59638},
+        {"fdo61343.docx", &Test::testFdo61343},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1121,6 +1123,15 @@
     CPPUNIT_FAIL("no BulletChar property");
 }
 
+void Test::testFdo61343()
+{
+    // The problem was that there were a groupshape in the doc, followed by an
+    // OLE object, and this lead to a crash.
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), 
uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a3cc27c..6074add 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1625,6 +1625,19 @@
     uno::Reference<text::XTextAppend> xTextAppend = m_aTextAppendStack.top().xTextAppend;
     try
     {
+        uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW );
+        if (xSInfo->supportsService("com.sun.star.drawing.GroupShape"))
+        {
+            // A GroupShape doesn't implement text::XTextRange, but appending
+            // an empty reference to the stacks still makes sense, because this
+            // way bToRemove can be set, and we won't end up with duplicated
+            // shapes for OLE objects.
+            m_aTextAppendStack.push(TextAppendContext(uno::Reference<text::XTextAppend>(xShape, 
uno::UNO_QUERY), uno::Reference<text::XTextCursor>()));
+            uno::Reference<text::XTextContent> xTxtContent(xShape, uno::UNO_QUERY);
+            m_aAnchoredStack.push(xTxtContent);
+        }
+        else
+        {
         uno::Reference< text::XTextRange > xShapeText( xShape, uno::UNO_QUERY_THROW);
         // Add the shape to the text append stack
         m_aTextAppendStack.push( TextAppendContext(uno::Reference< text::XTextAppend >( xShape, 
uno::UNO_QUERY_THROW ),
@@ -1640,7 +1653,6 @@
 #ifdef DEBUG_DOMAINMAPPER
         dmapper_logger->unoPropertySet(xProps);
 #endif
-        uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW );
         bool bIsGraphic = xSInfo->supportsService( "com.sun.star.drawing.GraphicObjectShape" );
 
         // If there are position properties, the shape should not be inserted "as character".
@@ -1668,6 +1680,7 @@
         {
             xProps->setPropertyValue( rPropNameSupplier.GetName( PROP_ANCHOR_TYPE ), bIsGraphic  ? 
 uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) : uno::makeAny( 
text::TextContentAnchorType_AT_PARAGRAPH ) );
         }
+        }
 
         appendTableManager( );
         appendTableHandler( );

-- 
To view, visit https://gerrit.libreoffice.org/2587
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I88d5e49cc3fb915d25c1b2576cdda1fffc9e2f23
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Miklos Vajna <vmiklos@suse.cz>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.