diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 09:59:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 10:14:56 +0100 |
commit | dcb7164f2e132bbe1e80d57dd5b4d2319b3b9b60 (patch) | |
tree | 050ee8de68feac58f118ebf06801a819cee8bfaa /svx/source/form | |
parent | ea8f69e4a8ca8c3912aacb9838d7c5bb20b47f46 (diff) |
convert filter menu to .ui
Change-Id: Iad9eeeedbd2b6c98861db367a68e3f5506cbd246
Diffstat (limited to 'svx/source/form')
-rw-r--r-- | svx/source/form/filtnav.cxx | 58 | ||||
-rw-r--r-- | svx/source/form/filtnav.src | 55 |
2 files changed, 29 insertions, 84 deletions
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: */ |