diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 17:03:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 17:08:48 +0100 |
commit | b44b97532196c39b3214618e00fa9cd456f8c0e8 (patch) | |
tree | 53d1e1e6e89642c3e98ebc6b31e18b8aa0f1697a /reportdesign/source/ui | |
parent | 0191f643a2a79af94630d08abbb3e422c05020e7 (diff) |
convert navigator menu to .ui
Change-Id: I754da935de04dde6d94fa2a1331c771a4bd5ec88
Diffstat (limited to 'reportdesign/source/ui')
-rw-r--r-- | reportdesign/source/ui/dlg/Navigator.cxx | 46 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Navigator.src | 61 |
2 files changed, 35 insertions, 72 deletions
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index e3dbfd459c99..d4cba5f0958a 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -261,6 +261,26 @@ void NavigatorTree::dispose() SvTreeListBox::dispose(); } +namespace +{ + sal_uInt16 mapIdent(const OString& rIdent) + { + if (rIdent == "sorting") + return SID_SORTINGANDGROUPING; + else if (rIdent == "page") + return SID_PAGEHEADERFOOTER; + else if (rIdent == "report") + return SID_REPORTHEADERFOOTER; + else if (rIdent == "function") + return SID_RPT_NEW_FUNCTION; + else if (rIdent == "properties") + return SID_SHOW_PROPERTYBROWSER; + else if (rIdent == "delete") + return SID_DELETE; + return 0; + } +} + void NavigatorTree::Command( const CommandEvent& rEvt ) { bool bHandled = false; @@ -297,29 +317,33 @@ void NavigatorTree::Command( const CommandEvent& rEvt ) uno::Reference< report::XGroup> xGroup(pData->getContent(),uno::UNO_QUERY); bool bDeleteAllowed = m_rController.isEditable() && (xGroup.is() || uno::Reference< report::XFunction>(pData->getContent(),uno::UNO_QUERY).is()); - ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_MENU_NAVIGATOR ) ); + + VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/dbreport/ui/navigatormenu.ui", ""); + VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu")); sal_uInt16 nCount = aContextMenu->GetItemCount(); for (sal_uInt16 i = 0; i < nCount; ++i) { if ( MenuItemType::SEPARATOR != aContextMenu->GetItemType(i)) { - sal_uInt16 nId = aContextMenu->GetItemId(i); + sal_uInt16 nMId = aContextMenu->GetItemId(i); + sal_uInt16 nSId = mapIdent(aContextMenu->GetItemIdent(nMId)); - aContextMenu->CheckItem(nId,m_rController.isCommandChecked(nId)); - bool bEnabled = m_rController.isCommandEnabled(nId); - if ( nId == SID_RPT_NEW_FUNCTION ) - aContextMenu->EnableItem(nId,m_rController.isEditable() && (xSupplier.is() || xFunctions.is()) ); + aContextMenu->CheckItem(nMId, m_rController.isCommandChecked(nSId)); + bool bEnabled = m_rController.isCommandEnabled(nSId); + if (nSId == SID_RPT_NEW_FUNCTION) + aContextMenu->EnableItem(nMId, m_rController.isEditable() && (xSupplier.is() || xFunctions.is())); // special condition, check for function and group - else if ( nId == SID_DELETE ) - aContextMenu->EnableItem(SID_DELETE,bDeleteAllowed); + else if (nSId == SID_DELETE) + aContextMenu->EnableItem(nMId, bDeleteAllowed); else - aContextMenu->EnableItem(nId,bEnabled); + aContextMenu->EnableItem(nMId, bEnabled); } } - sal_uInt16 nId = aContextMenu->Execute(this, aWhere); - if ( nId ) + + if (aContextMenu->Execute(this, aWhere)) { + sal_uInt16 nId = mapIdent(aContextMenu->GetCurItemIdent()); uno::Sequence< beans::PropertyValue> aArgs; if ( nId == SID_RPT_NEW_FUNCTION ) { diff --git a/reportdesign/source/ui/dlg/Navigator.src b/reportdesign/source/ui/dlg/Navigator.src index c2547457764c..dc13f2b395a2 100644 --- a/reportdesign/source/ui/dlg/Navigator.src +++ b/reportdesign/source/ui/dlg/Navigator.src @@ -117,65 +117,4 @@ String RID_STR_GROUPS Text [ en-US ] = "Groups" ; }; -Menu RID_MENU_NAVIGATOR -{ - ItemList = - { - MenuItem - { - Identifier = SID_SORTINGANDGROUPING; - Command = ".uno:DbSortingAndGrouping"; - Text [ en-US ] = "Sorting and Grouping..."; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = SID_PAGEHEADERFOOTER; - Command = ".uno:PageHeaderFooter"; - Checkable = TRUE; - Text [ en-US ] = "Page Header/Footer..."; - }; - MenuItem - { - Identifier = SID_REPORTHEADERFOOTER; - Command = ".uno:ReportHeaderFooter"; - Checkable = TRUE; - Text [ en-US ] = "Report Header/Footer..."; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = SID_RPT_NEW_FUNCTION; - Command = ".uno:NewFunction"; - Text [ en-US ] = "New Function"; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = SID_SHOW_PROPERTYBROWSER; - Command = ".uno:FormProperties"; - Text [ en-US ] = "Properties..."; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = SID_DELETE ; - Command = ".uno:Delete" ; - Text [ en-US ] = "~Delete" ; - }; - }; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |