[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source sw/uiconfig sw/UIConfig_swriter.mk vcl/source

Caolán McNamara caolanm at redhat.com
Tue Apr 18 12:27:45 UTC 2017


 sw/UIConfig_swriter.mk                 |    1 
 sw/inc/helpid.h                        |   11 -
 sw/source/uibase/docvw/docvw.hrc       |   26 ---
 sw/source/uibase/docvw/docvw.src       |  166 ----------------------
 sw/source/uibase/docvw/romenu.cxx      |  225 ++++++++++++++++--------------
 sw/source/uibase/docvw/romenu.hxx      |   25 +++
 sw/uiconfig/swriter/ui/readonlymenu.ui |  247 +++++++++++++++++++++++++++++++++
 vcl/source/window/mouse.cxx            |    9 -
 8 files changed, 401 insertions(+), 309 deletions(-)

New commits:
commit 45d57a0dba8bb5a92150cc07bdff0b37b3041007
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 18 13:13:27 2017 +0100

    convert readonly menu to .ui
    
    Change-Id: Ia9400b3c4b410dbf70633e55286a4af77f0d651a

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index d6e4dd787eb2..86fe9b7e503d 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -229,6 +229,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/printmonitordialog \
 	sw/uiconfig/swriter/ui/printoptionspage \
 	sw/uiconfig/swriter/ui/privateuserpage \
+	sw/uiconfig/swriter/ui/readonlymenu \
 	sw/uiconfig/swriter/ui/renameautotextdialog \
 	sw/uiconfig/swriter/ui/renameentrydialog \
 	sw/uiconfig/swriter/ui/renameobjectdialog \
diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h
index 5bea9367c9df..0d18cd66e88d 100644
--- a/sw/inc/helpid.h
+++ b/sw/inc/helpid.h
@@ -88,17 +88,6 @@
 #define HID_MN_SUB_SPELLING                                     "SW_HID_MN_SUB_SPELLING"
 #define HID_MN_SUB_MIRROR                                       "SW_HID_MN_SUB_MIRROR"
 
-#define HID_MN_READONLY_SAVEGRAPHIC                             "SW_HID_MN_READONLY_SAVEGRAPHIC"
-#define HID_MN_READONLY_GRAPHICTOGALLERY                        "SW_HID_MN_READONLY_GRAPHICTOGALLERY"
-#define HID_MN_READONLY_TOGALLERYLINK                           "SW_HID_MN_READONLY_TOGALLERYLINK"
-#define HID_MN_READONLY_TOGALLERYCOPY                           "SW_HID_MN_READONLY_TOGALLERYCOPY"
-#define HID_MN_READONLY_SAVEBACKGROUND                          "SW_HID_MN_READONLY_SAVEBACKGROUND"
-#define HID_MN_READONLY_BACKGROUNDTOGALLERY                     "SW_HID_MN_READONLY_BACKGROUNDTOGALLERY"
-#define HID_MN_READONLY_COPYLINK                                "SW_HID_MN_READONLY_COPYLINK"
-#define HID_MN_READONLY_COPYGRAPHIC                             "SW_HID_MN_READONLY_COPYGRAPHIC"
-#define HID_MN_READONLY_LOADGRAPHIC                             "SW_HID_MN_READONLY_LOADGRAPHIC"
-#define HID_MN_READONLY_GRAPHICOFF                              "SW_HID_MN_READONLY_GRAPHICOFF"
-
 #define HID_LINGU_AUTOCORR                                      "SW_HID_LINGU_AUTOCORR"
 #define HID_LINGU_REPLACE                                       "SW_HID_LINGU_REPLACE"
 #define HID_SMARTTAG_MAIN                                       "SW_HID_SMARTTAG_MAIN"    // SMARTTAGS
diff --git a/sw/source/uibase/docvw/docvw.hrc b/sw/source/uibase/docvw/docvw.hrc
index ca60529fbe07..799efce72c69 100644
--- a/sw/source/uibase/docvw/docvw.hrc
+++ b/sw/source/uibase/docvw/docvw.hrc
@@ -22,32 +22,6 @@
 
 #include "rcid.hrc"
 
-#define MN_READONLY_POPUP               (RC_DOCVW_BEGIN + 1)
-#define MN_READONLY_OPENURL             (RC_DOCVW_BEGIN + 2)
-#define MN_READONLY_OPENURLNEW          (RC_DOCVW_BEGIN + 3)
-#define MN_READONLY_EDITDOC             (RC_DOCVW_BEGIN + 4)
-// free (5)
-#define MN_READONLY_BROWSE_BACKWARD     (RC_DOCVW_BEGIN + 6)
-#define MN_READONLY_BROWSE_FORWARD      (RC_DOCVW_BEGIN + 7)
-#define MN_READONLY_SELECTION_MODE      (RC_DOCVW_BEGIN + 8)
-#define MN_READONLY_SAVEGRAPHIC         (RC_DOCVW_BEGIN + 11)
-#define MN_READONLY_SAVEBACKGROUND      (RC_DOCVW_BEGIN + 12)
-#define MN_READONLY_COPYLINK            (RC_DOCVW_BEGIN + 13)
-#define MN_READONLY_COPYGRAPHIC         (RC_DOCVW_BEGIN + 14)
-#define MN_READONLY_LOADGRAPHIC         (RC_DOCVW_BEGIN + 15)
-#define MN_READONLY_GRAPHICOFF          (RC_DOCVW_BEGIN + 16)
-// free                                 (RC_DOCVW_BEGIN + 17)
-#define MN_READONLY_TOGALLERYLINK       (RC_DOCVW_BEGIN + 18)
-#define MN_READONLY_TOGALLERYCOPY       (RC_DOCVW_BEGIN + 19)
-#define MN_READONLY_SOURCEVIEW          (RC_DOCVW_BEGIN + 20)
-#define MN_READONLY_RELOAD_FRAME        (RC_DOCVW_BEGIN + 21)
-#define MN_READONLY_RELOAD              (RC_DOCVW_BEGIN + 22)
-#define MN_READONLY_COPY                (RC_DOCVW_BEGIN + 23)
-
-//For the following we need space for the gallery-themes
-#define MN_READONLY_GRAPHICTOGALLERY    (RC_DOCVW_BEGIN + 24)
-#define MN_READONLY_BACKGROUNDTOGALLERY (RC_DOCVW_BEGIN + 60)
-
 #define STR_REDLINE_INSERT              (RC_DOCVW_BEGIN + 9)
 #define STR_REDLINE_DELETE              (RC_DOCVW_BEGIN + 10)
 #define STR_REDLINE_FORMAT              (RC_DOCVW_BEGIN + 11)
diff --git a/sw/source/uibase/docvw/docvw.src b/sw/source/uibase/docvw/docvw.src
index a589c11ae11f..22e47e6a8709 100644
--- a/sw/source/uibase/docvw/docvw.src
+++ b/sw/source/uibase/docvw/docvw.src
@@ -20,171 +20,7 @@
 #include "docvw.hrc"
 #include "cmdid.h"
 #include "helpid.h"
-#define SEPARATOR MenuItem { Separator = TRUE; };
-Menu MN_READONLY_POPUP
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = MN_READONLY_OPENURL ;
-            HelpId = CMD_SID_OPENDOC ;
-            Text [ en-US ] = "~Open" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_OPENURLNEW ;
-            HelpId = CMD_SID_OPENDOC ;
-            Text [ en-US ] = "Open in New Window" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_EDITDOC ;
-            HelpId = CMD_SID_EDITDOC ;
-            Text [ en-US ] = "~Edit" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_SELECTION_MODE ;
-            HelpId = CMD_FN_READONLY_SELECTION_MODE ;
-            Text [ en-US ] = "Select Text";
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_RELOAD;
-            HelpId = CMD_SID_RELOAD;
-            Text [ en-US ] = "Re~load";
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_RELOAD_FRAME;
-            HelpId = CMD_SID_RELOAD;
-            Text [ en-US ] = "Reload Frame";
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_SOURCEVIEW ;
-            HelpId = HID_SOURCEVIEW ;
-            Text [ en-US ] = "HT~ML Source" ;
-        };
-        SEPARATOR
-        MenuItem
-        {
-            Identifier = MN_READONLY_BROWSE_BACKWARD ;
-            HelpId = CMD_SID_BROWSE_BACKWARD ;
-            Text [ en-US ] = "Backwards" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_BROWSE_FORWARD ;
-            HelpId = CMD_SID_BROWSE_FORWARD ;
-            Text [ en-US ] = "~Forward" ;
-        };
-        SEPARATOR
-        MenuItem
-        {
-            Identifier = MN_READONLY_SAVEGRAPHIC ;
-            HelpID = HID_MN_READONLY_SAVEGRAPHIC ;
-            Text [ en-US ] = "Save Image..." ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_GRAPHICTOGALLERY ;
-            HelpID = HID_MN_READONLY_GRAPHICTOGALLERY ;
-            SubMenu = Menu
-            {
-                ItemList =
-                {
-                    MenuItem
-                    {
-                        Identifier = MN_READONLY_TOGALLERYLINK ;
-                        HelpID = HID_MN_READONLY_TOGALLERYLINK ;
-                        Text [ en-US ] = "As Link" ;
-                    };
-                    MenuItem
-                    {
-                        Identifier = MN_READONLY_TOGALLERYCOPY ;
-                        HelpID = HID_MN_READONLY_TOGALLERYCOPY ;
-                        Text [ en-US ] = "Copy" ;
-                    };
-                    SEPARATOR
-                };
-            };
-            Text [ en-US ] = "Add Image" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_SAVEBACKGROUND ;
-            HelpID = HID_MN_READONLY_SAVEBACKGROUND ;
-            Text [ en-US ] = "Save Background..." ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_BACKGROUNDTOGALLERY ;
-            HelpID = HID_MN_READONLY_BACKGROUNDTOGALLERY ;
-            SubMenu = Menu
-            {
-                ItemList =
-                {
-                    MenuItem
-                    {
-                        Identifier = MN_READONLY_TOGALLERYLINK ;
-                        HelpID = HID_MN_READONLY_TOGALLERYLINK ;
-                        Text [ en-US ] = "As Link" ;
-                    };
-                    MenuItem
-                    {
-                        Identifier = MN_READONLY_TOGALLERYCOPY ;
-                        HelpID = HID_MN_READONLY_TOGALLERYCOPY ;
-                        Text [ en-US ] = "Copy" ;
-                    };
-                    SEPARATOR
-                };
-            };
-            Text [ en-US ] = "Add Background" ;
-        };
-        SEPARATOR
-        MenuItem
-        {
-            Identifier = MN_READONLY_COPYLINK ;
-            HelpID = HID_MN_READONLY_COPYLINK ;
-            Text [ en-US ] = "Copy ~Link" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_COPYGRAPHIC ;
-            HelpID = HID_MN_READONLY_COPYGRAPHIC ;
-            Text [ en-US ] = "Copy ~Image" ;
-        };
-        SEPARATOR
-        MenuItem
-        {
-            Identifier = MN_READONLY_LOADGRAPHIC ;
-            HelpID = HID_MN_READONLY_LOADGRAPHIC ;
-            Text [ en-US ] = "Load Image" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_READONLY_GRAPHICOFF ;
-            HelpID = HID_MN_READONLY_GRAPHICOFF ;
-            Text [ en-US ] = "Image Off" ;
-        };
-        SEPARATOR
-        MenuItem
-        {
-            Identifier = SID_WIN_FULLSCREEN;
-            HelpId = CMD_SID_WIN_FULLSCREEN;
-            Text [ en-US ] = "Leave Full-Screen Mode" ;
-        };
-        SEPARATOR
-        MenuItem
-        {
-            Identifier = MN_READONLY_COPY ;
-            HelpId = CMD_SID_COPY;
-            Text [ en-US ] = "~Copy" ;
-        };
-    };
-};
+
 String STR_REDLINE_INSERT
 {
     Text [ en-US ] = "Inserted" ;
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index dc7a4b4fa367..44d26b6441bc 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -71,7 +71,7 @@ void SwReadOnlyPopup::Check( sal_uInt16 nMID, sal_uInt16 nSID, SfxDispatcher &rD
                             dynamic_cast< const SfxBoolItem *>( _pItem.get() ) !=  nullptr &&
                             static_cast<SfxBoolItem*>(_pItem.get())->GetValue());
             //remove full screen entry when not in full screen mode
-            if (SID_WIN_FULLSCREEN == nSID && !xMenu->IsItemChecked(SID_WIN_FULLSCREEN))
+            if (SID_WIN_FULLSCREEN == nSID && !xMenu->IsItemChecked(nReadonlyFullscreen))
                 xMenu->EnableItem(nMID, false);
         }
     }
