[Libreoffice-commits] core.git: include/svx svx/AllLangResTarget_svx.mk svx/inc svx/source svx/uiconfig svx/UIConfig_svx.mk

Caolán McNamara caolanm at redhat.com
Tue Apr 18 09:15:26 UTC 2017


 include/svx/fmresids.hrc      |    3 
 include/svx/svxids.hrc        |    8 +-
 svx/AllLangResTarget_svx.mk   |    1 
 svx/UIConfig_svx.mk           |    1 
 svx/inc/fmhelp.hrc            |    4 -
 svx/source/form/filtnav.cxx   |   58 +++++++-------
 svx/source/form/filtnav.src   |   55 -------------
 svx/uiconfig/ui/filtermenu.ui |  167 ++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 201 insertions(+), 96 deletions(-)

New commits:
commit dcb7164f2e132bbe1e80d57dd5b4d2319b3b9b60
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 18 09:59:22 2017 +0100

    convert filter menu to .ui
    
    Change-Id: Iad9eeeedbd2b6c98861db367a68e3f5506cbd246

diff --git a/include/svx/fmresids.hrc b/include/svx/fmresids.hrc
index 7a82ef7b9390..a9603635309b 100644
--- a/include/svx/fmresids.hrc
+++ b/include/svx/fmresids.hrc
@@ -61,9 +61,6 @@
 #define RID_SVXTBX_MORECONTROLS                     (RID_FORMS_START +  5)
 #define RID_SVXTBX_FORMDESIGN                       (RID_FORMS_START +  6)
 
-// Menu-Id's -----------------------------------------------------------
-#define RID_FM_FILTER_MENU                          (RID_FORMS_START + 5)
-
 // String-Id's -----------------------------------------------------------
 #define RID_STR_INVALID_XMLNAME                     (RID_FORMS_START + 1)
 #define RID_STR_INVALID_XMLPREFIX                   (RID_FORMS_START + 2)
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 64decd7a10b8..0eb5bf579c33 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -595,7 +595,7 @@
 #define SID_FM_PROPERTY_CONTROL                         ( SID_SVX_START + 636 )
 #define SID_FM_FMEXPLORER_CONTROL                       ( SID_SVX_START + 637 )
 //FREE
-#define SID_FM_DELETE                                   ( SID_SVX_START + 639 )
+//FREE
 //FREE
 #define SID_3D_WIN                                      ( SID_SVX_START + 644 )
 #define SID_3D_STATE                                    ( SID_SVX_START + 645 )
@@ -659,9 +659,9 @@
 //FREE
 //FREE
 //FREE
-#define SID_FM_FILTER_EDIT                              ( SID_SVX_START + 758 )
-#define SID_FM_FILTER_IS_NULL                           ( SID_SVX_START + 759 )
-#define SID_FM_FILTER_IS_NOT_NULL                       ( SID_SVX_START + 760 )
+//FREE
+//FREE
+//FREE
 #define SID_FM_VIEW_AS_GRID                             ( SID_SVX_START + 761 )
 #define SID_FM_AUTOCONTROLFOCUS                         ( SID_SVX_START + 763 )
 #define SID_DSBROWSER_EXPLORER                          ( SID_SVX_START + 764 )
diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk
index 0d14e1dce4c5..2fcc11325f51 100644
--- a/svx/AllLangResTarget_svx.mk
+++ b/svx/AllLangResTarget_svx.mk
@@ -60,7 +60,6 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\
     svx/source/engine3d/float3d.src \
     svx/source/engine3d/string3d.src \
     svx/source/form/datanavi.src \
-    svx/source/form/filtnav.src \
     svx/source/form/fmexpl.src \
     svx/source/form/fmstring.src \
     svx/source/items/svxerr.src \
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 5367c59b4743..d836697afe8b 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
 	svx/uiconfig/ui/docrecoveryrecoverdialog \
 	svx/uiconfig/ui/docrecoverysavedialog \
 	svx/uiconfig/ui/extrustiondepthdialog \
+	svx/uiconfig/ui/filtermenu \
 	svx/uiconfig/ui/findreplacedialog \
 	svx/uiconfig/ui/floatingareastyle \
 	svx/uiconfig/ui/floatingcontour \
diff --git a/svx/inc/fmhelp.hrc b/svx/inc/fmhelp.hrc
index 7e7495492430..c470e7876970 100644
--- a/svx/inc/fmhelp.hrc
+++ b/svx/inc/fmhelp.hrc
@@ -32,10 +32,6 @@
 #define HID_GRID_TRAVEL_NEW                                   "SVX_HID_GRID_TRAVEL_NEW"
 #define HID_GRID_TRAVEL_ABSOLUTE                              "SVX_HID_GRID_TRAVEL_ABSOLUTE"
 #define HID_GRID_NUMBEROFRECORDS                              "SVX_HID_GRID_NUMBEROFRECORDS"
-#define HID_FM_DELETE                                         "SVX_HID_FM_DELETE"
-#define HID_FM_FILTER_EDIT                                    "SVX_HID_FM_EDIT"
-#define HID_FM_FILTER_IS_NULL                                 "SVX_HID_FM_FILTER_IS_NULL"
-#define HID_FM_FILTER_IS_NOT_NULL                             "SVX_HID_FM_IS_NOT_NULL"
 
 #endif
 
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 965b2c0069fe..81e1a695ff45 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1611,45 +1611,45 @@ void FmFilterNavigator::Command( const CommandEvent& rEvt )
                     aSelectList.clear();
             }
 
