sd/inc/app.hrc                 |    2 +-
 sd/sdi/sdraw.sdi               |    2 +-
 sd/source/ui/view/viewshe3.cxx |   10 ++++++----
 3 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit b4ca18af675cce0d68b8504c04cf4c9d755310a4
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Fri Jun 2 03:43:05 2023 +0700
Commit:     Pranam Lashkari <lpra...@collabora.com>
CommitDate: Tue Jun 6 20:38:28 2023 +0200

    sd: introduced impress slide duplication to particular position
    
    Change-Id: I4931f92158c31506b765376639907d2d4f250deb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152512
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-by: Pranam Lashkari <lpra...@collabora.com>

diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index dcd09a8c7e46..1e9240feace0 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -245,7 +245,7 @@
 #define ID_VAL_ISACTIVE                     (SID_SD_START+216)
 #define ID_VAL_WHATKIND                     (SID_SD_START+217)
 #define ID_VAL_PAGEWIDTH                    (SID_SD_START+218)
-    // FREE
+#define ID_INSERT_POS                       (SID_SD_START+219)
 #define ID_VAL_PAGETOP                      (SID_SD_START+220)
 #define ID_VAL_PAGEBOTTOM                   (SID_SD_START+221)
 #define ID_VAL_PAGELEFT                     (SID_SD_START+222)
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 09124f3f4a81..932eb01e8a21 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -1337,7 +1337,7 @@ SfxBoolItem DrawingMode SID_DRAWINGMODE
 ]
 
 SfxVoidItem DuplicatePage SID_DUPLICATE_PAGE
-(SfxStringItem PageName ID_VAL_PAGENAME,SfxUInt32Item WhatLayout 
ID_VAL_WHATLAYOUT,SfxBoolItem IsPageBack ID_VAL_ISPAGEBACK,SfxBoolItem 
IsPageObj ID_VAL_ISPAGEOBJ)
+(SfxStringItem PageName ID_VAL_PAGENAME,SfxUInt32Item WhatLayout 
ID_VAL_WHATLAYOUT,SfxBoolItem IsPageBack ID_VAL_ISPAGEBACK,SfxBoolItem 
IsPageObj ID_VAL_ISPAGEOBJ,SfxUInt16Item InsertPos ID_INSERT_POS)
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx
index a7d466f6d94b..cb76eaf99844 100644
--- a/sd/source/ui/view/viewshe3.cxx
+++ b/sd/source/ui/view/viewshe3.cxx
@@ -189,7 +189,9 @@ SdPage* ViewShell::CreateOrDuplicatePage (
 
     // 1. Process the arguments.
     const SfxItemSet* pArgs = rRequest.GetArgs();
-    if (! pArgs)
+    const SfxUInt16Item* pInsertPos = 
rRequest.GetArg<SfxUInt16Item>(ID_INSERT_POS);
+
+    if (! pArgs || (pArgs->Count() == 1 && pInsertPos))
     {
         // AutoLayouts must be ready
         pDocument->StopWorkStartupDelay();
@@ -206,7 +208,7 @@ SdPage* ViewShell::CreateOrDuplicatePage (
                 eNotesLayout = pNotesTemplatePage->GetAutoLayout();
         }
     }
-    else if (pArgs->Count() == 1)
+    else if (pArgs->Count() == 1 || pArgs->Count() == 2)
     {
         pDocument->StopWorkStartupDelay();
         const SfxUInt32Item* pLayout = 
rRequest.GetArg<SfxUInt32Item>(ID_VAL_WHATLAYOUT);
@@ -222,7 +224,7 @@ SdPage* ViewShell::CreateOrDuplicatePage (
             }
         }
     }
-    else if (pArgs->Count() == 4)
+    else if (pArgs->Count() == 4 || pArgs->Count() == 5)
     {
         // AutoLayouts must be ready
         pDocument->StopWorkStartupDelay();
@@ -354,7 +356,7 @@ SdPage* ViewShell::CreateOrDuplicatePage (
                     aNotesPageName,
                     bIsPageBack,
                     bIsPageObj,
-                    nInsertPosition);
+                    pInsertPos ? (pInsertPos->GetValue()*2)+1 : 
nInsertPosition);
             break;
 
         default:

Reply via email to