@@ -79,8 +79,35 @@ void SwReadOnlyPopup::Check( sal_uInt16 nMID, sal_uInt16 nSID, SfxDispatcher &rD
         xMenu->EnableItem(nMID, false);
 }
 
+#define MN_READONLY_GRAPHICTOGALLERY 1000
+#define MN_READONLY_BACKGROUNDTOGALLERY 2000
+
 SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
-    : xMenu(VclPtr<PopupMenu>::Create(SW_RES(MN_READONLY_POPUP)))
+    : aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/swriter/ui/readonlymenu.ui", "")
+    , xMenu(aBuilder.get_menu("menu"))
+    , nReadonlyOpenurl(xMenu->GetItemId("openurl"))
+    , nReadonlyOpendoc(xMenu->GetItemId("opendoc"))
+    , nReadonlyEditdoc(xMenu->GetItemId("edit"))
+    , nReadonlySelectionMode(xMenu->GetItemId("selection"))
+    , nReadonlyReload(xMenu->GetItemId("reload"))
+    , nReadonlyReloadFrame(xMenu->GetItemId("reloadframe"))
+    , nReadonlySourceview(xMenu->GetItemId("html"))
+    , nReadonlyBrowseBackward(xMenu->GetItemId("backward"))
+    , nReadonlyBrowseForward(xMenu->GetItemId("forward"))
+    , nReadonlySaveGraphic(xMenu->GetItemId("savegraphic"))
+    , nReadonlyGraphictogallery(xMenu->GetItemId("graphictogallery"))
+    , nReadonlyTogallerylink(xMenu->GetItemId("graphicaslink"))
+    , nReadonlyTogallerycopy(xMenu->GetItemId("graphicascopy"))
+    , nReadonlySaveBackground(xMenu->GetItemId("savebackground"))
+    , nReadonlyBackgroundtogallery(xMenu->GetItemId("backgroundtogallery"))
+    , nReadonlyBackgroundTogallerylink(xMenu->GetItemId("backaslink"))
+    , nReadonlyBackgroundTogallerycopy(xMenu->GetItemId("backascopy"))
+    , nReadonlyCopylink(xMenu->GetItemId("copylink"))
+    , nReadonlyCopyGraphic(xMenu->GetItemId("copygraphic"))
+    , nReadonlyLoadGraphic(xMenu->GetItemId("loadgraphic"))
+    , nReadonlyGraphicoff(xMenu->GetItemId("imagesoff"))
+    , nReadonlyFullscreen(xMenu->GetItemId("fullscreen"))
+    , nReadonlyCopy(xMenu->GetItemId("copy"))
     , rView(rV)
     , aBrushItem(RES_BACKGROUND)
     , rDocPos(rDPos)
