Bug 58505 - Tweak F5 for slide display, and add Shift-F5

kuba kubusg at gmail.com
Tue Apr 9 12:16:11 PDT 2013


Hi,

I've been working on this bug for some time now and It's the high time 
to ask for help.
The changes are as follows:

+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -2234,6 +2234,11 @@
      </node>
      <node oor:name="F5_SHIFT" oor:op="replace">
       <prop oor:name="Command"><value xml:lang="x-no-translate">I10N 
SHORTCUTS - NO TRANSLATE</value>
+      <value xml:lang="en-US">.uno:PresentationThisSlide</value>
+     </prop>
+    </node>
+    <node oor:name="F5_SHIFT_MOD2" oor:op="replace">
+     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N 
SHORTCUTS - NO TRANSLATE</value>
        <value xml:lang="en-US">.uno:RestoreEditingView</value>
       </prop>
      </node>

Since Shift-F5 was taken by replace I changed replace to Shift-mod2-F5 
(Shift-right alt-F5).
Is this ok? Maybe some other combination would be better?

+++ 
b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -37,6 +37,14 @@
            <value>1</value>
          </prop>
        </node>
+      <node oor:name=".uno:PresentationThisSlide" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Sl~ide Show From This Slide</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
        <node oor:name=".uno:Remote" oor:op="replace">
          <prop oor:name="Label" oor:type="xs:string">
            <value xml:lang="en-US">Impress R~emote</value>

Here I decided to use "i" as a key, rather because I didn't know what to 
do so most likely other key would be better.

+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -403,6 +403,7 @@ protected:
      void            GetMenuStateSel(SfxItemSet& rSet);

  private:
+    void ShowSlideShow(SfxRequest& rReq);
      /** This flag controls whether the layer mode is active, i.e. the 
layer
          dialog is visible.

Here (and in /sd/source/ui/inc/OutlineViewShell.hxx) I decided to move 
some code to ShowSlideShow function just like it is in SlotManager class 
(/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx)

+void DrawViewShell::ShowSlideShow(SfxRequest& rReq)
+{
...
+            if( (SID_PRESENTATION == rReq.GetSlot() ) )
+            {
+                Sequence< PropertyValue > aArguments(1);
+                PropertyValue aPage;
+                OUString sValue("0");
+
+                aPage.Name = "FirstPage";
+                aPage.Value <<= sValue;
+
+                aArguments[0] = aPage;
+
+                xPresentation->startWithArguments( aArguments );
+            }
...

My way of starting presentation from first slide, frankly I don't think 
it's good but the
only alternative I could think of is to change (expand) XPresentation or 
XPresentation2
interface. Which is a better idea (or maybe there is better way)?

+++ b/svx/inc/svx/svxids.hrc
@@ -351,6 +351,7 @@
...
  #define SID_PRESENTATION                                ( 
SID_SVX_START + 157 )
+#define SID_PRESENTATION_THIS_SLIDE                     ( SID_SVX_START 
+ 158 )
  #define SID_REHEARSE_TIMINGS                            ( 
SID_SVX_START + 159 )

Here I took one free value that seemed to be unused.

Those are all the questions I think, Please criticise and help.

Kind regards
Kuba
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130409/e0c57e71/attachment.html>
-------------- next part --------------
>From 4233f0b07ab976be236a8e1e9279452888a69cda Mon Sep 17 00:00:00 2001
From: Jakub Golebiewski <kubusg at gmail.com>
Date: Tue, 9 Apr 2013 23:45:52 +0200
Subject: [PATCH] Bug 58505 - Tweak F5 for slide display, and add Shift-F5

Added menu entry to start the presentation from current slide.
Changed "Start Presentation" menu entry behavior so it starts
from the first slide.

Change-Id: Iebba85d2d1dcacad7da6b050e2152be5c0d47261
---
 .../data/org/openoffice/Office/Accelerators.xcu    |    5 +++
 .../openoffice/Office/UI/DrawImpressCommands.xcu   |    8 ++++
 sd/inc/sdcommands.h                                |    1 +
 sd/sdi/SlideSorterController.sdi                   |    5 +++
 sd/sdi/sdraw.sdi                                   |   25 +++++++++++
 sd/source/ui/inc/DrawViewShell.hxx                 |    1 +
 sd/source/ui/inc/OutlineViewShell.hxx              |    1 +
 .../ui/slidesorter/controller/SlsSlotManager.cxx   |   26 ++++++++++-
 sd/source/ui/view/drviewse.cxx                     |   45 +++++++++++++++----
 sd/source/ui/view/outlnvs2.cxx                     |   46 ++++++++++++++++----
 sd/uiconfig/simpress/menubar/menubar.xml           |    1 +
 svx/inc/svx/svxids.hrc                             |    1 +
 12 files changed, 147 insertions(+), 18 deletions(-)

diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
index fd649ba..6cf3ae3 100644
--- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -2234,6 +2234,11 @@
     </node>
     <node oor:name="F5_SHIFT" oor:op="replace">
      <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
+      <value xml:lang="en-US">.uno:PresentationThisSlide</value>
+     </prop>
+    </node>
+    <node oor:name="F5_SHIFT_MOD2" oor:op="replace">
+     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
       <value xml:lang="en-US">.uno:RestoreEditingView</value>
      </prop>
     </node>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 50afd03..d983b1f 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -37,6 +37,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:PresentationThisSlide" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Sl~ide Show From This Slide</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:Remote" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Impress R~emote</value>
diff --git a/sd/inc/sdcommands.h b/sd/inc/sdcommands.h
index daecfe8..f64e686 100644
--- a/sd/inc/sdcommands.h
+++ b/sd/inc/sdcommands.h
@@ -94,6 +94,7 @@
 #define CMD_SID_OUTLINE_TEXT_AUTOFIT                ".uno.OutlineTextAutofit"
 #define CMD_SID_PAGESETUP                           ".uno:PageSetup"
 #define CMD_SID_PRESENTATION                        ".uno:Presentation"
+#define CMD_SID_PRESENTATION_THIS_SLIDE             ".uno:PresentationThisSlide"
 #define CMD_SID_REMOTE_DLG                          ".uno:Remote"
 #define CMD_SID_PRESENTATION_LAYOUT                 ".uno:PresentationLayout"
 #define CMD_SID_RENAMELAYER                         ".uno:RenameLayer"
diff --git a/sd/sdi/SlideSorterController.sdi b/sd/sdi/SlideSorterController.sdi
index d1af8d0..ecc4580 100644
--- a/sd/sdi/SlideSorterController.sdi
+++ b/sd/sdi/SlideSorterController.sdi
@@ -136,6 +136,11 @@ interface SlideSorterView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_PRESENTATION_THIS_SLIDE // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     SID_HIDE_SLIDE // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 83b4d04..5e913a2 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -5196,6 +5196,31 @@ SfxVoidItem Presentation SID_PRESENTATION
 ]
 
 //--------------------------------------------------------------------------
+SfxVoidItem PresentationThisSlide SID_PRESENTATION_THIS_SLIDE
+()
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = TRUE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
 SfxVoidItem PresentationDialog SID_PRESENTATION_DLG
 ()
 [
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 64de25e..f8b94ba 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -403,6 +403,7 @@ protected:
     void            GetMenuStateSel(SfxItemSet& rSet);
 
 private:
+    void ShowSlideShow(SfxRequest& rReq);
     /** This flag controls whether the layer mode is active, i.e. the layer
         dialog is visible.
     */
diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx
index 616ed42..f4ca53f 100644
--- a/sd/source/ui/inc/OutlineViewShell.hxx
+++ b/sd/source/ui/inc/OutlineViewShell.hxx
@@ -151,6 +151,7 @@ public:
     bool UpdateOutlineObject( SdPage* pPage, Paragraph* pPara );
 
 private:
+    void ShowSlideShow(SfxRequest& rReq);
     OutlineView* pOlView;
     SdPage*         pLastPage; // Zur performanten Aufbereitung der Preview
     TransferableClipboardListener* pClipEvtLstnr;
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index bdf802b..7e905f9 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -19,6 +19,8 @@
 
 
 #include <com/sun/star/presentation/XPresentation2.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Any.hxx>
 
 #include <editeng/outlobj.hxx>
 
@@ -90,6 +92,7 @@
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::beans;
 
 namespace sd { namespace slidesorter { namespace controller {
 
@@ -137,6 +140,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
     switch (rRequest.GetSlot())
     {
         case SID_PRESENTATION:
+        case SID_PRESENTATION_THIS_SLIDE:
         case SID_REHEARSE_TIMINGS:
             ShowSlideShow (rRequest);
             pShell->Cancel();
@@ -865,9 +869,29 @@ void SlotManager::ShowSlideShow( SfxRequest& rReq)
     if( xPresentation.is() )
     {
         if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
-            xPresentation->start();
+        {
+            if( (SID_PRESENTATION == rReq.GetSlot() ) )
+            {
+                Sequence< PropertyValue > aArguments(1);
+                PropertyValue aPage;
+                OUString sValue("0");
+
+                aPage.Name = "FirstPage";
+                aPage.Value <<= sValue;
+
+                aArguments[0] = aPage;
+
+                xPresentation->startWithArguments( aArguments );
+            }
+            else
+            {
+                xPresentation->start();
+            }
+        }
         else
+        {
             xPresentation->rehearseTimings();
+        }
     }
 }
 
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 02d9cbe..023766a 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -23,6 +23,8 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/i18n/TransliterationModules.hpp>
 #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Any.hxx>
 
 #include <comphelper/processfactory.hxx>
 
@@ -97,6 +99,7 @@
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::beans;
 
 namespace sd {
 
@@ -681,16 +684,10 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
         break;
 
         case SID_PRESENTATION:
+        case SID_PRESENTATION_THIS_SLIDE:
         case SID_REHEARSE_TIMINGS:
         {
-            Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
-            if( xPresentation.is() )
-            {
-                if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
-                    xPresentation->start();
-                else
-                    xPresentation->rehearseTimings();
-            }
+            ShowSlideShow(rReq);
             rReq.Ignore ();
         }
         break;
@@ -1649,6 +1646,38 @@ void DrawViewShell::ShowUIControls (bool bVisible)
     maTabControl.Show (bVisible);
 }
 
+void DrawViewShell::ShowSlideShow(SfxRequest& rReq)
+{
+    Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
+    if( xPresentation.is() )
+    {
+        if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
+        {
+            if( (SID_PRESENTATION == rReq.GetSlot() ) )
+            {
+                Sequence< PropertyValue > aArguments(1);
+                PropertyValue aPage;
+                OUString sValue("0");
+
+                aPage.Name = "FirstPage";
+                aPage.Value <<= sValue;
+
+                aArguments[0] = aPage;
+
+                xPresentation->startWithArguments( aArguments );
+            }
+            else
+            {
+                xPresentation->start();
+            }
+        }
+        else
+        {
+            xPresentation->rehearseTimings();
+        }
+    }
+}
+
 void DrawViewShell::StopSlideShow (bool /*bCloseFrame*/)
 {
     Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
index d98589a..8706159 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -21,6 +21,8 @@
 #include "OutlineViewShell.hxx"
 
 #include <com/sun/star/presentation/XPresentation2.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Any.hxx>
 
 #include "app.hrc"
 #include <svx/hlnkitem.hxx>
@@ -64,6 +66,7 @@
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::beans;
 
 namespace sd {
 
@@ -229,18 +232,11 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
         break;
 
         case SID_PRESENTATION:
+        case SID_PRESENTATION_THIS_SLIDE:
         case SID_REHEARSE_TIMINGS:
         {
             pOlView->PrepareClose();
-
-            Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
-            if( xPresentation.is() )
-            {
-                if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
-                    xPresentation->start();
-                else
-                    xPresentation->rehearseTimings();
-            }
+            ShowSlideShow(rReq);
             Cancel();
             rReq.Done();
         }
@@ -318,6 +314,38 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
     Invalidate(SID_PASTE);
 }
 
+void OutlineViewShell::ShowSlideShow(SfxRequest& rReq)
+{
+    Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
+    if( xPresentation.is() )
+    {
+        if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
+        {
+            if( (SID_PRESENTATION == rReq.GetSlot() ) )
+            {
+                Sequence< PropertyValue > aArguments(1);
+                PropertyValue aPage;
+                OUString sValue("0");
+
+                aPage.Name = "FirstPage";
+                aPage.Value <<= sValue;
+
+                aArguments[0] = aPage;
+
+                xPresentation->startWithArguments( aArguments );
+            }
+            else
+            {
+                xPresentation->start();
+            }
+        }
+        else
+        {
+            xPresentation->rehearseTimings();
+        }
+    }
+}
+
 void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
 {
     OutlineViewModelChangeGuard aGuard( *pOlView );
diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml
index fc8047c..329dfce 100644
--- a/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
@@ -301,6 +301,7 @@
     <menu:menu menu:id=".uno:SlideShowMenu">
         <menu:menupopup>
             <menu:menuitem menu:id=".uno:Presentation"/>
+            <menu:menuitem menu:id=".uno:PresentationThisSlide"/>
             <menu:menuitem menu:id=".uno:PresentationDialog"/>
             <menu:menuitem menu:id=".uno:RehearseTimings"/>
             <menu:menuitem menu:id=".uno:Remote"/>
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index e92b3da..a343df4 100644
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -351,6 +351,7 @@
 #define SID_OUTLINE_COLLAPSE_ALL                        ( SID_SVX_START + 155 )
 #define SID_OUTLINE_BULLET                              ( SID_SVX_START + 156 )
 #define SID_PRESENTATION                                ( SID_SVX_START + 157 )
+#define SID_PRESENTATION_THIS_SLIDE                     ( SID_SVX_START + 158 )
 #define SID_REHEARSE_TIMINGS                            ( SID_SVX_START + 159 )
 #define SID_HIDE_SLIDE                                  ( SID_SVX_START + 161 )
 #define SID_CHOOSE_POLYGON                              ( SID_SVX_START + 162 )
-- 
1.7.10.4



More information about the LibreOffice mailing list