diff options
Diffstat (limited to 'sw/source/core/txtnode/ndtxt.cxx')
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 113 |
1 files changed, 92 insertions, 21 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 7b58c0ec6745..3622e4c02086 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -91,6 +91,9 @@ #include <switerator.hxx> #include <attrhint.hxx> +//UUUU +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svl/itemiter.hxx> using namespace ::com::sun::star; @@ -202,21 +205,23 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere, // SwTxtNode // -------------------- -SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, - SwTxtFmtColl *pTxtColl, - const SfxItemSet* pAutoAttr ) - : SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ), - m_pSwpHints( 0 ), - mpNodeNum( 0 ), - m_bLastOutlineState( false ), - m_bNotifiable( false ), - // --> OD 2008-11-19 #i70748# - mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ), - // <-- - // --> OD 2008-05-06 #refactorlists# - mbInSetOrResetAttr( false ), - mpList( 0 ) - // <-- +SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl, const SfxItemSet* pAutoAttr ) +: SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ), + m_pSwpHints( 0 ), + mpNodeNum( 0 ), + m_Text(), + m_pParaIdleData_Impl(0), + m_bContainsHiddenChars(false), + m_bHiddenCharsHidePara(false), + m_bRecalcHiddenCharFlags(false), + m_bLastOutlineState( false ), + m_bNotifiable( false ), + mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ), + mbInSetOrResetAttr( false ), + mpList( 0 ), + m_pNumStringCache(), + m_wXParagraph(), + maFillAttributes() { InitSwParaStatistics( true ); @@ -1072,6 +1077,8 @@ void SwTxtNode::Update( // Bookmarks must never grow to either side, when editing (directly) to the left or right (#i29942#)! // And a bookmark with same start and end must remain to the left of the inserted text (used in XML import). { + bool bAtLeastOneBookmarkMoved = false; + bool bAtLeastOneExpandedBookmarkAtInsertionPosition = false; const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess(); for ( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin(); ppMark != pMarkAccess->getAllMarksEnd(); @@ -1079,14 +1086,28 @@ void SwTxtNode::Update( { const ::sw::mark::IMark* const pMark = ppMark->get(); const SwPosition* pEnd = &pMark->GetMarkEnd(); - SwIndex & rIdx = const_cast<SwIndex&>(pEnd->nContent); + SwIndex & rEndIdx = const_cast<SwIndex&>(pEnd->nContent); if( this == &pEnd->nNode.GetNode() && - rPos.GetIndex() == rIdx.GetIndex() ) + rPos.GetIndex() == rEndIdx.GetIndex() ) { - rIdx.Assign( &aTmpIdxReg, rIdx.GetIndex() ); - bSortMarks = true; + rEndIdx.Assign( &aTmpIdxReg, rEndIdx.GetIndex() ); + bAtLeastOneBookmarkMoved = true; + } + else if ( !bAtLeastOneExpandedBookmarkAtInsertionPosition ) + { + if ( pMark->IsExpanded() ) + { + const SwPosition* pStart = &pMark->GetMarkStart(); + if ( this == &pStart->nNode.GetNode() + && rPos.GetIndex() == pStart->nContent.GetIndex() ) + { + bAtLeastOneExpandedBookmarkAtInsertionPosition = true; + } + } } } + + bSortMarks = bAtLeastOneBookmarkMoved && bAtLeastOneExpandedBookmarkAtInsertionPosition; } } @@ -1542,7 +1563,11 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx, if( this != pDest ) { // Frames benachrichtigen, sonst verschwinden die Ftn-Nummern - SwUpdateAttr aHint( nOldPos, nOldPos, 0 ); + SwUpdateAttr aHint( + nOldPos, + nOldPos, + 0); + pDest->ModifyNotification( 0, &aHint ); } } @@ -2463,7 +2488,11 @@ void SwTxtNode::GCAttr() if(bChanged) { //TxtFrm's reagieren auf aHint, andere auf aNew - SwUpdateAttr aHint( nMin, nMax, 0 ); + SwUpdateAttr aHint( + nMin, + nMax, + 0); + NotifyClients( 0, &aHint ); SwFmtChg aNew( GetTxtColl() ); NotifyClients( 0, &aNew ); @@ -3646,6 +3675,28 @@ void SwTxtNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewVal (SwTxtFmtColl*)((SwFmtChg*)pNewValue)->pChangedFmt ); } + //UUUU reset fill information + if(maFillAttributes.get()) + { + sal_uInt16 nWhich = pNewValue ? pNewValue->Which() : 0; + bool bReset(RES_FMT_CHG == nWhich); // ..on format change (e.g. style changed) + + if(!bReset && RES_ATTRSET_CHG == nWhich) // ..on ItemChange from DrawingLayer FillAttributes + { + SfxItemIter aIter(*((SwAttrSetChg*)pNewValue)->GetChgSet()); + + for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem()) + { + bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST; + } + } + + if(bReset) + { + maFillAttributes.reset(); + } + } + // --> OD 2008-03-27 #refactorlists# if ( !mbInSetOrResetAttr ) { @@ -3695,6 +3746,12 @@ SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl ) HandleModifyAtTxtNode( *this, &aTmp1, &aTmp2 ); } // <-- + + //UUUU reset fill information on parent style change + if(maFillAttributes.get()) + { + maFillAttributes.reset(); + } } // nur wenn im normalen Nodes-Array @@ -4619,6 +4676,7 @@ namespace { // --> OD 2008-11-19 #i70748# if ( mbOutlineLevelSet ) { + mrTxtNode.GetNodes().UpdateOutlineNode( mrTxtNode ); if ( mrTxtNode.GetAttrOutlineLevel() == 0 ) { mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); @@ -5056,3 +5114,16 @@ bool SwTxtNode::HasPageNumberField() } //Bug 120881(End) +//UUUU +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwTxtNode::getSdrAllFillAttributesHelper() const +{ + // create SdrAllFillAttributesHelper on demand + if(!maFillAttributes.get()) + { + const_cast< SwTxtNode* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetSwAttrSet())); + } + + return maFillAttributes; +} + +// eof |