@@ -106,8 +133,8 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
     const Graphic *pGrf;
     if ( nullptr == (pGrf = rSh.GetGrfAtPos( rDocPos, sGrfName, bLink )) )
     {
-        xMenu->EnableItem(MN_READONLY_SAVEGRAPHIC, false);
-        xMenu->EnableItem(MN_READONLY_COPYGRAPHIC, false);
+        xMenu->EnableItem(nReadonlySaveGraphic, false);
+        xMenu->EnableItem(nReadonlyCopyGraphic, false);
     }
     else
     {
@@ -133,18 +160,18 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
     {
         if (GalleryExplorer::FillThemeList( aThemeList ))
         {
-            PopupMenu *pMenu = xMenu->GetPopupMenu(MN_READONLY_GRAPHICTOGALLERY);
-            pMenu->CheckItem( MN_READONLY_TOGALLERYLINK,  bGrfToGalleryAsLnk );
-            pMenu->CheckItem( MN_READONLY_TOGALLERYCOPY, !bGrfToGalleryAsLnk );
+            PopupMenu *pMenu = xMenu->GetPopupMenu(nReadonlyGraphictogallery);
+            pMenu->CheckItem(nReadonlyTogallerylink,  bGrfToGalleryAsLnk);
+            pMenu->CheckItem(nReadonlyTogallerycopy, !bGrfToGalleryAsLnk);
 
             for ( size_t i=0; i < aThemeList.size(); ++i )
-                pMenu->InsertItem( MN_READONLY_GRAPHICTOGALLERY+i + 3, aThemeList[ i ] );
+                pMenu->InsertItem(MN_READONLY_GRAPHICTOGALLERY + i, aThemeList[i]);
         }
         else
             bEnableGraphicToGallery = false;
     }
 
-    xMenu->EnableItem(MN_READONLY_GRAPHICTOGALLERY, bEnableGraphicToGallery);
+    xMenu->EnableItem(nReadonlyGraphictogallery, bEnableGraphicToGallery);
 
     SfxViewFrame * pVFrame = rV.GetViewFrame();
     SfxDispatcher &rDis = *pVFrame->GetDispatcher();
@@ -163,41 +190,41 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
 
             if ( !aThemeList.empty() )
             {
-                PopupMenu *pMenu = xMenu->GetPopupMenu(MN_READONLY_BACKGROUNDTOGALLERY);
-                pMenu->CheckItem( MN_READONLY_TOGALLERYLINK,  bGrfToGalleryAsLnk );
-                pMenu->CheckItem( MN_READONLY_TOGALLERYCOPY, !bGrfToGalleryAsLnk );
+                PopupMenu *pMenu = xMenu->GetPopupMenu(nReadonlyBackgroundtogallery);
+                pMenu->CheckItem(nReadonlyBackgroundTogallerylink,  bGrfToGalleryAsLnk);
+                pMenu->CheckItem(nReadonlyBackgroundTogallerycopy, !bGrfToGalleryAsLnk);
                 bEnableBackGallery = true;
 
                 for ( size_t i=0; i < aThemeList.size(); ++i )
-                    pMenu->InsertItem( MN_READONLY_GRAPHICTOGALLERY+i + 3, aThemeList[ i ] );
+                    pMenu->InsertItem(MN_READONLY_BACKGROUNDTOGALLERY + i, aThemeList[i]);
             }
         }
     }
