sd/source/ui/table/TableDesignPane.cxx | 123 +-- sd/source/ui/table/tablefunction.cxx | 73 +- sd/source/ui/table/tableobjectbar.cxx | 184 ++--- sd/source/ui/tools/ConfigurationAccess.cxx | 28 sd/source/ui/tools/EventMultiplexer.cxx | 160 ++-- sd/source/ui/tools/PreviewRenderer.cxx | 48 - sd/source/ui/tools/PropertySet.cxx | 28 sd/source/ui/tools/TimerBasedTaskExecution.cxx | 66 - sd/source/ui/unoidl/DrawController.cxx | 200 ++--- sd/source/ui/unoidl/SdUnoDrawView.cxx | 48 - sd/source/ui/unoidl/unolayer.cxx | 114 +-- sd/source/ui/unoidl/unomodel.cxx | 840 ++++++++++++------------- sd/source/ui/unoidl/unoobj.cxx | 158 ++-- sd/source/ui/unoidl/unopage.cxx | 458 ++++++------- sd/source/ui/view/DocumentRenderer.cxx | 186 ++--- sd/source/ui/view/FormShellManager.cxx | 90 +- sd/source/ui/view/MediaObjectBar.cxx | 52 - sd/source/ui/view/Outliner.cxx | 412 ++++++------ sd/source/ui/view/OutlinerIterator.cxx | 24 sd/source/ui/view/ToolBarManager.cxx | 292 ++++---- sd/source/ui/view/ViewShellBase.cxx | 192 ++--- sd/source/ui/view/ViewShellImplementation.cxx | 46 - sd/source/ui/view/ViewShellManager.cxx | 120 +-- sd/source/ui/view/ViewTabBar.cxx | 18 sd/source/ui/view/WindowUpdater.cxx | 50 - sd/source/ui/view/drviews1.cxx | 430 ++++++------ sd/source/ui/view/drviews3.cxx | 34 - sd/source/ui/view/drviews4.cxx | 746 +++++++++++----------- sd/source/ui/view/drviews5.cxx | 26 sd/source/ui/view/drviews7.cxx | 92 +- sd/source/ui/view/drviewsa.cxx | 30 sd/source/ui/view/drviewsb.cxx | 86 +- sd/source/ui/view/drviewsc.cxx | 37 - sd/source/ui/view/drviewse.cxx | 231 +++--- sd/source/ui/view/drviewsf.cxx | 94 +- sd/source/ui/view/drviewsg.cxx | 58 - sd/source/ui/view/drviewsh.cxx | 170 ++--- sd/source/ui/view/drviewsi.cxx | 116 +-- sd/source/ui/view/frmview.cxx | 628 +++++++++--------- sd/source/ui/view/outlnvsh.cxx | 80 +- sd/source/ui/view/outlview.cxx | 428 ++++++------ sd/source/ui/view/sdview.cxx | 170 ++--- sd/source/ui/view/sdview2.cxx | 40 - sd/source/ui/view/sdview3.cxx | 44 - sd/source/ui/view/sdwindow.cxx | 244 +++---- sd/source/ui/view/viewoverlaymanager.cxx | 142 ++-- sd/source/ui/view/viewshe2.cxx | 53 - sd/source/ui/view/viewshe3.cxx | 48 - sd/source/ui/view/viewshel.cxx | 168 ++--- 49 files changed, 4109 insertions(+), 4096 deletions(-)
New commits: commit fcdfb94ac11cd4832ad68c896c706fb3cb376ce4 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 14 09:10:57 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Feb 15 07:48:24 2019 +0100 loplugin:flatten in sd/source/ui/[t-u]* Change-Id: I6db7c26c9534b249a38cec96f3875f808702a598 Reviewed-on: https://gerrit.libreoffice.org/67829 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 386986cea857..2f339b10aff7 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -211,30 +211,30 @@ void TableDesignWidget::ApplyOptions() ID_VAL_USEFIRSTCOLUMNSTYLE, ID_VAL_USELASTCOLUMNSTYLE, ID_VAL_USEBANDINGCOLUMNSTYLE }; - if( mxSelectedTable.is() ) + if( !mxSelectedTable.is() ) + return; + + SfxRequest aReq( SID_TABLE_STYLE_SETTINGS, SfxCallMode::SYNCHRON, SfxGetpApp()->GetPool() ); + + for( sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i ) { - SfxRequest aReq( SID_TABLE_STYLE_SETTINGS, SfxCallMode::SYNCHRON, SfxGetpApp()->GetPool() ); + aReq.AppendItem( SfxBoolItem( gParamIds[i], m_aCheckBoxes[i]->IsChecked() ) ); + } - for( sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i ) - { - aReq.AppendItem( SfxBoolItem( gParamIds[i], m_aCheckBoxes[i]->IsChecked() ) ); - } + SdrView* pView = mrBase.GetDrawView(); + if( !pView ) + return; - SdrView* pView = mrBase.GetDrawView(); - if( pView ) - { - const rtl::Reference< sdr::SelectionController >& xController( pView->getSelectionController() ); - if( xController.is() ) - { - xController->Execute( aReq ); + const rtl::Reference< sdr::SelectionController >& xController( pView->getSelectionController() ); + if( xController.is() ) + { + xController->Execute( aReq ); - SfxBindings* pBindings = getBindings( mrBase ); - if( pBindings ) - { - pBindings->Invalidate( SID_UNDO ); - pBindings->Invalidate( SID_REDO ); - } - } + SfxBindings* pBindings = getBindings( mrBase ); + if( pBindings ) + { + pBindings->Invalidate( SID_UNDO ); + pBindings->Invalidate( SID_REDO ); } } } @@ -282,36 +282,36 @@ void TableValueSet::Resize() { ValueSet::Resize(); // Calculate the number of rows and columns. - if( GetItemCount() > 0 ) - { - Size aValueSetSize = GetSizePixel(); + if( GetItemCount() <= 0 ) + return; + + Size aValueSetSize = GetSizePixel(); - Image aImage = GetItemImage(GetItemId(0)); - Size aItemSize = aImage.GetSizePixel(); + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = aImage.GetSizePixel(); - aItemSize.AdjustHeight(10 ); - int nColumnCount = (aValueSetSize.Width() - GetScrollWidth()) / aItemSize.Width(); - if (nColumnCount < 1) - nColumnCount = 1; + aItemSize.AdjustHeight(10 ); + int nColumnCount = (aValueSetSize.Width() - GetScrollWidth()) / aItemSize.Width(); + if (nColumnCount < 1) + nColumnCount = 1; - int nRowCount = (GetItemCount() + nColumnCount - 1) / nColumnCount; - if (nRowCount < 1) - nRowCount = 1; + int nRowCount = (GetItemCount() + nColumnCount - 1) / nColumnCount; + if (nRowCount < 1) + nRowCount = 1; - int nVisibleRowCount = (aValueSetSize.Height()+2) / aItemSize.Height(); + int nVisibleRowCount = (aValueSetSize.Height()+2) / aItemSize.Height(); - SetColCount (static_cast<sal_uInt16>(nColumnCount)); - SetLineCount (static_cast<sal_uInt16>(nRowCount)); + SetColCount (static_cast<sal_uInt16>(nColumnCount)); + SetLineCount (static_cast<sal_uInt16>(nRowCount)); - if( !m_bModal ) + if( !m_bModal ) + { + WinBits nStyle = GetStyle() & ~WB_VSCROLL; + if( nRowCount > nVisibleRowCount ) { - WinBits nStyle = GetStyle() & ~WB_VSCROLL; - if( nRowCount > nVisibleRowCount ) - { - nStyle |= WB_VSCROLL; - } - SetStyle( nStyle ); + nStyle |= WB_VSCROLL; } + SetStyle( nStyle ); } } @@ -438,26 +438,26 @@ CellInfo::CellInfo( const Reference< XStyle >& xStyle ) : maBorder(SDRATTR_TABLE_BORDER) { SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle ); - if( pStyleSheet ) - { - SfxItemSet& rSet = pStyleSheet->GetItemSet(); + if( !pStyleSheet ) + return; - // get style fill color - if( !GetDraftFillColor(rSet, maCellColor) ) - maCellColor = COL_TRANSPARENT; + SfxItemSet& rSet = pStyleSheet->GetItemSet(); - // get style text color - const SvxColorItem* pTextColor = rSet.GetItem(EE_CHAR_COLOR); - if( pTextColor ) - maTextColor = pTextColor->GetValue(); - else - maTextColor = COL_TRANSPARENT; + // get style fill color + if( !GetDraftFillColor(rSet, maCellColor) ) + maCellColor = COL_TRANSPARENT; - // get border - const SvxBoxItem* pBoxItem = rSet.GetItem( SDRATTR_TABLE_BORDER ); - if( pBoxItem ) - maBorder = *pBoxItem; - } + // get style text color + const SvxColorItem* pTextColor = rSet.GetItem(EE_CHAR_COLOR); + if( pTextColor ) + maTextColor = pTextColor->GetValue(); + else + maTextColor = COL_TRANSPARENT; + + // get border + const SvxBoxItem* pBoxItem = rSet.GetItem( SDRATTR_TABLE_BORDER ); + if( pBoxItem ) + maBorder = *pBoxItem; } typedef std::vector< std::shared_ptr< CellInfo > > CellInfoVector; @@ -484,7 +484,10 @@ struct TableStyleSettings static void FillCellInfoVector( const Reference< XIndexAccess >& xTableStyle, CellInfoVector& rVector ) { DBG_ASSERT( xTableStyle.is() && (xTableStyle->getCount() == sdr::table::style_count ), "sd::FillCellInfoVector(), invalid table style!" ); - if( xTableStyle.is() ) try + if( !xTableStyle.is() ) + return; + + try { rVector.resize( sdr::table::style_count ); diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index dfb5933926c8..339f2cc76e41 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -81,22 +81,25 @@ namespace sd static void apply_table_style( SdrTableObj* pObj, SdrModel const * pModel, const OUString& sTableStyle ) { - if( pModel && pObj ) + if( !(pModel && pObj) ) + return; + + Reference< XNameAccess > xPool( dynamic_cast< XNameAccess* >( pModel->GetStyleSheetPool() ) ); + if( !xPool.is() ) + return; + + try { - Reference< XNameAccess > xPool( dynamic_cast< XNameAccess* >( pModel->GetStyleSheetPool() ) ); - if( xPool.is() ) try - { - Reference< XNameContainer > xTableFamily( xPool->getByName( "table" ), UNO_QUERY_THROW ); - OUString aStdName( "default" ); - if( !sTableStyle.isEmpty() ) - aStdName = sTableStyle; - Reference< XIndexAccess > xStyle( xTableFamily->getByName( aStdName ), UNO_QUERY_THROW ); - pObj->setTableStyle( xStyle ); - } - catch( Exception& ) - { - OSL_FAIL("sd::apply_default_table_style(), exception caught!"); - } + Reference< XNameContainer > xTableFamily( xPool->getByName( "table" ), UNO_QUERY_THROW ); + OUString aStdName( "default" ); + if( !sTableStyle.isEmpty() ) + aStdName = sTableStyle; + Reference< XIndexAccess > xStyle( xTableFamily->getByName( aStdName ), UNO_QUERY_THROW ); + pObj->setTableStyle( xStyle ); + } + catch( Exception& ) + { + OSL_FAIL("sd::apply_default_table_style(), exception caught!"); } } @@ -262,26 +265,26 @@ void CreateTableFromRTF( SvStream& rStream, SdDrawDocument* pModel ) { rStream.Seek( 0 ); - if( pModel ) - { - SdrPage* pPage = pModel->GetPage(0); - if( pPage ) - { - Size aSize( 200, 200 ); - ::tools::Rectangle aRect (Point(), aSize); - sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( - *pModel, - aRect, - 1, - 1); - pObj->NbcSetStyleSheet( pModel->GetDefaultStyleSheet(), true ); - apply_table_style( pObj, pModel, OUString() ); - - pPage->NbcInsertObject( pObj ); - - sdr::table::SdrTableObj::ImportAsRTF( rStream, *pObj ); - } - } + if( !pModel ) + return; + + SdrPage* pPage = pModel->GetPage(0); + if( !pPage ) + return; + + Size aSize( 200, 200 ); + ::tools::Rectangle aRect (Point(), aSize); + sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( + *pModel, + aRect, + 1, + 1); + pObj->NbcSetStyleSheet( pModel->GetDefaultStyleSheet(), true ); + apply_table_style( pObj, pModel, OUString() ); + + pPage->NbcInsertObject( pObj ); + + sdr::table::SdrTableObj::ImportAsRTF( rStream, *pObj ); } } diff --git a/sd/source/ui/table/tableobjectbar.cxx b/sd/source/ui/table/tableobjectbar.cxx index 9b01ee63a290..d3b6aed2da73 100644 --- a/sd/source/ui/table/tableobjectbar.cxx +++ b/sd/source/ui/table/tableobjectbar.cxx @@ -121,111 +121,111 @@ void TableObjectBar::GetAttrState( SfxItemSet& rSet ) void TableObjectBar::Execute( SfxRequest& rReq ) { - if( mpView ) - { - SdrView* pView = mpView; - SfxBindings* pBindings = &mpViewSh->GetViewFrame()->GetBindings(); + if( !mpView ) + return; - rtl::Reference< sdr::SelectionController > xController( mpView->getSelectionController() ); - sal_uLong nSlotId = rReq.GetSlot(); - if( xController.is() ) + SdrView* pView = mpView; + SfxBindings* pBindings = &mpViewSh->GetViewFrame()->GetBindings(); + + rtl::Reference< sdr::SelectionController > xController( mpView->getSelectionController() ); + sal_uLong nSlotId = rReq.GetSlot(); + if( xController.is() ) + { + switch( nSlotId ) + { + case SID_TABLE_INSERT_ROW_DLG: + case SID_TABLE_INSERT_ROW_BEFORE: + case SID_TABLE_INSERT_ROW_AFTER: + case SID_TABLE_INSERT_COL_DLG: + case SID_TABLE_INSERT_COL_BEFORE: + case SID_TABLE_INSERT_COL_AFTER: { - switch( nSlotId ) + ScopedVclPtr<SvxAbstractInsRowColDlg> pDlg; + if (nSlotId == SID_TABLE_INSERT_ROW_DLG || nSlotId == SID_TABLE_INSERT_COL_DLG) { - case SID_TABLE_INSERT_ROW_DLG: - case SID_TABLE_INSERT_ROW_BEFORE: - case SID_TABLE_INSERT_ROW_AFTER: - case SID_TABLE_INSERT_COL_DLG: - case SID_TABLE_INSERT_COL_BEFORE: - case SID_TABLE_INSERT_COL_AFTER: + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + vcl::Window* pWin = mpView->GetViewShell()->GetParentWindow(); + pDlg.disposeAndReset( pFact->CreateSvxInsRowColDlg(pWin ? pWin->GetFrameWeld() : nullptr, + nSlotId == SID_TABLE_INSERT_COL_DLG, + SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) ); + + if (pDlg->Execute() != 1) + break; + } + + sal_uInt16 nCount = 1; + bool bInsertAfter = (nSlotId == SID_TABLE_INSERT_ROW_AFTER) || (nSlotId == SID_TABLE_INSERT_COL_AFTER); + + if (nSlotId == SID_TABLE_INSERT_ROW_DLG) { - ScopedVclPtr<SvxAbstractInsRowColDlg> pDlg; - if (nSlotId == SID_TABLE_INSERT_ROW_DLG || nSlotId == SID_TABLE_INSERT_COL_DLG) - { - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - vcl::Window* pWin = mpView->GetViewShell()->GetParentWindow(); - pDlg.disposeAndReset( pFact->CreateSvxInsRowColDlg(pWin ? pWin->GetFrameWeld() : nullptr, - nSlotId == SID_TABLE_INSERT_COL_DLG, - SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) ); - - if (pDlg->Execute() != 1) - break; - } - - sal_uInt16 nCount = 1; - bool bInsertAfter = (nSlotId == SID_TABLE_INSERT_ROW_AFTER) || (nSlotId == SID_TABLE_INSERT_COL_AFTER); - - if (nSlotId == SID_TABLE_INSERT_ROW_DLG) - { - nCount = pDlg->getInsertCount(); - bInsertAfter = !pDlg->isInsertBefore(); - } - else if (nSlotId == SID_TABLE_INSERT_COL_DLG) - { - nCount = pDlg->getInsertCount(); - bInsertAfter = !pDlg->isInsertBefore(); - } - - if (nSlotId == SID_TABLE_INSERT_ROW_DLG || nSlotId == SID_TABLE_INSERT_ROW_BEFORE || nSlotId == SID_TABLE_INSERT_ROW_AFTER) - nSlotId = SID_TABLE_INSERT_ROW; - else - nSlotId = SID_TABLE_INSERT_COL; - - rReq.AppendItem(SfxInt16Item(static_cast<sal_uInt16>(nSlotId), nCount)); - rReq.AppendItem(SfxBoolItem(SID_TABLE_PARAM_INSERT_AFTER, bInsertAfter)); - - rReq.SetSlot( static_cast<sal_uInt16>(nSlotId) ); + nCount = pDlg->getInsertCount(); + bInsertAfter = !pDlg->isInsertBefore(); } + else if (nSlotId == SID_TABLE_INSERT_COL_DLG) + { + nCount = pDlg->getInsertCount(); + bInsertAfter = !pDlg->isInsertBefore(); } - xController->Execute( rReq ); - } + if (nSlotId == SID_TABLE_INSERT_ROW_DLG || nSlotId == SID_TABLE_INSERT_ROW_BEFORE || nSlotId == SID_TABLE_INSERT_ROW_AFTER) + nSlotId = SID_TABLE_INSERT_ROW; + else + nSlotId = SID_TABLE_INSERT_COL; - // note: we may be deleted at this point, no more member access possible + rReq.AppendItem(SfxInt16Item(static_cast<sal_uInt16>(nSlotId), nCount)); + rReq.AppendItem(SfxBoolItem(SID_TABLE_PARAM_INSERT_AFTER, bInsertAfter)); - switch( rReq.GetSlot() ) - { - case SID_ATTR_BORDER: - case SID_TABLE_MERGE_CELLS: - case SID_TABLE_SPLIT_CELLS: - case SID_OPTIMIZE_TABLE: - case SID_TABLE_DELETE_ROW: - case SID_TABLE_DELETE_COL: - case SID_FORMAT_TABLE_DLG: - case SID_TABLE_INSERT_ROW: - case SID_TABLE_INSERT_COL: - { - pView->AdjustMarkHdl(); - pBindings->Invalidate( SID_TABLE_DELETE_ROW ); - pBindings->Invalidate( SID_TABLE_DELETE_COL ); - pBindings->Invalidate( SID_FRAME_LINESTYLE ); - pBindings->Invalidate( SID_FRAME_LINECOLOR ); - pBindings->Invalidate( SID_ATTR_BORDER ); - pBindings->Invalidate( SID_ATTR_FILL_STYLE ); - pBindings->Invalidate( SID_ATTR_FILL_TRANSPARENCE ); - pBindings->Invalidate( SID_ATTR_FILL_FLOATTRANSPARENCE ); - pBindings->Invalidate( SID_TABLE_MERGE_CELLS ); - pBindings->Invalidate( SID_TABLE_SPLIT_CELLS ); - pBindings->Invalidate( SID_OPTIMIZE_TABLE ); - pBindings->Invalidate( SID_TABLE_VERT_BOTTOM ); - pBindings->Invalidate( SID_TABLE_VERT_CENTER ); - pBindings->Invalidate( SID_TABLE_VERT_NONE ); - break; - } - case SID_TABLE_VERT_BOTTOM: - case SID_TABLE_VERT_CENTER: - case SID_TABLE_VERT_NONE: - { - pBindings->Invalidate( SID_TABLE_VERT_BOTTOM ); - pBindings->Invalidate( SID_TABLE_VERT_CENTER ); - pBindings->Invalidate( SID_TABLE_VERT_NONE ); - break; + rReq.SetSlot( static_cast<sal_uInt16>(nSlotId) ); } } - pBindings->Invalidate( SID_UNDO ); - pBindings->Invalidate( SID_REDO ); + xController->Execute( rReq ); + } + + // note: we may be deleted at this point, no more member access possible + + switch( rReq.GetSlot() ) + { + case SID_ATTR_BORDER: + case SID_TABLE_MERGE_CELLS: + case SID_TABLE_SPLIT_CELLS: + case SID_OPTIMIZE_TABLE: + case SID_TABLE_DELETE_ROW: + case SID_TABLE_DELETE_COL: + case SID_FORMAT_TABLE_DLG: + case SID_TABLE_INSERT_ROW: + case SID_TABLE_INSERT_COL: + { + pView->AdjustMarkHdl(); + pBindings->Invalidate( SID_TABLE_DELETE_ROW ); + pBindings->Invalidate( SID_TABLE_DELETE_COL ); + pBindings->Invalidate( SID_FRAME_LINESTYLE ); + pBindings->Invalidate( SID_FRAME_LINECOLOR ); + pBindings->Invalidate( SID_ATTR_BORDER ); + pBindings->Invalidate( SID_ATTR_FILL_STYLE ); + pBindings->Invalidate( SID_ATTR_FILL_TRANSPARENCE ); + pBindings->Invalidate( SID_ATTR_FILL_FLOATTRANSPARENCE ); + pBindings->Invalidate( SID_TABLE_MERGE_CELLS ); + pBindings->Invalidate( SID_TABLE_SPLIT_CELLS ); + pBindings->Invalidate( SID_OPTIMIZE_TABLE ); + pBindings->Invalidate( SID_TABLE_VERT_BOTTOM ); + pBindings->Invalidate( SID_TABLE_VERT_CENTER ); + pBindings->Invalidate( SID_TABLE_VERT_NONE ); + break; + } + case SID_TABLE_VERT_BOTTOM: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_NONE: + { + pBindings->Invalidate( SID_TABLE_VERT_BOTTOM ); + pBindings->Invalidate( SID_TABLE_VERT_CENTER ); + pBindings->Invalidate( SID_TABLE_VERT_NONE ); + break; + } } + + pBindings->Invalidate( SID_UNDO ); + pBindings->Invalidate( SID_REDO ); } } } } diff --git a/sd/source/ui/tools/ConfigurationAccess.cxx b/sd/source/ui/tools/ConfigurationAccess.cxx index 8db7f7594181..b62a26d0c113 100644 --- a/sd/source/ui/tools/ConfigurationAccess.cxx +++ b/sd/source/ui/tools/ConfigurationAccess.cxx @@ -126,23 +126,23 @@ void ConfigurationAccess::ForAll ( const ::std::vector<OUString>& rArguments, const Functor& rFunctor) { - 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) + const OUString& rsKey (aKeys[nItemIndex]); + Reference<container::XNameAccess> xSetItem (rxContainer->getByName(rsKey), UNO_QUERY); + if (xSetItem.is()) { - const OUString& rsKey (aKeys[nItemIndex]); - Reference<container::XNameAccess> xSetItem (rxContainer->getByName(rsKey), UNO_QUERY); - 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) - aValues[nValueIndex] = xSetItem->getByName(rArguments[nValueIndex]); - } - rFunctor(rsKey, aValues); + // 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) + aValues[nValueIndex] = xSetItem->getByName(rArguments[nValueIndex]); } + rFunctor(rsKey, aValues); } } diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index 3b135db46ad7..4184f3ed8dd5 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -222,31 +222,31 @@ EventMultiplexer::Implementation::Implementation (ViewShellBase& rBase) // Listen for configuration changes. Reference<XControllerManager> xControllerManager ( Reference<XWeak>(&mrBase.GetDrawController()), UNO_QUERY); - if (xControllerManager.is()) - { - Reference<XConfigurationController> xConfigurationController ( - xControllerManager->getConfigurationController()); - mxConfigurationControllerWeak = xConfigurationController; - if (xConfigurationController.is()) - { - Reference<XComponent> xComponent (xConfigurationController, UNO_QUERY); - if (xComponent.is()) - xComponent->addEventListener(static_cast<beans::XPropertyChangeListener*>(this)); - - xConfigurationController->addConfigurationChangeListener( - this, - FrameworkHelper::msResourceActivationEvent, - makeAny(ResourceActivationEvent)); - xConfigurationController->addConfigurationChangeListener( - this, - FrameworkHelper::msResourceDeactivationEvent, - makeAny(ResourceDeactivationEvent)); - xConfigurationController->addConfigurationChangeListener( - this, - FrameworkHelper::msConfigurationUpdateEndEvent, - makeAny(ConfigurationUpdateEvent)); - } - } + if (!xControllerManager.is()) + return; + + Reference<XConfigurationController> xConfigurationController ( + xControllerManager->getConfigurationController()); + mxConfigurationControllerWeak = xConfigurationController; + if (!xConfigurationController.is()) + return; + + Reference<XComponent> xComponent (xConfigurationController, UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener(static_cast<beans::XPropertyChangeListener*>(this)); + + xConfigurationController->addConfigurationChangeListener( + this, + FrameworkHelper::msResourceActivationEvent, + makeAny(ResourceActivationEvent)); + xConfigurationController->addConfigurationChangeListener( + this, + FrameworkHelper::msResourceDeactivationEvent, + makeAny(ResourceDeactivationEvent)); + xConfigurationController->addConfigurationChangeListener( + this, + FrameworkHelper::msConfigurationUpdateEndEvent, + makeAny(ConfigurationUpdateEvent)); } EventMultiplexer::Implementation::~Implementation() @@ -372,50 +372,50 @@ void EventMultiplexer::Implementation::ConnectToController() void EventMultiplexer::Implementation::DisconnectFromController() { - if (mbListeningToController) - { - mbListeningToController = false; + if (!mbListeningToController) + return; - Reference<frame::XController> xController = mxControllerWeak; + mbListeningToController = false; - Reference<beans::XPropertySet> xSet (xController, UNO_QUERY); - // Remove the property listener. - if (xSet.is()) - { - try - { - xSet->removePropertyChangeListener(aCurrentPagePropertyName, this); - } - catch (const beans::UnknownPropertyException&) - { - SAL_WARN("sd", "DisconnectFromController: CurrentPage unknown"); - } + Reference<frame::XController> xController = mxControllerWeak; - try - { - xSet->removePropertyChangeListener(aEditModePropertyName, this); - } - catch (const beans::UnknownPropertyException&) - { - SAL_WARN("sd", "DisconnectFromController: IsMasterPageMode unknown"); - } + Reference<beans::XPropertySet> xSet (xController, UNO_QUERY); + // Remove the property listener. + if (xSet.is()) + { + try + { + xSet->removePropertyChangeListener(aCurrentPagePropertyName, this); } - - // Remove selection change listener. - Reference<view::XSelectionSupplier> xSelection (xController, UNO_QUERY); - if (xSelection.is()) + catch (const beans::UnknownPropertyException&) { - xSelection->removeSelectionChangeListener(this); + SAL_WARN("sd", "DisconnectFromController: CurrentPage unknown"); } - // Remove listener for disposing events. - Reference<lang::XComponent> xComponent (xController, UNO_QUERY); - if (xComponent.is()) + try + { + xSet->removePropertyChangeListener(aEditModePropertyName, this); + } + catch (const beans::UnknownPropertyException&) { - xComponent->removeEventListener ( - Reference<lang::XEventListener>(static_cast<XWeak*>(this), UNO_QUERY)); + SAL_WARN("sd", "DisconnectFromController: IsMasterPageMode unknown"); } } + + // Remove selection change listener. + Reference<view::XSelectionSupplier> xSelection (xController, UNO_QUERY); + if (xSelection.is()) + { + xSelection->removeSelectionChangeListener(this); + } + + // Remove listener for disposing events. + Reference<lang::XComponent> xComponent (xController, UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener ( + Reference<lang::XEventListener>(static_cast<XWeak*>(this), UNO_QUERY)); + } } //===== lang::XEventListener ================================================ @@ -474,29 +474,31 @@ void SAL_CALL EventMultiplexer::Implementation::frameAction ( const frame::FrameActionEvent& rEvent) { Reference<frame::XFrame> xFrame (mxFrameWeak); - if (rEvent.Frame == xFrame) - switch (rEvent.Action) - { - case frame::FrameAction_COMPONENT_DETACHING: - DisconnectFromController(); - CallListeners (EventMultiplexerEventId::ControllerDetached); - break; + if (rEvent.Frame != xFrame) + return; - case frame::FrameAction_COMPONENT_REATTACHED: - CallListeners (EventMultiplexerEventId::ControllerDetached); - DisconnectFromController(); - ConnectToController(); - CallListeners (EventMultiplexerEventId::ControllerAttached); - break; + switch (rEvent.Action) + { + case frame::FrameAction_COMPONENT_DETACHING: + DisconnectFromController(); + CallListeners (EventMultiplexerEventId::ControllerDetached); + break; - case frame::FrameAction_COMPONENT_ATTACHED: - ConnectToController(); - CallListeners (EventMultiplexerEventId::ControllerAttached); - break; + case frame::FrameAction_COMPONENT_REATTACHED: + CallListeners (EventMultiplexerEventId::ControllerDetached); + DisconnectFromController(); + ConnectToController(); + CallListeners (EventMultiplexerEventId::ControllerAttached); + break; - default: - break; - } + case frame::FrameAction_COMPONENT_ATTACHED: + ConnectToController(); + CallListeners (EventMultiplexerEventId::ControllerAttached); + break; + + default: + break; + } } //===== view::XSelectionChangeListener ======================================== diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index c12930b10ece..7a14af3ee683 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -302,30 +302,30 @@ void PreviewRenderer::PaintPage ( void PreviewRenderer::PaintSubstitutionText (const OUString& rSubstitutionText) { - if (!rSubstitutionText.isEmpty()) - { - // Set the font size. - const vcl::Font& rOriginalFont (mpPreviewDevice->GetFont()); - vcl::Font aFont (mpPreviewDevice->GetSettings().GetStyleSettings().GetAppFont()); - sal_Int32 nHeight (mpPreviewDevice->PixelToLogic(Size(0,snSubstitutionTextSize)).Height()); - aFont.SetFontHeight(nHeight); - mpPreviewDevice->SetFont (aFont); - - // Paint the substitution text. - ::tools::Rectangle aTextBox ( - Point(0,0), - mpPreviewDevice->PixelToLogic( - mpPreviewDevice->GetOutputSizePixel())); - DrawTextFlags const nTextStyle = - DrawTextFlags::Center - | DrawTextFlags::VCenter - | DrawTextFlags::MultiLine - | DrawTextFlags::WordBreak; - mpPreviewDevice->DrawText (aTextBox, rSubstitutionText, nTextStyle); - - // Restore the font. - mpPreviewDevice->SetFont (rOriginalFont); - } + if (rSubstitutionText.isEmpty()) + return; + + // Set the font size. + const vcl::Font& rOriginalFont (mpPreviewDevice->GetFont()); + vcl::Font aFont (mpPreviewDevice->GetSettings().GetStyleSettings().GetAppFont()); + sal_Int32 nHeight (mpPreviewDevice->PixelToLogic(Size(0,snSubstitutionTextSize)).Height()); + aFont.SetFontHeight(nHeight); + mpPreviewDevice->SetFont (aFont); + + // Paint the substitution text. + ::tools::Rectangle aTextBox ( + Point(0,0), + mpPreviewDevice->PixelToLogic( + mpPreviewDevice->GetOutputSizePixel())); + DrawTextFlags const nTextStyle = + DrawTextFlags::Center + | DrawTextFlags::VCenter + | DrawTextFlags::MultiLine + | DrawTextFlags::WordBreak; + mpPreviewDevice->DrawText (aTextBox, rSubstitutionText, nTextStyle); + + // Restore the font. + mpPreviewDevice->SetFont (rOriginalFont); } void PreviewRenderer::PaintFrame() diff --git a/sd/source/ui/tools/PropertySet.cxx b/sd/source/ui/tools/PropertySet.cxx index c92a2c4d0026..980c15bf5b27 100644 --- a/sd/source/ui/tools/PropertySet.cxx +++ b/sd/source/ui/tools/PropertySet.cxx @@ -53,20 +53,20 @@ void SAL_CALL PropertySet::setPropertyValue ( ThrowIfDisposed(); Any aOldValue (SetPropertyValue(rsPropertyName,rsPropertyValue)); - if (aOldValue != rsPropertyValue) - { - // Inform listeners that are registered specifically for the - // property and those registered for any property. - beans::PropertyChangeEvent aEvent( - static_cast<XWeak*>(this), - rsPropertyName, - false, - -1, - aOldValue, - rsPropertyValue); - CallListeners(rsPropertyName, aEvent); - CallListeners(OUString(), aEvent); - } + if (aOldValue == rsPropertyValue) + return; + + // Inform listeners that are registered specifically for the + // property and those registered for any property. + beans::PropertyChangeEvent aEvent( + static_cast<XWeak*>(this), + rsPropertyName, + false, + -1, + aOldValue, + rsPropertyValue); + CallListeners(rsPropertyName, aEvent); + CallListeners(OUString(), aEvent); } Any SAL_CALL PropertySet::getPropertyValue (const OUString& rsPropertyName) diff --git a/sd/source/ui/tools/TimerBasedTaskExecution.cxx b/sd/source/ui/tools/TimerBasedTaskExecution.cxx index 379665e32f6a..fb9f42cb96c1 100644 --- a/sd/source/ui/tools/TimerBasedTaskExecution.cxx +++ b/sd/source/ui/tools/TimerBasedTaskExecution.cxx @@ -63,20 +63,20 @@ void TimerBasedTaskExecution::Release() void TimerBasedTaskExecution::ReleaseTask ( const std::weak_ptr<TimerBasedTaskExecution>& rpExecution) { - if ( ! rpExecution.expired()) + if ( rpExecution.expired()) + return; + + try { - try - { - std::shared_ptr<tools::TimerBasedTaskExecution> pExecution (rpExecution); - pExecution->Release(); - } - catch (const std::bad_weak_ptr&) - { - // When a bad_weak_ptr has been thrown then the object pointed - // to by rpTask has been released right after we checked that it - // still existed. Too bad, but that means, that we have nothing - // more do. - } + std::shared_ptr<tools::TimerBasedTaskExecution> pExecution (rpExecution); + pExecution->Release(); + } + catch (const std::bad_weak_ptr&) + { + // When a bad_weak_ptr has been thrown then the object pointed + // to by rpTask has been released right after we checked that it + // still existed. Too bad, but that means, that we have nothing + // more do. } } @@ -101,30 +101,30 @@ TimerBasedTaskExecution::~TimerBasedTaskExecution() IMPL_LINK_NOARG(TimerBasedTaskExecution, TimerCallback, Timer *, void) { - if (mpTask != nullptr) + if (mpTask == nullptr) + return; + + if (mpTask->HasNextStep()) { - if (mpTask->HasNextStep()) + // Execute as many steps as fit into the time span of length + // mnMaxTimePerStep. Note that the last step may take longer + // than allowed. + sal_uInt32 nStartTime (::tools::Time( ::tools::Time::SYSTEM ).GetMSFromTime()); + SAL_INFO("sd.tools", OSL_THIS_FUNC << ": starting TimerBasedTaskExecution at " << nStartTime); + do { - // Execute as many steps as fit into the time span of length - // mnMaxTimePerStep. Note that the last step may take longer - // than allowed. - sal_uInt32 nStartTime (::tools::Time( ::tools::Time::SYSTEM ).GetMSFromTime()); - SAL_INFO("sd.tools", OSL_THIS_FUNC << ": starting TimerBasedTaskExecution at " << nStartTime); - do - { - mpTask->RunNextStep(); - sal_uInt32 nDuration (::tools::Time( ::tools::Time::SYSTEM ).GetMSFromTime()-nStartTime); - SAL_INFO("sd.tools", OSL_THIS_FUNC << ": executed step in " << nDuration); - if (nDuration > mnMaxTimePerStep) - break; - } - while (mpTask->HasNextStep()); - SAL_INFO("sd.tools", OSL_THIS_FUNC << ": TimerBasedTaskExecution sleeping"); - maTimer.Start(); + mpTask->RunNextStep(); + sal_uInt32 nDuration (::tools::Time( ::tools::Time::SYSTEM ).GetMSFromTime()-nStartTime); + SAL_INFO("sd.tools", OSL_THIS_FUNC << ": executed step in " << nDuration); + if (nDuration > mnMaxTimePerStep) + break; } - else - mpSelf.reset(); + while (mpTask->HasNextStep()); + SAL_INFO("sd.tools", OSL_THIS_FUNC << ": TimerBasedTaskExecution sleeping"); + maTimer.Start(); } + else + mpSelf.reset(); } } } // end of namespace ::sd::tools diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 8f7cd937efa4..2085e77b2d74 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -126,42 +126,42 @@ IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController); void SAL_CALL DrawController::dispose() { - if( !mbDisposing ) + if( mbDisposing ) + return; + + SolarMutexGuard aGuard; + + if( mbDisposing ) + return; + + mbDisposing = true; + + std::shared_ptr<ViewShell> pViewShell; + if (mpBase) + pViewShell = mpBase->GetMainViewShell(); + if ( pViewShell ) { - SolarMutexGuard aGuard; + pViewShell->DeactivateCurrentFunction(); + DrawDocShell* pDocShell = pViewShell->GetDocSh(); + if ( pDocShell != nullptr ) + pDocShell->SetDocShellFunction(nullptr); + } + pViewShell.reset(); - if( !mbDisposing ) - { - mbDisposing = true; - - std::shared_ptr<ViewShell> pViewShell; - if (mpBase) - pViewShell = mpBase->GetMainViewShell(); - if ( pViewShell ) - { - pViewShell->DeactivateCurrentFunction(); - DrawDocShell* pDocShell = pViewShell->GetDocSh(); - if ( pDocShell != nullptr ) - pDocShell->SetDocShellFunction(nullptr); - } - pViewShell.reset(); - - // When the controller has not been detached from its view - // shell, i.e. mpViewShell is not NULL, then tell PaneManager - // and ViewShellManager to clear the shell stack. - if (mxSubController.is() && mpBase!=nullptr) - { - mpBase->DisconnectAllClients(); - mpBase->GetViewShellManager()->Shutdown(); - } - - OPropertySetHelper::disposing(); - - DisposeFrameworkControllers(); - - SfxBaseController::dispose(); - } + // When the controller has not been detached from its view + // shell, i.e. mpViewShell is not NULL, then tell PaneManager + // and ViewShellManager to clear the shell stack. + if (mxSubController.is() && mpBase!=nullptr) + { + mpBase->DisconnectAllClients(); + mpBase->GetViewShellManager()->Shutdown(); } + + OPropertySetHelper::disposing(); + + DisposeFrameworkControllers(); + + SfxBaseController::dispose(); } void SAL_CALL DrawController::addEventListener( @@ -276,23 +276,23 @@ void SAL_CALL // Have to forward the event to our selection change listeners. OInterfaceContainerHelper* pListeners = BroadcastHelperOwner::maBroadcastHelper.getContainer( cppu::UnoType<view::XSelectionChangeListener>::get()); - if (pListeners) + if (!pListeners) + return; + + // Re-send the event to all of our listeners. + OInterfaceIteratorHelper aIterator (*pListeners); + while (aIterator.hasMoreElements()) { - // Re-send the event to all of our listeners. - OInterfaceIteratorHelper aIterator (*pListeners); - while (aIterator.hasMoreElements()) + try + { + view::XSelectionChangeListener* pListener = + static_cast<view::XSelectionChangeListener*>( + aIterator.next()); + if (pListener != nullptr) + pListener->selectionChanged (rEvent); + } + catch (const RuntimeException&) { - try - { - view::XSelectionChangeListener* pListener = - static_cast<view::XSelectionChangeListener*>( - aIterator.next()); - if (pListener != nullptr) - pListener->selectionChanged (rEvent); - } - catch (const RuntimeException&) - { - } } } } @@ -328,51 +328,51 @@ Reference< drawing::XDrawPage > SAL_CALL DrawController::getCurrentPage() void DrawController::FireVisAreaChanged (const ::tools::Rectangle& rVisArea) throw() { - if( maLastVisArea != rVisArea ) - { - Any aNewValue; - aNewValue <<= awt::Rectangle( - rVisArea.Left(), - rVisArea.Top(), - rVisArea.GetWidth(), - rVisArea.GetHeight() ); + if( maLastVisArea == rVisArea ) + return; - Any aOldValue; - aOldValue <<= awt::Rectangle( - maLastVisArea.Left(), - maLastVisArea.Top(), - maLastVisArea.GetWidth(), - maLastVisArea.GetHeight() ); + Any aNewValue; + aNewValue <<= awt::Rectangle( + rVisArea.Left(), + rVisArea.Top(), + rVisArea.GetWidth(), + rVisArea.GetHeight() ); - FirePropertyChange (PROPERTY_WORKAREA, aNewValue, aOldValue); + Any aOldValue; + aOldValue <<= awt::Rectangle( + maLastVisArea.Left(), + maLastVisArea.Top(), + maLastVisArea.GetWidth(), + maLastVisArea.GetHeight() ); - maLastVisArea = rVisArea; - } + FirePropertyChange (PROPERTY_WORKAREA, aNewValue, aOldValue); + + maLastVisArea = rVisArea; } void DrawController::FireSelectionChangeListener() throw() { OInterfaceContainerHelper * pLC = BroadcastHelperOwner::maBroadcastHelper.getContainer( m_aSelectionTypeIdentifier); - if( pLC ) - { - Reference< XInterface > xSource( static_cast<XWeak*>(this) ); - const lang::EventObject aEvent( xSource ); + if( !pLC ) + return; - // iterate over all listeners and send events - OInterfaceIteratorHelper aIt( *pLC); - while( aIt.hasMoreElements() ) + Reference< XInterface > xSource( static_cast<XWeak*>(this) ); + const lang::EventObject aEvent( xSource ); + + // iterate over all listeners and send events + OInterfaceIteratorHelper aIt( *pLC); + while( aIt.hasMoreElements() ) + { + try + { + view::XSelectionChangeListener * pL = + static_cast<view::XSelectionChangeListener*>(aIt.next()); + if (pL != nullptr) + pL->selectionChanged( aEvent ); + } + catch (const RuntimeException&) { - try - { - view::XSelectionChangeListener * pL = - static_cast<view::XSelectionChangeListener*>(aIt.next()); - if (pL != nullptr) - pL->selectionChanged( aEvent ); - } - catch (const RuntimeException&) - { - } } } } @@ -406,28 +406,28 @@ void DrawController::FireChangeLayerMode (bool bLayerMode) throw() void DrawController::FireSwitchCurrentPage (SdPage* pNewCurrentPage) throw() { SdrPage* pCurrentPage = mpCurrentPage.get(); - if (pNewCurrentPage != pCurrentPage) - { - try - { - Any aNewValue ( - makeAny(Reference<drawing::XDrawPage>(pNewCurrentPage->getUnoPage(), UNO_QUERY))); - - Any aOldValue; - if (pCurrentPage != nullptr) - { - Reference<drawing::XDrawPage> xOldPage (pCurrentPage->getUnoPage(), UNO_QUERY); - aOldValue <<= xOldPage; - } + if (pNewCurrentPage == pCurrentPage) + return; - FirePropertyChange(PROPERTY_CURRENTPAGE, aNewValue, aOldValue); + try + { + Any aNewValue ( + makeAny(Reference<drawing::XDrawPage>(pNewCurrentPage->getUnoPage(), UNO_QUERY))); - mpCurrentPage.reset(pNewCurrentPage); - } - catch (const uno::Exception& e) + Any aOldValue; + if (pCurrentPage != nullptr) { - SAL_WARN("sd", "sd::SdUnoDrawView::FireSwitchCurrentPage(), exception caught: " << e); + Reference<drawing::XDrawPage> xOldPage (pCurrentPage->getUnoPage(), UNO_QUERY); + aOldValue <<= xOldPage; } + + FirePropertyChange(PROPERTY_CURRENTPAGE, aNewValue, aOldValue); + + mpCurrentPage.reset(pNewCurrentPage); + } + catch (const uno::Exception& e) + { + SAL_WARN("sd", "sd::SdUnoDrawView::FireSwitchCurrentPage(), exception caught: " << e); } } diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx b/sd/source/ui/unoidl/SdUnoDrawView.cxx index e865853c8c1b..4a133cccdfd3 100644 --- a/sd/source/ui/unoidl/SdUnoDrawView.cxx +++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx @@ -479,35 +479,35 @@ awt::Point SdUnoDrawView::GetViewOffset() const void SdUnoDrawView::SetZoomType ( sal_Int16 nType ) { SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame(); - if( pViewFrame ) + if( !pViewFrame ) + return; + + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if( !pDispatcher ) + return; + + SvxZoomType eZoomType; + switch( nType ) { - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); - if( pDispatcher ) - { - SvxZoomType eZoomType; - switch( nType ) - { - case css::view::DocumentZoomType::OPTIMAL: - eZoomType = SvxZoomType::OPTIMAL; - break; + case css::view::DocumentZoomType::OPTIMAL: + eZoomType = SvxZoomType::OPTIMAL; + break; - case css::view::DocumentZoomType::PAGE_WIDTH: - case css::view::DocumentZoomType::PAGE_WIDTH_EXACT: - eZoomType = SvxZoomType::PAGEWIDTH; - break; + case css::view::DocumentZoomType::PAGE_WIDTH: + case css::view::DocumentZoomType::PAGE_WIDTH_EXACT: + eZoomType = SvxZoomType::PAGEWIDTH; + break; - case css::view::DocumentZoomType::ENTIRE_PAGE: - eZoomType = SvxZoomType::WHOLEPAGE; - break; + case css::view::DocumentZoomType::ENTIRE_PAGE: + eZoomType = SvxZoomType::WHOLEPAGE; + break; - default: - return; - } - SvxZoomItem aZoomItem( eZoomType ); - pDispatcher->ExecuteList(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, - { &aZoomItem }); - } + default: + return; } + SvxZoomItem aZoomItem( eZoomType ); + pDispatcher->ExecuteList(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, + { &aZoomItem }); } SdXImpressDocument* SdUnoDrawView::GetModel() const throw() diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx index 662da98dfad6..d1750c7eaca8 100644 --- a/sd/source/ui/unoidl/unolayer.cxx +++ b/sd/source/ui/unoidl/unolayer.cxx @@ -270,61 +270,61 @@ bool SdLayer::get( LayerAttribute what ) throw() void SdLayer::set( LayerAttribute what, bool flag ) throw() { - if(pLayer && mxLayerManager.is()) - { - // Try 1. is an arbitrary page open? - ::sd::View *pView = mxLayerManager->GetView(); - SdrPageView* pSdrPageView = nullptr; - if(pView) - pSdrPageView = pView->GetSdrPageView(); + if(!(pLayer && mxLayerManager.is())) + return; - if(pSdrPageView) + // Try 1. is an arbitrary page open? + ::sd::View *pView = mxLayerManager->GetView(); + SdrPageView* pSdrPageView = nullptr; + if(pView) + pSdrPageView = pView->GetSdrPageView(); + + if(pSdrPageView) + { + OUString aLayerName(pLayer->GetName()); + switch(what) { - OUString aLayerName(pLayer->GetName()); - switch(what) - { - case VISIBLE: pSdrPageView->SetLayerVisible(aLayerName,flag); - break; - case PRINTABLE: pSdrPageView->SetLayerPrintable(aLayerName,flag); - break; - case LOCKED: pSdrPageView->SetLayerLocked(aLayerName,flag); - break; - } + case VISIBLE: pSdrPageView->SetLayerVisible(aLayerName,flag); + break; + case PRINTABLE: pSdrPageView->SetLayerPrintable(aLayerName,flag); + break; + case LOCKED: pSdrPageView->SetLayerLocked(aLayerName,flag); + break; } + } - // Try 2. get info from FrameView - if(mxLayerManager->GetDocShell()) - { - ::sd::FrameView *pFrameView = mxLayerManager->GetDocShell()->GetFrameView(); + // Try 2. get info from FrameView + if(!mxLayerManager->GetDocShell()) + return; - if(pFrameView) - { - SdrLayerIDSet aNewLayers; - switch(what) - { - case VISIBLE: aNewLayers = pFrameView->GetVisibleLayers(); - break; - case PRINTABLE: aNewLayers = pFrameView->GetPrintableLayers(); - break; - case LOCKED: aNewLayers = pFrameView->GetLockedLayers(); - break; - } + ::sd::FrameView *pFrameView = mxLayerManager->GetDocShell()->GetFrameView(); - aNewLayers.Set(pLayer->GetID(),flag); + if(!pFrameView) + return; - switch(what) - { - case VISIBLE: pFrameView->SetVisibleLayers(aNewLayers); - break; - case PRINTABLE: pFrameView->SetPrintableLayers(aNewLayers); - break; - case LOCKED: pFrameView->SetLockedLayers(aNewLayers); - break; - } - return; - } - } + SdrLayerIDSet aNewLayers; + switch(what) + { + case VISIBLE: aNewLayers = pFrameView->GetVisibleLayers(); + break; + case PRINTABLE: aNewLayers = pFrameView->GetPrintableLayers(); + break; + case LOCKED: aNewLayers = pFrameView->GetLockedLayers(); + break; } + + aNewLayers.Set(pLayer->GetID(),flag); + + switch(what) + { + case VISIBLE: pFrameView->SetVisibleLayers(aNewLayers); + break; + case PRINTABLE: pFrameView->SetPrintableLayers(aNewLayers); + break; + case LOCKED: pFrameView->SetLockedLayers(aNewLayers); + break; + } + return; //TODO: uno::Exception? } @@ -618,19 +618,19 @@ sal_Bool SAL_CALL SdLayerManager::hasElements() */ void SdLayerManager::UpdateLayerView() const throw() { - if(mpModel->mpDocShell) - { - ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell* >( mpModel->mpDocShell->GetViewShell()); + if(!mpModel->mpDocShell) + return; - if(pDrViewSh) - { - bool bLayerMode = pDrViewSh->IsLayerModeActive(); - pDrViewSh->ChangeEditMode(pDrViewSh->GetEditMode(), !bLayerMode); - pDrViewSh->ChangeEditMode(pDrViewSh->GetEditMode(), bLayerMode); - } + ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell* >( mpModel->mpDocShell->GetViewShell()); - mpModel->mpDoc->SetChanged(); + if(pDrViewSh) + { + bool bLayerMode = pDrViewSh->IsLayerModeActive(); + pDrViewSh->ChangeEditMode(pDrViewSh->GetEditMode(), !bLayerMode); + pDrViewSh->ChangeEditMode(pDrViewSh->GetEditMode(), bLayerMode); } + + mpModel->mpDoc->SetChanged(); } /** */ diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 927f33e44eef..b9e8463f38d3 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -315,23 +315,23 @@ void SAL_CALL SdXImpressDocument::acquire() throw ( ) void SAL_CALL SdXImpressDocument::release() throw ( ) { - if (osl_atomic_decrement( &m_refCount ) == 0) + if (osl_atomic_decrement( &m_refCount ) != 0) + return; + + // restore reference count: + osl_atomic_increment( &m_refCount ); + if(!mbDisposed) { - // restore reference count: - osl_atomic_increment( &m_refCount ); - if(!mbDisposed) + try { - try - { - dispose(); - } - catch (const uno::RuntimeException& exc) - { // don't break throw () - SAL_WARN( "sd", exc ); - } + dispose(); + } + catch (const uno::RuntimeException& exc) + { // don't break throw () + SAL_WARN( "sd", exc ); } - SfxBaseModel::release(); } + SfxBaseModel::release(); } namespace @@ -657,23 +657,23 @@ void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container: throw lang::DisposedException(); SfxBaseModel::setViewData( xData ); - if( mpDocShell && (mpDocShell->GetCreateMode() == SfxObjectCreateMode::EMBEDDED) && xData.is() ) - { - const sal_Int32 nCount = xData->getCount(); + if( !(mpDocShell && (mpDocShell->GetCreateMode() == SfxObjectCreateMode::EMBEDDED) && xData.is()) ) + return; - std::vector<std::unique_ptr<sd::FrameView>> &rViews = mpDoc->GetFrameViewList(); + const sal_Int32 nCount = xData->getCount(); - rViews.clear(); + std::vector<std::unique_ptr<sd::FrameView>> &rViews = mpDoc->GetFrameViewList(); - uno::Sequence< beans::PropertyValue > aSeq; - for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + rViews.clear(); + + uno::Sequence< beans::PropertyValue > aSeq; + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + if( xData->getByIndex( nIndex ) >>= aSeq ) { - if( xData->getByIndex( nIndex ) >>= aSeq ) - { - std::unique_ptr<::sd::FrameView> pFrameView(new ::sd::FrameView( mpDoc )); - pFrameView->ReadUserDataSequence( aSeq ); - rViews.push_back( std::move(pFrameView) ); - } + std::unique_ptr<::sd::FrameView> pFrameView(new ::sd::FrameView( mpDoc )); + pFrameView->ReadUserDataSequence( aSeq ); + rViews.push_back( std::move(pFrameView) ); } } } @@ -1890,342 +1890,342 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r if( nullptr == mpDoc ) throw lang::DisposedException(); - if (mpDocShell) - { - uno::Reference< awt::XDevice > xRenderDevice; - const sal_Int32 nPageNumber = nRenderer + 1; - PageKind ePageKind = PageKind::Standard; - bool bExportNotesPages = false; + if (!mpDocShell) + return; + + uno::Reference< awt::XDevice > xRenderDevice; + const sal_Int32 nPageNumber = nRenderer + 1; + PageKind ePageKind = PageKind::Standard; + bool bExportNotesPages = false; - for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) + for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) + { + if ( rxOptions[ nProperty ].Name == "RenderDevice" ) + rxOptions[ nProperty ].Value >>= xRenderDevice; + else if ( rxOptions[ nProperty ].Name == "ExportNotesPages" ) { - if ( rxOptions[ nProperty ].Name == "RenderDevice" ) - rxOptions[ nProperty ].Value >>= xRenderDevice; - else if ( rxOptions[ nProperty ].Name == "ExportNotesPages" ) - { - rxOptions[ nProperty].Value >>= bExportNotesPages; - if ( bExportNotesPages ) - ePageKind = PageKind::Notes; - } + rxOptions[ nProperty].Value >>= bExportNotesPages; + if ( bExportNotesPages ) + ePageKind = PageKind::Notes; } + } - if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) ) - { - VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >(); + if( !(xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) )) ) + return; - if( pOut ) - { - vcl::PDFExtOutDevData* pPDFExtOutDevData = dynamic_cast<vcl::PDFExtOutDevData* >( pOut->GetExtOutDevData() ); + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >(); - if ( !( mpDoc->GetSdPage(static_cast<sal_Int16>(nPageNumber)-1, PageKind::Standard)->IsExcluded() ) || - (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportHiddenSlides()) ) - { - std::unique_ptr<::sd::ClientView> pView( new ::sd::ClientView( mpDocShell, pOut ) ); - ::tools::Rectangle aVisArea = ::tools::Rectangle( Point(), mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )->GetSize() ); - vcl::Region aRegion( aVisArea ); + if( !pOut ) + return; - ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell(); - ::sd::View* pOldSdView = pOldViewSh ? pOldViewSh->GetView() : nullptr; + vcl::PDFExtOutDevData* pPDFExtOutDevData = dynamic_cast<vcl::PDFExtOutDevData* >( pOut->GetExtOutDevData() ); - if ( pOldSdView ) - pOldSdView->SdrEndTextEdit(); + if ( !(!( mpDoc->GetSdPage(static_cast<sal_Int16>(nPageNumber)-1, PageKind::Standard)->IsExcluded() ) || + (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportHiddenSlides())) ) + return; - pView->SetHlplVisible( false ); - pView->SetGridVisible( false ); - pView->SetBordVisible( false ); - pView->SetPageVisible( false ); - pView->SetGlueVisible( false ); + std::unique_ptr<::sd::ClientView> pView( new ::sd::ClientView( mpDocShell, pOut ) ); + ::tools::Rectangle aVisArea = ::tools::Rectangle( Point(), mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )->GetSize() ); + vcl::Region aRegion( aVisArea ); - pOut->SetMapMode(MapMode(MapUnit::Map100thMM)); - pOut->IntersectClipRegion( aVisArea ); + ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell(); + ::sd::View* pOldSdView = pOldViewSh ? pOldViewSh->GetView() : nullptr; - uno::Reference< frame::XModel > xModel; - rSelection >>= xModel; + if ( pOldSdView ) + pOldSdView->SdrEndTextEdit(); - if( xModel == mpDocShell->GetModel() ) - { - pView->ShowSdrPage( mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )); - SdrPageView* pPV = pView->GetSdrPageView(); + pView->SetHlplVisible( false ); + pView->SetGridVisible( false ); + pView->SetBordVisible( false ); + pView->SetPageVisible( false ); + pView->SetGlueVisible( false ); - if( pOldSdView ) - { - SdrPageView* pOldPV = pOldSdView->GetSdrPageView(); - if( pPV && pOldPV ) - { - pPV->SetVisibleLayers( pOldPV->GetVisibleLayers() ); - pPV->SetPrintableLayers( pOldPV->GetPrintableLayers() ); - } - } + pOut->SetMapMode(MapMode(MapUnit::Map100thMM)); + pOut->IntersectClipRegion( aVisArea ); - ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(), - pPV, pPDFExtOutDevData ); + uno::Reference< frame::XModel > xModel; + rSelection >>= xModel; - // background color for outliner :o - SdPage* pPage = pPV ? static_cast<SdPage*>(pPV->GetPage()) : nullptr; - if( pPage ) - { - SdrOutliner& rOutl = mpDoc->GetDrawOutliner(); - bool bScreenDisplay(true); - - // #i75566# printing; suppress AutoColor BackgroundColor generation - // for visibility reasons by giving GetPageBackgroundColor() - // the needed hint - // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see printing) - if (pOut && ((OUTDEV_PRINTER == pOut->GetOutDevType()) - || (OUTDEV_PDF == pOut->GetOutDevType()))) - bScreenDisplay = false; - - // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and - // hint value if screen display. Only then the AutoColor mechanisms shall be applied - rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) ); - } - pView->SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc ); + if( xModel == mpDocShell->GetModel() ) + { + pView->ShowSdrPage( mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )); + SdrPageView* pPV = pView->GetSdrPageView(); + + if( pOldSdView ) + { + SdrPageView* pOldPV = pOldSdView->GetSdrPageView(); + if( pPV && pOldPV ) + { + pPV->SetVisibleLayers( pOldPV->GetVisibleLayers() ); + pPV->SetPrintableLayers( pOldPV->GetPrintableLayers() ); + } + } + + ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(), + pPV, pPDFExtOutDevData ); - if ( pPDFExtOutDevData && pPage ) + // background color for outliner :o + SdPage* pPage = pPV ? static_cast<SdPage*>(pPV->GetPage()) : nullptr; + if( pPage ) + { + SdrOutliner& rOutl = mpDoc->GetDrawOutliner(); + bool bScreenDisplay(true); + + // #i75566# printing; suppress AutoColor BackgroundColor generation + // for visibility reasons by giving GetPageBackgroundColor() + // the needed hint + // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see printing) + if (pOut && ((OUTDEV_PRINTER == pOut->GetOutDevType()) + || (OUTDEV_PDF == pOut->GetOutDevType()))) + bScreenDisplay = false; + + // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and + // hint value if screen display. Only then the AutoColor mechanisms shall be applied + rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) ); + } + pView->SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc ); + + if ( pPDFExtOutDevData && pPage ) + { + try + { + uno::Any aAny; + uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) ); + if ( xPage.is() ) + { + if ( pPDFExtOutDevData->GetIsExportNotes() ) + ImplPDFExportComments( xPage, *pPDFExtOutDevData ); + uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY ); + if( xPagePropSet.is() ) + { + // exporting object interactions to pdf + + // if necessary, the master page interactions will be exported first + bool bIsBackgroundObjectsVisible = false; // #i39428# IsBackgroundObjectsVisible not available for Draw + if ( mbImpressDoc && xPagePropSet->getPropertySetInfo()->hasPropertyByName( "IsBackgroundObjectsVisible" ) ) + xPagePropSet->getPropertyValue( "IsBackgroundObjectsVisible" ) >>= bIsBackgroundObjectsVisible; + if ( bIsBackgroundObjectsVisible && !pPDFExtOutDevData->GetIsExportNotesPages() ) { - try + uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( xPage, uno::UNO_QUERY ); + if ( xMasterPageTarget.is() ) { - uno::Any aAny; - uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) ); - if ( xPage.is() ) + uno::Reference< drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage(); + if ( xMasterPage.is() ) { - if ( pPDFExtOutDevData->GetIsExportNotes() ) - ImplPDFExportComments( xPage, *pPDFExtOutDevData ); - uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY ); - if( xPagePropSet.is() ) + uno::Reference< drawing::XShapes> xShapes( xMasterPage, uno::UNO_QUERY ); + sal_Int32 i, nCount = xShapes->getCount(); + for ( i = 0; i < nCount; i++ ) { - // exporting object interactions to pdf - - // if necessary, the master page interactions will be exported first - bool bIsBackgroundObjectsVisible = false; // #i39428# IsBackgroundObjectsVisible not available for Draw - if ( mbImpressDoc && xPagePropSet->getPropertySetInfo()->hasPropertyByName( "IsBackgroundObjectsVisible" ) ) - xPagePropSet->getPropertyValue( "IsBackgroundObjectsVisible" ) >>= bIsBackgroundObjectsVisible; - if ( bIsBackgroundObjectsVisible && !pPDFExtOutDevData->GetIsExportNotesPages() ) - { - uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( xPage, uno::UNO_QUERY ); - if ( xMasterPageTarget.is() ) - { - uno::Reference< drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage(); - if ( xMasterPage.is() ) - { - uno::Reference< drawing::XShapes> xShapes( xMasterPage, uno::UNO_QUERY ); - sal_Int32 i, nCount = xShapes->getCount(); - for ( i = 0; i < nCount; i++ ) - { - aAny = xShapes->getByIndex( i ); - uno::Reference< drawing::XShape > xShape; - if ( aAny >>= xShape ) - ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData ); - } - } - } - } - - // exporting slide page object interactions - uno::Reference< drawing::XShapes> xShapes( xPage, uno::UNO_QUERY ); - sal_Int32 i, nCount = xShapes->getCount(); - for ( i = 0; i < nCount; i++ ) - { - aAny = xShapes->getByIndex( i ); - uno::Reference< drawing::XShape > xShape; - if ( aAny >>= xShape ) - ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData ); - } - - // exporting transition effects to pdf - if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && pPDFExtOutDevData->GetIsExportTransitionEffects() ) - { - const OUString sEffect( "Effect" ); - const OUString sSpeed ( "Speed" ); - sal_Int32 nTime = 800; - presentation::AnimationSpeed aAs; - if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) ) - { - aAny = xPagePropSet->getPropertyValue( sSpeed ); - if ( aAny >>= aAs ) - { - switch( aAs ) - { - case presentation::AnimationSpeed_SLOW : nTime = 1500; break; - case presentation::AnimationSpeed_FAST : nTime = 300; break; - default: - case presentation::AnimationSpeed_MEDIUM : nTime = 800; - } - } - } - presentation::FadeEffect eFe; - vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::PageTransition::Regular; - if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) ) - { - aAny = xPagePropSet->getPropertyValue( sEffect ); - if ( aAny >>= eFe ) - { - switch( eFe ) - { - case presentation::FadeEffect_HORIZONTAL_LINES : - case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD : - case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::PageTransition::BlindsHorizontal; break; - - case presentation::FadeEffect_VERTICAL_LINES : - case presentation::FadeEffect_VERTICAL_CHECKERBOARD : - case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::PageTransition::BlindsVertical; break; - - case presentation::FadeEffect_UNCOVER_TO_RIGHT : - case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT : - case presentation::FadeEffect_ROLL_FROM_LEFT : - case presentation::FadeEffect_FADE_FROM_UPPERLEFT : - case presentation::FadeEffect_MOVE_FROM_UPPERLEFT : - case presentation::FadeEffect_FADE_FROM_LEFT : - case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::PageTransition::WipeLeftToRight; break; - - case presentation::FadeEffect_UNCOVER_TO_BOTTOM : - case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT : - case presentation::FadeEffect_ROLL_FROM_TOP : - case presentation::FadeEffect_FADE_FROM_UPPERRIGHT : - case presentation::FadeEffect_MOVE_FROM_UPPERRIGHT : - case presentation::FadeEffect_FADE_FROM_TOP : - case presentation::FadeEffect_MOVE_FROM_TOP : eType = vcl::PDFWriter::PageTransition::WipeTopToBottom; break; - - case presentation::FadeEffect_UNCOVER_TO_LEFT : - case presentation::FadeEffect_UNCOVER_TO_LOWERLEFT : - case presentation::FadeEffect_ROLL_FROM_RIGHT : - - case presentation::FadeEffect_FADE_FROM_LOWERRIGHT : - case presentation::FadeEffect_MOVE_FROM_LOWERRIGHT : - case presentation::FadeEffect_FADE_FROM_RIGHT : - case presentation::FadeEffect_MOVE_FROM_RIGHT : eType = vcl::PDFWriter::PageTransition::WipeRightToLeft; break; - - case presentation::FadeEffect_UNCOVER_TO_TOP : - case presentation::FadeEffect_UNCOVER_TO_UPPERLEFT : - case presentation::FadeEffect_ROLL_FROM_BOTTOM : - case presentation::FadeEffect_FADE_FROM_LOWERLEFT : - case presentation::FadeEffect_MOVE_FROM_LOWERLEFT : - case presentation::FadeEffect_FADE_FROM_BOTTOM : - case presentation::FadeEffect_MOVE_FROM_BOTTOM : eType = vcl::PDFWriter::PageTransition::WipeBottomToTop; break; - - case presentation::FadeEffect_OPEN_VERTICAL : eType = vcl::PDFWriter::PageTransition::SplitHorizontalInward; break; - case presentation::FadeEffect_CLOSE_HORIZONTAL : eType = vcl::PDFWriter::PageTransition::SplitHorizontalOutward; break; - - case presentation::FadeEffect_OPEN_HORIZONTAL : eType = vcl::PDFWriter::PageTransition::SplitVerticalInward; break; - case presentation::FadeEffect_CLOSE_VERTICAL : eType = vcl::PDFWriter::PageTransition::SplitVerticalOutward; break; - - case presentation::FadeEffect_FADE_TO_CENTER : eType = vcl::PDFWriter::PageTransition::BoxInward; break; - case presentation::FadeEffect_FADE_FROM_CENTER : eType = vcl::PDFWriter::PageTransition::BoxOutward; break; - - case presentation::FadeEffect_NONE : eType = vcl::PDFWriter::PageTransition::Regular; break; - - case presentation::FadeEffect_RANDOM : - case presentation::FadeEffect_DISSOLVE : - default: eType = vcl::PDFWriter::PageTransition::Dissolve; break; - } - } - } - - if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) || - xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) ) - { - pPDFExtOutDevData->SetPageTransition( eType, nTime ); - } - } + aAny = xShapes->getByIndex( i ); + uno::Reference< drawing::XShape > xShape; + if ( aAny >>= xShape ) + ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData ); } } + } + } - Size aPageSize( mpDoc->GetSdPage( 0, PageKind::Standard )->GetSize() ); - Point aPoint( 0, 0 ); - ::tools::Rectangle aPageRect( aPoint, aPageSize ); + // exporting slide page object interactions + uno::Reference< drawing::XShapes> xShapes( xPage, uno::UNO_QUERY ); + sal_Int32 i, nCount = xShapes->getCount(); + for ( i = 0; i < nCount; i++ ) + { + aAny = xShapes->getByIndex( i ); + uno::Reference< drawing::XShape > xShape; + if ( aAny >>= xShape ) + ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData ); + } - // resolving links found in this page by the method ImpEditEngine::Paint - std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks(); - for ( const auto& rBookmark : rBookmarks ) + // exporting transition effects to pdf + if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && pPDFExtOutDevData->GetIsExportTransitionEffects() ) + { + const OUString sEffect( "Effect" ); + const OUString sSpeed ( "Speed" ); + sal_Int32 nTime = 800; + presentation::AnimationSpeed aAs; + if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) ) + { + aAny = xPagePropSet->getPropertyValue( sSpeed ); + if ( aAny >>= aAs ) { - sal_Int32 nPage = ImplPDFGetBookmarkPage( rBookmark.aBookmark, *mpDoc ); - if ( nPage != -1 ) + switch( aAs ) { - if ( rBookmark.nLinkId != -1 ) - pPDFExtOutDevData->SetLinkDest( rBookmark.nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle ) ); - else - pPDFExtOutDevData->DescribeRegisteredDest( rBookmark.nDestId, aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle ); + case presentation::AnimationSpeed_SLOW : nTime = 1500; break; + case presentation::AnimationSpeed_FAST : nTime = 300; break; + default: + case presentation::AnimationSpeed_MEDIUM : nTime = 800; } - else - pPDFExtOutDevData->SetLinkURL( rBookmark.nLinkId, rBookmark.aBookmark ); } - rBookmarks.clear(); - //---> #i56629, #i40318 - //get the page name, will be used as outline element in PDF bookmark pane - OUString aPageName = mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1 , PageKind::Standard )->GetName(); - if( !aPageName.isEmpty() ) + } + presentation::FadeEffect eFe; + vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::PageTransition::Regular; + if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) ) + { + aAny = xPagePropSet->getPropertyValue( sEffect ); + if ( aAny >>= eFe ) { - // Destination PageNum - const sal_Int32 nDestPageNum = CalcOutputPageNum(pPDFExtOutDevData, mpDoc, nPageNumber); - - // insert the bookmark to this page into the NamedDestinations - if( pPDFExtOutDevData->GetIsExportNamedDestinations() ) - pPDFExtOutDevData->CreateNamedDest(aPageName, aPageRect, nDestPageNum); - - // add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx - // issue #i40318. - - if( pPDFExtOutDevData->GetIsExportBookmarks() ) + switch( eFe ) { - // Destination Export - const sal_Int32 nDestId = - pPDFExtOutDevData->CreateDest(aPageRect , nDestPageNum); - - // Create a new outline item: - pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId ); + case presentation::FadeEffect_HORIZONTAL_LINES : + case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD : + case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::PageTransition::BlindsHorizontal; break; + + case presentation::FadeEffect_VERTICAL_LINES : + case presentation::FadeEffect_VERTICAL_CHECKERBOARD : + case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::PageTransition::BlindsVertical; break; + + case presentation::FadeEffect_UNCOVER_TO_RIGHT : + case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT : + case presentation::FadeEffect_ROLL_FROM_LEFT : + case presentation::FadeEffect_FADE_FROM_UPPERLEFT : + case presentation::FadeEffect_MOVE_FROM_UPPERLEFT : + case presentation::FadeEffect_FADE_FROM_LEFT : + case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::PageTransition::WipeLeftToRight; break; + + case presentation::FadeEffect_UNCOVER_TO_BOTTOM : + case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT : + case presentation::FadeEffect_ROLL_FROM_TOP : + case presentation::FadeEffect_FADE_FROM_UPPERRIGHT : + case presentation::FadeEffect_MOVE_FROM_UPPERRIGHT : + case presentation::FadeEffect_FADE_FROM_TOP : + case presentation::FadeEffect_MOVE_FROM_TOP : eType = vcl::PDFWriter::PageTransition::WipeTopToBottom; break; + + case presentation::FadeEffect_UNCOVER_TO_LEFT : + case presentation::FadeEffect_UNCOVER_TO_LOWERLEFT : + case presentation::FadeEffect_ROLL_FROM_RIGHT : + + case presentation::FadeEffect_FADE_FROM_LOWERRIGHT : + case presentation::FadeEffect_MOVE_FROM_LOWERRIGHT : + case presentation::FadeEffect_FADE_FROM_RIGHT : + case presentation::FadeEffect_MOVE_FROM_RIGHT : eType = vcl::PDFWriter::PageTransition::WipeRightToLeft; break; + + case presentation::FadeEffect_UNCOVER_TO_TOP : + case presentation::FadeEffect_UNCOVER_TO_UPPERLEFT : + case presentation::FadeEffect_ROLL_FROM_BOTTOM : + case presentation::FadeEffect_FADE_FROM_LOWERLEFT : + case presentation::FadeEffect_MOVE_FROM_LOWERLEFT : + case presentation::FadeEffect_FADE_FROM_BOTTOM : + case presentation::FadeEffect_MOVE_FROM_BOTTOM : eType = vcl::PDFWriter::PageTransition::WipeBottomToTop; break; + + case presentation::FadeEffect_OPEN_VERTICAL : eType = vcl::PDFWriter::PageTransition::SplitHorizontalInward; break; + case presentation::FadeEffect_CLOSE_HORIZONTAL : eType = vcl::PDFWriter::PageTransition::SplitHorizontalOutward; break; + + case presentation::FadeEffect_OPEN_HORIZONTAL : eType = vcl::PDFWriter::PageTransition::SplitVerticalInward; break; + case presentation::FadeEffect_CLOSE_VERTICAL : eType = vcl::PDFWriter::PageTransition::SplitVerticalOutward; break; + + case presentation::FadeEffect_FADE_TO_CENTER : eType = vcl::PDFWriter::PageTransition::BoxInward; break; + case presentation::FadeEffect_FADE_FROM_CENTER : eType = vcl::PDFWriter::PageTransition::BoxOutward; break; + + case presentation::FadeEffect_NONE : eType = vcl::PDFWriter::PageTransition::Regular; break; + + case presentation::FadeEffect_RANDOM : + case presentation::FadeEffect_DISSOLVE : + default: eType = vcl::PDFWriter::PageTransition::Dissolve; break; } } - //<--- #i56629, #i40318 } - catch (const uno::Exception&) + + if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) || + xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) ) { + pPDFExtOutDevData->SetPageTransition( eType, nTime ); } - } } + } + + Size aPageSize( mpDoc->GetSdPage( 0, PageKind::Standard )->GetSize() ); + Point aPoint( 0, 0 ); + ::tools::Rectangle aPageRect( aPoint, aPageSize ); + + // resolving links found in this page by the method ImpEditEngine::Paint + std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks(); + for ( const auto& rBookmark : rBookmarks ) + { + sal_Int32 nPage = ImplPDFGetBookmarkPage( rBookmark.aBookmark, *mpDoc ); + if ( nPage != -1 ) + { + if ( rBookmark.nLinkId != -1 ) + pPDFExtOutDevData->SetLinkDest( rBookmark.nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle ) ); + else + pPDFExtOutDevData->DescribeRegisteredDest( rBookmark.nDestId, aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle ); + } else + pPDFExtOutDevData->SetLinkURL( rBookmark.nLinkId, rBookmark.aBookmark ); + } + rBookmarks.clear(); + //---> #i56629, #i40318 + //get the page name, will be used as outline element in PDF bookmark pane + OUString aPageName = mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1 , PageKind::Standard )->GetName(); + if( !aPageName.isEmpty() ) + { + // Destination PageNum + const sal_Int32 nDestPageNum = CalcOutputPageNum(pPDFExtOutDevData, mpDoc, nPageNumber); + + // insert the bookmark to this page into the NamedDestinations + if( pPDFExtOutDevData->GetIsExportNamedDestinations() ) + pPDFExtOutDevData->CreateNamedDest(aPageName, aPageRect, nDestPageNum); + + // add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx + // issue #i40318. + + if( pPDFExtOutDevData->GetIsExportBookmarks() ) { - uno::Reference< drawing::XShapes > xShapes; - rSelection >>= xShapes; + // Destination Export + const sal_Int32 nDestId = + pPDFExtOutDevData->CreateDest(aPageRect , nDestPageNum); - if( xShapes.is() && xShapes->getCount() ) - { - SdrPageView* pPV = nullptr; + // Create a new outline item: + pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId ); + } + } + //<--- #i56629, #i40318 + } + catch (const uno::Exception&) + { + } - ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(), - pOldSdView ? pOldSdView->GetSdrPageView() : nullptr, pPDFExtOutDevData ); + } + } + else + { + uno::Reference< drawing::XShapes > xShapes; + rSelection >>= xShapes; - for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ ) - { - uno::Reference< drawing::XShape > xShape; - xShapes->getByIndex( i ) >>= xShape; + if( xShapes.is() && xShapes->getCount() ) + { + SdrPageView* pPV = nullptr; - if( xShape.is() ) - { - SvxShape* pShape = SvxShape::getImplementation( xShape ); + ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(), + pOldSdView ? pOldSdView->GetSdrPageView() : nullptr, pPDFExtOutDevData ); - if( pShape ) - { - SdrObject* pObj = pShape->GetSdrObject(); - if( pObj && pObj->getSdrPageFromSdrObject() - && aImplRenderPaintProc.IsVisible( pObj ) - && aImplRenderPaintProc.IsPrintable( pObj ) ) - { - if( !pPV ) - pPV = pView->ShowSdrPage( pObj->getSdrPageFromSdrObject() ); - - if( pPV ) - pView->MarkObj( pObj, pPV ); - } - } - } - } - pView->DrawMarkedObj(*pOut); + for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ ) + { + uno::Reference< drawing::XShape > xShape; + xShapes->getByIndex( i ) >>= xShape; + + if( xShape.is() ) + { + SvxShape* pShape = SvxShape::getImplementation( xShape ); + + if( pShape ) + { + SdrObject* pObj = pShape->GetSdrObject(); + if( pObj && pObj->getSdrPageFromSdrObject() + && aImplRenderPaintProc.IsVisible( pObj ) + && aImplRenderPaintProc.IsPrintable( pObj ) ) + { + if( !pPV ) + pPV = pView->ShowSdrPage( pObj->getSdrPageFromSdrObject() ); + + if( pPV ) + pView->MarkObj( pObj, pPV ); } } } } + pView->DrawMarkedObj(*pOut); } } } @@ -2693,23 +2693,23 @@ uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCha void SdXImpressDocument::initializeDocument() { - if( !mbClipBoard ) + if( mbClipBoard ) + return; + + switch( mpDoc->GetPageCount() ) { - switch( mpDoc->GetPageCount() ) - { - case 1: - { - // nasty hack to detect clipboard document - mbClipBoard = true; - break; - } - case 0: - { - mpDoc->CreateFirstPages(); - mpDoc->StopWorkStartupDelay(); - break; - } - } + case 1: + { + // nasty hack to detect clipboard document + mbClipBoard = true; + break; + } + case 0: + { + mpDoc->CreateFirstPages(); + mpDoc->StopWorkStartupDelay(); + break; + } } } @@ -2721,83 +2721,83 @@ SdrModel& SdXImpressDocument::getSdrModelFromUnoModel() const void SAL_CALL SdXImpressDocument::dispose() { - if( !mbDisposed ) - { - ::SolarMutexGuard aGuard; + if( mbDisposed ) + return; - if( mpDoc ) - { - EndListening( *mpDoc ); - mpDoc = nullptr; - } + ::SolarMutexGuard aGuard; - // Call the base class dispose() before setting the mbDisposed flag - // to true. The reason for this is that if close() has not yet been - // called this is done in SfxBaseModel::dispose(). At the end of - // that dispose() is called again. It is important to forward this - // second dispose() to the base class, too. - // As a consequence the following code has to be able to be run twice. - SfxBaseModel::dispose(); - mbDisposed = true; - - uno::Reference< container::XNameAccess > xLinks( mxLinks ); - if( xLinks.is() ) - { - uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY ); - if( xComp.is() ) - xComp->dispose(); + if( mpDoc ) + { + EndListening( *mpDoc ); + mpDoc = nullptr; + } - xLinks = nullptr; - } + // Call the base class dispose() before setting the mbDisposed flag + // to true. The reason for this is that if close() has not yet been + // called this is done in SfxBaseModel::dispose(). At the end of + // that dispose() is called again. It is important to forward this + // second dispose() to the base class, too. + // As a consequence the following code has to be able to be run twice. + SfxBaseModel::dispose(); + mbDisposed = true; - uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess ); - if( xDrawPagesAccess.is() ) - { - uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, uno::UNO_QUERY ); - if( xComp.is() ) - xComp->dispose(); + uno::Reference< container::XNameAccess > xLinks( mxLinks ); + if( xLinks.is() ) + { + uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY ); + if( xComp.is() ) + xComp->dispose(); - xDrawPagesAccess = nullptr; - } + xLinks = nullptr; + } - uno::Reference< drawing::XDrawPages > xMasterPagesAccess( mxMasterPagesAccess ); - if( xDrawPagesAccess.is() ) - { - uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, uno::UNO_QUERY ); - if( xComp.is() ) - xComp->dispose(); + uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess ); + if( xDrawPagesAccess.is() ) + { + uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, uno::UNO_QUERY ); + if( xComp.is() ) + xComp->dispose(); - xDrawPagesAccess = nullptr; - } + xDrawPagesAccess = nullptr; + } - uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager ); - if( xLayerManager.is() ) - { - uno::Reference< lang::XComponent > xComp( xLayerManager, uno::UNO_QUERY ); - if( xComp.is() ) - xComp->dispose(); + uno::Reference< drawing::XDrawPages > xMasterPagesAccess( mxMasterPagesAccess ); + if( xDrawPagesAccess.is() ) + { + uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, uno::UNO_QUERY ); + if( xComp.is() ) + xComp->dispose(); - xLayerManager = nullptr; - } + xDrawPagesAccess = nullptr; + } - uno::Reference< container::XNameContainer > xCustomPresentationAccess( mxCustomPresentationAccess ); - if( xCustomPresentationAccess.is() ) - { - uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, uno::UNO_QUERY ); - if( xComp.is() ) - xComp->dispose(); + uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager ); + if( xLayerManager.is() ) + { + uno::Reference< lang::XComponent > xComp( xLayerManager, uno::UNO_QUERY ); + if( xComp.is() ) + xComp->dispose(); - xCustomPresentationAccess = nullptr; - } + xLayerManager = nullptr; + } + ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits