[Libreoffice-commits] core.git: sd/AllLangResTarget_sd.mk sd/inc sd/source sd/uiconfig sd/UIConfig_simpress.mk

Caolán McNamara caolanm at redhat.com
Thu Apr 13 15:52:48 UTC 2017


 sd/AllLangResTarget_sd.mk                   |    1 
 sd/UIConfig_simpress.mk                     |    1 
 sd/inc/glob.hrc                             |    1 
 sd/source/ui/slideshow/slideshow.hrc        |   50 ----
 sd/source/ui/slideshow/slideshow.src        |  156 --------------
 sd/source/ui/slideshow/slideshowimpl.cxx    |  298 +++++++++++++---------------
 sd/uiconfig/simpress/ui/slidecontextmenu.ui |  197 ++++++++++++++++++
 7 files changed, 341 insertions(+), 363 deletions(-)

New commits:
commit 747a4f30d2e6b44e31854849be30295cca25af5b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 13 16:06:44 2017 +0100

    convert slideshow context menu to .ui
    
    Change-Id: I2e15f649ef628903899b5351bd52fc85b50fde8d

diff --git a/sd/AllLangResTarget_sd.mk b/sd/AllLangResTarget_sd.mk
index 93a31c632a41..aac8c3143426 100644
--- a/sd/AllLangResTarget_sd.mk
+++ b/sd/AllLangResTarget_sd.mk
@@ -33,7 +33,6 @@ $(eval $(call gb_SrsTarget_add_files,sd/res,\
     sd/source/ui/app/sdstring.src \
     sd/source/ui/app/strings.src \
     sd/source/ui/app/toolbox.src \
-    sd/source/ui/slideshow/slideshow.src \
     sd/source/ui/view/DocumentRenderer.src \
 ))
 
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index 070572c23309..1056b0faa987 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -142,6 +142,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
 	sd/uiconfig/simpress/ui/scalemenu \
 	sd/uiconfig/simpress/ui/sdviewpage \
 	sd/uiconfig/simpress/ui/sidebarslidebackground \
+	sd/uiconfig/simpress/ui/slidecontextmenu \
 	sd/uiconfig/simpress/ui/slidedesigndialog \
 	sd/uiconfig/simpress/ui/slidetransitionspanel \
 	sd/uiconfig/simpress/ui/slidetransitionspanelhorizontal \
diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc
index beaadc4d0de9..88ae89f7c5ac 100644
--- a/sd/inc/glob.hrc
+++ b/sd/inc/glob.hrc
@@ -114,7 +114,6 @@
 //      RID_ANNOTATIONS_END                     RID_GLOB_START+220
 #define STR_UNDO_ANIMATION                      RID_GLOB_START+221
 #define STR_UNDO_SLIDE_PARAMS                   RID_GLOB_START+222
-#define RID_SLIDESHOW_CONTEXTMENU               RID_GLOB_START+223
 
 #define STR_DEAUTHORISE_CLIENT                  RID_GLOB_START+229
 #define STR_MASTERSLIDE_NAME                    RID_GLOB_START+230