-    xMenu->EnableItem(MN_READONLY_SAVEBACKGROUND, bEnableBack);
-    xMenu->EnableItem(MN_READONLY_BACKGROUNDTOGALLERY, bEnableBackGallery);
+    xMenu->EnableItem(nReadonlySaveBackground, bEnableBack);
+    xMenu->EnableItem(nReadonlyBackgroundtogallery, bEnableBackGallery);
 
     if ( !rSh.GetViewOptions()->IsGraphic() )
-        xMenu->CheckItem(MN_READONLY_GRAPHICOFF);
+        xMenu->CheckItem(nReadonlyGraphicoff);
     else
-        xMenu->EnableItem(MN_READONLY_LOADGRAPHIC, false);
+        xMenu->EnableItem(nReadonlyLoadGraphic, false);
 
-    xMenu->EnableItem(MN_READONLY_RELOAD_FRAME, false);
-    xMenu->EnableItem(MN_READONLY_RELOAD);
+    xMenu->EnableItem(nReadonlyReloadFrame, false);
+    xMenu->EnableItem(nReadonlyReload);
 
-    Check( MN_READONLY_EDITDOC,         SID_EDITDOC,        rDis );
-    Check( MN_READONLY_SELECTION_MODE,  FN_READONLY_SELECTION_MODE,    rDis );
-    Check( MN_READONLY_SOURCEVIEW,      SID_SOURCEVIEW,     rDis );
-    Check( MN_READONLY_BROWSE_BACKWARD, SID_BROWSE_BACKWARD,rDis );
-    Check( MN_READONLY_BROWSE_FORWARD,  SID_BROWSE_FORWARD, rDis );
-    Check( MN_READONLY_OPENURL,         SID_OPENDOC,        rDis );
-    Check( MN_READONLY_OPENURLNEW,      SID_OPENDOC,        rDis );
+    Check(nReadonlyEditdoc, SID_EDITDOC, rDis);
+    Check(nReadonlySelectionMode, FN_READONLY_SELECTION_MODE, rDis);
+    Check(nReadonlySourceview, SID_SOURCEVIEW, rDis);
+    Check(nReadonlyBrowseBackward, SID_BROWSE_BACKWARD, rDis);
+    Check(nReadonlyBrowseForward,SID_BROWSE_FORWARD, rDis);
+    Check(nReadonlyOpenurl, SID_OPENDOC, rDis);
+    Check(nReadonlyOpendoc, SID_OPENDOC, rDis);
 
     std::unique_ptr<SfxPoolItem> pState;
 
     SfxItemState eState = pVFrame->GetBindings().QueryState( SID_COPY, pState );
