diff options
author | Maxime de Roucy <mderoucy@linagora.com> | 2013-04-04 18:05:24 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-04-25 08:55:10 +0000 |
commit | f215e634de4926def396d8442b8b15a912cb69e8 (patch) | |
tree | bcfb1be124987d29bcd620647165ba9be60e3ce3 /sw | |
parent | e42eed90b5c8151f8b5520ca2728061b1ac8e41e (diff) |
comments and code reformat
Change-Id: Ib4e45cb85c9e5e5ffa6476c939300c6795412b1a
Reviewed-on: https://gerrit.libreoffice.org/3582
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/doc.hxx | 8 | ||||
-rw-r--r-- | sw/inc/redline.hxx | 11 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 103 |
3 files changed, 62 insertions, 60 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 5dfb6df53076..1e77cacd2e72 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -878,7 +878,7 @@ public: virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*); virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*); - //Add a para for the char attribute exp... + /// Add a para for the char attribute exp... virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&, const SetAttrMode nFlags,bool bExpandCharToPara=false); virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&, @@ -1183,9 +1183,11 @@ public: const bool bSendDataChangedEvents = true ); void RstTxtAttrs(const SwPaM &rRg, bool bInclRefToxMark = false ); - /** Set attribute in given format. - If Undo is activated, the old one is listed in Undo-History. */ + /** Set attribute in given format.1y + * If Undo is enabled, the old values is added to the Undo history. */ void SetAttr( const SfxPoolItem&, SwFmt& ); + /** Set attribute in given format.1y + * If Undo is enabled, the old values is added to the Undo history. */ void SetAttr( const SfxItemSet&, SwFmt& ); /// method to reset a certain attribute at the given format diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index f9fc926b22ea..2c54a2ea61a4 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -203,7 +203,7 @@ public: if( !pEndPtr ) pEndPtr = End(); *pEndPtr = rPos; } - // Do we have a valid selection? + /// Do we have a valid selection? sal_Bool HasValidRange() const; const SwRedlineData& GetRedlineData(sal_uInt16 nPos = 0) const; @@ -224,8 +224,8 @@ public: void SetComment( const String& rS ) { pRedlineData->SetComment( rS ); } - // ExtraData gets copied, the pointer is therefor not taken over by - // the RedLineObject. + /** ExtraData gets copied, the pointer is therefor not taken over by + * the RedLineObject.*/ void SetExtraData( const SwRedlineExtraData* pData ) { pRedlineData->SetExtraData( pData ); } const SwRedlineExtraData* GetExtraData() const @@ -246,10 +246,11 @@ public: void Hide( sal_uInt16 nLoop = 0 ); void ShowOriginal( sal_uInt16 nLoop = 0 ); - // Calculates the intersection with text node number nNdIdx. + /// Calculates the intersection with text node number nNdIdx. void CalcStartEnd( sal_uLong nNdIdx, sal_uInt16& nStart, sal_uInt16& nEnd ) const; - void InvalidateRange(); // Initiate the layout. + /// Initiate the layout. + void InvalidateRange(); sal_Bool IsOwnRedline( const SwRedline& rRedl ) const { return GetAuthor() == rRedl.GetAuthor(); } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 332c44a9ce08..702156faad7c 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -97,7 +97,6 @@ struct ParaRstFmt bool bResetListAttrs; // #i62575# bool bResetAll; bool bInclRefToxMark; - bool bKeepOutlineLevelAttr; ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd, @@ -126,7 +125,7 @@ struct ParaRstFmt bResetListAttrs( false ), // #i62675# bResetAll( true ), bInclRefToxMark( false ), - bKeepOutlineLevelAttr( false ) + bKeepOutlineLevelAttr( false ) {} }; @@ -1637,74 +1636,74 @@ void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, bool bBroadcast ) static bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) { - // ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs; - SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode(); - if( pCNd ) - { - ParaRstFmt* pPara = (ParaRstFmt*)pArgs; + SwCntntNode* pCNd = static_cast<SwCntntNode*>(rpNode->GetTxtNode()); - SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl); - if ( pPara->bReset ) - { + if( pCNd == NULL) + return true; + + ParaRstFmt* pPara = reinterpret_cast<ParaRstFmt*>(pArgs); - if( pFmt->GetAttrOutlineLevel() == 0 && pPara ) - pPara->bKeepOutlineLevelAttr = true; + SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl); + if ( pPara->bReset ) + { + + if( pFmt->GetAttrOutlineLevel() == 0 && pPara ) + pPara->bKeepOutlineLevelAttr = true; - lcl_RstAttr( pCNd, pPara ); + lcl_RstAttr( pCNd, pPara ); - // #i62675# check, if paragraph style has changed - if ( pPara->bResetListAttrs && - pFmt != pCNd->GetFmtColl() && - pFmt->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET ) + // #i62675# check, if paragraph style has changed + if ( pPara->bResetListAttrs && + pFmt != pCNd->GetFmtColl() && + pFmt->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET ) + { + // Check, if the list style of the paragraph will change. + bool bChangeOfListStyleAtParagraph( true ); + SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) ); + OSL_ENSURE( pTNd, "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" ); { - // Check, if the list style of the paragraph will change. - bool bChangeOfListStyleAtParagraph( true ); - SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) ); - OSL_ENSURE( pTNd, - "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" ); + SwNumRule* pNumRuleAtParagraph( pTNd->GetNumRule() ); + if ( pNumRuleAtParagraph ) { - SwNumRule* pNumRuleAtParagraph( pTNd->GetNumRule() ); - if ( pNumRuleAtParagraph ) + const SwNumRuleItem& rNumRuleItemAtParagraphStyle = + pFmt->GetNumRule(); + if ( rNumRuleItemAtParagraphStyle.GetValue() == + pNumRuleAtParagraph->GetName() ) { - const SwNumRuleItem& rNumRuleItemAtParagraphStyle = - pFmt->GetNumRule(); - if ( rNumRuleItemAtParagraphStyle.GetValue() == - pNumRuleAtParagraph->GetName() ) - { - bChangeOfListStyleAtParagraph = false; - } + bChangeOfListStyleAtParagraph = false; } } + } - if ( bChangeOfListStyleAtParagraph ) + if ( bChangeOfListStyleAtParagraph ) + { + std::auto_ptr< SwRegHistory > pRegH; + if ( pPara->pHistory ) { - std::auto_ptr< SwRegHistory > pRegH; - if ( pPara->pHistory ) - { - pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) ); - } + pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) ); + } - pCNd->ResetAttr( RES_PARATR_NUMRULE ); + pCNd->ResetAttr( RES_PARATR_NUMRULE ); - // reset all list attributes - pCNd->ResetAttr( RES_PARATR_LIST_LEVEL ); - pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART ); - pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE ); - pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); - pCNd->ResetAttr( RES_PARATR_LIST_ID ); - } + // reset all list attributes + pCNd->ResetAttr( RES_PARATR_LIST_LEVEL ); + pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART ); + pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE ); + pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); + pCNd->ResetAttr( RES_PARATR_LIST_ID ); } } + } - // add to History so that old data is saved, if necessary - if( pPara->pHistory ) - pPara->pHistory->Add( pCNd->GetFmtColl(), pCNd->GetIndex(), - ND_TEXTNODE ); + // add to History so that old data is saved, if necessary + if( pPara->pHistory ) + pPara->pHistory->Add( pCNd->GetFmtColl(), pCNd->GetIndex(), + ND_TEXTNODE ); - pCNd->ChgFmtColl( pFmt ); + pCNd->ChgFmtColl( pFmt ); + + pPara->nWhich++; - pPara->nWhich++; - } return true; } |