diff --git a/sd/source/ui/slideshow/slideshow.hrc b/sd/source/ui/slideshow/slideshow.hrc
deleted file mode 100644
index 4e6169f43b87..000000000000
--- a/sd/source/ui/slideshow/slideshow.hrc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_SLIDESHOW_HRC_
-#define SD_SLIDESHOW_HRC_
-
-#define CM_PREV_SLIDE   1
-#define CM_NEXT_SLIDE   2
-#define CM_GOTO         3
-#define CM_SCREEN       4
-#define CM_SCREEN_BLACK 5
-#define CM_SCREEN_WHITE 6
-#define CM_ENDSHOW      7
-#define CM_FIRST_SLIDE  8
-#define CM_LAST_SLIDE   9
-
-//CM for extra presenter UI
-#define CM_ERASE_ALLINK 10
-#define CM_COLOR_PEN    11
-#define CM_WIDTH_PEN    12
-#define CM_WIDTH_PEN_VERY_THIN  13
-#define CM_WIDTH_PEN_THIN   14
-#define CM_WIDTH_PEN_NORMAL 15
-#define CM_WIDTH_PEN_THICK  16
-#define CM_WIDTH_PEN_VERY_THICK 17
-#define CM_PEN_MODE 18
-
-#define CM_EDIT_PRESENTATION 19
-
-#define CM_SLIDES       21      // this must be the last id!
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshow.src b/sd/source/ui/slideshow/slideshow.src
deleted file mode 100644
index 480cc096063a..000000000000
--- a/sd/source/ui/slideshow/slideshow.src
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "glob.hrc"
-#include "slideshow.hrc"
-
-Menu RID_SLIDESHOW_CONTEXTMENU
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = CM_NEXT_SLIDE ;
-            Text [ en-US ] = "~Next" ;
-        };
-        MenuItem
-        {
-            Identifier = CM_PREV_SLIDE ;
-            Text [ en-US ] = "~Previous" ;
-           };
-        MenuItem
-        {
-            Identifier = CM_GOTO;
-            Text [ en-US ] = "~Go to Slide" ;
-            SubMenu = Menu
-            {
-                ItemList =
-                {
-                    MenuItem
-                    {
-                        Identifier = CM_FIRST_SLIDE;
-                        Text [ en-US ] = "~First Slide";
-                    };
-                    MenuItem
-                    {
-                        Identifier = CM_LAST_SLIDE;
-                        Text [ en-US ] = "~Last Slide";
-                    };
-                    MenuItem
-                    {
-                        Separator = TRUE;
-                    };
-                };
-            };
-        };
-        MenuItem
-        {
-            Separator = TRUE;
-        };
-        MenuItem
-        {
-            Identifier = CM_PEN_MODE;
-            Text [ en-US ] = "Mouse pointer as ~Pen";
-        };
-        MenuItem
-        {
-            Identifier = CM_WIDTH_PEN;
-            Text [ en-US ] = "~Pen Width" ;
-            SubMenu = Menu
-            {
-                ItemList =
-                {
-                    MenuItem
-                    {
-                        Identifier =  CM_WIDTH_PEN_VERY_THIN;
-                        Text [ en-US ] = "~Very thin";
-                    };
-                    MenuItem
-                    {
-                        Identifier =  CM_WIDTH_PEN_THIN;
-                        Text [ en-US ] = "~Thin";
-                    };
-                    MenuItem
-                    {
-                        Identifier =  CM_WIDTH_PEN_NORMAL;
-                        Text [ en-US ] = "~Normal";
-                    };
-                    MenuItem
-                    {
-                        Identifier =  CM_WIDTH_PEN_THICK;
-                        Text [ en-US ] = "~Thick";
-                    };
-                    MenuItem
-                    {
-                        Identifier =  CM_WIDTH_PEN_VERY_THICK;
-                        Text [ en-US ] = "~Very Thick";
-                    };
-                };
-            };
-        };
-        MenuItem
-        {
-            Identifier = CM_COLOR_PEN ;
-            Text [ en-US ] = "~Change pen Color..." ;
-        };
-        MenuItem
-        {
-            Identifier = CM_ERASE_ALLINK ;
-            Text [ en-US ] = "~Erase all ink on Slide" ;
-        };
-        MenuItem
-        {
-            Separator = TRUE;
-        };
-        MenuItem
-        {
-            Identifier = CM_SCREEN;
-            Text [ en-US ] = "~Screen" ;
-
-            SubMenu = Menu
-            {
-                ItemList =
-                {
-                    MenuItem
-                    {
-                        Identifier = CM_SCREEN_BLACK;
-                        Text [ en-US ] = "~Black";
-                    };
-                    MenuItem
-                    {
-                        Identifier = CM_SCREEN_WHITE;
-                        Text [ en-US ] = "~White";
-                    };
-                };
-            };
-        };
-        MenuItem
-        {
-            Identifier = CM_EDIT_PRESENTATION ;
-            Text [ en-US ] = "E~dit Presentation" ;
-        };
-        MenuItem
-        {
-            Identifier = CM_ENDSHOW ;
-            Text [ en-US ] = "~End Show" ;
-        };
-    };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 0a104ae0f69c..521e18f86ce3 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -70,7 +70,6 @@
 #include "comphelper/anytostring.hxx"
 #include "cppuhelper/exc_hlp.hxx"
 #include "rtl/ref.hxx"
