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

Christoph Lutz christoph.lutz_ml at cib.de
Wed Apr 8 09:08:30 PDT 2015


 sw/source/uibase/uno/unomailmerge.cxx |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 098d08d6af951afa4f20f6f7883f6c9d34e87e11
Author: Christoph Lutz <christoph.lutz_ml at cib.de>
Date:   Wed Apr 8 14:57:28 2015 +0000

    MM: fixed invalid UNO-Reference as return value of UNO MailMergeService
    
    This fix is regarding 9835bb562 "MM: export the SwDocShell mail merge via UNO":
    
    In case of using the new output type MailMergeType.SHELL, the UNO
    MailMergeService returned a XTextDocument instance that was not
    correctly initialized. In particular after calling doc.getCurrentController()
    (with doc = the returned instance) we recieved NULL. The reason was, that the
    previous implementation used to create a new SwXTextDocument instance
    instead of just returning the BaseModel that is already associated with
    the internal SwDocShell. This is fixed in this patch.
    
    I also tested this patch with the unit test sw/CppunitTest_sw_mailmerge
    and everything seems to be fine now. doc.getCurrentController() no longer
    returns NULL.
    
    Change-Id: Ic116f8f25ab9686ef56950e97ba202a55ab81fb8
    Reviewed-on: https://gerrit.libreoffice.org/15207
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index 3839011..626c374 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -827,8 +827,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
 
     if (DBMGR_MERGE_SHELL == nMergeType)
     {
-        SwXTextDocument *xTextDoc = new SwXTextDocument( aMergeDesc.pMailMergeConfigItem->GetTargetView()->GetDocShell() );
-        return makeAny( Reference< XComponent >( xTextDoc->queryInterface( XComponent::static_type() ), css::uno::UNO_QUERY) );
+        return makeAny( aMergeDesc.pMailMergeConfigItem->GetTargetView()->GetDocShell()->GetBaseModel() );
     }
     else
         return makeAny( true );


More information about the Libreoffice-commits mailing list