summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore/unocrsrhelper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore/unocrsrhelper.cxx')
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx55
1 files changed, 27 insertions, 28 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index a82e7a1c2308..451c9cce7fa4 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1116,39 +1116,38 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
SfxObjectShellRef aRef( pDocSh );
pMed->Download(); // if necessary: start the download
- if( aRef.is() && 1 < aRef->GetRefCount() ) // Ref still valid?
- {
- SwReaderPtr pRdr;
- SfxItemSet* pSet = pMed->GetItemSet();
- pSet->Put(SfxBoolItem(FN_API_CALL, true));
- if(!sPassword.isEmpty())
- pSet->Put(SfxStringItem(SID_PASSWORD, sPassword));
- Reader *pRead = pDocSh->StartConvertFrom( *pMed, pRdr, nullptr, pUnoCursor);
- if( pRead )
- {
+ if( !(aRef.is() && 1 < aRef->GetRefCount()) ) // Ref still valid?
+ return;
- UnoActionContext aContext(pDoc);
+ SwReaderPtr pRdr;
+ SfxItemSet* pSet = pMed->GetItemSet();
+ pSet->Put(SfxBoolItem(FN_API_CALL, true));
+ if(!sPassword.isEmpty())
+ pSet->Put(SfxStringItem(SID_PASSWORD, sPassword));
+ Reader *pRead = pDocSh->StartConvertFrom( *pMed, pRdr, nullptr, pUnoCursor);
+ if( !pRead )
+ return;
- if(pUnoCursor->HasMark())
- pDoc->getIDocumentContentOperations().DeleteAndJoin(*pUnoCursor);
+ UnoActionContext aContext(pDoc);
- SwNodeIndex aSave( pUnoCursor->GetPoint()->nNode, -1 );
- sal_Int32 nContent = pUnoCursor->GetPoint()->nContent.GetIndex();
+ if(pUnoCursor->HasMark())
+ pDoc->getIDocumentContentOperations().DeleteAndJoin(*pUnoCursor);
- ErrCode nErrno = pRdr->Read( *pRead ); // and paste the document
+ SwNodeIndex aSave( pUnoCursor->GetPoint()->nNode, -1 );
+ sal_Int32 nContent = pUnoCursor->GetPoint()->nContent.GetIndex();
- if(!nErrno)
- {
- ++aSave;
- pUnoCursor->SetMark();
- pUnoCursor->GetMark()->nNode = aSave;
-
- SwContentNode* pCntNode = aSave.GetNode().GetContentNode();
- if( !pCntNode )
- nContent = 0;
- pUnoCursor->GetMark()->nContent.Assign( pCntNode, nContent );
- }
- }
+ ErrCode nErrno = pRdr->Read( *pRead ); // and paste the document
+
+ if(!nErrno)
+ {
+ ++aSave;
+ pUnoCursor->SetMark();
+ pUnoCursor->GetMark()->nNode = aSave;
+
+ SwContentNode* pCntNode = aSave.GetNode().GetContentNode();
+ if( !pCntNode )
+ nContent = 0;
+ pUnoCursor->GetMark()->nContent.Assign( pCntNode, nContent );
}
}