-    Check( MN_READONLY_COPY,            SID_COPY,           rDis );
+    Check(nReadonlyCopy, SID_COPY, rDis);
     if (eState < SfxItemState::DEFAULT)
-        xMenu->EnableItem(MN_READONLY_COPY, false);
+        xMenu->EnableItem(nReadonlyCopy, false);
 
     eState = pVFrame->GetBindings().QueryState( SID_EDITDOC, pState );
     if (
@@ -205,16 +232,16 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
         (rSh.IsGlobalDoc() && rView.GetDocShell()->IsReadOnlyUI())
        )
     {
-        xMenu->EnableItem(MN_READONLY_EDITDOC, false);
+        xMenu->EnableItem(nReadonlyEditdoc, false);
     }
 
     if ( sURL.isEmpty() )
     {
-        xMenu->EnableItem(MN_READONLY_OPENURL, false);
-        xMenu->EnableItem(MN_READONLY_OPENURLNEW, false);
-        xMenu->EnableItem(MN_READONLY_COPYLINK, false);
+        xMenu->EnableItem(nReadonlyOpenurl, false);
+        xMenu->EnableItem(nReadonlyOpendoc, false);
+        xMenu->EnableItem(nReadonlyCopylink, false);
     }
-    Check( SID_WIN_FULLSCREEN,         SID_WIN_FULLSCREEN,        rDis );
+    Check(nReadonlyFullscreen, SID_WIN_FULLSCREEN, rDis);
 
     xMenu->RemoveDisabledEntries( true, true );
 }
