summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-18 09:59:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-18 10:14:56 +0100
commitdcb7164f2e132bbe1e80d57dd5b4d2319b3b9b60 (patch)
tree050ee8de68feac58f118ebf06801a819cee8bfaa /svx
parentea8f69e4a8ca8c3912aacb9838d7c5bb20b47f46 (diff)
convert filter menu to .ui
Change-Id: Iad9eeeedbd2b6c98861db367a68e3f5506cbd246
Diffstat (limited to 'svx')
-rw-r--r--svx/AllLangResTarget_svx.mk1
-rw-r--r--svx/UIConfig_svx.mk1
-rw-r--r--svx/inc/fmhelp.hrc4
-rw-r--r--svx/source/form/filtnav.cxx58
-rw-r--r--svx/source/form/filtnav.src55
-rw-r--r--svx/uiconfig/ui/filtermenu.ui167
6 files changed, 197 insertions, 89 deletions
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>