-#include "slideshow.hrc"
 #include "canvas/elapsedtime.hxx"
 #include "avmedia/mediawindow.hxx"
 #include "svtools/colrdlg.hxx"
@@ -78,6 +77,7 @@
 #include "customshowlist.hxx"
 #include "unopage.hxx"
 
+#define CM_SLIDES       21
 
 using ::com::sun::star::animations::XAnimationNode;
 using ::com::sun::star::animations::XAnimationListener;
@@ -1985,17 +1985,18 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void)
     if( !mbWasPaused )
         pause();
 
-    VclPtrInstance<PopupMenu> pMenu( SdResId( RID_SLIDESHOW_CONTEXTMENU ) );
+    VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/slidecontextmenu.ui", "");
+    VclPtr<PopupMenu> pMenu(aBuilder.get_menu("menu"));
 
     // Adding button to display if in Pen  mode
-    pMenu->CheckItem( CM_PEN_MODE, mbUsePen);
+    pMenu->CheckItem(pMenu->GetItemId("pen"), mbUsePen);
 
     const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
-    pMenu->EnableItem( CM_NEXT_SLIDE, ( mpSlideController->getNextSlideIndex() != -1 ) );
-    pMenu->EnableItem( CM_PREV_SLIDE, ( mpSlideController->getPreviousSlideIndex() != -1 ) || (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) );
-    pMenu->EnableItem( CM_EDIT_PRESENTATION, mpViewShell->GetDoc()->IsStartWithPresentation());
+    pMenu->EnableItem(pMenu->GetItemId("next"), mpSlideController->getNextSlideIndex() != -1);
+    pMenu->EnableItem(pMenu->GetItemId("prev"), (mpSlideController->getPreviousSlideIndex() != -1 ) || (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK));
+    pMenu->EnableItem(pMenu->GetItemId("edit"), mpViewShell->GetDoc()->IsStartWithPresentation());
 
-    PopupMenu* pPageMenu = pMenu->GetPopupMenu( CM_GOTO );
+    PopupMenu* pPageMenu = pMenu->GetPopupMenu(pMenu->GetItemId("goto"));
 
     SfxViewFrame* pViewFrame = getViewFrame();
     if( pViewFrame )
@@ -2003,13 +2004,13 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void)
         Reference< css::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() );
         if( xFrame.is() )
         {
-            pMenu->SetItemImage( CM_NEXT_SLIDE, GetImage( xFrame, "slot:10617" , false ) );
-            pMenu->SetItemImage( CM_PREV_SLIDE, GetImage( xFrame, "slot:10618" , false ) );
+            pMenu->SetItemImage(pMenu->GetItemId("next"), GetImage(xFrame, "slot:10617" , false));
+            pMenu->SetItemImage(pMenu->GetItemId("prev"), GetImage(xFrame, "slot:10618" , false));
 
             if( pPageMenu )
             {
-                pPageMenu->SetItemImage( CM_FIRST_SLIDE, GetImage( xFrame, "slot:10616" , false ) );
-                pPageMenu->SetItemImage( CM_LAST_SLIDE, GetImage( xFrame, "slot:10619" , false ) );
+                pPageMenu->SetItemImage(pPageMenu->GetItemId("first"), GetImage(xFrame, "slot:10616" , false));
+                pPageMenu->SetItemImage(pPageMenu->GetItemId("last"), GetImage(xFrame, "slot:10619" , false));
             }
         }
     }