@@ -230,24 +257,24 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId )
 {
     SwWrtShell &rSh = rView.GetWrtShell();
     SfxDispatcher &rDis = *rView.GetViewFrame()->GetDispatcher();
-    if ( nId >= MN_READONLY_GRAPHICTOGALLERY )
+    if (nId >= MN_READONLY_GRAPHICTOGALLERY)
     {
         OUString sTmp;
         sal_uInt16 nSaveId;
-        if ( nId >= MN_READONLY_BACKGROUNDTOGALLERY )
+        if (nId >= MN_READONLY_BACKGROUNDTOGALLERY)
         {
-            nId -= MN_READONLY_BACKGROUNDTOGALLERY+3;
-            nSaveId = MN_READONLY_SAVEBACKGROUND;
+            nId -= MN_READONLY_BACKGROUNDTOGALLERY;
+            nSaveId = nReadonlySaveBackground;
             sTmp = aBrushItem.GetGraphicLink();
         }
         else
         {
-            nId -= MN_READONLY_GRAPHICTOGALLERY+3;
-            nSaveId = MN_READONLY_SAVEGRAPHIC;
+            nId -= MN_READONLY_GRAPHICTOGALLERY;
+            nSaveId = nReadonlySaveGraphic;
             sTmp = sGrfName;
         }
         if ( !bGrfToGalleryAsLnk )
-            sTmp = SaveGraphic( nSaveId );
+            sTmp = SaveGraphic(nSaveId);
 
         if ( !sTmp.isEmpty() )
             GalleryExplorer::InsertURL( aThemeList[nId], sTmp );
@@ -260,65 +287,65 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId )
     sal_uInt16 nExecId = USHRT_MAX;
     bool bFilterSet = false;
     LoadUrlFlags nFilter = LoadUrlFlags::NONE;
-    switch( nId )
+    if (nId == nReadonlyFullscreen)
+        nExecId = SID_WIN_FULLSCREEN;
+    else if (nId == nReadonlyOpenurl)
     {
-        case SID_WIN_FULLSCREEN :           nExecId = SID_WIN_FULLSCREEN; break;
-        case MN_READONLY_OPENURL:           nFilter = LoadUrlFlags::NONE; bFilterSet = true; break;
-        case MN_READONLY_OPENURLNEW:        nFilter = LoadUrlFlags::NewView; bFilterSet = true; break;
-        case MN_READONLY_COPY:              nExecId = SID_COPY;           break;
-
-        case MN_READONLY_EDITDOC:           nExecId = SID_EDITDOC;        break;
-        case MN_READONLY_SELECTION_MODE:    nExecId = FN_READONLY_SELECTION_MODE; break;
-        case MN_READONLY_RELOAD:
-        case MN_READONLY_RELOAD_FRAME:
-            rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(SID_RELOAD);
-        break;
-
-        case MN_READONLY_BROWSE_BACKWARD:   nExecId = SID_BROWSE_BACKWARD;break;
-        case MN_READONLY_BROWSE_FORWARD:    nExecId = SID_BROWSE_FORWARD; break;
-        case MN_READONLY_SOURCEVIEW:        nExecId = SID_SOURCEVIEW;     break;
-        case MN_READONLY_SAVEGRAPHIC:
-        case MN_READONLY_SAVEBACKGROUND:
-            {
-                SaveGraphic( nId );
-                break;
-            }
-        case MN_READONLY_COPYLINK:
-            pClipCntnr = new TransferDataContainer;
-            pClipCntnr->CopyString( sURL );
-            break;
-
-        case MN_READONLY_COPYGRAPHIC:
-            pClipCntnr = new TransferDataContainer;
-            pClipCntnr->CopyGraphic( aGraphic );
-
-            if( pImageMap )
-                pClipCntnr->CopyImageMap( *pImageMap );
-            if( pTargetURL )
-                pClipCntnr->CopyINetImage( *pTargetURL );
-            break;
-
-        case MN_READONLY_LOADGRAPHIC:
-            {
-                bool bModified = rSh.IsModified();
-                SwViewOption aOpt( *rSh.GetViewOptions() );
-                aOpt.SetGraphic( true );
-                rSh.ApplyViewOptions( aOpt );
-                if(!bModified)
-                    rSh.ResetModified();
-                break;
-            }
-        case MN_READONLY_GRAPHICOFF:        nExecId = FN_VIEW_GRAPHIC;    break;
-        case MN_READONLY_TOGALLERYLINK:
-            SW_MOD()->GetModuleConfig()->SetGrfToGalleryAsLnk( true );
-            break;
-        case MN_READONLY_TOGALLERYCOPY:
-            SW_MOD()->GetModuleConfig()->SetGrfToGalleryAsLnk( false );
-            break;
-
-        default: //forward the id to the SfxBindings
-            nExecId = nId;
+        nFilter = LoadUrlFlags::NONE;
+        bFilterSet = true;
+    }
+    else if (nId == nReadonlyOpendoc)
+    {
+        nFilter = LoadUrlFlags::NewView;
+        bFilterSet = true;
     }
+    else if (nId == nReadonlyCopy)
+        nExecId = SID_COPY;
+    else if (nId == nReadonlyEditdoc)
+        nExecId = SID_EDITDOC;
+    else if (nId == nReadonlySelectionMode)
+        nExecId = FN_READONLY_SELECTION_MODE;
+    else if (nId == nReadonlyReload || nId == nReadonlyReloadFrame)
+        rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(SID_RELOAD);
+    else if (nId == nReadonlyBrowseBackward)
+        nExecId = SID_BROWSE_BACKWARD;
+    else if (nId == nReadonlyBrowseForward)
+        nExecId = SID_BROWSE_FORWARD;
+    else if (nId == nReadonlySourceview)
+        nExecId = SID_SOURCEVIEW;
+    else if (nId == nReadonlySaveGraphic || nId == nReadonlySaveBackground)
+        SaveGraphic(nId);
+    else if (nId == nReadonlyCopylink)
+    {
+        pClipCntnr = new TransferDataContainer;
+        pClipCntnr->CopyString( sURL );
+    }
+    else if (nId == nReadonlyCopyGraphic)
+    {
+        pClipCntnr = new TransferDataContainer;
+        pClipCntnr->CopyGraphic( aGraphic );
+
+        if( pImageMap )
+            pClipCntnr->CopyImageMap( *pImageMap );
+        if( pTargetURL )
+            pClipCntnr->CopyINetImage( *pTargetURL );
+    }
+    else if (nId == nReadonlyLoadGraphic)
+    {
+        bool bModified = rSh.IsModified();
+        SwViewOption aOpt( *rSh.GetViewOptions() );
+        aOpt.SetGraphic( true );
+        rSh.ApplyViewOptions( aOpt );
+        if(!bModified)
+            rSh.ResetModified();
+    }
+    else if (nId == nReadonlyGraphicoff)
+        nExecId = FN_VIEW_GRAPHIC;
+    else if (nId == nReadonlyTogallerylink || nId == nReadonlyBackgroundTogallerylink)
+        SW_MOD()->GetModuleConfig()->SetGrfToGalleryAsLnk(true);
+    else if (nId == nReadonlyTogallerycopy || nId == nReadonlyBackgroundTogallerycopy)
+        SW_MOD()->GetModuleConfig()->SetGrfToGalleryAsLnk(false);
+
     if( USHRT_MAX != nExecId )
         rDis.GetBindings()->Execute( nExecId );
     if( bFilterSet )
@@ -332,10 +359,10 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId )
     }
 }
 
