[Libreoffice-commits] core.git: comphelper/source include/comphelper sw/source

Caolán McNamara caolanm at redhat.com
Sat Jan 9 07:17:33 PST 2016


 comphelper/source/container/embeddedobjectcontainer.cxx |   16 +++++++++++-----
 include/comphelper/embeddedobjectcontainer.hxx          |    6 ++++--
 sw/source/core/unocore/unoframe.cxx                     |    5 ++++-
 3 files changed, 19 insertions(+), 8 deletions(-)

New commits:
commit d9b589379cbc41b920dfe3f10e6d2c53431df676
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 9 14:45:19 2016 +0000

    crashtesting: fdo85994-1.doc assert on reexport to doc
    
    try setting DefaultParentBaseURL based on the parent BaseURL
    for objects created this way
    
    Change-Id: I1a660ff6e4874321e0308d556c7ce0e10a2605fe

diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 127798f..9a91321 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -368,7 +368,7 @@ uno::Reference<embed::XEmbeddedObject> EmbeddedObjectContainer::Get_Impl(
 }
 
 uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CreateEmbeddedObject( const uno::Sequence < sal_Int8 >& rClassId,
-            const uno::Sequence < beans::PropertyValue >& rArgs, OUString& rNewName )
+            const uno::Sequence < beans::PropertyValue >& rArgs, OUString& rNewName, OUString const* pBaseURL )
 {
     if ( rNewName.isEmpty() )
         rNewName = CreateUniqueObjectName();
@@ -381,10 +381,16 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CreateEmbedde
     {
         uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() );
 
-        uno::Sequence< beans::PropertyValue > aObjDescr( rArgs.getLength() + 1 );
+        const size_t nExtraArgs = pBaseURL ? 2 : 1;
+        uno::Sequence< beans::PropertyValue > aObjDescr( rArgs.getLength() + nExtraArgs );
         aObjDescr[0].Name = "Parent";
         aObjDescr[0].Value <<= pImpl->m_xModel.get();
-        ::std::copy( rArgs.begin(), rArgs.end(), aObjDescr.getArray() + 1 );
+        if (pBaseURL)
+        {
+            aObjDescr[1].Name = "DefaultParentBaseURL";
+            aObjDescr[1].Value <<= *pBaseURL;
+        }
+        ::std::copy( rArgs.begin(), rArgs.end(), aObjDescr.getArray() + nExtraArgs );
         xObj.set( xFactory->createInstanceInitNew(
                     rClassId, OUString(), pImpl->mxStorage, rNewName,
                     aObjDescr ), uno::UNO_QUERY );
@@ -402,9 +408,9 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CreateEmbedde
     return xObj;
 }
 
-uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CreateEmbeddedObject( const uno::Sequence < sal_Int8 >& rClassId, OUString& rNewName )
+uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CreateEmbeddedObject( const uno::Sequence < sal_Int8 >& rClassId, OUString& rNewName, OUString const* pBaseURL )
 {
-    return CreateEmbeddedObject( rClassId, uno::Sequence < beans::PropertyValue >(), rNewName );
+    return CreateEmbeddedObject( rClassId, uno::Sequence < beans::PropertyValue >(), rNewName, pBaseURL );
 }
 
 void EmbeddedObjectContainer::AddEmbeddedObject( const css::uno::Reference < css::embed::XEmbeddedObject >& xObj, const OUString& rName )
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx
index b7cae38..ddbc6d0 100644
--- a/include/comphelper/embeddedobjectcontainer.hxx
+++ b/include/comphelper/embeddedobjectcontainer.hxx
@@ -98,11 +98,13 @@ public:
 
     // create an object from a ClassId
     css::uno::Reference < css::embed::XEmbeddedObject >
-                        CreateEmbeddedObject( const css::uno::Sequence < sal_Int8 >&, OUString& );
+                        CreateEmbeddedObject( const css::uno::Sequence < sal_Int8 >&, OUString&,
+                                              OUString const* pBaseURL = nullptr );
 
     css::uno::Reference < css::embed::XEmbeddedObject >
                         CreateEmbeddedObject( const css::uno::Sequence < sal_Int8 >&,
-                        const css::uno::Sequence < css::beans::PropertyValue >&, OUString& );
+                        const css::uno::Sequence < css::beans::PropertyValue >&, OUString&,
+                        OUString const* pBaseURL = nullptr );
 
     // insert an embedded object into the container - objects persistent representation will be added to the storage
     bool            InsertEmbeddedObject( const css::uno::Reference < css::embed::XEmbeddedObject >&, OUString& );
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 98bd0ae..0b253ed 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2924,7 +2924,10 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
 
                     pCnt.reset( new comphelper::EmbeddedObjectContainer );
                     OUString aName;
-                    xIPObj = pCnt->CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
+
+                    OUString sDocumentBaseURL = pDoc->GetPersist()->getDocumentBaseURL();
+                    xIPObj = pCnt->CreateEmbeddedObject(aClassName.GetByteSequence(), aName,
+                                                        &sDocumentBaseURL);
                 }
                 if ( xIPObj.is() )
                 {


More information about the Libreoffice-commits mailing list