diff --git a/dbaccess/UIConfig_dbapp.mk b/dbaccess/UIConfig_dbapp.mk index 1dbab2a480a9..d93641d359eb 100644 --- a/dbaccess/UIConfig_dbapp.mk +++ b/dbaccess/UIConfig_dbapp.mk @@ -16,6 +16,7 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/dbapp,\ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/dbapp,\ dbaccess/uiconfig/dbapp/popupmenu/edit \ dbaccess/uiconfig/dbapp/popupmenu/new \ + dbaccess/uiconfig/dbapp/popupmenu/preview \ )) $(eval $(call gb_UIConfig_add_statusbarfiles,modules/dbapp,\ diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 91a2508e485e..2a65a8852832 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,7 @@ #include #include #include +#include #include #include #include "AppView.hxx" @@ -59,8 +61,10 @@ #include "dbaccess_slotid.hrc" #include "databaseobjectview.hxx" #include "imageprovider.hxx" +#include #include #include +#include #include #include #include "svtools/treelistentry.hxx" @@ -187,13 +191,14 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo ,m_aBorder(VclPtr::Create(this,WB_BORDER | WB_READONLY)) ,m_aPreview(VclPtr::Create(m_aBorder.get())) ,m_aDocumentInfo(VclPtr< ::svtools::ODocumentInfoPreview>::Create(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) ) - ,m_aMenu( VclPtr::Create( ModuleRes( RID_MENU_APP_PREVIEW ) ) ) ,m_ePreviewMode(_ePreviewMode) { m_aBorder->SetBorderStyle(WindowBorderStyle::MONO); 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->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) ); m_aTBPreview->Enable(); @@ -240,7 +245,6 @@ void OAppDetailPageHelper::dispose() rpBox.disposeAndClear(); } } - m_aMenu.disposeAndClear(); m_pTablePreview.disposeAndClear(); m_aDocumentInfo.disposeAndClear(); m_aPreview.disposeAndClear(); @@ -971,25 +975,28 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce) getBorderWin().getView()->getAppController().previewChanged(static_cast(m_ePreviewMode)); - sal_uInt16 nSelectedAction = SID_DB_APP_DISABLE_PREVIEW; + OUString aCommand; switch ( m_ePreviewMode ) { case E_PREVIEWNONE: - nSelectedAction = SID_DB_APP_DISABLE_PREVIEW; + aCommand = ".uno:DBDisablePreview"; break; case E_DOCUMENT: - nSelectedAction = SID_DB_APP_VIEW_DOC_PREVIEW; + aCommand = ".uno:DBShowDocPreview"; break; case E_DOCUMENTINFO: if ( getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) ) - nSelectedAction = SID_DB_APP_VIEW_DOCINFO_PREVIEW; + aCommand = ".uno:DBShowDocInfoPreview"; else + { m_ePreviewMode = E_PREVIEWNONE; + aCommand = ".uno:DBDisablePreview"; + } break; } - m_aMenu->CheckItem(nSelectedAction); - m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(m_aMenu->GetItemText(nSelectedAction))); + OUString aCommandLabel = vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument"); + m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel)); Resize(); // 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) m_aTBPreview->Update(); // execute the menu - ScopedVclPtrInstance aMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ); + css::uno::Reference xContext(getBorderWin().getView()->getORB()); + css::uno::Reference xPopupMenuFactory(css::frame::thePopupMenuControllerFactory::get(xContext)); + if (!xPopupMenuFactory.is()) + return; - const sal_uInt16 pActions[] = { SID_DB_APP_DISABLE_PREVIEW - , SID_DB_APP_VIEW_DOC_PREVIEW - , SID_DB_APP_VIEW_DOCINFO_PREVIEW - }; + css::uno::Sequence aArgs { + css::uno::makeAny(comphelper::makePropertyValue("InToolbar", true)), + 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) - { - aMenu->CheckItem(nAction,m_aMenu->IsItemChecked(nAction)); - } - aMenu->EnableItem( SID_DB_APP_VIEW_DOCINFO_PREVIEW, getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) ); + css::uno::Reference xPopupController( + xPopupMenuFactory->createInstanceWithArgumentsAndContext(".uno:DBPreview", aArgs, xContext), css::uno::UNO_QUERY); - // no disabled entries - aMenu->RemoveDisabledEntries(); + if (!xPopupController.is()) + return; + + rtl::Reference xPopupMenu(new VCLXPopupMenu); + xPopupController->setPopupMenu(xPopupMenu.get()); + VclPtr aMenu(static_cast(xPopupMenu->GetMenu())); sal_uInt16 nSelectedAction = aMenu->Execute(m_aTBPreview.get(), m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW )); // "cleanup" the toolbox state @@ -1176,8 +1187,11 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void) { m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aMenu->GetItemText(nSelectedAction))); Resize(); - getBorderWin().getView()->getAppController().executeChecked(nSelectedAction,Sequence()); } + + css::uno::Reference xComponent(xPopupController, css::uno::UNO_QUERY); + if (xComponent.is()) + xComponent->dispose(); } void OAppDetailPageHelper::KeyInput( const KeyEvent& rKEvt ) diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx index fb933c64e130..7aeda4283357 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx @@ -86,7 +86,6 @@ namespace dbaui VclPtr< ::svtools::ODocumentInfoPreview> m_aDocumentInfo; VclPtr m_pTablePreview; - ScopedVclPtr m_aMenu; PreviewMode m_ePreviewMode; css::uno::Reference < css::frame::XFrame2 > m_xFrame; diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src index 927a86add29c..7169c4782524 100644 --- a/dbaccess/source/ui/app/app.src +++ b/dbaccess/source/ui/app/app.src @@ -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?" ; }; -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 { Text [ en-US ] = "Form"; diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index 5851cec7ea77..a9d1f5853364 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -129,7 +129,6 @@ #define RID_QUERYFUNCTION_POPUPMENU RID_MENU_START + 6 #define RID_TABLEDESIGNROWPOPUPMENU RID_MENU_START + 7 #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 RID_MENU_JOINVIEW_CONNECTION RID_MENU_START + 16 #define RID_MENU_JOINVIEW_TABLE RID_MENU_START + 17 diff --git a/dbaccess/uiconfig/dbapp/menubar/menubar.xml b/dbaccess/uiconfig/dbapp/menubar/menubar.xml index ecffe81468d0..66cb6cbd2f71 100644 --- a/dbaccess/uiconfig/dbapp/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbapp/menubar/menubar.xml @@ -88,13 +88,7 @@ - - - - - - - + diff --git a/dbaccess/uiconfig/dbapp/popupmenu/preview.xml b/dbaccess/uiconfig/dbapp/popupmenu/preview.xml new file mode 100644 index 000000000000..eb58afdb95f0 --- /dev/null +++ b/dbaccess/uiconfig/dbapp/popupmenu/preview.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index 2ec77eae80b1..e6448e98ff86 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -425,6 +425,20 @@ refreshdata + + + .uno:DBPreview + + + com.sun.star.sdb.OfficeDatabaseDocument + + + com.sun.star.comp.framework.ResourceMenuController + + + preview + +