-OUString SwReadOnlyPopup::SaveGraphic( sal_uInt16 nId )
+OUString SwReadOnlyPopup::SaveGraphic(sal_uInt16 nId)
 {
     // fish out the graphic's name
-    if ( MN_READONLY_SAVEBACKGROUND == nId )
+    if (nId == nReadonlySaveBackground)
     {
         if ( !aBrushItem.GetGraphicLink().isEmpty() )
             sGrfName = aBrushItem.GetGraphicLink();
diff --git a/sw/source/uibase/docvw/romenu.hxx b/sw/source/uibase/docvw/romenu.hxx
index 12f350873314..946095dbb8a1 100644
--- a/sw/source/uibase/docvw/romenu.hxx
+++ b/sw/source/uibase/docvw/romenu.hxx
@@ -31,7 +31,32 @@ class INetImage;
 
 class SwReadOnlyPopup
 {
+    VclBuilder aBuilder;
     ScopedVclPtr<PopupMenu> xMenu;
+    sal_uInt16 nReadonlyOpenurl;
+    sal_uInt16 nReadonlyOpendoc;
+    sal_uInt16 nReadonlyEditdoc;
+    sal_uInt16 nReadonlySelectionMode;
+    sal_uInt16 nReadonlyReload;
+    sal_uInt16 nReadonlyReloadFrame;
+    sal_uInt16 nReadonlySourceview;
+    sal_uInt16 nReadonlyBrowseBackward;
+    sal_uInt16 nReadonlyBrowseForward;
+    sal_uInt16 nReadonlySaveGraphic;
+    sal_uInt16 nReadonlyGraphictogallery;
+    sal_uInt16 nReadonlyTogallerylink;
+    sal_uInt16 nReadonlyTogallerycopy;
+    sal_uInt16 nReadonlySaveBackground;
+    sal_uInt16 nReadonlyBackgroundtogallery;
+    sal_uInt16 nReadonlyBackgroundTogallerylink;
+    sal_uInt16 nReadonlyBackgroundTogallerycopy;
+    sal_uInt16 nReadonlyCopylink;
+    sal_uInt16 nReadonlyCopyGraphic;
+    sal_uInt16 nReadonlyLoadGraphic;
+    sal_uInt16 nReadonlyGraphicoff;
+    sal_uInt16 nReadonlyFullscreen;
+    sal_uInt16 nReadonlyCopy;
+
     SwView &rView;
     SvxBrushItem aBrushItem;
     const Point &rDocPos;
diff --git a/sw/uiconfig/swriter/ui/readonlymenu.ui b/sw/uiconfig/swriter/ui/readonlymenu.ui
new file mode 100644
index 000000000000..91891ee30d7b
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/readonlymenu.ui
@@ -0,0 +1,247 @@
+<?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="openurl">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Open</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="opendoc">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Open in New Window</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="edit">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Edit</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkCheckMenuItem" id="selection">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Select Text</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="reload">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Re_load</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="reloadframe">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Reload Frame</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkCheckMenuItem" id="html">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">HT_ML Source</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="backward">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Backwards</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="forward">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Forward</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="savegraphic">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Save Image...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="graphictogallery">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Add Image</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="graphicaslink">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">As Link</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="graphicascopy">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Copy</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="GtkMenuItem" id="savebackground">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Save Background...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="backgroundtogallery">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child type="submenu">
+          <object class="GtkMenu">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkMenuItem" id="backaslink">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="backascopy">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparatorMenuItem" id="menuitem4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem5">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="copylink">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Copy _Link</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="copygraphic">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Copy _Image</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem6">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="loadgraphic">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Load Image</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkCheckMenuItem" id="imagesoff">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Image Off</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem8">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkCheckMenuItem" id="fullscreen">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Leave Full-Screen Mode</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem7">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="copy">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Copy</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
+</interface>
commit c1b14cb632914d6eeaa036d7d1b2cce1b2fd14b3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 18 12:10:20 2017 +0100

    Window::ReleaseMouse warning isn't helpful
    
    Change-Id: If25bdc25c5fc6c1beda14c749c3bdfb6d12386a2

diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 090b2e3e73fd..814560113470 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -464,14 +464,9 @@ void Window::CaptureMouse()
 
 void Window::ReleaseMouse()
 {
-
-    ImplSVData* pSVData = ImplGetSVData();
-
-    SAL_WARN_IF(!IsMouseCaptured(), "vcl",
-                       "Window::ReleaseMouse(): window doesn't have the mouse capture" );
-
     if (IsMouseCaptured())
     {
+        ImplSVData* pSVData = ImplGetSVData();
         pSVData->maWinData.mpCaptureWin = nullptr;
         mpWindowImpl->mpFrame->CaptureMouse( false );
         ImplGenerateMouseMove();
@@ -480,13 +475,11 @@ void Window::ReleaseMouse()
 
 bool Window::IsMouseCaptured() const
 {
-
     return (this == ImplGetSVData()->maWinData.mpCaptureWin);
 }
 
 void Window::SetPointer( const Pointer& rPointer )
 {
-
     if ( mpWindowImpl->maPointer == rPointer )
         return;
 


More information about the Libreoffice-commits mailing list