sfx2/source/appl/appbaslib.cxx | 22 sfx2/source/appl/childwin.cxx | 136 +- sfx2/source/appl/fileobj.cxx | 94 - sfx2/source/appl/fwkhelper.cxx | 28 sfx2/source/appl/helpinterceptor.cxx | 52 - sfx2/source/appl/imestatuswindow.cxx | 28 sfx2/source/appl/linkmgr2.cxx | 24 sfx2/source/appl/lnkbase2.cxx | 30 sfx2/source/appl/macroloader.cxx | 24 sfx2/source/appl/newhelp.cxx | 300 ++--- sfx2/source/appl/opengrf.cxx | 36 sfx2/source/appl/sfxpicklist.cxx | 100 - sfx2/source/appl/shutdownicon.cxx | 112 +- sfx2/source/appl/workwin.cxx | 320 +++--- sfx2/source/bastyp/fltfnc.cxx | 316 +++--- sfx2/source/bastyp/frmhtmlw.cxx | 158 +-- sfx2/source/bastyp/progress.cxx | 88 - sfx2/source/bastyp/sfxhtml.cxx | 62 - sfx2/source/config/evntconf.cxx | 38 sfx2/source/control/bindings.cxx | 266 ++--- sfx2/source/control/dispatch.cxx | 214 ++-- sfx2/source/control/recentdocsviewitem.cxx | 26 sfx2/source/control/request.cxx | 82 - sfx2/source/control/shell.cxx | 34 sfx2/source/control/statcach.cxx | 92 - sfx2/source/control/templatelocalview.cxx | 158 +-- sfx2/source/control/thumbnailview.cxx | 74 - sfx2/source/control/thumbnailviewacc.cxx | 80 - sfx2/source/control/unoctitm.cxx | 532 +++++----- sfx2/source/dialog/backingcomp.cxx | 70 - sfx2/source/dialog/backingwindow.cxx | 50 sfx2/source/dialog/basedlgs.cxx | 94 - sfx2/source/dialog/dinfdlg.cxx | 58 - sfx2/source/dialog/dockwin.cxx | 80 - sfx2/source/dialog/filedlghelper.cxx | 176 +-- sfx2/source/dialog/securitypage.cxx | 76 - sfx2/source/dialog/tabdlg.cxx | 268 ++--- sfx2/source/dialog/templdlg.cxx | 575 +++++------ sfx2/source/doc/DocumentMetadataAccess.cxx | 27 sfx2/source/doc/Metadatable.cxx | 22 sfx2/source/doc/SfxDocumentMetaData.cxx | 62 - sfx2/source/doc/docfac.cxx | 164 +-- sfx2/source/doc/docfile.cxx | 1108 +++++++++++----------- sfx2/source/doc/doctempl.cxx | 76 - sfx2/source/doc/doctemplates.cxx | 140 +- sfx2/source/doc/new.cxx | 76 - sfx2/source/doc/objcont.cxx | 188 +-- sfx2/source/doc/objmisc.cxx | 388 +++---- sfx2/source/doc/objserv.cxx | 36 sfx2/source/doc/objstor.cxx | 125 +- sfx2/source/doc/objxtor.cxx | 40 sfx2/source/doc/printhelper.cxx | 48 sfx2/source/doc/sfxbasemodel.cxx | 894 ++++++++--------- sfx2/source/doc/templatedlg.cxx | 252 ++--- sfx2/source/inet/inettbc.cxx | 134 +- sfx2/source/notebookbar/NotebookbarTabControl.cxx | 44 sfx2/source/notebookbar/SfxNotebookBar.cxx | 124 +- sfx2/source/notify/eventsupplier.cxx | 226 ++-- sfx2/source/sidebar/ContextList.cxx | 24 sfx2/source/sidebar/Deck.cxx | 49 sfx2/source/sidebar/DeckTitleBar.cxx | 24 sfx2/source/sidebar/Panel.cxx | 22 sfx2/source/sidebar/PanelTitleBar.cxx | 84 - sfx2/source/sidebar/SidebarController.cxx | 179 +-- sfx2/source/statbar/stbitem.cxx | 114 +- sfx2/source/toolbox/tbxitem.cxx | 138 +- sfx2/source/uitest/sfx_uiobject.cxx | 38 sfx2/source/view/frame.cxx | 70 - sfx2/source/view/frmload.cxx | 24 sfx2/source/view/ipclient.cxx | 124 +- sfx2/source/view/lokcharthelper.cxx | 120 +- sfx2/source/view/sfxbasecontroller.cxx | 252 ++--- sfx2/source/view/viewfrm.cxx | 154 +-- sfx2/source/view/viewprn.cxx | 208 ++-- sfx2/source/view/viewsh.cxx | 80 - 75 files changed, 5425 insertions(+), 5426 deletions(-)
New commits: commit 536a6d6ca67d01c8470c242c6f1fd0750496eed4 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Feb 6 10:09:28 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Feb 7 08:19:14 2019 +0100 loplugin:flatten in sfx2 Change-Id: If4e07d497ead58a2ff58b5fdedd282b8784be421 Reviewed-on: https://gerrit.libreoffice.org/67435 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index af666bb7fc66..1e8654eeb530 100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -66,18 +66,18 @@ void SfxBasicManagerHolder::reset( BasicManager* _pBasicManager ) // @see basic::BasicManagerRepository::getDocumentBasicManager mpBasicManager = _pBasicManager; - if ( mpBasicManager ) + if ( !mpBasicManager ) + return; + + StartListening(*mpBasicManager); + try { - StartListening(*mpBasicManager); - try - { - mxBasicContainer.set( mpBasicManager->GetScriptLibraryContainer(), UNO_QUERY_THROW ); - mxDialogContainer.set( mpBasicManager->GetDialogLibraryContainer(), UNO_QUERY_THROW ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION("sfx.appl"); - } + mxBasicContainer.set( mpBasicManager->GetScriptLibraryContainer(), UNO_QUERY_THROW ); + mxDialogContainer.set( mpBasicManager->GetDialogLibraryContainer(), UNO_QUERY_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("sfx.appl"); } #endif } diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index ff4a1a1023bc..50d9371907d7 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -80,24 +80,24 @@ class DisposeListener : public ::cppu::WeakImplHelper< css::lang::XEventListener if( xComp.is() ) xComp->removeEventListener( this ); - if( m_pOwner && m_pData ) - { - m_pData->xListener.clear(); + if( !m_pOwner || !m_pData ) + return; - if ( m_pData->pWorkWin ) - { - // m_pOwner and m_pData will be killed - m_pData->xFrame.clear(); - m_pData->pWorkWin->GetBindings().Execute( m_pOwner->GetType() ); - } - else - { - delete m_pOwner; - } + m_pData->xListener.clear(); - m_pOwner = nullptr; - m_pData = nullptr; + if ( m_pData->pWorkWin ) + { + // m_pOwner and m_pData will be killed + m_pData->xFrame.clear(); + m_pData->pWorkWin->GetBindings().Execute( m_pOwner->GetType() ); } + else + { + delete m_pOwner; + } + + m_pOwner = nullptr; + m_pData = nullptr; } private: @@ -392,43 +392,43 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI OUString aWinData( aTmp ); rInfo.aWinState = OUStringToOString(xWinOpt->GetWindowState(), RTL_TEXTENCODING_UTF8); - if ( !aWinData.isEmpty() ) + if ( aWinData.isEmpty() ) + return; + + // Search for version ID + if ( aWinData[0] != 0x0056 ) // 'V' = 56h + // A version ID, so do not use + return; + + // Delete 'V' + aWinData = aWinData.copy(1); + + // Read version + char cToken = ','; + sal_Int32 nPos = aWinData.indexOf( cToken ); + sal_uInt16 nActVersion = static_cast<sal_uInt16>(aWinData.copy( 0, nPos + 1 ).toInt32()); + if ( nActVersion != nVersion ) + return; + + aWinData = aWinData.copy(nPos+1); + + // Load Visibility: is coded as a char + rInfo.bVisible = (aWinData[0] == 0x0056); // 'V' = 56h + aWinData = aWinData.copy(1); + nPos = aWinData.indexOf( cToken ); + if (nPos == -1) + return; + + sal_Int32 nNextPos = aWinData.indexOf( cToken, 2 ); + if ( nNextPos != -1 ) { - // Search for version ID - if ( aWinData[0] != 0x0056 ) // 'V' = 56h - // A version ID, so do not use - return; - - // Delete 'V' - aWinData = aWinData.copy(1); - - // Read version - char cToken = ','; - sal_Int32 nPos = aWinData.indexOf( cToken ); - sal_uInt16 nActVersion = static_cast<sal_uInt16>(aWinData.copy( 0, nPos + 1 ).toInt32()); - if ( nActVersion != nVersion ) - return; - - aWinData = aWinData.copy(nPos+1); - - // Load Visibility: is coded as a char - rInfo.bVisible = (aWinData[0] == 0x0056); // 'V' = 56h - aWinData = aWinData.copy(1); - nPos = aWinData.indexOf( cToken ); - if (nPos != -1) - { - sal_Int32 nNextPos = aWinData.indexOf( cToken, 2 ); - if ( nNextPos != -1 ) - { - // there is extra information - rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1, nNextPos - nPos - 1 ).toInt32())); - aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, "" ); - rInfo.aExtraString = aWinData; - } - else - rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1 ).toInt32())); - } + // there is extra information + rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1, nNextPos - nPos - 1 ).toInt32())); + aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, "" ); + rInfo.aExtraString = aWinData; } + else + rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1 ).toInt32())); } void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBindings ) @@ -700,24 +700,24 @@ const css::uno::Reference< css::frame::XFrame >& SfxChildWindow::GetFrame() void SfxChildWindow::SetFrame( const css::uno::Reference< css::frame::XFrame > & rFrame ) { // Do nothing if nothing will be changed ... - if( pImpl->xFrame != rFrame ) - { - // ... but stop listening on old frame, if connection exist! - if( pImpl->xFrame.is() ) - pImpl->xFrame->removeEventListener( pImpl->xListener ); - - // If new frame is not NULL -> we must guarantee valid listener for disposing events. - // Use already existing or create new one. - if( rFrame.is() ) - if( !pImpl->xListener.is() ) - pImpl->xListener.set( new DisposeListener( this, pImpl.get() ) ); - - // Set new frame in data container - // and build new listener connection, if necessary. - pImpl->xFrame = rFrame; - if( pImpl->xFrame.is() ) - pImpl->xFrame->addEventListener( pImpl->xListener ); - } + if( pImpl->xFrame == rFrame ) + return; + + // ... but stop listening on old frame, if connection exist! + if( pImpl->xFrame.is() ) + pImpl->xFrame->removeEventListener( pImpl->xListener ); + + // If new frame is not NULL -> we must guarantee valid listener for disposing events. + // Use already existing or create new one. + if( rFrame.is() ) + if( !pImpl->xListener.is() ) + pImpl->xListener.set( new DisposeListener( this, pImpl.get() ) ); + + // Set new frame in data container + // and build new listener connection, if necessary. + pImpl->xFrame = rFrame; + if( pImpl->xFrame.is() ) + pImpl->xFrame->addEventListener( pImpl->xListener ); } void SfxChildWindowContext::RegisterChildWindowContext(SfxModule* pMod, sal_uInt16 nId, std::unique_ptr<SfxChildWinContextFactory> pFact) diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index 7d0cffb21b78..1ff6c891cd7c 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -257,65 +257,65 @@ void SvFileObject::Edit(weld::Window* pParent, sfx2::SvBaseLink* pLink, const Li { aEndEditLink = rEndEditHdl; OUString sFile, sRange, sTmpFilter; - if( pLink && pLink->GetLinkManager() ) - { - sfx2::LinkManager::GetDisplayNames( pLink, nullptr, &sFile, &sRange, &sTmpFilter ); - - switch( pLink->GetObjType() ) - { - case OBJECT_CLIENT_GRF: - { - nType = FILETYPE_GRF; // If not set already + if( !pLink || !pLink->GetLinkManager() ) + return; - SvxOpenGraphicDialog aDlg(SfxResId(RID_SVXSTR_EDITGRFLINK), pParent); - aDlg.EnableLink(false); - aDlg.SetPath( sFile, true ); - aDlg.SetCurrentFilter( sTmpFilter ); + sfx2::LinkManager::GetDisplayNames( pLink, nullptr, &sFile, &sRange, &sTmpFilter ); - if( !aDlg.Execute() ) - { - sFile = aDlg.GetPath() - + OUStringLiteral1(sfx2::cTokenSeparator) - + OUStringLiteral1(sfx2::cTokenSeparator) - + aDlg.GetDetectedFilter(); + switch( pLink->GetObjType() ) + { + case OBJECT_CLIENT_GRF: + { + nType = FILETYPE_GRF; // If not set already - aEndEditLink.Call( sFile ); - } - else - sFile.clear(); - } - break; + SvxOpenGraphicDialog aDlg(SfxResId(RID_SVXSTR_EDITGRFLINK), pParent); + aDlg.EnableLink(false); + aDlg.SetPath( sFile, true ); + aDlg.SetCurrentFilter( sTmpFilter ); - case OBJECT_CLIENT_OLE: + if( !aDlg.Execute() ) { - nType = FILETYPE_OBJECT; // if not set already + sFile = aDlg.GetPath() + + OUStringLiteral1(sfx2::cTokenSeparator) + + OUStringLiteral1(sfx2::cTokenSeparator) + + aDlg.GetDetectedFilter(); - ::sfx2::FileDialogHelper & rFileDlg = - pLink->GetInsertFileDialog( OUString() ); - rFileDlg.StartExecuteModal( - LINK( this, SvFileObject, DialogClosedHdl ) ); + aEndEditLink.Call( sFile ); } - break; + else + sFile.clear(); + } + break; - case OBJECT_CLIENT_FILE: - { - nType = FILETYPE_TEXT; // if not set already + case OBJECT_CLIENT_OLE: + { + nType = FILETYPE_OBJECT; // if not set already + + ::sfx2::FileDialogHelper & rFileDlg = + pLink->GetInsertFileDialog( OUString() ); + rFileDlg.StartExecuteModal( + LINK( this, SvFileObject, DialogClosedHdl ) ); + } + break; - OUString sFactory; - SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); - if ( pShell ) - sFactory = pShell->GetFactory().GetFactoryName(); + case OBJECT_CLIENT_FILE: + { + nType = FILETYPE_TEXT; // if not set already - ::sfx2::FileDialogHelper & rFileDlg = - pLink->GetInsertFileDialog(sFactory); - rFileDlg.StartExecuteModal( - LINK( this, SvFileObject, DialogClosedHdl ) ); - } - break; + OUString sFactory; + SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); + if ( pShell ) + sFactory = pShell->GetFactory().GetFactoryName(); - default: - sFile.clear(); + ::sfx2::FileDialogHelper & rFileDlg = + pLink->GetInsertFileDialog(sFactory); + rFileDlg.StartExecuteModal( + LINK( this, SvFileObject, DialogClosedHdl ) ); } + break; + + default: + sFile.clear(); } } diff --git a/sfx2/source/appl/fwkhelper.cxx b/sfx2/source/appl/fwkhelper.cxx index 64e527c4f4bc..df66d6e3a72f 100644 --- a/sfx2/source/appl/fwkhelper.cxx +++ b/sfx2/source/appl/fwkhelper.cxx @@ -32,21 +32,21 @@ void RefreshToolbars( css::uno::Reference< css::frame::XFrame > const & xFrame ) { SolarMutexGuard aGuard; - if ( xFrame.is() ) + if ( !xFrame.is() ) + return; + + SfxFrame* pFrame=nullptr; + for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) + { + if ( pFrame->GetFrameInterface() == xFrame ) + break; + } + + if ( pFrame ) { - SfxFrame* pFrame=nullptr; - for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) - { - if ( pFrame->GetFrameInterface() == xFrame ) - break; - } - - if ( pFrame ) - { - SfxWorkWindow* pWrkWin = pFrame->GetWorkWindow_Impl(); - if ( pWrkWin ) - pWrkWin->UpdateObjectBars_Impl(); - } + SfxWorkWindow* pWrkWin = pFrame->GetWorkWindow_Impl(); + if ( pWrkWin ) + pWrkWin->UpdateObjectBars_Impl(); } } diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx index 3d6ec464c96e..7b8c1f98ddb2 100644 --- a/sfx2/source/appl/helpinterceptor.cxx +++ b/sfx2/source/appl/helpinterceptor.cxx @@ -196,36 +196,36 @@ void SAL_CALL HelpInterceptor_Impl::dispatch( const URL& aURL, const Sequence< css::beans::PropertyValue >& ) { bool bBack = aURL.Complete == ".uno:Backward"; - if ( bBack || aURL.Complete == ".uno:Forward" ) + if ( !bBack && aURL.Complete != ".uno:Forward" ) + return; + + if ( !m_pHistory ) + return; + + if(m_pHistory->size() > m_nCurPos) { - if ( m_pHistory ) + Reference<XFrame> xFrame(m_xIntercepted, UNO_QUERY); + Reference<XController> xController; + if(xFrame.is()) + xController = xFrame->getController(); + if(xController.is()) { - if(m_pHistory->size() > m_nCurPos) - { - Reference<XFrame> xFrame(m_xIntercepted, UNO_QUERY); - Reference<XController> xController; - if(xFrame.is()) - xController = xFrame->getController(); - if(xController.is()) - { - m_pHistory->at( m_nCurPos )->aViewData = xController->getViewData(); - } - } - - sal_uIntPtr nPos = ( bBack && m_nCurPos > 0 ) ? --m_nCurPos - : ( !bBack && m_nCurPos < m_pHistory->size() - 1 ) - ? ++m_nCurPos - : ULONG_MAX; - - if ( nPos < ULONG_MAX ) - { - HelpHistoryEntry_Impl* pEntry = m_pHistory->at( nPos ).get(); - m_pWindow->loadHelpContent(pEntry->aURL, false); // false => don't add item to history again! - } - - m_pWindow->UpdateToolbox(); + m_pHistory->at( m_nCurPos )->aViewData = xController->getViewData(); } } + + sal_uIntPtr nPos = ( bBack && m_nCurPos > 0 ) ? --m_nCurPos + : ( !bBack && m_nCurPos < m_pHistory->size() - 1 ) + ? ++m_nCurPos + : ULONG_MAX; + + if ( nPos < ULONG_MAX ) + { + HelpHistoryEntry_Impl* pEntry = m_pHistory->at( nPos ).get(); + m_pWindow->loadHelpContent(pEntry->aURL, false); // false => don't add item to history again! + } + + m_pWindow->UpdateToolbox(); } diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx index c49107ba87ce..4fad9d3e2732 100644 --- a/sfx2/source/appl/imestatuswindow.cxx +++ b/sfx2/source/appl/imestatuswindow.cxx @@ -86,19 +86,21 @@ ImeStatusWindow::ImeStatusWindow( void ImeStatusWindow::init() { - if (Application::CanToggleImeStatusWindow()) - try - { - bool bShow; - if (getConfig()->getPropertyValue("ShowStatusWindow") >>= bShow) - Application::ShowImeStatusWindow(bShow); - } - catch (css::uno::Exception &) - { - OSL_FAIL("com.sun.star.uno.Exception"); - // Degrade gracefully and use the VCL-supplied default if no - // configuration is available. - } + if (!Application::CanToggleImeStatusWindow()) + return; + + try + { + bool bShow; + if (getConfig()->getPropertyValue("ShowStatusWindow") >>= bShow) + Application::ShowImeStatusWindow(bShow); + } + catch (css::uno::Exception &) + { + OSL_FAIL("com.sun.star.uno.Exception"); + // Degrade gracefully and use the VCL-supplied default if no + // configuration is available. + } } bool ImeStatusWindow::isShowing() diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 1e631bc949aa..459ded0e88b3 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -132,22 +132,22 @@ void LinkManager::Remove( SvBaseLink const *pLink ) void LinkManager::Remove( size_t nPos, size_t nCnt ) { - if( nCnt && nPos < aLinkTbl.size() ) - { - if (sal::static_int_cast<size_t>(nPos + nCnt) > aLinkTbl.size()) - nCnt = aLinkTbl.size() - nPos; + if( !nCnt || nPos >= aLinkTbl.size() ) + return; + + if (sal::static_int_cast<size_t>(nPos + nCnt) > aLinkTbl.size()) + nCnt = aLinkTbl.size() - nPos; - for( size_t n = nPos; n < nPos + nCnt; ++n) + for( size_t n = nPos; n < nPos + nCnt; ++n) + { + tools::SvRef<SvBaseLink>& rTmp = aLinkTbl[ n ]; + if( rTmp.is() ) { - tools::SvRef<SvBaseLink>& rTmp = aLinkTbl[ n ]; - if( rTmp.is() ) - { - rTmp->Disconnect(); - rTmp->SetLinkManager( nullptr ); - } + rTmp->Disconnect(); + rTmp->SetLinkManager( nullptr ); } - aLinkTbl.erase( aLinkTbl.begin() + nPos, aLinkTbl.begin() + nPos + nCnt ); } + aLinkTbl.erase( aLinkTbl.begin() + nPos, aLinkTbl.begin() + nPos + nCnt ); } bool LinkManager::Insert( SvBaseLink* pLink ) diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index b86cf3dbdbb5..15bc01f84059 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -586,25 +586,25 @@ bool ImplDdeItem::Put( const DdeData* ) void ImplDdeItem::AdviseLoop( bool bOpen ) { // Connection is closed, so also unsubscribe link - if( pLink->GetObj() ) + if( !pLink->GetObj() ) + return; + + if( bOpen ) { - if( bOpen ) + // A connection is re-established + if( OBJECT_DDE_EXTERN == pLink->GetObjType() ) { - // A connection is re-established - if( OBJECT_DDE_EXTERN == pLink->GetObjType() ) - { - pLink->GetObj()->AddDataAdvise( pLink, "text/plain;charset=utf-16", ADVISEMODE_NODATA ); - pLink->GetObj()->AddConnectAdvise( pLink ); - } - } - else - { - // So that no-one gets the idea to delete the pointer - // when Disconnecting! - tools::SvRef<SvBaseLink> aRef( pLink ); - aRef->Disconnect(); + pLink->GetObj()->AddDataAdvise( pLink, "text/plain;charset=utf-16", ADVISEMODE_NODATA ); + pLink->GetObj()->AddConnectAdvise( pLink ); } } + else + { + // So that no-one gets the idea to delete the pointer + // when Disconnecting! + tools::SvRef<SvBaseLink> aRef( pLink ); + aRef->Disconnect(); + } } } diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx index 1c32be75cd90..267b6d803608 100644 --- a/sfx2/source/appl/macroloader.cxx +++ b/sfx2/source/appl/macroloader.cxx @@ -129,20 +129,20 @@ void SAL_CALL SfxMacroLoader::dispatchWithNotification( uno::Any aAny; ErrCode nErr = loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() ); - if( xListener.is() ) - { - // always call dispatchFinished(), because we didn't load a document but - // executed a macro instead! - frame::DispatchResultEvent aEvent; + if( !xListener.is() ) + return; - aEvent.Source = static_cast< ::cppu::OWeakObject* >(this); - if( nErr == ERRCODE_NONE ) - aEvent.State = frame::DispatchResultState::SUCCESS; - else - aEvent.State = frame::DispatchResultState::FAILURE; + // always call dispatchFinished(), because we didn't load a document but + // executed a macro instead! + frame::DispatchResultEvent aEvent; - xListener->dispatchFinished( aEvent ) ; - } + aEvent.Source = static_cast< ::cppu::OWeakObject* >(this); + if( nErr == ERRCODE_NONE ) + aEvent.State = frame::DispatchResultState::SUCCESS; + else + aEvent.State = frame::DispatchResultState::FAILURE; + + xListener->dispatchFinished( aEvent ) ; } uno::Any SAL_CALL SfxMacroLoader::dispatchWithReturnValue( diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 78ae4d441905..45cfaeeb9937 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -516,21 +516,21 @@ bool IndexBox_Impl::EventNotify( NotifyEvent& rNEvt ) void IndexBox_Impl::SelectExecutableEntry() { sal_Int32 nPos = GetEntryPos( GetText() ); - if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) - { - sal_Int32 nOldPos = nPos; - OUString aEntryText; - IndexEntry_Impl* pEntry = static_cast<IndexEntry_Impl*>(GetEntryData( nPos )); - sal_Int32 nCount = GetEntryCount(); - while ( nPos < nCount && ( !pEntry || pEntry->m_aURL.isEmpty() ) ) - { - pEntry = static_cast<IndexEntry_Impl*>(GetEntryData( ++nPos )); - aEntryText = GetEntry( nPos ); - } + if ( nPos == COMBOBOX_ENTRY_NOTFOUND ) + return; - if ( nOldPos != nPos ) - SetText( aEntryText ); + sal_Int32 nOldPos = nPos; + OUString aEntryText; + IndexEntry_Impl* pEntry = static_cast<IndexEntry_Impl*>(GetEntryData( nPos )); + sal_Int32 nCount = GetEntryCount(); + while ( nPos < nCount && ( !pEntry || pEntry->m_aURL.isEmpty() ) ) + { + pEntry = static_cast<IndexEntry_Impl*>(GetEntryData( ++nPos )); + aEntryText = GetEntry( nPos ); } + + if ( nOldPos != nPos ) + SetText( aEntryText ); } // class IndexTabPage_Impl ----------------------------------------------- @@ -1016,38 +1016,38 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, ClickHdl, Button*, void) IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl, LinkParamNone*, void) { OUString aSearchText = comphelper::string::strip(m_pSearchED->GetText(), ' '); - if ( !aSearchText.isEmpty() ) + if ( aSearchText.isEmpty() ) + return; + + EnterWait(); + ClearSearchResults(); + RememberSearchText( aSearchText ); + OUStringBuffer aSearchURL(HELP_URL); + aSearchURL.append(aFactory); + aSearchURL.append(HELP_SEARCH_TAG); + if ( !m_pFullWordsCB->IsChecked() ) + aSearchText = sfx2::PrepareSearchString( aSearchText, xBreakIterator, true ); + aSearchURL.append(aSearchText); + AppendConfigToken(aSearchURL, false); + if ( m_pScopeCB->IsChecked() ) + aSearchURL.append("&Scope=Heading"); + std::vector< OUString > aFactories = SfxContentHelper::GetResultSet(aSearchURL.makeStringAndClear()); + for (const OUString & rRow : aFactories) { - EnterWait(); - ClearSearchResults(); - RememberSearchText( aSearchText ); - OUStringBuffer aSearchURL(HELP_URL); - aSearchURL.append(aFactory); - aSearchURL.append(HELP_SEARCH_TAG); - if ( !m_pFullWordsCB->IsChecked() ) - aSearchText = sfx2::PrepareSearchString( aSearchText, xBreakIterator, true ); - aSearchURL.append(aSearchText); - AppendConfigToken(aSearchURL, false); - if ( m_pScopeCB->IsChecked() ) - aSearchURL.append("&Scope=Heading"); - std::vector< OUString > aFactories = SfxContentHelper::GetResultSet(aSearchURL.makeStringAndClear()); - for (const OUString & rRow : aFactories) - { - sal_Int32 nIdx = 0; - OUString aTitle = rRow.getToken( 0, '\t', nIdx ); - OUString* pURL = new OUString( rRow.getToken( 1, '\t', nIdx ) ); - const sal_Int32 nPos = m_pResultsLB->InsertEntry( aTitle ); - m_pResultsLB->SetEntryData( nPos, pURL ); - } - LeaveWait(); + sal_Int32 nIdx = 0; + OUString aTitle = rRow.getToken( 0, '\t', nIdx ); + OUString* pURL = new OUString( rRow.getToken( 1, '\t', nIdx ) ); + const sal_Int32 nPos = m_pResultsLB->InsertEntry( aTitle ); + m_pResultsLB->SetEntryData( nPos, pURL ); + } + LeaveWait(); - if ( aFactories.empty() ) - { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), - VclMessageType::Info, VclButtonsType::Ok, - SfxResId(STR_INFO_NOSEARCHRESULTS))); - xBox->run(); - } + if ( aFactories.empty() ) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_INFO_NOSEARCHRESULTS))); + xBox->run(); } } @@ -2274,19 +2274,19 @@ IMPL_LINK_NOARG( SfxHelpTextWindow_Impl, CloseHdl, LinkParamNone*, void ) IMPL_LINK( SfxHelpTextWindow_Impl, CheckHdl, Button*, pButton, void ) { CheckBox* pBox = static_cast<CheckBox*>(pButton); - if ( xConfiguration.is() ) + if ( !xConfiguration.is() ) + return; + + bool bChecked = pBox->IsChecked(); + try { - bool bChecked = pBox->IsChecked(); - try - { - ConfigurationHelper::writeRelativeKey( - xConfiguration, PATH_OFFICE_FACTORIES + sCurrentFactory, KEY_HELP_ON_OPEN, makeAny( bChecked ) ); - ConfigurationHelper::flush( xConfiguration ); - } - catch( Exception& ) - { - SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::CheckHdl(): unexpected exception" ); - } + ConfigurationHelper::writeRelativeKey( + xConfiguration, PATH_OFFICE_FACTORIES + sCurrentFactory, KEY_HELP_ON_OPEN, makeAny( bChecked ) ); + ConfigurationHelper::flush( xConfiguration ); + } + catch( Exception& ) + { + SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::CheckHdl(): unexpected exception" ); } } @@ -2428,22 +2428,22 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt ) void SfxHelpTextWindow_Impl::GetFocus() { - if ( !bIsInClose ) + if ( bIsInClose ) + return; + + try { - try + if( xFrame.is() ) { - if( xFrame.is() ) - { - Reference< css::awt::XWindow > xWindow = xFrame->getComponentWindow(); - if( xWindow.is() ) - xWindow->setFocus(); - } - } - catch( Exception& ) - { - SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::GetFocus(): unexpected exception" ); + Reference< css::awt::XWindow > xWindow = xFrame->getComponentWindow(); + if( xWindow.is() ) + xWindow->setFocus(); } } + catch( Exception& ) + { + SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::GetFocus(): unexpected exception" ); + } } @@ -2553,23 +2553,23 @@ void SfxHelpTextWindow_Impl::CloseFrame() void SfxHelpTextWindow_Impl::DoSearch() { - if (!m_xSrchDlg) + if (m_xSrchDlg) + return; + + // create the search dialog + m_xSrchDlg.reset(new sfx2::SearchDialog(pTextWin->GetFrameWeld(), "HelpSearchDialog")); + // set handler + m_xSrchDlg->SetFindHdl( LINK( this, SfxHelpTextWindow_Impl, FindHdl ) ); + m_xSrchDlg->SetCloseHdl( LINK( this, SfxHelpTextWindow_Impl, CloseHdl ) ); + // get selected text of the help page to set it as the search text + Reference< XTextRange > xCursor = getCursor(); + if ( xCursor.is() ) { - // create the search dialog - m_xSrchDlg.reset(new sfx2::SearchDialog(pTextWin->GetFrameWeld(), "HelpSearchDialog")); - // set handler - m_xSrchDlg->SetFindHdl( LINK( this, SfxHelpTextWindow_Impl, FindHdl ) ); - m_xSrchDlg->SetCloseHdl( LINK( this, SfxHelpTextWindow_Impl, CloseHdl ) ); - // get selected text of the help page to set it as the search text - Reference< XTextRange > xCursor = getCursor(); - if ( xCursor.is() ) - { - OUString sText = xCursor->getString(); - if ( !sText.isEmpty() ) - m_xSrchDlg->SetSearchText( sText ); - } - sfx2::SearchDialog::runAsync(m_xSrchDlg); + OUString sText = xCursor->getString(); + if ( !sText.isEmpty() ) + m_xSrchDlg->SetSearchText( sText ); } + sfx2::SearchDialog::runAsync(m_xSrchDlg); } // class SfxHelpWindow_Impl ---------------------------------------------- @@ -2677,21 +2677,21 @@ void SfxHelpWindow_Impl::MakeLayout() void SfxHelpWindow_Impl::InitSizes() { - if ( xWindow.is() ) - { - css::awt::Rectangle aRect = xWindow->getPosSize(); - nHeight = aRect.Height; + if ( !xWindow.is() ) + return; - if ( bIndex ) - { - nExpandWidth = aRect.Width; - nCollapseWidth = nExpandWidth * nTextSize / 100; - } - else - { - nCollapseWidth = aRect.Width; - nExpandWidth = nTextSize ? nCollapseWidth * 100 / nTextSize : 0; - } + css::awt::Rectangle aRect = xWindow->getPosSize(); + nHeight = aRect.Height; + + if ( bIndex ) + { + nExpandWidth = aRect.Width; + nCollapseWidth = nExpandWidth * nTextSize / 100; + } + else + { + nCollapseWidth = aRect.Width; + nExpandWidth = nTextSize ? nCollapseWidth * 100 / nTextSize : 0; } } @@ -2699,35 +2699,35 @@ void SfxHelpWindow_Impl::InitSizes() void SfxHelpWindow_Impl::LoadConfig() { SvtViewOptions aViewOpt( EViewType::Window, CONFIGNAME_HELPWIN ); - if ( aViewOpt.Exists() ) + if ( !aViewOpt.Exists() ) + return; + + bIndex = aViewOpt.IsVisible(); + Any aUserItem = aViewOpt.GetUserItem( USERITEM_NAME ); + OUString aUserData; + if ( aUserItem >>= aUserData ) { - bIndex = aViewOpt.IsVisible(); - Any aUserItem = aViewOpt.GetUserItem( USERITEM_NAME ); - OUString aUserData; - if ( aUserItem >>= aUserData ) + DBG_ASSERT( comphelper::string::getTokenCount(aUserData, ';') == 6, "invalid user data" ); + sal_Int32 nIdx = 0; + nIndexSize = aUserData.getToken( 0, ';', nIdx ).toInt32(); + nTextSize = aUserData.getToken( 0, ';', nIdx ).toInt32(); + sal_Int32 nWidth = aUserData.getToken( 0, ';', nIdx ).toInt32(); + nHeight = aUserData.getToken( 0, ';', nIdx ).toInt32(); + aWinPos.setX( aUserData.getToken( 0, ';', nIdx ).toInt32() ); + aWinPos.setY( aUserData.getToken( 0, ';', nIdx ).toInt32() ); + if ( bIndex ) { - DBG_ASSERT( comphelper::string::getTokenCount(aUserData, ';') == 6, "invalid user data" ); - sal_Int32 nIdx = 0; - nIndexSize = aUserData.getToken( 0, ';', nIdx ).toInt32(); - nTextSize = aUserData.getToken( 0, ';', nIdx ).toInt32(); - sal_Int32 nWidth = aUserData.getToken( 0, ';', nIdx ).toInt32(); - nHeight = aUserData.getToken( 0, ';', nIdx ).toInt32(); - aWinPos.setX( aUserData.getToken( 0, ';', nIdx ).toInt32() ); - aWinPos.setY( aUserData.getToken( 0, ';', nIdx ).toInt32() ); - if ( bIndex ) - { - nExpandWidth = nWidth; - nCollapseWidth = nExpandWidth * nTextSize / 100; - } - else if (nTextSize != 0) - { - nCollapseWidth = nWidth; - nExpandWidth = nCollapseWidth * 100 / nTextSize; - } + nExpandWidth = nWidth; + nCollapseWidth = nExpandWidth * nTextSize / 100; + } + else if (nTextSize != 0) + { + nCollapseWidth = nWidth; + nExpandWidth = nCollapseWidth * 100 / nTextSize; } - - pTextWin->ToggleIndex( bIndex ); } + + pTextWin->ToggleIndex( bIndex ); } @@ -2845,40 +2845,40 @@ void SfxHelpWindow_Impl::openDone(const OUString& sURL , } else pIndexWin->GrabFocusBack(); - if ( bSuccess ) + if ( !bSuccess ) + return; + + // set some view settings: "prevent help tips" and "helpid == 68245" + try { - // set some view settings: "prevent help tips" and "helpid == 68245" - try - { - Reference < XController > xController = pTextWin->getFrame()->getController(); - if ( xController.is() ) - { - Reference < XViewSettingsSupplier > xSettings( xController, UNO_QUERY ); - Reference < XPropertySet > xViewProps = xSettings->getViewSettings(); - Reference< XPropertySetInfo > xInfo = xViewProps->getPropertySetInfo(); - xViewProps->setPropertyValue( "ShowContentTips", makeAny( false ) ); - xViewProps->setPropertyValue( "ShowGraphics", makeAny( true ) ); - xViewProps->setPropertyValue( "ShowTables", makeAny( true ) ); - xViewProps->setPropertyValue( "HelpURL", makeAny( OUString("HID:SFX2_HID_HELP_ONHELP") ) ); - OUString sProperty( "IsExecuteHyperlinks" ); - if ( xInfo->hasPropertyByName( sProperty ) ) - xViewProps->setPropertyValue( sProperty, makeAny( true ) ); - xController->restoreViewData(Any()); - } - } - catch( Exception& ) + Reference < XController > xController = pTextWin->getFrame()->getController(); + if ( xController.is() ) { - OSL_FAIL( "SfxHelpWindow_Impl::OpenDoneHdl(): unexpected exception" ); + Reference < XViewSettingsSupplier > xSettings( xController, UNO_QUERY ); + Reference < XPropertySet > xViewProps = xSettings->getViewSettings(); + Reference< XPropertySetInfo > xInfo = xViewProps->getPropertySetInfo(); + xViewProps->setPropertyValue( "ShowContentTips", makeAny( false ) ); + xViewProps->setPropertyValue( "ShowGraphics", makeAny( true ) ); + xViewProps->setPropertyValue( "ShowTables", makeAny( true ) ); + xViewProps->setPropertyValue( "HelpURL", makeAny( OUString("HID:SFX2_HID_HELP_ONHELP") ) ); + OUString sProperty( "IsExecuteHyperlinks" ); + if ( xInfo->hasPropertyByName( sProperty ) ) + xViewProps->setPropertyValue( sProperty, makeAny( true ) ); + xController->restoreViewData(Any()); } + } + catch( Exception& ) + { + OSL_FAIL( "SfxHelpWindow_Impl::OpenDoneHdl(): unexpected exception" ); + } - // When the SearchPage opens the help doc, then select all words, which are equal to its text - OUString sSearchText = comphelper::string::strip(pIndexWin->GetSearchText(), ' '); - if ( !sSearchText.isEmpty() ) - pTextWin->SelectSearchText( sSearchText, pIndexWin->IsFullWordSearch() ); + // When the SearchPage opens the help doc, then select all words, which are equal to its text + OUString sSearchText = comphelper::string::strip(pIndexWin->GetSearchText(), ' '); + if ( !sSearchText.isEmpty() ) + pTextWin->SelectSearchText( sSearchText, pIndexWin->IsFullWordSearch() ); - // no page style header -> this prevents a print output of the URL - pTextWin->SetPageStyleHeaderOff(); - } + // no page style header -> this prevents a print output of the URL + pTextWin->SetPageStyleHeaderOff(); } diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index 873bd7914189..bff6d3d32eea 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -199,36 +199,36 @@ void SvxOpenGraphicDialog::SetPath( const OUString& rPath, bool bLinkState ) void SvxOpenGraphicDialog::EnableLink( bool state ) { - if( mpImpl->xCtrlAcc.is() ) + if( !mpImpl->xCtrlAcc.is() ) + return; + + try + { + mpImpl->xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, state ); + } + catch(const IllegalArgumentException&) { - try - { - mpImpl->xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, state ); - } - catch(const IllegalArgumentException&) - { #ifdef DBG_UTIL - OSL_FAIL( "Cannot enable \"link\" checkbox" ); + OSL_FAIL( "Cannot enable \"link\" checkbox" ); #endif - } } } void SvxOpenGraphicDialog::AsLink(bool bState) { - if( mpImpl->xCtrlAcc.is() ) + if( !mpImpl->xCtrlAcc.is() ) + return; + + try + { + mpImpl->xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, Any(bState) ); + } + catch(const IllegalArgumentException&) { - try - { - mpImpl->xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, Any(bState) ); - } - catch(const IllegalArgumentException&) - { #ifdef DBG_UTIL - OSL_FAIL( "Cannot check \"link\" checkbox" ); + OSL_FAIL( "Cannot check \"link\" checkbox" ); #endif - } } } diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index b32f14649f96..a5b698f5cc69 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -184,64 +184,64 @@ void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) } const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint); - if ( pEventHint ) - { - // only ObjectShell-related events with media interest - SfxObjectShell* pDocSh = pEventHint->GetObjShell(); - if( !pDocSh ) - return; + if ( !pEventHint ) + return; - switch ( pEventHint->GetEventId() ) - { - case SfxEventHintId::CreateDoc: - { - bool bAllowModif = pDocSh->IsEnableSetModified(); - if ( bAllowModif ) - pDocSh->EnableSetModified( false ); - - using namespace ::com::sun::star; - uno::Reference<document::XDocumentProperties> xDocProps( - pDocSh->getDocProperties()); - if (xDocProps.is()) { - xDocProps->setAuthor( SvtUserOptions().GetFullName() ); - ::DateTime now( ::DateTime::SYSTEM ); - xDocProps->setCreationDate( now.GetUNODateTime() ); - } + // only ObjectShell-related events with media interest + SfxObjectShell* pDocSh = pEventHint->GetObjShell(); + if( !pDocSh ) + return; - if ( bAllowModif ) - pDocSh->EnableSetModified( bAllowModif ); + switch ( pEventHint->GetEventId() ) + { + case SfxEventHintId::CreateDoc: + { + bool bAllowModif = pDocSh->IsEnableSetModified(); + if ( bAllowModif ) + pDocSh->EnableSetModified( false ); + + using namespace ::com::sun::star; + uno::Reference<document::XDocumentProperties> xDocProps( + pDocSh->getDocProperties()); + if (xDocProps.is()) { + xDocProps->setAuthor( SvtUserOptions().GetFullName() ); + ::DateTime now( ::DateTime::SYSTEM ); + xDocProps->setCreationDate( now.GetUNODateTime() ); } - break; - case SfxEventHintId::OpenDoc: - case SfxEventHintId::SaveDocDone: - case SfxEventHintId::SaveAsDocDone: - case SfxEventHintId::SaveToDocDone: - case SfxEventHintId::CloseDoc: - { - AddDocumentToPickList(pDocSh); - } - break; + if ( bAllowModif ) + pDocSh->EnableSetModified( bAllowModif ); + } + break; + + case SfxEventHintId::OpenDoc: + case SfxEventHintId::SaveDocDone: + case SfxEventHintId::SaveAsDocDone: + case SfxEventHintId::SaveToDocDone: + case SfxEventHintId::CloseDoc: + { + AddDocumentToPickList(pDocSh); + } + break; - case SfxEventHintId::SaveAsDoc: + case SfxEventHintId::SaveAsDoc: + { + SfxMedium *pMedium = pDocSh->GetMedium(); + if (!pMedium) + return; + + // We're starting a "Save As". Add the current document (if it's + // not a "new" document) to the "Recent Documents" list before we + // switch to the new path. + // If the current document is new, path will be empty. + OUString path = pMedium->GetOrigURL(); + if (!path.isEmpty()) { - SfxMedium *pMedium = pDocSh->GetMedium(); - if (!pMedium) - return; - - // We're starting a "Save As". Add the current document (if it's - // not a "new" document) to the "Recent Documents" list before we - // switch to the new path. - // If the current document is new, path will be empty. - OUString path = pMedium->GetOrigURL(); - if (!path.isEmpty()) - { - AddDocumentToPickList(pDocSh); - } + AddDocumentToPickList(pDocSh); } - break; - default: break; } + break; + default: break; } } diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 65c73de125d9..a05579fbdd89 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -196,32 +196,32 @@ ShutdownIcon::~ShutdownIcon() void ShutdownIcon::OpenURL( const OUString& aURL, const OUString& rTarget, const Sequence< PropertyValue >& aArgs ) { - if ( getInstance() && getInstance()->m_xDesktop.is() ) - { - css::uno::Reference < XDispatchProvider > xDispatchProvider( getInstance()->m_xDesktop, UNO_QUERY ); - if ( xDispatchProvider.is() ) - { - css::util::URL aDispatchURL; - aDispatchURL.Complete = aURL; + if ( !getInstance() || !getInstance()->m_xDesktop.is() ) + return; - css::uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); - try - { - css::uno::Reference< css::frame::XDispatch > xDispatch; + css::uno::Reference < XDispatchProvider > xDispatchProvider( getInstance()->m_xDesktop, UNO_QUERY ); + if ( !xDispatchProvider.is() ) + return; - xURLTransformer->parseStrict( aDispatchURL ); - xDispatch = xDispatchProvider->queryDispatch( aDispatchURL, rTarget, 0 ); - if ( xDispatch.is() ) - xDispatch->dispatch( aDispatchURL, aArgs ); - } - catch ( css::uno::RuntimeException& ) - { - throw; - } - catch ( css::uno::Exception& ) - { - } - } + css::util::URL aDispatchURL; + aDispatchURL.Complete = aURL; + + css::uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); + try + { + css::uno::Reference< css::frame::XDispatch > xDispatch; + + xURLTransformer->parseStrict( aDispatchURL ); + xDispatch = xDispatchProvider->queryDispatch( aDispatchURL, rTarget, 0 ); + if ( xDispatch.is() ) + xDispatch->dispatch( aDispatchURL, aArgs ); + } + catch ( css::uno::RuntimeException& ) + { + throw; + } + catch ( css::uno::Exception& ) + { } } @@ -239,40 +239,40 @@ void ShutdownIcon::FileOpen() void ShutdownIcon::FromTemplate() { - if ( getInstance() && getInstance()->m_xDesktop.is() ) + if ( !getInstance() || !getInstance()->m_xDesktop.is() ) + return; + + css::uno::Reference < css::frame::XFramesSupplier > xDesktop ( getInstance()->m_xDesktop, UNO_QUERY); + css::uno::Reference < css::frame::XFrame > xFrame( xDesktop->getActiveFrame() ); + if ( !xFrame.is() ) + xFrame.set( xDesktop, UNO_QUERY ); + + URL aTargetURL; + aTargetURL.Complete = ".uno:NewDoc"; + css::uno::Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); + xTrans->parseStrict( aTargetURL ); + + css::uno::Reference < css::frame::XDispatchProvider > xProv( xFrame, UNO_QUERY ); + css::uno::Reference < css::frame::XDispatch > xDisp; + if ( xProv.is() ) { - css::uno::Reference < css::frame::XFramesSupplier > xDesktop ( getInstance()->m_xDesktop, UNO_QUERY); - css::uno::Reference < css::frame::XFrame > xFrame( xDesktop->getActiveFrame() ); - if ( !xFrame.is() ) - xFrame.set( xDesktop, UNO_QUERY ); - - URL aTargetURL; - aTargetURL.Complete = ".uno:NewDoc"; - css::uno::Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); - xTrans->parseStrict( aTargetURL ); - - css::uno::Reference < css::frame::XDispatchProvider > xProv( xFrame, UNO_QUERY ); - css::uno::Reference < css::frame::XDispatch > xDisp; - if ( xProv.is() ) - { - xDisp = xProv->queryDispatch( aTargetURL, "_self", 0 ); - } - if ( xDisp.is() ) - { - Sequence<PropertyValue> aArgs(1); - PropertyValue* pArg = aArgs.getArray(); - pArg[0].Name = "Referer"; - pArg[0].Value <<= OUString("private:user"); - css::uno::Reference< css::frame::XNotifyingDispatch > xNotifier(xDisp, UNO_QUERY); - if (xNotifier.is()) - { - EnterModalMode(); - xNotifier->dispatchWithNotification(aTargetURL, aArgs, new SfxNotificationListener_Impl); - } - else - xDisp->dispatch( aTargetURL, aArgs ); - } + xDisp = xProv->queryDispatch( aTargetURL, "_self", 0 ); } + if ( !xDisp.is() ) + return; + + Sequence<PropertyValue> aArgs(1); + PropertyValue* pArg = aArgs.getArray(); + pArg[0].Name = "Referer"; + pArg[0].Value <<= OUString("private:user"); + css::uno::Reference< css::frame::XNotifyingDispatch > xNotifier(xDisp, UNO_QUERY); + if (xNotifier.is()) + { + EnterModalMode(); + xNotifier->dispatchWithNotification(aTargetURL, aArgs, new SfxNotificationListener_Impl); + } + else + xDisp->dispatch( aTargetURL, aArgs ); } OUString ShutdownIcon::GetUrlDescription( const OUString& aUrl ) diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 20aa4cfab3a9..d27a04d1a27a 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -144,47 +144,47 @@ LayoutManagerListener::~LayoutManagerListener() void LayoutManagerListener::setFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) { SolarMutexGuard aGuard; - if ( m_pWrkWin && !m_bHasFrame ) - { - m_xFrame = xFrame; - m_bHasFrame = true; + if ( !m_pWrkWin || m_bHasFrame ) + return; - if ( xFrame.is() ) - { - css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); - css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager; - if ( xPropSet.is() ) - { - try - { - Any aValue = xPropSet->getPropertyValue( g_aLayoutManagerPropName ); - aValue >>= xLayoutManager; + m_xFrame = xFrame; + m_bHasFrame = true; - if ( xLayoutManager.is() ) - xLayoutManager->addLayoutManagerEventListener( - css::uno::Reference< css::frame::XLayoutManagerListener >( - static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY )); + if ( !xFrame.is() ) + return; - xPropSet.set( xLayoutManager, UNO_QUERY ); - if ( xPropSet.is() ) - { - aValue = xPropSet->getPropertyValue( "LockCount" ); - aValue >>= m_pWrkWin->m_nLock; - } - } - catch ( css::lang::DisposedException& ) - { - } - catch ( const css::uno::RuntimeException& ) - { - throw; - } - catch ( css::uno::Exception& ) - { - } - } + css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); + css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager; + if ( !xPropSet.is() ) + return; + + try + { + Any aValue = xPropSet->getPropertyValue( g_aLayoutManagerPropName ); + aValue >>= xLayoutManager; + + if ( xLayoutManager.is() ) + xLayoutManager->addLayoutManagerEventListener( + css::uno::Reference< css::frame::XLayoutManagerListener >( + static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY )); + + xPropSet.set( xLayoutManager, UNO_QUERY ); + if ( xPropSet.is() ) + { + aValue = xPropSet->getPropertyValue( "LockCount" ); + aValue >>= m_pWrkWin->m_nLock; } } + catch ( css::lang::DisposedException& ) + { + } + catch ( const css::uno::RuntimeException& ) + { + throw; + } + catch ( css::uno::Exception& ) + { + } } @@ -210,37 +210,37 @@ void SAL_CALL LayoutManagerListener::dispose() m_pWrkWin = nullptr; css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame.get(), css::uno::UNO_QUERY ); - if ( xFrame.is() ) + if ( !xFrame.is() ) + return; + + m_xFrame.clear(); + m_bHasFrame = false; + + css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, css::uno::UNO_QUERY ); + css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager; + if ( !xPropSet.is() ) + return; + + try { - m_xFrame.clear(); - m_bHasFrame = false; + css::uno::Any aValue = xPropSet->getPropertyValue( g_aLayoutManagerPropName ); + aValue >>= xLayoutManager; - css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, css::uno::UNO_QUERY ); - css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager; - if ( xPropSet.is() ) - { - try - { - css::uno::Any aValue = xPropSet->getPropertyValue( g_aLayoutManagerPropName ); - aValue >>= xLayoutManager; - - // remove as listener from layout manager - if ( xLayoutManager.is() ) - xLayoutManager->removeLayoutManagerEventListener( - css::uno::Reference< css::frame::XLayoutManagerListener >( - static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY )); - } - catch ( css::lang::DisposedException& ) - { - } - catch ( const css::uno::RuntimeException& ) - { - throw; - } - catch ( css::uno::Exception& ) - { - } - } + // remove as listener from layout manager + if ( xLayoutManager.is() ) + xLayoutManager->removeLayoutManagerEventListener( + css::uno::Reference< css::frame::XLayoutManagerListener >( + static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY )); + } + catch ( css::lang::DisposedException& ) + { + } + catch ( const css::uno::RuntimeException& ) + { + throw; + } + catch ( css::uno::Exception& ) + { } } @@ -265,28 +265,28 @@ void SAL_CALL LayoutManagerListener::layoutEvent( const css::uno::Any& ) { SolarMutexGuard aGuard; - if ( m_pWrkWin ) + if ( !m_pWrkWin ) + return; + + if ( eLayoutEvent == css::frame::LayoutManagerEvents::VISIBLE ) { - if ( eLayoutEvent == css::frame::LayoutManagerEvents::VISIBLE ) - { - m_pWrkWin->MakeVisible_Impl( true ); - m_pWrkWin->ShowChildren_Impl(); - m_pWrkWin->ArrangeChildren_Impl(); - } - else if ( eLayoutEvent == css::frame::LayoutManagerEvents::INVISIBLE ) - { - m_pWrkWin->MakeVisible_Impl( false ); - m_pWrkWin->HideChildren_Impl(); - m_pWrkWin->ArrangeChildren_Impl(); - } - else if ( eLayoutEvent == css::frame::LayoutManagerEvents::LOCK ) - { - m_pWrkWin->Lock_Impl( true ); - } - else if ( eLayoutEvent == css::frame::LayoutManagerEvents::UNLOCK ) - { - m_pWrkWin->Lock_Impl( false ); - } + m_pWrkWin->MakeVisible_Impl( true ); + m_pWrkWin->ShowChildren_Impl(); + m_pWrkWin->ArrangeChildren_Impl(); + } + else if ( eLayoutEvent == css::frame::LayoutManagerEvents::INVISIBLE ) + { + m_pWrkWin->MakeVisible_Impl( false ); + m_pWrkWin->HideChildren_Impl(); + m_pWrkWin->ArrangeChildren_Impl(); + } + else if ( eLayoutEvent == css::frame::LayoutManagerEvents::LOCK ) + { + m_pWrkWin->Lock_Impl( true ); + } + else if ( eLayoutEvent == css::frame::LayoutManagerEvents::UNLOCK ) + { + m_pWrkWin->Lock_Impl( false ); } } @@ -1330,64 +1330,64 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus ) pCW->aInfo.bVisible = true; SfxChildWindow *pChildWin = SfxChildWindow::CreateChildWindow( pCW->nId, pWorkWin, &GetBindings(), pCW->aInfo).release(); - if (pChildWin) - { - if ( bSetFocus ) - bSetFocus = pChildWin->WantsFocus(); - pChildWin->SetWorkWindow_Impl( this ); + if (!pChildWin) + return; + + if ( bSetFocus ) + bSetFocus = pChildWin->WantsFocus(); + pChildWin->SetWorkWindow_Impl( this ); - // At least the extra string is changed during the evaluation, - // also get it anewed - SfxChildWinInfo aInfo = pChildWin->GetInfo(); - pCW->aInfo.aExtraString = aInfo.aExtraString; - pCW->aInfo.bVisible = aInfo.bVisible; - pCW->aInfo.nFlags |= aInfo.nFlags; + // At least the extra string is changed during the evaluation, + // also get it anewed + SfxChildWinInfo aInfo = pChildWin->GetInfo(); + pCW->aInfo.aExtraString = aInfo.aExtraString; + pCW->aInfo.bVisible = aInfo.bVisible; + pCW->aInfo.nFlags |= aInfo.nFlags; - // The creation was successful - GetBindings().Invalidate(pCW->nId); + // The creation was successful + GetBindings().Invalidate(pCW->nId); - sal_uInt16 nPos = pChildWin->GetPosition(); - if (nPos != CHILDWIN_NOPOS) + sal_uInt16 nPos = pChildWin->GetPosition(); + if (nPos != CHILDWIN_NOPOS) + { + DBG_ASSERT(nPos < SFX_OBJECTBAR_MAX, "Illegal objectbar position!"); + if ( aChildren[TbxMatch(nPos)] )// && { - DBG_ASSERT(nPos < SFX_OBJECTBAR_MAX, "Illegal objectbar position!"); - if ( aChildren[TbxMatch(nPos)] )// && - { - // ChildWindow replaces ObjectBar - aChildren[TbxMatch(nPos)]->nVisible ^= SfxChildVisibility::NOT_HIDDEN; - } + // ChildWindow replaces ObjectBar + aChildren[TbxMatch(nPos)]->nVisible ^= SfxChildVisibility::NOT_HIDDEN; } + } - // make childwin keyboard accessible - pWorkWin->GetSystemWindow()->GetTaskPaneList()->AddWindow( pChildWin->GetWindow() ); + // make childwin keyboard accessible + pWorkWin->GetSystemWindow()->GetTaskPaneList()->AddWindow( pChildWin->GetWindow() ); - pCW->pWin = pChildWin; + pCW->pWin = pChildWin; - if ( pChildWin->GetAlignment() == SfxChildAlignment::NOALIGNMENT || pChildWin->GetWindow()->GetParent() == pWorkWin) - { - // The window is not docked or docked outside of one split windows - // and must therefore be registered explicitly as a Child - if (pChildWin->GetController()) - pCW->pCli = RegisterChild_Impl(pChildWin->GetController(), pChildWin->GetAlignment()); - else - pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment()); - pCW->pCli->nVisible = SfxChildVisibility::VISIBLE; - if ( pChildWin->GetAlignment() != SfxChildAlignment::NOALIGNMENT && bIsFullScreen ) - pCW->pCli->nVisible ^= SfxChildVisibility::ACTIVE; - pCW->pCli->bSetFocus = bSetFocus; - } + if ( pChildWin->GetAlignment() == SfxChildAlignment::NOALIGNMENT || pChildWin->GetWindow()->GetParent() == pWorkWin) + { + // The window is not docked or docked outside of one split windows + // and must therefore be registered explicitly as a Child + if (pChildWin->GetController()) + pCW->pCli = RegisterChild_Impl(pChildWin->GetController(), pChildWin->GetAlignment()); else - { - // A docked window which parent is not a WorkingWindow, must lie - // in a SplitWindow and thus not be explicitly registered. - // This happens already in the initialization of SfxDockingWindows! - } + pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment()); + pCW->pCli->nVisible = SfxChildVisibility::VISIBLE; + if ( pChildWin->GetAlignment() != SfxChildAlignment::NOALIGNMENT && bIsFullScreen ) + pCW->pCli->nVisible ^= SfxChildVisibility::ACTIVE; + pCW->pCli->bSetFocus = bSetFocus; + } + else + { + // A docked window which parent is not a WorkingWindow, must lie + // in a SplitWindow and thus not be explicitly registered. + // This happens already in the initialization of SfxDockingWindows! + } - if ( pCW->nInterfaceId != pChildWin->GetContextId() ) - pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); + if ( pCW->nInterfaceId != pChildWin->GetContextId() ) + pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); - // Save the information in the INI file - SaveStatus_Impl(pChildWin, pCW->aInfo); - } + // Save the information in the INI file + SaveStatus_Impl(pChildWin, pCW->aInfo); } void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl *pCW ) @@ -2153,35 +2153,35 @@ void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW) } } - if ( pMod ) + if ( !pMod ) + return; + + SfxChildWinFactArr_Impl *pFactories = pMod->GetChildWinFactories_Impl(); + if ( !pFactories ) + return; + + SfxChildWinFactArr_Impl &rFactories = *pFactories; + for ( size_t nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { - SfxChildWinFactArr_Impl *pFactories = pMod->GetChildWinFactories_Impl(); - if ( pFactories ) + pFact = &rFactories[nFactory]; + if ( pFact->nId == pCW->nSaveId ) { - SfxChildWinFactArr_Impl &rFactories = *pFactories; - for ( size_t nFactory = 0; nFactory < rFactories.size(); ++nFactory ) - { - pFact = &rFactories[nFactory]; - if ( pFact->nId == pCW->nSaveId ) - { - pCW->aInfo = pFact->aInfo; - pCW->aInfo.aModule = sModule; - SfxChildWindow::InitializeChildWinFactory_Impl( - pCW->nSaveId, pCW->aInfo); - pCW->bCreate = pCW->aInfo.bVisible; - SfxChildWindowFlags nFlags = pFact->aInfo.nFlags; - if ( nFlags & SfxChildWindowFlags::TASK ) - pCW->aInfo.nFlags |= SfxChildWindowFlags::TASK; - if ( nFlags & SfxChildWindowFlags::CANTGETFOCUS ) - pCW->aInfo.nFlags |= SfxChildWindowFlags::CANTGETFOCUS; - if ( nFlags & SfxChildWindowFlags::FORCEDOCK ) - pCW->aInfo.nFlags |= SfxChildWindowFlags::FORCEDOCK; - if ( nFlags & SfxChildWindowFlags::ALWAYSAVAILABLE ) - pCW->aInfo.nFlags |= SfxChildWindowFlags::ALWAYSAVAILABLE; - pFact->aInfo = pCW->aInfo; - return; - } - } + pCW->aInfo = pFact->aInfo; + pCW->aInfo.aModule = sModule; + SfxChildWindow::InitializeChildWinFactory_Impl( + pCW->nSaveId, pCW->aInfo); + pCW->bCreate = pCW->aInfo.bVisible; + SfxChildWindowFlags nFlags = pFact->aInfo.nFlags; + if ( nFlags & SfxChildWindowFlags::TASK ) + pCW->aInfo.nFlags |= SfxChildWindowFlags::TASK; + if ( nFlags & SfxChildWindowFlags::CANTGETFOCUS ) + pCW->aInfo.nFlags |= SfxChildWindowFlags::CANTGETFOCUS; + if ( nFlags & SfxChildWindowFlags::FORCEDOCK ) + pCW->aInfo.nFlags |= SfxChildWindowFlags::FORCEDOCK; + if ( nFlags & SfxChildWindowFlags::ALWAYSAVAILABLE ) + pCW->aInfo.nFlags |= SfxChildWindowFlags::ALWAYSAVAILABLE; + pFact->aInfo = pCW->aInfo; + return; } } } diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 062c969f0bc9..a17f43929ab5 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -902,189 +902,189 @@ void SfxFilterContainer::ReadSingleFilter_Impl( aResult = uno::Any(); } - if( aResult >>= lFilterProperties ) + if( !(aResult >>= lFilterProperties) ) + return; + + // collect information to add filter to container + // (attention: some information aren't available on filter directly ... you must search for corresponding type too!) + SfxFilterFlags nFlags = SfxFilterFlags::NONE; + SotClipboardFormatId nClipboardId = SotClipboardFormatId::NONE; + sal_Int32 nDocumentIconId = 0 ; + sal_Int32 nFormatVersion = 0 ; + OUString sMimeType ; + OUString sType ; + OUString sUIName ; + OUString sHumanName ; + OUString sDefaultTemplate ; + OUString sUserData ; + OUString sExtension ; + OUString sPattern ; + OUString sServiceName ; + bool bEnabled = true ; + + // first get directly available properties + sal_Int32 nFilterPropertyCount = lFilterProperties.getLength(); + sal_Int32 nFilterProperty = 0 ; + for( nFilterProperty=0; nFilterProperty<nFilterPropertyCount; ++nFilterProperty ) { - // collect information to add filter to container - // (attention: some information aren't available on filter directly ... you must search for corresponding type too!) - SfxFilterFlags nFlags = SfxFilterFlags::NONE; - SotClipboardFormatId nClipboardId = SotClipboardFormatId::NONE; - sal_Int32 nDocumentIconId = 0 ; - sal_Int32 nFormatVersion = 0 ; - OUString sMimeType ; - OUString sType ; - OUString sUIName ; - OUString sHumanName ; - OUString sDefaultTemplate ; - OUString sUserData ; - OUString sExtension ; - OUString sPattern ; - OUString sServiceName ; - bool bEnabled = true ; - - // first get directly available properties - sal_Int32 nFilterPropertyCount = lFilterProperties.getLength(); - sal_Int32 nFilterProperty = 0 ; - for( nFilterProperty=0; nFilterProperty<nFilterPropertyCount; ++nFilterProperty ) + if ( lFilterProperties[nFilterProperty].Name == "FileFormatVersion" ) { - if ( lFilterProperties[nFilterProperty].Name == "FileFormatVersion" ) - { - lFilterProperties[nFilterProperty].Value >>= nFormatVersion; - } - else if ( lFilterProperties[nFilterProperty].Name == "TemplateName" ) - { - lFilterProperties[nFilterProperty].Value >>= sDefaultTemplate; - } - else if ( lFilterProperties[nFilterProperty].Name == "Flags" ) - { - sal_Int32 nTmp(0); - lFilterProperties[nFilterProperty].Value >>= nTmp; - assert((nTmp & ~o3tl::typed_flags<SfxFilterFlags>::mask) == 0); - nFlags = static_cast<SfxFilterFlags>(nTmp); - } - else if ( lFilterProperties[nFilterProperty].Name == "UIName" ) - { - lFilterProperties[nFilterProperty].Value >>= sUIName; - } - else if ( lFilterProperties[nFilterProperty].Name == "UserData" ) - { - uno::Sequence< OUString > lUserData; - lFilterProperties[nFilterProperty].Value >>= lUserData; - sUserData = implc_convertStringlistToString( lUserData, ',', OUString() ); - } - else if ( lFilterProperties[nFilterProperty].Name == "DocumentService" ) + lFilterProperties[nFilterProperty].Value >>= nFormatVersion; + } + else if ( lFilterProperties[nFilterProperty].Name == "TemplateName" ) + { + lFilterProperties[nFilterProperty].Value >>= sDefaultTemplate; + } + else if ( lFilterProperties[nFilterProperty].Name == "Flags" ) + { + sal_Int32 nTmp(0); + lFilterProperties[nFilterProperty].Value >>= nTmp; + assert((nTmp & ~o3tl::typed_flags<SfxFilterFlags>::mask) == 0); + nFlags = static_cast<SfxFilterFlags>(nTmp); + } + else if ( lFilterProperties[nFilterProperty].Name == "UIName" ) + { + lFilterProperties[nFilterProperty].Value >>= sUIName; + } + else if ( lFilterProperties[nFilterProperty].Name == "UserData" ) + { + uno::Sequence< OUString > lUserData; + lFilterProperties[nFilterProperty].Value >>= lUserData; + sUserData = implc_convertStringlistToString( lUserData, ',', OUString() ); + } + else if ( lFilterProperties[nFilterProperty].Name == "DocumentService" ) + { + lFilterProperties[nFilterProperty].Value >>= sServiceName; + } + else if (lFilterProperties[nFilterProperty].Name == "ExportExtension") + { + // Extension preferred by the filter. This takes precedence + // over those that are given in the file format type. + lFilterProperties[nFilterProperty].Value >>= sExtension; + sExtension = "*." + sExtension; + } + else if ( lFilterProperties[nFilterProperty].Name == "Type" ) + { + lFilterProperties[nFilterProperty].Value >>= sType; + // Try to get filter .. but look for any exceptions! + // May be filter was deleted by another thread ... + try { - lFilterProperties[nFilterProperty].Value >>= sServiceName; + aResult = xTypeCFG->getByName( sType ); } - else if (lFilterProperties[nFilterProperty].Name == "ExportExtension") + catch (const container::NoSuchElementException&) { - // Extension preferred by the filter. This takes precedence - // over those that are given in the file format type. - lFilterProperties[nFilterProperty].Value >>= sExtension; - sExtension = "*." + sExtension; + aResult = uno::Any(); } - else if ( lFilterProperties[nFilterProperty].Name == "Type" ) - { - lFilterProperties[nFilterProperty].Value >>= sType; - // Try to get filter .. but look for any exceptions! - // May be filter was deleted by another thread ... - try - { - aResult = xTypeCFG->getByName( sType ); - } - catch (const container::NoSuchElementException&) - { - aResult = uno::Any(); - } - uno::Sequence< beans::PropertyValue > lTypeProperties; - if( aResult >>= lTypeProperties ) + uno::Sequence< beans::PropertyValue > lTypeProperties; + if( aResult >>= lTypeProperties ) + { + // get indirect available properties then (types) + sal_Int32 nTypePropertyCount = lTypeProperties.getLength(); + sal_Int32 nTypeProperty = 0 ; + for( nTypeProperty=0; nTypeProperty<nTypePropertyCount; ++nTypeProperty ) { - // get indirect available properties then (types) - sal_Int32 nTypePropertyCount = lTypeProperties.getLength(); - sal_Int32 nTypeProperty = 0 ; - for( nTypeProperty=0; nTypeProperty<nTypePropertyCount; ++nTypeProperty ) + if ( lTypeProperties[nTypeProperty].Name == "ClipboardFormat" ) { - if ( lTypeProperties[nTypeProperty].Name == "ClipboardFormat" ) - { - lTypeProperties[nTypeProperty].Value >>= sHumanName; - } - else if ( lTypeProperties[nTypeProperty].Name == "DocumentIconID" ) - { - lTypeProperties[nTypeProperty].Value >>= nDocumentIconId; - } - else if ( lTypeProperties[nTypeProperty].Name == "MediaType" ) - { - lTypeProperties[nTypeProperty].Value >>= sMimeType; - } - else if ( lTypeProperties[nTypeProperty].Name == "Extensions" ) - { - if (sExtension.isEmpty()) - { - uno::Sequence< OUString > lExtensions; - lTypeProperties[nTypeProperty].Value >>= lExtensions; - sExtension = implc_convertStringlistToString( lExtensions, ';', "*." ); - } - } - else if ( lTypeProperties[nTypeProperty].Name == "URLPattern" ) + lTypeProperties[nTypeProperty].Value >>= sHumanName; + } + else if ( lTypeProperties[nTypeProperty].Name == "DocumentIconID" ) + { + lTypeProperties[nTypeProperty].Value >>= nDocumentIconId; + } + else if ( lTypeProperties[nTypeProperty].Name == "MediaType" ) + { + lTypeProperties[nTypeProperty].Value >>= sMimeType; + } + else if ( lTypeProperties[nTypeProperty].Name == "Extensions" ) + { + if (sExtension.isEmpty()) { - uno::Sequence< OUString > lPattern; - lTypeProperties[nTypeProperty].Value >>= lPattern; - sPattern = implc_convertStringlistToString( lPattern, ';', OUString() ); + uno::Sequence< OUString > lExtensions; + lTypeProperties[nTypeProperty].Value >>= lExtensions; + sExtension = implc_convertStringlistToString( lExtensions, ';', "*." ); } } + else if ( lTypeProperties[nTypeProperty].Name == "URLPattern" ) + { + uno::Sequence< OUString > lPattern; + lTypeProperties[nTypeProperty].Value >>= lPattern; + sPattern = implc_convertStringlistToString( lPattern, ';', OUString() ); + } } } - else if ( lFilterProperties[nFilterProperty].Name == "Enabled" ) - { - lFilterProperties[nFilterProperty].Value >>= bEnabled; - } - + } + else if ( lFilterProperties[nFilterProperty].Name == "Enabled" ) + { + lFilterProperties[nFilterProperty].Value >>= bEnabled; } - if ( sServiceName.isEmpty() ) - return; + } - // old formats are found ... using HumanPresentableName! - if( !sHumanName.isEmpty() ) - { - nClipboardId = SotExchange::RegisterFormatName( sHumanName ); + if ( sServiceName.isEmpty() ) + return; - // For external filters ignore clipboard IDs - if(nFlags & SfxFilterFlags::STARONEFILTER) - { - nClipboardId = SotClipboardFormatId::NONE; - } - } - // register SfxFilter - // first erase module name from old filter names! - // e.g: "scalc: DIF" => "DIF" - sal_Int32 nStartRealName = sFilterName.indexOf( ": " ); - if( nStartRealName != -1 ) - { - SAL_WARN( "sfx.bastyp", "Old format, not supported!"); - sFilterName = sFilterName.copy( nStartRealName+2 ); - } + // old formats are found ... using HumanPresentableName! + if( !sHumanName.isEmpty() ) + { + nClipboardId = SotExchange::RegisterFormatName( sHumanName ); - std::shared_ptr<const SfxFilter> pFilter = bUpdate ? SfxFilter::GetFilterByName( sFilterName ) : nullptr; - if (!pFilter) - { - pFilter.reset(new SfxFilter( sFilterName , - sExtension , - nFlags , - nClipboardId , - sType , - sMimeType , - sUserData , - sServiceName , - bEnabled )); - rList.push_back( pFilter ); - } - else + // For external filters ignore clipboard IDs + if(nFlags & SfxFilterFlags::STARONEFILTER) { - SfxFilter* pFilt = const_cast<SfxFilter*>(pFilter.get()); - pFilt->maFilterName = sFilterName; - pFilt->aWildCard = WildCard(sExtension, ';'); - pFilt->nFormatType = nFlags; - pFilt->lFormat = nClipboardId; - pFilt->aTypeName = sType; - pFilt->aMimeType = sMimeType; - pFilt->aUserData = sUserData; - pFilt->aServiceName = sServiceName; - pFilt->mbEnabled = bEnabled; + nClipboardId = SotClipboardFormatId::NONE; } + } + // register SfxFilter + // first erase module name from old filter names! + // e.g: "scalc: DIF" => "DIF" + sal_Int32 nStartRealName = sFilterName.indexOf( ": " ); + if( nStartRealName != -1 ) + { + SAL_WARN( "sfx.bastyp", "Old format, not supported!"); + sFilterName = sFilterName.copy( nStartRealName+2 ); + } + std::shared_ptr<const SfxFilter> pFilter = bUpdate ? SfxFilter::GetFilterByName( sFilterName ) : nullptr; + if (!pFilter) + { + pFilter.reset(new SfxFilter( sFilterName , + sExtension , + nFlags , + nClipboardId , + sType , + sMimeType , + sUserData , + sServiceName , + bEnabled )); + rList.push_back( pFilter ); + } + else + { SfxFilter* pFilt = const_cast<SfxFilter*>(pFilter.get()); + pFilt->maFilterName = sFilterName; + pFilt->aWildCard = WildCard(sExtension, ';'); + pFilt->nFormatType = nFlags; + pFilt->lFormat = nClipboardId; + pFilt->aTypeName = sType; + pFilt->aMimeType = sMimeType; + pFilt->aUserData = sUserData; + pFilt->aServiceName = sServiceName; + pFilt->mbEnabled = bEnabled; + } - // Don't forget to set right UIName! - // Otherwise internal name is used as fallback ... - pFilt->SetUIName( sUIName ); - pFilt->SetDefaultTemplate( sDefaultTemplate ); - if( nFormatVersion ) - { - pFilt->SetVersion( nFormatVersion ); - } - pFilt->SetURLPattern(sPattern); + SfxFilter* pFilt = const_cast<SfxFilter*>(pFilter.get()); + + // Don't forget to set right UIName! + // Otherwise internal name is used as fallback ... + pFilt->SetUIName( sUIName ); + pFilt->SetDefaultTemplate( sDefaultTemplate ); + if( nFormatVersion ) + { + pFilt->SetVersion( nFormatVersion ); } + pFilt->SetURLPattern(sPattern); } void SfxFilterContainer::ReadFilters_Impl( bool bUpdate ) diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index 327cd406f7d6..f5ba6bcf4b50 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -133,100 +133,100 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, sGenerator = sGenerator.replaceFirst( "%1", os ); OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_generator, sGenerator, false, eDestEnc, pNonConvertableChars ); - if( i_xDocProps.is() ) + if( !i_xDocProps.is() ) + return; + + // Reload + if( (i_xDocProps->getAutoloadSecs() != 0) || + !i_xDocProps->getAutoloadURL().isEmpty() ) { - // Reload - if( (i_xDocProps->getAutoloadSecs() != 0) || - !i_xDocProps->getAutoloadURL().isEmpty() ) + OUString sContent = OUString::number( + i_xDocProps->getAutoloadSecs() ); + + const OUString &rReloadURL = i_xDocProps->getAutoloadURL(); + if( !rReloadURL.isEmpty() ) { - OUString sContent = OUString::number( - i_xDocProps->getAutoloadSecs() ); + sContent += ";URL="; + sContent += URIHelper::simpleNormalizedMakeRelative( + rBaseURL, rReloadURL); + } - const OUString &rReloadURL = i_xDocProps->getAutoloadURL(); - if( !rReloadURL.isEmpty() ) - { - sContent += ";URL="; - sContent += URIHelper::simpleNormalizedMakeRelative( - rBaseURL, rReloadURL); - } + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_refresh, sContent, true, + eDestEnc, pNonConvertableChars ); + } - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_refresh, sContent, true, - eDestEnc, pNonConvertableChars ); - } + // Author + const OUString& rAuthor = i_xDocProps->getAuthor(); + if( !rAuthor.isEmpty() ) + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_author, rAuthor, false, + eDestEnc, pNonConvertableChars ); - // Author - const OUString& rAuthor = i_xDocProps->getAuthor(); - if( !rAuthor.isEmpty() ) - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_author, rAuthor, false, - eDestEnc, pNonConvertableChars ); + // created + ::util::DateTime uDT = i_xDocProps->getCreationDate(); + OUStringBuffer aBuffer; + ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT); - // created - ::util::DateTime uDT = i_xDocProps->getCreationDate(); - OUStringBuffer aBuffer; - ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT); + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_created, aBuffer.makeStringAndClear(), false, + eDestEnc, pNonConvertableChars ); - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_created, aBuffer.makeStringAndClear(), false, + // changedby + const OUString& rChangedBy = i_xDocProps->getModifiedBy(); + if( !rChangedBy.isEmpty() ) + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changedby, rChangedBy, false, eDestEnc, pNonConvertableChars ); - // changedby - const OUString& rChangedBy = i_xDocProps->getModifiedBy(); - if( !rChangedBy.isEmpty() ) - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changedby, rChangedBy, false, - eDestEnc, pNonConvertableChars ); + // changed + uDT = i_xDocProps->getModificationDate(); + ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT); - // changed - uDT = i_xDocProps->getModificationDate(); - ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT); + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changed, aBuffer.makeStringAndClear(), false, + eDestEnc, pNonConvertableChars ); - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changed, aBuffer.makeStringAndClear(), false, + // Subject + const OUString& rTheme = i_xDocProps->getSubject(); + if( !rTheme.isEmpty() ) + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_classification, rTheme, false, eDestEnc, pNonConvertableChars ); - // Subject - const OUString& rTheme = i_xDocProps->getSubject(); - if( !rTheme.isEmpty() ) - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_classification, rTheme, false, + // Description + const OUString& rComment = i_xDocProps->getDescription(); + if( !rComment.isEmpty() ) + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_description, rComment, false, + eDestEnc, pNonConvertableChars); + + // Keywords + OUString Keywords = ::comphelper::string::convertCommaSeparated( + i_xDocProps->getKeywords()); + if( !Keywords.isEmpty() ) + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_keywords, Keywords, false, + eDestEnc, pNonConvertableChars); + + uno::Reference < script::XTypeConverter > xConverter( script::Converter::create( + ::comphelper::getProcessComponentContext() ) ); + uno::Reference<beans::XPropertySet> xUserDefinedProps( + i_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySetInfo> xPropInfo = + xUserDefinedProps->getPropertySetInfo(); + DBG_ASSERT(xPropInfo.is(), "UserDefinedProperties Info is null"); + uno::Sequence<beans::Property> props = xPropInfo->getProperties(); + for (sal_Int32 i = 0; i < props.getLength(); ++i) + { + try + { + OUString name = props[i].Name; + uno::Any aStr = xConverter->convertToSimpleType( + xUserDefinedProps->getPropertyValue(name), + uno::TypeClass_STRING); + OUString str; + aStr >>= str; + OUString valstr(comphelper::string::stripEnd(str, ' ')); + OutMeta( rStrm, pIndent, name, valstr, false, eDestEnc, pNonConvertableChars ); - - // Description - const OUString& rComment = i_xDocProps->getDescription(); - if( !rComment.isEmpty() ) - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_description, rComment, false, - eDestEnc, pNonConvertableChars); - - // Keywords - OUString Keywords = ::comphelper::string::convertCommaSeparated( - i_xDocProps->getKeywords()); - if( !Keywords.isEmpty() ) - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_keywords, Keywords, false, - eDestEnc, pNonConvertableChars); - - uno::Reference < script::XTypeConverter > xConverter( script::Converter::create( - ::comphelper::getProcessComponentContext() ) ); - uno::Reference<beans::XPropertySet> xUserDefinedProps( - i_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - uno::Reference<beans::XPropertySetInfo> xPropInfo = - xUserDefinedProps->getPropertySetInfo(); - DBG_ASSERT(xPropInfo.is(), "UserDefinedProperties Info is null"); - uno::Sequence<beans::Property> props = xPropInfo->getProperties(); - for (sal_Int32 i = 0; i < props.getLength(); ++i) + } + catch (const uno::Exception&) { - try - { - OUString name = props[i].Name; - uno::Any aStr = xConverter->convertToSimpleType( - xUserDefinedProps->getPropertyValue(name), - uno::TypeClass_STRING); - OUString str; - aStr >>= str; - OUString valstr(comphelper::string::stripEnd(str, ' ')); - OutMeta( rStrm, pIndent, name, valstr, false, - eDestEnc, pNonConvertableChars ); - } - catch (const uno::Exception&) - { - // may happen with concurrent modification... - SAL_INFO("sfx", "SfxFrameHTMLWriter::Out_DocInfo: exception"); - } + // may happen with concurrent modification... + SAL_INFO("sfx", "SfxFrameHTMLWriter::Out_DocInfo: exception"); } } } diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 0659564edf16..a1eb0394c1ec 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -268,35 +268,35 @@ void SfxProgress::Resume() { if( pImpl->pActiveProgress ) return; - if ( bSuspended ) - { - SAL_INFO("sfx.bastyp", "SfxProgress: resumed"); - if ( pImpl->xStatusInd.is() ) - { - pImpl->xStatusInd->start( pImpl->aText, pImpl->nMax ); - pImpl->xStatusInd->setValue( nVal ); - } + if ( !bSuspended ) + return; - if ( pImpl->bWaitMode ) - { - if ( pImpl->xObjSh.is() ) - { - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh.get() ); - pFrame; - pFrame = SfxViewFrame::GetNext( *pFrame, pImpl->xObjSh.get() ) ) - pFrame->GetWindow().EnterWait(); - } - } + SAL_INFO("sfx.bastyp", "SfxProgress: resumed"); + if ( pImpl->xStatusInd.is() ) + { + pImpl->xStatusInd->start( pImpl->aText, pImpl->nMax ); + pImpl->xStatusInd->setValue( nVal ); + } + if ( pImpl->bWaitMode ) + { if ( pImpl->xObjSh.is() ) { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh.get()); - if ( pFrame ) - pFrame->GetBindings().ENTERREGISTRATIONS(); + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh.get() ); + pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, pImpl->xObjSh.get() ) ) + pFrame->GetWindow().EnterWait(); } + } - bSuspended = false; + if ( pImpl->xObjSh.is() ) + { + SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh.get()); + if ( pFrame ) + pFrame->GetBindings().ENTERREGISTRATIONS(); } + + bSuspended = false; } @@ -313,30 +313,30 @@ void SfxProgress::Suspend() { if( pImpl->pActiveProgress ) return; - if ( !bSuspended ) - { - SAL_INFO("sfx.bastyp", "SfxProgress: suspended"); - bSuspended = true; + if ( bSuspended ) + return; - if ( pImpl->xStatusInd.is() ) - { - pImpl->xStatusInd->reset(); - } + SAL_INFO("sfx.bastyp", "SfxProgress: suspended"); + bSuspended = true; - if ( pImpl->xObjSh.is() ) - { - for ( SfxViewFrame *pFrame = - SfxViewFrame::GetFirst(pImpl->xObjSh.get()); - pFrame; - pFrame = SfxViewFrame::GetNext( *pFrame, pImpl->xObjSh.get() ) ) - pFrame->GetWindow().LeaveWait(); - } - if ( pImpl->xObjSh.is() ) - { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pImpl->xObjSh.get() ); - if ( pFrame ) - pFrame->GetBindings().LEAVEREGISTRATIONS(); - } + if ( pImpl->xStatusInd.is() ) + { + pImpl->xStatusInd->reset(); + } + + if ( pImpl->xObjSh.is() ) + { + for ( SfxViewFrame *pFrame = + SfxViewFrame::GetFirst(pImpl->xObjSh.get()); + pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, pImpl->xObjSh.get() ) ) + pFrame->GetWindow().LeaveWait(); + } + if ( pImpl->xObjSh.is() ) + { + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pImpl->xObjSh.get() ); + if ( pFrame ) + pFrame->GetBindings().LEAVEREGISTRATIONS(); } } diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 1bf5a179bd0d..53f25cb95423 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -257,43 +257,43 @@ void SfxHTMLParser::GetScriptType_Impl( SvKeyValueIterator *pHTTPHeader ) { aScriptType = SVX_MACRO_LANGUAGE_JAVASCRIPT; eScriptType = JAVASCRIPT; - if( pHTTPHeader ) + if( !pHTTPHeader ) + return; + + SvKeyValue aKV; + for( bool bCont = pHTTPHeader->GetFirst( aKV ); bCont; + bCont = pHTTPHeader->GetNext( aKV ) ) { - SvKeyValue aKV; - for( bool bCont = pHTTPHeader->GetFirst( aKV ); bCont; - bCont = pHTTPHeader->GetNext( aKV ) ) + if( aKV.GetKey().equalsIgnoreAsciiCase( + OOO_STRING_SVTOOLS_HTML_META_content_script_type ) ) { - if( aKV.GetKey().equalsIgnoreAsciiCase( - OOO_STRING_SVTOOLS_HTML_META_content_script_type ) ) + if( !aKV.GetValue().isEmpty() ) { - if( !aKV.GetValue().isEmpty() ) + OUString aTmp( aKV.GetValue() ); + if( aTmp.startsWithIgnoreAsciiCase( "text/" ) ) + aTmp = aTmp.copy( 5 ); + else if( aTmp.startsWithIgnoreAsciiCase( "application/" ) ) + aTmp = aTmp.copy( 12 ); + else + break; + + if( aTmp.startsWithIgnoreAsciiCase( "x-" ) ) // MIME-experimental + { + aTmp = aTmp.copy( 2 ); + } + + if( aTmp.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_LG_starbasic ) ) + { + eScriptType = STARBASIC; + aScriptType = SVX_MACRO_LANGUAGE_STARBASIC; + } + if( !aTmp.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_LG_javascript ) ) { - OUString aTmp( aKV.GetValue() ); - if( aTmp.startsWithIgnoreAsciiCase( "text/" ) ) - aTmp = aTmp.copy( 5 ); - else if( aTmp.startsWithIgnoreAsciiCase( "application/" ) ) - aTmp = aTmp.copy( 12 ); - else - break; - - if( aTmp.startsWithIgnoreAsciiCase( "x-" ) ) // MIME-experimental - { - aTmp = aTmp.copy( 2 ); - } - - if( aTmp.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_LG_starbasic ) ) - { - eScriptType = STARBASIC; - aScriptType = SVX_MACRO_LANGUAGE_STARBASIC; - } - if( !aTmp.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_LG_javascript ) ) - { - eScriptType = EXTENDED_STYPE; - aScriptType = aTmp; - } + eScriptType = EXTENDED_STYPE; + aScriptType = aTmp; } - break; } + break; } } } diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index af680f3ff7ec..1e664d6371e3 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -192,30 +192,30 @@ static void PropagateEvent_Impl( SfxObjectShell const *pDoc, const OUString& aEv uno::UNO_QUERY ); } - if ( xSupplier.is() ) + if ( !xSupplier.is() ) + return; + + uno::Reference < container::XNameReplace > xEvents = xSupplier->getEvents(); + if ( !aEventName.isEmpty() ) { - uno::Reference < container::XNameReplace > xEvents = xSupplier->getEvents(); - if ( !aEventName.isEmpty() ) + uno::Any aEventData = CreateEventData_Impl( pMacro ); + + try + { + xEvents->replaceByName( aEventName, aEventData ); + } + catch( const css::lang::IllegalArgumentException& ) { - uno::Any aEventData = CreateEventData_Impl( pMacro ); - - try - { - xEvents->replaceByName( aEventName, aEventData ); - } - catch( const css::lang::IllegalArgumentException& ) - { - SAL_WARN( "sfx.config", "PropagateEvents_Impl: caught IllegalArgumentException" ); - } - catch( const css::container::NoSuchElementException& ) - { - SAL_WARN( "sfx.config", "PropagateEvents_Impl: caught NoSuchElementException" ); - } + SAL_WARN( "sfx.config", "PropagateEvents_Impl: caught IllegalArgumentException" ); } - else { - SAL_INFO( "sfx.config", "PropagateEvents_Impl: Got unknown event" ); + catch( const css::container::NoSuchElementException& ) + { + SAL_WARN( "sfx.config", "PropagateEvents_Impl: caught NoSuchElementException" ); } } + else { + SAL_INFO( "sfx.config", "PropagateEvents_Impl: Got unknown event" ); + } } diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 0a4e1fcc7169..2c8e71e96dee 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -317,51 +317,51 @@ void SfxBindings::Update pImpl->pSubBindings->Update( nId ); SfxStateCache* pCache = GetStateCache( nId ); - if ( pCache ) + if ( !pCache ) + return; + + pImpl->bInUpdate = true; + if ( pImpl->bMsgDirty ) { - pImpl->bInUpdate = true; - if ( pImpl->bMsgDirty ) + UpdateSlotServer_Impl(); + pCache = GetStateCache( nId ); + } + + if (pCache) + { + bool bInternalUpdate = true; + if( pCache->GetDispatch().is() && pCache->GetItemLink() ) { - UpdateSlotServer_Impl(); - pCache = GetStateCache( nId ); + pCache->SetCachedState(true); + bInternalUpdate = ( pCache->GetInternalController() != nullptr ); } - if (pCache) + if ( bInternalUpdate ) { - bool bInternalUpdate = true; - if( pCache->GetDispatch().is() && pCache->GetItemLink() ) + // Query Status + const SfxSlotServer* pMsgServer = pDispatcher ? pCache->GetSlotServer(*pDispatcher, pImpl->xProv) : nullptr; + if ( !pCache->IsControllerDirty() ) { - pCache->SetCachedState(true); - bInternalUpdate = ( pCache->GetInternalController() != nullptr ); + pImpl->bInUpdate = false; + InvalidateSlotsInMap_Impl(); + return; } - - if ( bInternalUpdate ) + if (!pMsgServer) { - // Query Status - const SfxSlotServer* pMsgServer = pDispatcher ? pCache->GetSlotServer(*pDispatcher, pImpl->xProv) : nullptr; - if ( !pCache->IsControllerDirty() ) - { - pImpl->bInUpdate = false; - InvalidateSlotsInMap_Impl(); - return; - } - if (!pMsgServer) - { - pCache->SetState(SfxItemState::DISABLED, nullptr); - pImpl->bInUpdate = false; - InvalidateSlotsInMap_Impl(); - return; - } - - Update_Impl(*pCache); + pCache->SetState(SfxItemState::DISABLED, nullptr); + pImpl->bInUpdate = false; + InvalidateSlotsInMap_Impl(); + return; } - pImpl->bAllDirty = false; + Update_Impl(*pCache); } - pImpl->bInUpdate = false; - InvalidateSlotsInMap_Impl(); + pImpl->bAllDirty = false; } + + pImpl->bInUpdate = false; + InvalidateSlotsInMap_Impl(); } @@ -370,19 +370,19 @@ void SfxBindings::Update() if ( pImpl->pSubBindings ) pImpl->pSubBindings->Update(); - if ( pDispatcher ) - { - if ( nRegLevel ) - return; + if ( !pDispatcher ) + return; - pImpl->bInUpdate = true; - pDispatcher->Flush(); - pDispatcher->Update_Impl(); - while ( !NextJob_Impl(nullptr) ) - ; // loop - pImpl->bInUpdate = false; ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits