diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-21 14:00:43 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-21 14:03:43 +0100 |
commit | 4698eeea354b51d7efd6bb229898e86b3e3c0596 (patch) | |
tree | 6b4d5a6c0706e417013524e8d078d2142ffb7a78 | |
parent | ce67bc61da9e12987d57f764bc7c8376eea48bbe (diff) |
SwSection::GetFmt const-correctness
...otherwise, wouldn't make sense to have non-const/const overloads anyway.
Needs to introduce one const_cast into doctxm.cxx (which already contains quite
a handful), otherwise the required changes would turn into too much of an
avalanche.
Change-Id: I694c7a1df7089d83ee95d35ed09bb864e9703f7c
-rw-r--r-- | sw/inc/doc.hxx | 4 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 2 | ||||
-rw-r--r-- | sw/inc/fesh.hxx | 2 | ||||
-rw-r--r-- | sw/inc/section.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/docnode/section.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/edit/edsect.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/unoidx.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 18 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewtab.cxx | 4 |
13 files changed, 39 insertions, 39 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 6efdfd49fe7d..f2fe7abbf447 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -991,14 +991,14 @@ public: SwTOXSearch eDir, bool bInReadOnly ); // Insert/Renew table/indes - const SwTOXBaseSection* InsertTableOf( const SwPosition& rPos, + SwTOXBaseSection* InsertTableOf( const SwPosition& rPos, const SwTOXBase& rTOX, const SfxItemSet* pSet = 0, bool bExpand = false ); const SwTOXBaseSection* InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd, const SwTOXBase& rTOX, const SfxItemSet* pSet = 0 ); - const SwTOXBase* GetCurTOX( const SwPosition& rPos ) const; + SwTOXBase* GetCurTOX( const SwPosition& rPos ); const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX) const; bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes = false ); diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 60d1fe22f597..34c44092b7f0 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -818,7 +818,7 @@ public: a footnote the reference of which is in a columned range. If bOutOfTab is set, the range comprising the table is searched and not an inner one. */ - const SwSection* GetAnySection( bool bOutOfTab = false, const Point* pPt = 0 ) const; + SwSection* GetAnySection( bool bOutOfTab = false, const Point* pPt = 0 ); sal_uInt16 GetSectionFmtCount() const; sal_uInt16 GetSectionFmtPos( const SwSectionFmt& ) const; diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 49b591b9f289..70bbe3f0e3bc 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -726,7 +726,7 @@ public: bool IsLastCellInRow() const; /// Width of current range for column-dialog. - long GetSectionWidth( SwFmt& rFmt ) const; + long GetSectionWidth( SwFmt const & rFmt ) const; void GetConnectableFrmFmts (SwFrmFmt & rFmt, const OUString & rReference, bool bSuccessors, diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index 418319a68c09..9774dee72c30 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -175,7 +175,7 @@ public: void SetType(SectionType const eType) { return m_Data.SetType(eType); } SwSectionFmt* GetFmt() { return (SwSectionFmt*)GetRegisteredIn(); } - SwSectionFmt* GetFmt() const { return (SwSectionFmt*)GetRegisteredIn(); } + SwSectionFmt const * GetFmt() const { return (SwSectionFmt const *)GetRegisteredIn(); } // Set hidden/protected -> update the whole tree! // (Attributes/flags are set/get.) @@ -348,7 +348,7 @@ public: inline SwSection* SwSection::GetParent() const { - SwSectionFmt* pFmt = GetFmt(); + SwSectionFmt const * pFmt = GetFmt(); SwSection* pRet = 0; if( pFmt ) pRet = pFmt->GetParentSection(); diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 078c49976289..46ff6070ba7b 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -326,7 +326,7 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, return *pNew; } -const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos, +SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos, const SwTOXBase& rTOX, const SfxItemSet* pSet, bool bExpand ) @@ -417,10 +417,10 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd } /// Get current table of contents -const SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const +SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) { - const SwNode& rNd = rPos.nNode.GetNode(); - const SwSectionNode* pSectNd = rNd.FindSectionNode(); + SwNode& rNd = rPos.nNode.GetNode(); + SwSectionNode* pSectNd = rNd.FindSectionNode(); while( pSectNd ) { SectionType eT = pSectNd->GetSection().GetType(); @@ -428,7 +428,7 @@ const SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const { OSL_ENSURE( pSectNd->GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>( + SwTOXBaseSection& rTOXSect = static_cast<SwTOXBaseSection&>( pSectNd->GetSection()); return &rTOXSect; } @@ -441,7 +441,7 @@ const SwAttrSet& SwDoc::GetTOXBaseAttrSet(const SwTOXBase& rTOXBase) const { OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); - SwSectionFmt* pFmt = rTOXSect.GetFmt(); + SwSectionFmt const * pFmt = rTOXSect.GetFmt(); OSL_ENSURE( pFmt, "invalid TOXBaseSection!" ); return pFmt->GetAttrSet(); } @@ -501,15 +501,15 @@ bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ) OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); - SwSectionFmt* pFmt = rTOXSect.GetFmt(); + SwSectionFmt const * pFmt = rTOXSect.GetFmt(); if( pFmt ) { GetIDocumentUndoRedo().StartUndo( UNDO_CLEARTOXRANGE, NULL ); /* Save the start node of the TOX' section. */ - SwSectionNode * pMyNode = pFmt->GetSectionNode(); + SwSectionNode const * pMyNode = pFmt->GetSectionNode(); /* Save start node of section's surrounding. */ - SwNode * pStartNd = pMyNode->StartOfSectionNode(); + SwNode const * pStartNd = pMyNode->StartOfSectionNode(); /* Look for the point where to move the cursors in the area to delete to. This is done by first searching forward from the @@ -572,7 +572,7 @@ bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ) } } - DelSectionFmt( pFmt, bDelNodes ); + DelSectionFmt( const_cast<SwSectionFmt *>(pFmt), bDelNodes ); GetIDocumentUndoRedo().EndUndo( UNDO_CLEARTOXRANGE, NULL ); bRet = true; @@ -2015,7 +2015,7 @@ const SfxItemSet* SwTOXBase::GetAttrSet() const void SwTOXBase::SetAttrSet( const SfxItemSet& rSet ) { - const SwTOXBaseSection *pSect = dynamic_cast<const SwTOXBaseSection*>(this); + SwTOXBaseSection *pSect = dynamic_cast<SwTOXBaseSection*>(this); if( pSect && pSect->GetFmt() ) pSect->GetFmt()->SetFmtAttr( rSet ); } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 909edf4924f7..89349a1293d3 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -352,7 +352,7 @@ bool SwSection::CalcHiddenFlag() const bool SwSection::IsProtect() const { - SwSectionFmt *const pFmt( GetFmt() ); + SwSectionFmt const *const pFmt( GetFmt() ); OSL_ENSURE(pFmt, "SwSection::IsProtect: no format?"); return (pFmt) ? pFmt->GetProtect().IsCntntProtected() @@ -362,7 +362,7 @@ bool SwSection::IsProtect() const // edit in readonly sections bool SwSection::IsEditInReadonly() const { - SwSectionFmt *const pFmt( GetFmt() ); + SwSectionFmt const *const pFmt( GetFmt() ); OSL_ENSURE(pFmt, "SwSection::IsEditInReadonly: no format?"); return (pFmt) ? pFmt->GetEditInReadonly().GetValue() diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index 6179924d0ee4..33ed0de23735 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -80,7 +80,7 @@ const SwSection* SwEditShell::GetCurrSection() const * * In footnotes it may not be the area within the footnote. */ -const SwSection* SwEditShell::GetAnySection( bool bOutOfTab, const Point* pPt ) const +SwSection* SwEditShell::GetAnySection( bool bOutOfTab, const Point* pPt ) { SwFrm *pFrm; if ( pPt ) @@ -189,7 +189,7 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet, const SwPosition* pStt = rPaM.Start(), * pEnd = rPaM.End(); - const SwSectionNode* pSttSectNd = pStt->nNode.GetNode().FindSectionNode(), + SwSectionNode* pSttSectNd = pStt->nNode.GetNode().FindSectionNode(), * pEndSectNd = pEnd->nNode.GetNode().FindSectionNode(); if( pSttSectNd || pEndSectNd ) diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 6ae1625209a7..6923a71296ee 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2596,7 +2596,7 @@ void SwFEShell::SetChainMarker() } } -long SwFEShell::GetSectionWidth( SwFmt& rFmt ) const +long SwFEShell::GetSectionWidth( SwFmt const & rFmt ) const { SwFrm *pFrm = GetCurrFrm(); // Is the cursor at this moment in a SectionFrm? diff --git a/sw/source/core/inc/unoidx.hxx b/sw/source/core/inc/unoidx.hxx index 4dfcc2412f0f..ed3b5248f2a6 100644 --- a/sw/source/core/inc/unoidx.hxx +++ b/sw/source/core/inc/unoidx.hxx @@ -64,7 +64,7 @@ private: virtual ~SwXDocumentIndex(); - SwXDocumentIndex(SwTOXBaseSection const&, SwDoc &); + SwXDocumentIndex(SwTOXBaseSection &, SwDoc &); /// descriptor SwXDocumentIndex(const TOXTypes eToxType, SwDoc& rDoc); @@ -73,7 +73,7 @@ public: static ::com::sun::star::uno::Reference< ::com::sun::star::text::XDocumentIndex> - CreateXDocumentIndex(SwDoc & rDoc, SwTOXBaseSection const* pSection, + CreateXDocumentIndex(SwDoc & rDoc, SwTOXBaseSection * pSection, TOXTypes eTypes = TOX_INDEX); // MetadatableMixin diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 0270960bc5fe..943223001e54 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -490,7 +490,7 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry break; case FN_UNO_DOCUMENT_INDEX: { - const SwTOXBase* pBase = rPam.GetDoc()->GetCurTOX( + SwTOXBase* pBase = rPam.GetDoc()->GetCurTOX( *rPam.Start() ); if( pBase ) { @@ -498,7 +498,7 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry { const uno::Reference< text::XDocumentIndex > xRef = SwXDocumentIndex::CreateXDocumentIndex(*rPam.GetDoc(), - static_cast<SwTOXBaseSection const*>(pBase)); + static_cast<SwTOXBaseSection *>(pBase)); (*pAny) <<= xRef; } } diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 387e8883f041..4d2efa310470 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -332,7 +332,7 @@ public: Impl( SwDoc & rDoc, const TOXTypes eType, - SwTOXBaseSection const*const pBaseSection) + SwTOXBaseSection *const pBaseSection) : SwClient((pBaseSection) ? pBaseSection->GetFmt() : 0) , m_Listeners(m_Mutex) , m_rPropSet( @@ -398,7 +398,7 @@ void SwXDocumentIndex::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem * } SwXDocumentIndex::SwXDocumentIndex( - SwTOXBaseSection const& rBaseSection, SwDoc & rDoc) + SwTOXBaseSection & rBaseSection, SwDoc & rDoc) : m_pImpl( new SwXDocumentIndex::Impl( rDoc, rBaseSection.SwTOXBase::GetType(), & rBaseSection) ) { @@ -415,14 +415,14 @@ SwXDocumentIndex::~SwXDocumentIndex() uno::Reference<text::XDocumentIndex> SwXDocumentIndex::CreateXDocumentIndex( - SwDoc & rDoc, SwTOXBaseSection const* pSection, TOXTypes const eTypes) + SwDoc & rDoc, SwTOXBaseSection * pSection, TOXTypes const eTypes) { // re-use existing SwXDocumentIndex // #i105557#: do not iterate over the registered clients: race condition uno::Reference<text::XDocumentIndex> xIndex; if (pSection) { - SwSectionFmt *const pFmt = pSection->GetFmt(); + SwSectionFmt const *const pFmt = pSection->GetFmt(); xIndex.set(pFmt->GetXObject(), uno::UNO_QUERY); } if (!xIndex.is()) @@ -1374,7 +1374,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) lcl_ReAssignTOXType(pDoc, rTOXBase, m_pImpl->m_pProps->GetTypeName()); } //TODO: apply Section attributes (columns and background) - SwTOXBaseSection const*const pTOX = + SwTOXBaseSection *const pTOX = pDoc->InsertTableOf( *aPam.GetPoint(), rTOXBase, 0, false ); pDoc->SetTOXBaseName(*pTOX, m_pImpl->m_pProps->GetTOXBase().GetTOXName()); @@ -2502,14 +2502,14 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, const SwSectionFmts& rFmts = GetDoc()->GetSections(); for( size_t n = 0; n < rFmts.size(); ++n ) { - const SwSection* pSect = rFmts[ n ]->GetSection(); + SwSection* pSect = rFmts[ n ]->GetSection(); if( TOX_CONTENT_SECTION == pSect->GetType() && pSect->GetFmt()->GetSectionNode() && nIdx++ == nIndex ) { const uno::Reference< text::XDocumentIndex > xTmp = SwXDocumentIndex::CreateXDocumentIndex( - *GetDoc(), static_cast<SwTOXBaseSection const*>(pSect)); + *GetDoc(), static_cast<SwTOXBaseSection *>(pSect)); uno::Any aRet; aRet <<= xTmp; return aRet; @@ -2532,7 +2532,7 @@ throw (container::NoSuchElementException, lang::WrappedTargetException, const SwSectionFmts& rFmts = GetDoc()->GetSections(); for( size_t n = 0; n < rFmts.size(); ++n ) { - const SwSection* pSect = rFmts[ n ]->GetSection(); + SwSection* pSect = rFmts[ n ]->GetSection(); if( TOX_CONTENT_SECTION == pSect->GetType() && pSect->GetFmt()->GetSectionNode() && (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName() @@ -2540,7 +2540,7 @@ throw (container::NoSuchElementException, lang::WrappedTargetException, { const uno::Reference< text::XDocumentIndex > xTmp = SwXDocumentIndex::CreateXDocumentIndex( - *GetDoc(), static_cast<SwTOXBaseSection const*>(pSect)); + *GetDoc(), static_cast<SwTOXBaseSection *>(pSect)); uno::Any aRet; aRet <<= xTmp; return aRet; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 5f14c5de007d..bdd055d7289c 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1152,7 +1152,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName) SwSectionNode* pSectionNode = pTblNode->FindSectionNode(); if(pSectionNode) { - const SwSection& rSect = pSectionNode->GetSection(); + SwSection& rSect = pSectionNode->GetSection(); uno::Reference< text::XTextSection > xSect = SwXTextSections::GetObject( *rSect.GetFmt() ); aRet <<= xSect; @@ -3545,7 +3545,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) SwSectionNode* pSectionNode = pTblNode->FindSectionNode(); if(pSectionNode) { - const SwSection& rSect = pSectionNode->GetSection(); + SwSection& rSect = pSectionNode->GetSection(); uno::Reference< text::XTextSection > xSect = SwXTextSections::GetObject( *rSect.GetFmt() ); aRet <<= xSect; diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 76b386a72096..3e86e3b0d317 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -862,7 +862,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) SfxItemSet aSet( GetPool(), RES_COL, RES_COL ); if(bSect) { - const SwSection *pSect = rSh.GetAnySection(); + SwSection *pSect = rSh.GetAnySection(); OSL_ENSURE( pSect, "Which section?"); pSectFmt = pSect->GetFmt(); } @@ -1561,7 +1561,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) OSL_ENSURE( pSect, "Which section?"); if( pSect ) { - SwSectionFmt *pFmt = pSect->GetFmt(); + SwSectionFmt const *pFmt = pSect->GetFmt(); const SwFmtCol& rCol = pFmt->GetCol(); if(rSh.IsInRightToLeftText()) nNum = rCol.GetColumns().size() - nNum; |