diff options
Diffstat (limited to 'dbaccess/source/ui/app/AppControllerGen.cxx')
-rw-r--r-- | dbaccess/source/ui/app/AppControllerGen.cxx | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 28b4c4053da3..0f6eda11de7b 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -50,9 +50,8 @@ #include <sfx2/mailmodelapi.hxx> #include <svx/dbaexchange.hxx> #include <toolkit/helper/vclunohelper.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <osl/diagnose.h> -#include <vcl/menu.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> @@ -111,7 +110,7 @@ void OApplicationController::convertToView(const OUString& _sName) Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject); if ( !xView.is() ) throw SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE),*this, "S1000",0,Any()); - getContainer()->elementAdded(E_TABLE,sNewName,makeAny(xView)); + getContainer()->elementAdded(E_TABLE,sNewName,Any(xView)); } } catch(const SQLException& ) @@ -156,6 +155,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) weld::WaitObject aWO(getFrameWeld()); Sequence< Any > aArgs(3); + auto pArgs = aArgs.getArray(); sal_Int32 nArgPos = 0; Reference< css::awt::XWindow> xWindow = getTopMostContainerWindow(); @@ -166,9 +166,9 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) xWindow = VCLUnoHelper::GetInterface(getView()->Window::GetParent()); } // the parent window - aArgs[nArgPos++] <<= PropertyValue( "ParentWindow", + pArgs[nArgPos++] <<= PropertyValue( "ParentWindow", 0, - makeAny(xWindow), + Any(xWindow), PropertyState_DIRECT_VALUE); // the initial selection @@ -177,15 +177,15 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) sInitialSelection = getDatabaseName(); if ( !sInitialSelection.isEmpty() ) { - aArgs[ nArgPos++ ] <<= PropertyValue( + pArgs[ nArgPos++ ] <<= PropertyValue( "InitialSelection", 0, - makeAny( sInitialSelection ), PropertyState_DIRECT_VALUE ); + Any( sInitialSelection ), PropertyState_DIRECT_VALUE ); } SharedConnection xConnection( getConnection() ); if ( xConnection.is() ) { - aArgs[ nArgPos++ ] <<= PropertyValue( + pArgs[ nArgPos++ ] <<= PropertyValue( PROPERTY_ACTIVE_CONNECTION, 0, makeAny( xConnection ), PropertyState_DIRECT_VALUE ); } @@ -321,7 +321,8 @@ void SAL_CALL OApplicationController::connect( ) // no particular error, but nonetheless could not connect -> throw a generic exception OUString sConnectingContext( DBA_RES( STR_COULDNOTCONNECT_DATASOURCE ) ); - ::dbtools::throwGenericSQLException( sConnectingContext.replaceFirst( "$name$", getStrippedDatabaseName() ), *this ); + OUString sDatabaseName; + ::dbtools::throwGenericSQLException( sConnectingContext.replaceFirst( "$name$", ::dbaui::getStrippedDatabaseName(m_xDataSource, sDatabaseName) ), *this ); } } @@ -433,7 +434,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 ) ) ); @@ -487,7 +488,7 @@ void OApplicationController::previewChanged( sal_Int32 _nMode ) if ( nOldMode != _nMode ) { aLayoutInfo.put( "Preview", _nMode ); - m_xDataSource->setPropertyValue( PROPERTY_LAYOUTINFORMATION, makeAny( aLayoutInfo.getPropertyValues() ) ); + m_xDataSource->setPropertyValue( PROPERTY_LAYOUTINFORMATION, Any( aLayoutInfo.getPropertyValues() ) ); } } catch ( const Exception& ) @@ -550,12 +551,6 @@ OUString OApplicationController::getDatabaseName() const return sDatabaseName; } -OUString OApplicationController::getStrippedDatabaseName() const -{ - OUString sDatabaseName; - return ::dbaui::getStrippedDatabaseName( m_xDataSource, sDatabaseName ); -} - void OApplicationController::onDocumentOpened( const OUString& _rName, const sal_Int32 _nType, const ElementOpenMode _eMode, const Reference< XComponent >& _xDocument, const Reference< XComponent >& _rxDefinition ) { @@ -580,10 +575,10 @@ void OApplicationController::onDocumentOpened( const OUString& _rName, const sal } } -bool OApplicationController::insertHierachyElement(ElementType _eType, const OUString& _sParentFolder, bool _bCollection, const Reference<XContent>& _xContent, bool _bMove) +bool OApplicationController::insertHierarchyElement(ElementType _eType, const OUString& _sParentFolder, bool _bCollection, const Reference<XContent>& _xContent, bool _bMove) { Reference<XHierarchicalNameContainer> xNames(getElements(_eType), UNO_QUERY); - return dbaui::insertHierachyElement(getFrameWeld() + return dbaui::insertHierarchyElement(getFrameWeld() ,getORB() ,xNames ,_sParentFolder @@ -639,7 +634,7 @@ void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutMa if ( !_xLayoutManager.is() ) return; - static constexpr OUStringLiteral s_sStatusbar = u"private:resource/statusbar/statusbar"; + static constexpr OUString s_sStatusbar = u"private:resource/statusbar/statusbar"_ustr; _xLayoutManager->createElement( s_sStatusbar ); _xLayoutManager->requestElement( s_sStatusbar ); @@ -648,14 +643,8 @@ void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutMa // we need to share the "mnemonic space": MnemonicGenerator aMnemonicGenerator; // - the menu already has mnemonics - SystemWindow* pSystemWindow = getContainer()->GetSystemWindow(); - MenuBar* pMenu = pSystemWindow ? pSystemWindow->GetMenuBar() : nullptr; - if ( pMenu ) - { - sal_uInt16 nMenuItems = pMenu->GetItemCount(); - for ( sal_uInt16 i = 0; i < nMenuItems; ++i ) - aMnemonicGenerator.RegisterMnemonic( pMenu->GetItemText( pMenu->GetItemId( i ) ) ); - } + if (SystemWindow* pSystemWindow = getContainer()->GetSystemWindow()) + pSystemWindow->CollectMenuBarMnemonics(aMnemonicGenerator); // - the icons should use automatic ones getContainer()->createIconAutoMnemonics( aMnemonicGenerator ); // - as well as the entries in the task pane @@ -673,10 +662,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; @@ -692,7 +681,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; |