sd/inc/app.hrc | 2 + sd/sdi/_drvwsh.sdi | 10 +++++ sd/sdi/sdraw.sdi | 34 +++++++++++++++++ sd/source/ui/slidesorter/controller/SlsClipboard.cxx | 3 + sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 8 +++- sd/source/ui/view/drviews2.cxx | 12 ++++++ sd/source/ui/view/drviews7.cxx | 4 ++ sfx2/source/control/unoctitm.cxx | 1 8 files changed, 72 insertions(+), 2 deletions(-)
New commits: commit f2ed4a849375a6cd22b0335352cccb3b5f4ba732 Author: Pranam Lashkari <lpra...@collabora.com> AuthorDate: Fri Mar 7 07:13:59 2025 +0530 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Apr 9 15:27:52 2025 +0200 uno: introduced command to copy slides problem: in online though kit process it was difficult to trigger the slidesorter clipboard to copy slides. Difficulty was caused by slidesorter using its own viewshell to copy and online triggering copy command on drawviewshell. It's more convenient to use a different command rather than jumping between viewshells in this case Change-Id: I347ad0044efa64a3e5dcd26aeb16fe5b8103bb12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183924 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 8ff088781df6..1dbacbba5a16 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -368,6 +368,8 @@ #define SID_EXPAND_PAGE (SID_SD_START+343) #define SID_SUMMARY_PAGE (SID_SD_START+344) #define SID_LEAVE_ALL_GROUPS (SID_SD_START+345) +#define SID_COPY_SLIDE (SID_SD_START+346) +#define SID_PASTE_SLIDE (SID_SD_START+347) // FREE #define SID_SLIDE_MASTER_MODE TypedWhichId<SfxBoolItem>(SID_SD_START+348) // FREE diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index b0c655176b1b..2aee9b626abc 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -2988,4 +2988,14 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetMenuState; ] + SID_COPY_SLIDE + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] + SID_PASTE_SLIDE + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] } diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi index 3acde8972344..3c0e3fceb424 100644 --- a/sd/sdi/sdraw.sdi +++ b/sd/sdi/sdraw.sdi @@ -4735,3 +4735,37 @@ SfxVoidItem AlignOnPage SID_ALIGN_PAGE ToolBoxConfig = TRUE, GroupId = SfxGroupId::Modify; ] + +SfxVoidItem CopySlide SID_COPY_SLIDE +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Edit; +] + +SfxVoidItem PasteSlide SID_PASTE_SLIDE +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Edit; +] diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index c404cb0b8561..834371579a03 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -55,6 +55,7 @@ #include <DrawDocShell.hxx> #include <sdpage.hxx> #include <sdtreelb.hxx> +#include <app.hrc> #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <sfx2/request.hxx> @@ -170,6 +171,7 @@ void Clipboard::HandleSlotCall (SfxRequest& rRequest) break; case SID_COPY: + case SID_COPY_SLIDE: if (mrSlideSorter.GetModel().GetEditMode() != EditMode::MasterPage) { if(xFunc.is()) @@ -181,6 +183,7 @@ void Clipboard::HandleSlotCall (SfxRequest& rRequest) break; case SID_PASTE: + case SID_PASTE_SLIDE: // Prevent redraws while inserting pages from the clipboard // because the intermediate inconsistent state might lead to // a crash. diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 17482e36957f..7c749e318692 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -365,6 +365,7 @@ void SlotManager::FuSupport (SfxRequest& rRequest) break; case SID_PASTE: + case SID_PASTE_SLIDE: { SdTransferable* pTransferClip = SdModule::get()->pTransferClip; if( pTransferClip ) @@ -392,6 +393,7 @@ void SlotManager::FuSupport (SfxRequest& rRequest) case SID_CUT: case SID_COPY: case SID_DELETE: + case SID_COPY_SLIDE: mrSlideSorter.GetView().EndTextEditAllViews(); mrSlideSorter.GetController().GetClipboard().HandleSlotCall(rRequest); break; @@ -699,14 +701,16 @@ void SlotManager::GetClipboardState ( SfxItemSet& rSet) { SdTransferable* pTransferClip = SdModule::get()->pTransferClip; - if (rSet.GetItemState(SID_PASTE) == SfxItemState::DEFAULT - || rSet.GetItemState(SID_PASTE_SPECIAL) == SfxItemState::DEFAULT) + if (rSet.GetItemState(SID_PASTE) == SfxItemState::DEFAULT + || rSet.GetItemState(SID_PASTE_SPECIAL) == SfxItemState::DEFAULT + || rSet.GetItemState(SID_PASTE_SLIDE) == SfxItemState::DEFAULT) { // no own clipboard data? if ( !pTransferClip || !pTransferClip->GetDocShell().is() ) { rSet.DisableItem(SID_PASTE); rSet.DisableItem(SID_PASTE_SPECIAL); + rSet.DisableItem(SID_PASTE_SLIDE); } else { diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 3f9d2655b0da..91803f91dea1 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -192,6 +192,7 @@ #include <SlideSorterViewShell.hxx> #include <controller/SlideSorterController.hxx> #include <controller/SlsPageSelector.hxx> +#include <controller/SlsClipboard.hxx> #include <tools/GraphicSizeCheck.hxx> #include <theme/ThemeColorChanger.hxx> @@ -4255,6 +4256,17 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) Cancel(); break; + case SID_PASTE_SLIDE: + case SID_COPY_SLIDE: + { + sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()) + ->GetSlideSorter() + .GetController() + .FuSupport(rReq); + Cancel(); + rReq.Done(); + } + break; default: { SAL_WARN( "sd.ui", "Slot without function" ); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 0b2502d289eb..e56f3f6da9d0 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1069,6 +1069,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) rSet.DisableItem( SID_PASTE ); rSet.DisableItem( SID_PASTE_SPECIAL ); rSet.DisableItem( SID_PASTE_UNFORMATTED ); + rSet.DisableItem( SID_PASTE_SLIDE ); rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS ); rSet.DisableItem( SID_INSERT_FLD_DATE_FIX ); @@ -1613,6 +1614,9 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) } } + if (!SdModule::get()->pTransferClip) + rSet.DisableItem(SID_PASTE_SLIDE); + GetModeSwitchingMenuState (rSet); } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index c0e2dfbb4c73..8dcb14d2b1ee 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1382,6 +1382,7 @@ const std::map<std::u16string_view, KitUnoCommand>& GetKitUnoCommandList() { u"DistributeVertTop", { PayloadType::EnabledPayload, true } }, { u"AnimationEffects", { PayloadType::EnabledPayload, true } }, { u"ExecuteAnimationEffect", { PayloadType::EnabledPayload, true } }, + { u"PasteSlide", { PayloadType::EnabledPayload, true } }, { u"ParaLeftToRight", { PayloadType::ParaDirectionPayload, true } }, { u"ParaRightToLeft", { PayloadType::ParaDirectionPayload, true } },