@@ -2020,7 +2021,7 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void)
         const sal_Int32 nPageNumberCount = mpSlideController->getSlideNumberCount();
         if( nPageNumberCount <= 1 )
         {
-            pMenu->EnableItem( CM_GOTO, false );
+            pMenu->EnableItem(pMenu->GetItemId("goto"), false);
         }
         else
         {
@@ -2028,8 +2029,8 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void)
             if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
                 nCurrentSlideNumber = -1;
 
-            pPageMenu->EnableItem( CM_FIRST_SLIDE, ( mpSlideController->getSlideNumber(0) != nCurrentSlideNumber ) );
-            pPageMenu->EnableItem( CM_LAST_SLIDE, ( mpSlideController->getSlideNumber( mpSlideController->getSlideIndexCount() - 1) != nCurrentSlideNumber ) );
+            pPageMenu->EnableItem(pPageMenu->GetItemId("first"), mpSlideController->getSlideNumber(0) != nCurrentSlideNumber);
+            pPageMenu->EnableItem(pPageMenu->GetItemId("last"), mpSlideController->getSlideNumber(mpSlideController->getSlideIndexCount() - 1) != nCurrentSlideNumber);
 
             sal_Int32 nPageNumber;
 
@@ -2051,14 +2052,14 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void)
 
     if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
     {
-        PopupMenu* pBlankMenu = pMenu->GetPopupMenu( CM_SCREEN );
+        PopupMenu* pBlankMenu = pMenu->GetPopupMenu(pMenu->GetItemId("screen"));
         if( pBlankMenu )
         {
-            pBlankMenu->CheckItem( ( mpShowWindow->GetBlankColor() == Color( COL_WHITE ) ) ? CM_SCREEN_WHITE : CM_SCREEN_BLACK  );
+            pBlankMenu->CheckItem((mpShowWindow->GetBlankColor() == Color(COL_WHITE)) ? pBlankMenu->GetItemId("white") : pBlankMenu->GetItemId("black"));
         }
     }
 
-    PopupMenu* pWidthMenu = pMenu->GetPopupMenu( CM_WIDTH_PEN);
+    PopupMenu* pWidthMenu = pMenu->GetPopupMenu(pMenu->GetItemId("width"));
 
     // populate color width list
     if( pWidthMenu )
@@ -2090,15 +2091,13 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void)
                     break;
             }
 
-            pWidthMenu->EnableItem( (sal_uInt16)(CM_WIDTH_PEN + nIterator));
-            if( nWidth ==  mdUserPaintStrokeWidth)
-                pWidthMenu->CheckItem( (sal_uInt16)(CM_WIDTH_PEN + nIterator) );
+            if (nWidth == mdUserPaintStrokeWidth)
+                pWidthMenu->CheckItem(pWidthMenu->GetItemId(OString::number(nWidth)));
         }
     }
 
     pMenu->SetSelectHdl( LINK( this, SlideshowImpl, ContextMenuSelectHdl ) );
     pMenu->Execute( mpShowWindow, maPopupMousePos );
-    pMenu.disposeAndClear();
 
     if( mxView.is() )
         mxView->ignoreNextMouseReleased();
