diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/docsh.hxx | 3 | ||||
-rw-r--r-- | sw/source/ui/app/docsh.cxx | 17 | ||||
-rw-r--r-- | sw/source/ui/uiview/view2.cxx | 7 |
3 files changed, 26 insertions, 1 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 267060338d7a..f8f60bf71684 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -93,6 +93,9 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener SW_DLLPRIVATE virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False ); + SW_DLLPRIVATE virtual bool InsertGeneratedStream(SfxMedium& rMedium, + css::uno::Reference<css::text::XTextRange> const& xInsertPosition) + SAL_OVERRIDE; /// Make DocInfo known to the Doc. SW_DLLPRIVATE virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index e4f95338416f..e96af964120e 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -106,6 +106,7 @@ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <unomid.h> +#include <unotextrange.hxx> #include <sfx2/Metadatable.hxx> #include <switerator.hxx> @@ -124,6 +125,22 @@ TYPEINIT2(SwDocShell, SfxObjectShell, SfxListener); SFX_IMPL_OBJECTFACTORY(SwDocShell, SvGlobalName(SO3_SW_CLASSID), SFXOBJECTSHELL_STD_NORMAL|SFXOBJECTSHELL_HASMENU, "swriter" ) +bool SwDocShell::InsertGeneratedStream(SfxMedium & rMedium, + uno::Reference<text::XTextRange> const& xInsertPosition) +{ + SwUnoInternalPaM aPam(*GetDoc()); // must have doc since called from SwView + if (!::sw::XTextRangeToSwPaM(aPam, xInsertPosition)) + return false; + // similar to SwView::InsertMedium + SwReader *pReader(0); + Reader *const pRead = StartConvertFrom(rMedium, &pReader, 0, &aPam); + if (!pRead) + return false; + sal_uLong const nError = pReader->Read(*pRead); + delete pReader; + return 0 == nError; +} + // Prepare loading Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, SwCrsrShell *pCrsrShell, diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index ecfaa893e602..06ea67fa70d2 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -131,6 +131,7 @@ #include <fmthdft.hxx> #include <svx/ofaitem.hxx> #include <unomid.h> +#include <unotextrange.hxx> #include <docstat.hxx> #include <wordcountdialog.hxx> @@ -2150,7 +2151,11 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe else { ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); - nErrno = pDocSh->ImportFrom( *pMedium, true ) ? 0 : ERR_SWG_READ_ERROR; + uno::Reference<text::XTextRange> const xInsertPosition( + SwXTextRange::CreateXTextRange(*pDoc, + *m_pWrtShell->GetCrsr()->GetPoint(), 0)); + nErrno = pDocSh->ImportFrom(*pMedium, xInsertPosition) + ? 0 : ERR_SWG_READ_ERROR; } } |