sd/source/filter/ppt/propread.cxx | 6 +++--- sd/source/ui/app/sdmod2.cxx | 10 +++++----- sd/source/ui/dlg/dlgolbul.cxx | 2 +- sd/source/ui/dlg/docprev.cxx | 2 +- sd/source/ui/dlg/prltempl.cxx | 2 +- sd/source/ui/dlg/prntopts.cxx | 2 +- sd/source/ui/dlg/sdabstdlg.cxx | 4 ++-- sd/source/ui/dlg/sdtreelb.cxx | 12 ++++++------ sd/source/ui/docshell/docshel4.cxx | 4 ++-- sd/source/ui/func/fuolbull.cxx | 2 +- sd/source/ui/remotecontrol/BluetoothServer.cxx | 4 ++-- sd/source/ui/remotecontrol/DiscoveryService.cxx | 6 +++--- sd/source/ui/unoidl/UnoDocumentSettings.cxx | 8 ++++---- sd/source/ui/unoidl/unosrch.cxx | 6 +++--- sd/source/ui/view/drtxtob1.cxx | 2 +- sd/source/ui/view/viewshel.cxx | 2 +- starmath/inc/node.hxx | 17 ++++++++--------- sw/inc/doc.hxx | 4 ++-- sw/inc/editsh.hxx | 2 +- sw/inc/fesh.hxx | 2 +- sw/inc/section.hxx | 4 ++-- sw/source/core/doc/doctxm.cxx | 22 +++++++++++----------- sw/source/core/docnode/section.cxx | 4 ++-- sw/source/core/edit/edsect.cxx | 4 ++-- sw/source/core/frmedt/feshview.cxx | 2 +- sw/source/core/inc/unoidx.hxx | 4 ++-- sw/source/core/unocore/unocrsrhelper.cxx | 4 ++-- sw/source/core/unocore/unoidx.cxx | 18 +++++++++--------- sw/source/core/unocore/unotbl.cxx | 4 ++-- sw/source/uibase/uiview/viewtab.cxx | 4 ++-- writerperfect/source/common/DocumentHandler.cxx | 2 +- writerperfect/source/common/WPXSvInputStream.cxx | 2 +- 32 files changed, 86 insertions(+), 87 deletions(-)
New commits: commit 4698eeea354b51d7efd6bb229898e86b3e3c0596 Author: Stephan Bergmann <[email protected]> Date: Wed Jan 21 14:00:43 2015 +0100 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 diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 6efdfd49..f2fe7ab 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 60d1fe2..34c4409 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 49b591b..70bbe3f 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 418319a..9774dee 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 078c499..46ff607 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 909edf4..89349a1 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 6179924..33ed0de 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 6ae16252..6923a71 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 4dfcc24..ed3b524 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 0270960..9432230 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 387e888..4d2efa3 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 5f14c5d..bdd055d 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 76b386a..3e86e3b 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; commit ce67bc61da9e12987d57f764bc7c8376eea48bbe Author: Stephan Bergmann <[email protected]> Date: Tue Jan 20 16:50:11 2015 +0100 Some more loplugin:cstylecast: writerperfect Change-Id: I5bdc5f147e507d4ac1626133e653bdc9addb5571 diff --git a/writerperfect/source/common/DocumentHandler.cxx b/writerperfect/source/common/DocumentHandler.cxx index 72a5b36..d87a736 100644 --- a/writerperfect/source/common/DocumentHandler.cxx +++ b/writerperfect/source/common/DocumentHandler.cxx @@ -32,7 +32,7 @@ static const unsigned char librvng_utf8_skip_data[256] = 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1 }; -#define librvng_utf8_next_char(p) (char const *)((p) + librvng_utf8_skip_data[*((unsigned char const *)p)]) +#define librvng_utf8_next_char(p) (char const *)((p) + librvng_utf8_skip_data[*reinterpret_cast<unsigned char const *>(p)]) static void unescapeXML(const char *s, const unsigned long sz, librevenge::RVNGString &res) { diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index 8233820..7bc436f 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -494,7 +494,7 @@ const unsigned char *WPXSvInputStreamImpl::read(unsigned long numBytes, unsigned if (numBytesRead == 0) return 0; - return (const unsigned char *)maData.getConstArray(); + return reinterpret_cast<const unsigned char *>(maData.getConstArray()); } long WPXSvInputStreamImpl::tell() commit f53972b0285cfd11da30f2723a662ff76c40c757 Author: Stephan Bergmann <[email protected]> Date: Tue Jan 20 16:50:03 2015 +0100 Some more loplugin:cstylecast: starmath Change-Id: I0d1c743343d8f84c0491957ad43d8b16d9490622 diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index e70d5a3..a44ed35 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -231,13 +231,7 @@ public: } protected: /** Sets parent on children of this node */ - void ClaimPaternity(){ - SmNode* pNode; - sal_uInt16 nSize = GetNumSubNodes(); - for (sal_uInt16 i = 0; i < nSize; i++) - if (NULL != (pNode = GetSubNode(i))) - pNode->SetParent((SmStructureNode*)this); //Cast is valid if we have children - } + inline void ClaimPaternity(); private: SmStructureNode* aParentNode; void DumpAsDot(std::ostream &out, OUString* label, int number, int& id, int parent) const; @@ -352,8 +346,13 @@ public: } }; - - +inline void SmNode::ClaimPaternity() { + SmNode* pNode; + sal_uInt16 nSize = GetNumSubNodes(); + for (sal_uInt16 i = 0; i < nSize; i++) + if (NULL != (pNode = GetSubNode(i))) + pNode->SetParent(static_cast<SmStructureNode*>(this)); //Cast is valid if we have children +} /** Abstract base class for all visible node * commit c4b3801c22c6d4dc6fe34033089c6398bcd433d3 Author: Stephan Bergmann <[email protected]> Date: Tue Jan 20 16:49:57 2015 +0100 Some more loplugin:cstylecast: sd Change-Id: I3562efaab55655bc758fe94090b2b6d05b548098 diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index 2318c4b..96466d0 100644 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -103,7 +103,7 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign ) nItemSize >>= 1; if ( nItemSize > 1 ) { - sal_Unicode* pWString = (sal_Unicode*)pString; + sal_Unicode* pWString = reinterpret_cast<sal_Unicode*>(pString); for ( i = 0; i < nItemSize; i++ ) ReadUInt16( pWString[ i ] ); rString = OUString(pWString, lcl_getMaxSafeStrLen(nItemSize)); @@ -263,7 +263,7 @@ bool Section::GetDictionary( Dictionary& rDict ) if ( iter != maEntries.end() ) { sal_uInt32 nDictCount, nId, nSize, nPos; - SvMemoryStream aStream( (sal_Int8*)iter->mpBuf, iter->mnSize, StreamMode::READ ); + SvMemoryStream aStream( iter->mpBuf, iter->mnSize, StreamMode::READ ); aStream.Seek( STREAM_SEEK_TO_BEGIN ); aStream.ReadUInt32( nDictCount ); for ( sal_uInt32 i = 0; i < nDictCount; i++ ) @@ -281,7 +281,7 @@ bool Section::GetDictionary( Dictionary& rDict ) { nSize >>= 1; aStream.Seek( nPos ); - sal_Unicode* pWString = (sal_Unicode*)pString; + sal_Unicode* pWString = reinterpret_cast<sal_Unicode*>(pString); for ( i = 0; i < nSize; i++ ) aStream.ReadUInt16( pWString[ i ] ); aString = OUString(pWString, lcl_getMaxSafeStrLen(nSize)); diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index dd5c666..f30c937 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -561,7 +561,7 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) // Layout const SdOptionsLayoutItem* pLayoutItem = NULL; if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_LAYOUT, - false, (const SfxPoolItem**) &pLayoutItem )) + false, reinterpret_cast<const SfxPoolItem**>(&pLayoutItem) )) { pLayoutItem->SetOptions( pOptions ); } @@ -605,7 +605,7 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) // Contents const SdOptionsContentsItem* pContentsItem = NULL; if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_CONTENTS, - false, (const SfxPoolItem**) &pContentsItem )) + false, reinterpret_cast<const SfxPoolItem**>(&pContentsItem) )) { pContentsItem->SetOptions( pOptions ); } @@ -613,7 +613,7 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) // Misc const SdOptionsMiscItem* pMiscItem = NULL; if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_MISC, - false, (const SfxPoolItem**) &pMiscItem )) + false, reinterpret_cast<const SfxPoolItem**>(&pMiscItem) )) { pMiscItem->SetOptions( pOptions ); bMiscOptions = true; @@ -622,7 +622,7 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) // Snap const SdOptionsSnapItem* pSnapItem = NULL; if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_SNAP, - false, (const SfxPoolItem**) &pSnapItem )) + false, reinterpret_cast<const SfxPoolItem**>(&pSnapItem) )) { pSnapItem->SetOptions( pOptions ); } @@ -636,7 +636,7 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) // Print const SdOptionsPrintItem* pPrintItem = NULL; if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_PRINT, - false, (const SfxPoolItem**) &pPrintItem )) + false, reinterpret_cast<const SfxPoolItem**>(&pPrintItem) )) { pPrintItem->SetOptions( pOptions ); diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx index 0eecf6a..4dd28b9 100644 --- a/sd/source/ui/dlg/dlgolbul.cxx +++ b/sd/source/ui/dlg/dlgolbul.cxx @@ -98,7 +98,7 @@ OutlineBulletDlg::OutlineBulletDlg( OUString aStyleName(SD_RESSTR(STR_LAYOUT_OUTLINE) + " 1"); SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); if( pFirstStyleSheet ) - pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, (const SfxPoolItem**)&pItem); + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem)); } if( pItem == NULL ) diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx index f8217eb..e3f9a2a 100644 --- a/sd/source/ui/dlg/docprev.cxx +++ b/sd/source/ui/dlg/docprev.cxx @@ -154,7 +154,7 @@ void SdDocPreviewWin::Paint( const Rectangle& rRect ) ? ::sd::ViewShell::OUTPUT_DRAWMODE_CONTRAST : ::sd::ViewShell::OUTPUT_DRAWMODE_COLOR ); - ImpPaint( pMetaFile, (VirtualDevice*)this ); + ImpPaint( pMetaFile, this ); } else { diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx index 171b82a..e2330f9 100644 --- a/sd/source/ui/dlg/prltempl.cxx +++ b/sd/source/ui/dlg/prltempl.cxx @@ -287,7 +287,7 @@ const SfxItemSet* SdPresLayoutTemplateDlg::GetOutputItemSet() const pOutSet->Put( *SfxTabDialog::GetOutputItemSet() ); const SvxNumBulletItem *pSvxNumBulletItem = NULL; - if( SfxItemState::SET == pOutSet->GetItemState(EE_PARA_NUMBULLET, false, (const SfxPoolItem**)&pSvxNumBulletItem )) + if( SfxItemState::SET == pOutSet->GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pSvxNumBulletItem) )) SdBulletMapper::MapFontsInNumRule( *pSvxNumBulletItem->GetNumRule(), *pOutSet ); return pOutSet; } diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx index 1be0be5..943144b 100644 --- a/sd/source/ui/dlg/prntopts.cxx +++ b/sd/source/ui/dlg/prntopts.cxx @@ -131,7 +131,7 @@ void SdPrintOptions::Reset( const SfxItemSet* rAttrs ) { const SdOptionsPrintItem* pPrintOpts = NULL; if( SfxItemState::SET == rAttrs->GetItemState( ATTR_OPTIONS_PRINT, false, - (const SfxPoolItem**) &pPrintOpts ) ) + reinterpret_cast<const SfxPoolItem**>(&pPrintOpts) ) ) { m_pCbxDraw->Check( pPrintOpts->GetOptionsPrint().IsDraw() ); m_pCbxNotes->Check( pPrintOpts->GetOptionsPrint().IsNotes() ); diff --git a/sd/source/ui/dlg/sdabstdlg.cxx b/sd/source/ui/dlg/sdabstdlg.cxx index acf4705..1f64f29 100644 --- a/sd/source/ui/dlg/sdabstdlg.cxx +++ b/sd/source/ui/dlg/sdabstdlg.cxx @@ -44,8 +44,8 @@ SdAbstractDialogFactory* SdAbstractDialogFactory::Create() static ::osl::Module aDialogLibrary; static const OUString sLibName(SDUI_DLL_NAME); if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, sLibName ) ) - fp = ( SdAbstractDialogFactory* (SAL_CALL*)() ) - aDialogLibrary.getFunctionSymbol( "SdCreateDialogFactory" ); + fp = reinterpret_cast<SdAbstractDialogFactory* (SAL_CALL*)()>( + aDialogLibrary.getFunctionSymbol( "SdCreateDialogFactory" )); #else fp = SdCreateDialogFactory(); #endif diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index bcea730..e1442cd 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -602,7 +602,7 @@ void SdPageObjsTLB::AddShapeList ( SdNavigatorWin* pSdNavigatorWin=NULL; sd::DrawDocShell* pSdDrawDocShell = NULL; if(pEntry) - pWindow=(vcl::Window*)GetParent(pEntry); + pWindow=reinterpret_cast<vcl::Window*>(GetParent(pEntry)); if(pWindow) pSdNavigatorWin = static_cast<SdNavigatorWin*>(pWindow); if( pSdNavigatorWin ) @@ -645,7 +645,7 @@ void SdPageObjsTLB::AddShapeList ( SdNavigatorWin* pSdNavigatorWin=NULL; sd::DrawDocShell* pSdDrawDocShell = NULL; if(pNewEntry) - pWindow=(vcl::Window*)GetParent(pNewEntry); + pWindow=reinterpret_cast<vcl::Window*>(GetParent(pNewEntry)); if(pWindow) pSdNavigatorWin = static_cast<SdNavigatorWin*>(pWindow); if( pSdNavigatorWin ) @@ -679,7 +679,7 @@ void SdPageObjsTLB::AddShapeList ( SdNavigatorWin* pSdNavigatorWin=NULL; sd::DrawDocShell* pSdDrawDocShell = NULL; if(pNewEntry) - pWindow=(vcl::Window*)GetParent(pNewEntry); + pWindow=reinterpret_cast<vcl::Window*>(GetParent(pNewEntry)); if(pWindow) pSdNavigatorWin = static_cast<SdNavigatorWin*>(pWindow); if( pSdNavigatorWin ) @@ -728,7 +728,7 @@ void SdPageObjsTLB::AddShapeList ( SdNavigatorWin* pSdNavigatorWin=NULL; sd::DrawDocShell* pSdDrawDocShell = NULL; if(pNewEntry) - pWindow=(vcl::Window*)GetParent(pNewEntry); + pWindow=reinterpret_cast<vcl::Window*>(GetParent(pNewEntry)); if(pWindow) pSdNavigatorWin = static_cast<SdNavigatorWin*>(pWindow); if( pSdNavigatorWin ) @@ -1094,7 +1094,7 @@ void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt ) if (!pParentEntry) return; OUString aStr(GetSelectEntry()); - SdNavigatorWin* pSdNavigatorWin = (SdNavigatorWin*)pParentEntry; + SdNavigatorWin* pSdNavigatorWin = reinterpret_cast<SdNavigatorWin*>(pParentEntry); sd::DrawDocShell* pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc); if (pSdDrawDocShell) { @@ -1200,7 +1200,7 @@ void SdPageObjsTLB::DoDrag() aDDInfo.pSource = this; // aDDInfo.pDDStartEntry = pEntry; ::com::sun::star::uno::Sequence<sal_Int8> aSequence (sizeof(SvLBoxDDInfo)); - memcpy(aSequence.getArray(), (sal_Char*)&aDDInfo, sizeof(SvLBoxDDInfo)); + memcpy(aSequence.getArray(), &aDDInfo, sizeof(SvLBoxDDInfo)); ::com::sun::star::uno::Any aTreeListBoxData (aSequence); // object is destroyed by internal reference mechanism diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index deec364..6f3fcbb 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -1061,8 +1061,8 @@ bool DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium ) OUString aLayoutName; - SfxStringItem* pLayoutItem; - if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, false, (const SfxPoolItem**) & pLayoutItem ) == SfxItemState::SET ) + SfxStringItem const * pLayoutItem; + if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, false, reinterpret_cast<const SfxPoolItem**>(& pLayoutItem) ) == SfxItemState::SET ) { aLayoutName = pLayoutItem->GetValue(); } diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index 9888738..55acf20 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -349,7 +349,7 @@ const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_u OUString aStyleName(SD_RESSTR(STR_LAYOUT_OUTLINE) + " 1"); SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); if( pFirstStyleSheet ) - pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, (const SfxPoolItem**)&pItem); + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem)); } if( pItem == NULL ) diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx index e04392d..93180f2 100644 --- a/sd/source/ui/remotecontrol/BluetoothServer.cxx +++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx @@ -395,7 +395,7 @@ bluezCreateAttachListeningSocket( GMainContext *pContext, GPollFD *pSocketFD ) aAddr.rc_channel = 5; int a; - if ( ( a = bind( nSocket, (sockaddr*) &aAddr, sizeof(aAddr) ) ) < 0 ) { + if ( ( a = bind( nSocket, reinterpret_cast<sockaddr*>(&aAddr), sizeof(aAddr) ) ) < 0 ) { SAL_WARN( "sdremote.bluetooth", "bind failed with error" << a ); close( nSocket ); return; @@ -1297,7 +1297,7 @@ void SAL_CALL BluetoothServer::run() int nClient; SAL_INFO( "sdremote.bluetooth", "performing accept" ); - if ( ( nClient = accept( aSocketFD.fd, (sockaddr*) &aRemoteAddr, &aRemoteAddrLen)) < 0 && + if ( ( nClient = accept( aSocketFD.fd, reinterpret_cast<sockaddr*>(&aRemoteAddr), &aRemoteAddrLen)) < 0 && errno != EAGAIN ) { SAL_WARN( "sdremote.bluetooth", "accept failed with errno " << errno ); diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx index 9b6bfbfb..04ef5e7 100644 --- a/sd/source/ui/remotecontrol/DiscoveryService.cxx +++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx @@ -112,7 +112,7 @@ void DiscoveryService::setupSockets() aAddr.sin_addr.s_addr = htonl(INADDR_ANY); aAddr.sin_port = htons( PORT_DISCOVERY ); - int rc = bind( mSocket, (sockaddr*) &aAddr, sizeof(sockaddr_in) ); + int rc = bind( mSocket, reinterpret_cast<sockaddr*>(&aAddr), sizeof(sockaddr_in) ); if (rc) { @@ -151,7 +151,7 @@ void SAL_CALL DiscoveryService::run() memset( aBuffer, 0, sizeof(char) * BUFFER_SIZE ); sockaddr_in aAddr; socklen_t aLen = sizeof( aAddr ); - if(recvfrom( mSocket, aBuffer, BUFFER_SIZE, 0, (sockaddr*) &aAddr, &aLen ) > 0) + if(recvfrom( mSocket, aBuffer, BUFFER_SIZE, 0, reinterpret_cast<sockaddr*>(&aAddr), &aLen ) > 0) { OString aString( aBuffer, strlen( "LOREMOTE_SEARCH" ) ); if ( aString == "LOREMOTE_SEARCH" ) @@ -161,7 +161,7 @@ void SAL_CALL DiscoveryService::run() osl::SocketAddr::getLocalHostname(), RTL_TEXTENCODING_UTF8 ) ) .append( "\n\n" ); if ( sendto( mSocket, aStringBuffer.getStr(), - aStringBuffer.getLength(), 0, (sockaddr*) &aAddr, + aStringBuffer.getLength(), 0, reinterpret_cast<sockaddr*>(&aAddr), sizeof(aAddr) ) <= 0 ) { // Write error or closed socket -- we are done. diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index b193dd6..6264d10 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -417,8 +417,8 @@ throw (UnknownPropertyException, PropertyVetoException, SfxPrinter* pPrinter = pDocSh->GetPrinter( false ); if( pPrinter ) { - SdOptionsPrintItem* pPrinterOptions = NULL; - if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, false, (const SfxPoolItem**) &pPrinterOptions) == SfxItemState::SET) + SdOptionsPrintItem const * pPrinterOptions = NULL; + if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, false, reinterpret_cast<const SfxPoolItem**>(&pPrinterOptions)) == SfxItemState::SET) aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint(); } else @@ -997,8 +997,8 @@ throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std:: SfxPrinter* pPrinter = pDocSh->GetPrinter( false ); if( pPrinter ) { - SdOptionsPrintItem* pPrinterOptions = NULL; - if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, false, (const SfxPoolItem**) &pPrinterOptions) == SfxItemState::SET) + SdOptionsPrintItem const * pPrinterOptions = NULL; + if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, false, reinterpret_cast<const SfxPoolItem**>(&pPrinterOptions)) == SfxItemState::SET) aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint(); } else diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index 90d466a..082d636 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -580,7 +580,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Refere } } - uno::Reference< text::XText > xFound; + uno::Reference< text::XTextRange > xFound; ESelection aSel; uno::Reference< text::XTextRange > xRangeRef( xText, uno::UNO_QUERY ); @@ -608,7 +608,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Refere if(pParent) { pRange = new SvxUnoTextRange( *pParent ); - xFound = (text::XText*)pRange; + xFound = pRange; pRange->SetSelection(aSelection); } @@ -622,7 +622,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Refere delete[] pConvertPos; delete[] pConvertPara; - return uno::Reference< text::XTextRange > ( xFound, uno::UNO_QUERY ); + return xFound; } bool SdUnoSearchReplaceShape::Search( const OUString& rText, sal_Int32& nStartPos, sal_Int32& nEndPos, SdUnoSearchReplaceDescriptor* pDescr ) throw() diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index c38924b..a3e850c 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -349,7 +349,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) OUString sStyleName(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE) + " 1"); SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find(sStyleName, SD_STYLE_FAMILY_PSEUDO); if( pFirstStyleSheet ) - pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, (const SfxPoolItem**)&pItem); + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem)); if (pItem ) { diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 736de76..9901737 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -766,7 +766,7 @@ const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& OUString aStyleName(SD_RESSTR(STR_LAYOUT_OUTLINE) + " 1"); SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); if( pFirstStyleSheet ) - pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, (const SfxPoolItem**)&pItem); + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem)); } if( pItem == NULL ) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
