diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-14 09:10:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-15 07:48:24 +0100 |
commit | fcdfb94ac11cd4832ad68c896c706fb3cb376ce4 (patch) | |
tree | f1cbab12af9b0003432e5928573b23d5646ed9f3 /sd | |
parent | c2429e3e95a4298f43c468f36a1a2832992dd40e (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/table/TableDesignPane.cxx | 123 | ||||
-rw-r--r-- | sd/source/ui/table/tablefunction.cxx | 73 | ||||
-rw-r--r-- | sd/source/ui/table/tableobjectbar.cxx | 184 | ||||
-rw-r--r-- | sd/source/ui/tools/ConfigurationAccess.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/tools/EventMultiplexer.cxx | 160 | ||||
-rw-r--r-- | sd/source/ui/tools/PreviewRenderer.cxx | 48 | ||||
-rw-r--r-- | sd/source/ui/tools/PropertySet.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/tools/TimerBasedTaskExecution.cxx | 66 | ||||
-rw-r--r-- | sd/source/ui/unoidl/DrawController.cxx | 200 | ||||
-rw-r--r-- | sd/source/ui/unoidl/SdUnoDrawView.cxx | 48 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unolayer.cxx | 114 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 840 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unoobj.cxx | 158 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 458 |
14 files changed, 1269 insertions, 1259 deletions
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; + } + + uno::Reference< container::XNameContainer > xCustomPresentationAccess( mxCustomPresentationAccess ); + if( xCustomPresentationAccess.is() ) + { + uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, uno::UNO_QUERY ); + if( xComp.is() ) + xComp->dispose(); - mxDashTable = nullptr; - mxGradientTable = nullptr; - mxHatchTable = nullptr; - mxBitmapTable = nullptr; - mxTransGradientTable = nullptr; - mxMarkerTable = nullptr; - mxDrawingPool = nullptr; + xCustomPresentationAccess = nullptr; } + + mxDashTable = nullptr; + mxGradientTable = nullptr; + mxHatchTable = nullptr; + mxBitmapTable = nullptr; + mxTransGradientTable = nullptr; + mxMarkerTable = nullptr; + mxDrawingPool = nullptr; } // class SdDrawPagesAccess @@ -3236,37 +3236,37 @@ void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawP return; //Todo: this should be excepted // only standard pages can be removed directly - if( pPage->GetPageKind() == PageKind::Standard ) - { - sal_uInt16 nPage = pPage->GetPageNum(); + if( pPage->GetPageKind() != PageKind::Standard ) + return; - SdDrawDocument& rDoc = *mpModel->mpDoc; + sal_uInt16 nPage = pPage->GetPageNum(); - SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetMasterPage( nPage+1 ) ); + SdDrawDocument& rDoc = *mpModel->mpDoc; - bool bUndo = rDoc.IsUndoEnabled(); - if( bUndo ) - { - // Add undo actions and delete the pages. The order of adding - // the undo actions is important. - rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) ); - rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage)); - rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); - } + SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetMasterPage( nPage+1 ) ); - // remove both pages - rDoc.RemoveMasterPage( nPage ); - rDoc.RemoveMasterPage( nPage ); + bool bUndo = rDoc.IsUndoEnabled(); + if( bUndo ) + { + // Add undo actions and delete the pages. The order of adding + // the undo actions is important. + rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) ); + rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage)); + rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); + } - if( bUndo ) - { - rDoc.EndUndo(); - } - else - { - delete pNotesPage; - delete pPage; - } + // remove both pages + rDoc.RemoveMasterPage( nPage ); + rDoc.RemoveMasterPage( nPage ); + + if( bUndo ) + { + rDoc.EndUndo(); + } + else + { + delete pNotesPage; + delete pPage; } } diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index b9094956b4eb..b62efec9c7f6 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -897,72 +897,72 @@ void SdXShape::SetEmptyPresObj(bool bEmpty) if( pObj == nullptr ) return; - if( pObj->IsEmptyPresObj() != bEmpty ) + if( pObj->IsEmptyPresObj() == bEmpty ) + return; + + if(!bEmpty) { - if(!bEmpty) - { - OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject(); - const bool bVertical = pOutlinerParaObject && pOutlinerParaObject->IsVertical(); + OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject(); + const bool bVertical = pOutlinerParaObject && pOutlinerParaObject->IsVertical(); - // really delete SdrOutlinerObj at pObj - pObj->NbcSetOutlinerParaObject(nullptr); - if( bVertical && dynamic_cast<SdrTextObj*>( pObj ) ) - static_cast<SdrTextObj*>(pObj)->SetVerticalWriting( true ); + // really delete SdrOutlinerObj at pObj + pObj->NbcSetOutlinerParaObject(nullptr); + if( bVertical && dynamic_cast<SdrTextObj*>( pObj ) ) + static_cast<SdrTextObj*>(pObj)->SetVerticalWriting( true ); - SdrGrafObj* pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj ); - if( pGraphicObj ) - { - Graphic aEmpty; - pGraphicObj->SetGraphic(aEmpty); - } - else - { - SdrOle2Obj* pOleObj = dynamic_cast< SdrOle2Obj* >( pObj ); - if( pOleObj ) - { - pOleObj->ClearGraphic(); - } - } + SdrGrafObj* pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj ); + if( pGraphicObj ) + { + Graphic aEmpty; + pGraphicObj->SetGraphic(aEmpty); } else { - // now set an empty OutlinerParaObject at pObj without - // any content but with the style of the old OutlinerParaObjects - // first paragraph - do + SdrOle2Obj* pOleObj = dynamic_cast< SdrOle2Obj* >( pObj ); + if( pOleObj ) { - SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():nullptr; - DBG_ASSERT( pDoc, "no document?" ); - if( pDoc == nullptr) - break; + pOleObj->ClearGraphic(); + } + } + } + else + { + // now set an empty OutlinerParaObject at pObj without + // any content but with the style of the old OutlinerParaObjects + // first paragraph + do + { + SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():nullptr; + DBG_ASSERT( pDoc, "no document?" ); + if( pDoc == nullptr) + break; - SdOutliner* pOutliner = pDoc->GetInternalOutliner(); - DBG_ASSERT( pOutliner, "no outliner?" ); - if( pOutliner == nullptr ) - break; + SdOutliner* pOutliner = pDoc->GetInternalOutliner(); + DBG_ASSERT( pOutliner, "no outliner?" ); + if( pOutliner == nullptr ) + break; - SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject()); - DBG_ASSERT( pPage, "no page?" ); - if( pPage == nullptr ) - break; + SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject()); + DBG_ASSERT( pPage, "no page?" ); + if( pPage == nullptr ) + break; - OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject(); - pOutliner->SetText( *pOutlinerParaObject ); - const bool bVertical = pOutliner->IsVertical(); - - pOutliner->Clear(); - pOutliner->SetVertical( bVertical ); - pOutliner->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pDoc->GetStyleSheetPool()) ); - pOutliner->SetStyleSheet( 0, pPage->GetTextStyleSheetForObject( pObj ) ); - pOutliner->Insert( pPage->GetPresObjText( pPage->GetPresObjKind(pObj) ) ); - pObj->SetOutlinerParaObject( pOutliner->CreateParaObject() ); - pOutliner->Clear(); - } - while(false); + OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject(); + pOutliner->SetText( *pOutlinerParaObject ); + const bool bVertical = pOutliner->IsVertical(); + + pOutliner->Clear(); + pOutliner->SetVertical( bVertical ); + pOutliner->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pDoc->GetStyleSheetPool()) ); + pOutliner->SetStyleSheet( 0, pPage->GetTextStyleSheetForObject( pObj ) ); + pOutliner->Insert( pPage->GetPresObjText( pPage->GetPresObjKind(pObj) ) ); + pObj->SetOutlinerParaObject( pOutliner->CreateParaObject() ); + pOutliner->Clear(); } - - pObj->SetEmptyPresObj(bEmpty); + while(false); } + + pObj->SetEmptyPresObj(bEmpty); } bool SdXShape::IsMasterDepend() const throw() @@ -973,20 +973,20 @@ bool SdXShape::IsMasterDepend() const throw() void SdXShape::SetMasterDepend( bool bDepend ) throw() { - if( IsMasterDepend() != bDepend ) + if( IsMasterDepend() == bDepend ) + return; + + SdrObject* pObj = mpShape->GetSdrObject(); + if( pObj ) { - SdrObject* pObj = mpShape->GetSdrObject(); - if( pObj ) + if( bDepend ) { - if( bDepend ) - { - SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject()); - pObj->SetUserCall( pPage ); - } - else - { - pObj->SetUserCall( nullptr ); - } + SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject()); + pObj->SetUserCall( pPage ); + } + else + { + pObj->SetUserCall( nullptr ); } } } @@ -1001,22 +1001,22 @@ void SdXShape::SetStyleSheet( const uno::Any& rAny ) SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle ); const SfxStyleSheet* pOldStyleSheet = pObj->GetStyleSheet(); - if( pOldStyleSheet != pStyleSheet ) - { - if( pStyleSheet == nullptr || (pStyleSheet->GetFamily() != SfxStyleFamily::Para && pStyleSheet->GetFamily() != SfxStyleFamily::Page) ) - throw lang::IllegalArgumentException(); + if( pOldStyleSheet == pStyleSheet ) + return; - pObj->SetStyleSheet( pStyleSheet, false ); + if( pStyleSheet == nullptr || (pStyleSheet->GetFamily() != SfxStyleFamily::Para && pStyleSheet->GetFamily() != SfxStyleFamily::Page) ) + throw lang::IllegalArgumentException(); - SdDrawDocument* pDoc = mpModel? mpModel->GetDoc() : nullptr; - if( pDoc ) - { - ::sd::DrawDocShell* pDocSh = pDoc->GetDocSh(); - ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr; + pObj->SetStyleSheet( pStyleSheet, false ); - if( pViewSh ) - pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 ); - } + SdDrawDocument* pDoc = mpModel? mpModel->GetDoc() : nullptr; + if( pDoc ) + { + ::sd::DrawDocShell* pDocSh = pDoc->GetDocSh(); + ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr; + + if( pViewSh ) + pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 ); } } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index d4423676e52e..48d6c0a56e43 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -1532,22 +1532,22 @@ OUString SdGenericDrawPage::getBookmarkURL() const void SdGenericDrawPage::setBookmarkURL( OUString const & rURL ) { - if( SvxFmDrawPage::mpPage ) - { - sal_Int32 nIndex = rURL.indexOf( '#' ); - if( nIndex != -1 ) - { - const OUString aFileName( rURL.copy( 0, nIndex ) ); - const OUString aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) ); + if( !SvxFmDrawPage::mpPage ) + return; - if( !aFileName.isEmpty() && !aBookmarkName.isEmpty() ) - { - static_cast<SdPage*>(SvxFmDrawPage::mpPage)->DisconnectLink(); - static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetFileName( aFileName ); - static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetBookmarkName( aBookmarkName ); - static_cast<SdPage*>(SvxFmDrawPage::mpPage)->ConnectLink(); - } - } + sal_Int32 nIndex = rURL.indexOf( '#' ); + if( nIndex == -1 ) + return; + + const OUString aFileName( rURL.copy( 0, nIndex ) ); + const OUString aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) ); + + if( !aFileName.isEmpty() && !aBookmarkName.isEmpty() ) + { + static_cast<SdPage*>(SvxFmDrawPage::mpPage)->DisconnectLink(); + static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetFileName( aFileName ); + static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetBookmarkName( aBookmarkName ); + static_cast<SdPage*>(SvxFmDrawPage::mpPage)->ConnectLink(); } } @@ -1654,184 +1654,184 @@ void SAL_CALL SdGenericDrawPage::unbind( const Reference< drawing::XShape >& xSh void SdGenericDrawPage::SetLeftBorder( sal_Int32 nValue ) { - if( nValue != GetPage()->GetLeftBorder() ) - { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - const PageKind ePageKind = GetPage()->GetPageKind(); + if( nValue == GetPage()->GetLeftBorder() ) + return; - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); - pPage->SetLeftBorder( nValue ); - } + SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + const PageKind ePageKind = GetPage()->GetPageKind(); - nPageCnt = rDoc.GetSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + pPage->SetLeftBorder( nValue ); + } - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); - pPage->SetLeftBorder( nValue ); - } + nPageCnt = rDoc.GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + pPage->SetLeftBorder( nValue ); } } void SdGenericDrawPage::SetRightBorder( sal_Int32 nValue ) { - if( nValue != GetPage()->GetRightBorder() ) - { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - const PageKind ePageKind = GetPage()->GetPageKind(); + if( nValue == GetPage()->GetRightBorder() ) + return; - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); - pPage->SetRightBorder( nValue ); - } + SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + const PageKind ePageKind = GetPage()->GetPageKind(); - nPageCnt = rDoc.GetSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + pPage->SetRightBorder( nValue ); + } - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); - pPage->SetRightBorder( nValue ); - } + nPageCnt = rDoc.GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + pPage->SetRightBorder( nValue ); } } void SdGenericDrawPage::SetUpperBorder( sal_Int32 nValue ) { - if( nValue != GetPage()->GetUpperBorder() ) - { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - const PageKind ePageKind = GetPage()->GetPageKind(); + if( nValue == GetPage()->GetUpperBorder() ) + return; - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); - pPage->SetUpperBorder( nValue ); - } + SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + const PageKind ePageKind = GetPage()->GetPageKind(); - nPageCnt = rDoc.GetSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + pPage->SetUpperBorder( nValue ); + } - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); - pPage->SetUpperBorder( nValue ); - } + nPageCnt = rDoc.GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + pPage->SetUpperBorder( nValue ); } } void SdGenericDrawPage::SetLowerBorder( sal_Int32 nValue ) { - if( nValue != GetPage()->GetLowerBorder() ) - { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - const PageKind ePageKind = GetPage()->GetPageKind(); + if( nValue == GetPage()->GetLowerBorder() ) + return; - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); - pPage->SetLowerBorder( nValue ); - } + SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + const PageKind ePageKind = GetPage()->GetPageKind(); - nPageCnt = rDoc.GetSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + pPage->SetLowerBorder( nValue ); + } - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); - pPage->SetLowerBorder( nValue ); - } + nPageCnt = rDoc.GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + pPage->SetLowerBorder( nValue ); } } static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind ) { ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh(); - if ( pDocShell ) - { - ::sd::ViewShell* pViewSh = pDocShell->GetViewShell(); + if ( !pDocShell ) + return; - if( pViewSh ) - { - if( dynamic_cast<const ::sd::DrawViewShell* >(pViewSh) != nullptr ) - static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage(); + ::sd::ViewShell* pViewSh = pDocShell->GetViewShell(); - Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize(); - const long nWidth = aPageSize.Width(); - const long nHeight = aPageSize.Height(); + if( !pViewSh ) + return; - Point aPageOrg(nWidth, nHeight / 2); - Size aViewSize(nWidth * 3, nHeight * 2); + if( dynamic_cast<const ::sd::DrawViewShell* >(pViewSh) != nullptr ) + static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage(); - pDoc->SetMaxObjSize(aViewSize); + Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize(); + const long nWidth = aPageSize.Width(); + const long nHeight = aPageSize.Height(); - pViewSh->InitWindows(aPageOrg, aViewSize, Point(-1, -1), true); + Point aPageOrg(nWidth, nHeight / 2); + Size aViewSize(nWidth * 3, nHeight * 2); - pViewSh->UpdateScrollBars(); - } - } + pDoc->SetMaxObjSize(aViewSize); + + pViewSh->InitWindows(aPageOrg, aViewSize, Point(-1, -1), true); + + pViewSh->UpdateScrollBars(); } void SdGenericDrawPage::SetWidth( sal_Int32 nWidth ) { Size aSize( GetPage()->GetSize() ); - if( aSize.getWidth() != nWidth ) - { - aSize.setWidth( nWidth ); + if( aSize.getWidth() == nWidth ) + return; - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - const PageKind ePageKind = GetPage()->GetPageKind(); + aSize.setWidth( nWidth ); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); - pPage->SetSize(aSize); - } + SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + const PageKind ePageKind = GetPage()->GetPageKind(); - nPageCnt = rDoc.GetSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + pPage->SetSize(aSize); + } - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); - pPage->SetSize(aSize); - } + nPageCnt = rDoc.GetSdPageCount(ePageKind); - refreshpage( &rDoc, ePageKind ); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + pPage->SetSize(aSize); } + + refreshpage( &rDoc, ePageKind ); } void SdGenericDrawPage::SetHeight( sal_Int32 nHeight ) { Size aSize( GetPage()->GetSize() ); - if( aSize.getHeight() != nHeight ) - { - aSize.setHeight( nHeight ); + if( aSize.getHeight() == nHeight ) + return; - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - const PageKind ePageKind = GetPage()->GetPageKind(); + aSize.setHeight( nHeight ); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); - pPage->SetSize(aSize); - } + SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + const PageKind ePageKind = GetPage()->GetPageKind(); - nPageCnt = rDoc.GetSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + pPage->SetSize(aSize); + } - for (i = 0; i < nPageCnt; i++) - { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); - pPage->SetSize(aSize); - } + nPageCnt = rDoc.GetSdPageCount(ePageKind); - refreshpage( &rDoc, ePageKind ); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + pPage->SetSize(aSize); } + + refreshpage( &rDoc, ePageKind ); } // XInterface @@ -2232,69 +2232,69 @@ void SAL_CALL SdDrawPage::setName( const OUString& rName ) OUString aName( rName ); - if(GetPage() && GetPage()->GetPageKind() != PageKind::Notes) + if(!(GetPage() && GetPage()->GetPageKind() != PageKind::Notes)) + return; + + // check if this is the default 'page1234' name + if(aName.startsWith( sEmptyPageName )) { - // check if this is the default 'page1234' name - if(aName.startsWith( sEmptyPageName )) - { - // ok, it maybe is, first get the number part after 'page' - OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) ); + // ok, it maybe is, first get the number part after 'page' + OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) ); - // create the page number - sal_Int32 nPageNumber = aNumber.toInt32(); + // create the page number + sal_Int32 nPageNumber = aNumber.toInt32(); - // check if there are non number characters in the number part - const sal_Int32 nChars = aNumber.getLength(); - const sal_Unicode* pString = aNumber.getStr(); - sal_Int32 nChar; - for( nChar = 0; nChar < nChars; nChar++, pString++ ) + // check if there are non number characters in the number part + const sal_Int32 nChars = aNumber.getLength(); + const sal_Unicode* pString = aNumber.getStr(); + sal_Int32 nChar; + for( nChar = 0; nChar < nChars; nChar++, pString++ ) + { + if((*pString < '0') || (*pString > '9')) { - if((*pString < '0') || (*pString > '9')) - { - // found a non number character, so this is not the default - // name for this page - nPageNumber = -1; - break; - } + // found a non number character, so this is not the default + // name for this page + nPageNumber = -1; + break; } - - if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 ) - aName.clear(); - } - else - { - OUString aDefaultPageName( SdResId(STR_PAGE) + " " ); - if( aName.startsWith( aDefaultPageName ) ) - aName.clear(); } - GetPage()->SetName( aName ); + if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 ) + aName.clear(); + } + else + { + OUString aDefaultPageName( SdResId(STR_PAGE) + " " ); + if( aName.startsWith( aDefaultPageName ) ) + aName.clear(); + } - sal_uInt16 nNotesPageNum = (GetPage()->GetPageNum()-1)>>1; - if( GetModel()->GetDoc()->GetSdPageCount( PageKind::Notes ) > nNotesPageNum ) - { - SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( nNotesPageNum, PageKind::Notes ); - if( pNotesPage ) - pNotesPage->SetName(aName); - } + GetPage()->SetName( aName ); - // fake a mode change to repaint the page tab bar - ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell(); - ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr; - if( auto pDrawViewSh = dynamic_cast<::sd::DrawViewShell* >(pViewSh) ) + sal_uInt16 nNotesPageNum = (GetPage()->GetPageNum()-1)>>1; + if( GetModel()->GetDoc()->GetSdPageCount( PageKind::Notes ) > nNotesPageNum ) + { + SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( nNotesPageNum, PageKind::Notes ); + if( pNotesPage ) + pNotesPage->SetName(aName); + } + + // fake a mode change to repaint the page tab bar + ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell(); + ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr; + if( auto pDrawViewSh = dynamic_cast<::sd::DrawViewShell* >(pViewSh) ) + { + EditMode eMode = pDrawViewSh->GetEditMode(); + if( eMode == EditMode::Page ) { - EditMode eMode = pDrawViewSh->GetEditMode(); - if( eMode == EditMode::Page ) - { - bool bLayer = pDrawViewSh->IsLayerModeActive(); + bool bLayer = pDrawViewSh->IsLayerModeActive(); - pDrawViewSh->ChangeEditMode( eMode, !bLayer ); - pDrawViewSh->ChangeEditMode( eMode, bLayer ); - } + pDrawViewSh->ChangeEditMode( eMode, !bLayer ); + pDrawViewSh->ChangeEditMode( eMode, bLayer ); } - - GetModel()->SetModified(); } + + GetModel()->SetModified(); } OUString SAL_CALL SdDrawPage::getName() @@ -2335,35 +2335,34 @@ void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >& throwIfDisposed(); - if(SvxFmDrawPage::mpPage) - { - SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage ); - if( pMasterPage && pMasterPage->isValid() ) - { - SvxFmDrawPage::mpPage->TRG_ClearMasterPage(); + if(!SvxFmDrawPage::mpPage) + return; - SdPage* pSdPage = static_cast<SdPage*>(pMasterPage->GetSdrPage()); - SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage); + SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage ); + if( !(pMasterPage && pMasterPage->isValid()) ) + return; - SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLeftBorder(),pSdPage->GetUpperBorder(), - pSdPage->GetRightBorder(),pSdPage->GetLowerBorder() ); + SvxFmDrawPage::mpPage->TRG_ClearMasterPage(); - SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() ); - SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() ); - static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetLayoutName( pSdPage->GetLayoutName() ); + SdPage* pSdPage = static_cast<SdPage*>(pMasterPage->GetSdrPage()); + SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage); - // set notes master also - SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PageKind::Notes ); + SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLeftBorder(),pSdPage->GetUpperBorder(), + pSdPage->GetRightBorder(),pSdPage->GetLowerBorder() ); - pNotesPage->TRG_ClearMasterPage(); - sal_uInt16 nNum = SvxFmDrawPage::mpPage->TRG_GetMasterPage().GetPageNum() + 1; - pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->getSdrModelFromSdrPage().GetMasterPage(nNum)); - pNotesPage->SetLayoutName( pSdPage->GetLayoutName() ); + SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() ); + SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() ); + static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetLayoutName( pSdPage->GetLayoutName() ); - GetModel()->SetModified(); - } + // set notes master also + SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PageKind::Notes ); - } + pNotesPage->TRG_ClearMasterPage(); + sal_uInt16 nNum = SvxFmDrawPage::mpPage->TRG_GetMasterPage().GetPageNum() + 1; + pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->getSdrModelFromSdrPage().GetMasterPage(nNum)); + pNotesPage->SetLayoutName( pSdPage->GetLayoutName() ); + + GetModel()->SetModified(); } // XPresentationPage @@ -2892,7 +2891,10 @@ void SdMasterPage::setBackground( const Any& rValue ) void SdMasterPage::getBackground( Any& rValue ) { - if( GetModel() ) try + if( !GetModel() ) + return; + + try { if( IsImpressDocument() ) { @@ -2953,37 +2955,37 @@ void SAL_CALL SdMasterPage::setName( const OUString& rName ) throwIfDisposed(); - if(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PageKind::Notes) - { - SdDrawDocument* pDoc = GetModel()->GetDoc(); - bool bOutDummy; + if(!(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PageKind::Notes)) + return; + + SdDrawDocument* pDoc = GetModel()->GetDoc(); + bool bOutDummy; - // Slide Name has to be unique - if( pDoc && pDoc->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND ) - return; // throw Exception ? + // Slide Name has to be unique + if( pDoc && pDoc->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND ) + return; // throw Exception ? - GetPage()->SetName( rName ); + GetPage()->SetName( rName ); - if( pDoc ) - pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), rName ); + if( pDoc ) + pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), rName ); - // fake a mode change to repaint the page tab bar - ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell(); - ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr; - if( auto pDrawViewSh = dynamic_cast< ::sd::DrawViewShell* >(pViewSh) ) + // fake a mode change to repaint the page tab bar + ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell(); + ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr; + if( auto pDrawViewSh = dynamic_cast< ::sd::DrawViewShell* >(pViewSh) ) + { + EditMode eMode = pDrawViewSh->GetEditMode(); + if( eMode == EditMode::MasterPage ) { - EditMode eMode = pDrawViewSh->GetEditMode(); - if( eMode == EditMode::MasterPage ) - { - bool bLayer = pDrawViewSh->IsLayerModeActive(); + bool bLayer = pDrawViewSh->IsLayerModeActive(); - pDrawViewSh->ChangeEditMode( eMode, !bLayer ); - pDrawViewSh->ChangeEditMode( eMode, bLayer ); - } + pDrawViewSh->ChangeEditMode( eMode, !bLayer ); + pDrawViewSh->ChangeEditMode( eMode, bLayer ); } - - GetModel()->SetModified(); } + + GetModel()->SetModified(); } OUString SAL_CALL SdMasterPage::getName( ) |