diff options
Diffstat (limited to 'sw/source/core')
76 files changed, 488 insertions, 565 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index c92cb80d5d4e..e6822921648e 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -243,7 +243,7 @@ public: maInfo.SetViewForwarder( pMap ); uno::Reference < document::XEventBroadcaster > xModelBroadcaster = new SwDrawModellListener_Impl( - pMap->GetShell()->getIDocumentDrawModelAccess()->GetOrCreateDrawModel() ); + pMap->GetShell()->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); maInfo.SetModelBroadcaster( xModelBroadcaster ); } diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx index 405f4228f327..cbe8d70160ab 100644 --- a/sw/source/core/access/parachangetrackinginfo.cxx +++ b/sw/source/core/access/parachangetrackinginfo.cxx @@ -47,22 +47,17 @@ namespace { } const SwTextNode& rTextNode( *(rTextFrm.GetTextNode()) ); - const IDocumentRedlineAccess* pIDocChangeTrack( rTextNode.getIDocumentRedlineAccess() ); - if ( !pIDocChangeTrack ) - { - OSL_FAIL( "<initChangeTrackTextMarkupLists(..) - missing <IDocumentRedlineAccess> instance!" ); - return; - } + const IDocumentRedlineAccess& rIDocChangeTrack( rTextNode.getIDocumentRedlineAccess() ); - if ( !IDocumentRedlineAccess::IsShowChanges( pIDocChangeTrack->GetRedlineMode() ) || - pIDocChangeTrack->GetRedlineTable().empty() ) + if ( !IDocumentRedlineAccess::IsShowChanges( rIDocChangeTrack.GetRedlineMode() ) || + rIDocChangeTrack.GetRedlineTable().empty() ) { // nothing to do --> empty change track text markup lists. return; } const sal_uInt16 nIdxOfFirstRedlineForTextNode = - pIDocChangeTrack->GetRedlinePos( rTextNode, USHRT_MAX ); + rIDocChangeTrack.GetRedlinePos( rTextNode, USHRT_MAX ); if ( nIdxOfFirstRedlineForTextNode == USHRT_MAX ) { // nothing to do --> empty change track text markup lists. @@ -77,7 +72,7 @@ namespace { : rTextFrm.GetText().getLength(); // iteration over the redlines which overlap with the text node. - const SwRedlineTable& rRedlineTable = pIDocChangeTrack->GetRedlineTable(); + const SwRedlineTable& rRedlineTable = rIDocChangeTrack.GetRedlineTable(); const sal_uInt16 nRedlineCount( rRedlineTable.size() ); for ( sal_uInt16 nActRedline = nIdxOfFirstRedlineForTextNode; nActRedline < nRedlineCount; diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 934045bba438..ab6a5a5d5103 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -780,14 +780,14 @@ bool SwFormat::IsBackgroundTransparent() const /* * Document Interface Access */ -const IDocumentSettingAccess* SwFormat::getIDocumentSettingAccess() const { return & GetDoc()->GetDocumentSettingManager(); } -const IDocumentDrawModelAccess* SwFormat::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); } -IDocumentDrawModelAccess* SwFormat::getIDocumentDrawModelAccess() { return & GetDoc()->getIDocumentDrawModelAccess(); } -const IDocumentLayoutAccess* SwFormat::getIDocumentLayoutAccess() const { return &GetDoc()->getIDocumentLayoutAccess(); } -IDocumentLayoutAccess* SwFormat::getIDocumentLayoutAccess() { return &GetDoc()->getIDocumentLayoutAccess(); } -IDocumentTimerAccess* SwFormat::getIDocumentTimerAccess() { return & GetDoc()->getIDocumentTimerAccess(); } -IDocumentFieldsAccess* SwFormat::getIDocumentFieldsAccess() { return &GetDoc()->getIDocumentFieldsAccess(); } -IDocumentChartDataProviderAccess* SwFormat::getIDocumentChartDataProviderAccess() { return & GetDoc()->getIDocumentChartDataProviderAccess(); } +const IDocumentSettingAccess& SwFormat::getIDocumentSettingAccess() const { return GetDoc()->GetDocumentSettingManager(); } +const IDocumentDrawModelAccess& SwFormat::getIDocumentDrawModelAccess() const { return GetDoc()->getIDocumentDrawModelAccess(); } +IDocumentDrawModelAccess& SwFormat::getIDocumentDrawModelAccess() { return GetDoc()->getIDocumentDrawModelAccess(); } +const IDocumentLayoutAccess& SwFormat::getIDocumentLayoutAccess() const { return GetDoc()->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess& SwFormat::getIDocumentLayoutAccess() { return GetDoc()->getIDocumentLayoutAccess(); } +IDocumentTimerAccess& SwFormat::getIDocumentTimerAccess() { return GetDoc()->getIDocumentTimerAccess(); } +IDocumentFieldsAccess& SwFormat::getIDocumentFieldsAccess() { return GetDoc()->getIDocumentFieldsAccess(); } +IDocumentChartDataProviderAccess& SwFormat::getIDocumentChartDataProviderAccess() { return GetDoc()->getIDocumentChartDataProviderAccess(); } void SwFormat::GetGrabBagItem(uno::Any& rVal) const { diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 0fa19ecea2b0..3fa891436a16 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -130,7 +130,7 @@ bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark) bool SwCrsrShell::GoNextBookmark() { - IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess(); + IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess(); IDocumentMarkAccess::container_t vCandidates; remove_copy_if( upper_bound( // finds the first that is starting after @@ -163,7 +163,7 @@ bool SwCrsrShell::GoNextBookmark() bool SwCrsrShell::GoPrevBookmark() { - IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess(); + IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess(); // candidates from which to choose the mark before // no need to consider marks starting after rPos IDocumentMarkAccess::container_t vCandidates; @@ -208,7 +208,7 @@ bool SwCrsrShell::GoPrevBookmark() bool SwCrsrShell::IsFormProtected() { - return getIDocumentSettingAccess()->get(DocumentSettingId::PROTECT_FORM); + return getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM); } ::sw::mark::IFieldmark* SwCrsrShell::GetCurrentFieldmark() diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 3e92ce5ef4e5..44805c67e402 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -733,7 +733,7 @@ void SwShellTableCrsr::FillRects() bool bStart = true; SwRegionRects aReg( GetShell()->VisArea() ); if (GetShell()->isTiledRendering()) - aReg = GetShell()->getIDocumentLayoutAccess()->GetCurrentLayout()->Frm(); + aReg = GetShell()->getIDocumentLayoutAccess().GetCurrentLayout()->Frm(); SwNodes& rNds = GetDoc()->GetNodes(); SwFrm* pEndFrm = 0; for (size_t n = 0; n < m_SelectedBoxes.size(); ++n) diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 85dd7b2d102f..deb4e747cf97 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -488,7 +488,7 @@ _ZSortFly::_ZSortFly( const SwFrameFormat* pFrameFormat, const SwFormatAnchor* p // FlyFrames an alternative method is used now in that case. if( RES_FLYFRMFMT == pFormat->Which() ) { - if( pFormat->getIDocumentLayoutAccess()->GetCurrentViewShell() ) + if( pFormat->getIDocumentLayoutAccess().GetCurrentViewShell() ) { // See if there is an SdrObject for it SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFormat>( *pFrameFormat ).First(); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index f3ff0cd14071..1b5381bd61f3 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -839,7 +839,7 @@ void SwNoTextFrm::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfArea SwGrfNode* pGrfNd = rNoTNd.GetGrfNode(); SwOLENode* pOLENd = rNoTNd.GetOLENode(); - const bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) || + const bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess().getPrinter( false ) || pOut->GetConnectMetaFile(); const bool bIsChart = pOLENd && pOLENd->GetOLEObj().GetObject().IsChart(); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 089890d63479..4d938a90e4ca 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -3426,7 +3426,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, bool bChgLRSpace = true; if( bBigger ) { - if( GetFrameFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) && + if( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) && !rSz.GetWidthPercent() ) { bRet = rSz.GetWidth() < USHRT_MAX - nRelDiff; @@ -3537,7 +3537,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, // If the Table happens to contain relative values (USHORT_MAX), // we need to convert them to absolute ones now. // Bug 61494 - if( GetFrameFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) && + if( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) && !rSz.GetWidthPercent() ) { SwTabFrm* pTabFrm = SwIterator<SwTabFrm,SwFormat>( *GetFrameFormat() ).First(); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 863295462531..2ec5f3dc12e8 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -117,7 +117,7 @@ static void lcl_SetDfltBoxAttr( SwFrameFormat& rFormat, sal_uInt8 nId ) case 3: bBottom = bLeft = bRight = true; break; } - const bool bHTML = rFormat.getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE); + const bool bHTML = rFormat.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE); Color aCol( bHTML ? COL_GRAY : COL_BLACK ); SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 ); if ( bHTML ) @@ -3421,7 +3421,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, bool bAfter, /* From the back (bottom right) to the front (top left) deregister all Boxes from the Chart Data Provider. The Modify event is triggered in the calling function. TL_CHART2: */ - SwChartDataProvider *pPCD = rTable.GetFrameFormat()->getIDocumentChartDataProviderAccess()->GetChartDataProvider(); + SwChartDataProvider *pPCD = rTable.GetFrameFormat()->getIDocumentChartDataProviderAccess().GetChartDataProvider(); if( pPCD ) { for (SwTableLines::size_type k = nLinePos; k < rTable.GetTabLines().size(); ++k) diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index c7765128011b..b8382bbf319b 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -2002,17 +2002,17 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwContentNode::getSdrAllF * Document Interface Access */ const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return &GetDoc()->GetDocumentSettingManager(); } -const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return &GetDoc()->getIDocumentDeviceAccess(); } -const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return &GetDoc()->getIDocumentRedlineAccess(); } -const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return &GetDoc()->getIDocumentStylePoolAccess(); } -const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); } -const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return &GetDoc()->getIDocumentLayoutAccess(); } -IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return &GetDoc()->getIDocumentLayoutAccess(); } -const IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() const { return &GetDoc()->getIDocumentLinksAdministration(); } -IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() { return &GetDoc()->getIDocumentLinksAdministration(); } -const IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() const { return &GetDoc()->getIDocumentFieldsAccess(); } -IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() { return &GetDoc()->getIDocumentFieldsAccess(); } -IDocumentContentOperations* SwNode::getIDocumentContentOperations() { return &GetDoc()->getIDocumentContentOperations(); } +const IDocumentDeviceAccess& SwNode::getIDocumentDeviceAccess() const { return GetDoc()->getIDocumentDeviceAccess(); } +const IDocumentRedlineAccess& SwNode::getIDocumentRedlineAccess() const { return GetDoc()->getIDocumentRedlineAccess(); } +const IDocumentStylePoolAccess& SwNode::getIDocumentStylePoolAccess() const { return GetDoc()->getIDocumentStylePoolAccess(); } +const IDocumentDrawModelAccess& SwNode::getIDocumentDrawModelAccess() const { return GetDoc()->getIDocumentDrawModelAccess(); } +const IDocumentLayoutAccess& SwNode::getIDocumentLayoutAccess() const { return GetDoc()->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess& SwNode::getIDocumentLayoutAccess() { return GetDoc()->getIDocumentLayoutAccess(); } +const IDocumentLinksAdministration& SwNode::getIDocumentLinksAdministration() const { return GetDoc()->getIDocumentLinksAdministration(); } +IDocumentLinksAdministration& SwNode::getIDocumentLinksAdministration() { return GetDoc()->getIDocumentLinksAdministration(); } +const IDocumentFieldsAccess& SwNode::getIDocumentFieldsAccess() const { return GetDoc()->getIDocumentFieldsAccess(); } +IDocumentFieldsAccess& SwNode::getIDocumentFieldsAccess() { return GetDoc()->getIDocumentFieldsAccess(); } +IDocumentContentOperations& SwNode::getIDocumentContentOperations() { return GetDoc()->getIDocumentContentOperations(); } IDocumentListItems& SwNode::getIDocumentListItems() { return GetDoc()->getIDocumentListItems(); } // #i83479# const IDocumentMarkAccess* SwNode::getIDocumentMarkAccess() const { return GetDoc()->getIDocumentMarkAccess(); } diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index f25c278b9b37..4d582bf94bfd 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -190,7 +190,7 @@ void SwContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) { // #i46297# - notify background about the arriving of // the object and invalidate its position. - const bool bNotify( !GetFormat()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ); + const bool bNotify( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ); _MoveObjToLayer( true, _pDrawObj ); @@ -220,7 +220,7 @@ void SwContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) void SwContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj ) { // #i46297# - notify background about the leaving of the object. - const bool bNotify( GetFormat()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ); + const bool bNotify( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ); _MoveObjToLayer( false, _pDrawObj ); @@ -260,25 +260,20 @@ void SwContact::_MoveObjToLayer( const bool _bToVisible, return; } - const IDocumentDrawModelAccess* pIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess(); - if ( !pIDDMA ) - { - OSL_FAIL( "SwDrawContact::_MoveObjToLayer(..) - no writer document!" ); - return; - } + const IDocumentDrawModelAccess& rIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess(); SdrLayerID nToHellLayerId = - _bToVisible ? pIDDMA->GetHellId() : pIDDMA->GetInvisibleHellId(); + _bToVisible ? rIDDMA.GetHellId() : rIDDMA.GetInvisibleHellId(); SdrLayerID nToHeavenLayerId = - _bToVisible ? pIDDMA->GetHeavenId() : pIDDMA->GetInvisibleHeavenId(); + _bToVisible ? rIDDMA.GetHeavenId() : rIDDMA.GetInvisibleHeavenId(); SdrLayerID nToControlLayerId = - _bToVisible ? pIDDMA->GetControlsId() : pIDDMA->GetInvisibleControlsId(); + _bToVisible ? rIDDMA.GetControlsId() : rIDDMA.GetInvisibleControlsId(); SdrLayerID nFromHellLayerId = - _bToVisible ? pIDDMA->GetInvisibleHellId() : pIDDMA->GetHellId(); + _bToVisible ? rIDDMA.GetInvisibleHellId() : rIDDMA.GetHellId(); SdrLayerID nFromHeavenLayerId = - _bToVisible ? pIDDMA->GetInvisibleHeavenId() : pIDDMA->GetHeavenId(); + _bToVisible ? rIDDMA.GetInvisibleHeavenId() : rIDDMA.GetHeavenId(); SdrLayerID nFromControlLayerId = - _bToVisible ? pIDDMA->GetInvisibleControlsId() : pIDDMA->GetControlsId(); + _bToVisible ? rIDDMA.GetInvisibleControlsId() : rIDDMA.GetControlsId(); if ( _pDrawObj->ISA( SdrObjGroup ) ) { @@ -292,8 +287,8 @@ void SwContact::_MoveObjToLayer( const bool _bToVisible, // is a control nNewLayerId = nToControlLayerId; } - else if ( _pDrawObj->GetLayer() == pIDDMA->GetHeavenId() || - _pDrawObj->GetLayer() == pIDDMA->GetInvisibleHeavenId() ) + else if ( _pDrawObj->GetLayer() == rIDDMA.GetHeavenId() || + _pDrawObj->GetLayer() == rIDDMA.GetInvisibleHeavenId() ) { // it has to be the heaven layer, if method <GetLayer()> reveals // a heaven layer @@ -481,7 +476,7 @@ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) OSL_ENSURE( _pDrawObj->ISA(SwVirtFlyDrawObj), "<SwFlyDrawContact::MoveObjToVisibleLayer(..)> - wrong SdrObject type -> crash" ); - if ( GetFormat()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ) + if ( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ) { // nothing to do return; @@ -522,7 +517,7 @@ void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj ) OSL_ENSURE( _pDrawObj->ISA(SwVirtFlyDrawObj), "<SwFlyDrawContact::MoveObjToInvisibleLayer(..)> - wrong SdrObject type -> crash" ); - if ( !GetFormat()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ) + if ( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ) { // nothing to do return; @@ -592,7 +587,7 @@ SwDrawContact::SwDrawContact( SwFrameFormat* pToRegisterIn, SdrObject* pObj ) : // in the drawing page. if ( !pObj->IsInserted() ) { - pToRegisterIn->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)-> + pToRegisterIn->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)-> InsertObject( pObj, pObj->GetOrdNumDirect() ); } @@ -601,7 +596,7 @@ SwDrawContact::SwDrawContact( SwFrameFormat* pToRegisterIn, SdrObject* pObj ) : if ( ::CheckControlLayer( pObj ) ) { // set layer of object to corresponding invisible layer. - pObj->SetLayer( pToRegisterIn->getIDocumentDrawModelAccess()->GetInvisibleControlsId() ); + pObj->SetLayer( pToRegisterIn->getIDocumentDrawModelAccess().GetInvisibleControlsId() ); } // #i26791# @@ -1243,15 +1238,15 @@ void SwDrawContact::_Changed( const SdrObject& rObj, { if(::CheckControlLayer(maAnchoredDrawObj.DrawObj())) { - const IDocumentDrawModelAccess* pIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess(); const SdrLayerID aCurrentLayer(maAnchoredDrawObj.DrawObj()->GetLayer()); - const SdrLayerID aControlLayerID(pIDDMA->GetControlsId()); - const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId()); + const SdrLayerID aControlLayerID(rIDDMA.GetControlsId()); + const SdrLayerID aInvisibleControlLayerID(rIDDMA.GetInvisibleControlsId()); if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID) { - if ( aCurrentLayer == pIDDMA->GetInvisibleHellId() || - aCurrentLayer == pIDDMA->GetInvisibleHeavenId() ) + if ( aCurrentLayer == rIDDMA.GetInvisibleHellId() || + aCurrentLayer == rIDDMA.GetInvisibleHeavenId() ) { maAnchoredDrawObj.DrawObj()->SetLayer(aInvisibleControlLayerID); } @@ -1652,7 +1647,7 @@ void SwDrawContact::RemoveMasterFromDrawPage() GetMaster()->SetUserCall( 0 ); if ( GetMaster()->IsInserted() ) { - static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)-> + static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)-> RemoveObject( GetMaster()->GetOrdNum() ); } } @@ -1734,7 +1729,7 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) SwFrameFormat* pDrawFrameFormat = static_cast<SwFrameFormat*>(GetRegisteredIn()); - if( !pDrawFrameFormat->getIDocumentLayoutAccess()->GetCurrentViewShell() ) + if( !pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell() ) return; // remove 'virtual' drawing objects from writer @@ -1752,7 +1747,7 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) case FLY_AT_PAGE: { sal_uInt16 nPgNum = pAnch->GetPageNum(); - SwViewShell *pShell = pDrawFrameFormat->getIDocumentLayoutAccess()->GetCurrentViewShell(); + SwViewShell *pShell = pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell(); if( !pShell ) break; SwRootFrm* pRoot = pShell->GetLayout(); @@ -1902,7 +1897,7 @@ void SwDrawContact::InsertMasterIntoDrawPage() { if ( !GetMaster()->IsInserted() ) { - GetFormat()->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0) + GetFormat()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0) ->InsertObject( GetMaster(), GetMaster()->GetOrdNumDirect() ); } GetMaster()->SetUserCall( this ); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 73cc853b1d60..4a5e60c2dae3 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -405,12 +405,12 @@ void SwEditShell::UnlockExpFields() void SwEditShell::SetFieldUpdateFlags( SwFieldUpdateFlags eFlags ) { - getIDocumentSettingAccess()->setFieldUpdateFlags( eFlags ); + getIDocumentSettingAccess().setFieldUpdateFlags( eFlags ); } SwFieldUpdateFlags SwEditShell::GetFieldUpdateFlags(bool bDocSettings) const { - return getIDocumentSettingAccess()->getFieldUpdateFlags( !bDocSettings ); + return getIDocumentSettingAccess().getFieldUpdateFlags( !bDocSettings ); } void SwEditShell::SetLabelDoc( bool bFlag ) @@ -420,7 +420,7 @@ void SwEditShell::SetLabelDoc( bool bFlag ) bool SwEditShell::IsLabelDoc() const { - return getIDocumentSettingAccess()->get(DocumentSettingId::LABEL_DOCUMENT); + return getIDocumentSettingAccess().get(DocumentSettingId::LABEL_DOCUMENT); } void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData) diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index a5311bd8bce8..a72240b29a46 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -33,12 +33,12 @@ bool SwEditShell::IsGlobalDoc() const { - return getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT); + return getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT); } void SwEditShell::SetGlblDocSaveLinks( bool bFlag ) { - getIDocumentSettingAccess()->set(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS, bFlag); + getIDocumentSettingAccess().set(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS, bFlag); if( !GetDoc()->getIDocumentState().IsModified() ) // Bug 57028 { GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); @@ -48,14 +48,14 @@ void SwEditShell::SetGlblDocSaveLinks( bool bFlag ) bool SwEditShell::IsGlblDocSaveLinks() const { - return getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS); + return getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS); } void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const { rArr.DeleteAndDestroyAll(); - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return; // then all linked areas on the topmost level @@ -136,7 +136,7 @@ void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, SwSectionData & rNew) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); @@ -177,7 +177,7 @@ bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, const SwTOXBase& rTOX ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); @@ -217,7 +217,7 @@ bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); @@ -240,7 +240,7 @@ bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos ) bool SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr , size_t nDelPos ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); @@ -306,7 +306,7 @@ bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr , size_t nFromPos, size_t nToPos, size_t nInsPos ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) || + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) || nFromPos >= rArr.size() || nToPos > rArr.size() || nInsPos > rArr.size() || nFromPos >= nToPos || ( nFromPos <= nInsPos && nInsPos <= nToPos ) ) @@ -341,7 +341,7 @@ bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr , bool SwEditShell::GotoGlobalDocContent( const SwGlblDocContent& rPos ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index f498f753912c..ba39bce73619 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -929,12 +929,12 @@ void SwEditShell::SetLineNumberInfo(const SwLineNumberInfo& rInfo) sal_uInt16 SwEditShell::GetLinkUpdMode(bool bDocSettings) const { - return getIDocumentSettingAccess()->getLinkUpdateMode( !bDocSettings ); + return getIDocumentSettingAccess().getLinkUpdateMode( !bDocSettings ); } void SwEditShell::SetLinkUpdMode( sal_uInt16 nMode ) { - getIDocumentSettingAccess()->setLinkUpdateMode( nMode ); + getIDocumentSettingAccess().setLinkUpdateMode( nMode ); } // Interface for TextInputData - (for text input of japanese/chinese characters) diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 9f6a74d2fcd6..2edec00f8169 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -135,9 +135,9 @@ void SwDDETable::ChangeContent() } } - const IDocumentSettingAccess* pIDSA = GetFrameFormat()->getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDSA = GetFrameFormat()->getIDocumentSettingAccess(); SwDoc* pDoc = GetFrameFormat()->GetDoc(); - if( AUTOUPD_FIELD_AND_CHARTS == pIDSA->getFieldUpdateFlags(true) ) + if( AUTOUPD_FIELD_AND_CHARTS == rIDSA.getFieldUpdateFlags(true) ) pDoc->getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx index 618acb04509e..f5d8514732b2 100644 --- a/sw/source/core/fields/postithelper.cxx +++ b/sw/source/core/fields/postithelper.cxx @@ -78,10 +78,10 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( o_rInfo.meSidebarPosition = pPage->SidebarPosition(); o_rInfo.mRedlineAuthor = 0; - const IDocumentRedlineAccess* pIDRA = pTextNode->getIDocumentRedlineAccess(); - if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) ) + const IDocumentRedlineAccess& rIDRA = pTextNode->getIDocumentRedlineAccess(); + if( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { - const SwRangeRedline* pRedline = pIDRA->GetRedline( rAnchorPos, 0 ); + const SwRangeRedline* pRedline = rIDRA.GetRedline( rAnchorPos, 0 ); if( pRedline ) { if( nsRedlineType_t::REDLINE_INSERT == pRedline->GetType() ) diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 7a73af074341..194bff89c765 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -865,7 +865,7 @@ void SwFEShell::InsertDrawObj( SdrObject& rDrawObj, rFlyAttrSet.Put( SwFormatAnchor( FLY_AT_PARA )); // #i89920# rFlyAttrSet.Put( SwFormatSurround( SURROUND_THROUGHT ) ); - rDrawObj.SetLayer( getIDocumentDrawModelAccess()->GetHeavenId() ); + rDrawObj.SetLayer( getIDocumentDrawModelAccess().GetHeavenId() ); // find anchor position SwPaM aPam( mpDoc->GetNodes() ); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index b72bead59631..79331de8f5b4 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -922,7 +922,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) if ( Imp()->HasDrawView() ) { const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); - const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); // correct type of <nControls> for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { @@ -945,7 +945,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) { SwFormat *pFormat = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetFormat(); SvxOpaqueItem aOpa( pFormat->GetOpaque() ); - aOpa.SetValue( nLayerId == pIDDMA->GetHellId() ); + aOpa.SetValue( nLayerId == rIDDMA.GetHellId() ); pFormat->SetFormatAttr( aOpa ); } } @@ -956,12 +956,12 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) void SwFEShell::SelectionToHeaven() { - ChangeOpaque( getIDocumentDrawModelAccess()->GetHeavenId() ); + ChangeOpaque( getIDocumentDrawModelAccess().GetHeavenId() ); } void SwFEShell::SelectionToHell() { - ChangeOpaque( getIDocumentDrawModelAccess()->GetHellId() ); + ChangeOpaque( getIDocumentDrawModelAccess().GetHellId() ); } size_t SwFEShell::IsObjSelected() const @@ -1125,13 +1125,13 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) if ( bRet && pObj ) { - const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); // #i89920# // Do not select object in background which is overlapping this text // at the given position. bool bObjInBackground( false ); { - if ( pObj->GetLayer() == pIDDMA->GetHellId() ) + if ( pObj->GetLayer() == rIDDMA.GetHellId() ) { const SwAnchoredObject* pAnchoredObj = ::GetUserCall( pObj )->GetAnchoredObj( pObj ); const SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat(); @@ -1198,7 +1198,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) if ( bRet ) { - const SdrPage* pPage = pIDDMA->GetDrawModel()->GetPage(0); + const SdrPage* pPage = rIDDMA.GetDrawModel()->GetPage(0); for(size_t a = pObj->GetOrdNum()+1; bRet && a < pPage->GetObjCount(); ++a) { SdrObject *pCandidate = pPage->GetObj(a); @@ -1319,7 +1319,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool // Here we are if // A No object has been selected and no group has been entered or // B An object has been selected and it is not inside a group - pList = getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 ); + pList = getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ); } OSL_ENSURE( pList, "No object list to iterate" ); @@ -1758,10 +1758,10 @@ bool SwFEShell::ImpEndCreate() // via the available SS be generated. GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false); // see above // #i52858# - method name changed - SdrPage *pPg = getIDocumentDrawModelAccess()->GetOrCreateDrawModel()->GetPage( 0 ); + SdrPage *pPg = getIDocumentDrawModelAccess().GetOrCreateDrawModel()->GetPage( 0 ); if( !pPg ) { - SdrModel* pTmpSdrModel = getIDocumentDrawModelAccess()->GetDrawModel(); + SdrModel* pTmpSdrModel = getIDocumentDrawModelAccess().GetDrawModel(); pPg = pTmpSdrModel->AllocPage( false ); pTmpSdrModel->InsertPage( pPg ); } @@ -1827,7 +1827,7 @@ bool SwFEShell::ImpEndCreate() } SwFormatVertOrient aVert( nYOffset, text::VertOrientation::NONE, text::RelOrientation::FRAME ); aSet.Put( aVert ); - SwDrawFrameFormat* pFormat = static_cast<SwDrawFrameFormat*>(getIDocumentLayoutAccess()->MakeLayoutFormat( RND_DRAW_OBJECT, &aSet )); + SwDrawFrameFormat* pFormat = static_cast<SwDrawFrameFormat*>(getIDocumentLayoutAccess().MakeLayoutFormat( RND_DRAW_OBJECT, &aSet )); // #i36010# - set layout direction of the position pFormat->SetPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor ); @@ -2531,7 +2531,7 @@ void SwFEShell::CheckUnboundObjects() aSet.Put( aAnch ); aSet.Put( SwFormatSurround( SURROUND_THROUGHT ) ); - SwFrameFormat* pFormat = getIDocumentLayoutAccess()->MakeLayoutFormat( RND_DRAW_OBJECT, &aSet ); + SwFrameFormat* pFormat = getIDocumentLayoutAccess().MakeLayoutFormat( RND_DRAW_OBJECT, &aSet ); SwDrawContact *pContact = new SwDrawContact( static_cast<SwDrawFrameFormat*>(pFormat), pObj ); diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 94ffa386e0bb..7f9f7c6cf130 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -686,10 +686,10 @@ bool SwGrfNode::RestorePersistentData() { if( refLink.Is() ) { - IDocumentLinksAdministration* pIDLA = getIDocumentLinksAdministration(); - refLink->SetVisible( pIDLA->IsVisibleLinks() ); - pIDLA->GetLinkManager().InsertDDELink( refLink ); - if( getIDocumentLayoutAccess()->GetCurrentLayout() ) + IDocumentLinksAdministration& rIDLA = getIDocumentLinksAdministration(); + refLink->SetVisible( rIDLA.IsVisibleLinks() ); + rIDLA.GetLinkManager().InsertDDELink( refLink ); + if( getIDocumentLayoutAccess().GetCurrentLayout() ) refLink->Update(); } return true; @@ -699,10 +699,10 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName ) { refLink = new SwBaseLink( SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::GDIMETAFILE, this ); - IDocumentLinksAdministration* pIDLA = getIDocumentLinksAdministration(); + IDocumentLinksAdministration& rIDLA = getIDocumentLinksAdministration(); if( GetNodes().IsDocNodes() ) { - refLink->SetVisible( pIDLA->IsVisibleLinks() ); + refLink->SetVisible( rIDLA.IsVisibleLinks() ); if( rFltName == "DDE" ) { sal_Int32 nTmp = 0; @@ -710,7 +710,7 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName ) sApp = rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ); sTopic = rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ); sItem = rGrfName.copy( nTmp ); - pIDLA->GetLinkManager().InsertDDELink( refLink, + rIDLA.GetLinkManager().InsertDDELink( refLink, sApp, sTopic, sItem ); } else @@ -719,7 +719,7 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName ) refLink->SetSynchron( bSync ); refLink->SetContentType( SotClipboardFormatId::SVXB ); - pIDLA->GetLinkManager().InsertFileLink( *refLink, + rIDLA.GetLinkManager().InsertFileLink( *refLink, OBJECT_CLIENT_GRF, rGrfName, (!bSync && !rFltName.isEmpty() ? &rFltName : 0) ); } @@ -742,7 +742,7 @@ void SwGrfNode::ReleaseLink() bInSwapIn = false; } - getIDocumentLinksAdministration()->GetLinkManager().Remove( refLink ); + getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); refLink.Clear(); maGrfObj.SetLink(); diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 5f4dc2f37149..d1c3af05da4b 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -152,7 +152,7 @@ protected: virtual const SwRect GetObjBoundRect() const SAL_OVERRIDE; virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE; - virtual const IDocumentDrawModelAccess* getIDocumentDrawModelAccess( ) SAL_OVERRIDE; + virtual const IDocumentDrawModelAccess& getIDocumentDrawModelAccess( ) SAL_OVERRIDE; SwTwips CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips nMinHeight, const SwTwips nUL); diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 11bf2b1c6ca5..6e8dd25a8b43 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -418,7 +418,7 @@ protected: void PaintShadow( const SwRect&, SwRect&, const SwBorderAttrs& ) const; virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE; - virtual const IDocumentDrawModelAccess* getIDocumentDrawModelAccess( ); + virtual const IDocumentDrawModelAccess& getIDocumentDrawModelAccess( ); public: virtual css::uno::Sequence< css::style::TabStop > GetTabStopInfo( SwTwips ) diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx index b644aea996f6..53c4e02814dd 100644 --- a/sw/source/core/inc/unoport.hxx +++ b/sw/source/core/inc/unoport.hxx @@ -239,8 +239,8 @@ public: SwTextPortionType GetTextPortionType() const { return m_ePortionType; } - SwUnoCrsr* GetCursor() const - { return &(*m_pUnoCursor); } + SwUnoCrsr& GetCursor() const + { return *m_pUnoCursor; } }; class SwXTextPortionEnumeration @@ -253,8 +253,8 @@ class SwXTextPortionEnumeration TextRangeList_t m_Portions; // contains all portions, filled by ctor sw::UnoCursorPointer m_pUnoCrsr; - SwUnoCrsr* GetCursor() const - {return &(*m_pUnoCrsr);} + SwUnoCrsr& GetCursor() const + {return *m_pUnoCrsr;} protected: virtual ~SwXTextPortionEnumeration(); diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index e446d24c3ea8..c8c348824146 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -435,7 +435,7 @@ bool SwAnchoredObject::ConsiderObjWrapInfluenceOnObjPos() const { bRet = true; } - else if ( rObjFormat.getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( rObjFormat.getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { const SwFormatAnchor& rAnchor = rObjFormat.GetAnchor(); if ( ((rAnchor.GetAnchorId() == FLY_AT_CHAR) || @@ -632,7 +632,7 @@ void SwAnchoredObject::UpdateObjInSortedList() { if ( GetAnchorFrm() ) { - if ( GetFrameFormat().getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + if ( GetFrameFormat().getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { // invalidate position of all anchored objects at anchor frame if ( GetAnchorFrm()->GetDrawObjs() ) diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index a66cd336d614..6bb30287662a 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -102,7 +102,7 @@ bool SwContentFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool, bool & ) // if <nMoveAnyway> equals 3 and no space is left in new upper. nMoveAnyway |= BwdMoveNecessary( pOldPage, Frm() ); { - const IDocumentSettingAccess* pIDSA = pNewPage->GetFormat()->getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDSA = pNewPage->GetFormat()->getIDocumentSettingAccess(); SwTwips nSpace = 0; SwRect aRect( pNewUpper->Prt() ); aRect.Pos() += pNewUpper->Frm().Pos(); @@ -116,7 +116,7 @@ bool SwContentFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool, bool & ) // check, if last frame is inside table and if it includes // its lower spacing. if ( !pPrevFrm->GetNext() && pPrevFrm->IsInTab() && - pIDSA->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) + rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) { const SwFrm* pLastFrm = pPrevFrm; // if last frame is a section, take its last content @@ -1907,7 +1907,7 @@ bool SwContentFrm::_WouldFit( SwTwips nSpace, // OD 2004-03-01 #106629# - also consider lower spacing in table cells if ( bRet && IsInTab() && - pNewUpper->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) + pNewUpper->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) { nSpace -= rAttrs.GetULSpace().GetLower(); if ( nSpace < 0 ) diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 26c5fe86a7bc..c412a3a93d20 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1370,8 +1370,8 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, SwTwips nUpper = 0; // OD 06.01.2004 #i11859# { - const IDocumentSettingAccess* pIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess(); - const bool bUseFormerLineSpacing = pIDSA->get(DocumentSettingId::OLD_LINE_SPACING); + const IDocumentSettingAccess& rIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess(); + const bool bUseFormerLineSpacing = rIDSA.get(DocumentSettingId::OLD_LINE_SPACING); if( pPrevFrm ) { // OD 2004-03-10 #i11860# - use new method to determine needed spacing @@ -1383,7 +1383,7 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing, bPrevLineSpacingPorportional ); - if( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX) ) + if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) ) { nUpper = nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); SwTwips nAdd = nPrevLineSpacing; @@ -1473,7 +1473,7 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, } } } - else if ( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) && + else if ( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) && CastFlowFrm( pOwn )->HasParaSpaceAtPages( m_rThis.IsSctFrm() ) ) { nUpper = pAttrs->GetULSpace().GetUpper(); @@ -1580,9 +1580,9 @@ SwTwips SwFlowFrm::_GetUpperSpaceAmountConsideredForPrevFrm() const GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing, bDummy ); if ( nPrevLowerSpace > 0 || nPrevLineSpacing > 0 ) { - const IDocumentSettingAccess* pIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX) || - !pIDSA->get(DocumentSettingId::OLD_LINE_SPACING) ) + const IDocumentSettingAccess& rIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) || + !rIDSA.get(DocumentSettingId::OLD_LINE_SPACING) ) { nUpperSpaceAmountOfPrevFrm = nPrevLowerSpace + nPrevLineSpacing; } @@ -1606,7 +1606,7 @@ SwTwips SwFlowFrm::GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid() const { SwTwips nUpperSpaceAmountConsideredForPrevFrmAndPageGrid = 0; - if ( !m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) + if ( !m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) { nUpperSpaceAmountConsideredForPrevFrmAndPageGrid = _GetUpperSpaceAmountConsideredForPrevFrm() + @@ -1669,7 +1669,7 @@ SwTwips SwFlowFrm::CalcAddLowerSpaceAsLastInTableCell( { SwTwips nAdditionalLowerSpace = 0; - if ( m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) + if ( m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) { const SwFrm* pFrm = &m_rThis; if ( pFrm->IsSctFrm() ) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 0d926b1a3523..b2f98f11a927 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -276,7 +276,7 @@ SwFlyFrm::~SwFlyFrm() { } -const IDocumentDrawModelAccess* SwFlyFrm::getIDocumentDrawModelAccess() +const IDocumentDrawModelAccess& SwFlyFrm::getIDocumentDrawModelAccess() { return GetFormat()->getIDocumentDrawModelAccess(); } @@ -389,7 +389,7 @@ SwVirtFlyDrawObj* SwFlyFrm::CreateNewRef( SwFlyDrawContact *pContact ) // into drawing page with correct order number else { - pContact->GetFormat()->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 )-> + pContact->GetFormat()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )-> InsertObject( pDrawObj, _GetOrdNumForNewRef( pContact ) ); } // #i38889# - assure, that new <SwVirtFlyDrawObj> instance @@ -403,13 +403,13 @@ void SwFlyFrm::InitDrawObj( bool bNotify ) // Find ContactObject from the Format. If there's already one, we just // need to create a new Ref, else we create the Contact now. - IDocumentDrawModelAccess* pIDDMA = GetFormat()->getIDocumentDrawModelAccess(); + IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess(); SwFlyDrawContact *pContact = SwIterator<SwFlyDrawContact,SwFormat>( *GetFormat() ).First(); if ( !pContact ) { // #i52858# - method name changed pContact = new SwFlyDrawContact( GetFormat(), - pIDDMA->GetOrCreateDrawModel() ); + rIDDMA.GetOrCreateDrawModel() ); } OSL_ENSURE( pContact, "InitDrawObj failed" ); // OD 2004-03-22 #i26791# @@ -417,8 +417,8 @@ void SwFlyFrm::InitDrawObj( bool bNotify ) // Set the right Layer // OD 2004-01-19 #110582# - SdrLayerID nHeavenId = pIDDMA->GetHeavenId(); - SdrLayerID nHellId = pIDDMA->GetHellId(); + SdrLayerID nHeavenId = rIDDMA.GetHeavenId(); + SdrLayerID nHellId = rIDDMA.GetHellId(); // OD 2004-03-22 #i26791# GetVirtDrawObj()->SetLayer( GetFormat()->GetOpaque().GetValue() ? nHeavenId @@ -895,10 +895,10 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, if ( pSh ) pSh->InvalidateWindows( Frm() ); - const IDocumentDrawModelAccess* pIDDMA = GetFormat()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess(); const sal_uInt8 nId = GetFormat()->GetOpaque().GetValue() ? - pIDDMA->GetHeavenId() : - pIDDMA->GetHellId(); + rIDDMA.GetHeavenId() : + rIDDMA.GetHellId(); GetVirtDrawObj()->SetLayer( nId ); if ( Lower() ) @@ -976,10 +976,10 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, if ( pSh ) pSh->InvalidateWindows( Frm() ); - const IDocumentDrawModelAccess* pIDDMA = GetFormat()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess(); const sal_uInt8 nId = static_cast<const SvxOpaqueItem*>(pNew)->GetValue() ? - pIDDMA->GetHeavenId() : - pIDDMA->GetHellId(); + rIDDMA.GetHeavenId() : + rIDDMA.GetHellId(); GetVirtDrawObj()->SetLayer( nId ); if( pSh ) { @@ -1595,7 +1595,7 @@ void CalcContent( SwLayoutFrm *pLay, // OD 2004-05-17 #i28701# - format anchor frame after its objects // are formatted, if the wrapping style influence has to be considered. - if ( pLay->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + if ( pLay->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { pFrm->Calc(pRenderContext); } @@ -2116,15 +2116,15 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj ) // Assure the control objects and group objects containing controls are on the control layer if ( ::CheckControlLayer( _rNewObj.DrawObj() ) ) { - const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer()); - const SdrLayerID aControlLayerID(pIDDMA->GetControlsId()); - const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId()); + const SdrLayerID aControlLayerID(rIDDMA.GetControlsId()); + const SdrLayerID aInvisibleControlLayerID(rIDDMA.GetInvisibleControlsId()); if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID) { - if ( aCurrentLayer == pIDDMA->GetInvisibleHellId() || - aCurrentLayer == pIDDMA->GetInvisibleHeavenId() ) + if ( aCurrentLayer == rIDDMA.GetInvisibleHellId() || + aCurrentLayer == rIDDMA.GetInvisibleHeavenId() ) { _rNewObj.DrawObj()->SetLayer(aInvisibleControlLayerID); } diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 36e7478043e0..f630bb0c253c 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1321,7 +1321,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) GetFormat()->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); if( pCnt != GetAnchorFrm() || ( IsAutoPos() && pCnt->IsTextFrm() && - GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE)) ) + GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)) ) { //Set the anchor attribute according to the new Cnt. SwFormatAnchor aAnch( pFormat->GetAnchor() ); diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 882ae50ad2d0..66b664365cc2 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -254,7 +254,7 @@ void SwFlyInCntFrm::MakeAll(vcl::RenderContext* /*pRenderContext*/) // re-activate clipping of as-character anchored Writer fly frames // depending on compatibility option <ClipAsCharacterAnchoredWriterFlyFrames> if ( mbValidPos && mbValidSize && - GetFormat()->getIDocumentSettingAccess()->get( DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME ) ) + GetFormat()->getIDocumentSettingAccess().get( DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME ) ) { SwFrm* pFrm = AnchorFrm(); if ( Frm().Left() == (pFrm->Frm().Left()+pFrm->Prt().Left()) && diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index fe9bb3d4750f..fa0a15595b07 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -916,7 +916,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) const bool bFollowTextFlow = pFly->GetFormat()->GetFollowTextFlow().GetValue(); // #i28701# const bool bConsiderWrapOnObjPos = - pFly->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); + pFly->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); const SwFormatVertOrient &rV = pFly->GetFormat()->GetVertOrient(); if( pFly->IsFlyLayFrm() ) { diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index aa1e2dbc3cee..9a56a1ad5859 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1058,7 +1058,7 @@ void AppendObjs( const SwFrameFormats *pTable, sal_uLong nIndex, { if ( !pSdrObj->GetPage() ) { - pFormat->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)-> + pFormat->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)-> InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect()); } diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 27dc66b2c5ec..c87def2fae8d 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -85,7 +85,7 @@ static void BreakPoint() { if ( IsAgain() ) \ { \ if( bNoLoop ) \ - pLayoutAccess->GetLayouter()->EndLoopControl(); \ + rLayoutAccess.GetLayouter()->EndLoopControl(); \ return; \ } \ } @@ -141,8 +141,8 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwContentFrm *pCn continue; // OD 2004-01-15 #110582# - do not consider invisible objects - const IDocumentDrawModelAccess* pIDDMA = pPage->GetFormat()->getIDocumentDrawModelAccess(); - if ( !pIDDMA->IsVisibleLayerId( pO->GetLayer() ) ) + const IDocumentDrawModelAccess& rIDDMA = pPage->GetFormat()->getIDocumentDrawModelAccess(); + if ( !rIDDMA.IsVisibleLayerId( pO->GetLayer() ) ) { continue; } @@ -155,7 +155,7 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwContentFrm *pCn if ( pSelfFly && pSelfFly->IsLowerOf( pFly ) ) continue; - if ( pFly->GetVirtDrawObj()->GetLayer() == pIDDMA->GetHellId() ) + if ( pFly->GetVirtDrawObj()->GetLayer() == rIDDMA.GetHellId() ) continue; if ( pSelfFly ) @@ -467,7 +467,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) while ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() ) pPage = static_cast<SwPageFrm*>(pPage->GetNext()); - IDocumentLayoutAccess *pLayoutAccess = pRoot->GetFormat()->getIDocumentLayoutAccess(); + IDocumentLayoutAccess& rLayoutAccess = pRoot->GetFormat()->getIDocumentLayoutAccess(); bool bNoLoop = pPage && SwLayouter::StartLoopControl( pRoot->GetFormat()->GetDoc(), pPage ); sal_uInt16 nPercentPageNum = 0; while ( (pPage && !IsInterrupt()) || nCheckPageNum != USHRT_MAX ) @@ -519,7 +519,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) if ( IsAgain() ) { if( bNoLoop ) - pLayoutAccess->GetLayouter()->EndLoopControl(); + rLayoutAccess.GetLayouter()->EndLoopControl(); return; } pPage = static_cast<SwPageFrm*>(pRoot->Lower()); @@ -598,7 +598,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) } } if( bNoLoop ) - pLayoutAccess->GetLayouter()->LoopControl( pPage, LOOP_PAGE ); + rLayoutAccess.GetLayouter()->LoopControl( pPage, LOOP_PAGE ); } unlockPositionOfObjects( pPage ); @@ -651,7 +651,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) pPage = static_cast<SwPageFrm*>(pPage->GetNext()); } if( bNoLoop ) - pLayoutAccess->GetLayouter()->LoopControl( pPage, LOOP_PAGE ); + rLayoutAccess.GetLayouter()->LoopControl( pPage, LOOP_PAGE ); } CheckIdleEnd(); } @@ -669,7 +669,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) if ( IsAgain() ) { if( bNoLoop ) - pLayoutAccess->GetLayouter()->EndLoopControl(); + rLayoutAccess.GetLayouter()->EndLoopControl(); return; } pPage = static_cast<SwPageFrm*>(pRoot->Lower()); @@ -801,7 +801,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) } pOptTab = 0; if( bNoLoop ) - pLayoutAccess->GetLayouter()->EndLoopControl(); + rLayoutAccess.GetLayouter()->EndLoopControl(); } bool SwLayAction::_TurboAction( const SwContentFrm *pCnt ) @@ -1486,8 +1486,8 @@ bool SwLayAction::FormatLayoutTab( SwTabFrm *pTab, bool bAddRect ) return false; vcl::RenderContext* pRenderContext = pImp->GetShell()->GetOut(); - IDocumentTimerAccess *pTimerAccess = pRoot->GetFormat()->getIDocumentTimerAccess(); - pTimerAccess->BlockIdling(); + IDocumentTimerAccess& rTimerAccess = pRoot->GetFormat()->getIDocumentTimerAccess(); + rTimerAccess.BlockIdling(); bool bChanged = false; bool bPainted = false; @@ -1596,7 +1596,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrm *pTab, bool bAddRect ) CheckWaitCrsr(); - pTimerAccess->UnblockIdling(); + rTimerAccess.UnblockIdling(); // Ugly shortcut! if ( pTab->IsLowersFormatted() && @@ -2027,7 +2027,7 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool bVisAreaOnly ) return false; break; case WORD_COUNT : - if ( !pViewShell->getIDocumentStatistics()->GetDocStat().bModified ) + if ( !pViewShell->getIDocumentStatistics().GetDocStat().bModified ) return false; break; case SMART_TAGS : @@ -2274,7 +2274,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewShellImp *pI ) : // See conditions in DoIdleJob() const bool bSpell = rVOpt.IsOnlineSpell(); const bool bACmplWrd = SwViewOption::IsAutoCompleteWords(); - const bool bWordCount = pViewShell->getIDocumentStatistics()->GetDocStat().bModified; + const bool bWordCount = pViewShell->getIDocumentStatistics().GetDocStat().bModified; const bool bSmartTags = !pViewShell->GetDoc()->GetDocShell()->IsHelpDocument() && !pViewShell->GetDoc()->isXForms() && SwSmartTagMgr::Get().IsSmartTagsEnabled(); diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index e71ea11ee688..8eee3606a721 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -487,16 +487,16 @@ void SwRootFrm::Init( SwFrameFormat* pFormat ) { InitCurrShells( this ); - IDocumentTimerAccess *pTimerAccess = pFormat->getIDocumentTimerAccess(); - IDocumentLayoutAccess *pLayoutAccess = pFormat->getIDocumentLayoutAccess(); - IDocumentFieldsAccess *pFieldsAccess = pFormat->getIDocumentFieldsAccess(); - const IDocumentSettingAccess *pSettingAccess = pFormat->getIDocumentSettingAccess(); - pTimerAccess->StopIdling(); + IDocumentTimerAccess& rTimerAccess = pFormat->getIDocumentTimerAccess(); + IDocumentLayoutAccess& rLayoutAccess = pFormat->getIDocumentLayoutAccess(); + IDocumentFieldsAccess& rFieldsAccess = pFormat->getIDocumentFieldsAccess(); + const IDocumentSettingAccess& rSettingAccess = pFormat->getIDocumentSettingAccess(); + rTimerAccess.StopIdling(); // For creating the Flys by MakeFrms() - pLayoutAccess->SetCurrentViewShell( this->GetCurrShell() ); + rLayoutAccess.SetCurrentViewShell( this->GetCurrShell() ); mbCallbackActionEnabled = false; // needs to be set to true before leaving! - SwDrawModel* pMd = pFormat->getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* pMd = pFormat->getIDocumentDrawModelAccess().GetDrawModel(); if ( pMd ) { // Disable "multiple layout" @@ -556,16 +556,16 @@ void SwRootFrm::Init( SwFrameFormat* pFormat ) ::_InsertCnt( pLay, pDoc, aTmp.GetIndex(), true ); //Remove masters that haven't been replaced yet from the list. RemoveMasterObjs( mpDrawPage ); - if( pSettingAccess->get(DocumentSettingId::GLOBAL_DOCUMENT) ) - pFieldsAccess->UpdateRefFields( NULL ); + if( rSettingAccess.get(DocumentSettingId::GLOBAL_DOCUMENT) ) + rFieldsAccess.UpdateRefFields( NULL ); //b6433357: Update page fields after loading if ( !mpCurrShell || !mpCurrShell->Imp()->IsUpdateExpFields() ) { SwDocPosUpdate aMsgHint( pPage->Frm().Top() ); - pFieldsAccess->UpdatePageFields( &aMsgHint ); + rFieldsAccess.UpdatePageFields( &aMsgHint ); } - pTimerAccess->StartIdling(); + rTimerAccess.StartIdling(); mbCallbackActionEnabled = true; SwViewShell *pViewSh = GetCurrShell(); diff --git a/sw/source/core/layout/objectformatter.cxx b/sw/source/core/layout/objectformatter.cxx index b49f9a72e694..a2d2fdeb880c 100644 --- a/sw/source/core/layout/objectformatter.cxx +++ b/sw/source/core/layout/objectformatter.cxx @@ -137,7 +137,7 @@ SwObjectFormatter::SwObjectFormatter( const SwPageFrm& _rPageFrm, const bool _bCollectPgNumOfAnchors ) : mrPageFrm( _rPageFrm ), mbFormatOnlyAsCharAnchored( false ), - mbConsiderWrapOnObjPos( _rPageFrm.GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ), + mbConsiderWrapOnObjPos( _rPageFrm.GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ), mpLayAction( _pLayAction ), // --> #i26945# mpPgNumAndTypeOfAnchors( _bCollectPgNumOfAnchors ? new SwPageNumAndTypeOfAnchors() : 0L ) diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 3c755e1d90f1..2bf79201f05f 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1907,7 +1907,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi mbSidebarChanged = false; } - if( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE ) ) + if( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE ) ) { mnColumns = 1; mbBookMode = false; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 4f27f02e8d4c..b22259a0a640 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1628,8 +1628,8 @@ static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, //If the content of the Fly is transparent, we subtract it only if it's //contained in the hell layer. - const IDocumentDrawModelAccess* pIDDMA = pFly->GetFormat()->getIDocumentDrawModelAccess(); - bool bHell = pSdrObj->GetLayer() == pIDDMA->GetHellId(); + const IDocumentDrawModelAccess& rIDDMA = pFly->GetFormat()->getIDocumentDrawModelAccess(); + bool bHell = pSdrObj->GetLayer() == rIDDMA.GetHellId(); if ( (bStopOnHell && bHell) || /// Change internal order of condition /// first check "!bHell", then "..->Lower()" and "..->IsNoTextFrm()" @@ -3367,8 +3367,8 @@ void SwRootFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, S if ( pSh->Imp()->HasDrawView() ) { gProp.pSLines->LockLines( true ); - const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); - pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), + const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); + pSh->Imp()->PaintLayer( rIDDMA.GetHellId(), pPrintData, pPage->Frm(), &aPageBackgrdColor, @@ -4057,7 +4057,7 @@ bool SwFlyFrm::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) { if ( !pAnch->GetValidPosFlag() ) pAnch = 0; - else if ( sal_IntPtr(pSh->GetOut()) == sal_IntPtr(pSh->getIDocumentDeviceAccess()->getPrinter( false ))) + else if ( sal_IntPtr(pSh->GetOut()) == sal_IntPtr(pSh->getIDocumentDeviceAccess().getPrinter( false ))) { //HACK: we have to omit some of the objects for printing, //otherwise they would be printed twice. @@ -4210,16 +4210,16 @@ void SwFlyFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw // for transparent graphics in layer Hell, if parent fly frame isn't // in layer Hell. It's only painted the intersection between the // parent fly frame area and the paint area <aRect> - const IDocumentDrawModelAccess* pIDDMA = GetFormat()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess(); if (bIsGraphicTransparent && GetFormat()->GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS) && - GetVirtDrawObj()->GetLayer() == pIDDMA->GetHellId() && + GetVirtDrawObj()->GetLayer() == rIDDMA.GetHellId() && GetAnchorFrm()->FindFlyFrm() ) { const SwFlyFrm* pParentFlyFrm = GetAnchorFrm()->FindFlyFrm(); if ( pParentFlyFrm->GetDrawObj()->GetLayer() != - pIDDMA->GetHellId() ) + rIDDMA.GetHellId() ) { SwFlyFrm* pOldRet = gProp.pSRetoucheFly2; gProp.pSRetoucheFly2 = const_cast<SwFlyFrm*>(this); @@ -7414,16 +7414,16 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const if ( aRetouchePart.HasArea() ) { const Color aPageBackgrdColor(pPage->GetDrawBackgrdColor()); - const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); // --> OD #i76669# SwViewObjectContactRedirector aSwRedirector( *pSh ); // <-- - pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), 0, + pSh->Imp()->PaintLayer( rIDDMA.GetHellId(), 0, aRetouchePart, &aPageBackgrdColor, pPage->IsRightToLeft(), &aSwRedirector ); - pSh->Imp()->PaintLayer( pIDDMA->GetHeavenId(), 0, + pSh->Imp()->PaintLayer( rIDDMA.GetHeavenId(), 0, aRetouchePart, &aPageBackgrdColor, pPage->IsRightToLeft(), &aSwRedirector ); @@ -7703,11 +7703,11 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) // OD 09.12.2002 #103045# - determine page, fly frame is on const SwPageFrm* pFlyPage = pFly->FindPageFrm(); const Color aPageBackgrdColor(pFlyPage->GetDrawBackgrdColor()); - const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); // --> OD #i76669# SwViewObjectContactRedirector aSwRedirector( *pSh ); // <-- - pImp->PaintLayer( pIDDMA->GetHellId(), 0, aOut, &aPageBackgrdColor, + pImp->PaintLayer( rIDDMA.GetHellId(), 0, aOut, &aPageBackgrdColor, pFlyPage->IsRightToLeft(), &aSwRedirector ); gProp.pSLines->PaintLines( pDev, gProp ); @@ -7715,7 +7715,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) pFly->Paint( *pDev, aOut ); gProp.pSLines->PaintLines( pDev, gProp ); // OD 30.08.2002 #102450# - add 3rd parameter - pImp->PaintLayer( pIDDMA->GetHeavenId(), 0, aOut, &aPageBackgrdColor, + pImp->PaintLayer( rIDDMA.GetHeavenId(), 0, aOut, &aPageBackgrdColor, pFlyPage->IsRightToLeft(), &aSwRedirector ); gProp.pSLines->PaintLines( pDev, gProp ); @@ -7748,7 +7748,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) Graphic SwDrawFrameFormat::MakeGraphic( ImageMap* ) { Graphic aRet; - SwDrawModel* pMod = getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* pMod = getIDocumentDrawModelAccess().GetDrawModel(); if ( pMod ) { SdrObject *pObj = FindSdrObject(); diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index ef889db091aa..f5fe4fe3e09a 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -1263,7 +1263,7 @@ void SwSectionFrm::Format( vcl::RenderContext* pRenderContext, const SwBorderAtt // and releases this position lock keeping on destruction. ExtraFormatToPositionObjs aExtraFormatToPosObjs( *this ); if ( !bMaximize && - GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && + GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && !GetFormat()->GetBalancedColumns().GetValue() ) { aExtraFormatToPosObjs.FormatSectionToPositionObjs(); @@ -1964,7 +1964,7 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, bool bTst ) // was moved forward due to the positioning of its objects ). // Thus, invalivate this next frame, if document compatibility // option 'Consider wrapping style influence on object positioning' is ON. - else if ( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { InvalidateNextPos(); } diff --git a/sw/source/core/layout/sortedobjs.cxx b/sw/source/core/layout/sortedobjs.cxx index ea26372c06f3..2a6dfb1180f9 100644 --- a/sw/source/core/layout/sortedobjs.cxx +++ b/sw/source/core/layout/sortedobjs.cxx @@ -156,9 +156,9 @@ struct ObjAnchorOrder // objects anchored at the same content and at the same content anchor // node position with the same anchor type // Thus, compare its wrapping style including its layer - const IDocumentDrawModelAccess* pIDDMA = rFormatListed.getIDocumentDrawModelAccess(); - const SdrLayerID nHellId = pIDDMA->GetHellId(); - const SdrLayerID nInvisibleHellId = pIDDMA->GetInvisibleHellId(); + const IDocumentDrawModelAccess& rIDDMA = rFormatListed.getIDocumentDrawModelAccess(); + const SdrLayerID nHellId = rIDDMA.GetHellId(); + const SdrLayerID nInvisibleHellId = rIDDMA.GetInvisibleHellId(); const bool bWrapThroughOrHellListed = rFormatListed.GetSurround().GetSurround() == SURROUND_THROUGHT || _pListedAnchoredObj->GetDrawObj()->GetLayer() == nHellId || diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index bd2b6315cba4..8bb796a1f2da 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2537,14 +2537,14 @@ bool SwTabFrm::CalcFlyOffsets( SwTwips& rUpper, // --> #108724# Page header/footer content doesn't have to wrap around // floating screen objects - const IDocumentSettingAccess* pIDSA = GetFormat()->getIDocumentSettingAccess(); - const bool bWrapAllowed = pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) || + const IDocumentSettingAccess& rIDSA = GetFormat()->getIDocumentSettingAccess(); + const bool bWrapAllowed = rIDSA.get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) || ( !IsInFootnote() && 0 == FindFooterOrHeader() ); if ( pPage->GetSortedObjs() && bWrapAllowed ) { SWRECTFN( this ) - const bool bConsiderWrapOnObjPos = pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); + const bool bConsiderWrapOnObjPos = rIDSA.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); long nPrtPos = (Frm().*fnRect->fnGetTop)(); nPrtPos = (*fnRect->fnYInc)( nPrtPos, rUpper ); SwRect aRect( Frm() ); @@ -2865,7 +2865,7 @@ void SwTabFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAtt // #i26250# - extend bottom printing area, if table // is last content inside a table cell. - if ( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) && + if ( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) && GetUpper()->IsInTab() && !GetIndNext() ) { nLower += pAttrs->GetULSpace().GetLower(); @@ -2980,7 +2980,7 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo ) // forward due to the positioning of its objects ). Thus, invalivate this // next frame, if document compatibility option 'Consider wrapping style // influence on object positioning' is ON. - else if ( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { InvalidateNextPos(); } @@ -4843,7 +4843,7 @@ void SwCellFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAt // #i43913# - no vertical alignment, if wrapping // style influence is considered on object positioning and // an object is anchored inside the cell. - const bool bConsiderWrapOnObjPos( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ); + const bool bConsiderWrapOnObjPos( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ); //No alignment if border with flow overlaps the cell. if ( pPg->GetSortedObjs() ) { diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 9ab790c357fa..1548af234669 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -81,7 +81,7 @@ SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) : mbForbidDelete = false; } -const IDocumentDrawModelAccess* SwFrm::getIDocumentDrawModelAccess() +const IDocumentDrawModelAccess& SwFrm::getIDocumentDrawModelAccess() { return GetUpper()->GetFormat()->getIDocumentDrawModelAccess(); } @@ -1732,7 +1732,7 @@ SwTwips SwContentFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo ) // due to the positioning of its objects ). Thus, invalivate this next frame, // if document compatibility option 'Consider wrapping style influence on // object positioning' is ON. - else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { InvalidateNextPos(); } @@ -1798,7 +1798,7 @@ SwTwips SwContentFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo ) { GetNext()->InvalidatePos(); } - else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { InvalidateNextPos(); } @@ -2046,7 +2046,7 @@ void SwContentFrm::_UpdateAttr( const SfxPoolItem* pOld, const SfxPoolItem* pNew } // OD 2004-03-17 #i11860# if ( GetIndNext() && - !GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) + !GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) { // OD 2004-07-01 #i28701# - use new method <InvalidateObjs(..)> GetIndNext()->InvalidateObjs( true ); @@ -2066,9 +2066,9 @@ void SwContentFrm::_UpdateAttr( const SfxPoolItem* pOld, const SfxPoolItem* pNew case RES_BREAK: { rInvFlags |= 0x42; - const IDocumentSettingAccess* pIDSA = GetUpper()->GetFormat()->getIDocumentSettingAccess(); - if( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX) || - pIDSA->get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) ) + const IDocumentSettingAccess& rIDSA = GetUpper()->GetFormat()->getIDocumentSettingAccess(); + if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) || + rIDSA.get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) ) { rInvFlags |= 0x1; SwFrm* pNxt = FindNext(); diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index b4e63e36d8ae..4d5373084e59 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -121,7 +121,7 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() // - it doesn't follow the text flow { mbDoNotCaptureAnchoredObj = !mbIsObjFly && !mbFollowTextFlow && - mpFrameFormat->getIDocumentSettingAccess()->get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE); + mpFrameFormat->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE); } } @@ -411,7 +411,7 @@ SwTwips SwAnchoredObjectPosition::_ImplAdjustVertRelPos( const SwTwips nTopOfAnc { // #i26945# - no extension of restricted area, if // object's attribute follow text flow is set and its inside a table - if ( GetFrameFormat().getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && + if ( GetFrameFormat().getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && ( !bFollowTextFlow || !GetAnchoredObj().GetAnchorFrm()->IsInTab() ) ) { diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 2a679f443b0a..41afd1586320 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -207,7 +207,7 @@ void* lcl_GetKeyFromFrame( const SwFrm& rFrm ) void* pKey = 0; if ( rFrm.IsPageFrm() ) - pKey = const_cast<void*>(static_cast<void const *>((static_cast<const SwPageFrm&>(rFrm).GetFormat()->getIDocumentSettingAccess()))); + pKey = const_cast<void*>(static_cast<void const *>(&(static_cast<const SwPageFrm&>(rFrm).GetFormat()->getIDocumentSettingAccess()))); else if ( rFrm.IsTextFrm() ) pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwTextFrm&>(rFrm).GetTextNode())); else if ( rFrm.IsSctFrm() ) diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 86d173fd1d4f..d5ee4eec2121 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1378,7 +1378,7 @@ void SwTextFrm::FillCrsrPos( SwFillData& rFill ) const } OutputDevice* pOut = pSh->GetOut(); if( !pSh->GetViewOptions()->getBrowseMode() || pSh->GetViewOptions()->IsPrtFormat() ) - pOut = GetTextNode()->getIDocumentDeviceAccess()->getReferenceDevice( true ); + pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true ); pFnt->SetFntChg( true ); pFnt->ChgPhysFnt( pSh, *pOut ); diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 2381383b36d1..03bce1496595 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -122,7 +122,7 @@ SwExtraPainter::SwExtraPainter( const SwTextFrm *pFrm, SwViewShell *pVwSh, */ nDivider = !rLineInf.GetDivider().isEmpty() ? rLineInf.GetDividerCountBy() : 0; nX = pFrm->Frm().Left(); - SwCharFormat* pFormat = rLineInf.GetCharFormat( const_cast<IDocumentStylePoolAccess&>(*pFrm->GetNode()->getIDocumentStylePoolAccess()) ); + SwCharFormat* pFormat = rLineInf.GetCharFormat( const_cast<IDocumentStylePoolAccess&>(pFrm->GetNode()->getIDocumentStylePoolAccess()) ); OSL_ENSURE( pFormat, "PaintExtraData without CharFormat" ); pFnt = new SwFont( &pFormat->GetAttrSet(), pFrm->GetTextNode()->getIDocumentSettingAccess() ); pFnt->Invalidate(); @@ -285,13 +285,13 @@ void SwTextFrm::PaintExtraData( const SwRect &rRect ) const return; const SwTextNode& rTextNode = *GetTextNode(); - const IDocumentRedlineAccess* pIDRA = rTextNode.getIDocumentRedlineAccess(); + const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); const SwLineNumberInfo &rLineInf = rTextNode.GetDoc()->GetLineNumberInfo(); const SwFormatLineNumber &rLineNum = GetAttrSet()->GetLineNumber(); bool bLineNum = !IsInTab() && rLineInf.IsPaintLineNumbers() && ( !IsInFly() || rLineInf.IsCountInFlys() ) && rLineNum.IsCount(); sal_Int16 eHor = (sal_Int16)SW_MOD()->GetRedlineMarkPos(); - if( eHor != text::HoriOrientation::NONE && !IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) ) + if( eHor != text::HoriOrientation::NONE && !IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) eHor = text::HoriOrientation::NONE; bool bRedLine = eHor != text::HoriOrientation::NONE; if ( bLineNum || bRedLine ) @@ -384,7 +384,7 @@ void SwTextFrm::PaintExtraData( const SwRect &rRect ) const } else { - if ( USHRT_MAX == pIDRA->GetRedlinePos(rTextNode, USHRT_MAX) ) + if ( USHRT_MAX == rIDRA.GetRedlinePos(rTextNode, USHRT_MAX) ) bRedLine = false; if( bLineNum && rLineInf.IsCountBlankLines() && @@ -478,10 +478,10 @@ bool SwTextFrm::PaintEmpty( const SwRect &rRect, bool bCheck ) const pFnt = new SwFont( aFontAccess.Get()->GetFont() ); } - const IDocumentRedlineAccess* pIDRA = rTextNode.getIDocumentRedlineAccess(); - if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) ) + const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); + if( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { - const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTextNode, USHRT_MAX ); + const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); if( USHRT_MAX != nRedlPos ) { SwAttrHandler aAttrHandler; diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 3a38002ecd67..089318b71eff 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -277,7 +277,7 @@ void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextF m_pOut = Application::GetDefaultDevice(); } else - m_pOut = pNd->getIDocumentDeviceAccess()->getPrinter( false ); + m_pOut = pNd->getIDocumentDeviceAccess().getPrinter( false ); m_pRef = m_pOut; } diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 3315f8bfd65b..d4347bd2efe3 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -414,7 +414,7 @@ bool SwTextNode::IsSymbol( const sal_Int32 nBegin ) const SwAttrIter aIter( *const_cast<SwTextNode*>(this), aScriptInfo ); aIter.Seek( nBegin ); return aIter.GetFnt()->IsSymbol( - const_cast<SwViewShell *>(getIDocumentLayoutAccess()->GetCurrentViewShell()) ); + const_cast<SwViewShell *>(getIDocumentLayoutAccess().GetCurrentViewShell()) ); } class SwMinMaxNodeArgs @@ -665,7 +665,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM case CHAR_HARDHYPHEN: { OUString sTmp( cChar ); - SwDrawTextInfo aDrawInf( getIDocumentLayoutAccess()->GetCurrentViewShell(), + SwDrawTextInfo aDrawInf( getIDocumentLayoutAccess().GetCurrentViewShell(), *pOut, 0, sTmp, 0, 1, 0, false ); nAktWidth = aIter.GetFnt()->_GetTextSize( aDrawInf ).Width(); aArg.nWordWidth += nAktWidth; @@ -799,7 +799,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd if ( getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE) ) pOut = Application::GetDefaultDevice(); else - pOut = getIDocumentDeviceAccess()->getReferenceDevice( true ); + pOut = getIDocumentDeviceAccess().getReferenceDevice( true ); } OSL_ENSURE( pOut, "GetScalingOfSelectedText without outdev" ); diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 894c033ca1fb..93d4162d507e 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1334,7 +1334,7 @@ void SwScriptInfo::DeleteHiddenRanges( SwTextNode& rNode ) nHiddenStart = *(rFirst++); SwPaM aPam( rNode, nHiddenStart, rNode, nHiddenEnd ); - rNode.getIDocumentContentOperations()->DeleteRange( aPam ); + rNode.getIDocumentContentOperations().DeleteRange( aPam ); } } @@ -2091,7 +2091,7 @@ void SwScriptInfo::selectRedLineDeleted(const SwTextNode& rNode, MultiSelection assert((rNode.GetText().isEmpty() && rHiddenMulti.GetTotalRange().Len() == 1) || (rNode.GetText().getLength() == rHiddenMulti.GetTotalRange().Len())); - const IDocumentRedlineAccess& rIDRA = *rNode.getIDocumentRedlineAccess(); + const IDocumentRedlineAccess& rIDRA = rNode.getIDocumentRedlineAccess(); if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { sal_uInt16 nAct = rIDRA.GetRedlinePos( rNode, USHRT_MAX ); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 5e78961844a9..c2b029ebc37a 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -244,13 +244,13 @@ SwTwips SwTextFrm::EmptyHeight() const if ( !pOut || !pSh->GetViewOptions()->getBrowseMode() || pSh->GetViewOptions()->IsPrtFormat() ) { - pOut = rTextNode.getIDocumentDeviceAccess()->getReferenceDevice(true); + pOut = rTextNode.getIDocumentDeviceAccess().getReferenceDevice(true); } - const IDocumentRedlineAccess* pIDRA = rTextNode.getIDocumentRedlineAccess(); - if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) ) + const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); + if( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { - const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTextNode, USHRT_MAX ); + const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); if( USHRT_MAX != nRedlPos ) { SwAttrHandler aAttrHandler; @@ -384,7 +384,7 @@ bool SwTextFrm::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff ) OutputDevice *pOut = 0; if( !pSh || !pSh->GetViewOptions()->getBrowseMode() || pSh->GetViewOptions()->IsPrtFormat() ) - pOut = GetTextNode()->getIDocumentDeviceAccess()->getReferenceDevice( true ); + pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true ); if( pSh && !pOut ) pOut = pSh->GetWin(); diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 9edc033e5eae..b9ce387cb16e 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -46,7 +46,7 @@ using namespace ::com::sun::star; void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf, SwTextFrm* pFrm ) { // during HTML-Import it can happen, that no layout exists - SwRootFrm* pRootFrm = rTextNode.getIDocumentLayoutAccess()->GetCurrentLayout(); + SwRootFrm* pRootFrm = rTextNode.getIDocumentLayoutAccess().GetCurrentLayout(); pShell = pRootFrm ? pRootFrm->GetCurrShell() : 0; pScriptInfo = &rScrInf; @@ -126,13 +126,13 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf, nStartIndex = nEndIndex = nPos = nChgCnt = 0; nPropFont = 0; SwDoc* pDoc = rTextNode.GetDoc(); - const IDocumentRedlineAccess* pIDRA = rTextNode.getIDocumentRedlineAccess(); + const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); const SwExtTextInput* pExtInp = pDoc->GetExtTextInput( rTextNode ); - const bool bShow = IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ); + const bool bShow = IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ); if( pExtInp || bShow ) { - const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTextNode, USHRT_MAX ); + const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); if( pExtInp || USHRT_MAX != nRedlPos ) { const std::vector<sal_uInt16> *pArr = 0; diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 1f79bba70d0b..a959e71ed576 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -501,7 +501,7 @@ bool SwTextFly::DrawTextOpaque( SwDrawTextInfo &rInf ) SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); if ( bOn && nCount > 0 ) { - const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess()->GetHellId(); + const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId(); for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i ) { // #i68520# @@ -589,7 +589,7 @@ void SwTextFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect, SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); if ( bOn && nCount > 0 ) { - const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess()->GetHellId(); + const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId(); for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i ) { // #i68520# @@ -899,7 +899,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() const long nLeft = (aRect.*fnRect->fnGetLeft)() + 1; const bool bR2L = pCurrFrm->IsRightToLeft(); - const IDocumentDrawModelAccess* pIDDMA = pCurrFrm->GetTextNode()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = pCurrFrm->GetTextNode()->getIDocumentDrawModelAccess(); for( size_t i = 0; i < nCount; ++i ) { @@ -914,7 +914,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() SwAnchoredObject* pAnchoredObj = (*pSorted)[ i ]; assert(pAnchoredObj); if ( !pAnchoredObj || - !pIDDMA->IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) || + !rIDDMA.IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) || !pAnchoredObj->ConsiderForTextWrap() || ( mbIgnoreObjsInHeaderFooter && !bFooterHeader && pAnchoredObj->GetAnchorFrm()->FindFooterOrHeader() ) ) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 9ed3750e0772..397996b031ed 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1334,7 +1334,7 @@ void SwTextFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) } // switch if( bSetFieldsDirty ) - GetNode()->getIDocumentFieldsAccess()->SetFieldsDirty( true, GetNode(), 1 ); + GetNode()->getIDocumentFieldsAccess().SetFieldsDirty( true, GetNode(), 1 ); if ( bRecalcFootnoteFlag ) CalcFootnoteFlag(); @@ -2244,7 +2244,7 @@ void SwTextFrm::_CalcHeightOfLastLine( const bool _bUseFont ) if ( !pVsh->GetViewOptions()->getBrowseMode() || pVsh->GetViewOptions()->IsPrtFormat() ) { - pOut = GetTextNode()->getIDocumentDeviceAccess()->getReferenceDevice( true ); + pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true ); } OSL_ENSURE( pOut, "<SwTextFrm::_GetHeightOfLastLineForPropLineSpacing()> - no OutputDevice" ); // #i78921# - make code robust, according to provided patch diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index dc1a2f71899d..0b965860a705 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -643,7 +643,7 @@ void SwTextFrm::ConnectFootnote( SwTextFootnote *pFootnote, const SwTwips nDeadL SwFootnoteFrm *pNew = new SwFootnoteFrm(pDoc->GetDfltFrameFormat(),this,this,pFootnote); SwNodeIndex aIdx( *pFootnote->GetStartNode(), 1 ); ::_InsertCnt( pNew, pDoc, aIdx.GetIndex() ); - GetNode()->getIDocumentLayoutAccess()->GetLayouter()->CollectEndnote( pNew ); + GetNode()->getIDocumentLayoutAccess().GetLayouter()->CollectEndnote( pNew ); } else if( pSrcFrm != this ) SwFootnoteBossFrm::ChangeFootnoteRef( pSrcFrm, pFootnote, this ); diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 0a25e5921637..4445da495c54 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -402,8 +402,8 @@ void SwTextField::CopyTextField( SwTextField *pDest ) const OSL_ENSURE( m_pTextNode, "SwTextField: where is my TextNode?" ); OSL_ENSURE( pDest->m_pTextNode, "SwTextField: where is pDest's TextNode?" ); - IDocumentFieldsAccess* pIDFA = m_pTextNode->getIDocumentFieldsAccess(); - IDocumentFieldsAccess* pDestIDFA = pDest->m_pTextNode->getIDocumentFieldsAccess(); + IDocumentFieldsAccess* pIDFA = &m_pTextNode->getIDocumentFieldsAccess(); + IDocumentFieldsAccess* pDestIDFA = &pDest->m_pTextNode->getIDocumentFieldsAccess(); SwFormatField& rDestFormatField = (SwFormatField&)pDest->GetFormatField(); const sal_uInt16 nFieldWhich = rDestFormatField.GetField()->GetTyp()->Which(); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 4f458bde1653..a106cbdf1172 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -379,7 +379,7 @@ sal_uInt16 SwFntObj::GetFontLeading( const SwViewShell *pSh, const OutputDevice& nExtLeading = 0; } - const IDocumentSettingAccess& rIDSA = *pSh->getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDSA = pSh->getIDocumentSettingAccess(); const bool bBrowse = ( pSh->GetWin() && pSh->GetViewOptions()->getBrowseMode() && !pSh->GetViewOptions()->IsPrtFormat() ); diff --git a/sw/source/core/txtnode/swfntcch.cxx b/sw/source/core/txtnode/swfntcch.cxx index e867b1dcd7ac..a21ca2414b38 100644 --- a/sw/source/core/txtnode/swfntcch.cxx +++ b/sw/source/core/txtnode/swfntcch.cxx @@ -31,7 +31,7 @@ SwFontCache *pSwFontCache = NULL; SwFontObj::SwFontObj( const void *pOwn, SwViewShell *pSh ) : SwCacheObj( pOwn ), - aSwFont( &static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(), pSh ? pSh->getIDocumentSettingAccess() : 0 ) + aSwFont( &static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(), pSh ? &pSh->getIDocumentSettingAccess() : 0 ) { aSwFont.GoMagic( pSh, aSwFont.GetActual() ); const SwAttrSet& rAttrSet = static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(); diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index e6bc9af235e6..bd54dde1f043 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -216,7 +216,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } SwDoc *const pDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDoc) { throw lang::IllegalArgumentException(); diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index d1b01a48f8cd..251fa0a726ba 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -2107,14 +2107,14 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange) sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) ); if (pRange) - pDoc = pRange->GetDoc(); + pDoc = &pRange->GetDoc(); else if (!pDoc && pText) pDoc = pText->GetDoc(); else if (!pDoc && pCursor) pDoc = pCursor->GetDoc(); - else if ( !pDoc && pPortion && pPortion->GetCursor() ) + else if ( !pDoc && pPortion ) { - pDoc = pPortion->GetCursor()->GetDoc(); + pDoc = pPortion->GetCursor().GetDoc(); } else if ( !pDoc && pParagraph && pParagraph->GetTextNode( ) ) { diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index bf114b3c7875..507a6ce80509 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1343,7 +1343,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); } - SwDoc* pDoc = pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0; + SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0; // if a FieldMaster was attached, then the document is already fixed! // NOTE: sw.SwXAutoTextEntry unoapi test depends on m_pDoc = 0 being valid if (!pDoc || (m_pImpl->m_pDoc && m_pImpl->m_pDoc != pDoc)) diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 22fe58a24212..7922c37e8b9f 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -284,8 +284,8 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, c xPropSet->setPropertyValue( aAttributes[i].Name, aAttributes[i].Value ); } - IDocumentContentOperations* pIDCO = pOldTextNode->getIDocumentContentOperations(); - pIDCO->ReplaceRange( aPaM, aNewText, false ); + IDocumentContentOperations& rIDCO = pOldTextNode->getIDocumentContentOperations(); + rIDCO.ReplaceRange( aPaM, aNewText, false ); ClearTextNode(); // TODO: is this really needed? } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index c39ccd302c58..19c702f95ae7 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2707,7 +2707,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); } - SwDoc* pDoc = pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0; + SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0; if(pDoc) { SwUnoInternalPaM aIntPam(*pDoc); diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index 6ef75b28422f..004c30a0ff27 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -300,7 +300,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) OTextCursorHelper *const pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pNewDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pNewDoc) { throw lang::IllegalArgumentException(); @@ -431,8 +431,8 @@ SwXFootnote::createTextCursor() throw (uno::RuntimeException, std::exception) SwPosition aPos( *pTextFootnote->GetStartNode() ); SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE, aPos); - auto pUnoCrsr(pXCursor->GetCursor()); - pUnoCrsr->Move(fnMoveForward, fnGoNode); + auto& rUnoCrsr(pXCursor->GetCursor()); + rUnoCrsr.Move(fnMoveForward, fnGoNode); const uno::Reference< text::XTextCursor > xRet = static_cast<text::XWordCursor*>(pXCursor); return xRet; diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 2c96470f1389..b8f6d0aeb513 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -1345,7 +1345,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDoc) { throw lang::IllegalArgumentException(); @@ -1839,7 +1839,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) OTextCursorHelper *const pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDoc) { throw lang::IllegalArgumentException(); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index dc0c45c8171c..cd4cd0a16216 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -686,8 +686,8 @@ public: } }; -SwUnoCrsr*SwXTextCursor::GetCursor() - { return &(*m_pImpl->m_pUnoCursor); } +SwUnoCrsr& SwXTextCursor::GetCursor() + { return *m_pImpl->m_pUnoCursor; } SwPaM const* SwXTextCursor::GetPaM() const { return &(*m_pImpl->m_pUnoCursor); } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 0bab22047f18..e1bdf2e79c5f 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -481,7 +481,7 @@ struct SwXParagraphEnumerationImpl SAL_FINAL : public SwXParagraphEnumeration if ((CURSOR_SELECTION == m_eCursorType) || (CURSOR_SELECTION_IN_TABLE == m_eCursorType)) { - SwUnoCrsr & rCursor = *GetCursor(); + SwUnoCrsr & rCursor = GetCursor(); rCursor.Normalize(); m_nFirstParaStart = rCursor.GetPoint()->nContent.GetIndex(); m_nLastParaEnd = rCursor.GetMark()->nContent.GetIndex(); @@ -509,8 +509,8 @@ struct SwXParagraphEnumerationImpl SAL_FINAL : public SwXParagraphEnumeration virtual sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - SwUnoCrsr* GetCursor() - { return &(*m_pCrsr); } + SwUnoCrsr& GetCursor() + { return *m_pCrsr; } uno::Reference< text::XTextContent > NextElement_Impl() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); }; @@ -569,19 +569,15 @@ lcl_CursorIsInSection( uno::Reference< text::XTextContent > SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - SwUnoCrsr *const pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - { - throw uno::RuntimeException(); - } + SwUnoCrsr& rUnoCrsr = GetCursor(); // check for exceeding selections if (!m_bFirstParagraph && ((CURSOR_SELECTION == m_eCursorType) || (CURSOR_SELECTION_IN_TABLE == m_eCursorType))) { - SwPosition* pStart = pUnoCrsr->Start(); - auto aNewCrsr(pUnoCrsr->GetDoc()->CreateUnoCrsr(*pStart, false)); + SwPosition* pStart = rUnoCrsr.Start(); + auto aNewCrsr(rUnoCrsr.GetDoc()->CreateUnoCrsr(*pStart, false)); // one may also go into tables here if ((CURSOR_TBLTEXT != m_eCursorType) && (CURSOR_SELECTION_IN_TABLE != m_eCursorType)) @@ -611,15 +607,15 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE bool bInTable = false; if (!m_bFirstParagraph) { - pUnoCrsr->SetRemainInSection( false ); + rUnoCrsr.SetRemainInSection( false ); // what to do if already in a table? - SwTableNode * pTableNode = pUnoCrsr->GetNode().FindTableNode(); + SwTableNode * pTableNode = rUnoCrsr.GetNode().FindTableNode(); pTableNode = lcl_FindTopLevelTable( pTableNode, m_pOwnTable ); if (pTableNode && (&pTableNode->GetTable() != m_pOwnTable)) { // this is a foreign table: go to end - pUnoCrsr->GetPoint()->nNode = pTableNode->EndOfSectionIndex(); - if (!pUnoCrsr->Move(fnMoveForward, fnGoNode)) + rUnoCrsr.GetPoint()->nNode = pTableNode->EndOfSectionIndex(); + if (!rUnoCrsr.Move(fnMoveForward, fnGoNode)) { return 0; } @@ -630,19 +626,19 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE uno::Reference< text::XTextContent > xRef; // the cursor must remain in the current section or a subsection // before AND after the movement... - if (lcl_CursorIsInSection( pUnoCrsr, m_pOwnStartNode ) && + if (lcl_CursorIsInSection( &rUnoCrsr, m_pOwnStartNode ) && (m_bFirstParagraph || bInTable || - (pUnoCrsr->MovePara(fnParaNext, fnParaStart) && - lcl_CursorIsInSection( pUnoCrsr, m_pOwnStartNode )))) + (rUnoCrsr.MovePara(fnParaNext, fnParaStart) && + lcl_CursorIsInSection( &rUnoCrsr, m_pOwnStartNode )))) { - SwPosition* pStart = pUnoCrsr->Start(); + SwPosition* pStart = rUnoCrsr.Start(); const sal_Int32 nFirstContent = (m_bFirstParagraph) ? m_nFirstParaStart : -1; const sal_Int32 nLastContent = (m_nEndIndex == pStart->nNode.GetIndex()) ? m_nLastParaEnd : -1; // position in a table, or in a simple paragraph? - SwTableNode * pTableNode = pUnoCrsr->GetNode().FindTableNode(); + SwTableNode * pTableNode = rUnoCrsr.GetNode().FindTableNode(); pTableNode = lcl_FindTopLevelTable( pTableNode, m_pOwnTable ); if (/*CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType && */ pTableNode && (&pTableNode->GetTable() != m_pOwnTable)) @@ -655,7 +651,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE else { text::XText *const pText = m_xParentText.get(); - xRef = SwXParagraph::CreateXParagraph(*pUnoCrsr->GetDoc(), + xRef = SwXParagraph::CreateXParagraph(*rUnoCrsr.GetDoc(), pStart->nNode.GetNode().GetTextNode(), static_cast<SwXText*>(pText), nFirstContent, nLastContent); } @@ -781,14 +777,14 @@ SwXTextRange::~SwXTextRange() { } -const SwDoc * SwXTextRange::GetDoc() const +const SwDoc& SwXTextRange::GetDoc() const { - return & m_pImpl->m_rDoc; + return m_pImpl->m_rDoc; } -SwDoc * SwXTextRange::GetDoc() +SwDoc& SwXTextRange::GetDoc() { - return & m_pImpl->m_rDoc; + return m_pImpl->m_rDoc; } void SwXTextRange::Invalidate() @@ -815,7 +811,7 @@ throw (uno::RuntimeException) throw uno::RuntimeException(); } - const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent()); + const SwPosition aPos(GetDoc().GetNodes().GetEndOfContent()); SwCursor aCursor(aPos, 0, false); if (GetPositions(aCursor)) { @@ -976,7 +972,7 @@ OUString SAL_CALL SwXTextRange::getString() throw (uno::RuntimeException, std::e OUString sRet; // for tables there is no bookmark, thus also no text // one could export the table as ASCII here maybe? - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); if (GetPositions(aPaM) && aPaM.HasMark()) { SwUnoCursorHelper::GetTextFromPam(aPaM, sRet); @@ -1049,7 +1045,7 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill, pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xCrsrTunnel); } - if(pRange && pRange->GetDoc() == rToFill.GetDoc()) + if(pRange && &pRange->GetDoc() == rToFill.GetDoc()) { bRet = pRange->GetPositions(rToFill); } @@ -1062,9 +1058,9 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill, else { SwDoc* const pDoc = (pCursor) ? pCursor->GetDoc() - : ((pPortion) ? pPortion->GetCursor()->GetDoc() : 0); + : ((pPortion) ? pPortion->GetCursor().GetDoc() : 0); const SwPaM* const pUnoCrsr = (pCursor) ? pCursor->GetPaM() - : ((pPortion) ? pPortion->GetCursor() : 0); + : ((pPortion) ? &pPortion->GetCursor() : 0); if (pUnoCrsr && pDoc == rToFill.GetDoc()) { OSL_ENSURE(!pUnoCrsr->IsMultiSelection(), @@ -1252,11 +1248,11 @@ throw (uno::RuntimeException, std::exception) throw uno::RuntimeException(); } - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent()); + const SwPosition aPos(GetDoc().GetNodes().GetEndOfContent()); const auto pNewCrsr(m_pImpl->m_rDoc.CreateUnoCrsr(aPos, false)); if (!GetPositions(*pNewCrsr)) { @@ -1271,11 +1267,11 @@ SwXTextRange::createEnumeration() throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent()); + const SwPosition aPos(GetDoc().GetNodes().GetEndOfContent()); auto pNewCrsr(m_pImpl->m_rDoc.CreateUnoCrsr(aPos, false)); if (!GetPositions(*pNewCrsr)) { @@ -1329,11 +1325,11 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); SwUnoCursorHelper::SetPropertyValue(aPaM, m_pImpl->m_rPropSet, rPropertyName, rValue); @@ -1346,11 +1342,11 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); return SwUnoCursorHelper::GetPropertyValue(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1402,11 +1398,11 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); return SwUnoCursorHelper::GetPropertyState(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1418,11 +1414,11 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { SolarMutexGuard g; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); return SwUnoCursorHelper::GetPropertyStates(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1433,11 +1429,11 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); SwUnoCursorHelper::SetPropertyToDefault(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1450,11 +1446,11 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); return SwUnoCursorHelper::GetPropertyDefault(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1468,11 +1464,11 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); SwXTextRange::GetPositions(aPaM); SwUnoCursorHelper::makeRedline( aPaM, rRedlineType, rRedlineProperties ); } @@ -1622,8 +1618,8 @@ struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration SolarMutexGuard g; OWeakObject::release(); } - SwUnoCrsr* GetCursor() - { return &(*m_pUnoCursor); } + SwUnoCrsr& GetCursor() + { return *m_pUnoCursor; } void PurgeFrameClients() { if(!m_pUnoCursor) @@ -1658,8 +1654,8 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( { if (rPaM.HasMark()) { - GetCursor()->SetMark(); - *GetCursor()->GetMark() = *rPaM.GetMark(); + GetCursor().SetMark(); + *GetCursor().GetMark() = *rPaM.GetMark(); } if (PARAFRAME_PORTION_PARAGRAPH == eParaFrameMode) { @@ -1679,7 +1675,7 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( if (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode) { //get all frames that are bound at paragraph or at character - for(const auto& pFlyFrm : rPaM.GetDoc()->GetAllFlyFormats(GetCursor(), false, true)) + for(const auto& pFlyFrm : rPaM.GetDoc()->GetAllFlyFormats(&GetCursor(), false, true)) { const auto pFrameFormat = const_cast<SwFrameFormat*>(&pFlyFrm->GetFormat()); m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat))); @@ -1754,8 +1750,6 @@ sal_Bool SAL_CALL SwXParaFrameEnumerationImpl::hasMoreElements() throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetCursor()) - throw uno::RuntimeException(); PurgeFrameClients(); return m_xNextObject.is() || CreateNextObject(); } @@ -1765,8 +1759,6 @@ throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetCursor()) - throw uno::RuntimeException(); PurgeFrameClients(); if (!m_xNextObject.is() && !m_vFrames.empty()) CreateNextObject(); diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 06080e3d05fb..e4da5c4b07e4 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -150,11 +150,9 @@ throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; uno::Reference< text::XTextRange > xRet; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - SwPaM aPam(*pUnoCrsr->Start()); + SwPaM aPam(*rUnoCrsr.Start()); uno::Reference< text::XText > xParent = getText(); xRet = new SwXTextRange(aPam, xParent); return xRet; @@ -165,11 +163,9 @@ throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; uno::Reference< text::XTextRange > xRet; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - SwPaM aPam(*pUnoCrsr->End()); + SwPaM aPam(*rUnoCrsr.End()); uno::Reference< text::XText > xParent = getText(); xRet = new SwXTextRange(aPam, xParent); return xRet; @@ -180,17 +176,15 @@ throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; OUString aText; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); // TextPortions are always within a paragraph - SwTextNode* pTextNd = pUnoCrsr->GetNode().GetTextNode(); + SwTextNode* pTextNd = rUnoCrsr.GetNode().GetTextNode(); if ( pTextNd ) { - const sal_Int32 nStt = pUnoCrsr->Start()->nContent.GetIndex(); + const sal_Int32 nStt = rUnoCrsr.Start()->nContent.GetIndex(); aText = pTextNd->GetExpandText( nStt, - pUnoCrsr->End()->nContent.GetIndex() - nStt ); + rUnoCrsr.End()->nContent.GetIndex() - nStt ); } return aText; } @@ -198,11 +192,9 @@ throw( uno::RuntimeException, std::exception ) void SwXTextPortion::setString(const OUString& aString) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - SwUnoCursorHelper::SetString(*pUnoCrsr, aString); + SwUnoCursorHelper::SetString(rUnoCrsr, aString); } uno::Reference< beans::XPropertySetInfo > SwXTextPortion::getPropertySetInfo() @@ -228,11 +220,9 @@ void SwXTextPortion::setPropertyValue(const OUString& rPropertyName, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - SwUnoCursorHelper::SetPropertyValue(*pUnoCrsr, *m_pPropSet, + SwUnoCursorHelper::SetPropertyValue(rUnoCrsr, *m_pPropSet, rPropertyName, aValue); } @@ -403,9 +393,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl( const OUString *pPropertyNames = rPropertyNames.getConstArray(); uno::Sequence< uno::Any > aValues(rPropertyNames.getLength()); uno::Any *pValues = aValues.getArray(); - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); { SfxItemSet *pSet = 0; @@ -417,7 +405,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl( const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pPropertyNames[nProp]); if(pEntry) { - GetPropertyValue( pValues[nProp], *pEntry, pUnoCrsr, pSet ); + GetPropertyValue( pValues[nProp], *pEntry, &rUnoCrsr, pSet ); } else throw beans::UnknownPropertyException( "Unknown property: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); @@ -443,9 +431,7 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl( throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); { const OUString* pPropertyNames = rPropertyNames.getConstArray(); @@ -463,7 +449,7 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl( aValues[nProp].Name = pPropertyNames[nProp]; aValues[nProp].Value = pValues[nProp]; } - SwUnoCursorHelper::SetPropertyValues( *pUnoCrsr, *m_pPropSet, aValues ); + SwUnoCursorHelper::SetPropertyValues( rUnoCrsr, *m_pPropSet, aValues ); } } @@ -524,9 +510,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPr if (rPropertyNames.getLength() != rValues.getLength()) throw lang::IllegalArgumentException(); - SwUnoCrsr* pUnoCrsr = this->GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = this->GetCursor(); sal_Int32 nProps = rPropertyNames.getLength(); const OUString *pProp = rPropertyNames.getConstArray(); @@ -558,7 +542,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPr else { SwUnoCursorHelper::SetPropertyValue( - *pUnoCrsr, *m_pPropSet, pProp[i], pValue[i] ); + rUnoCrsr, *m_pPropSet, pProp[i], pValue[i] ); } } } @@ -620,9 +604,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = this->GetCursor(); - if(!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = this->GetCursor(); std::vector< beans::GetDirectPropertyTolerantResult > aResultVector; @@ -638,7 +620,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: uno::Sequence< beans::PropertyState > aPropertyStates = SwUnoCursorHelper::GetPropertyStates( - *pUnoCrsr, *m_pPropSet, + rUnoCrsr, *m_pPropSet, rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT ); const beans::PropertyState* pPropertyStates = aPropertyStates.getConstArray(); @@ -674,7 +656,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: { // get property value // (compare to SwXTextPortion::getPropertyValue(s)) - GetPropertyValue( aResult.Value, *pEntry, pUnoCrsr, pSet ); + GetPropertyValue( aResult.Value, *pEntry, &rUnoCrsr, pSet ); aResult.Result = beans::TolerantPropertySetResultType::SUCCESS; aResultVector.push_back( aResult ); } @@ -770,9 +752,7 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN { SolarMutexGuard aGuard; beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); if (GetTextPortionType() == PORTION_RUBY_START && rPropertyName.startsWith("Ruby")) @@ -781,7 +761,7 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN } else { - eRet = SwUnoCursorHelper::GetPropertyState(*pUnoCrsr, *m_pPropSet, + eRet = SwUnoCursorHelper::GetPropertyState(rUnoCrsr, *m_pPropSet, rPropertyName); } return eRet; @@ -792,12 +772,10 @@ uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates( throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if(!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); uno::Sequence< beans::PropertyState > aRet = - SwUnoCursorHelper::GetPropertyStates(*pUnoCrsr, *m_pPropSet, + SwUnoCursorHelper::GetPropertyStates(rUnoCrsr, *m_pPropSet, rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION); if(GetTextPortionType() == PORTION_RUBY_START) @@ -817,12 +795,10 @@ void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName) throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); SwUnoCursorHelper::SetPropertyToDefault( - *pUnoCrsr, *m_pPropSet, rPropertyName); + rUnoCrsr, *m_pPropSet, rPropertyName); } uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName) @@ -830,11 +806,9 @@ uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName) { SolarMutexGuard aGuard; uno::Any aRet; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - aRet = SwUnoCursorHelper::GetPropertyDefault(*pUnoCrsr, *m_pPropSet, + aRet = SwUnoCursorHelper::GetPropertyDefault(rUnoCrsr, *m_pPropSet, rPropertyName); return aRet; } @@ -843,11 +817,9 @@ uno::Reference< container::XEnumeration > SwXTextPortion::createContentEnumerat throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if(!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - return SwXParaFrameEnumeration::Create(*pUnoCrsr, PARAFRAME_PORTION_CHAR, m_pFrameFormat); + return SwXParaFrameEnumeration::Create(rUnoCrsr, PARAFRAME_PORTION_CHAR, m_pFrameFormat); } namespace @@ -896,11 +868,6 @@ sal_Bool SwXTextPortion::supportsService(const OUString& rServiceName) throw( un uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames() throw( uno::RuntimeException, std::exception ) { - SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); - uno::Sequence< OUString > aRet(7); OUString* pArray = aRet.getArray(); pArray[0] = "com.sun.star.text.TextPortion"; diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index c3cc87864e22..12f91b8a5c83 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -372,7 +372,7 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration( // find all frames, graphics and OLEs that are bound AT character in para FrameClientSortList_t frames; ::CollectFrameAtNode(m_pUnoCrsr->GetPoint()->nNode, frames, true); - lcl_CreatePortions(m_Portions, xParentText, GetCursor(), frames, nStart, nEnd); + lcl_CreatePortions(m_Portions, xParentText, &GetCursor(), frames, nStart, nEnd); } SwXTextPortionEnumeration::SwXTextPortionEnumeration( diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index 23954447767f..1443e42b1913 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -110,26 +110,26 @@ uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor() SwPosition aPos(aNodeIndex); SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this, CURSOR_REDLINE, aPos); - auto pUnoCursor(pXCursor->GetCursor()); - pUnoCursor->Move(fnMoveForward, fnGoNode); + auto& rUnoCursor(pXCursor->GetCursor()); + rUnoCursor.Move(fnMoveForward, fnGoNode); // #101929# prevent a newly created text cursor from running inside a table // because table cells have their own XText. // Patterned after SwXTextFrame::createTextCursor(). // skip all tables at the beginning - SwTableNode* pTableNode = pUnoCursor->GetNode().FindTableNode(); + SwTableNode* pTableNode = rUnoCursor.GetNode().FindTableNode(); SwContentNode* pContentNode = NULL; bool bTable = pTableNode != NULL; while( pTableNode != NULL ) { - pUnoCursor->GetPoint()->nNode = *(pTableNode->EndOfSectionNode()); - pContentNode = GetDoc()->GetNodes().GoNext(&pUnoCursor->GetPoint()->nNode); + rUnoCursor.GetPoint()->nNode = *(pTableNode->EndOfSectionNode()); + pContentNode = GetDoc()->GetNodes().GoNext(&rUnoCursor.GetPoint()->nNode); pTableNode = pContentNode->FindTableNode(); } if( pContentNode != NULL ) - pUnoCursor->GetPoint()->nContent.Assign( pContentNode, 0 ); - if( bTable && pUnoCursor->GetNode().FindSttNodeByType( SwNormalStartNode ) + rUnoCursor.GetPoint()->nContent.Assign( pContentNode, 0 ); + if( bTable && rUnoCursor.GetNode().FindSttNodeByType( SwNormalStartNode ) != GetStartNode() ) { // We have gone too far and have left our own redline. This means that @@ -239,8 +239,8 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName ) { if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) ) { - SwUnoCrsr* pUnoCrsr = GetCursor(); - uno::Reference<text::XText> xRet = new SwXRedlineText(pUnoCrsr->GetDoc(), *pNodeIdx); + SwUnoCrsr& rUnoCrsr = GetCursor(); + uno::Reference<text::XText> xRet = new SwXRedlineText(rUnoCrsr.GetDoc(), *pNodeIdx); aRet <<= xRet; } else { @@ -260,11 +260,9 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName ) void SwXRedlinePortion::Validate() throw( uno::RuntimeException ) { - SwUnoCrsr* pUnoCrsr = GetCursor(); - if(!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); //search for the redline - SwDoc* pDoc = pUnoCrsr->GetDoc(); + SwDoc* pDoc = rUnoCrsr.GetDoc(); const SwRedlineTable& rRedTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); bool bFound = false; for(size_t nRed = 0; nRed < rRedTable.size() && !bFound; nRed++) @@ -567,20 +565,20 @@ uno::Reference< text::XTextCursor > SwXRedline::createTextCursor() throw( uno:: SwPosition aPos(*pNodeIndex); SwXTextCursor *const pXCursor = new SwXTextCursor(*pDoc, this, CURSOR_REDLINE, aPos); - auto pUnoCrsr(pXCursor->GetCursor()); - pUnoCrsr->Move(fnMoveForward, fnGoNode); + auto& rUnoCrsr(pXCursor->GetCursor()); + rUnoCrsr.Move(fnMoveForward, fnGoNode); // is here a table? - SwTableNode* pTableNode = pUnoCrsr->GetNode().FindTableNode(); + SwTableNode* pTableNode = rUnoCrsr.GetNode().FindTableNode(); SwContentNode* pCont = 0; while( pTableNode ) { - pUnoCrsr->GetPoint()->nNode = *pTableNode->EndOfSectionNode(); - pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode); + rUnoCrsr.GetPoint()->nNode = *pTableNode->EndOfSectionNode(); + pCont = GetDoc()->GetNodes().GoNext(&rUnoCrsr.GetPoint()->nNode); pTableNode = pCont->FindTableNode(); } if(pCont) - pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0); + rUnoCrsr.GetPoint()->nContent.Assign(pCont, 0); xRet = static_cast<text::XWordCursor*>(pXCursor); } else diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index c0ce5748a7c5..4b8ba9656142 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -286,7 +286,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); } SwDoc *const pDocument = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDocument) { throw lang::IllegalArgumentException(); @@ -1013,7 +1013,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } SwDoc * const pDoc( - pRange ? pRange->GetDoc() : pCursor->GetDoc()); + pRange ? &pRange->GetDoc() : pCursor->GetDoc()); if (!pDoc) { throw lang::IllegalArgumentException( diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index a54e79415494..e1eaa861e2a4 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -285,7 +285,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) } SwDoc *const pDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDoc) { throw lang::IllegalArgumentException(); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 18fcc766114a..e55465aa1b4e 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -944,8 +944,8 @@ uno::Reference<text::XTextCursor> SwXCell::createTextCursor() throw( uno::Runtim SwPosition aPos(*pSttNd); SwXTextCursor* const pXCursor = new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT, aPos); - auto pUnoCrsr(pXCursor->GetCursor()); - pUnoCrsr->Move(fnMoveForward, fnGoNode); + auto& rUnoCrsr(pXCursor->GetCursor()); + rUnoCrsr.Move(fnMoveForward, fnGoNode); return static_cast<text::XWordCursor*>(pXCursor); } @@ -1427,12 +1427,12 @@ sal_Bool SwXTextTableCursor::supportsService(const OUString& rServiceName) throw { return cppu::supportsService(this, rServiceName); } IMPLEMENT_FORWARD_XINTERFACE2(SwXTextTableCursor,SwXTextTableCursor_Base,OTextCursorHelper) -const SwPaM* SwXTextTableCursor::GetPaM() const { return GetCrsr(); } -SwPaM* SwXTextTableCursor::GetPaM() { return GetCrsr(); } +const SwPaM* SwXTextTableCursor::GetPaM() const { return &GetCrsr(); } +SwPaM* SwXTextTableCursor::GetPaM() { return &GetCrsr(); } const SwDoc* SwXTextTableCursor::GetDoc() const { return GetFrameFormat()->GetDoc(); } SwDoc* SwXTextTableCursor::GetDoc() { return GetFrameFormat()->GetDoc(); } -const SwUnoCrsr* SwXTextTableCursor::GetCrsr() const { return &(*m_pUnoCrsr); } -SwUnoCrsr* SwXTextTableCursor::GetCrsr() { return &(*m_pUnoCrsr); } +const SwUnoCrsr& SwXTextTableCursor::GetCrsr() const { return *m_pUnoCrsr; } +SwUnoCrsr& SwXTextTableCursor::GetCrsr() { return *m_pUnoCrsr; } uno::Sequence<OUString> SwXTextTableCursor::getSupportedServiceNames() throw( uno::RuntimeException, std::exception ) { return {"com.sun.star.text.TextTableCursor"}; } @@ -1471,8 +1471,8 @@ OUString SwXTextTableCursor::getRangeName() throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(&rUnoCrsr); //!! see also SwChartDataSequence::getSourceRangeRepresentation if(!pTableCrsr) return OUString(); @@ -1499,10 +1499,8 @@ sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& sCellName, sal_Bool throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - auto& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + auto& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.GotoTableBox(sCellName); } @@ -1510,10 +1508,8 @@ sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& sCellName, sal_Bool sal_Bool SwXTextTableCursor::goLeft(sal_Int16 Count, sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.Left(Count, CRSR_SKIP_CHARS, false, false); } @@ -1521,10 +1517,8 @@ sal_Bool SwXTextTableCursor::goLeft(sal_Int16 Count, sal_Bool bExpand) throw( un sal_Bool SwXTextTableCursor::goRight(sal_Int16 Count, sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.Right(Count, CRSR_SKIP_CHARS, false, false); } @@ -1532,10 +1526,8 @@ sal_Bool SwXTextTableCursor::goRight(sal_Int16 Count, sal_Bool bExpand) throw( u sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.UpDown(true, Count, 0, 0); } @@ -1543,10 +1535,8 @@ sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool bExpand) throw( uno: sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.UpDown(false, Count, 0, 0); } @@ -1554,10 +1544,8 @@ sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool bExpand) throw( un void SwXTextTableCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); rTableCrsr.MoveTable(fnTableCurr, fnTableStart); } @@ -1565,10 +1553,8 @@ void SwXTextTableCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeExceptio void SwXTextTableCursor::gotoEnd(sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); rTableCrsr.MoveTable(fnTableCurr, fnTableEnd); } @@ -1577,11 +1563,9 @@ sal_Bool SwXTextTableCursor::mergeRange() throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; + SwUnoCrsr& rUnoCrsr = GetCrsr(); - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); { // HACK: remove pending actions for selecting old style tables UnoActionRemoveContext aRemoveContext(rTableCrsr); @@ -1589,7 +1573,7 @@ sal_Bool SwXTextTableCursor::mergeRange() rTableCrsr.MakeBoxSels(); bool bResult; { - UnoActionContext aContext(pUnoCrsr->GetDoc()); + UnoActionContext aContext(rUnoCrsr.GetDoc()); bResult = TBLMERGE_OK == rTableCrsr.GetDoc()->MergeTable(rTableCrsr); } if(bResult) @@ -1608,10 +1592,8 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) SolarMutexGuard aGuard; if (Count <= 0) throw uno::RuntimeException("Illegal first argument: needs to be > 0", static_cast<cppu::OWeakObject*>(this)); - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); { // HACK: remove pending actions for selecting old style tables UnoActionRemoveContext aRemoveContext(rTableCrsr); @@ -1619,7 +1601,7 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) rTableCrsr.MakeBoxSels(); bool bResult; { - UnoActionContext aContext(pUnoCrsr->GetDoc()); + UnoActionContext aContext(rUnoCrsr.GetDoc()); bResult = rTableCrsr.GetDoc()->SplitTable(rTableCrsr.GetSelectedBoxes(), !Horizontal, Count); } rTableCrsr.MakeBoxSels(); @@ -1641,30 +1623,28 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return; + SwUnoCrsr& rUnoCrsr = GetCrsr(); auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName)); if(!pEntry) throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this)); if(pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast<cppu::OWeakObject*>(this)); { - auto pSttNode = pUnoCrsr->GetNode().StartOfSectionNode(); + auto pSttNode = rUnoCrsr.GetNode().StartOfSectionNode(); const SwTableNode* pTableNode = pSttNode->FindTableNode(); lcl_FormatTable(pTableNode->GetTable().GetFrameFormat()); } - auto& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + auto& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); rTableCrsr.MakeBoxSels(); - SwDoc* pDoc = pUnoCrsr->GetDoc(); + SwDoc* pDoc = rUnoCrsr.GetDoc(); switch(pEntry->nWID) { case FN_UNO_TABLE_CELL_BACKGROUND: { SvxBrushItem aBrush(RES_BACKGROUND); - SwDoc::GetBoxAttr(*pUnoCrsr, aBrush); + SwDoc::GetBoxAttr(rUnoCrsr, aBrush); aBrush.PutValue(aValue, pEntry->nMemberId); - pDoc->SetBoxAttr(*pUnoCrsr, aBrush); + pDoc->SetBoxAttr(rUnoCrsr, aBrush); } break; @@ -1672,11 +1652,11 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u { SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT); aNumberFormat.PutValue(aValue, 0); - pDoc->SetBoxAttr(*pUnoCrsr, aNumberFormat); + pDoc->SetBoxAttr(rUnoCrsr, aNumberFormat); } break; case FN_UNO_PARA_STYLE: - SwUnoCursorHelper::SetTextFormatColl(aValue, *pUnoCrsr); + SwUnoCursorHelper::SetTextFormatColl(aValue, rUnoCrsr); break; default: { @@ -1702,15 +1682,13 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return uno::Any(); + SwUnoCrsr& rUnoCrsr = GetCrsr(); { - auto pSttNode = pUnoCrsr->GetNode().StartOfSectionNode(); + auto pSttNode = rUnoCrsr.GetNode().StartOfSectionNode(); const SwTableNode* pTableNode = pSttNode->FindTableNode(); lcl_FormatTable(pTableNode->GetTable().GetFrameFormat()); } - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName)); if(!pEntry) throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this)); @@ -1721,7 +1699,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) case FN_UNO_TABLE_CELL_BACKGROUND: { SvxBrushItem aBrush(RES_BACKGROUND); - if (SwDoc::GetBoxAttr(*pUnoCrsr, aBrush)) + if (SwDoc::GetBoxAttr(rUnoCrsr, aBrush)) aBrush.QueryValue(aResult, pEntry->nMemberId); } break; @@ -1731,7 +1709,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) break; case FN_UNO_PARA_STYLE: { - auto pFormat(SwUnoCursorHelper::GetCurTextFormatColl(*pUnoCrsr, false)); + auto pFormat(SwUnoCursorHelper::GetCurTextFormatColl(rUnoCrsr, false)); if(pFormat) aResult = uno::makeAny(pFormat->GetName()); } @@ -2090,7 +2068,7 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex pCursor = reinterpret_cast<OTextCursorHelper*>( sal::static_int_cast<sal_IntPtr>(xRangeTunnel->getSomething(OTextCursorHelper::getUnoTunnelId()))); } - SwDoc* pDoc = pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr; + SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr; if(!pDoc || !nRows || !nColumns) throw lang::IllegalArgumentException(); SwUnoInternalPaM aPam(*pDoc); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index f0126282daa1..a72c9f8a5f65 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -299,7 +299,7 @@ throw (uno::RuntimeException, std::exception) ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel); OTextCursorHelper *const pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); - if ((!pRange || pRange ->GetDoc() != GetDoc()) && + if ((!pRange || &pRange ->GetDoc() != GetDoc()) && (!pCursor || pCursor->GetDoc() != GetDoc())) { throw uno::RuntimeException(); @@ -1382,23 +1382,23 @@ SwXText::insertTextPortion( OUString sMessage; m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); - auto pCursor(pTextCursor->GetCursor()); - m_pImpl->m_pDoc->DontExpandFormat( *pCursor->Start() ); + auto& rCursor(pTextCursor->GetCursor()); + m_pImpl->m_pDoc->DontExpandFormat( *rCursor.Start() ); if (!rText.isEmpty()) { - const sal_Int32 nContentPos = pCursor->GetPoint()->nContent.GetIndex(); + const sal_Int32 nContentPos = rCursor.GetPoint()->nContent.GetIndex(); SwUnoCursorHelper::DocInsertStringSplitCR( - *m_pImpl->m_pDoc, *pCursor, rText, false); - SwUnoCursorHelper::SelectPam(*pCursor, true); - pCursor->GetPoint()->nContent = nContentPos; + *m_pImpl->m_pDoc, rCursor, rText, false); + SwUnoCursorHelper::SelectPam(rCursor, true); + rCursor.GetPoint()->nContent = nContentPos; } try { SfxItemPropertySet const*const pCursorPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR); - SwUnoCursorHelper::SetPropertyValues(*pCursor, *pCursorPropSet, + SwUnoCursorHelper::SetPropertyValues(rCursor, *pCursorPropSet, rCharacterAndParagraphProperties, SetAttrMode::NOFORMATATTR); } @@ -1429,7 +1429,7 @@ SwXText::insertTextPortion( throw aEx; } } - xRet = new SwXTextRange(*pCursor, this); + xRet = new SwXTextRange(rCursor, this); return xRet; } @@ -2745,28 +2745,28 @@ SwXHeadFootText::createTextCursor() throw (uno::RuntimeException, std::exception SwPosition aPos(rNode); SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this, (m_pImpl->m_bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER, aPos); - auto pUnoCrsr(pXCursor->GetCursor()); - pUnoCrsr->Move(fnMoveForward, fnGoNode); + auto& rUnoCrsr(pXCursor->GetCursor()); + rUnoCrsr.Move(fnMoveForward, fnGoNode); // save current start node to be able to check if there is content // after the table - otherwise the cursor would be in the body text! SwStartNode const*const pOwnStartNode = rNode.FindSttNodeByType( (m_pImpl->m_bIsHeader) ? SwHeaderStartNode : SwFooterStartNode); // is there a table here? - SwTableNode* pTableNode = pUnoCrsr->GetNode().FindTableNode(); + SwTableNode* pTableNode = rUnoCrsr.GetNode().FindTableNode(); SwContentNode* pCont = 0; while (pTableNode) { - pUnoCrsr->GetPoint()->nNode = *pTableNode->EndOfSectionNode(); - pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode); + rUnoCrsr.GetPoint()->nNode = *pTableNode->EndOfSectionNode(); + pCont = GetDoc()->GetNodes().GoNext(&rUnoCrsr.GetPoint()->nNode); pTableNode = pCont->FindTableNode(); } if (pCont) { - pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0); + rUnoCrsr.GetPoint()->nContent.Assign(pCont, 0); } SwStartNode const*const pNewStartNode = - pUnoCrsr->GetNode().FindSttNodeByType( + rUnoCrsr.GetNode().FindSttNodeByType( (m_pImpl->m_bIsHeader) ? SwHeaderStartNode : SwFooterStartNode); if (!pNewStartNode || (pNewStartNode != pOwnStartNode)) { diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index 0354e6ac199d..6c28f833d6bd 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -110,11 +110,9 @@ void SAL_CALL SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const OUSt if (pRange) { - SwDoc* pDoc = reinterpret_cast<SwDoc*>(pRange->GetDoc()); + SwDoc& rDoc = pRange->GetDoc(); - if (!pDoc) return; - - SwUnoInternalPaM aPam(*pDoc); + SwUnoInternalPaM aPam(rDoc); ::sw::XTextRangeToSwPaM(aPam, xRange); diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 5f13e3cee827..a24a5ed9c884 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -56,7 +56,7 @@ SwPagePreviewLayout::SwPagePreviewLayout( SwViewShell& _rParentViewShell, mbBookPreview = false; mbBookPreviewModeToggled = false; - mbPrintEmptyPages = mrParentViewShell.getIDocumentDeviceAccess()->getPrintData().IsPrintEmptyPages(); + mbPrintEmptyPages = mrParentViewShell.getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages(); } void SwPagePreviewLayout::_Clear() diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index 5c160b84caa4..611d6e29af2d 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -110,9 +110,9 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID, // set default horizontal text direction on painting <hell> or // <heaven>. EEHorizontalTextDirection aOldEEHoriTextDir = EE_HTEXTDIR_L2R; - const IDocumentDrawModelAccess* pIDDMA = GetShell()->getIDocumentDrawModelAccess(); - if ( (_nLayerID == pIDDMA->GetHellId()) || - (_nLayerID == pIDDMA->GetHeavenId()) ) + const IDocumentDrawModelAccess& rIDDMA = GetShell()->getIDocumentDrawModelAccess(); + if ( (_nLayerID == rIDDMA.GetHellId()) || + (_nLayerID == rIDDMA.GetHeavenId()) ) { OSL_ENSURE( _pPageBackgrdColor, "incorrect usage of SwViewShellImp::PaintLayer: pPageBackgrdColor have to be set for painting layer <hell> or <heaven>"); @@ -141,8 +141,8 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID, pOutDev->Pop(); // reset background color of the outliner & default horiz. text dir. - if ( (_nLayerID == pIDDMA->GetHellId()) || - (_nLayerID == pIDDMA->GetHeavenId()) ) + if ( (_nLayerID == rIDDMA.GetHellId()) || + (_nLayerID == rIDDMA.GetHeavenId()) ) { GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( aOldOutlinerBackgrdColor ); GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aOldEEHoriTextDir ); @@ -204,8 +204,8 @@ void SwViewShellImp::NotifySizeChg( const Size &rNewSz ) if ( !bCheckDrawObjs ) return; - OSL_ENSURE( pSh->getIDocumentDrawModelAccess()->GetDrawModel(), "NotifySizeChg without DrawModel" ); - SdrPage* pPage = pSh->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 ); + OSL_ENSURE( pSh->getIDocumentDrawModelAccess().GetDrawModel(), "NotifySizeChg without DrawModel" ); + SdrPage* pPage = pSh->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ); const size_t nObjs = pPage->GetObjCount(); for( size_t nObj = 0; nObj < nObjs; ++nObj ) { diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index b3957c4ccd2e..586db03542a2 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -48,9 +48,9 @@ void SwViewShellImp::Init( const SwViewOption *pNewOpt ) SwRootFrm *pRoot = pSh->GetLayout(); if ( !pSdrPageView ) { - IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); + IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); if ( !pRoot->GetDrawPage() ) - pRoot->SetDrawPage( pIDDMA->GetDrawModel()->GetPage( 0 ) ); + pRoot->SetDrawPage( rIDDMA.GetDrawModel()->GetPage( 0 ) ); if ( pRoot->GetDrawPage()->GetSize() != pRoot->Frm().SSize() ) pRoot->GetDrawPage()->SetSize( pRoot->Frm().SSize() ); @@ -58,7 +58,7 @@ void SwViewShellImp::Init( const SwViewOption *pNewOpt ) pSdrPageView = pDrawView->ShowSdrPage( pRoot->GetDrawPage()); // OD 26.06.2003 #108784# - notify drawing page view about invisible // layers. - pIDDMA->NotifyInvisibleLayers( *pSdrPageView ); + rIDDMA.NotifyInvisibleLayers( *pSdrPageView ); } pDrawView->SetDragStripes( pNewOpt->IsCrossHair() ); pDrawView->SetGridSnap( pNewOpt->IsSnap() ); @@ -208,13 +208,13 @@ void SwViewShellImp::SetFirstVisPage(OutputDevice* pRenderContext) void SwViewShellImp::MakeDrawView() { - IDocumentDrawModelAccess* pIDDMA = GetShell()->getIDocumentDrawModelAccess(); + IDocumentDrawModelAccess& rIDDMA = GetShell()->getIDocumentDrawModelAccess(); // the else here is not an error, _MakeDrawModel() calls this method again // after the DrawModel is created to create DrawViews for all shells... - if( !pIDDMA->GetDrawModel() ) + if( !rIDDMA.GetDrawModel() ) { - pIDDMA->_MakeDrawModel(); + rIDDMA._MakeDrawModel(); } else { @@ -233,7 +233,7 @@ void SwViewShellImp::MakeDrawView() pOutDevForDrawView = GetShell()->GetOut(); } - pDrawView = new SwDrawView( *this, pIDDMA->GetDrawModel(), pOutDevForDrawView); + pDrawView = new SwDrawView( *this, rIDDMA.GetDrawModel(), pOutDevForDrawView); } GetDrawView()->SetActiveLayer("Heaven"); @@ -295,12 +295,12 @@ void SwViewShellImp::InitPagePreviewLayout() void SwViewShellImp::UpdateAccessible() { // We require a layout and an XModel to be accessible. - IDocumentLayoutAccess* pIDLA = GetShell()->getIDocumentLayoutAccess(); + IDocumentLayoutAccess& rIDLA = GetShell()->getIDocumentLayoutAccess(); vcl::Window *pWin = GetShell()->GetWin(); OSL_ENSURE( GetShell()->GetLayout(), "no layout, no access" ); OSL_ENSURE( pWin, "no window, no access" ); - if( IsAccessible() && pIDLA->GetCurrentViewShell() && pWin ) + if( IsAccessible() && rIDLA.GetCurrentViewShell() && pWin ) GetAccessibleMap().GetDocumentView(); } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 9462b8f1fd51..b8ed7138e613 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -119,7 +119,7 @@ void SwViewShell::ToggleHeaderFooterEdit() void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) { - getIDocumentDrawModelAccess()->GetDrawModel()->registerLibreOfficeKitCallback(pCallback, pData); + getIDocumentDrawModelAccess().GetDrawModel()->registerLibreOfficeKitCallback(pCallback, pData); } void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const @@ -127,17 +127,17 @@ void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const if (mbInLibreOfficeKitCallback) return; - getIDocumentDrawModelAccess()->GetDrawModel()->libreOfficeKitCallback(nType, pPayload); + getIDocumentDrawModelAccess().GetDrawModel()->libreOfficeKitCallback(nType, pPayload); } void SwViewShell::setTiledRendering(bool bTiledRendering) { - getIDocumentDrawModelAccess()->GetDrawModel()->setTiledRendering(bTiledRendering); + getIDocumentDrawModelAccess().GetDrawModel()->setTiledRendering(bTiledRendering); } bool SwViewShell::isTiledRendering() const { - return getIDocumentDrawModelAccess()->GetDrawModel()->isTiledRendering(); + return getIDocumentDrawModelAccess().GetDrawModel()->isTiledRendering(); } void SwViewShell::setOutputToWindow(bool bOutputToWindow) @@ -736,11 +736,11 @@ static void lcl_InvalidateAllObjPos( SwViewShell &_rSh ) void SwViewShell::SetParaSpaceMax( bool bNew ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX) != bNew ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) != bNew ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::PARA_SPACE_MAX, bNew ); + rIDSA.set(DocumentSettingId::PARA_SPACE_MAX, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -748,11 +748,11 @@ void SwViewShell::SetParaSpaceMax( bool bNew ) void SwViewShell::SetParaSpaceMaxAtPages( bool bNew ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) != bNew ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) != bNew ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES, bNew ); + rIDSA.set(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -760,11 +760,11 @@ void SwViewShell::SetParaSpaceMaxAtPages( bool bNew ) void SwViewShell::SetTabCompat( bool bNew ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if( pIDSA->get(DocumentSettingId::TAB_COMPAT) != bNew ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if( rIDSA.get(DocumentSettingId::TAB_COMPAT) != bNew ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::TAB_COMPAT, bNew ); + rIDSA.set(DocumentSettingId::TAB_COMPAT, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -772,12 +772,12 @@ void SwViewShell::SetTabCompat( bool bNew ) void SwViewShell::SetAddExtLeading( bool bNew ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::ADD_EXT_LEADING) != bNew ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::ADD_EXT_LEADING) != bNew ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::ADD_EXT_LEADING, bNew ); - SwDrawModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel(); + rIDSA.set(DocumentSettingId::ADD_EXT_LEADING, bNew ); + SwDrawModel* pTmpDrawModel = getIDocumentDrawModelAccess().GetDrawModel(); if ( pTmpDrawModel ) pTmpDrawModel->SetAddExtLeading( bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; @@ -787,13 +787,13 @@ void SwViewShell::SetAddExtLeading( bool bNew ) void SwViewShell::SetUseVirDev( bool bNewVirtual ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::USE_VIRTUAL_DEVICE) != bNewVirtual ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::USE_VIRTUAL_DEVICE) != bNewVirtual ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); // this sets the flag at the document and calls PrtDataChanged - IDocumentDeviceAccess* pIDDA = getIDocumentDeviceAccess(); - pIDDA->setReferenceDeviceType( bNewVirtual, true ); + IDocumentDeviceAccess& rIDDA = getIDocumentDeviceAccess(); + rIDDA.setReferenceDeviceType( bNewVirtual, true ); } } @@ -803,11 +803,11 @@ void SwViewShell::SetUseVirDev( bool bNewVirtual ) */ void SwViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells ); + rIDSA.set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells ); const sal_uInt8 nInv = INV_PRTAREA; lcl_InvalidateAllContent( *this, nInv ); } @@ -820,11 +820,11 @@ void SwViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCel */ void SwViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::OLD_LINE_SPACING) != _bUseFormerLineSpacing ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::OLD_LINE_SPACING) != _bUseFormerLineSpacing ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::OLD_LINE_SPACING, _bUseFormerLineSpacing ); + rIDSA.set(DocumentSettingId::OLD_LINE_SPACING, _bUseFormerLineSpacing ); const sal_uInt8 nInv = INV_PRTAREA; lcl_InvalidateAllContent( *this, nInv ); } @@ -837,11 +837,11 @@ void SwViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing ) */ void SwViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::USE_FORMER_OBJECT_POS, _bUseFormerObjPos ); + rIDSA.set(DocumentSettingId::USE_FORMER_OBJECT_POS, _bUseFormerObjPos ); lcl_InvalidateAllObjPos( *this ); } } @@ -849,22 +849,22 @@ void SwViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos ) // #i28701# void SwViewShell::SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos ); + rIDSA.set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos ); lcl_InvalidateAllObjPos( *this ); } } void SwViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping ); + rIDSA.set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -873,11 +873,11 @@ void SwViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping ) // #i45491# void SwViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWithManualBreak ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak ); + rIDSA.set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -903,7 +903,7 @@ void SwViewShell::Reformat() void SwViewShell::ChgNumberDigits() { - SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel(); + SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess().GetDrawModel(); if ( pTmpDrawModel ) pTmpDrawModel->ReformatAllTextObjects(); Reformat(); @@ -2481,21 +2481,21 @@ SwPostItMgr* SwViewShell::GetPostItMgr() /* * Document Interface Access */ -const IDocumentSettingAccess* SwViewShell::getIDocumentSettingAccess() const { return &mpDoc->GetDocumentSettingManager(); } -IDocumentSettingAccess* SwViewShell::getIDocumentSettingAccess() { return &mpDoc->GetDocumentSettingManager(); } -const IDocumentDeviceAccess* SwViewShell::getIDocumentDeviceAccess() const { return &mpDoc->getIDocumentDeviceAccess(); } -IDocumentDeviceAccess* SwViewShell::getIDocumentDeviceAccess() { return &mpDoc->getIDocumentDeviceAccess(); } +const IDocumentSettingAccess& SwViewShell::getIDocumentSettingAccess() const { return mpDoc->GetDocumentSettingManager(); } +IDocumentSettingAccess& SwViewShell::getIDocumentSettingAccess() { return mpDoc->GetDocumentSettingManager(); } +const IDocumentDeviceAccess& SwViewShell::getIDocumentDeviceAccess() const { return mpDoc->getIDocumentDeviceAccess(); } +IDocumentDeviceAccess& SwViewShell::getIDocumentDeviceAccess() { return mpDoc->getIDocumentDeviceAccess(); } const IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() const { return mpDoc->getIDocumentMarkAccess(); } IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() { return mpDoc->getIDocumentMarkAccess(); } -const IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() const { return & mpDoc->getIDocumentDrawModelAccess(); } -IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() { return & mpDoc->getIDocumentDrawModelAccess(); } -const IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() const { return &mpDoc->getIDocumentRedlineAccess(); } -IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() { return &mpDoc->getIDocumentRedlineAccess(); } -const IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() const { return &mpDoc->getIDocumentLayoutAccess(); } -IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() { return &mpDoc->getIDocumentLayoutAccess(); } -IDocumentContentOperations* SwViewShell::getIDocumentContentOperations() { return &mpDoc->getIDocumentContentOperations(); } -IDocumentStylePoolAccess* SwViewShell::getIDocumentStylePoolAccess() { return &mpDoc->getIDocumentStylePoolAccess(); } -const IDocumentStatistics* SwViewShell::getIDocumentStatistics() const { return &mpDoc->getIDocumentStatistics(); } +const IDocumentDrawModelAccess& SwViewShell::getIDocumentDrawModelAccess() const { return mpDoc->getIDocumentDrawModelAccess(); } +IDocumentDrawModelAccess& SwViewShell::getIDocumentDrawModelAccess() { return mpDoc->getIDocumentDrawModelAccess(); } +const IDocumentRedlineAccess& SwViewShell::getIDocumentRedlineAccess() const { return mpDoc->getIDocumentRedlineAccess(); } +IDocumentRedlineAccess& SwViewShell::getIDocumentRedlineAccess() { return mpDoc->getIDocumentRedlineAccess(); } +const IDocumentLayoutAccess& SwViewShell::getIDocumentLayoutAccess() const { return mpDoc->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess& SwViewShell::getIDocumentLayoutAccess() { return mpDoc->getIDocumentLayoutAccess(); } +IDocumentContentOperations& SwViewShell::getIDocumentContentOperations() { return mpDoc->getIDocumentContentOperations(); } +IDocumentStylePoolAccess& SwViewShell::getIDocumentStylePoolAccess() { return mpDoc->getIDocumentStylePoolAccess(); } +const IDocumentStatistics& SwViewShell::getIDocumentStatistics() const { return mpDoc->getIDocumentStatistics(); } IDocumentUndoRedo & SwViewShell::GetIDocumentUndoRedo() { return mpDoc->GetIDocumentUndoRedo(); } diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 2e8ed74a01ec..4533b13212f4 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -216,7 +216,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow, // extend format cache. if ( SwTextFrm::GetTextCache()->GetCurMax() < 2550 ) SwTextFrm::GetTextCache()->IncreaseMax( 100 ); - if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess()->GetDrawModel() ) + if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess().GetDrawModel() ) Imp()->MakeDrawView(); // OD 2004-06-01 #i26791# @@ -288,7 +288,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow, // extend format cache. if ( SwTextFrm::GetTextCache()->GetCurMax() < 2550 ) SwTextFrm::GetTextCache()->IncreaseMax( 100 ); - if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess()->GetDrawModel() ) + if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess().GetDrawModel() ) Imp()->MakeDrawView(); // OD 2004-06-01 #i26791# |