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 1f2ea09c597d8af82f53d4eb219b1235af9fda3e Author: Pranam Lashkari <lpra...@collabora.com> AuthorDate: Fri Mar 7 07:13:59 2025 +0530 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Mar 7 09:36:26 2025 +0100 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/+/182605 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index d2524fe39b1f..06f29f002bd6 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 36ffca5bef2a..14ff9035341f 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -2958,4 +2958,14 @@ interface DrawView ExecMethod = FuTemporary; StateMethod = GetAttrState; ] + 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 7ea8365aac1b..208bc10a3f3e 100644 --- a/sd/sdi/sdraw.sdi +++ b/sd/sdi/sdraw.sdi @@ -4721,3 +4721,37 @@ SfxBoolItem UnderlineDotted SID_ULINE_VAL_DOTTED ToolBoxConfig = TRUE, GroupId = SfxGroupId::Format; ] + +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 90fa0b7d7399..4a738b0f3e1a 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 3d1d822ee24d..f694cd9a31b8 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 = SD_MOD()->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 = SD_MOD()->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 7626fb6427e3..787fc86825ef 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> @@ -4240,6 +4241,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 fe47f9095616..d2cfb5f4496f 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1067,6 +1067,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 ); @@ -1609,6 +1610,9 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) } } + if (!SD_MOD()->pTransferClip) + rSet.DisableItem(SID_PASTE_SLIDE); + GetModeSwitchingMenuState (rSet); } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 26a8e694fd12..c56842f18713 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1342,6 +1342,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 } },