diff options
author | Noel Grandin <noel@peralex.com> | 2015-07-03 11:31:14 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-07-06 07:04:50 +0000 |
commit | e9c3583c2cc27fc88ee81047c236ec99dd51e8de (patch) | |
tree | b3e8394ca1ec402a31b227339366fc790124c1f8 /sw/source | |
parent | 89c77994d4638c86635c70535fab6508e2f3d900 (diff) |
improve the returnbyref loplugin
Change-Id: I1b510a6194282dfa4a9001d473127c5ebc8b44eb
Reviewed-on: https://gerrit.libreoffice.org/16731
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source')
121 files changed, 689 insertions, 814 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# diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 574b4b234c05..3e289ca40587 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -563,7 +563,7 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, bool bUsed ) pFollow = pPageDesc->GetFollow(); } - IDocumentStylePoolAccess* pStylePoolAccess = getIDocumentStylePoolAccess(); + IDocumentStylePoolAccess* pStylePoolAccess = &getIDocumentStylePoolAccess(); if( pPageDesc == pFollow ) { // The document is one-sided; no matter what page, we do not create a 2-sided doc. @@ -596,7 +596,7 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, bool bUsed ) // The text body style has to be exported always (if it is changed compared // to the template), because it is used as reference for any style // that maps to <P>, and that's especially the standard style - getIDocumentStylePoolAccess()->GetTextCollFromPool( RES_POOLCOLL_TEXT, false ); + getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TEXT, false ); // the Default-TextStyle is not also exported !! // 0-Style is the Default; is never exported !! diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx index 8b4099003cf8..626d7328ac17 100644 --- a/sw/source/filter/html/svxcss1.hxx +++ b/sw/source/filter/html/svxcss1.hxx @@ -290,7 +290,7 @@ public: virtual const FontList *GetFontList() const; - const sal_uInt16 *GetWhichMap() const { return &aWhichMap[0]; } + const sal_uInt16 *GetWhichMap() const { return aWhichMap.data(); } static void InsertMapEntry( const OUString& rKey, const SfxItemSet& rItemSet, const SvxCSS1PropertyInfo& rProp, CSS1Map& rMap ); diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index c84dfabde3cf..0274d5b35959 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -135,10 +135,10 @@ Writer::~Writer() /* * Document Interface Access */ -IDocumentSettingAccess* Writer::getIDocumentSettingAccess() { return &pDoc->getIDocumentSettingAccess(); } -const IDocumentSettingAccess* Writer::getIDocumentSettingAccess() const { return &pDoc->getIDocumentSettingAccess(); } -IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() { return &pDoc->getIDocumentStylePoolAccess(); } -const IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() const { return &pDoc->getIDocumentStylePoolAccess(); } +IDocumentSettingAccess& Writer::getIDocumentSettingAccess() { return pDoc->getIDocumentSettingAccess(); } +const IDocumentSettingAccess& Writer::getIDocumentSettingAccess() const { return pDoc->getIDocumentSettingAccess(); } +IDocumentStylePoolAccess& Writer::getIDocumentStylePoolAccess() { return pDoc->getIDocumentStylePoolAccess(); } +const IDocumentStylePoolAccess& Writer::getIDocumentStylePoolAccess() const { return pDoc->getIDocumentStylePoolAccess(); } void Writer::ResetWriter() { diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index b7c610604d67..cfd231058376 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2903,7 +2903,7 @@ sal_Int32 SwEscherEx::WriteFlyFrm(const DrawObj &rObj, sal_uInt32 &rShapeId, //In browse mode the sdr object doesn't always exist. For example, the //object is in the hidden header/footer. We save the fmt directly //in such cases; we copy most of the logic from the block above - const bool bBrowseMode = (rFormat.getIDocumentSettingAccess())->get(DocumentSettingId::BROWSE_MODE); + const bool bBrowseMode = rFormat.getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE); if( bBrowseMode && rFormat.GetDoc()) { if( !rFormat.GetChain().GetPrev() )//obj in header/footer? diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index c95e1abbafa6..4d1d370228b5 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -633,9 +633,9 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) (rTypo.cchLeadingPunct+1)*2); } - const IDocumentSettingAccess* pIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess(); - rTypo.fKerningPunct = sal_uInt16(pIDocumentSettingAccess->get(DocumentSettingId::KERN_ASIAN_PUNCTUATION)); + rTypo.fKerningPunct = sal_uInt16(rIDocumentSettingAccess.get(DocumentSettingId::KERN_ASIAN_PUNCTUATION)); rTypo.iJustification = m_pDoc->getIDocumentSettingAccess().getCharacterCompressionType(); } diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index b864bf936379..15d522b8467d 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -66,7 +66,7 @@ static SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> & rRange ) ::sw::UnoTunnelGetImplementation<SwXTextRange>(xTunnel); // #i115174#: this may be a SvxUnoTextRange // OSL_ENSURE( pXRange, "SwXTextRange missing" ); - return (pXRange) ? pXRange->GetDoc() : 0; + return (pXRange) ? &pXRange->GetDoc() : 0; } // XTextRangeOrNodeIndexPosition: store a position into the text @@ -486,7 +486,7 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection( SwPosition aPos(*pRedlineNode); SwXTextCursor *const pXCursor = new SwXTextCursor(*pDoc, pXText, CURSOR_REDLINE, aPos); - pXCursor->GetCursor()->Move(fnMoveForward, fnGoNode); + pXCursor->GetCursor().Move(fnMoveForward, fnGoNode); // cast to avoid ambiguity xReturn = static_cast<text::XWordCursor*>(pXCursor); } diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index af971b8e412b..f1a9a2ce56d4 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -72,17 +72,17 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, while( nIndex < nCount ) { - SvXMLItemMapEntry* pEntry = mrMapEntries->getByIndex( nIndex ); + SvXMLItemMapEntry& rEntry = mrMapEntries->getByIndex( nIndex ); // we have a valid map entry here, so lets use it... - if( 0 == (pEntry->nMemberId & MID_SW_FLAG_NO_ITEM_EXPORT) ) + if( 0 == (rEntry.nMemberId & MID_SW_FLAG_NO_ITEM_EXPORT) ) { - const SfxPoolItem* pItem = GetItem( rSet, pEntry->nWhichId, + const SfxPoolItem* pItem = GetItem( rSet, rEntry.nWhichId, nFlags ); // do we have an item? if(pItem) { - if( 0 != (pEntry->nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT) ) + if( 0 != (rEntry.nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT) ) { // element items do not add any properties, // we export it later @@ -92,14 +92,14 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, } else { - exportXML( rExport, rAttrList, *pItem, *pEntry, rUnitConverter, + exportXML( rExport, rAttrList, *pItem, rEntry, rUnitConverter, rNamespaceMap, nFlags, &rSet ); } } } else { - handleNoItem( rAttrList, *pEntry, rUnitConverter, rNamespaceMap, + handleNoItem( rAttrList, rEntry, rUnitConverter, rNamespaceMap, rSet ); } nIndex++; @@ -228,16 +228,16 @@ void SvXMLExportItemMapper::exportElementItems( for( size_t nIndex = 0; nIndex < nCount; ++nIndex ) { const sal_uInt16 nElement = rIndexArray[ nIndex ]; - SvXMLItemMapEntry* pEntry = mrMapEntries->getByIndex( nElement ); - OSL_ENSURE( 0 != (pEntry->nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT), + SvXMLItemMapEntry& rEntry = mrMapEntries->getByIndex( nElement ); + OSL_ENSURE( 0 != (rEntry.nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT), "wrong mid flag!" ); - const SfxPoolItem* pItem = GetItem( rSet, pEntry->nWhichId, nFlags ); + const SfxPoolItem* pItem = GetItem( rSet, rEntry.nWhichId, nFlags ); // do we have an item? if(pItem) { rExport.IgnorableWhitespace(); - handleElementItem( rExport, *pEntry, *pItem, rUnitConverter, + handleElementItem( rExport, rEntry, *pItem, rUnitConverter, rSet, nFlags); bItemsExported = true; } diff --git a/sw/source/filter/xml/xmlitmap.hxx b/sw/source/filter/xml/xmlitmap.hxx index 75deb2c67b7c..d9738a83c7c3 100644 --- a/sw/source/filter/xml/xmlitmap.hxx +++ b/sw/source/filter/xml/xmlitmap.hxx @@ -67,7 +67,7 @@ public: SvXMLItemMapEntry* getByName( sal_uInt16 nNameSpace, const OUString& rString, SvXMLItemMapEntry* pStartAt = NULL ) const; - SvXMLItemMapEntry* getByIndex( sal_uInt16 nIndex ) const; + SvXMLItemMapEntry& getByIndex( sal_uInt16 nIndex ) const; sal_uInt16 getCount() const; }; diff --git a/sw/source/filter/xml/xmlitmpr.cxx b/sw/source/filter/xml/xmlitmpr.cxx index e19630af2c48..7a119e7d0885 100644 --- a/sw/source/filter/xml/xmlitmpr.cxx +++ b/sw/source/filter/xml/xmlitmpr.cxx @@ -67,9 +67,9 @@ SvXMLItemMapEntry* SvXMLItemMapEntries::getByName( sal_uInt16 nNameSpace, return (pMap && (pMap->eLocalName != XML_TOKEN_INVALID)) ? pMap : NULL; } -SvXMLItemMapEntry* SvXMLItemMapEntries::getByIndex( sal_uInt16 nIndex ) const +SvXMLItemMapEntry& SvXMLItemMapEntries::getByIndex( sal_uInt16 nIndex ) const { - return &mpImpl->mpEntries[nIndex]; + return mpImpl->mpEntries[nIndex]; } sal_uInt16 SvXMLItemMapEntries::getCount() const diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index d479d583b2fa..4a8998a10821 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -379,7 +379,7 @@ sal_uLong SwCompatibilityOptPage::GetDocumentOptions() const sal_uLong nRet = 0; if ( m_pWrtShell ) { - const IDocumentSettingAccess& rIDocumentSettingAccess = *m_pWrtShell->getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDocumentSettingAccess = m_pWrtShell->getIDocumentSettingAccess(); nRet = convertBools2Ulong_Impl( !rIDocumentSettingAccess.get(DocumentSettingId::USE_VIRTUAL_DEVICE), rIDocumentSettingAccess.get(DocumentSettingId::PARA_SPACE_MAX), diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index fc06390b5845..2ae97be648ed 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -742,7 +742,7 @@ bool SwStdFontTabPage::FillItemSet( SfxItemSet* ) if(pWrtShell) { pWrtShell->StartAllAction(); - SfxPrinter* pPrinter = pWrtShell->getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter* pPrinter = pWrtShell->getIDocumentDeviceAccess().getPrinter( false ); bool bMod = false; const sal_uInt16 nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >( nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONT : diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 7bbe913a0a28..d827c05e2879 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -366,7 +366,7 @@ void SwMailMergeOutputPage::ActivatePage() OSL_ENSURE(pTargetView, "no target view exists"); if(pTargetView) { - SfxPrinter* pPrinter = pTargetView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( true ); + SfxPrinter* pPrinter = pTargetView->GetWrtShell().getIDocumentDeviceAccess().getPrinter( true ); m_pPrinterLB->SelectEntry( pPrinter->GetName() ); m_pToNF->SetValue( rConfigItem.GetMergedDocumentCount() ); m_pToNF->SetMax( rConfigItem.GetMergedDocumentCount() ); @@ -826,7 +826,7 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) { SwView *const pTargetView = m_pWizard->GetConfigItem().GetTargetView(); SfxPrinter *const pDocumentPrinter = pTargetView->GetWrtShell() - .getIDocumentDeviceAccess()->getPrinter(true); + .getIDocumentDeviceAccess().getPrinter(true); if (pDocumentPrinter && pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) { const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), false ); @@ -897,7 +897,7 @@ IMPL_LINK_NOARG(SwMailMergeOutputPage, PrintHdl_Impl) if(m_pTempPrinter) { SfxPrinter *const pDocumentPrinter = pTargetView->GetWrtShell() - .getIDocumentDeviceAccess()->getPrinter(true); + .getIDocumentDeviceAccess().getPrinter(true); pDocumentPrinter->SetPrinterProps(m_pTempPrinter); // this should be able to handle setting its own printer pTargetView->SetPrinter(pDocumentPrinter); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 89d467374e04..10317ad739cd 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -76,17 +76,16 @@ using namespace ::com::sun::star::form; using namespace ::com::sun::star::view; using namespace ::com::sun::star::ui::dialogs; -struct SwMailMergeDlg_Impl -{ +struct SwMailMergeDlg_Impl { uno::Reference<runtime::XFormController> xFController; uno::Reference<XSelectionChangeListener> xChgLstnr; uno::Reference<XSelectionSupplier> xSelSupp; }; class SwXSelChgLstnr_Impl : public cppu::WeakImplHelper -< + < view::XSelectionChangeListener -> + > { SwMailMergeDlg& rParent; public: @@ -115,8 +114,7 @@ void SwXSelChgLstnr_Impl::selectionChanged( const EventObject& ) throw (Runtime rParent.m_pMarkedRB->Enable(bEnable); if(bEnable) rParent.m_pMarkedRB->Check(); - else if(rParent.m_pMarkedRB->IsChecked()) - { + else if(rParent.m_pMarkedRB->IsChecked()) { rParent.m_pAllRB->Check(); rParent.m_aSelection.realloc(0); } @@ -128,11 +126,11 @@ void SwXSelChgLstnr_Impl::disposing( const EventObject& ) throw (RuntimeExcepti } SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, - const OUString& rSourceName, - const OUString& rTableName, - sal_Int32 nCommandType, - const uno::Reference< XConnection>& _xConnection, - Sequence< Any >* pSelection) : + const OUString& rSourceName, + const OUString& rTableName, + sal_Int32 nCommandType, + const uno::Reference< XConnection>& _xConnection, + Sequence< Any >* pSelection) : SvxStandardDialog(pParent, "MailmergeDialog", "modules/swriter/ui/mailmerge.ui"), @@ -201,33 +199,25 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, aFilePos.X() -= (aFilePos.X() - aMailPos.X()) /2; m_pFileRB->SetPosPixel(aFilePos); uno::Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory(); - if(pSelection) - { + if(pSelection) { m_aSelection = *pSelection; m_pBeamerWin->Show(false); - } - else - { - try - { + } else { + try { // create a frame wrapper for myself m_xFrame = frame::Frame::create( comphelper::getProcessComponentContext() ); m_pUIBuilder->drop_ownership(m_pBeamerWin); m_xFrame->initialize( VCLUnoHelper::GetInterface ( m_pBeamerWin ) ); - } - catch (const Exception&) - { + } catch (const Exception&) { m_xFrame.clear(); } - if(m_xFrame.is()) - { + if(m_xFrame.is()) { URL aURL; aURL.Complete = ".component:DB/DataSourceBrowser"; uno::Reference<XDispatch> xD = m_xFrame->queryDispatch(aURL, - "", - 0x0C); - if(xD.is()) - { + "", + 0x0C); + if(xD.is()) { Sequence<PropertyValue> aProperties(3); PropertyValue* pProperties = aProperties.getArray(); pProperties[0].Name = "DataSourceName"; @@ -241,12 +231,10 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, } uno::Reference<XController> xController = m_xFrame->getController(); pImpl->xFController = uno::Reference<runtime::XFormController>(xController, UNO_QUERY); - if(pImpl->xFController.is()) - { + if(pImpl->xFController.is()) { uno::Reference< awt::XControl > xCtrl = pImpl->xFController->getCurrentControl( ); pImpl->xSelSupp = uno::Reference<XSelectionSupplier>(xCtrl, UNO_QUERY); - if(pImpl->xSelSupp.is()) - { + if(pImpl->xSelSupp.is()) { pImpl->xChgLstnr = new SwXSelChgLstnr_Impl(*this); pImpl->xSelSupp->addSelectionChangeListener( pImpl->xChgLstnr ); } @@ -308,8 +296,7 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, m_pAddressFieldLB->SelectEntry("EMAIL"); OUString sPath(pModOpt->GetMailingPath()); - if(sPath.isEmpty()) - { + if(sPath.isEmpty()) { SvtPathOptions aPathOpt; sPath = aPathOpt.GetWorkPath(); } @@ -319,11 +306,9 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, else m_pPathED->SetText(aURL.GetFull()); - if (!bColumn ) - { + if (!bColumn ) { m_pColumnLB->SelectEntry("NAME"); - } - else + } else m_pColumnLB->SelectEntry(pModOpt->GetNameFromColumn()); if (m_pAddressFieldLB->GetSelectEntryCount() == 0) @@ -335,27 +320,24 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, m_pMarkedRB->Enable(bEnable); if (bEnable) m_pMarkedRB->Check(); - else - { + else { m_pAllRB->Check(); m_pMarkedRB->Enable(false); } SetMinOutputSizePixel(m_aDialogSize); - try - { + try { uno::Reference< container::XNameContainer> xFilterFactory( - xMSF->createInstance("com.sun.star.document.FilterFactory"), UNO_QUERY_THROW); + xMSF->createInstance("com.sun.star.document.FilterFactory"), UNO_QUERY_THROW); uno::Reference< container::XContainerQuery > xQuery(xFilterFactory, UNO_QUERY_THROW); const OUString sCommand("matchByDocumentService=com.sun.star.text.TextDocument:iflags=" - + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::EXPORT)) - + ":eflags=" - + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::NOTINFILEDLG)) - + ":default_first"); + + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::EXPORT)) + + ":eflags=" + + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::NOTINFILEDLG)) + + ":default_first"); uno::Reference< container::XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand); const OUString sName("Name"); sal_Int32 nODT = -1; - while(xList->hasMoreElements()) - { + while(xList->hasMoreElements()) { comphelper::SequenceAsHashMap aFilter(xList->nextElement()); const OUString sFilter = aFilter.getUnpackedValueOrDefault(sName, OUString()); @@ -364,16 +346,13 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, aProps >>= aFilterProperties; OUString sUIName2; const beans::PropertyValue* pFilterProperties = aFilterProperties.getConstArray(); - for(sal_Int32 nProp = 0; nProp < aFilterProperties.getLength(); ++nProp) - { - if(pFilterProperties[nProp].Name == "UIName") - { + for(sal_Int32 nProp = 0; nProp < aFilterProperties.getLength(); ++nProp) { + if(pFilterProperties[nProp].Name == "UIName") { pFilterProperties[nProp].Value >>= sUIName2; break; } } - if( !sUIName2.isEmpty() ) - { + if( !sUIName2.isEmpty() ) { const sal_Int32 nFilter = m_pFilterLB->InsertEntry( sUIName2 ); if( sFilter == "writer8" ) nODT = nFilter; @@ -381,9 +360,7 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, } } m_pFilterLB->SelectEntryPos( nODT ); - } - catch (const uno::Exception&) - { + } catch (const uno::Exception&) { } } @@ -394,14 +371,12 @@ SwMailMergeDlg::~SwMailMergeDlg() void SwMailMergeDlg::dispose() { - if(m_xFrame.is()) - { + if(m_xFrame.is()) { m_xFrame->setComponent(NULL, NULL); m_xFrame->dispose(); } - for( sal_Int32 nFilter = 0; nFilter < m_pFilterLB->GetEntryCount(); ++nFilter ) - { + for( sal_Int32 nFilter = 0; nFilter < m_pFilterLB->GetEntryCount(); ++nFilter ) { OUString* pData = static_cast< OUString* >( m_pFilterLB->GetEntryData(nFilter) ); delete pData; } @@ -447,8 +422,7 @@ void SwMailMergeDlg::Apply() IMPL_LINK( SwMailMergeDlg, ButtonHdl, Button *, pBtn ) { - if (pBtn == m_pOkBTN) - { + if (pBtn == m_pOkBTN) { if( ExecQryShell() ) EndDialog(RET_OK); } @@ -464,12 +438,9 @@ IMPL_LINK( SwMailMergeDlg, OutputTypeHdl, RadioButton *, pBtn ) m_pSaveSingleDocRB->Enable( !bPrint ); m_pSaveIndividualRB->Enable( !bPrint ); - if( !bPrint ) - { + if( !bPrint ) { SaveTypeHdl( m_pSaveSingleDocRB->IsChecked() ? m_pSaveSingleDocRB : m_pSaveIndividualRB ); - } - else - { + } else { m_pPathFT->Enable(false); m_pPathED->Enable(false); m_pPathPB->Enable(false); @@ -488,12 +459,9 @@ IMPL_LINK( SwMailMergeDlg, SaveTypeHdl, RadioButton*, pBtn ) bool bIndividual = pBtn == m_pSaveIndividualRB; m_pGenerateFromDataBaseCB->Enable( bIndividual ); - if( bIndividual ) - { + if( bIndividual ) { FilenameHdl( m_pGenerateFromDataBaseCB ); - } - else - { + } else { m_pColumnFT->Enable(false); m_pColumnLB->Enable(false); m_pPathFT->Enable( false ); @@ -515,7 +483,7 @@ IMPL_LINK( SwMailMergeDlg, FilenameHdl, CheckBox*, pBox ) m_pPathPB->Enable( bEnable ); m_pFilterFT->Enable( bEnable ); m_pFilterLB->Enable( bEnable ); - return 0; + return 0; } IMPL_LINK_NOARG(SwMailMergeDlg, ModifyHdl) @@ -526,16 +494,14 @@ IMPL_LINK_NOARG(SwMailMergeDlg, ModifyHdl) bool SwMailMergeDlg::ExecQryShell() { - if(pImpl->xSelSupp.is()) - { + if(pImpl->xSelSupp.is()) { pImpl->xSelSupp->removeSelectionChangeListener( pImpl->xChgLstnr ); } SwDBManager* pMgr = rSh.GetDBManager(); if (m_pPrinterRB->IsChecked()) nMergeType = DBMGR_MERGE_PRINTER; - else - { + else { nMergeType = DBMGR_MERGE_FILE; SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); INetURLObject aAbs; @@ -551,15 +517,12 @@ bool SwMailMergeDlg::ExecQryShell() pModOpt->SetIsNameFromColumn(m_pGenerateFromDataBaseCB->IsChecked()); - if (m_pGenerateFromDataBaseCB->IsEnabled() && m_pGenerateFromDataBaseCB->IsChecked()) - { + if (m_pGenerateFromDataBaseCB->IsEnabled() && m_pGenerateFromDataBaseCB->IsChecked()) { pMgr->SetEMailColumn(m_pColumnLB->GetSelectEntry()); pModOpt->SetNameFromColumn(m_pColumnLB->GetSelectEntry()); if( m_pFilterLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) m_sSaveFilter = *static_cast<const OUString*>(m_pFilterLB->GetSelectEntryData()); - } - else - { + } else { //#i97667# reset column name - otherwise it's remembered from the last run pMgr->SetEMailColumn(OUString()); //start save as dialog @@ -573,8 +536,7 @@ bool SwMailMergeDlg::ExecQryShell() pMgr->SetSubject(sPath); } - if (m_pFromRB->IsChecked()) // Insert list - { + if (m_pFromRB->IsChecked()) { // Insert list // Safe: the maximal value of the fields is limited sal_Int32 nStart = sal::static_int_cast<sal_Int32>(m_pFromNF->GetValue()); sal_Int32 nEnd = sal::static_int_cast<sal_Int32>(m_pToNF->GetValue()); @@ -586,33 +548,28 @@ bool SwMailMergeDlg::ExecQryShell() Any* pSelection = m_aSelection.getArray(); for (sal_Int32 i = nStart; i <= nEnd; ++i, ++pSelection) *pSelection <<= i; - } - else if (m_pAllRB->IsChecked() ) + } else if (m_pAllRB->IsChecked() ) m_aSelection.realloc(0); // Empty selection = insert all - else - { - if(pImpl->xSelSupp.is()) - { + else { + if(pImpl->xSelSupp.is()) { //update selection uno::Reference< XRowLocate > xRowLocate(GetResultSet(),UNO_QUERY); uno::Reference< XResultSet > xRes(xRowLocate,UNO_QUERY); pImpl->xSelSupp->getSelection() >>= m_aSelection; - if ( xRowLocate.is() ) - { + if ( xRowLocate.is() ) { Any* pBegin = m_aSelection.getArray(); Any* pEnd = pBegin + m_aSelection.getLength(); - for (;pBegin != pEnd ; ++pBegin) - { + for (; pBegin != pEnd ; ++pBegin) { if ( xRowLocate->moveToBookmark(*pBegin) ) *pBegin <<= xRes->getRow(); } } } } - IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess(); - SwPrintData aPrtData( pIDDA->getPrintData() ); + IDocumentDeviceAccess& rIDDA = rSh.getIDocumentDeviceAccess(); + SwPrintData aPrtData( rIDDA.getPrintData() ); aPrtData.SetPrintSingleJobs(m_pSingleJobsCB->IsChecked()); - pIDDA->setPrintData(aPrtData); + rIDDA.setPrintData(aPrtData); pModOpt->SetSinglePrintJob(m_pSingleJobsCB->IsChecked()); @@ -631,8 +588,7 @@ bool SwMailMergeDlg::ExecQryShell() IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl) { OUString sPath( m_pPathED->GetText() ); - if( sPath.isEmpty() ) - { + if( sPath.isEmpty() ) { SvtPathOptions aPathOpt; sPath = aPathOpt.GetWorkPath(); } @@ -640,8 +596,7 @@ IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl) uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < XFolderPicker2 > xFP = FolderPicker::create(xContext); xFP->setDisplayDirectory(sPath); - if( xFP->execute() == RET_OK ) - { + if( xFP->execute() == RET_OK ) { INetURLObject aURL(xFP->getDirectory()); if(aURL.GetProtocol() == INetProtocol::File) m_pPathED->SetText(aURL.PathToFileName()); @@ -654,8 +609,7 @@ IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl) uno::Reference<XResultSet> SwMailMergeDlg::GetResultSet() const { uno::Reference< XResultSet > xResSetClone; - if ( pImpl->xFController.is() ) - { + if ( pImpl->xFController.is() ) { // we create a clone to do the task uno::Reference< XResultSetAccess > xResultSetAccess( pImpl->xFController->getModel(),UNO_QUERY); if ( xResultSetAccess.is() ) @@ -666,7 +620,7 @@ uno::Reference<XResultSet> SwMailMergeDlg::GetResultSet() const SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(vcl::Window* pParent) : ModalDialog(pParent, "MailMergeDialog", - "modules/swriter/ui/mailmergedialog.ui") + "modules/swriter/ui/mailmergedialog.ui") { get(m_pThisDocRB, "document"); } @@ -684,7 +638,7 @@ void SwMailMergeCreateFromDlg::dispose() SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(vcl::Window* pParent) : ModalDialog(pParent, "MergeConnectDialog", - "modules/swriter/ui/mergeconnectdialog.ui") + "modules/swriter/ui/mergeconnectdialog.ui") { get(m_pUseExistingRB, "existing"); } diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index 7523cac8d503..7af4e717e339 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -99,9 +99,9 @@ SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw) ::FillCharStyleListBox(*m_pCharStyleLB, pSh->GetView().GetDocShell()); const SwLineNumberInfo &rInf = pSh->GetLineNumberInfo(); - IDocumentStylePoolAccess* pIDSPA = pSh->getIDocumentStylePoolAccess(); + IDocumentStylePoolAccess& rIDSPA = pSh->getIDocumentStylePoolAccess(); - OUString sStyleName(rInf.GetCharFormat( *pIDSPA )->GetName()); + OUString sStyleName(rInf.GetCharFormat( rIDSPA )->GetName()); const sal_Int32 nPos = m_pCharStyleLB->GetEntryPos(sStyleName); if (nPos != LISTBOX_ENTRY_NOTFOUND) diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx index 1820d88a46e0..f4fcb423ff86 100644 --- a/sw/source/uibase/app/appenv.cxx +++ b/sw/source/uibase/app/appenv.cxx @@ -186,7 +186,7 @@ void SwModule::InsertEnv( SfxRequest& rReq ) SfxItemSet aSet(GetPool(), FN_ENVELOP, FN_ENVELOP, 0); aSet.Put(aEnvCfg.GetItem()); - SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess().getPrinter( true ); if(pOldSh ) { const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc()); @@ -194,13 +194,13 @@ void SwModule::InsertEnv( SfxRequest& rReq ) SwStyleNameMapper::FillUIName( RES_POOLPAGE_JAKET, sJacket ); bEnvChange = rCurPageDesc.GetName() == sJacket; - IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess(); - if( pIDDA_old->getPrinter( false ) ) + IDocumentDeviceAccess& rIDDA_old = pOldSh->getIDocumentDeviceAccess(); + if( rIDDA_old.getPrinter( false ) ) { - IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); - pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); + IDocumentDeviceAccess& rIDDA = pSh->getIDocumentDeviceAccess(); + rIDDA.setJobsetup( *rIDDA_old.getJobsetup() ); //#69563# if it isn't the same printer then the pointer has been invalidated! - pTempPrinter = pIDDA->getPrinter( true ); + pTempPrinter = rIDDA.getPrinter( true ); } pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); @@ -244,7 +244,7 @@ void SwModule::InsertEnv( SfxRequest& rReq ) { OSL_ENSURE(pOldSh, "No document - wasn't 'Insert' disabled???"); SvxPaperBinItem aItem( RES_PAPER_BIN ); - aItem.SetValue((sal_uInt8)pSh->getIDocumentDeviceAccess()->getPrinter(true)->GetPaperBin()); + aItem.SetValue((sal_uInt8)pSh->getIDocumentDeviceAccess().getPrinter(true)->GetPaperBin()); pOldSh->GetPageDescFromPool(RES_POOLPAGE_JAKET)->GetMaster().SetFormatAttr(aItem); } @@ -338,7 +338,7 @@ void SwModule::InsertEnv( SfxRequest& rReq ) SwPageDesc* pDesc = pSh->GetPageDescFromPool(RES_POOLPAGE_JAKET); SwFrameFormat& rFormat = pDesc->GetMaster(); - Printer *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + Printer *pPrt = pSh->getIDocumentDeviceAccess().getPrinter( true ); // Borders (are put together by Shift-Offset and alignment) Size aPaperSize = pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index 4858f898f19b..f7778b3fb6f4 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -198,7 +198,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) if (pPrt) { SwDocShell *pDocSh = static_cast<SwDocShell*>(&*xDocSh); - pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup()); + pDocSh->getIDocumentDeviceAccess().setJobsetup(pPrt->GetJobSetup()); } SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq ); @@ -272,7 +272,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) const SwPageDesc &rFollow = pSh->GetPageDesc( pSh->GetCurPageDesc() ); aDesc.SetFollow( &rFollow ); - pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + pPrt = pSh->getIDocumentDeviceAccess().getPrinter( true ); SvxPaperBinItem aItem( RES_PAPER_BIN ); aItem.SetValue((sal_Int8)pPrt->GetPaperBin()); rFormat.SetFormatAttr(aItem); diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 00b93f30e036..d0453e4f80ee 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -131,7 +131,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) { SwWrtShell& rWrtShell = pAppView->GetWrtShell(); - SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess().getPrinter( false ); if( pPrt ) pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt)); pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell)); @@ -218,7 +218,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) // Options for PrintTabPage const SwPrintData* pOpt = pAppView ? - &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() : + &pAppView->GetWrtShell().getIDocumentDeviceAccess().getPrintData() : 0; if(!pOpt) @@ -383,7 +383,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) *pOpt = *pAddPrinterAttr; if(pAppView) - pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt ); + pAppView->GetWrtShell().getIDocumentDeviceAccess().setPrintData( *pOpt ); } } diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 32cc3039accd..2530fa2608e6 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -1270,7 +1270,7 @@ bool SwDocShell::HasChangeRecordProtection() const { if (!m_pWrtShell) return false; - return m_pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength() > 0; + return m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().getLength() > 0; } void SwDocShell::SetChangeRecording( bool bActivate ) @@ -1286,8 +1286,8 @@ bool SwDocShell::SetProtectionPassword( const OUString &rNewPassword ) const SfxItemSet* pArgs = &aSet; const SfxPoolItem* pItem = NULL; - IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); - Sequence< sal_Int8 > aPasswd = pIDRA->GetRedlinePassword(); + IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); + Sequence< sal_Int8 > aPasswd = rIDRA.GetRedlinePassword(); if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem ) && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswd.getLength() > 0)) return false; @@ -1301,12 +1301,12 @@ bool SwDocShell::SetProtectionPassword( const OUString &rNewPassword ) Sequence< sal_Int8 > aNewPasswd; SvPasswordHelper::GetHashPassword( aNewPasswd, rNewPassword ); - pIDRA->SetRedlinePassword( aNewPasswd ); + rIDRA.SetRedlinePassword( aNewPasswd ); bRes = true; } else { - pIDRA->SetRedlinePassword( Sequence< sal_Int8 >() ); + rIDRA.SetRedlinePassword( Sequence< sal_Int8 >() ); bRes = true; } @@ -1321,8 +1321,8 @@ bool SwDocShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal const SfxItemSet* pArgs = &aSet; const SfxPoolItem* pItem = NULL; - IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); - Sequence< sal_Int8 > aPasswdHash( pIDRA->GetRedlinePassword() ); + IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); + Sequence< sal_Int8 > aPasswdHash( rIDRA.GetRedlinePassword() ); if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem ) && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswdHash.getLength() != 0)) return false; diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index a774e66b11e5..73ef5c352318 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -691,8 +691,8 @@ void SwDocShell::SubInitNew() /* * Document Interface Access */ -IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return &m_pDoc->getIDocumentDeviceAccess(); } -const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return &m_pDoc->getIDocumentSettingAccess(); } -IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return &m_pDoc->getIDocumentChartDataProviderAccess(); } +IDocumentDeviceAccess& SwDocShell::getIDocumentDeviceAccess() { return m_pDoc->getIDocumentDeviceAccess(); } +const IDocumentSettingAccess& SwDocShell::getIDocumentSettingAccess() const { return m_pDoc->getIDocumentSettingAccess(); } +IDocumentChartDataProviderAccess& SwDocShell::getIDocumentChartDataProviderAccess() { return m_pDoc->getIDocumentChartDataProviderAccess(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 3c76f2564644..a81e1f5e006c 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -782,8 +782,8 @@ sal_uInt16 SwDocShell::Edit( // get one here. SwWrtShell* pCurrShell = (pActShell) ? pActShell : m_pWrtShell; if( ( HTMLMODE_ON & nHtmlMode ) && - !pCurrShell->getIDocumentDeviceAccess()->getPrinter( false ) ) - pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess()->getPrinter( true ) ); + !pCurrShell->getIDocumentDeviceAccess().getPrinter( false ) ) + pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess().getPrinter( true ) ); PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode)); FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode)); diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 84f6fddc86bb..e29cb22166c7 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -780,7 +780,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh) aTmpOutliner.SetSpeller( xSpell ); OutlinerView* pOutlView = new OutlinerView( &aTmpOutliner, &(rView.GetEditWin()) ); - pOutlView->GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess()->getPrinter( false ) ); + pOutlView->GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess().getPrinter( false ) ); aTmpOutliner.InsertView( pOutlView ); Point aPt; Size aSize(1,1); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 44185b4884fb..c6b6b817cd84 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -527,7 +527,7 @@ bool SwPostItMgr::CalcRects() mPages[aPageNum-1]->eSidebarPosition = pItem->maLayoutInfo.meSidebarPosition; } - if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE)) + if (!bChange && mpWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE)) { long nLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() ); if( nLayoutHeight > mbLayoutHeight ) @@ -622,7 +622,7 @@ void SwPostItMgr::LayoutPostIts() mlPageBorder = mpEditWin->LogicToPixel( Point( mPages[n]->mPageRect.Left(), 0)).X() - GetSidebarWidth(true);// - GetSidebarBorderWidth(true); //bending point mlPageEnd = - mpWrtShell->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) + mpWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) ? pItem->maLayoutInfo.mPagePrtArea.Left() : mPages[n]->mPageRect.Left() + 350; } @@ -632,7 +632,7 @@ void SwPostItMgr::LayoutPostIts() mlPageBorder = mpEditWin->LogicToPixel( Point(mPages[n]->mPageRect.Right(), 0)).X() + GetSidebarBorderWidth(true); //bending point mlPageEnd = - mpWrtShell->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) + mpWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) ? pItem->maLayoutInfo.mPagePrtArea.Right() : mPages[n]->mPageRect.Right() - 350; } @@ -1631,7 +1631,7 @@ void SwPostItMgr::PrepareView(bool bIgnoreCount) SwRootFrm* pLayout = mpWrtShell->GetLayout(); if ( pLayout ) SwPostItHelper::setSidebarChanged( pLayout, - mpWrtShell->getIDocumentSettingAccess()->get( DocumentSettingId::BROWSE_MODE ) ); + mpWrtShell->getIDocumentSettingAccess().get( DocumentSettingId::BROWSE_MODE ) ); mpWrtShell->EndAllAction(); } } diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 8bf1c98a1dc7..e10179963aac 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -545,14 +545,14 @@ void SwSidebarWin::SetPosAndSize() { case sw::sidebarwindows::SidebarPosition::LEFT: { - aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); - aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); + aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); + aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); } break; case sw::sidebarwindows::SidebarPosition::RIGHT: { - aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); - aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); + aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); + aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); } break; default: @@ -609,8 +609,8 @@ void SwSidebarWin::SetPosAndSize() if (bChange) { - Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())); - Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); + Point aStart = EditWin().PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())); + Point aEnd = EditWin().PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y())); } @@ -818,8 +818,8 @@ void SwSidebarWin::SetSizePixel( const Size& rNewSize ) if (mpShadow) { - Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())); - Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); + Point aStart = EditWin().PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())); + Point aEnd = EditWin().PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y())); } } @@ -1096,9 +1096,9 @@ void SwSidebarWin::ExecuteCommand(sal_uInt16 nSlot) } } -SwEditWin* SwSidebarWin::EditWin() +SwEditWin& SwSidebarWin::EditWin() { - return &mrView.GetEditWin(); + return mrView.GetEditWin(); } long SwSidebarWin::GetPostItTextHeight() diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index 4f06e6fd2e10..c527e1244eea 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -188,8 +188,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) // special handling if target is a cross-reference bookmark { OUString sTmpSearchStr = sText.copy( 1 ); - IDocumentMarkAccess* const pMarkAccess = - rSh.getIDocumentMarkAccess(); + IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess(); IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark( sTmpSearchStr ); if ( ppBkmk != pMarkAccess->getBookmarksEnd() && diff --git a/sw/source/uibase/lingu/sdrhhcwrap.cxx b/sw/source/uibase/lingu/sdrhhcwrap.cxx index 5d8e364e5918..956e7a576180 100644 --- a/sw/source/uibase/lingu/sdrhhcwrap.cxx +++ b/sw/source/uibase/lingu/sdrhhcwrap.cxx @@ -74,7 +74,7 @@ SdrHHCWrapper::SdrHHCWrapper( SwView* pVw, SetPaperSize( aSize ); pOutlView = new OutlinerView( this, &(pView->GetEditWin()) ); - pOutlView->GetOutliner()->SetRefDevice(pView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( false )); + pOutlView->GetOutliner()->SetRefDevice(pView->GetWrtShell().getIDocumentDeviceAccess().getPrinter( false )); // Hack: all SdrTextObj attributes should be transferred to EditEngine pOutlView->SetBackgroundColor( Color( COL_WHITE ) ); diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 39ac83783291..dd2f23f46ae3 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -295,7 +295,7 @@ void SwRedlineAcceptDlg::InitAuthors() if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && !aStrings.empty()) pFilterPage->SelectAuthor(aStrings[0]); - bool bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength(); + bool bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength(); bool bSel = pTable->FirstSelected() != 0; SvTreeListEntry* pSelEntry = pTable->FirstSelected(); @@ -1014,7 +1014,7 @@ IMPL_LINK_NOARG_TYPED(SwRedlineAcceptDlg, GotoHdl, Timer *, void) pSh->EndAction(); SwViewShell::SetCareWin(NULL); } - bool bEnable = !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength(); + bool bEnable = !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength(); pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ ); pTPView->EnableReject( bEnable && bSel && bIsNotFormated /*&& !bReadonlySel*/ ); pTPView->EnableRejectAll( bEnable && !bOnlyFormatedRedlines && !bHasReadonlySel ); diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index 2eed3b425667..7415b8b17aa2 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -448,9 +448,9 @@ IMPL_LINK( SwInputWindow, SelTableCellsNotify, SwWrtShell *, pCaller ) aPam.SetMark(); aPam.Move( fnMoveForward, fnGoSection ); - IDocumentContentOperations* pIDCO = pWrtShell->getIDocumentContentOperations(); - pIDCO->DeleteRange( aPam ); - pIDCO->InsertString( aPam, sNew ); + IDocumentContentOperations& rIDCO = pWrtShell->getIDocumentContentOperations(); + rIDCO.DeleteRange( aPam ); + rIDCO.InsertString( aPam, sNew ); pWrtShell->EndAllAction(); sOldFormula = sNew; } diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 4e8637e7b889..ce7a272302c7 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -606,7 +606,7 @@ IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNam else { nRet = 1; - SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess().GetDrawModel(); SdrObjListIter aIter( *(pModel->GetPage(0)), IM_DEEPWITHGROUPS ); while( aIter.IsMore() ) { diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 9bab3ad99e38..cde79a064a83 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -439,7 +439,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) + GetShell().GetBoxNms(); // get table data provider - xDataProvider.set( GetView().GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider() ); + xDataProvider.set( GetView().GetDocShell()->getIDocumentChartDataProviderAccess().GetChartDataProvider() ); } else bFillWithData = false; // will create chart with only it's default image diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index a210d2613909..8dcff4199011 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -938,7 +938,7 @@ void SwTextShell::Execute(SfxRequest &rReq) // Left border as offset //#i24363# tab stops relative to indent - const long nOff = rWrtSh.getIDocumentSettingAccess()->get(DocumentSettingId::TABS_RELATIVE_TO_INDENT) ? + const long nOff = rWrtSh.getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT) ? static_cast<const SvxLRSpaceItem&>(aCoreSet.Get( RES_LR_SPACE )).GetTextLeft() : 0; SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff ); aCoreSet.Put( aOff ); diff --git a/sw/source/uibase/table/chartins.cxx b/sw/source/uibase/table/chartins.cxx index 6da2f8455932..1515a85c53ab 100644 --- a/sw/source/uibase/table/chartins.cxx +++ b/sw/source/uibase/table/chartins.cxx @@ -158,7 +158,7 @@ void SwInsertChart(vcl::Window* pParent, SfxBindings* pBindings ) aRangeString = pTableFormat->GetName() + "." + rWrtShell.GetBoxNms(); // get table data provider - xDataProvider.set( pView->GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider( true ) ); + xDataProvider.set( pView->GetDocShell()->getIDocumentChartDataProviderAccess().GetChartDataProvider( true ) ); } } diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 5d1ad3befe8d..1b8993604bfc 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -1647,25 +1647,25 @@ void SwPagePreview::ScrollDocSzChg() // All about printing SfxPrinter* SwPagePreview::GetPrinter( bool bCreate ) { - return pViewWin->GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate ); + return pViewWin->GetViewShell()->getIDocumentDeviceAccess().getPrinter( bCreate ); } sal_uInt16 SwPagePreview::SetPrinter( SfxPrinter *pNew, SfxPrinterChangeFlags nDiffFlags, bool ) { SwViewShell &rSh = *GetViewShell(); - SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter* pOld = rSh.getIDocumentDeviceAccess().getPrinter( false ); if ( pOld && pOld->IsPrinting() ) return SFX_PRINTERROR_BUSY; SwEditShell &rESh = static_cast<SwEditShell&>(rSh); //Buh... if( ( SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP ) & nDiffFlags ) { - rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true ); + rSh.getIDocumentDeviceAccess().setPrinter( pNew, true, true ); if( nDiffFlags & SfxPrinterChangeFlags::PRINTER ) rESh.SetModified(); } if ( ( nDiffFlags & SfxPrinterChangeFlags::OPTIONS ) == SfxPrinterChangeFlags::OPTIONS ) - ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, false ); + ::SetPrinter( &rSh.getIDocumentDeviceAccess(), pNew, false ); const bool bChgOri = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_ORIENTATION); const bool bChgSize = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_SIZE); diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index db8aeba32fd3..69df7cbb1934 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -672,7 +672,7 @@ sal_uInt16 SwSrcView::SetPrinter(SfxPrinter* pNew, SfxPrinterChangeFlags nDiffFl pDocSh->SetModified(); } if ( nDiffFlags & SfxPrinterChangeFlags::OPTIONS ) - ::SetPrinter( pDocSh->getIDocumentDeviceAccess(), pNew, true ); + ::SetPrinter( &pDocSh->getIDocumentDeviceAccess(), pNew, true ); const bool bChgOri = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_ORIENTATION); const bool bChgSize = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_SIZE); diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index bd38b880477c..edd0b4211c93 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -243,7 +243,6 @@ void SwView::StateViewOptions(SfxItemSet &rSet) sal_uInt16 nWhich = aIter.FirstWhich(); SfxBoolItem aBool; const SwViewOption* pOpt = GetWrtShell().GetViewOptions(); - const IDocumentSettingAccess* pIDSA = GetDocShell()->getIDocumentSettingAccess(); while(nWhich) { @@ -327,7 +326,7 @@ void SwView::StateViewOptions(SfxItemSet &rSet) aBool.SetValue( pOpt->IsOnlineSpell() ); break; case FN_SHADOWCURSOR: - if (pIDSA == 0 || pOpt->getBrowseMode() ) + if ( pOpt->getBrowseMode() ) { rSet.DisableItem( nWhich ); nWhich = 0; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 498a2627b1e4..a65b79af64ff 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -532,7 +532,7 @@ void SwView::Execute(SfxRequest &rReq) switch( nSlot ) { case SID_CREATE_SW_DRAWVIEW: - m_pWrtShell->getIDocumentDrawModelAccess()->GetOrCreateDrawModel(); + m_pWrtShell->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); break; case FN_LINE_NUMBERING_DLG: @@ -573,8 +573,8 @@ void SwView::Execute(SfxRequest &rReq) if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem )) { - IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); - Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword(); + IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); + Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword(); if( aPasswd.getLength() ) { OSL_ENSURE( !static_cast<const SfxBoolItem*>(pItem)->GetValue(), "SwView::Execute(): password set an redlining off doesn't match!" ); @@ -590,10 +590,10 @@ void SwView::Execute(SfxRequest &rReq) //#i69751# the result of Execute() can be ignored (void)aPasswdDlg->Execute(); OUString sNewPasswd( aPasswdDlg->GetPassword() ); - Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword(); + Sequence <sal_Int8> aNewPasswd = rIDRA.GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) - pIDRA->SetRedlinePassword(Sequence <sal_Int8> ()); + rIDRA.SetRedlinePassword(Sequence <sal_Int8> ()); else { // xmlsec05: message box for wrong password break; @@ -609,8 +609,8 @@ void SwView::Execute(SfxRequest &rReq) break; case FN_REDLINE_PROTECT : { - IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); - Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword(); + IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); + Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword(); if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ) && static_cast<const SfxBoolItem*>(pItem)->GetValue() == ( aPasswd.getLength() != 0 ) ) break; @@ -632,18 +632,18 @@ void SwView::Execute(SfxRequest &rReq) sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON; OUString sNewPasswd( aPasswdDlg->GetPassword() ); Sequence <sal_Int8> aNewPasswd = - pIDRA->GetRedlinePassword(); + rIDRA.GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if(!aPasswd.getLength()) { - pIDRA->SetRedlinePassword(aNewPasswd); + rIDRA.SetRedlinePassword(aNewPasswd); } else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) { - pIDRA->SetRedlinePassword(Sequence <sal_Int8> ()); + rIDRA.SetRedlinePassword(Sequence <sal_Int8> ()); nOn = 0; } - const sal_uInt16 nMode = pIDRA->GetRedlineMode(); + const sal_uInt16 nMode = rIDRA.GetRedlineMode(); m_pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, ((nMode&nsRedlineMode_t::REDLINE_ON)==0) ) ); } @@ -1438,7 +1438,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM ); aZoomSliderItem.AddSnappingPoint( 100 ); - if ( !m_pWrtShell->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) ) + if ( !m_pWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) ) { const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns(); const bool bAutomaticViewLayout = 0 == nColumns; @@ -1761,7 +1761,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) case SID_ATTR_VIEWLAYOUT: { - if ( pArgs && !rSh.getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) && + if ( pArgs && !rSh.getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) && ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) { if ( SfxItemState::SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, true, &pItem )) diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 7540776fb21c..b81cf88835d9 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -522,7 +522,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin, uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::GetSpellChecker() ); if (pOutliner) { - pOutliner->SetRefDevice(pSh->getIDocumentDeviceAccess()->getReferenceDevice(false)); + pOutliner->SetRefDevice(pSh->getIDocumentDeviceAccess().getReferenceDevice(false)); pOutliner->SetSpeller(xSpell); uno::Reference<linguistic2::XHyphenator> xHyphenator( ::GetHyphenator() ); pOutliner->SetHyphenator( xHyphenator ); diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index 281567a2fa5d..64c371ec705b 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -71,9 +71,9 @@ using namespace ::com::sun::star; SfxPrinter* SwView::GetPrinter( bool bCreate ) { - const IDocumentDeviceAccess* pIDDA = GetWrtShell().getIDocumentDeviceAccess(); - SfxPrinter *pOld = pIDDA->getPrinter( false ); - SfxPrinter *pPrt = pIDDA->getPrinter( bCreate ); + const IDocumentDeviceAccess& rIDDA = GetWrtShell().getIDocumentDeviceAccess(); + SfxPrinter *pOld = rIDDA.getPrinter( false ); + SfxPrinter *pPrt = rIDDA.getPrinter( bCreate ); if ( pOld != pPrt ) { bool bWeb = 0 != dynamic_cast<SwWebView*>(this); @@ -107,19 +107,19 @@ void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter* pNew, bool bWeb ) sal_uInt16 SwView::SetPrinter(SfxPrinter* pNew, SfxPrinterChangeFlags nDiffFlags, bool ) { SwWrtShell &rSh = GetWrtShell(); - SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter* pOld = rSh.getIDocumentDeviceAccess().getPrinter( false ); if ( pOld && pOld->IsPrinting() ) return SFX_PRINTERROR_BUSY; if ( (SfxPrinterChangeFlags::JOBSETUP | SfxPrinterChangeFlags::PRINTER) & nDiffFlags ) { - rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true ); + rSh.getIDocumentDeviceAccess().setPrinter( pNew, true, true ); if ( nDiffFlags & SfxPrinterChangeFlags::PRINTER ) rSh.SetModified(); } bool bWeb = this->ISA(SwWebView); if ( nDiffFlags & SfxPrinterChangeFlags::OPTIONS ) - ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, bWeb ); + ::SetPrinter( &rSh.getIDocumentDeviceAccess(), pNew, bWeb ); const bool bChgOri = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_ORIENTATION); const bool bChgSize = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_SIZE); @@ -273,10 +273,10 @@ VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, void SetAppPrintOptions( SwViewShell* pSh, bool bWeb ) { - const IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); - SwPrintData aPrtData = pIDDA->getPrintData(); + const IDocumentDeviceAccess& rIDDA = pSh->getIDocumentDeviceAccess(); + SwPrintData aPrtData = rIDDA.getPrintData(); - if( pIDDA->getPrinter( false ) ) + if( rIDDA.getPrinter( false ) ) { // Close application own printing options in SfxPrinter. SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData); @@ -299,7 +299,7 @@ void SetAppPrintOptions( SwViewShell* pSh, bool bWeb ) static_cast<int>(aMisc.IsPaperSizeWarning() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE) | static_cast<int>(aMisc.IsPaperOrientationWarning() ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE ))); - pIDDA->getPrinter( true )->SetOptions( aSet ); + rIDDA.getPrinter( true )->SetOptions( aSet ); } } diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 1315f6867c94..cfc2f0210a40 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -391,7 +391,7 @@ void SwView::GetState(SfxItemSet &rSet) case SID_DOCUMENT_COMPARE: case SID_DOCUMENT_MERGE: if( GetDocShell()->IsA( SwGlobalDocShell::StaticType() ) || - (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength())) + (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().getLength())) rSet.DisableItem(nWhich); break; case SID_VIEW_DATA_SOURCE_BROWSER: diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 5245344ddb3f..23c9b59ab92b 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1022,7 +1022,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) m_pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle); //#i24363# tab stops relative to indent - bool bRelative = rSh.getIDocumentSettingAccess()->get(DocumentSettingId::TABS_RELATIVE_TO_INDENT); + bool bRelative = rSh.getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT); m_pHRuler->SetTabsRelativeToIndent( bRelative ); m_pVRuler->SetTabsRelativeToIndent( bRelative ); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 26e29830af18..15d6f2619509 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -312,7 +312,7 @@ static bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTe bool bRet = false; pInsDoc->getIDocumentFieldsAccess().LockExpFields(); { - SwDoc *const pDoc((pxCursor) ? pxCursor->GetDoc() : pxRange->GetDoc()); + SwDoc *const pDoc((pxCursor) ? pxCursor->GetDoc() : &pxRange->GetDoc()); SwPaM aPam(pDoc->GetNodes()); SwPaM * pPam(0); if(pxCursor) @@ -923,7 +923,7 @@ void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextR SwDoc* pDoc = 0; if (pRange) - pDoc = pRange->GetDoc(); + pDoc = &pRange->GetDoc(); else if ( pCursor ) pDoc = pCursor->GetDoc(); else if ( pText && pText->GetDoc() ) diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index b2a954f82488..f5cc22988cf9 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -684,10 +684,10 @@ uno::Any SAL_CALL SwXMailMerge::execute( { case MailMergeType::PRINTER: { - IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess(); - SwPrintData aPrtData( pIDDA->getPrintData() ); + IDocumentDeviceAccess& rIDDA = rSh.getIDocumentDeviceAccess(); + SwPrintData aPrtData( rIDDA.getPrintData() ); aPrtData.SetPrintSingleJobs( bCurSinglePrintJobs ); - pIDDA->setPrintData( aPrtData ); + rIDDA.setPrintData( aPrtData ); // #i25686# printing should not be done asynchronously to prevent dangling offices // when mail merge is called as command line macro aMergeDesc.bPrintAsync = false; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index fa53d49e8622..9a31a3b017da 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -721,9 +721,9 @@ SwUnoCrsr* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & xCr SwXTextCursor *const pXTextCursor = pBText->CreateTextCursor(true); xCrsr.set( static_cast<text::XWordCursor*>(pXTextCursor) ); - auto pUnoCrsr(pXTextCursor->GetCursor()); - pUnoCrsr->SetRemainInSection(false); - return pUnoCrsr; + auto& rUnoCrsr(pXTextCursor->GetCursor()); + rUnoCrsr.SetRemainInSection(false); + return &rUnoCrsr; } sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > & xDesc) @@ -1688,7 +1688,7 @@ css::uno::Reference<css::uno::XInterface> SwXTextDocument::create( { return Reference<XInterface>( dynamic_cast<chart2::data::XDataProvider *>( - pDocShell->getIDocumentChartDataProviderAccess()-> + pDocShell->getIDocumentChartDataProviderAccess(). GetChartDataProvider())); } if (!rServiceName.startsWith("com.sun.star.") diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 631e6efe23a0..684c95ea9b90 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -642,7 +642,7 @@ void SAL_CALL SwXTextView::setRubyList( SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc() { SwWrtShell& rOldSh = m_pView->GetWrtShell(); - SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess().getPrinter( false ); SwDocShell* pDocSh; SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SfxObjectCreateMode::STANDARD ) ); xDocSh->DoInitNew( 0 ); @@ -655,18 +655,18 @@ SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc() pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//So that SelectShell is called. SwWrtShell* pSh = pDocView->GetWrtShellPtr(); - IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); - SfxPrinter* pTempPrinter = pIDDA->getPrinter( true ); + IDocumentDeviceAccess& rIDDA = pSh->getIDocumentDeviceAccess(); + SfxPrinter* pTempPrinter = rIDDA.getPrinter( true ); const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc()); - IDocumentDeviceAccess* pIDDA_old = rOldSh.getIDocumentDeviceAccess(); + IDocumentDeviceAccess& rIDDA_old = rOldSh.getIDocumentDeviceAccess(); - if( pIDDA_old->getPrinter( false ) ) + if( rIDDA_old.getPrinter( false ) ) { - pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); + rIDDA.setJobsetup( *rIDDA_old.getJobsetup() ); //#69563# if it isn't the same printer then the pointer has been invalidated! - pTempPrinter = pIDDA->getPrinter( true ); + pTempPrinter = rIDDA.getPrinter( true ); } pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); @@ -1107,7 +1107,7 @@ void SwXTextViewCursor::gotoRange( } else if (pRange) { - SwPaM aPam(pRange->GetDoc()->GetNodes()); + SwPaM aPam(pRange->GetDoc().GetNodes()); if (pRange->GetPositions(aPam)) { pSrcNode = &aPam.GetNode(); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index b81bc63c777f..388b8101bd35 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -427,7 +427,7 @@ void SwContentType::Init(bool* pbInvalidateWindow) { sTypeToken.clear(); nMemberCount = 0; - SwDrawModel* pModel = pWrtShell->getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* pModel = pWrtShell->getIDocumentDrawModelAccess().GetDrawModel(); if(pModel) { SdrPage* pPage = pModel->GetPage(0); @@ -736,8 +736,8 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) else if(!pMember->empty()) pMember->DeleteAndDestroyAll(); - IDocumentDrawModelAccess* pIDDMA = pWrtShell->getIDocumentDrawModelAccess(); - SwDrawModel* pModel = pIDDMA->GetDrawModel(); + IDocumentDrawModelAccess& rIDDMA = pWrtShell->getIDocumentDrawModelAccess(); + SwDrawModel* pModel = rIDDMA.GetDrawModel(); if(pModel) { SdrPage* pPage = pModel->GetPage(0); @@ -757,7 +757,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) this, pTemp->GetName(), nYPos); - if(!pIDDMA->IsVisibleLayerId(pTemp->GetLayer())) + if(!rIDDMA.IsVisibleLayerId(pTemp->GetLayer())) pCnt->SetInvisible(); pMember->insert(pCnt); nMemberCount++; @@ -3367,7 +3367,7 @@ void SwContentTree::GotoContent(SwContent* pCnt) { pDrawView->SdrEndTextEdit(); pDrawView->UnmarkAll(); - SwDrawModel* _pModel = pActiveShell->getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* _pModel = pActiveShell->getIDocumentDrawModelAccess().GetDrawModel(); SdrPage* pPage = _pModel->GetPage(0); const size_t nCount = pPage->GetObjCount(); for( size_t i=0; i<nCount; ++i ) @@ -3460,8 +3460,8 @@ void SwContentTree::InitEntry(SvTreeListEntry* pEntry, { const size_t nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nColToHilite )); - SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, pCol->GetText() ); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite )); + SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, rCol.GetText() ); pEntry->ReplaceItem( pStr, nColToHilite ); } diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 42131fa4279d..8b2c4d39ec99 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -1232,8 +1232,8 @@ void SwGlobalTree::InitEntry(SvTreeListEntry* pEntry, { const size_t nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nColToHilite )); - SwLBoxString* pStr = new SwLBoxString( pEntry, 0, pCol->GetText() ); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite )); + SwLBoxString* pStr = new SwLBoxString( pEntry, 0, rCol.GetText() ); pEntry->ReplaceItem( pStr, nColToHilite ); } |