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 <vmiklos@collabora.com>
This commit is contained in:
Pranam Lashkari
2025-04-09 15:27:52 +02:00
committed by Miklos Vajna
parent 0c80b4440f
commit f2ed4a8493
8 changed files with 72 additions and 2 deletions
+2
View File
@@ -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
+10
View File
@@ -2988,4 +2988,14 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState;
]
SID_COPY_SLIDE
[
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
SID_PASTE_SLIDE
[
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
}
+34
View File
@@ -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;
]
@@ -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.
@@ -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
{
+12
View File
@@ -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" );
+4
View File
@@ -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);
}
+1
View File
@@ -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 } },