Kaydet (Commit) 93ada372 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

Convert RID_MENU_APP_PREVIEW to xml

Change-Id: I8601c0d9c23c6b1fe191391a56602173fe600e20
üst ca1cb1b4
...@@ -16,6 +16,7 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/dbapp,\ ...@@ -16,6 +16,7 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/dbapp,\
$(eval $(call gb_UIConfig_add_popupmenufiles,modules/dbapp,\ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/dbapp,\
dbaccess/uiconfig/dbapp/popupmenu/edit \ dbaccess/uiconfig/dbapp/popupmenu/edit \
dbaccess/uiconfig/dbapp/popupmenu/new \ dbaccess/uiconfig/dbapp/popupmenu/new \
dbaccess/uiconfig/dbapp/popupmenu/preview \
)) ))
$(eval $(call gb_UIConfig_add_statusbarfiles,modules/dbapp,\ $(eval $(call gb_UIConfig_add_statusbarfiles,modules/dbapp,\
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XContainer.hpp> #include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/form/XLoadable.hpp> #include <com/sun/star/form/XLoadable.hpp>
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/Frame.hpp> #include <com/sun/star/frame/Frame.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp>
...@@ -48,6 +49,7 @@ ...@@ -48,6 +49,7 @@
#include <com/sun/star/ucb/XCommandProcessor.hpp> #include <com/sun/star/ucb/XCommandProcessor.hpp>
#include <com/sun/star/ucb/Command.hpp> #include <com/sun/star/ucb/Command.hpp>
#include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/util/XCloseable.hpp>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include "AppView.hxx" #include "AppView.hxx"
...@@ -59,8 +61,10 @@ ...@@ -59,8 +61,10 @@
#include "dbaccess_slotid.hrc" #include "dbaccess_slotid.hrc"
#include "databaseobjectview.hxx" #include "databaseobjectview.hxx"
#include "imageprovider.hxx" #include "imageprovider.hxx"
#include <vcl/commandinfoprovider.hxx>
#include <vcl/waitobj.hxx> #include <vcl/waitobj.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <toolkit/awt/vclxmenu.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include "svtools/treelistentry.hxx" #include "svtools/treelistentry.hxx"
...@@ -187,13 +191,14 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo ...@@ -187,13 +191,14 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
,m_aBorder(VclPtr<Window>::Create(this,WB_BORDER | WB_READONLY)) ,m_aBorder(VclPtr<Window>::Create(this,WB_BORDER | WB_READONLY))
,m_aPreview(VclPtr<OPreviewWindow>::Create(m_aBorder.get())) ,m_aPreview(VclPtr<OPreviewWindow>::Create(m_aBorder.get()))
,m_aDocumentInfo(VclPtr< ::svtools::ODocumentInfoPreview>::Create(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) ) ,m_aDocumentInfo(VclPtr< ::svtools::ODocumentInfoPreview>::Create(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) )
,m_aMenu( VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_PREVIEW ) ) )
,m_ePreviewMode(_ePreviewMode) ,m_ePreviewMode(_ePreviewMode)
{ {
m_aBorder->SetBorderStyle(WindowBorderStyle::MONO); m_aBorder->SetBorderStyle(WindowBorderStyle::MONO);
m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT); m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK); m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,
vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB); m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) ); m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
m_aTBPreview->Enable(); m_aTBPreview->Enable();
...@@ -240,7 +245,6 @@ void OAppDetailPageHelper::dispose() ...@@ -240,7 +245,6 @@ void OAppDetailPageHelper::dispose()
rpBox.disposeAndClear(); rpBox.disposeAndClear();
} }
} }
m_aMenu.disposeAndClear();
m_pTablePreview.disposeAndClear(); m_pTablePreview.disposeAndClear();
m_aDocumentInfo.disposeAndClear(); m_aDocumentInfo.disposeAndClear();
m_aPreview.disposeAndClear(); m_aPreview.disposeAndClear();
...@@ -971,25 +975,28 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce) ...@@ -971,25 +975,28 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
getBorderWin().getView()->getAppController().previewChanged(static_cast<sal_Int32>(m_ePreviewMode)); getBorderWin().getView()->getAppController().previewChanged(static_cast<sal_Int32>(m_ePreviewMode));
sal_uInt16 nSelectedAction = SID_DB_APP_DISABLE_PREVIEW; OUString aCommand;
switch ( m_ePreviewMode ) switch ( m_ePreviewMode )
{ {
case E_PREVIEWNONE: case E_PREVIEWNONE:
nSelectedAction = SID_DB_APP_DISABLE_PREVIEW; aCommand = ".uno:DBDisablePreview";
break; break;
case E_DOCUMENT: case E_DOCUMENT:
nSelectedAction = SID_DB_APP_VIEW_DOC_PREVIEW; aCommand = ".uno:DBShowDocPreview";
break; break;
case E_DOCUMENTINFO: case E_DOCUMENTINFO:
if ( getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) ) if ( getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) )
nSelectedAction = SID_DB_APP_VIEW_DOCINFO_PREVIEW; aCommand = ".uno:DBShowDocInfoPreview";
else else
{
m_ePreviewMode = E_PREVIEWNONE; m_ePreviewMode = E_PREVIEWNONE;
aCommand = ".uno:DBDisablePreview";
}
break; break;
} }
m_aMenu->CheckItem(nSelectedAction); OUString aCommandLabel = vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(m_aMenu->GetItemText(nSelectedAction))); m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
Resize(); Resize();
// simulate a selectionChanged event at the controller, to force the preview to be updated // simulate a selectionChanged event at the controller, to force the preview to be updated
...@@ -1151,21 +1158,25 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void) ...@@ -1151,21 +1158,25 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
m_aTBPreview->Update(); m_aTBPreview->Update();
// execute the menu // execute the menu
ScopedVclPtrInstance<PopupMenu> aMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ); css::uno::Reference<css::uno::XComponentContext> xContext(getBorderWin().getView()->getORB());
css::uno::Reference<css::frame::XUIControllerFactory> xPopupMenuFactory(css::frame::thePopupMenuControllerFactory::get(xContext));
if (!xPopupMenuFactory.is())
return;
const sal_uInt16 pActions[] = { SID_DB_APP_DISABLE_PREVIEW css::uno::Sequence<css::uno::Any> aArgs {
, SID_DB_APP_VIEW_DOC_PREVIEW css::uno::makeAny(comphelper::makePropertyValue("InToolbar", true)),
, SID_DB_APP_VIEW_DOCINFO_PREVIEW css::uno::makeAny(comphelper::makePropertyValue("ModuleIdentifier", OUString("com.sun.star.sdb.OfficeDatabaseDocument"))),
}; css::uno::makeAny(comphelper::makePropertyValue("Frame", getBorderWin().getView()->getAppController().getFrame())) };
for(unsigned short nAction : pActions) css::uno::Reference<css::frame::XPopupMenuController> xPopupController(
{ xPopupMenuFactory->createInstanceWithArgumentsAndContext(".uno:DBPreview", aArgs, xContext), css::uno::UNO_QUERY);
aMenu->CheckItem(nAction,m_aMenu->IsItemChecked(nAction));
} if (!xPopupController.is())
aMenu->EnableItem( SID_DB_APP_VIEW_DOCINFO_PREVIEW, getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) ); return;
// no disabled entries rtl::Reference<VCLXPopupMenu> xPopupMenu(new VCLXPopupMenu);
aMenu->RemoveDisabledEntries(); xPopupController->setPopupMenu(xPopupMenu.get());
VclPtr<PopupMenu> aMenu(static_cast<PopupMenu*>(xPopupMenu->GetMenu()));
sal_uInt16 nSelectedAction = aMenu->Execute(m_aTBPreview.get(), m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW )); sal_uInt16 nSelectedAction = aMenu->Execute(m_aTBPreview.get(), m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW ));
// "cleanup" the toolbox state // "cleanup" the toolbox state
...@@ -1176,8 +1187,11 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void) ...@@ -1176,8 +1187,11 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
{ {
m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aMenu->GetItemText(nSelectedAction))); m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aMenu->GetItemText(nSelectedAction)));
Resize(); Resize();
getBorderWin().getView()->getAppController().executeChecked(nSelectedAction,Sequence<PropertyValue>());
} }
css::uno::Reference<css::lang::XComponent> xComponent(xPopupController, css::uno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
} }
void OAppDetailPageHelper::KeyInput( const KeyEvent& rKEvt ) void OAppDetailPageHelper::KeyInput( const KeyEvent& rKEvt )
......
...@@ -86,7 +86,6 @@ namespace dbaui ...@@ -86,7 +86,6 @@ namespace dbaui
VclPtr< ::svtools::ODocumentInfoPreview> VclPtr< ::svtools::ODocumentInfoPreview>
m_aDocumentInfo; m_aDocumentInfo;
VclPtr<vcl::Window> m_pTablePreview; VclPtr<vcl::Window> m_pTablePreview;
ScopedVclPtr<PopupMenu> m_aMenu;
PreviewMode m_ePreviewMode; PreviewMode m_ePreviewMode;
css::uno::Reference < css::frame::XFrame2 > css::uno::Reference < css::frame::XFrame2 >
m_xFrame; m_xFrame;
......
...@@ -173,40 +173,6 @@ String STR_QUERY_CLOSEDOCUMENTS ...@@ -173,40 +173,6 @@ String STR_QUERY_CLOSEDOCUMENTS
Text [ en-US ] = "The connection type has been altered.\nFor the changes to take effect, all forms, reports, queries and tables must be closed.\n\nDo you want to close all documents now?" ; Text [ en-US ] = "The connection type has been altered.\nFor the changes to take effect, all forms, reports, queries and tables must be closed.\n\nDo you want to close all documents now?" ;
}; };
Menu RID_MENU_APP_PREVIEW
{
ItemList =
{
MenuItem
{
Identifier = SID_DB_APP_DISABLE_PREVIEW;
Text[ en-US ] = "None";
Command = ".uno:DBDisablePreview";
Checkable = TRUE;
RadioCheck = TRUE;
AutoCheck = TRUE;
};
MenuItem
{
Identifier = SID_DB_APP_VIEW_DOCINFO_PREVIEW;
Text[ en-US ] = "Document Information";
Command = ".uno:DBShowDocInfoPreview";
Checkable = TRUE;
RadioCheck = TRUE;
AutoCheck = TRUE;
};
MenuItem
{
Identifier = SID_DB_APP_VIEW_DOC_PREVIEW;
Text[ en-US ] = "Document";
Command = ".uno:DBShowDocPreview";
Checkable = TRUE;
RadioCheck = TRUE;
AutoCheck = TRUE;
};
};
};
String RID_STR_FORM String RID_STR_FORM
{ {
Text [ en-US ] = "Form"; Text [ en-US ] = "Form";
......
...@@ -129,7 +129,6 @@ ...@@ -129,7 +129,6 @@
#define RID_QUERYFUNCTION_POPUPMENU RID_MENU_START + 6 #define RID_QUERYFUNCTION_POPUPMENU RID_MENU_START + 6
#define RID_TABLEDESIGNROWPOPUPMENU RID_MENU_START + 7 #define RID_TABLEDESIGNROWPOPUPMENU RID_MENU_START + 7
#define RID_SBA_RTF_PKEYPOPUP RID_MENU_START + 9 #define RID_SBA_RTF_PKEYPOPUP RID_MENU_START + 9
#define RID_MENU_APP_PREVIEW RID_MENU_START + 12
#define MENU_BROWSER_DEFAULTCONTEXT RID_MENU_START + 14 #define MENU_BROWSER_DEFAULTCONTEXT RID_MENU_START + 14
#define RID_MENU_JOINVIEW_CONNECTION RID_MENU_START + 16 #define RID_MENU_JOINVIEW_CONNECTION RID_MENU_START + 16
#define RID_MENU_JOINVIEW_TABLE RID_MENU_START + 17 #define RID_MENU_JOINVIEW_TABLE RID_MENU_START + 17
......
...@@ -88,13 +88,7 @@ ...@@ -88,13 +88,7 @@
<menu:menuseparator/> <menu:menuseparator/>
<menu:menuitem menu:id=".uno:AvailableToolbars"/> <menu:menuitem menu:id=".uno:AvailableToolbars"/>
<menu:menuitem menu:id=".uno:StatusBarVisible"/> <menu:menuitem menu:id=".uno:StatusBarVisible"/>
<menu:menu menu:id=".uno:DBPreview"> <menu:menuitem menu:id=".uno:DBPreview"/>
<menu:menupopup>
<menu:menuitem menu:id=".uno:DBDisablePreview" menu:style="radio"/>
<menu:menuitem menu:id=".uno:DBShowDocInfoPreview" menu:style="radio"/>
<menu:menuitem menu:id=".uno:DBShowDocPreview" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuseparator/> <menu:menuseparator/>
<menu:menu menu:id=".uno:DBSort"> <menu:menu menu:id=".uno:DBSort">
<menu:menupopup> <menu:menupopup>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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/.
*
-->
<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
<menu:menuitem menu:id=".uno:DBDisablePreview" menu:style="radio"/>
<menu:menuitem menu:id=".uno:DBShowDocInfoPreview" menu:style="radio"/>
<menu:menuitem menu:id=".uno:DBShowDocPreview" menu:style="radio"/>
</menu:menupopup>
...@@ -425,6 +425,20 @@ ...@@ -425,6 +425,20 @@
<value>refreshdata</value> <value>refreshdata</value>
</prop> </prop>
</node> </node>
<node oor:name="c35" oor:op="replace">
<prop oor:name="Command">
<value>.uno:DBPreview</value>
</prop>
<prop oor:name="Module">
<value>com.sun.star.sdb.OfficeDatabaseDocument</value>
</prop>
<prop oor:name="Controller">
<value>com.sun.star.comp.framework.ResourceMenuController</value>
</prop>
<prop oor:name="Value">
<value>preview</value>
</prop>
</node>
</node> </node>
<node oor:name="ToolBar"> <node oor:name="ToolBar">
<node oor:name="ZoomToolBox" oor:op="replace"> <node oor:name="ZoomToolBox" oor:op="replace">
......
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