@@ -2109,153 +2108,142 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void)
 
 IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu, bool )
 {
-    if( pMenu )
-    {
-        sal_uInt16 nMenuId = pMenu->GetCurItemId();
+    if (!pMenu)
+        return false;
 
-        switch( nMenuId )
-        {
-        case CM_PREV_SLIDE:
-            gotoPreviousSlide();
-            mbWasPaused = false;
-            break;
-        case CM_NEXT_SLIDE:
-            gotoNextSlide();
-            mbWasPaused = false;
-            break;
-        case CM_FIRST_SLIDE:
-            gotoFirstSlide();
-            mbWasPaused = false;
-            break;
-        case CM_LAST_SLIDE:
-            gotoLastSlide();
-            mbWasPaused = false;
-            break;
-        case CM_SCREEN_BLACK:
-        case CM_SCREEN_WHITE:
+    OString sMenuId = pMenu->GetCurItemIdent();
+
+    if (sMenuId == "prev")
+    {
+        gotoPreviousSlide();
+        mbWasPaused = false;
+    }
+    else if(sMenuId == "next")
+    {
+        gotoNextSlide();
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "first")
+    {
+        gotoFirstSlide();
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "last")
+    {
+        gotoLastSlide();
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "black" || sMenuId == "white")
+    {
+        const Color aBlankColor(sMenuId == "white" ? COL_WHITE : COL_BLACK);
+        if( mbWasPaused )
         {
-            const Color aBlankColor( (nMenuId == CM_SCREEN_WHITE) ? COL_WHITE : COL_BLACK );
-            if( mbWasPaused )
+            if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
             {
-                if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
+                if( mpShowWindow->GetBlankColor() == aBlankColor )
                 {
-                    if( mpShowWindow->GetBlankColor() == aBlankColor )
-                    {
-                        mbWasPaused = false;
-                        mpShowWindow->RestartShow();
-                        break;
-                    }
+                    mbWasPaused = false;
+                    mpShowWindow->RestartShow();
+                    return false;
                 }
-                mpShowWindow->RestartShow();
-            }
-            if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), aBlankColor ) )
-            {
-                pause();
-                mbWasPaused = true;
             }
+            mpShowWindow->RestartShow();
         }
-        break;
-        case CM_COLOR_PEN:
-            {
-                //Open a color picker based on SvColorDialog
-                ::Color aColor( mnUserPaintColor );
-                SvColorDialog aColorDlg( mpShowWindow);
-                aColorDlg.SetColor( aColor );
-
-                if (aColorDlg.Execute() )
-                {
-                    aColor = aColorDlg.GetColor();
-                    setPenColor(aColor.GetColor());
-                }
-                mbWasPaused = false;
-            }
-            break;
-
-        case CM_WIDTH_PEN_VERY_THIN:
-            {
-                setPenWidth(4.0);
-                mbWasPaused = false;
-            }
-            break;
-
-        case CM_WIDTH_PEN_THIN:
-            {
-                setPenWidth(100.0);
-                mbWasPaused = false;
-            }
-            break;
-
-        case CM_WIDTH_PEN_NORMAL:
-            {
-                setPenWidth(150.0);
-                mbWasPaused = false;
-            }
-            break;
-
-        case CM_WIDTH_PEN_THICK:
-            {
-                setPenWidth(200.0);
-                mbWasPaused = false;
-            }
-            break;
+        if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), aBlankColor ) )
+        {
+            pause();
+            mbWasPaused = true;
+        }
+    }
+    else if (sMenuId == "color")
+    {
+        //Open a color picker based on SvColorDialog
+        ::Color aColor( mnUserPaintColor );
+        SvColorDialog aColorDlg( mpShowWindow);
+        aColorDlg.SetColor( aColor );
 
-        case CM_WIDTH_PEN_VERY_THICK:
-            {
-                setPenWidth(400.0);
-                mbWasPaused = false;
-            }
-            break;
-        case CM_ERASE_ALLINK:
-            {
-                setEraseAllInk(true);
-                    mbWasPaused = false;
-            }
-            break;
-        case CM_PEN_MODE:
-            {
-                setUsePen(!mbUsePen);
-                mbWasPaused = false;
-            }
-            break;
-        case CM_EDIT_PRESENTATION:
-            // When in autoplay mode (pps/ppsx), offer editing of the presentation
-            // Turn autostart off, else Impress will close when exiting the Presentation
-            mpViewShell->GetDoc()->SetExitAfterPresenting(false);
-            if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
-            {
-                if( mpSlideController->getCurrentSlideNumber() != -1 )
-                {
-                    mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
-                }
-            }
-            endPresentation();
-            break;
-        case CM_ENDSHOW:
-            // in case the user cancels the presentation, switch to current slide
-            // in edit mode
-            if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
-            {
-                if( mpSlideController->getCurrentSlideNumber() != -1 )
-                {
-                    mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
-                }
-            }
-            endPresentation();
-            break;
-        default:
-            sal_Int32 nPageNumber = nMenuId - CM_SLIDES;
-            const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
-            if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
+        if (aColorDlg.Execute() )
+        {
+            aColor = aColorDlg.GetColor();
+            setPenColor(aColor.GetColor());
+        }
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "4")
+    {
+        setPenWidth(4.0);
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "100")
+    {
+        setPenWidth(100.0);
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "150")
+    {
+        setPenWidth(150.0);
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "200")
+    {
+        setPenWidth(200.0);
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "400")
+    {
+        setPenWidth(400.0);
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "erase")
+    {
+        setEraseAllInk(true);
+            mbWasPaused = false;
+    }
+    else if (sMenuId == "pen")
+    {
+        setUsePen(!mbUsePen);
+        mbWasPaused = false;
+    }
+    else if (sMenuId == "edit")
+    {
+        // When in autoplay mode (pps/ppsx), offer editing of the presentation
+        // Turn autostart off, else Impress will close when exiting the Presentation
+        mpViewShell->GetDoc()->SetExitAfterPresenting(false);
+        if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
+        {
+            if( mpSlideController->getCurrentSlideNumber() != -1 )
             {
-                mpShowWindow->RestartShow( nPageNumber );
+                mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
             }
-            else if( nPageNumber != mpSlideController->getCurrentSlideNumber() )
+        }
+        endPresentation();
+    }
+    else if (sMenuId == "end")
+    {
+        // in case the user cancels the presentation, switch to current slide
+        // in edit mode
+        if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
+        {
+            if( mpSlideController->getCurrentSlideNumber() != -1 )
             {
-                displaySlideNumber( nPageNumber );
+                mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
             }
-            mbWasPaused = false;
-            break;
         }
+        endPresentation();
+    }
+    else
+    {
+        sal_Int32 nPageNumber = pMenu->GetCurItemId() - CM_SLIDES;
+        const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
+        if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
+        {
+            mpShowWindow->RestartShow( nPageNumber );
+        }
+        else if( nPageNumber != mpSlideController->getCurrentSlideNumber() )
+        {
+            displaySlideNumber( nPageNumber );
+        }
+        mbWasPaused = false;
     }
 
     return false;
diff --git a/sd/uiconfig/simpress/ui/slidecontextmenu.ui b/sd/uiconfig/simpress/ui/slidecontextmenu.ui
new file mode 100644
index 000000000000..f86ce8862781
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/slidecontextmenu.ui
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <object class="GtkMenu" id="menu">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="next">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Next</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="prev">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Previous</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="goto">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Go to Slide</property>
+        <property name="use_underline">True</property>
+        <child type="submenu">
+          <object class="GtkMenu">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkMenuItem" id="first">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_First Slide</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="last">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Last Slide</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparatorMenuItem" id="menuitem3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkCheckMenuItem" id="pen">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Mouse pointer as ~Pen</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="width">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Pen Width</property>
+        <property name="use_underline">True</property>
+        <child type="submenu">
+          <object class="GtkMenu">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkRadioMenuItem" id="4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Very thin</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkRadioMenuItem" id="100">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Thin</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkRadioMenuItem" id="150">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Normal</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkRadioMenuItem" id="200">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Thick</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkRadioMenuItem" id="400">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Very Thick</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="color">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Change pen Color...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="erase">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Erase all ink on Slide</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="screen">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Screen</property>
+        <property name="use_underline">True</property>
+        <child type="submenu">
+          <object class="GtkMenu">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkMenuItem" id="black">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Black</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="white">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_White</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="edit">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">E_dit Presentation</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="end">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_End Show</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list