sdext/source/minimizer/configurationaccess.cxx | 130 +++--- sdext/source/minimizer/graphiccollector.cxx | 84 ++-- sdext/source/minimizer/impoptimizer.cxx | 228 +++++------ sdext/source/minimizer/optimizerdialog.cxx | 136 +++--- sdext/source/minimizer/pppoptimizerdialog.cxx | 68 +-- sdext/source/pdfimport/pdfparse/pdfentries.cxx | 26 - sdext/source/pdfimport/sax/emitcontext.cxx | 64 +-- sdext/source/pdfimport/tree/drawtreevisiting.cxx | 34 - sdext/source/pdfimport/tree/pdfiprocessor.cxx | 32 - sdext/source/pdfimport/tree/style.cxx | 38 - sdext/source/pdfimport/tree/writertreevisiting.cxx | 142 +++--- sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 96 ++-- sdext/source/presenter/PresenterBitmapContainer.cxx | 62 +-- sdext/source/presenter/PresenterButton.cxx | 74 +-- sdext/source/presenter/PresenterConfigurationAccess.cxx | 46 +- sdext/source/presenter/PresenterController.cxx | 58 +- sdext/source/presenter/PresenterHelpView.cxx | 24 - sdext/source/presenter/PresenterNotesView.cxx | 142 +++--- sdext/source/presenter/PresenterPaneBase.cxx | 83 ++-- sdext/source/presenter/PresenterPaneBorderPainter.cxx | 154 +++---- sdext/source/presenter/PresenterPaneContainer.cxx | 82 ++-- sdext/source/presenter/PresenterPaneFactory.cxx | 34 - sdext/source/presenter/PresenterProtocolHandler.cxx | 22 - sdext/source/presenter/PresenterScreen.cxx | 38 - sdext/source/presenter/PresenterScrollBar.cxx | 178 ++++---- sdext/source/presenter/PresenterSlideShowView.cxx | 38 - sdext/source/presenter/PresenterSlideSorter.cxx | 158 +++---- sdext/source/presenter/PresenterSprite.cxx | 44 +- sdext/source/presenter/PresenterTextView.cxx | 71 +-- sdext/source/presenter/PresenterTheme.cxx | 62 +-- sdext/source/presenter/PresenterToolBar.cxx | 130 +++--- sdext/source/presenter/PresenterUIPainter.cxx | 92 ++-- sdext/source/presenter/PresenterViewFactory.cxx | 26 - sdext/source/presenter/PresenterWindowManager.cxx | 328 ++++++++-------- 34 files changed, 1511 insertions(+), 1513 deletions(-)
New commits: commit 58e31745600757f3d95085e67aa6bf13d7b9878b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Feb 12 12:31:47 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Feb 12 13:01:50 2019 +0100 loplugin:flatten in sdext Change-Id: I5a7c2d38ef2e4af54316becd807bffab83d402d0 Reviewed-on: https://gerrit.libreoffice.org/67715 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sdext/source/minimizer/configurationaccess.cxx b/sdext/source/minimizer/configurationaccess.cxx index f7978379761b..f0e16bd12461 100644 --- a/sdext/source/minimizer/configurationaccess.cxx +++ b/sdext/source/minimizer/configurationaccess.cxx @@ -41,89 +41,89 @@ static OUString GetPathToConfigurationRoot() void OptimizerSettings::LoadSettingsFromConfiguration( const Reference< XNameAccess >& rSettings ) { - if ( rSettings.is() ) + if ( !rSettings.is() ) + return; + + const Sequence< OUString > aElements( rSettings->getElementNames() ); + for ( int i = 0; i < aElements.getLength(); i++ ) { - const Sequence< OUString > aElements( rSettings->getElementNames() ); - for ( int i = 0; i < aElements.getLength(); i++ ) + try { - try + const OUString aPropertyName( aElements[ i ] ); + Any aValue( rSettings->getByName( aPropertyName ) ); + switch( TKGet( aPropertyName ) ) { - const OUString aPropertyName( aElements[ i ] ); - Any aValue( rSettings->getByName( aPropertyName ) ); - switch( TKGet( aPropertyName ) ) - { - case TK_Name : aValue >>= maName; break; - case TK_JPEGCompression : aValue >>= mbJPEGCompression; break; - case TK_JPEGQuality : aValue >>= mnJPEGQuality; break; - case TK_RemoveCropArea : aValue >>= mbRemoveCropArea; break; - case TK_ImageResolution : aValue >>= mnImageResolution; break; - case TK_EmbedLinkedGraphics : aValue >>= mbEmbedLinkedGraphics; break; - case TK_OLEOptimization : aValue >>= mbOLEOptimization; break; - case TK_OLEOptimizationType : aValue >>= mnOLEOptimizationType; break; - case TK_DeleteUnusedMasterPages : aValue >>= mbDeleteUnusedMasterPages; break; - case TK_DeleteHiddenSlides : aValue >>= mbDeleteHiddenSlides; break; - case TK_DeleteNotesPages : aValue >>= mbDeleteNotesPages ;break; - case TK_SaveAs : aValue >>= mbSaveAs; break; + case TK_Name : aValue >>= maName; break; + case TK_JPEGCompression : aValue >>= mbJPEGCompression; break; + case TK_JPEGQuality : aValue >>= mnJPEGQuality; break; + case TK_RemoveCropArea : aValue >>= mbRemoveCropArea; break; + case TK_ImageResolution : aValue >>= mnImageResolution; break; + case TK_EmbedLinkedGraphics : aValue >>= mbEmbedLinkedGraphics; break; + case TK_OLEOptimization : aValue >>= mbOLEOptimization; break; + case TK_OLEOptimizationType : aValue >>= mnOLEOptimizationType; break; + case TK_DeleteUnusedMasterPages : aValue >>= mbDeleteUnusedMasterPages; break; + case TK_DeleteHiddenSlides : aValue >>= mbDeleteHiddenSlides; break; + case TK_DeleteNotesPages : aValue >>= mbDeleteNotesPages ;break; + case TK_SaveAs : aValue >>= mbSaveAs; break; // case TK_SaveAsURL : aValue >>= maSaveAsURL; break; // URL is not saved to configuration // case TK_FilterName : aValue >>= maFilterName; break; // URL is not saved to configuration - case TK_OpenNewDocument : aValue >>= mbOpenNewDocument; break; - default: break; - } - } - catch (const Exception&) - { + case TK_OpenNewDocument : aValue >>= mbOpenNewDocument; break; + default: break; } } + catch (const Exception&) + { + } } } void OptimizerSettings::SaveSettingsToConfiguration( const Reference< XNameReplace >& rSettings ) { - if ( rSettings.is() ) - { - OUString pNames[] = { - OUString("Name"), - OUString("JPEGCompression"), - OUString("JPEGQuality"), - OUString("RemoveCropArea"), - OUString("ImageResolution"), - OUString("EmbedLinkedGraphics"), - OUString("OLEOptimization"), - OUString("OLEOptimizationType"), - OUString("DeleteUnusedMasterPages"), - OUString("DeleteHiddenSlides"), - OUString("DeleteNotesPages"), - OUString("SaveAs"), + if ( !rSettings.is() ) + return; + + OUString pNames[] = { + OUString("Name"), + OUString("JPEGCompression"), + OUString("JPEGQuality"), + OUString("RemoveCropArea"), + OUString("ImageResolution"), + OUString("EmbedLinkedGraphics"), + OUString("OLEOptimization"), + OUString("OLEOptimizationType"), + OUString("DeleteUnusedMasterPages"), + OUString("DeleteHiddenSlides"), + OUString("DeleteNotesPages"), + OUString("SaveAs"), // OUString("SaveAsURL"), // OUString("FilterName"), - OUString("OpenNewDocument") }; - - Any pValues[] = { - Any( maName ), - Any( mbJPEGCompression ), - Any( mnJPEGQuality ), - Any( mbRemoveCropArea ), - Any( mnImageResolution ), - Any( mbEmbedLinkedGraphics ), - Any( mbOLEOptimization ), - Any( mnOLEOptimizationType ), - Any( mbDeleteUnusedMasterPages ), - Any( mbDeleteHiddenSlides ), - Any( mbDeleteNotesPages ), - Any( mbSaveAs ), + OUString("OpenNewDocument") }; + + Any pValues[] = { + Any( maName ), + Any( mbJPEGCompression ), + Any( mnJPEGQuality ), + Any( mbRemoveCropArea ), + Any( mnImageResolution ), + Any( mbEmbedLinkedGraphics ), + Any( mbOLEOptimization ), + Any( mnOLEOptimizationType ), + Any( mbDeleteUnusedMasterPages ), + Any( mbDeleteHiddenSlides ), + Any( mbDeleteNotesPages ), + Any( mbSaveAs ), // Any( maSaveAsURL ), // Any( maFilterName ), - Any( mbOpenNewDocument ) }; + Any( mbOpenNewDocument ) }; - for ( int i = 0; i < int(SAL_N_ELEMENTS( pNames )); i++ ) + for ( int i = 0; i < int(SAL_N_ELEMENTS( pNames )); i++ ) + { + try + { + rSettings->replaceByName( pNames[ i ], pValues[ i ] ); + } + catch (const Exception&) { - try - { - rSettings->replaceByName( pNames[ i ], pValues[ i ] ); - } - catch (const Exception&) - { - } } } } diff --git a/sdext/source/minimizer/graphiccollector.cxx b/sdext/source/minimizer/graphiccollector.cxx index c0ca3d57f4a0..73cd5195e51e 100644 --- a/sdext/source/minimizer/graphiccollector.cxx +++ b/sdext/source/minimizer/graphiccollector.cxx @@ -60,25 +60,25 @@ const DeviceInfo& GraphicCollector::GetDeviceInfo( const Reference< XComponentCo static void ImpAddEntity( std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities, const GraphicSettings& rGraphicSettings, const GraphicCollector::GraphicUser& rUser ) { - if ( rGraphicSettings.mbEmbedLinkedGraphics ) + if ( !rGraphicSettings.mbEmbedLinkedGraphics ) + return; + + auto aIter = std::find_if(rGraphicEntities.begin(), rGraphicEntities.end(), + [&rUser](const GraphicCollector::GraphicEntity& rGraphicEntity) { + return rGraphicEntity.maUser[ 0 ].mxGraphic == rUser.mxGraphic; + }); + if ( aIter == rGraphicEntities.end() ) { - auto aIter = std::find_if(rGraphicEntities.begin(), rGraphicEntities.end(), - [&rUser](const GraphicCollector::GraphicEntity& rGraphicEntity) { - return rGraphicEntity.maUser[ 0 ].mxGraphic == rUser.mxGraphic; - }); - if ( aIter == rGraphicEntities.end() ) - { - GraphicCollector::GraphicEntity aEntity( rUser ); - rGraphicEntities.push_back( aEntity ); - } - else - { - if ( rUser.maLogicalSize.Width > aIter->maLogicalSize.Width ) - aIter->maLogicalSize.Width = rUser.maLogicalSize.Width; - if ( rUser.maLogicalSize.Height > aIter->maLogicalSize.Height ) - aIter->maLogicalSize.Height = rUser.maLogicalSize.Height; - aIter->maUser.push_back( rUser ); - } + GraphicCollector::GraphicEntity aEntity( rUser ); + rGraphicEntities.push_back( aEntity ); + } + else + { + if ( rUser.maLogicalSize.Width > aIter->maLogicalSize.Width ) + aIter->maLogicalSize.Width = rUser.maLogicalSize.Width; + if ( rUser.maLogicalSize.Height > aIter->maLogicalSize.Height ) + aIter->maLogicalSize.Height = rUser.maLogicalSize.Height; + aIter->maUser.push_back( rUser ); } } @@ -86,37 +86,37 @@ static void ImpAddGraphicEntity( const Reference< XComponentContext >& rxMSF, Re { Reference< XGraphic > xGraphic; Reference< XPropertySet > xShapePropertySet( rxShape, UNO_QUERY_THROW ); - if ( xShapePropertySet->getPropertyValue( "Graphic" ) >>= xGraphic ) - { - text::GraphicCrop aGraphicCropLogic( 0, 0, 0, 0 ); + if ( !(xShapePropertySet->getPropertyValue( "Graphic" ) >>= xGraphic) ) + return; + + text::GraphicCrop aGraphicCropLogic( 0, 0, 0, 0 ); - GraphicCollector::GraphicUser aUser; - aUser.mxShape = rxShape; - aUser.mbFillBitmap = false; - aUser.mxGraphic = xGraphic; - xShapePropertySet->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropLogic; - awt::Size aLogicalSize( rxShape->getSize() ); + GraphicCollector::GraphicUser aUser; + aUser.mxShape = rxShape; + aUser.mbFillBitmap = false; + aUser.mxGraphic = xGraphic; + xShapePropertySet->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropLogic; + awt::Size aLogicalSize( rxShape->getSize() ); - // calculating the logical size, as if there were no cropping - if ( aGraphicCropLogic.Left || aGraphicCropLogic.Right || aGraphicCropLogic.Top || aGraphicCropLogic.Bottom ) + // calculating the logical size, as if there were no cropping + if ( aGraphicCropLogic.Left || aGraphicCropLogic.Right || aGraphicCropLogic.Top || aGraphicCropLogic.Bottom ) + { + awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) ); + if ( aSize100thMM.Width && aSize100thMM.Height ) { - awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) ); - if ( aSize100thMM.Width && aSize100thMM.Height ) + awt::Size aCropSize( aSize100thMM.Width - ( aGraphicCropLogic.Left + aGraphicCropLogic.Right ), + aSize100thMM.Height - ( aGraphicCropLogic.Top + aGraphicCropLogic.Bottom )); + if ( aCropSize.Width && aCropSize.Height ) { - awt::Size aCropSize( aSize100thMM.Width - ( aGraphicCropLogic.Left + aGraphicCropLogic.Right ), - aSize100thMM.Height - ( aGraphicCropLogic.Top + aGraphicCropLogic.Bottom )); - if ( aCropSize.Width && aCropSize.Height ) - { - awt::Size aNewLogSize( static_cast< sal_Int32 >( static_cast< double >( aSize100thMM.Width * aLogicalSize.Width ) / aCropSize.Width ), - static_cast< sal_Int32 >( static_cast< double >( aSize100thMM.Height * aLogicalSize.Height ) / aCropSize.Height ) ); - aLogicalSize = aNewLogSize; - } + awt::Size aNewLogSize( static_cast< sal_Int32 >( static_cast< double >( aSize100thMM.Width * aLogicalSize.Width ) / aCropSize.Width ), + static_cast< sal_Int32 >( static_cast< double >( aSize100thMM.Height * aLogicalSize.Height ) / aCropSize.Height ) ); + aLogicalSize = aNewLogSize; } } - aUser.maGraphicCropLogic = aGraphicCropLogic; - aUser.maLogicalSize = aLogicalSize; - ImpAddEntity( rGraphicEntities, rGraphicSettings, aUser ); } + aUser.maGraphicCropLogic = aGraphicCropLogic; + aUser.maLogicalSize = aLogicalSize; + ImpAddEntity( rGraphicEntities, rGraphicSettings, aUser ); } static void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxMSF, const Reference< XPropertySet >& rxPropertySet, const awt::Size& rLogicalSize, diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index 520001fedabd..b8d8d5c3a33e 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -574,151 +574,151 @@ static void DispatchURL( const Reference< XComponentContext >& xContext, const O void ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments ) { - if ( mxModel.is() ) - { - sal_Int64 nEstimatedFileSize = 0; - SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 0 ) ) ); - DispatchStatus(); + if ( !mxModel.is() ) + return; + + sal_Int64 nEstimatedFileSize = 0; + SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 0 ) ) ); + DispatchStatus(); - int i, nICount; - for ( i = 0, nICount = rArguments.getLength(); i < nICount; i++ ) + int i, nICount; + for ( i = 0, nICount = rArguments.getLength(); i < nICount; i++ ) + { + switch( TKGet( rArguments[ i ].Name ) ) { - switch( TKGet( rArguments[ i ].Name ) ) + case TK_StatusDispatcher : rArguments[ i ].Value >>= mxStatusDispatcher; break; + case TK_InformationDialog: rArguments[ i ].Value >>= mxInformationDialog; break; + case TK_Settings : { - case TK_StatusDispatcher : rArguments[ i ].Value >>= mxStatusDispatcher; break; - case TK_InformationDialog: rArguments[ i ].Value >>= mxInformationDialog; break; - case TK_Settings : + css::uno::Sequence< css::beans::PropertyValue > aSettings; + int j, nJCount; + rArguments[ i ].Value >>= aSettings; + for ( j = 0, nJCount = aSettings.getLength(); j < nJCount; j++ ) { - css::uno::Sequence< css::beans::PropertyValue > aSettings; - int j, nJCount; - rArguments[ i ].Value >>= aSettings; - for ( j = 0, nJCount = aSettings.getLength(); j < nJCount; j++ ) + switch( TKGet( aSettings[ j ].Name ) ) { - switch( TKGet( aSettings[ j ].Name ) ) - { - case TK_JPEGCompression : aSettings[ j ].Value >>= mbJPEGCompression; break; - case TK_JPEGQuality : aSettings[ j ].Value >>= mnJPEGQuality; break; - case TK_RemoveCropArea : aSettings[ j ].Value >>= mbRemoveCropArea; break; - case TK_ImageResolution : aSettings[ j ].Value >>= mnImageResolution; break; - case TK_EmbedLinkedGraphics : aSettings[ j ].Value >>= mbEmbedLinkedGraphics; break; - case TK_OLEOptimization : aSettings[ j ].Value >>= mbOLEOptimization; break; - case TK_OLEOptimizationType : aSettings[ j ].Value >>= mnOLEOptimizationType; break; - case TK_CustomShowName : aSettings[ j ].Value >>= maCustomShowName; break; - case TK_DeleteUnusedMasterPages : aSettings[ j ].Value >>= mbDeleteUnusedMasterPages; break; - case TK_DeleteHiddenSlides : aSettings[ j ].Value >>= mbDeleteHiddenSlides; break; - case TK_DeleteNotesPages : aSettings[ j ].Value >>= mbDeleteNotesPages; break; - case TK_SaveAsURL : aSettings[ j ].Value >>= maSaveAsURL; break; - case TK_FilterName : aSettings[ j ].Value >>= maFilterName; break; - case TK_OpenNewDocument : aSettings[ j ].Value >>= mbOpenNewDocument; break; - case TK_EstimatedFileSize : aSettings[ j ].Value >>= nEstimatedFileSize; break; - default: break; - } + case TK_JPEGCompression : aSettings[ j ].Value >>= mbJPEGCompression; break; + case TK_JPEGQuality : aSettings[ j ].Value >>= mnJPEGQuality; break; + case TK_RemoveCropArea : aSettings[ j ].Value >>= mbRemoveCropArea; break; + case TK_ImageResolution : aSettings[ j ].Value >>= mnImageResolution; break; + case TK_EmbedLinkedGraphics : aSettings[ j ].Value >>= mbEmbedLinkedGraphics; break; + case TK_OLEOptimization : aSettings[ j ].Value >>= mbOLEOptimization; break; + case TK_OLEOptimizationType : aSettings[ j ].Value >>= mnOLEOptimizationType; break; + case TK_CustomShowName : aSettings[ j ].Value >>= maCustomShowName; break; + case TK_DeleteUnusedMasterPages : aSettings[ j ].Value >>= mbDeleteUnusedMasterPages; break; + case TK_DeleteHiddenSlides : aSettings[ j ].Value >>= mbDeleteHiddenSlides; break; + case TK_DeleteNotesPages : aSettings[ j ].Value >>= mbDeleteNotesPages; break; + case TK_SaveAsURL : aSettings[ j ].Value >>= maSaveAsURL; break; + case TK_FilterName : aSettings[ j ].Value >>= maFilterName; break; + case TK_OpenNewDocument : aSettings[ j ].Value >>= mbOpenNewDocument; break; + case TK_EstimatedFileSize : aSettings[ j ].Value >>= nEstimatedFileSize; break; + default: break; } } - break; - default: break; } + break; + default: break; } + } + + sal_Int64 nSourceSize = 0; + sal_Int64 nDestSize = 0; - sal_Int64 nSourceSize = 0; - sal_Int64 nDestSize = 0; + Reference< XFrame > xSelf; + if ( !maSaveAsURL.isEmpty() ) + { + + SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 10 ) ) ); + SetStatusValue( TK_Status, Any( OUString("STR_DUPLICATING_PRESENTATION") ) ); + DispatchStatus(); - Reference< XFrame > xSelf; - if ( !maSaveAsURL.isEmpty() ) + Reference< XStorable >xStorable( mxModel, UNO_QUERY ); + if ( xStorable.is() ) { + if ( xStorable->hasLocation() ) + nSourceSize = PPPOptimizer::GetFileSize( xStorable->getLocation() ); - SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 10 ) ) ); + Sequence< PropertyValue > aArguments; + if ( !maFilterName.isEmpty() ) + { + int nLength = aArguments.getLength(); + aArguments.realloc( nLength + 1 ); + aArguments[ nLength ].Name = "FilterName"; + aArguments[ nLength ].Value <<= maFilterName; + } + xStorable->storeToURL( maSaveAsURL, aArguments ); + if ( !nSourceSize ) + nSourceSize = PPPOptimizer::GetFileSize( maSaveAsURL ); + + SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 30 ) ) ); SetStatusValue( TK_Status, Any( OUString("STR_DUPLICATING_PRESENTATION") ) ); DispatchStatus(); - Reference< XStorable >xStorable( mxModel, UNO_QUERY ); - if ( xStorable.is() ) - { - if ( xStorable->hasLocation() ) - nSourceSize = PPPOptimizer::GetFileSize( xStorable->getLocation() ); + Reference< XDesktop2 > xDesktop = Desktop::create( mxContext ); + xSelf = xDesktop->findFrame( "_blank", FrameSearchFlag::CREATE ); + Reference< XComponentLoader > xComponentLoader( xSelf, UNO_QUERY ); - Sequence< PropertyValue > aArguments; - if ( !maFilterName.isEmpty() ) - { - int nLength = aArguments.getLength(); - aArguments.realloc( nLength + 1 ); - aArguments[ nLength ].Name = "FilterName"; - aArguments[ nLength ].Value <<= maFilterName; - } - xStorable->storeToURL( maSaveAsURL, aArguments ); - if ( !nSourceSize ) - nSourceSize = PPPOptimizer::GetFileSize( maSaveAsURL ); - - SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 30 ) ) ); - SetStatusValue( TK_Status, Any( OUString("STR_DUPLICATING_PRESENTATION") ) ); - DispatchStatus(); - - Reference< XDesktop2 > xDesktop = Desktop::create( mxContext ); - xSelf = xDesktop->findFrame( "_blank", FrameSearchFlag::CREATE ); - Reference< XComponentLoader > xComponentLoader( xSelf, UNO_QUERY ); - - Sequence< PropertyValue > aLoadProps( 1 ); - aLoadProps[ 0 ].Name = "Hidden"; - aLoadProps[ 0 ].Value <<= true; - mxModel.set( xComponentLoader->loadComponentFromURL( - maSaveAsURL, "_self", 0, aLoadProps ), UNO_QUERY ); - } + Sequence< PropertyValue > aLoadProps( 1 ); + aLoadProps[ 0 ].Name = "Hidden"; + aLoadProps[ 0 ].Value <<= true; + mxModel.set( xComponentLoader->loadComponentFromURL( + maSaveAsURL, "_self", 0, aLoadProps ), UNO_QUERY ); } + } - // check if the document is ReadOnly -> error - Reference< XStorable > xStorable( mxModel, UNO_QUERY ); - if ( xStorable.is() && !xStorable->isReadonly() ) - { - mxModel->lockControllers(); - Optimize(); - mxModel->unlockControllers(); - - // clearing undo stack: - Reference< XFrame > xFrame( xSelf.is() ? xSelf : mxInformationDialog ); - if ( xFrame.is() ) - { - const OUString sSlot( "slot:27115" ); - DispatchURL( mxContext, sSlot, xFrame ); - } - } + // check if the document is ReadOnly -> error + Reference< XStorable > xStorable( mxModel, UNO_QUERY ); + if ( xStorable.is() && !xStorable->isReadonly() ) + { + mxModel->lockControllers(); + Optimize(); + mxModel->unlockControllers(); - if ( !maSaveAsURL.isEmpty() ) + // clearing undo stack: + Reference< XFrame > xFrame( xSelf.is() ? xSelf : mxInformationDialog ); + if ( xFrame.is() ) { - if ( xStorable.is() ) - { - xStorable->store(); - nDestSize = PPPOptimizer::GetFileSize( maSaveAsURL ); - } + const OUString sSlot( "slot:27115" ); + DispatchURL( mxContext, sSlot, xFrame ); } + } - if ( mxInformationDialog.is() ) + if ( !maSaveAsURL.isEmpty() ) + { + if ( xStorable.is() ) { - InformationDialog aInformationDialog( mxContext, mxInformationDialog, maSaveAsURL, mbOpenNewDocument, nSourceSize, nDestSize, nEstimatedFileSize ); - aInformationDialog.execute(); - SetStatusValue( TK_OpenNewDocument, Any( mbOpenNewDocument ) ); - DispatchStatus(); + xStorable->store(); + nDestSize = PPPOptimizer::GetFileSize( maSaveAsURL ); } + } + + if ( mxInformationDialog.is() ) + { + InformationDialog aInformationDialog( mxContext, mxInformationDialog, maSaveAsURL, mbOpenNewDocument, nSourceSize, nDestSize, nEstimatedFileSize ); + aInformationDialog.execute(); + SetStatusValue( TK_OpenNewDocument, Any( mbOpenNewDocument ) ); + DispatchStatus(); + } - if ( !maSaveAsURL.isEmpty() ) + if ( !maSaveAsURL.isEmpty() ) + { + if ( mbOpenNewDocument && xSelf.is() ) { - if ( mbOpenNewDocument && xSelf.is() ) - { - Reference< awt::XWindow > xContainerWindow( xSelf->getContainerWindow() ); - xContainerWindow->setVisible( true ); - } - else - { - Reference< XComponent > xComponent( mxModel, UNO_QUERY ); - xComponent->dispose(); - } + Reference< awt::XWindow > xContainerWindow( xSelf->getContainerWindow() ); + xContainerWindow->setVisible( true ); } - if ( nSourceSize && nDestSize ) + else { - SetStatusValue( TK_FileSizeSource, Any( nSourceSize ) ); - SetStatusValue( TK_FileSizeDestination, Any( nDestSize ) ); - DispatchStatus(); + Reference< XComponent > xComponent( mxModel, UNO_QUERY ); + xComponent->dispose(); } } + if ( nSourceSize && nDestSize ) + { + SetStatusValue( TK_FileSizeSource, Any( nSourceSize ) ); + SetStatusValue( TK_FileSizeDestination, Any( nDestSize ) ); + DispatchStatus(); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index a1056b3a2542..3da7dc6c2d93 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -177,21 +177,21 @@ void OptimizerDialog::UpdateConfiguration() } aAny = getControlProperty( "CheckBox3Pg3", "State" ); - if ( (aAny >>= nInt16) && nInt16 ) + if ( !((aAny >>= nInt16) && nInt16) ) + return; + + aAny = getControlProperty( "ListBox0Pg3", "SelectedItems" ); + if ( !(aAny >>= aSelectedItems) ) + return; + + if ( aSelectedItems.getLength() ) { - aAny = getControlProperty( "ListBox0Pg3", "SelectedItems" ); - if ( aAny >>= aSelectedItems ) + sal_Int16 nSelectedItem = aSelectedItems[ 0 ]; + aAny = getControlProperty( "ListBox0Pg3", "StringItemList" ); + if ( aAny >>= aStringItemList ) { - if ( aSelectedItems.getLength() ) - { - sal_Int16 nSelectedItem = aSelectedItems[ 0 ]; - aAny = getControlProperty( "ListBox0Pg3", "StringItemList" ); - if ( aAny >>= aStringItemList ) - { - if ( aStringItemList.getLength() > nSelectedItem ) - SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) ); - } - } + if ( aStringItemList.getLength() > nSelectedItem ) + SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) ); } } } @@ -251,27 +251,27 @@ void OptimizerDialog::execute() void OptimizerDialog::SwitchPage( sal_Int16 nNewStep ) { - if ( ( nNewStep != mnCurrentStep ) && ( nNewStep <= MAX_STEP ) && ( nNewStep >= 0 ) ) - { - sal_Int16 nOldStep = mnCurrentStep; - if ( nNewStep == 0 ) - disableControl( "btnNavBack" ); - else if ( nOldStep == 0 ) - enableControl( "btnNavBack" ); + if ( !(( nNewStep != mnCurrentStep ) && ( nNewStep <= MAX_STEP ) && ( nNewStep >= 0 )) ) + return; - if ( nNewStep == MAX_STEP ) - disableControl( "btnNavNext" ); - else if ( nOldStep == MAX_STEP ) - enableControl( "btnNavNext" ); + sal_Int16 nOldStep = mnCurrentStep; + if ( nNewStep == 0 ) + disableControl( "btnNavBack" ); + else if ( nOldStep == 0 ) + enableControl( "btnNavBack" ); - setControlProperty( "rdmNavi", "CurrentItemID", Any( nNewStep ) ); + if ( nNewStep == MAX_STEP ) + disableControl( "btnNavNext" ); + else if ( nOldStep == MAX_STEP ) + enableControl( "btnNavNext" ); - DeactivatePage( nOldStep ); - UpdateControlStates( nNewStep ); + setControlProperty( "rdmNavi", "CurrentItemID", Any( nNewStep ) ); - ActivatePage( nNewStep ); - mnCurrentStep = nNewStep; - } + DeactivatePage( nOldStep ); + UpdateControlStates( nNewStep ); + + ActivatePage( nNewStep ); + mnCurrentStep = nNewStep; } void OptimizerDialog::UpdateControlStates( sal_Int16 nPage ) @@ -317,32 +317,32 @@ OUString OptimizerDialog::GetSelectedString( OUString const & token ) void OptimizerDialog::UpdateStatus( const css::uno::Sequence< css::beans::PropertyValue >& rStatus ) { - if ( mxReschedule.is() ) + if ( !mxReschedule.is() ) + return; + + maStats.InitializeStatusValues( rStatus ); + const Any* pVal( maStats.GetStatusValue( TK_Status ) ); + if ( pVal ) { - maStats.InitializeStatusValues( rStatus ); - const Any* pVal( maStats.GetStatusValue( TK_Status ) ); - if ( pVal ) + OUString sStatus; + if ( *pVal >>= sStatus ) { - OUString sStatus; - if ( *pVal >>= sStatus ) - { - setControlProperty( "FixedText1Pg4", "Enabled", Any( true ) ); - setControlProperty( "FixedText1Pg4", "Label", Any( getString( TKGet( sStatus ) ) ) ); - } + setControlProperty( "FixedText1Pg4", "Enabled", Any( true ) ); + setControlProperty( "FixedText1Pg4", "Label", Any( getString( TKGet( sStatus ) ) ) ); } - pVal = maStats.GetStatusValue( TK_Progress ); - if ( pVal ) - { - sal_Int32 nProgress = 0; - if ( *pVal >>= nProgress ) - setControlProperty( "Progress", "ProgressValue", Any( nProgress ) ); - } - pVal = maStats.GetStatusValue( TK_OpenNewDocument ); - if ( pVal ) - SetConfigProperty( TK_OpenNewDocument, *pVal ); - - mxReschedule->reschedule(); } + pVal = maStats.GetStatusValue( TK_Progress ); + if ( pVal ) + { + sal_Int32 nProgress = 0; + if ( *pVal >>= nProgress ) + setControlProperty( "Progress", "ProgressValue", Any( nProgress ) ); + } + pVal = maStats.GetStatusValue( TK_OpenNewDocument ); + if ( pVal ) + SetConfigProperty( TK_OpenNewDocument, *pVal ); + + mxReschedule->reschedule(); } @@ -716,22 +716,22 @@ void TextListenerComboBox0Pg1::textChanged( const TextEvent& /* rEvent */ ) { OUString aString; Any aAny = mrOptimizerDialog.getControlProperty( "ComboBox0Pg1", "Text" ); - if ( aAny >>= aString ) - { - sal_Int32 nI0, nI1, nI2, nI3, nI4; - nI0 = nI1 = nI2 = nI3 = nI4 = 0; - - if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';', nI0 ) == aString ) - aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_0 ).getToken( 0, ';', nI4 ); - else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';', nI1 ) == aString ) - aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_1 ).getToken( 0, ';', nI4 ); - else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';', nI2 ) == aString ) - aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_2 ).getToken( 0, ';', nI4 ); - else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';', nI3 ) == aString ) - aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_3 ).getToken( 0, ';', nI4 ); - - mrOptimizerDialog.SetConfigProperty( TK_ImageResolution, Any( aString.toInt32() ) ); - } + if ( !(aAny >>= aString) ) + return; + + sal_Int32 nI0, nI1, nI2, nI3, nI4; + nI0 = nI1 = nI2 = nI3 = nI4 = 0; + + if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';', nI0 ) == aString ) + aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_0 ).getToken( 0, ';', nI4 ); + else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';', nI1 ) == aString ) + aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_1 ).getToken( 0, ';', nI4 ); + else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';', nI2 ) == aString ) + aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_2 ).getToken( 0, ';', nI4 ); + else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';', nI3 ) == aString ) + aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_3 ).getToken( 0, ';', nI4 ); + + mrOptimizerDialog.SetConfigProperty( TK_ImageResolution, Any( aString.toInt32() ) ); } void TextListenerComboBox0Pg1::disposing( const css::lang::EventObject& /* Source */ ) { diff --git a/sdext/source/minimizer/pppoptimizerdialog.cxx b/sdext/source/minimizer/pppoptimizerdialog.cxx index f575e88a5f60..90baad21091b 100644 --- a/sdext/source/minimizer/pppoptimizerdialog.cxx +++ b/sdext/source/minimizer/pppoptimizerdialog.cxx @@ -94,48 +94,48 @@ void SAL_CALL PPPOptimizerDialog::dispatch( const URL& rURL, const Sequence< PropertyValue >& rArguments ) { - if ( mxController.is() && rURL.Protocol.equalsIgnoreAsciiCase( "vnd.com.sun.star.comp.PresentationMinimizer:" ) ) + if ( !(mxController.is() && rURL.Protocol.equalsIgnoreAsciiCase( "vnd.com.sun.star.comp.PresentationMinimizer:" )) ) + return; + + if ( rURL.Path == "execute" ) { - if ( rURL.Path == "execute" ) + try { - try - { - sal_Int64 nFileSizeSource = 0; - sal_Int64 nFileSizeDest = 0; - mpOptimizerDialog = new OptimizerDialog( mxContext, mxFrame, this ); - mpOptimizerDialog->execute(); - - const Any* pVal( mpOptimizerDialog->maStats.GetStatusValue( TK_FileSizeSource ) ); - if ( pVal ) - *pVal >>= nFileSizeSource; - pVal = mpOptimizerDialog->maStats.GetStatusValue( TK_FileSizeDestination ); - if ( pVal ) - *pVal >>= nFileSizeDest; - - if ( nFileSizeSource && nFileSizeDest ) - { - OUStringBuffer sBuf( "Your Presentation has been minimized from:" ); - sBuf.append( OUString::number( nFileSizeSource >> 10 ) ); - sBuf.append( "KB to " ); - sBuf.append( OUString::number( nFileSizeDest >> 10 ) ); - sBuf.append( "KB." ); - OUString sResult( sBuf.makeStringAndClear() ); - SAL_INFO("sdext.minimizer", sResult ); - } - delete mpOptimizerDialog; - mpOptimizerDialog = nullptr; - } - catch( ... ) + sal_Int64 nFileSizeSource = 0; + sal_Int64 nFileSizeDest = 0; + mpOptimizerDialog = new OptimizerDialog( mxContext, mxFrame, this ); + mpOptimizerDialog->execute(); + + const Any* pVal( mpOptimizerDialog->maStats.GetStatusValue( TK_FileSizeSource ) ); + if ( pVal ) + *pVal >>= nFileSizeSource; + pVal = mpOptimizerDialog->maStats.GetStatusValue( TK_FileSizeDestination ); + if ( pVal ) + *pVal >>= nFileSizeDest; + + if ( nFileSizeSource && nFileSizeDest ) { - + OUStringBuffer sBuf( "Your Presentation has been minimized from:" ); + sBuf.append( OUString::number( nFileSizeSource >> 10 ) ); + sBuf.append( "KB to " ); + sBuf.append( OUString::number( nFileSizeDest >> 10 ) ); + sBuf.append( "KB." ); + OUString sResult( sBuf.makeStringAndClear() ); + SAL_INFO("sdext.minimizer", sResult ); } + delete mpOptimizerDialog; + mpOptimizerDialog = nullptr; } - else if ( rURL.Path == "statusupdate" ) + catch( ... ) { - if ( mpOptimizerDialog ) - mpOptimizerDialog->UpdateStatus( rArguments ); + } } + else if ( rURL.Path == "statusupdate" ) + { + if ( mpOptimizerDialog ) + mpOptimizerDialog->UpdateStatus( rArguments ); + } } void SAL_CALL PPPOptimizerDialog::addStatusListener( const Reference< XStatusListener >&, const URL& ) diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index 87b88b8ff71d..919e0964b8d4 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -780,21 +780,21 @@ static void unzipToBuffer( char* pBegin, unsigned int nLen, void PDFObject::writeStream( EmitContext& rWriteContext, const PDFFile* pParsedFile ) const { - if( m_pStream ) + if( !m_pStream ) + return; + + std::unique_ptr<char[]> pStream; + unsigned int nBytes = 0; + if( getDeflatedStream( pStream, &nBytes, pParsedFile, rWriteContext ) && nBytes && rWriteContext.m_bDeflate ) { - std::unique_ptr<char[]> pStream; - unsigned int nBytes = 0; - if( getDeflatedStream( pStream, &nBytes, pParsedFile, rWriteContext ) && nBytes && rWriteContext.m_bDeflate ) - { - sal_uInt8* pOutBytes = nullptr; - sal_uInt32 nOutBytes = 0; - unzipToBuffer( pStream.get(), nBytes, &pOutBytes, &nOutBytes ); - rWriteContext.write( pOutBytes, nOutBytes ); - std::free( pOutBytes ); - } - else if( pStream && nBytes ) - rWriteContext.write( pStream.get(), nBytes ); + sal_uInt8* pOutBytes = nullptr; + sal_uInt32 nOutBytes = 0; + unzipToBuffer( pStream.get(), nBytes, &pOutBytes, &nOutBytes ); + rWriteContext.write( pOutBytes, nOutBytes ); + std::free( pOutBytes ); } + else if( pStream && nBytes ) + rWriteContext.write( pStream.get(), nBytes ); } bool PDFObject::emit( EmitContext& rWriteContext ) const diff --git a/sdext/source/pdfimport/sax/emitcontext.cxx b/sdext/source/pdfimport/sax/emitcontext.cxx index 8eab0e0b5ddf..4b1f7de41172 100644 --- a/sdext/source/pdfimport/sax/emitcontext.cxx +++ b/sdext/source/pdfimport/sax/emitcontext.cxx @@ -107,27 +107,27 @@ void SaxEmitter::beginTag( const char* pTag, const PropertyMap& rProperties ) { } #if OSL_DEBUG_LEVEL > 0 - if( pStream ) - { - sal_uInt64 nWritten = 0; - for( int i = 0; i < nIndent; i++ ) - pStream->write( " ", 4, nWritten ); + if( !pStream ) + return; - OStringBuffer aBuf( 1024 ); - aBuf.append( '<' ); - aBuf.append( pTag ); - for( const auto& rProperty : rProperties ) - { - aBuf.append( ' ' ); - aBuf.append( OUStringToOString( rProperty.first, RTL_TEXTENCODING_UTF8 ) ); - aBuf.append( "=\"" ); - aBuf.append( OUStringToOString( rProperty.second, RTL_TEXTENCODING_UTF8 ) ); - aBuf.append( "\"" ); - } - aBuf.append( ">\n" ); - pStream->write( aBuf.getStr(), aBuf.getLength(), nWritten ); - nIndent++; + sal_uInt64 nWritten = 0; + for( int i = 0; i < nIndent; i++ ) + pStream->write( " ", 4, nWritten ); + + OStringBuffer aBuf( 1024 ); + aBuf.append( '<' ); + aBuf.append( pTag ); + for( const auto& rProperty : rProperties ) + { + aBuf.append( ' ' ); + aBuf.append( OUStringToOString( rProperty.first, RTL_TEXTENCODING_UTF8 ) ); + aBuf.append( "=\"" ); + aBuf.append( OUStringToOString( rProperty.second, RTL_TEXTENCODING_UTF8 ) ); + aBuf.append( "\"" ); } + aBuf.append( ">\n" ); + pStream->write( aBuf.getStr(), aBuf.getLength(), nWritten ); + nIndent++; #endif } @@ -161,19 +161,19 @@ void SaxEmitter::endTag( const char* pTag ) { } #if OSL_DEBUG_LEVEL > 0 - if( pStream ) - { - sal_uInt64 nWritten = 0; - for( int i = 0; i < nIndent; i++ ) - pStream->write( " ", 4, nWritten ); - - OStringBuffer aBuf( 1024 ); - aBuf.append( "</" ); - aBuf.append( pTag ); - aBuf.append( ">\n" ); - pStream->write( aBuf.getStr(), aBuf.getLength(), nWritten ); - nIndent--; - } + if( !pStream ) + return; + + sal_uInt64 nWritten = 0; + for( int i = 0; i < nIndent; i++ ) + pStream->write( " ", 4, nWritten ); + + OStringBuffer aBuf( 1024 ); + aBuf.append( "</" ); + aBuf.append( pTag ); + aBuf.append( ">\n" ); + pStream->write( aBuf.getStr(), aBuf.getLength(), nWritten ); + nIndent--; #endif } diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index ceedace97f6a..30dfefedba20 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -425,7 +425,7 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< std::uniqu const GraphicsContext& rThisGC = m_rProcessor.getGraphicsContext( elem.GCId ); - if( rThisGC.BlendMode == rNextGC.BlendMode && + if( !(rThisGC.BlendMode == rNextGC.BlendMode && rThisGC.Flatness == rNextGC.Flatness && rThisGC.Transformation == rNextGC.Transformation && rThisGC.Clip == rNextGC.Clip && @@ -434,22 +434,22 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< std::uniqu rThisGC.FillColor.Blue == rNextGC.FillColor.Blue && rThisGC.FillColor.Alpha== rNextGC.FillColor.Alpha && pNext->Action == PATH_STROKE && - (elem.Action == PATH_FILL || elem.Action == PATH_EOFILL) ) - { - GraphicsContext aGC = rThisGC; - aGC.LineJoin = rNextGC.LineJoin; - aGC.LineCap = rNextGC.LineCap; - aGC.LineWidth = rNextGC.LineWidth; - aGC.MiterLimit= rNextGC.MiterLimit; - aGC.DashArray = rNextGC.DashArray; - aGC.LineColor = rNextGC.LineColor; - elem.GCId = m_rProcessor.getGCId( aGC ); - - elem.Action |= pNext->Action; - - elem.Children.splice( elem.Children.end(), pNext->Children ); - elem.Parent->Children.erase(next_it); - } + (elem.Action == PATH_FILL || elem.Action == PATH_EOFILL)) ) + return; + + GraphicsContext aGC = rThisGC; + aGC.LineJoin = rNextGC.LineJoin; + aGC.LineCap = rNextGC.LineCap; + aGC.LineWidth = rNextGC.LineWidth; + aGC.MiterLimit= rNextGC.MiterLimit; + aGC.DashArray = rNextGC.DashArray; + aGC.LineColor = rNextGC.LineColor; + elem.GCId = m_rProcessor.getGCId( aGC ); + + elem.Action |= pNext->Action; + + elem.Children.splice( elem.Children.end(), pNext->Children ); + elem.Parent->Children.erase(next_it); } void DrawXmlOptimizer::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& ) diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index e99b72bbf3f0..509e4a72d9e8 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -598,26 +598,26 @@ void PDFIProcessor::emit( XmlEmitter& rEmitter, void PDFIProcessor::startIndicator( const OUString& rText ) { sal_Int32 nElements = m_nPages; - if( m_xStatusIndicator.is() ) + if( !m_xStatusIndicator.is() ) + return; + + sal_Int32 nLength = rText.getLength(); + OUStringBuffer aStr( nLength*2 ); + const sal_Unicode* pText = rText.getStr(); + for( int i = 0; i < nLength; i++ ) { - sal_Int32 nLength = rText.getLength(); - OUStringBuffer aStr( nLength*2 ); - const sal_Unicode* pText = rText.getStr(); - for( int i = 0; i < nLength; i++ ) + if( nLength-i > 1&& + pText[i] == '%' && + pText[i+1] == 'd' + ) { - if( nLength-i > 1&& - pText[i] == '%' && - pText[i+1] == 'd' - ) - { - aStr.append( nElements ); - i++; - } - else - aStr.append( pText[i] ); + aStr.append( nElements ); + i++; } - m_xStatusIndicator->start( aStr.makeStringAndClear(), nElements ); + else + aStr.append( pText[i] ); } + m_xStatusIndicator->start( aStr.makeStringAndClear(), nElements ); } void PDFIProcessor::endIndicator() diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx index dd4afd89579b..4b20008ba3cd 100644 --- a/sdext/source/pdfimport/tree/style.cxx +++ b/sdext/source/pdfimport/tree/style.cxx @@ -186,25 +186,25 @@ void StyleContainer::impl_emitStyle( sal_Int32 nStyleId, ElementTreeVisitor& rContainedElemVisitor ) { std::unordered_map< sal_Int32, RefCountedHashedStyle >::const_iterator it = m_aIdToStyle.find( nStyleId ); - if( it != m_aIdToStyle.end() ) - { - const HashedStyle& rStyle = it->second.style; - PropertyMap aProps( rStyle.Properties ); - if( !rStyle.IsSubStyle ) - aProps[ "style:name" ] = getStyleName( nStyleId ); - if (rStyle.Name == "draw:stroke-dash") - aProps[ "draw:name" ] = aProps[ "style:name" ]; - rContext.rEmitter.beginTag( rStyle.Name.getStr(), aProps ); - - for(sal_Int32 nSubStyle : rStyle.SubStyles) - impl_emitStyle( nSubStyle, rContext, rContainedElemVisitor ); - if( !rStyle.Contents.isEmpty() ) - rContext.rEmitter.write( rStyle.Contents ); - if( rStyle.ContainedElement ) - rStyle.ContainedElement->visitedBy( rContainedElemVisitor, - std::list<std::unique_ptr<Element>>::iterator() ); - rContext.rEmitter.endTag( rStyle.Name.getStr() ); - } + if( it == m_aIdToStyle.end() ) + return; + + const HashedStyle& rStyle = it->second.style; + PropertyMap aProps( rStyle.Properties ); + if( !rStyle.IsSubStyle ) + aProps[ "style:name" ] = getStyleName( nStyleId ); + if (rStyle.Name == "draw:stroke-dash") + aProps[ "draw:name" ] = aProps[ "style:name" ]; + rContext.rEmitter.beginTag( rStyle.Name.getStr(), aProps ); + + for(sal_Int32 nSubStyle : rStyle.SubStyles) + impl_emitStyle( nSubStyle, rContext, rContainedElemVisitor ); + if( !rStyle.Contents.isEmpty() ) + rContext.rEmitter.write( rStyle.Contents ); + if( rStyle.ContainedElement ) + rStyle.ContainedElement->visitedBy( rContainedElemVisitor, + std::list<std::unique_ptr<Element>>::iterator() ); + rContext.rEmitter.endTag( rStyle.Name.getStr() ); } void StyleContainer::emit( EmitContext& rContext, diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index a16f4b443068..2e092503d757 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -391,27 +391,27 @@ void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< std::uni const GraphicsContext& rThisGC = m_rProcessor.getGraphicsContext( elem.GCId ); - if( rThisGC.BlendMode == rNextGC.BlendMode && + if( !(rThisGC.BlendMode == rNextGC.BlendMode && rThisGC.Flatness == rNextGC.Flatness && rThisGC.Transformation == rNextGC.Transformation && rThisGC.Clip == rNextGC.Clip && pNext->Action == PATH_STROKE && - (elem.Action == PATH_FILL || elem.Action == PATH_EOFILL) ) - { - GraphicsContext aGC = rThisGC; - aGC.LineJoin = rNextGC.LineJoin; - aGC.LineCap = rNextGC.LineCap; - aGC.LineWidth = rNextGC.LineWidth; - aGC.MiterLimit= rNextGC.MiterLimit; - aGC.DashArray = rNextGC.DashArray; - aGC.LineColor = rNextGC.LineColor; - elem.GCId = m_rProcessor.getGCId( aGC ); - - elem.Action |= pNext->Action; - - elem.Children.splice( elem.Children.end(), pNext->Children ); - elem.Parent->Children.erase(next_it); - } + (elem.Action == PATH_FILL || elem.Action == PATH_EOFILL)) ) + return; + + GraphicsContext aGC = rThisGC; + aGC.LineJoin = rNextGC.LineJoin; + aGC.LineCap = rNextGC.LineCap; + aGC.LineWidth = rNextGC.LineWidth; + aGC.MiterLimit= rNextGC.MiterLimit; + aGC.DashArray = rNextGC.DashArray; + aGC.LineColor = rNextGC.LineColor; + elem.GCId = m_rProcessor.getGCId( aGC ); + + elem.Action |= pNext->Action; + + elem.Children.splice( elem.Children.end(), pNext->Children ); + elem.Parent->Children.erase(next_it); } void WriterXmlOptimizer::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt) @@ -420,53 +420,53 @@ void WriterXmlOptimizer::visit( ParagraphElement& elem, const std::list< std::un elem.applyToChildren(*this); - if( elem.Parent && rParentIt != elem.Parent->Children.end() ) + if( !(elem.Parent && rParentIt != elem.Parent->Children.end()) ) + return; + + // find if there is a previous paragraph that might be a heading for this one + auto prev = rParentIt; + ParagraphElement* pPrevPara = nullptr; + while( prev != elem.Parent->Children.begin() ) { - // find if there is a previous paragraph that might be a heading for this one - auto prev = rParentIt; - ParagraphElement* pPrevPara = nullptr; - while( prev != elem.Parent->Children.begin() ) + --prev; + pPrevPara = dynamic_cast< ParagraphElement* >(prev->get()); + if( pPrevPara ) { - --prev; - pPrevPara = dynamic_cast< ParagraphElement* >(prev->get()); - if( pPrevPara ) + /* What constitutes a heading ? current hints are: + * - one line only + * - not too far away from this paragraph (two heading height max ?) + * - font larger or bold + * this is of course incomplete + * FIXME: improve hints for heading + */ + // check for single line + if( pPrevPara->isSingleLined( m_rProcessor ) ) { - /* What constitutes a heading ? current hints are: - * - one line only - * - not too far away from this paragraph (two heading height max ?) - * - font larger or bold - * this is of course incomplete - * FIXME: improve hints for heading - */ - // check for single line - if( pPrevPara->isSingleLined( m_rProcessor ) ) + double head_line_height = pPrevPara->getLineHeight( m_rProcessor ); + if( pPrevPara->y + pPrevPara->h + 2*head_line_height > elem.y ) { - double head_line_height = pPrevPara->getLineHeight( m_rProcessor ); - if( pPrevPara->y + pPrevPara->h + 2*head_line_height > elem.y ) + // check for larger font + if( head_line_height > elem.getLineHeight( m_rProcessor ) ) { - // check for larger font - if( head_line_height > elem.getLineHeight( m_rProcessor ) ) - { - pPrevPara->Type = ParagraphElement::Headline; - } - else + pPrevPara->Type = ParagraphElement::Headline; + } + else + { + // check whether text of pPrevPara is bold (at least first text element) + // and this para is not bold (dito) + TextElement* pPrevText = pPrevPara->getFirstTextChild(); + TextElement* pThisText = elem.getFirstTextChild(); + if( pPrevText && pThisText ) { - // check whether text of pPrevPara is bold (at least first text element) - // and this para is not bold (dito) - TextElement* pPrevText = pPrevPara->getFirstTextChild(); - TextElement* pThisText = elem.getFirstTextChild(); - if( pPrevText && pThisText ) - { - const FontAttributes& rPrevFont = m_rProcessor.getFont( pPrevText->FontId ); - const FontAttributes& rThisFont = m_rProcessor.getFont( pThisText->FontId ); - if( rPrevFont.isBold && ! rThisFont.isBold ) - pPrevPara->Type = ParagraphElement::Headline; - } + const FontAttributes& rPrevFont = m_rProcessor.getFont( pPrevText->FontId ); + const FontAttributes& rThisFont = m_rProcessor.getFont( pThisText->FontId ); + if( rPrevFont.isBold && ! rThisFont.isBold ) + pPrevPara->Type = ParagraphElement::Headline; } } } - break; } + break; } } } @@ -690,24 +690,24 @@ void WriterXmlOptimizer::checkHeaderAndFooter( PageElement& rElem ) // detect footer auto rit = std::find_if(rElem.Children.rbegin(), rElem.Children.rend(), isParagraphElement); - if (rit != rElem.Children.rend()) + if (rit == rElem.Children.rend()) + return; + + ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(rit->get()); + if( !(pPara->y > rElem.h*0.85 && pPara->isSingleLined( m_rProcessor )) ) + return; + + std::list< std::unique_ptr<Element> >::reverse_iterator next_it = rit; + ParagraphElement* pNextPara = nullptr; + while( ++next_it != rElem.Children.rend() && pNextPara == nullptr ) { - ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(rit->get()); - if( pPara->y > rElem.h*0.85 && pPara->isSingleLined( m_rProcessor ) ) - { - std::list< std::unique_ptr<Element> >::reverse_iterator next_it = rit; - ParagraphElement* pNextPara = nullptr; - while( ++next_it != rElem.Children.rend() && pNextPara == nullptr ) - { - pNextPara = dynamic_cast<ParagraphElement*>(next_it->get()); - } - if( pNextPara && pNextPara->y < pPara->y-pPara->h*2 ) - { - rElem.FooterElement = std::move(*rit); - pPara->Parent = nullptr; - rElem.Children.erase( std::next(rit).base() ); - } - } + pNextPara = dynamic_cast<ParagraphElement*>(next_it->get()); + } + if( pNextPara && pNextPara->y < pPara->y-pPara->h*2 ) + { + rElem.FooterElement = std::move(*rit); + pPara->Parent = nullptr; + rElem.Children.erase( std::next(rit).base() ); } } diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index 9842b9734e8d..3b6fcce7d137 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -553,23 +553,23 @@ void PDFOutDev::processLink(Link* link, Catalog*) link->getRect( &x1, &y1, &x2, &y2 ); LinkAction* pAction = link->getAction(); - if (pAction && pAction->getKind() == actionURI) - { + if (!(pAction && pAction->getKind() == actionURI)) +return; + #if POPPLER_CHECK_VERSION(0, 72, 0) - const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->c_str(); + const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->c_str(); #else - const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->getCString(); + const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->getCString(); #endif - std::vector<char> aEsc( lcl_escapeLineFeeds(pURI) ); + std::vector<char> aEsc( lcl_escapeLineFeeds(pURI) ); - printf( "drawLink %f %f %f %f %s\n", - normalize(x1), - normalize(y1), - normalize(x2), - normalize(y2), - aEsc.data() ); - } + printf( "drawLink %f %f %f %f %s\n", + normalize(x1), + normalize(y1), + normalize(x2), + normalize(y2), + aEsc.data() ); } void PDFOutDev::saveState(GfxState*) @@ -734,52 +734,52 @@ void PDFOutDev::updateFont(GfxState *state) assert(state); GfxFont *gfxFont = state->getFont(); - if( gfxFont ) - { - FontAttributes aFont; - int nEmbedSize=0; + if( !gfxFont ) + return; + + FontAttributes aFont; + int nEmbedSize=0; #if POPPLER_CHECK_VERSION(0, 64, 0) - const + const #endif - Ref* pID = gfxFont->getID(); - // TODO(Q3): Portability problem - long long fontID = static_cast<long long>(pID->gen) << 32 | static_cast<long long>(pID->num); - std::unordered_map< long long, FontAttributes >::const_iterator it = - m_aFontMap.find( fontID ); - if( it == m_aFontMap.end() ) - { - nEmbedSize = parseFont( fontID, gfxFont, state ); - it = m_aFontMap.find( fontID ); - } + Ref* pID = gfxFont->getID(); + // TODO(Q3): Portability problem + long long fontID = static_cast<long long>(pID->gen) << 32 | static_cast<long long>(pID->num); + std::unordered_map< long long, FontAttributes >::const_iterator it = + m_aFontMap.find( fontID ); + if( it == m_aFontMap.end() ) + { + nEmbedSize = parseFont( fontID, gfxFont, state ); + it = m_aFontMap.find( fontID ); + } - printf( "updateFont" ); - if( it != m_aFontMap.end() ) - { - // conflating this with printf below crashes under Windoze - printf( " %lld", fontID ); + printf( "updateFont" ); + if( it != m_aFontMap.end() ) + { + // conflating this with printf below crashes under Windoze + printf( " %lld", fontID ); - aFont = it->second; + aFont = it->second; #if POPPLER_CHECK_VERSION(0, 72, 0) - std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.c_str()) ); + std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.c_str()) ); #else - std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.getCString()) ); + std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.getCString()) ); #endif - printf( " %d %d %d %d %f %d %s", - aFont.isEmbedded, - aFont.isBold, - aFont.isItalic, - aFont.isUnderline, - normalize(state->getTransformedFontSize()), - nEmbedSize, - aEsc.data() ); - } - printf( "\n" ); - - if( nEmbedSize ) - writeFontFile(gfxFont); + printf( " %d %d %d %d %f %d %s", + aFont.isEmbedded, + aFont.isBold, + aFont.isItalic, + aFont.isUnderline, + normalize(state->getTransformedFontSize()), + nEmbedSize, + aEsc.data() ); } + printf( "\n" ); + + if( nEmbedSize ) + writeFontFile(gfxFont); } void PDFOutDev::updateRender(GfxState *state) diff --git a/sdext/source/presenter/PresenterBitmapContainer.cxx b/sdext/source/presenter/PresenterBitmapContainer.cxx index d9d9b90c1f3a..fcd0613c3f22 100644 --- a/sdext/source/presenter/PresenterBitmapContainer.cxx +++ b/sdext/source/presenter/PresenterBitmapContainer.cxx @@ -79,20 +79,20 @@ PresenterBitmapContainer::PresenterBitmapContainer ( void PresenterBitmapContainer::Initialize ( const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext) { - if ( ! mxPresenterHelper.is()) - { - // Create an object that is able to load the bitmaps in a format that is - // supported by the canvas. - Reference<lang::XMultiComponentFactory> xFactory ( - rxComponentContext->getServiceManager(), UNO_QUERY); - if ( ! xFactory.is()) - return; - mxPresenterHelper.set( - xFactory->createInstanceWithContext( - "com.sun.star.drawing.PresenterHelper", - rxComponentContext), - UNO_QUERY_THROW); - } + if ( mxPresenterHelper.is()) + return; + + // Create an object that is able to load the bitmaps in a format that is + // supported by the canvas. + Reference<lang::XMultiComponentFactory> xFactory ( + rxComponentContext->getServiceManager(), UNO_QUERY); + if ( ! xFactory.is()) + return; + mxPresenterHelper.set( + xFactory->createInstanceWithContext( + "com.sun.star.drawing.PresenterHelper", + rxComponentContext), + UNO_QUERY_THROW); } PresenterBitmapContainer::~PresenterBitmapContainer() @@ -317,23 +317,23 @@ PresenterBitmapContainer::BitmapDescriptor::BitmapDescriptor ( mxDisabledBitmap(), mxMaskBitmap() { - if (rpDefault != nullptr) - { - mnWidth = rpDefault->mnWidth; - mnHeight = rpDefault->mnHeight; - mnXOffset = rpDefault->mnXOffset; - mnYOffset = rpDefault->mnYOffset; - mnXHotSpot = rpDefault->mnXHotSpot; - mnYHotSpot = rpDefault->mnYHotSpot; - maReplacementColor = rpDefault->maReplacementColor; - meHorizontalTexturingMode = rpDefault->meHorizontalTexturingMode; - meVerticalTexturingMode = rpDefault->meVerticalTexturingMode; - mxNormalBitmap = rpDefault->mxNormalBitmap; - mxMouseOverBitmap = rpDefault->mxMouseOverBitmap; - mxButtonDownBitmap = rpDefault->mxButtonDownBitmap; - mxDisabledBitmap = rpDefault->mxDisabledBitmap; - mxMaskBitmap = rpDefault->mxMaskBitmap; - } + if (rpDefault == nullptr) + return; + + mnWidth = rpDefault->mnWidth; + mnHeight = rpDefault->mnHeight; + mnXOffset = rpDefault->mnXOffset; + mnYOffset = rpDefault->mnYOffset; + mnXHotSpot = rpDefault->mnXHotSpot; + mnYHotSpot = rpDefault->mnYHotSpot; + maReplacementColor = rpDefault->maReplacementColor; + meHorizontalTexturingMode = rpDefault->meHorizontalTexturingMode; + meVerticalTexturingMode = rpDefault->meVerticalTexturingMode; + mxNormalBitmap = rpDefault->mxNormalBitmap; + mxMouseOverBitmap = rpDefault->mxMouseOverBitmap; + mxButtonDownBitmap = rpDefault->mxButtonDownBitmap; + mxDisabledBitmap = rpDefault->mxDisabledBitmap; + mxMaskBitmap = rpDefault->mxMaskBitmap; } const css::uno::Reference<css::rendering::XBitmap>& diff --git a/sdext/source/presenter/PresenterButton.cxx b/sdext/source/presenter/PresenterButton.cxx index e24ee663f44e..26206dbc28ec 100644 --- a/sdext/source/presenter/PresenterButton.cxx +++ b/sdext/source/presenter/PresenterButton.cxx @@ -202,19 +202,19 @@ void PresenterButton::SetCanvas ( xComponent->dispose(); } - if (mxPresenterHelper.is() && rxParentCanvas.is() && rxParentWindow.is()) + if (!(mxPresenterHelper.is() && rxParentCanvas.is() && rxParentWindow.is())) + return; + + mxCanvas = mxPresenterHelper->createSharedCanvas ( + Reference<rendering::XSpriteCanvas>(rxParentCanvas, UNO_QUERY), + rxParentWindow, + rxParentCanvas, + rxParentWindow, + mxWindow); + if (mxCanvas.is()) { - mxCanvas = mxPresenterHelper->createSharedCanvas ( - Reference<rendering::XSpriteCanvas>(rxParentCanvas, UNO_QUERY), - rxParentWindow, - rxParentCanvas, - rxParentWindow, - mxWindow); - if (mxCanvas.is()) - { - SetupButtonBitmaps(); - SetCenter(maCenter); - } + SetupButtonBitmaps(); + SetCenter(maCenter); } } @@ -252,31 +252,31 @@ void SAL_CALL PresenterButton::windowHidden (const css::lang::EventObject&) void SAL_CALL PresenterButton::windowPaint (const css::awt::PaintEvent& rEvent) { ThrowIfDisposed(); - if (mxWindow.is() && mxCanvas.is()) - { - Reference<rendering::XBitmap> xBitmap; - if (meState == PresenterBitmapDescriptor::MouseOver) - xBitmap = mxMouseOverBitmap; - else - xBitmap = mxNormalBitmap; - if ( ! xBitmap.is()) - return; - - rendering::ViewState aViewState( - geometry::AffineMatrix2D(1,0,0, 0,1,0), - nullptr); - rendering::RenderState aRenderState( - geometry::AffineMatrix2D(1,0,0, 0,1,0), - PresenterGeometryHelper::CreatePolygon(rEvent.UpdateRect, mxCanvas->getDevice()), - Sequence<double>(4), - rendering::CompositeOperation::SOURCE); - - mxCanvas->drawBitmap(xBitmap, aViewState, aRenderState); - - Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY); - if (xSpriteCanvas.is()) - xSpriteCanvas->updateScreen(false); - } + if (!(mxWindow.is() && mxCanvas.is())) + return; + + Reference<rendering::XBitmap> xBitmap; + if (meState == PresenterBitmapDescriptor::MouseOver) + xBitmap = mxMouseOverBitmap; + else + xBitmap = mxNormalBitmap; + if ( ! xBitmap.is()) + return; + + rendering::ViewState aViewState( + geometry::AffineMatrix2D(1,0,0, 0,1,0), + nullptr); + rendering::RenderState aRenderState( + geometry::AffineMatrix2D(1,0,0, 0,1,0), + PresenterGeometryHelper::CreatePolygon(rEvent.UpdateRect, mxCanvas->getDevice()), + Sequence<double>(4), + rendering::CompositeOperation::SOURCE); + + mxCanvas->drawBitmap(xBitmap, aViewState, aRenderState); + + Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY); + if (xSpriteCanvas.is()) + xSpriteCanvas->updateScreen(false); } //----- XMouseListener -------------------------------------------------------- diff --git a/sdext/source/presenter/PresenterConfigurationAccess.cxx b/sdext/source/presenter/PresenterConfigurationAccess.cxx index 38e6e6b93b5d..f2c5569a4dec 100644 --- a/sdext/source/presenter/PresenterConfigurationAccess.cxx +++ b/sdext/source/presenter/PresenterConfigurationAccess.cxx @@ -176,34 +176,34 @@ void PresenterConfigurationAccess::ForAll ( const ::std::vector<OUString>& rArguments, const ItemProcessor& rProcessor) { - if (rxContainer.is()) + if (!rxContainer.is()) + return; + + ::std::vector<Any> aValues(rArguments.size()); + Sequence<OUString> aKeys (rxContainer->getElementNames()); + for (sal_Int32 nItemIndex=0; nItemIndex<aKeys.getLength(); ++nItemIndex) { - ::std::vector<Any> aValues(rArguments.size()); - Sequence<OUString> aKeys (rxContainer->getElementNames()); - for (sal_Int32 nItemIndex=0; nItemIndex<aKeys.getLength(); ++nItemIndex) + bool bHasAllValues (true); + const OUString& rsKey (aKeys[nItemIndex]); + Reference<container::XNameAccess> xSetItem (rxContainer->getByName(rsKey), UNO_QUERY); + Reference<beans::XPropertySet> xSet (xSetItem, UNO_QUERY); + OSL_ASSERT(xSet.is()); + if (xSetItem.is()) { - bool bHasAllValues (true); - const OUString& rsKey (aKeys[nItemIndex]); - Reference<container::XNameAccess> xSetItem (rxContainer->getByName(rsKey), UNO_QUERY); - Reference<beans::XPropertySet> xSet (xSetItem, UNO_QUERY); - OSL_ASSERT(xSet.is()); - if (xSetItem.is()) + // Get from the current item of the container the children + // that match the names in the rArguments list. + for (size_t nValueIndex=0; nValueIndex<aValues.size(); ++nValueIndex) { - // Get from the current item of the container the children - // that match the names in the rArguments list. - for (size_t nValueIndex=0; nValueIndex<aValues.size(); ++nValueIndex) - { - if ( ! xSetItem->hasByName(rArguments[nValueIndex])) - bHasAllValues = false; - else - aValues[nValueIndex] = xSetItem->getByName(rArguments[nValueIndex]); - } + if ( ! xSetItem->hasByName(rArguments[nValueIndex])) + bHasAllValues = false; + else + aValues[nValueIndex] = xSetItem->getByName(rArguments[nValueIndex]); } - else - bHasAllValues = false; - if (bHasAllValues) - rProcessor(aValues); } + else + bHasAllValues = false; + if (bHasAllValues) + rProcessor(aValues); } } diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx index 313a34cef216..cbd4300cc152 100644 --- a/sdext/source/presenter/PresenterController.cxx +++ b/sdext/source/presenter/PresenterController.cxx @@ -493,19 +493,19 @@ void PresenterController::ShowView (const OUString& rsViewURL) { PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( mpPaneContainer->FindViewURL(rsViewURL)); - if (pDescriptor.get() != nullptr) - { - pDescriptor->mbIsActive = true; - mxConfigurationController->requestResourceActivation( - pDescriptor->mxPaneId, - ResourceActivationMode_ADD); - mxConfigurationController->requestResourceActivation( - ResourceId::createWithAnchor( - mxComponentContext, - rsViewURL, - pDescriptor->mxPaneId), - ResourceActivationMode_REPLACE); - } + if (pDescriptor.get() == nullptr) + return; + + pDescriptor->mbIsActive = true; + mxConfigurationController->requestResourceActivation( + pDescriptor->mxPaneId, + ResourceActivationMode_ADD); + mxConfigurationController->requestResourceActivation( + ResourceId::createWithAnchor( + mxComponentContext, + rsViewURL, + pDescriptor->mxPaneId), + ResourceActivationMode_REPLACE); } void PresenterController::HideView (const OUString& rsViewURL) @@ -642,25 +642,25 @@ void PresenterController::SetAccessibilityActiveState (const bool bIsActive) void PresenterController::HandleMouseClick (const awt::MouseEvent& rEvent) { - if (mxSlideShowController.is()) + if (!mxSlideShowController.is()) + return; + + switch (rEvent.Buttons) { - switch (rEvent.Buttons) - { - case awt::MouseButton::LEFT: - if (rEvent.Modifiers == awt::KeyModifier::MOD2) - mxSlideShowController->gotoNextSlide(); - else - mxSlideShowController->gotoNextEffect(); - break; + case awt::MouseButton::LEFT: + if (rEvent.Modifiers == awt::KeyModifier::MOD2) + mxSlideShowController->gotoNextSlide(); + else + mxSlideShowController->gotoNextEffect(); + break; - case awt::MouseButton::RIGHT: - mxSlideShowController->gotoPreviousSlide(); - break; + case awt::MouseButton::RIGHT: + mxSlideShowController->gotoPreviousSlide(); + break; - default: - // Other or multiple buttons. - break; - } + default: + // Other or multiple buttons. + break; } } diff --git a/sdext/source/presenter/PresenterHelpView.cxx b/sdext/source/presenter/PresenterHelpView.cxx index 0bce7633dcec..57dd858a2ea1 100644 --- a/sdext/source/presenter/PresenterHelpView.cxx +++ b/sdext/source/presenter/PresenterHelpView.cxx @@ -466,21 +466,21 @@ void PresenterHelpView::ProvideCanvas() void PresenterHelpView::Resize() { - if (mpCloseButton.get() != nullptr && mxWindow.is()) - { - const awt::Rectangle aWindowBox (mxWindow->getPosSize()); - mnMaximalWidth = (mxWindow->getPosSize().Width - 4*gnHorizontalGap) / 2; + if (!(mpCloseButton.get() != nullptr && mxWindow.is())) + return; - // Place vertical separator. - mnSeparatorY = aWindowBox.Height - - mpCloseButton->GetSize().Height - gnVerticalButtonPadding; + const awt::Rectangle aWindowBox (mxWindow->getPosSize()); + mnMaximalWidth = (mxWindow->getPosSize().Width - 4*gnHorizontalGap) / 2; - mpCloseButton->SetCenter(geometry::RealPoint2D( - aWindowBox.Width/2.0, - aWindowBox.Height - mpCloseButton->GetSize().Height/2.0)); + // Place vertical separator. + mnSeparatorY = aWindowBox.Height + - mpCloseButton->GetSize().Height - gnVerticalButtonPadding; - CheckFontSize(); - } + mpCloseButton->SetCenter(geometry::RealPoint2D( + aWindowBox.Width/2.0, + aWindowBox.Height - mpCloseButton->GetSize().Height/2.0)); + + CheckFontSize(); } void PresenterHelpView::ThrowIfDisposed() diff --git a/sdext/source/presenter/PresenterNotesView.cxx b/sdext/source/presenter/PresenterNotesView.cxx index 900340b56fab..436202bd67ce 100644 --- a/sdext/source/presenter/PresenterNotesView.cxx +++ b/sdext/source/presenter/PresenterNotesView.cxx @@ -226,49 +226,49 @@ void PresenterNotesView::SetSlide (const Reference<drawing::XDrawPage>& rxNotesP "com.sun.star.drawing.TextShape"); Reference<container::XIndexAccess> xIndexAccess (rxNotesPage, UNO_QUERY); - if (xIndexAccess.is()) + if (!xIndexAccess.is()) + return; + + // Iterate over all shapes and find the one that holds the text. + sal_Int32 nCount (xIndexAccess->getCount()); + for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex) { - // Iterate over all shapes and find the one that holds the text. - sal_Int32 nCount (xIndexAccess->getCount()); - for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex) - { - Reference<lang::XServiceName> xServiceName ( + Reference<lang::XServiceName> xServiceName ( + xIndexAccess->getByIndex(nIndex), UNO_QUERY); + if (xServiceName.is() + && xServiceName->getServiceName() == sNotesShapeName) + { + } + else + { + Reference<drawing::XShapeDescriptor> xShapeDescriptor ( xIndexAccess->getByIndex(nIndex), UNO_QUERY); - if (xServiceName.is() - && xServiceName->getServiceName() == sNotesShapeName) + if (xShapeDescriptor.is()) { - } - else - { - Reference<drawing::XShapeDescriptor> xShapeDescriptor ( - xIndexAccess->getByIndex(nIndex), UNO_QUERY); - if (xShapeDescriptor.is()) + OUString sType (xShapeDescriptor->getShapeType()); + if (sType == sNotesShapeName || sType == sTextShapeName) { - OUString sType (xShapeDescriptor->getShapeType()); - if (sType == sNotesShapeName || sType == sTextShapeName) + Reference<text::XTextRange> xText ( + xIndexAccess->getByIndex(nIndex), UNO_QUERY); + if (xText.is()) { - Reference<text::XTextRange> xText ( - xIndexAccess->getByIndex(nIndex), UNO_QUERY); - if (xText.is()) - { - mpTextView->SetText(Reference<text::XText>(xText, UNO_QUERY)); - } + mpTextView->SetText(Reference<text::XText>(xText, UNO_QUERY)); } } } } + } - Layout(); - - if (mpScrollBar.get() != nullptr) - { - mpScrollBar->SetThumbPosition(0, false); - UpdateScrollBar(); - } + Layout(); - Invalidate(); + if (mpScrollBar.get() != nullptr) + { + mpScrollBar->SetThumbPosition(0, false); + UpdateScrollBar(); } + + Invalidate(); } //----- lang::XEventListener ------------------------------------------------- @@ -611,35 +611,35 @@ void PresenterNotesView::SetTop (const double nTop) void PresenterNotesView::ChangeFontSize (const sal_Int32 nSizeChange) { const sal_Int32 nNewSize (mpFont->mnSize + nSizeChange); - if (nNewSize > 5) - { - mpFont->mnSize = nNewSize; - mpFont->mxFont = nullptr; - mpTextView->SetFont(mpFont); + if (nNewSize <= 5) + return; - Layout(); - UpdateScrollBar(); - Invalidate(); + mpFont->mnSize = nNewSize; + mpFont->mxFont = nullptr; + mpTextView->SetFont(mpFont); - // Write the new font size to the configuration to make it persistent. - try - { - const OUString sStyleName (mpPresenterController->GetTheme()->GetStyleName( - mxViewId->getResourceURL())); - std::shared_ptr<PresenterConfigurationAccess> pConfiguration ( - mpPresenterController->GetTheme()->GetNodeForViewStyle( - sStyleName)); - if (pConfiguration == nullptr || !pConfiguration->IsValid()) - return; - - pConfiguration->GoToChild(OUString("Font")); - pConfiguration->SetProperty("Size", Any(static_cast<sal_Int32>(nNewSize+0.5))); - pConfiguration->CommitChanges(); - } - catch (Exception&) - { - OSL_ASSERT(false); - } + Layout(); + UpdateScrollBar(); + Invalidate(); + + // Write the new font size to the configuration to make it persistent. + try + { + const OUString sStyleName (mpPresenterController->GetTheme()->GetStyleName( + mxViewId->getResourceURL())); + std::shared_ptr<PresenterConfigurationAccess> pConfiguration ( + mpPresenterController->GetTheme()->GetNodeForViewStyle( + sStyleName)); + if (pConfiguration == nullptr || !pConfiguration->IsValid()) + return; + + pConfiguration->GoToChild(OUString("Font")); + pConfiguration->SetProperty("Size", Any(static_cast<sal_Int32>(nNewSize+0.5))); + pConfiguration->CommitChanges(); + } + catch (Exception&) + { + OSL_ASSERT(false); } } @@ -650,23 +650,23 @@ const std::shared_ptr<PresenterTextView>& PresenterNotesView::GetTextView() cons void PresenterNotesView::UpdateScrollBar() { - if (mpScrollBar.get() != nullptr) + if (mpScrollBar.get() == nullptr) + return; + + try { - try - { - mpScrollBar->SetTotalSize(mpTextView->GetTotalTextHeight()); - } - catch(beans::UnknownPropertyException&) - { - OSL_ASSERT(false); - } + mpScrollBar->SetTotalSize(mpTextView->GetTotalTextHeight()); + } + catch(beans::UnknownPropertyException&) + { + OSL_ASSERT(false); + } - mpScrollBar->SetLineHeight(mpFont->mnSize*1.2); - mpScrollBar->SetThumbPosition(mnTop, false); + mpScrollBar->SetLineHeight(mpFont->mnSize*1.2); + mpScrollBar->SetThumbPosition(mnTop, false); - mpScrollBar->SetThumbSize(maTextBoundingBox.Y2 - maTextBoundingBox.Y1); - mpScrollBar->CheckValues(); - } + mpScrollBar->SetThumbSize(maTextBoundingBox.Y2 - maTextBoundingBox.Y1); + mpScrollBar->CheckValues(); } } } // end of namespace ::sdext::presenter diff --git a/sdext/source/presenter/PresenterPaneBase.cxx b/sdext/source/presenter/PresenterPaneBase.cxx index d8d25218dd9e..2378f393b0c2 100644 --- a/sdext/source/presenter/PresenterPaneBase.cxx +++ b/sdext/source/presenter/PresenterPaneBase.cxx @@ -267,22 +267,21 @@ void SAL_CALL PresenterPaneBase::disposing (const lang::EventObject& rEvent) void PresenterPaneBase::CreateWindows ( const bool bIsWindowVisibleOnCreation) { - if (mxPresenterHelper.is() && mxParentWindow.is()) - { - - mxBorderWindow = mxPresenterHelper->createWindow( - mxParentWindow, - false, - bIsWindowVisibleOnCreation, - false, - false); - mxContentWindow = mxPresenterHelper->createWindow( - mxBorderWindow, - false, - bIsWindowVisibleOnCreation, - false, - false); - } + if (!(mxPresenterHelper.is() && mxParentWindow.is())) + return; + + mxBorderWindow = mxPresenterHelper->createWindow( + mxParentWindow, + false, + bIsWindowVisibleOnCreation, + false, + false); + mxContentWindow = mxPresenterHelper->createWindow( + mxBorderWindow, + false, + bIsWindowVisibleOnCreation, + false, + false); } const Reference<awt::XWindow>& PresenterPaneBase::GetBorderWindow() const @@ -305,20 +304,20 @@ void PresenterPaneBase::PaintBorder (const awt::Rectangle& rUpdateBox) { OSL_ASSERT(mxPaneId.is()); - if (mxBorderPainter.is() && mxBorderWindow.is() && mxBorderCanvas.is()) - { - awt::Rectangle aBorderBox (mxBorderWindow->getPosSize()); - awt::Rectangle aLocalBorderBox (0,0, aBorderBox.Width, aBorderBox.Height); + if (!(mxBorderPainter.is() && mxBorderWindow.is() && mxBorderCanvas.is())) + return; - //TODO: paint border background? + awt::Rectangle aBorderBox (mxBorderWindow->getPosSize()); + awt::Rectangle aLocalBorderBox (0,0, aBorderBox.Width, aBorderBox.Height); - mxBorderPainter->paintBorder( - mxPaneId->getResourceURL(), - mxBorderCanvas, - aLocalBorderBox, - rUpdateBox, - msTitle); - } + //TODO: paint border background? + + mxBorderPainter->paintBorder( + mxPaneId->getResourceURL(), + mxBorderCanvas, + aLocalBorderBox, + rUpdateBox, + msTitle); } void PresenterPaneBase::LayoutContextWindow() @@ -326,20 +325,20 @@ void PresenterPaneBase::LayoutContextWindow() OSL_ASSERT(mxPaneId.is()); OSL_ASSERT(mxBorderWindow.is()); OSL_ASSERT(mxContentWindow.is()); - if (mxBorderPainter.is() && mxPaneId.is() && mxBorderWindow.is() && mxContentWindow.is()) - { - const awt::Rectangle aBorderBox (mxBorderWindow->getPosSize()); - const awt::Rectangle aInnerBox (mxBorderPainter->removeBorder( - mxPaneId->getResourceURL(), - aBorderBox, - drawing::framework::BorderType_TOTAL_BORDER)); - mxContentWindow->setPosSize( - aInnerBox.X - aBorderBox.X, - aInnerBox.Y - aBorderBox.Y, - aInnerBox.Width, - aInnerBox.Height, - awt::PosSize::POSSIZE); - } + if (!(mxBorderPainter.is() && mxPaneId.is() && mxBorderWindow.is() && mxContentWindow.is())) + return; + + const awt::Rectangle aBorderBox (mxBorderWindow->getPosSize()); + const awt::Rectangle aInnerBox (mxBorderPainter->removeBorder( + mxPaneId->getResourceURL(), + aBorderBox, + drawing::framework::BorderType_TOTAL_BORDER)); + mxContentWindow->setPosSize( + aInnerBox.X - aBorderBox.X, + aInnerBox.Y - aBorderBox.Y, + aInnerBox.Width, + aInnerBox.Height, + awt::PosSize::POSSIZE); } bool PresenterPaneBase::IsVisible() const diff --git a/sdext/source/presenter/PresenterPaneBorderPainter.cxx b/sdext/source/presenter/PresenterPaneBorderPainter.cxx index 719769cda946..53b820109fcc 100644 --- a/sdext/source/presenter/PresenterPaneBorderPainter.cxx +++ b/sdext/source/presenter/PresenterPaneBorderPainter.cxx @@ -208,19 +208,19 @@ void SAL_CALL PresenterPaneBorderPainter::paintBorder ( } ProvideTheme(rxCanvas); - if (mpRenderer != nullptr) - { - mpRenderer->SetCanvas(rxCanvas); - mpRenderer->SetupClipping( - rRepaintArea, - rOuterBorderRectangle, - rsPaneBorderStyleName); - mpRenderer->PaintBorder( - rsTitle, - rOuterBorderRectangle, - rRepaintArea, - rsPaneBorderStyleName); - } + if (mpRenderer == nullptr) + return; + + mpRenderer->SetCanvas(rxCanvas); + mpRenderer->SetupClipping( + rRepaintArea, + rOuterBorderRectangle, + rsPaneBorderStyleName); + mpRenderer->PaintBorder( + rsTitle, + rOuterBorderRectangle, + rRepaintArea, + rsPaneBorderStyleName); } void SAL_CALL PresenterPaneBorderPainter::paintBorderWithCallout ( @@ -243,20 +243,20 @@ void SAL_CALL PresenterPaneBorderPainter::paintBorderWithCallout ( } ProvideTheme(rxCanvas); - if (mpRenderer != nullptr) - { - mpRenderer->SetCanvas(rxCanvas); - mpRenderer->SetupClipping( - rRepaintArea, - rOuterBorderRectangle, - rsPaneBorderStyleName); - mpRenderer->SetCalloutAnchor(rCalloutAnchor); - mpRenderer->PaintBorder( - rsTitle, - rOuterBorderRectangle, - rRepaintArea, - rsPaneBorderStyleName); - } + if (mpRenderer == nullptr) + return; + + mpRenderer->SetCanvas(rxCanvas); + mpRenderer->SetupClipping( + rRepaintArea, + rOuterBorderRectangle, + rsPaneBorderStyleName); + mpRenderer->SetCalloutAnchor(rCalloutAnchor); + mpRenderer->PaintBorder( + rsTitle, + rOuterBorderRectangle, + rRepaintArea, + rsPaneBorderStyleName); } awt::Point SAL_CALL PresenterPaneBorderPainter::getCalloutOffset ( @@ -763,60 +763,60 @@ RendererPaneStyle::RendererPaneStyle ( maOuterBorderSize(), maTotalBorderSize() { - if (rpTheme != nullptr) - { - mpTopLeft = GetBitmap(rpTheme, rsStyleName, "TopLeft"); - mpTop = GetBitmap(rpTheme, rsStyleName, "Top"); - mpTopRight = GetBitmap(rpTheme, rsStyleName, "TopRight"); - mpLeft = GetBitmap(rpTheme, rsStyleName,"Left"); - mpRight = GetBitmap(rpTheme, rsStyleName, "Right"); - mpBottomLeft = GetBitmap(rpTheme, rsStyleName, "BottomLeft"); - mpBottom = GetBitmap(rpTheme, rsStyleName, "Bottom"); - mpBottomRight = GetBitmap(rpTheme, rsStyleName, "BottomRight"); - mpBottomCallout = GetBitmap(rpTheme, rsStyleName, "BottomCallout"); - - // Get font description. - mpFont = rpTheme->GetFont(rsStyleName); - - OUString sAnchor ("Left"); - if (mpFont.get() != nullptr) - { - sAnchor = mpFont->msAnchor; - mnFontXOffset = mpFont->mnXOffset; - mnFontYOffset = mpFont->mnYOffset; - } + if (rpTheme == nullptr) + return; - if ( sAnchor == "Left" ) - meFontAnchor = Anchor::Left; - else if ( sAnchor == "Right" ) - meFontAnchor = Anchor::Right; - else - meFontAnchor = Anchor::Center; + mpTopLeft = GetBitmap(rpTheme, rsStyleName, "TopLeft"); + mpTop = GetBitmap(rpTheme, rsStyleName, "Top"); + mpTopRight = GetBitmap(rpTheme, rsStyleName, "TopRight"); + mpLeft = GetBitmap(rpTheme, rsStyleName,"Left"); + mpRight = GetBitmap(rpTheme, rsStyleName, "Right"); + mpBottomLeft = GetBitmap(rpTheme, rsStyleName, "BottomLeft"); + mpBottom = GetBitmap(rpTheme, rsStyleName, "Bottom"); + mpBottomRight = GetBitmap(rpTheme, rsStyleName, "BottomRight"); + mpBottomCallout = GetBitmap(rpTheme, rsStyleName, "BottomCallout"); - // Get border sizes. - try - { - ::std::vector<sal_Int32> aInnerBorder (rpTheme->GetBorderSize(rsStyleName, false)); - OSL_ASSERT(aInnerBorder.size()==4); - maInnerBorderSize.mnLeft = aInnerBorder[0]; - maInnerBorderSize.mnTop = aInnerBorder[1]; - maInnerBorderSize.mnRight = aInnerBorder[2]; - maInnerBorderSize.mnBottom = aInnerBorder[3]; - - ::std::vector<sal_Int32> aOuterBorder (rpTheme->GetBorderSize(rsStyleName, true)); - OSL_ASSERT(aOuterBorder.size()==4); - maOuterBorderSize.mnLeft = aOuterBorder[0]; - maOuterBorderSize.mnTop = aOuterBorder[1]; - maOuterBorderSize.mnRight = aOuterBorder[2]; - maOuterBorderSize.mnBottom = aOuterBorder[3]; - } - catch(beans::UnknownPropertyException&) - { - OSL_ASSERT(false); - } + // Get font description. + mpFont = rpTheme->GetFont(rsStyleName); + + OUString sAnchor ("Left"); + if (mpFont.get() != nullptr) + { + sAnchor = mpFont->msAnchor; + mnFontXOffset = mpFont->mnXOffset; + mnFontYOffset = mpFont->mnYOffset; + } + + if ( sAnchor == "Left" ) + meFontAnchor = Anchor::Left; + else if ( sAnchor == "Right" ) + meFontAnchor = Anchor::Right; + else + meFontAnchor = Anchor::Center; + + // Get border sizes. + try + { + ::std::vector<sal_Int32> aInnerBorder (rpTheme->GetBorderSize(rsStyleName, false)); + OSL_ASSERT(aInnerBorder.size()==4); + maInnerBorderSize.mnLeft = aInnerBorder[0]; + maInnerBorderSize.mnTop = aInnerBorder[1]; + maInnerBorderSize.mnRight = aInnerBorder[2]; + maInnerBorderSize.mnBottom = aInnerBorder[3]; - UpdateBorderSizes(); + ::std::vector<sal_Int32> aOuterBorder (rpTheme->GetBorderSize(rsStyleName, true)); + OSL_ASSERT(aOuterBorder.size()==4); + maOuterBorderSize.mnLeft = aOuterBorder[0]; + maOuterBorderSize.mnTop = aOuterBorder[1]; + maOuterBorderSize.mnRight = aOuterBorder[2]; + maOuterBorderSize.mnBottom = aOuterBorder[3]; + } + catch(beans::UnknownPropertyException&) + { + OSL_ASSERT(false); } + + UpdateBorderSizes(); } awt::Rectangle RendererPaneStyle::AddBorder ( diff --git a/sdext/source/presenter/PresenterPaneContainer.cxx b/sdext/source/presenter/PresenterPaneContainer.cxx index 5078ff08bf57..da7cd5db667e 100644 --- a/sdext/source/presenter/PresenterPaneContainer.cxx +++ b/sdext/source/presenter/PresenterPaneContainer.cxx @@ -63,33 +63,33 @@ void PresenterPaneContainer::PreparePane ( return; SharedPaneDescriptor pPane (FindPaneURL(rxPaneId->getResourceURL())); - if (pPane.get() == nullptr) + if (pPane.get() != nullptr) + return; + + // No entry found for the given pane id. Create a new one. + SharedPaneDescriptor pDescriptor (new PaneDescriptor); + pDescriptor->mxPaneId = rxPaneId; + pDescriptor->msViewURL = rsViewURL; + pDescriptor->mxPane = nullptr; + if (rsTitle.indexOf('%') < 0) { - // No entry found for the given pane id. Create a new one. - SharedPaneDescriptor pDescriptor (new PaneDescriptor); - pDescriptor->mxPaneId = rxPaneId; - pDescriptor->msViewURL = rsViewURL; - pDescriptor->mxPane = nullptr; - if (rsTitle.indexOf('%') < 0) - { - pDescriptor->msTitle = rsTitle; - pDescriptor->msTitleTemplate.clear(); - } - else - { - pDescriptor->msTitleTemplate = rsTitle; - pDescriptor->msTitle.clear(); - } - pDescriptor->msAccessibleTitleTemplate = rsAccessibleTitle; - pDescriptor->maViewInitialization = rViewInitialization; - pDescriptor->mbIsActive = true; - pDescriptor->mbIsOpaque = bIsOpaque; - pDescriptor->maSpriteProvider = PaneDescriptor::SpriteProvider(); - pDescriptor->mbIsSprite = false; - pDescriptor->maCalloutAnchorLocation = awt::Point(-1,-1); - - maPanes.push_back(pDescriptor); + pDescriptor->msTitle = rsTitle; + pDescriptor->msTitleTemplate.clear(); } + else + { + pDescriptor->msTitleTemplate = rsTitle; + pDescriptor->msTitle.clear(); + } + pDescriptor->msAccessibleTitleTemplate = rsAccessibleTitle; + pDescriptor->maViewInitialization = rViewInitialization; + pDescriptor->mbIsActive = true; + pDescriptor->mbIsOpaque = bIsOpaque; + pDescriptor->maSpriteProvider = PaneDescriptor::SpriteProvider(); + pDescriptor->mbIsSprite = false; + pDescriptor->maCalloutAnchorLocation = awt::Point(-1,-1); + + maPanes.push_back(pDescriptor); } void SAL_CALL PresenterPaneContainer::disposing() @@ -301,22 +301,22 @@ OUString PresenterPaneContainer::GetPaneURLForViewURL (const OUString& rsViewURL void PresenterPaneContainer::ToTop (const SharedPaneDescriptor& rpDescriptor) { - if (rpDescriptor.get() != nullptr) - { - // Find iterator for pDescriptor. - PaneList::iterator iEnd (maPanes.end()); - auto iPane = std::find_if(maPanes.begin(), iEnd, - [&rpDescriptor](SharedPaneDescriptor& rxPane) { return rxPane.get() == rpDescriptor.get(); }); - OSL_ASSERT(iPane!=iEnd); - if (iPane == iEnd) - return; - - if (mxPresenterHelper.is()) - mxPresenterHelper->toTop(rpDescriptor->mxBorderWindow); - - maPanes.erase(iPane); - maPanes.push_back(rpDescriptor); - } + if (rpDescriptor.get() == nullptr) + return; + + // Find iterator for pDescriptor. + PaneList::iterator iEnd (maPanes.end()); + auto iPane = std::find_if(maPanes.begin(), iEnd, + [&rpDescriptor](SharedPaneDescriptor& rxPane) { return rxPane.get() == rpDescriptor.get(); }); + OSL_ASSERT(iPane!=iEnd); + if (iPane == iEnd) + return; + + if (mxPresenterHelper.is()) + mxPresenterHelper->toTop(rpDescriptor->mxBorderWindow); + + maPanes.erase(iPane); + maPanes.push_back(rpDescriptor); } //----- XEventListener -------------------------------------------------------- diff --git a/sdext/source/presenter/PresenterPaneFactory.cxx b/sdext/source/presenter/PresenterPaneFactory.cxx index 9041de148bee..5990babcc18e 100644 --- a/sdext/source/presenter/PresenterPaneFactory.cxx +++ b/sdext/source/presenter/PresenterPaneFactory.cxx @@ -186,24 +186,24 @@ void SAL_CALL PresenterPaneFactory::releaseResource (const Reference<XResource>& const OUString sPaneURL (rxResource->getResourceId()->getResourceURL()); PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( pPaneContainer->FindPaneURL(sPaneURL)); - if (pDescriptor.get() != nullptr) - { - pDescriptor->SetActivationState(false); - if (pDescriptor->mxBorderWindow.is()) - pDescriptor->mxBorderWindow->setVisible(false); + if (pDescriptor.get() == nullptr) + return; - if (mpResourceCache != nullptr) - { - // Store the pane in the cache. - (*mpResourceCache)[sPaneURL] = rxResource; - } - else - { - // Dispose the pane. - Reference<lang::XComponent> xPaneComponent (rxResource, UNO_QUERY); - if (xPaneComponent.is()) - xPaneComponent->dispose(); - } + pDescriptor->SetActivationState(false); + if (pDescriptor->mxBorderWindow.is()) + pDescriptor->mxBorderWindow->setVisible(false); + + if (mpResourceCache != nullptr) + { + // Store the pane in the cache. + (*mpResourceCache)[sPaneURL] = rxResource; + } + else + { + // Dispose the pane. + Reference<lang::XComponent> xPaneComponent (rxResource, UNO_QUERY); + if (xPaneComponent.is()) + xPaneComponent->dispose(); } } diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx index 150e54755028..15018b33ef58 100644 --- a/sdext/source/presenter/PresenterProtocolHandler.cxx +++ b/sdext/source/presenter/PresenterProtocolHandler.cxx @@ -264,21 +264,21 @@ void SAL_CALL PresenterProtocolHandler::disposing() void SAL_CALL PresenterProtocolHandler::initialize (const Sequence<Any>& aArguments) { ThrowIfDisposed(); - if (aArguments.getLength() > 0) + if (aArguments.getLength() <= 0) + return; + + try { - try - { - Reference<frame::XFrame> xFrame; - if (aArguments[0] >>= xFrame) - { - mpPresenterController = PresenterController::Instance(xFrame); - } - } - catch (RuntimeException&) + Reference<frame::XFrame> xFrame; + if (aArguments[0] >>= xFrame) { - OSL_ASSERT(false); + mpPresenterController = PresenterController::Instance(xFrame); } } + catch (RuntimeException&) + { + OSL_ASSERT(false); + } } OUString PresenterProtocolHandler::getImplementationName() diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx index a0333918736a..086f1ce157ec 100644 --- a/sdext/source/presenter/PresenterScreen.cxx +++ b/sdext/source/presenter/PresenterScreen.cxx @@ -794,25 +794,25 @@ void PresenterScreen::SetupView( const PresenterPaneContainer::ViewInitializationFunction& rViewInitialization) { Reference<XConfigurationController> xCC (mxConfigurationControllerWeak); - if (xCC.is()) - { - Reference<XResourceId> xPaneId (ResourceId::createWithAnchor(rxContext,rsPaneURL,rxAnchorId)); - // Look up the view descriptor. - ViewDescriptor aViewDescriptor; - ViewDescriptorContainer::const_iterator iDescriptor (maViewDescriptors.find(rsViewURL)); - if (iDescriptor != maViewDescriptors.end()) - aViewDescriptor = iDescriptor->second; - - // Prepare the pane. - OSL_ASSERT(mpPaneContainer.get() != nullptr); - mpPaneContainer->PreparePane( - xPaneId, - rsViewURL, - aViewDescriptor.msTitle, - aViewDescriptor.msAccessibleTitle, - aViewDescriptor.mbIsOpaque, - rViewInitialization); - } + if (!xCC.is()) + return; + ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits