Kaydet (Commit) b44b9753 authored tarafından Caolán McNamara's avatar Caolán McNamara

convert navigator menu to .ui

Change-Id: I754da935de04dde6d94fa2a1331c771a4bd5ec88
üst 0191f643
......@@ -48,6 +48,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/dbreport,\
reportdesign/uiconfig/dbreport/ui/floatingnavigator \
reportdesign/uiconfig/dbreport/ui/floatingsort \
reportdesign/uiconfig/dbreport/ui/groupsortmenu \
reportdesign/uiconfig/dbreport/ui/navigatormenu \
reportdesign/uiconfig/dbreport/ui/pagedialog \
reportdesign/uiconfig/dbreport/ui/pagenumberdialog \
))
......
......@@ -191,8 +191,6 @@
#define RID_STR_VERTICALALIGN (RID_STRING_START + 160)
#define RID_STR_PARAADJUST (RID_STRING_START + 161)
// menu -----------------------------------------------------------------------
#define RID_MENU_NAVIGATOR ( RID_MENU_START + 1 )
// bitmaps
#define RID_SVXBMP_SELECT_REPORT (RID_BITMAP_START + 0 )
#define RID_SVXBMP_FM_FIXEDTEXT (RID_BITMAP_START + 1 )
......
......@@ -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 )
{
......
......@@ -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: */
<?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="sorting">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Sorting and Grouping...</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="menuitem5">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Page Header/Footer...</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="report">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Report Header/Footer...</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="function">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">New Function</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="properties">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Properties...</property>
<property name="use_underline">True</property>
</object>
</child>
<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>
</object>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment