diff options
Diffstat (limited to 'sw/source/uibase/uno/unotxvw.cxx')
-rw-r--r-- | sw/source/uibase/uno/unotxvw.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 7dbdb7574bc9..42ae9a02634b 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -143,6 +143,7 @@ Sequence< uno::Type > SAL_CALL SwXTextView::getTypes( ) cppu::UnoType<XRubySelection>::get(), cppu::UnoType<XPropertySet>::get(), cppu::UnoType<datatransfer::XTransferableSupplier>::get(), + cppu::UnoType<datatransfer::XTransferableTextSupplier>::get(), SfxBaseController::getTypes() ).getTypes(); } @@ -210,6 +211,11 @@ uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType ) uno::Reference<datatransfer::XTransferableSupplier> xRet = this; aRet <<= xRet; } + else if(aType == cppu::UnoType<datatransfer::XTransferableTextSupplier>::get()) + { + uno::Reference<datatransfer::XTransferableTextSupplier> xRet = this; + aRet <<= xRet; + } else aRet = SfxBaseController::queryInterface(aType); return aRet; @@ -1710,6 +1716,29 @@ SwPaM* SwXTextViewCursor::GetPaM() return rSh.GetCursor(); } +uno::Reference<datatransfer::XTransferable> SAL_CALL +SwXTextView::getTransferableForTextRange(uno::Reference<text::XTextRange> const& xTextRange) +{ + SolarMutexGuard aGuard; + + // the point is we can copy PaM that wouldn't be legal as shell cursor + SwUnoInternalPaM aPam(*m_pView->GetDocShell()->GetDoc()); + if (!::sw::XTextRangeToSwPaM(aPam, xTextRange, ::sw::TextRangeMode::AllowNonTextNode)) + { + throw uno::RuntimeException("invalid text range"); + } + + //force immediate shell update + GetView()->StopShellTimer(); + SwWrtShell& rSh = GetView()->GetWrtShell(); + SwTransferable *const pTransfer = new SwTransferable(rSh); + const bool bLockedView = rSh.IsViewLocked(); + rSh.LockView( true ); + pTransfer->PrepareForCopyTextRange(aPam); + rSh.LockView( bLockedView ); + return uno::Reference<datatransfer::XTransferable>(pTransfer); +} + uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable() { SolarMutexGuard aGuard; |