dbaccess/source/ui/app/AppController.cxx | 24 +++++++++--------- dbaccess/source/ui/app/AppControllerGen.cxx | 8 +++--- dbaccess/source/ui/app/subcomponentmanager.cxx | 2 - dbaccess/source/ui/inc/AppElementType.hxx | 8 +++--- dbaccess/source/ui/misc/linkeddocuments.cxx | 6 ++-- reportdesign/source/ui/dlg/Navigator.cxx | 33 ++++--------------------- reportdesign/source/ui/inc/Navigator.hxx | 8 ++++-- 7 files changed, 36 insertions(+), 53 deletions(-)
New commits: commit 87d03edf08cda2f9f6a9d4ef9e5b7fe71964c71f Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Sep 6 22:04:22 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Sep 7 11:42:04 2022 +0200 convert ElementOpenMode to scoped enum Change-Id: Ib1b714c377ce0d4935ba5ead68163d69fa091cfd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139545 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 52106a2fd099..2e30cf1fce38 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1211,7 +1211,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource, aCreationArgs ); - onDocumentOpened( OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, nullptr ); + onDocumentOpened( OUString(), E_QUERY, ElementOpenMode::Design, xComponent, nullptr ); } } break; @@ -1235,17 +1235,17 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa case SID_DB_APP_QUERY_EDIT: case SID_DB_APP_FORM_EDIT: case SID_DB_APP_REPORT_EDIT: - doAction( _nId, E_OPEN_DESIGN ); + doAction( _nId, ElementOpenMode::Design ); break; case SID_DB_APP_OPEN: case SID_DB_APP_TABLE_OPEN: case SID_DB_APP_QUERY_OPEN: case SID_DB_APP_FORM_OPEN: case SID_DB_APP_REPORT_OPEN: - doAction( _nId, E_OPEN_NORMAL ); + doAction( _nId, ElementOpenMode::Normal ); break; case SID_DB_APP_CONVERTTOVIEW: - doAction( _nId, E_OPEN_NORMAL ); + doAction( _nId, ElementOpenMode::Normal ); break; case SID_SELECTALL: getContainer()->selectAll(); @@ -1254,7 +1254,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa case SID_DB_APP_DSRELDESIGN: { Reference< XComponent > xRelationDesigner; - if ( !m_pSubComponentManager->activateSubFrame( OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xRelationDesigner ) ) + if ( !m_pSubComponentManager->activateSubFrame( OUString(), SID_DB_APP_DSRELDESIGN, ElementOpenMode::Design, xRelationDesigner ) ) { SharedConnection xConnection( ensureConnection() ); if ( xConnection.is() ) @@ -1263,7 +1263,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource ); - onDocumentOpened( OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, nullptr ); + onDocumentOpened( OUString(), SID_DB_APP_DSRELDESIGN, ElementOpenMode::Design, xComponent, nullptr ); } } } @@ -1336,7 +1336,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa } break; case SID_DB_APP_SENDREPORTASMAIL: - doAction( _nId, E_OPEN_FOR_MAIL ); + doAction( _nId, ElementOpenMode::Mail ); break; } } @@ -1701,7 +1701,7 @@ bool OApplicationController::onEntryDoubleClick(const weld::TreeView& rTreeView) openElementWithArguments( getContainer()->getQualifiedName(xHdlEntry.get()), getContainer()->getElementType(), - E_OPEN_NORMAL, + ElementOpenMode::Normal, 0, ::comphelper::NamedValueCollection() ); return true; // handled @@ -1747,7 +1747,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const return nullptr; Reference< XComponent > xRet; - if ( _eOpenMode == E_OPEN_DESIGN ) + if ( _eOpenMode == ElementOpenMode::Design ) { // https://bz.apache.org/ooo/show_bug.cgi?id=30382 getContainer()->showPreview(nullptr); @@ -1757,7 +1757,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const switch ( _eType ) { case E_REPORT: - if ( _eOpenMode != E_OPEN_DESIGN ) + if ( _eOpenMode != ElementOpenMode::Design ) { // reports which are opened in a mode other than design are no sub components of our application // component, but standalone documents. @@ -1794,7 +1794,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const ::comphelper::NamedValueCollection aArguments( _rAdditionalArguments ); Any aDataSource; - if ( _eOpenMode == E_OPEN_DESIGN ) + if ( _eOpenMode == ElementOpenMode::Design ) { bool bAddViewTypeArg = false; @@ -1954,7 +1954,7 @@ Reference< XComponent > OApplicationController::newElement( ElementType _eType, } if ( xComponent.is() ) - onDocumentOpened( OUString(), _eType, E_OPEN_DESIGN, xComponent, o_rDocumentDefinition ); + onDocumentOpened( OUString(), _eType, ElementOpenMode::Design, xComponent, o_rDocumentDefinition ); return xComponent; } diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index e9ba046d1655..b14b9c891540 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -433,7 +433,7 @@ Reference< XComponent > SAL_CALL OApplicationController::loadComponentWithArgume Reference< XComponent > xComponent( openElementWithArguments( ObjectName, lcl_objectType2ElementType( ObjectType ), - ForEditing ? E_OPEN_DESIGN : E_OPEN_NORMAL, + ForEditing ? ElementOpenMode::Design : ElementOpenMode::Normal, ForEditing ? SID_DB_APP_EDIT : SID_DB_APP_OPEN, ::comphelper::NamedValueCollection( Arguments ) ) ); @@ -667,10 +667,10 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO ElementType eType = getContainer()->getElementType(); ::comphelper::NamedValueCollection aArguments; ElementOpenMode eOpenMode = _eOpenMode; - if ( eType == E_REPORT && E_OPEN_FOR_MAIL == _eOpenMode ) + if ( eType == E_REPORT && ElementOpenMode::Mail == _eOpenMode ) { aArguments.put("Hidden",true); - eOpenMode = E_OPEN_NORMAL; + eOpenMode = ElementOpenMode::Normal; } std::vector< std::pair< OUString ,Reference< XModel > > > aComponents; @@ -686,7 +686,7 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO } // special handling for mail, if more than one document is selected attach them all - if ( _eOpenMode != E_OPEN_FOR_MAIL ) + if ( _eOpenMode != ElementOpenMode::Mail ) return; diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index d8de89b56773..712996e093be 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -90,7 +90,7 @@ namespace dbaui SubComponentDescriptor() :nComponentType( -1 ) - ,eOpenMode( E_OPEN_NORMAL ) + ,eOpenMode( ElementOpenMode::Normal ) { } diff --git a/dbaccess/source/ui/inc/AppElementType.hxx b/dbaccess/source/ui/inc/AppElementType.hxx index 59105cf225f7..a8e106933e3a 100644 --- a/dbaccess/source/ui/inc/AppElementType.hxx +++ b/dbaccess/source/ui/inc/AppElementType.hxx @@ -41,11 +41,11 @@ namespace dbaui E_DOCUMENTINFO = 2 }; - enum ElementOpenMode + enum class ElementOpenMode { - E_OPEN_NORMAL, - E_OPEN_DESIGN, - E_OPEN_FOR_MAIL + Normal, + Design, + Mail }; } // namespace dbaui diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index fc20da667019..a08f90cc3425 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -118,15 +118,15 @@ namespace dbaui OUString sOpenMode; switch ( _eOpenMode ) { - case E_OPEN_NORMAL: + case ElementOpenMode::Normal: sOpenMode = "open"; break; - case E_OPEN_FOR_MAIL: + case ElementOpenMode::Mail: aArguments.put( "Hidden", true ); [[fallthrough]]; - case E_OPEN_DESIGN: + case ElementOpenMode::Design: sOpenMode = "openDesign"; break; commit 8fe31ee550bd6f127b4c1ea335ef8177ccafa747 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Sep 6 18:50:33 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Sep 7 11:41:51 2022 +0200 ONavigator doesn't need a pimpl it is module private Change-Id: I21779fe8ac50aa4602e4c3d7798d0ced1ddab066 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139541 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index 586494bbe2b9..2c4512470733 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -24,7 +24,6 @@ #include <ReportController.hxx> #include <UITools.hxx> #include <reportformula.hxx> -#include <com/sun/star/report/XReportDefinition.hpp> #include <com/sun/star/report/XFixedText.hpp> #include <com/sun/star/report/XFixedLine.hpp> #include <com/sun/star/report/XFormattedField.hpp> @@ -98,8 +97,6 @@ static OUString lcl_getName(const uno::Reference< beans::XPropertySet>& _xElemen return sName.makeStringAndClear(); } -namespace { - class NavigatorTree : public ::cppu::BaseMutex , public reportdesign::ITraverseReport , public comphelper::OSelectionChangeListener @@ -207,8 +204,6 @@ public: } }; -} - NavigatorTree::NavigatorTree(std::unique_ptr<weld::TreeView> xTreeView, OReportController& rController) : OPropertyChangeListener(m_aMutex) , m_xTreeView(std::move(xTreeView)) @@ -789,20 +784,10 @@ void NavigatorTree::UserData::_disposing(const lang::EventObject& _rSource) m_pTree->_disposing( _rSource ); } -class ONavigatorImpl -{ -public: - ONavigatorImpl(OReportController& rController, weld::Builder& rBuilder); - ONavigatorImpl(const ONavigatorImpl&) = delete; - ONavigatorImpl& operator=(const ONavigatorImpl&) = delete; - - uno::Reference< report::XReportDefinition> m_xReport; - std::unique_ptr<NavigatorTree> m_xNavigatorTree; -}; - -ONavigatorImpl::ONavigatorImpl(OReportController& rController, weld::Builder& rBuilder) - : m_xReport(rController.getReportDefinition()) - , m_xNavigatorTree(std::make_unique<NavigatorTree>(rBuilder.weld_tree_view("treeview"), rController)) +ONavigator::ONavigator(weld::Window* pParent, OReportController& rController) + : GenericDialogController(pParent, "modules/dbreport/ui/floatingnavigator.ui", "FloatingNavigator") + , m_xReport(rController.getReportDefinition()) + , m_xNavigatorTree(std::make_unique<NavigatorTree>(m_xBuilder->weld_tree_view("treeview"), rController)) { reportdesign::OReportVisitor aVisitor(m_xNavigatorTree.get()); aVisitor.start(m_xReport); @@ -811,13 +796,7 @@ ONavigatorImpl::ONavigatorImpl(OReportController& rController, weld::Builder& rB m_xNavigatorTree->expand_row(*xScratch); lang::EventObject aEvent(rController); m_xNavigatorTree->_selectionChanged(aEvent); -} - -ONavigator::ONavigator(weld::Window* pParent, OReportController& rController) - : GenericDialogController(pParent, "modules/dbreport/ui/floatingnavigator.ui", "FloatingNavigator") -{ - m_pImpl.reset(new ONavigatorImpl(rController, *m_xBuilder)); - m_pImpl->m_xNavigatorTree->grab_focus(); + m_xNavigatorTree->grab_focus(); m_xDialog->connect_container_focus_changed(LINK(this, ONavigator, FocusChangeHdl)); } @@ -829,7 +808,7 @@ ONavigator::~ONavigator() IMPL_LINK_NOARG(ONavigator, FocusChangeHdl, weld::Container&, void) { if (m_xDialog->has_toplevel_focus()) - m_pImpl->m_xNavigatorTree->grab_focus(); + m_xNavigatorTree->grab_focus(); } } // rptui diff --git a/reportdesign/source/ui/inc/Navigator.hxx b/reportdesign/source/ui/inc/Navigator.hxx index eed3e529c00d..f201472147f5 100644 --- a/reportdesign/source/ui/inc/Navigator.hxx +++ b/reportdesign/source/ui/inc/Navigator.hxx @@ -19,15 +19,19 @@ #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_NAVIGATOR_HXX #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_NAVIGATOR_HXX +#include <com/sun/star/report/XReportDefinition.hpp> #include <vcl/weld.hxx> #include <memory> + namespace rptui { + class NavigatorTree; class OReportController; - class ONavigatorImpl; class ONavigator : public weld::GenericDialogController { - ::std::unique_ptr<ONavigatorImpl> m_pImpl; + css::uno::Reference< css::report::XReportDefinition> m_xReport; + std::unique_ptr<NavigatorTree> m_xNavigatorTree; + ONavigator(const ONavigator&) = delete; void operator =(const ONavigator&) = delete;