[Libreoffice-commits] core.git: sd/sdi sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Nov 4 21:50:52 UTC 2018


 sd/sdi/sdraw.sdi                                       |    2 
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx |   46 ++++++++++-------
 sd/source/ui/view/drviews2.cxx                         |   36 ++++++++-----
 3 files changed, 52 insertions(+), 32 deletions(-)

New commits:
commit 7cf6cee97bc05512fae482733ee45f039e9d2160
Author:     Gulsah Kose <gulsah.1004 at gmail.com>
AuthorDate: Sun Nov 4 22:06:10 2018 +0300
Commit:     Gülşah Köse <gulsah.1004 at gmail.com>
CommitDate: Sun Nov 4 22:50:02 2018 +0100

    [Pardus] Make the slide change command accessible.
    
    Allows to call uno:RenamePage from the android viewer and LibreOffice
    online. This patch is sponsored by ULAKBIM/Pardus project.
    
    Change-Id: Ife814846bd7076e9f8830bce4c2451cb6b44a15a
    Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/62860

diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 7a7c53bb5bed..233200c0c22f 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -3282,7 +3282,7 @@ SfxVoidItem RenameLayer SID_RENAMELAYER
 ]
 
 SfxVoidItem RenamePage SID_RENAMEPAGE
-()
+(SfxStringItem Name SID_RENAMEPAGE)
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index d336a312ecab..0a8f11f58271 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -873,29 +873,39 @@ void SlotManager::RenameSlide(const SfxRequest& rRequest)
         OUString aDescr( SdResId( STR_DESC_RENAMESLIDE ) );
         OUString aPageName = pSelectedPage->GetName();
 
-        SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-        vcl::Window* pWin = mrSlideSorter.GetContentWindow();
-        ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(
-                pWin ? pWin->GetFrameWeld() : nullptr,
-                aPageName, aDescr));
-        aNameDlg->SetText( aTitle );
-        aNameDlg->SetCheckNameHdl( LINK( this, SlotManager, RenameSlideHdl ), true );
-        aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
+        if(rRequest.GetArgs())
+        {
+           OUString aName;
+           aName = rRequest.GetArgs()->GetItem<const SfxStringItem>(SID_RENAMEPAGE)->GetValue();
 
-        if( aNameDlg->Execute() == RET_OK )
+           bool bResult =  RenameSlideFromDrawViewShell(pSelectedPage->GetPageNum()/2, aName );
+           DBG_ASSERT( bResult, "Couldn't rename slide" );
+        }
+        else
         {
-            OUString aNewName;
-            aNameDlg->GetName( aNewName );
-            if (aNewName != aPageName)
+            SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+            vcl::Window* pWin = mrSlideSorter.GetContentWindow();
+            ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(
+                    pWin ? pWin->GetFrameWeld() : nullptr,
+                    aPageName, aDescr));
+            aNameDlg->SetText( aTitle );
+            aNameDlg->SetCheckNameHdl( LINK( this, SlotManager, RenameSlideHdl ), true );
+            aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
+
+            if( aNameDlg->Execute() == RET_OK )
             {
-                bool bResult =
-                        RenameSlideFromDrawViewShell(
-                          pSelectedPage->GetPageNum()/2, aNewName );
-                DBG_ASSERT( bResult, "Couldn't rename slide" );
+                OUString aNewName;
+                aNameDlg->GetName( aNewName );
+                if (aNewName != aPageName)
+                {
+                    bool bResult =
+                            RenameSlideFromDrawViewShell(
+                              pSelectedPage->GetPageNum()/2, aNewName );
+                    DBG_ASSERT( bResult, "Couldn't rename slide" );
+                }
             }
+            aNameDlg.disposeAndClear();
         }
-        aNameDlg.disposeAndClear();
-
         // Tell the slide sorter about the name change (necessary for
         // accessibility.)
         mrSlideSorter.GetController().PageNameHasChanged(
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 90ae9fbb5896..37690eac773f 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -788,26 +788,36 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                 OUString aDescr = SdResId(STR_DESC_RENAMESLIDE);
                 const OUString& aPageName = pCurrentPage->GetName();
 
-                SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-                ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aPageName, aDescr));
-                aNameDlg->SetText( aTitle );
-                aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true );
-                aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
+                if(rReq.GetArgs())
+                {
+                    OUString aName;
+                    aName = rReq.GetArgs()->GetItem<const SfxStringItem>(SID_RENAMEPAGE)->GetValue();
 
-                if( aNameDlg->Execute() == RET_OK )
+                    bool bResult = RenameSlide( maTabControl->GetPageId(nPage), aName );
+                    DBG_ASSERT( bResult, "Couldn't rename slide" );
+                }
+                else
                 {
-                    OUString aNewName;
-                    aNameDlg->GetName( aNewName );
-                    if (aNewName != aPageName)
+                    SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+                    ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aPageName, aDescr));
+                    aNameDlg->SetText( aTitle );
+                    aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true );
+                    aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
+
+                    if( aNameDlg->Execute() == RET_OK )
                     {
-                        bool bResult = RenameSlide( maTabControl->GetPageId(nPage), aNewName );
-                        DBG_ASSERT( bResult, "Couldn't rename slide" );
+                        OUString aNewName;
+                        aNameDlg->GetName( aNewName );
+                        if (aNewName != aPageName)
+                        {
+                            bool bResult = RenameSlide( maTabControl->GetPageId(nPage), aNewName );
+                            DBG_ASSERT( bResult, "Couldn't rename slide" );
+                        }
                     }
                 }
             }
-
             Cancel();
-            rReq.Ignore ();
+            rReq.Ignore();
         }
         break;
 


More information about the Libreoffice-commits mailing list