diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-02-02 22:35:39 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-05 21:03:36 +0000 |
commit | 84b4b7b931b194fc4d1980d2fa9c7fd6e0c9134c (patch) | |
tree | c9ba999c1d4a8de32b595499b5e0629e0ac2797e /sd | |
parent | 7cd90162f1c4a1d763e40c8f9972fd59e219ccd1 (diff) |
fdo#51525 Add Paste Unformatted Text to Impress.
Change-Id: I4eff66ee2990fd7bf6a9be6b9f0801e7a70206e9
Reviewed-on: https://gerrit.libreoffice.org/7783
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/sdi/_drvwsh.sdi | 5 | ||||
-rw-r--r-- | sd/sdi/outlnvsh.sdi | 5 | ||||
-rw-r--r-- | sd/source/ui/app/sddll.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/func/fuoltext.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/func/fupoor.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/inc/fuoltext.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/fupoor.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drviewse.cxx | 24 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvs2.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 25 |
11 files changed, 101 insertions, 0 deletions
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 857b30e7d30c..5e3373e9a03c 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -96,6 +96,11 @@ interface DrawView ExecMethod = FuSupport ; StateMethod = GetMenuState ; ] + SID_PASTE_UNFORMATTED + [ + ExecMethod = FuSupport ; + StateMethod = GetMenuState ; + ] SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = FuSupport ; diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi index 72169349ffb9..dae93d65f556 100644 --- a/sd/sdi/outlnvsh.sdi +++ b/sd/sdi/outlnvsh.sdi @@ -36,6 +36,11 @@ interface OutlineView ExecMethod = FuSupport ; StateMethod = GetMenuState ; ] + SID_PASTE_UNFORMATTED // ole : no, status : ? + [ + ExecMethod = FuSupport ; + StateMethod = GetMenuState ; + ] SID_DELETE // ole : no, status : ? [ ExecMethod = FuSupport ; diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index f7a27c0e65ba..1863c758ae47 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -262,6 +262,7 @@ void SdDLL::RegisterControllers() svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod ); SvxClipBoardControl::RegisterControl( SID_PASTE, pMod ); + SvxClipBoardControl::RegisterControl( SID_PASTE_UNFORMATTED, pMod ); svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod ); diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx index 228360705491..09ee7d339f69 100644 --- a/sd/source/ui/func/fuoltext.cxx +++ b/sd/source/ui/func/fuoltext.cxx @@ -278,6 +278,21 @@ void FuOutlineText::DoPaste() pOutlineView->GetViewByWindow(mpWindow)->PasteSpecial(); } +/** + * Paste object as unformatted text from clipboard + */ +void FuOutlineText::DoPasteUnformatted() +{ + TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mpViewShell->GetActiveWindow() ) ); + if (aDataHelper.GetTransferable().is()) + { + OUString aText; + if (aDataHelper.GetString(FORMAT_STRING, aText)) + pOutlineView->GetViewByWindow(mpWindow)->InsertText(aText); + } +} + + } // end of namespace sd diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx index f681b232d9fa..e40553669a15 100644 --- a/sd/source/ui/func/fupoor.cxx +++ b/sd/source/ui/func/fupoor.cxx @@ -938,6 +938,24 @@ void FuPoor::DoPaste() } /** + * Paste unformatted text from clipboard + */ +void FuPoor::DoPasteUnformatted() +{ + if (mpView) + { + sal_Int8 nAction = DND_ACTION_COPY; + TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mpViewShell->GetActiveWindow() ) ); + if (aDataHelper.GetTransferable().is()) + { + mpView->InsertData( aDataHelper, + mpWindow->PixelToLogic( Rectangle( Point(), mpWindow->GetOutputSizePixel() ).Center() ), + nAction, sal_False, FORMAT_STRING); + } + } +} + +/** * Timer handler for Drag&Drop */ IMPL_LINK_NOARG(FuPoor, DragHdl) diff --git a/sd/source/ui/inc/fuoltext.hxx b/sd/source/ui/inc/fuoltext.hxx index c98ea090d47d..7aea47b56ce1 100644 --- a/sd/source/ui/inc/fuoltext.hxx +++ b/sd/source/ui/inc/fuoltext.hxx @@ -50,6 +50,7 @@ public: virtual void DoCut(); virtual void DoCopy(); virtual void DoPaste(); + virtual void DoPasteUnformatted(); virtual void Activate(); // Function aktivieren virtual void Deactivate(); // Function deaktivieren diff --git a/sd/source/ui/inc/fupoor.hxx b/sd/source/ui/inc/fupoor.hxx index a633eba14fbf..a41464d5b91e 100644 --- a/sd/source/ui/inc/fupoor.hxx +++ b/sd/source/ui/inc/fupoor.hxx @@ -63,6 +63,7 @@ public: virtual void DoCut(); virtual void DoCopy(); virtual void DoPaste(); + virtual void DoPasteUnformatted(); // Mouse- & Key-Events; Returnwert=sal_True: Event wurde bearbeitet virtual sal_Bool KeyInput(const KeyEvent& rKEvt); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 59819b0d9207..2ee338859dad 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -198,6 +198,7 @@ IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper SfxBindings& rBindings = GetViewFrame()->GetBindings(); rBindings.Invalidate( SID_PASTE ); rBindings.Invalidate( SID_PASTE_SPECIAL ); + rBindings.Invalidate( SID_PASTE_UNFORMATTED ); rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } return 0; @@ -601,6 +602,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) // clipboard (paste) if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE_SPECIAL ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE_UNFORMATTED ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) ) { if ( !mpClipEvtLstnr ) @@ -627,6 +629,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { rSet.DisableItem( SID_PASTE ); rSet.DisableItem( SID_PASTE_SPECIAL ); + rSet.DisableItem( SID_PASTE_UNFORMATTED ); rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS ); } else if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) ) @@ -1062,6 +1065,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { rSet.DisableItem( SID_PASTE ); rSet.DisableItem( SID_PASTE_SPECIAL ); + rSet.DisableItem( SID_PASTE_UNFORMATTED ); rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS ); rSet.DisableItem( SID_INSERT_FLD_DATE_FIX ); diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 0c83d6c3a309..9ef7de839d39 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -798,6 +798,30 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) } break; + case SID_PASTE_UNFORMATTED: + { + WaitObject aWait( (Window*)GetActiveWindow() ); + + if(HasCurrentFunction()) + { + GetCurrentFunction()->DoPasteUnformatted(); + } + else if(mpDrawView) + { + sal_Int8 nAction = DND_ACTION_COPY; + TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) ); + if (aDataHelper.GetTransferable().is()) + { + mpDrawView->InsertData( aDataHelper, + GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ), + nAction, sal_False, FORMAT_STRING); + } + } + + rReq.Ignore (); + } + break; + case SID_CLIPBOARD_FORMAT_ITEMS: { WaitObject aWait( (Window*)GetActiveWindow() ); diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 1f2370a6a14e..8d1703c3bd06 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -331,6 +331,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) Invalidate(SID_CUT); Invalidate(SID_COPY); Invalidate(SID_PASTE); + Invalidate(SID_PASTE_UNFORMATTED); } void OutlineViewShell::ShowSlideShow(SfxRequest& rReq) @@ -628,6 +629,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) Invalidate(SID_CUT); Invalidate(SID_COPY); Invalidate(SID_PASTE); + Invalidate(SID_PASTE_UNFORMATTED); } diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index c0e7ecd36ac1..cfdbfc7e8e48 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -475,6 +475,7 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq) (nSlot == SID_TRANSLITERATE_KATAGANA) || (nSlot == SID_CUT) || (nSlot == SID_PASTE) || + (nSlot == SID_PASTE_UNFORMATTED) || (nSlot == SID_DELETE))) { aGuard.reset( new OutlineViewModelChangeGuard( *pOlView ) ); @@ -529,6 +530,29 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq) } break; + case SID_PASTE_UNFORMATTED: + { + OutlineViewPageChangesGuard aGuard2(pOlView); + + if(HasCurrentFunction()) + { + GetCurrentFunction()->DoPasteUnformatted(); + } + else if(pOlView) + { + sal_Int8 nAction = DND_ACTION_COPY; + TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) ); + if (aDataHelper.GetTransferable().is()) + { + pOlView->InsertData( aDataHelper, + GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ), + nAction, sal_False, FORMAT_STRING); + } + } + + rReq.Ignore (); + } + break; case SID_DELETE: { if( pOlView ) @@ -735,6 +759,7 @@ IMPL_LINK( OutlineViewShell, ClipboardChanged, TransferableDataHelper*, pDataHel SfxBindings& rBindings = GetViewFrame()->GetBindings(); rBindings.Invalidate( SID_PASTE ); rBindings.Invalidate( SID_PASTE_SPECIAL ); + rBindings.Invalidate( SID_PASTE_UNFORMATTED ); rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } return 0; |