-            ScopedVclPtrInstance<PopupMenu> aContextMenu(SVX_RES(RID_FM_FILTER_MENU));
+            VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/filtermenu.ui", "");
+            VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
 
             // every condition could be deleted except the first one if it's the only one
-            aContextMenu->EnableItem( SID_FM_DELETE, !aSelectList.empty() );
+            aContextMenu->EnableItem(aContextMenu->GetItemId("delete"), !aSelectList.empty());
 
 
             bool bEdit = dynamic_cast<FmFilterItem*>( static_cast<FmFilterData*>(pClicked->GetUserData()) ) != nullptr &&
                 IsSelected(pClicked) && GetSelectionCount() == 1;
 
-            aContextMenu->EnableItem( SID_FM_FILTER_EDIT, bEdit );
-            aContextMenu->EnableItem( SID_FM_FILTER_IS_NULL, bEdit );
-            aContextMenu->EnableItem( SID_FM_FILTER_IS_NOT_NULL, bEdit );
+            aContextMenu->EnableItem(aContextMenu->GetItemId("edit"), bEdit);
+            aContextMenu->EnableItem(aContextMenu->GetItemId("isnull"), bEdit);
+            aContextMenu->EnableItem(aContextMenu->GetItemId("isnotnull"), bEdit);
 
             aContextMenu->RemoveDisabledEntries(true, true);
-            sal_uInt16 nSlotId = aContextMenu->Execute( this, aWhere );
-            switch( nSlotId )
+            aContextMenu->Execute(this, aWhere);
+            OString sIdent = aContextMenu->GetCurItemIdent();
+            if (sIdent == "edit")
+                EditEntry( pClicked );
+            else if (sIdent == "isnull")
             {
-                case SID_FM_FILTER_EDIT:
-                {
-                    EditEntry( pClicked );
-                }   break;
-                case SID_FM_FILTER_IS_NULL:
-                case SID_FM_FILTER_IS_NOT_NULL:
-                {
-                    OUString aErrorMsg;
-                    OUString aText;
-                    if (nSlotId == SID_FM_FILTER_IS_NULL)
-                        aText = "IS NULL";
-                    else
-                        aText = "IS NOT NULL";
-
-                    m_pModel->ValidateText(static_cast<FmFilterItem*>(pClicked->GetUserData()),
-                                            aText, aErrorMsg);
-                    m_pModel->SetTextForItem(static_cast<FmFilterItem*>(pClicked->GetUserData()), aText);
-                }   break;
-                case SID_FM_DELETE:
-                {
-                    DeleteSelection();
-                }   break;
+                OUString aErrorMsg;
+                OUString aText = "IS NULL";
+                m_pModel->ValidateText(static_cast<FmFilterItem*>(pClicked->GetUserData()),
+                                        aText, aErrorMsg);
+                m_pModel->SetTextForItem(static_cast<FmFilterItem*>(pClicked->GetUserData()), aText);
+            }
+            else if (sIdent == "isnotnull")
+            {
+                OUString aErrorMsg;
+                OUString aText = "IS NOT NULL";
+
+                m_pModel->ValidateText(static_cast<FmFilterItem*>(pClicked->GetUserData()),
+                                        aText, aErrorMsg);
+                m_pModel->SetTextForItem(static_cast<FmFilterItem*>(pClicked->GetUserData()), aText);
+            }
+            else if (sIdent == "delete")
+            {
+                DeleteSelection();
             }
             bHandled = true;
         }
diff --git a/svx/source/form/filtnav.src b/svx/source/form/filtnav.src
deleted file mode 100644
index e12ff8615de5..000000000000
--- a/svx/source/form/filtnav.src
+++ /dev/null
@@ -1,55 +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 <svx/svxids.hrc>
-#include "svx/fmresids.hrc"
-#include "fmhelp.hrc"
-
-Menu RID_FM_FILTER_MENU
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = SID_FM_DELETE ;
-            HelpId = HID_FM_DELETE;
-            Text [ en-US ] = "~Delete" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_FM_FILTER_EDIT ;
-            HelpId = HID_FM_FILTER_EDIT;
-            Text [ en-US ] = "~Edit" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_FM_FILTER_IS_NULL ;
-            HelpId = HID_FM_FILTER_IS_NULL;
-            Text [ en-US ] = "~Is Null" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_FM_FILTER_IS_NOT_NULL ;
-            HelpId = HID_FM_FILTER_IS_NOT_NULL;
-            Text [ en-US ] = "I~s not Null" ;
-        };
-    };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/filtermenu.ui b/svx/uiconfig/ui/filtermenu.ui
new file mode 100644
index 000000000000..b3d149e711c5
--- /dev/null
+++ b/svx/uiconfig/ui/filtermenu.ui
@@ -0,0 +1,167 @@
+<?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="delete">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Delete</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="GtkMenuItem" id="isnull">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Is Null</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="isnotnull">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">I_s not Null</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToList">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">L_ist Box</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToCheckBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Check Box</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToRadio">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Radio Button</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToCombo">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Combo Bo_x</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToImageBtn">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">I_mage Button</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToFileControl">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_File Selection</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToDate">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Date Field</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToTime">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Tim_e Field</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToNumeric">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Numerical Field</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToCurrency">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">C_urrency Field</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToPattern">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Pattern Field</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToImageControl">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Ima_ge Control</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToFormatted">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Fo_rmatted Field</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToScrollBar">
+        <property name="sensitive">False</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Scroll bar</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToSpinButton">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Spin Button</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="ConvertToNavigationBar">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Navigation Bar</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list