diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2009-11-24 12:30:17 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2009-11-24 12:30:17 +0100 |
commit | 3ee0f60e251fc31f13cac15047ca3d3b9d2f56b6 (patch) | |
tree | 53eafed7b898b5d1fc9657699d7a741850fce361 /sw/source | |
parent | 8eeb6688770ab12a2243926098526417764fa38b (diff) | |
parent | ac926713efc96ddd53f84099d46bca7d94ee5823 (diff) |
CWS-TOOLING: integrate CWS sw33bf01
Diffstat (limited to 'sw/source')
24 files changed, 309 insertions, 214 deletions
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx index d241982182..bbf03673f0 100644 --- a/sw/source/core/bastyp/swrect.cxx +++ b/sw/source/core/bastyp/swrect.cxx @@ -53,13 +53,12 @@ SwRect::SwRect( const Rectangle &rRect ) : - nX( rRect.Left() ), - nY( rRect.Top() ) + m_Point( rRect.Left(), rRect.Top() ) { - nWidth = rRect.Right() == RECT_EMPTY ? 0 : - rRect.Right() - rRect.Left() +1; - nHeight = rRect.Bottom() == RECT_EMPTY ? 0 : - rRect.Bottom() - rRect.Top() + 1; + m_Size.setWidth(rRect.Right() == RECT_EMPTY ? 0 : + rRect.Right() - rRect.Left() +1); + m_Size.setHeight(rRect.Bottom() == RECT_EMPTY ? 0 : + rRect.Bottom() - rRect.Top() + 1); } /************************************************************************* @@ -139,7 +138,7 @@ SwRect& SwRect::Intersection( const SwRect& rRect ) } else //Def.: Bei einer leeren Intersection wird nur die SSize genullt. - nHeight = nWidth = 0; + SSize(0, 0); return *this; } @@ -239,76 +238,88 @@ BOOL SwRect::IsOver( const SwRect& rRect ) const void SwRect::Justify() { - if ( nHeight < 0 ) + if ( m_Size.getHeight() < 0 ) { - nY = nY + nHeight + 1; - nHeight = -nHeight; + m_Point.Y() += m_Size.getHeight() + 1; + m_Size.setHeight(-m_Size.getHeight()); } - if ( nWidth < 0 ) + if ( m_Size.getWidth() < 0 ) { - nX = nX + nWidth + 1; - nWidth = -nWidth; + m_Point.Y() += m_Size.getWidth() + 1; + m_Size.setWidth(-m_Size.getWidth()); } } // Similiar to the inline methods, but we need the function pointers -void SwRect::_Width( const long nNew ) { nWidth = nNew; } -void SwRect::_Height( const long nNew ) { nHeight = nNew; } -void SwRect::_Left( const long nLeft ){ nWidth += nX - nLeft; nX = nLeft; } -void SwRect::_Right( const long nRight ){ nWidth = nRight - nX; } -void SwRect::_Top( const long nTop ){ nHeight += nY - nTop; nY = nTop; } -void SwRect::_Bottom( const long nBottom ){ nHeight = nBottom - nY; } - -long SwRect::_Width() const{ return nWidth; } -long SwRect::_Height() const{ return nHeight; } -long SwRect::_Left() const{ return nX; } -long SwRect::_Right() const{ return nX + nWidth; } -long SwRect::_Top() const{ return nY; } -long SwRect::_Bottom() const{ return nY + nHeight; } - -void SwRect::AddWidth( const long nAdd ) { nWidth += nAdd; } -void SwRect::AddHeight( const long nAdd ) { nHeight += nAdd; } -void SwRect::SubLeft( const long nSub ){ nWidth += nSub; nX -= nSub; } -void SwRect::AddRight( const long nAdd ){ nWidth += nAdd; } -void SwRect::SubTop( const long nSub ){ nHeight += nSub; nY -= nSub; } -void SwRect::AddBottom( const long nAdd ){ nHeight += nAdd; } -void SwRect::SetPosX( const long nNew ){ nX = nNew; } -void SwRect::SetPosY( const long nNew ){ nY = nNew; } +void SwRect::_Width( const long nNew ) { m_Size.setWidth(nNew); } +void SwRect::_Height( const long nNew ) { m_Size.setHeight(nNew); } +void SwRect::_Left( const long nLeft ){ m_Size.Width() += m_Point.getX() - nLeft; m_Point.setX(nLeft); } +void SwRect::_Right( const long nRight ){ m_Size.setWidth(nRight - m_Point.getX()); } +void SwRect::_Top( const long nTop ){ m_Size.Height() += m_Point.getY() - nTop; m_Point.setY(nTop); } +void SwRect::_Bottom( const long nBottom ){ m_Size.setHeight(nBottom - m_Point.getY()); } + +long SwRect::_Width() const{ return m_Size.getWidth(); } +long SwRect::_Height() const{ return m_Size.getHeight(); } +long SwRect::_Left() const{ return m_Point.getX(); } +long SwRect::_Right() const{ return m_Point.getX() + m_Size.getWidth(); } +long SwRect::_Top() const{ return m_Point.getY(); } +long SwRect::_Bottom() const{ return m_Point.getY() + m_Size.getHeight(); } + +void SwRect::AddWidth( const long nAdd ) { m_Size.Width() += nAdd; } +void SwRect::AddHeight( const long nAdd ) { m_Size.Height() += nAdd; } +void SwRect::SubLeft( const long nSub ){ m_Size.Width() += nSub; m_Point.X() -= nSub; } +void SwRect::AddRight( const long nAdd ){ m_Size.Width() += nAdd; } +void SwRect::SubTop( const long nSub ){ m_Size.Height() += nSub; m_Point.Y() -= nSub; } +void SwRect::AddBottom( const long nAdd ){ m_Size.Height() += nAdd; } +void SwRect::SetPosX( const long nNew ){ m_Point.setX(nNew); } +void SwRect::SetPosY( const long nNew ){ m_Point.setY(nNew); } const Size SwRect::_Size() const { return SSize(); } -const Size SwRect::SwappedSize() const { return Size( nHeight, nWidth ); } +const Size SwRect::SwappedSize() const { return Size( m_Size.getHeight(), m_Size.getWidth() ); } const Point SwRect::TopLeft() const { return Pos(); } -const Point SwRect::TopRight() const { return Point( nX + nWidth, nY ); } -const Point SwRect::BottomLeft() const { return Point( nX, nY + nHeight ); } +const Point SwRect::TopRight() const { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() ); } +const Point SwRect::BottomLeft() const { return Point( m_Point.getX(), m_Point.getY() + m_Size.getHeight() ); } const Point SwRect::BottomRight() const - { return Point( nX + nWidth, nY + nHeight ); } -long SwRect::GetLeftDistance( long nLimit ) const { return nX - nLimit; } -long SwRect::GetBottomDistance( long nLim ) const { return nLim - nY - nHeight;} -long SwRect::GetTopDistance( long nLimit ) const { return nY - nLimit; } -long SwRect::GetRightDistance( long nLim ) const { return nLim - nX - nWidth; } + { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() + m_Size.getHeight() ); } +long SwRect::GetLeftDistance( long nLimit ) const { return m_Point.getX() - nLimit; } +long SwRect::GetBottomDistance( long nLim ) const { return nLim - m_Point.getY() - m_Size.getHeight();} +long SwRect::GetTopDistance( long nLimit ) const { return m_Point.getY() - nLimit; } +long SwRect::GetRightDistance( long nLim ) const { return nLim - m_Point.getX() - m_Size.getWidth(); } BOOL SwRect::OverStepLeft( long nLimit ) const - { return nLimit > nX && nX + nWidth > nLimit; } + { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; } BOOL SwRect::OverStepBottom( long nLimit ) const - { return nLimit > nY && nY + nHeight > nLimit; } + { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; } BOOL SwRect::OverStepTop( long nLimit ) const - { return nLimit > nY && nY + nHeight > nLimit; } + { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; } BOOL SwRect::OverStepRight( long nLimit ) const - { return nLimit > nX && nX + nWidth > nLimit; } + { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; } void SwRect::SetLeftAndWidth( long nLeft, long nNew ) - { nX = nLeft; nWidth = nNew; } +{ + m_Point.setX(nLeft); + m_Size.setWidth(nNew); +} void SwRect::SetTopAndHeight( long nTop, long nNew ) - { nY = nTop; nHeight = nNew; } +{ + m_Point.setY(nTop); + m_Size.setHeight(nNew); +} void SwRect::SetRightAndWidth( long nRight, long nNew ) - { nX = nRight - nNew; nWidth = nNew; } +{ + m_Point.setX(nRight - nNew); + m_Size.setWidth(nNew); +} void SwRect::SetBottomAndHeight( long nBottom, long nNew ) - { nY = nBottom - nNew; nHeight = nNew; } +{ + m_Point.setY(nBottom - nNew); + m_Size.setHeight(nNew); +} void SwRect::SetUpperLeftCorner( const Point& rNew ) - { nX = rNew.nA; nY = rNew.nB; } + { m_Point = rNew; } void SwRect::SetUpperRightCorner( const Point& rNew ) - { nX = rNew.nA - nWidth; nY = rNew.nB; } + { m_Point = Point(rNew.nA - m_Size.getWidth(), rNew.nB); } void SwRect::SetLowerLeftCorner( const Point& rNew ) - { nX = rNew.nA; nY = rNew.nB - nHeight; } + { m_Point = Point(rNew.nA, rNew.nB - m_Size.getHeight()); } #ifndef PRODUCT /************************************************************************* diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx index f0ee36b12a..d2926f6d7e 100644 --- a/sw/source/core/bastyp/swregion.cxx +++ b/sw/source/core/bastyp/swregion.cxx @@ -117,7 +117,7 @@ void SwRegionRects::operator-=( const SwRect &rRect ) if ( 0 < (nTmp = aInter.Top() - aTmp.Top()) ) { const long nOldVal = aTmp.Height(); - aTmp.SSize().Height() = nTmp; + aTmp.Height(nTmp); InsertRect( aTmp, i, bDel ); aTmp.Height( nOldVal ); } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index d5fc2798c6..f731b853d2 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -106,6 +106,8 @@ #include <SwUndoFmt.hxx> #include <unocrsr.hxx> #include <docsh.hxx> +#include <docufld.hxx> + #include <vector> #include <osl/diagnose.h> @@ -1066,6 +1068,24 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat ) } } + // #i93174#: notes contain paragraphs that are not nodes + { + SwFieldType * const pPostits( GetSysFldType(RES_POSTITFLD) ); + SwClientIter aIter(*pPostits); + SwFmtFld const * pFmtFld = + static_cast<SwFmtFld const*>(aIter.First( TYPE(SwFmtFld) )); + while (pFmtFld) + { + if (pFmtFld->IsFldInDoc()) + { + SwPostItField const * const pField( + static_cast<SwPostItField const*>(pFmtFld->GetFld())); + rStat.nAllPara += pField->GetNumberOfParagraphs(); + } + pFmtFld = static_cast<SwFmtFld const*>(aIter.Next()); + } + } + rStat.nPage = GetRootFrm() ? GetRootFrm()->GetPageNum() : 0; rStat.bModified = FALSE; SetDocStat( rStat ); @@ -1091,12 +1111,21 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat ) aStat[n++].Value <<= (sal_Int32)rStat.nChar; // For e.g. autotext documents there is no pSwgInfo (#i79945) - if (GetDocShell()) { - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetDocShell()->GetModel(), uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentProperties> xDocProps( + SfxObjectShell * const pObjShell( GetDocShell() ); + if (pObjShell) + { + const uno::Reference<document::XDocumentPropertiesSupplier> xDPS( + pObjShell->GetModel(), uno::UNO_QUERY_THROW); + const uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties()); + // #i96786#: do not set modified flag when updating statistics + const bool bDocWasModified( IsModified() ); + const ModifyBlocker_Impl b(pObjShell); xDocProps->setDocumentStatistics(aStat); + if (!bDocWasModified) + { + ResetModified(); + } } // event. Stat. Felder Updaten diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index fff14d4ed3..4b8b41ec55 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -625,7 +625,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, (RES_TXTATR_CHARFMT == nWhich) || (RES_TXTATR_INETFMT == nWhich) || (RES_TXTATR_AUTOFMT == nWhich) || - isUNKNOWNATR(nWhich) ) + (RES_TXTATR_UNKNOWN_CONTAINER == nWhich) ) { pCharSet = &rChgSet; bCharAttr = true; @@ -636,7 +636,8 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, || isPARATR_LIST(nWhich) // <-- || isFRMATR(nWhich) - || isGRFATR(nWhich) ) + || isGRFATR(nWhich) + || isUNKNOWNATR(nWhich) ) { pOtherSet = &rChgSet; bOtherAttr = true; @@ -653,7 +654,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, RES_TXTATR_AUTOFMT, RES_TXTATR_AUTOFMT, RES_TXTATR_INETFMT, RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT, - RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, + RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER, 0 ); SfxItemSet* pTmpOtherItemSet = new SfxItemSet( pDoc->GetAttrPool(), @@ -663,6 +664,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, // <-- RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_GRFATR_BEGIN, RES_GRFATR_END-1, + RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, 0 ); pTmpCharItemSet->Put( rChgSet ); @@ -755,7 +757,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, SfxItemSet aTxtSet( pDoc->GetAttrPool(), RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK, RES_TXTATR_META, RES_TXTATR_METAFIELD, - RES_TXTATR_CJK_RUBY, RES_TXTATR_WITHEND_END-1, + RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY, 0 ); aTxtSet.Put( rChgSet ); diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 75d0dd1faa..1c325a296d 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -309,7 +309,8 @@ Verhalten von Delete-Redline: bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) { -#ifndef PRODUCT +#if 0 +// #i93179# disabled: ASSERT in ~SwIndexReg #ifndef PRODUCT SwRedline aCopy( *pNewRedl ); #endif _CHECK_REDLINE( this ) diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 5414b72869..752b146b9f 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -386,7 +386,7 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) { if( bUndo ) { - pRedlUndo = new SwUndoRedlineSort( rPaM, rOpt ); + pRedlUndo = new SwUndoRedlineSort( *pRedlPam,rOpt ); DoUndo( FALSE ); } // erst den Bereich kopieren, dann @@ -471,20 +471,36 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) AppendUndo( pRedlUndo ); } - // nBeg ist der Start vom sortierten Bereich + // nBeg is start of sorted range SwNodeIndex aSttIdx( GetNodes(), nBeg ); - // der Kopierte Bereich ist das Geloeschte - AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, *pRedlPam ), true); + // the copied range is deleted + SwRedline *const pDeleteRedline( + new SwRedline( nsRedlineType_t::REDLINE_DELETE, *pRedlPam )); - // das sortierte ist das Eingefuegte + // pRedlPam points to nodes that may be deleted (hidden) by + // AppendRedline, so adjust it beforehand to prevent ASSERT pRedlPam->GetPoint()->nNode = aSttIdx; SwCntntNode* pCNd = aSttIdx.GetNode().GetCntntNode(); pRedlPam->GetPoint()->nContent.Assign( pCNd, 0 ); + AppendRedline(pDeleteRedline, true); + + // the sorted range is inserted AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlPam ), true); if( pRedlUndo ) + { + SwNodeIndex aInsEndIdx( pRedlPam->GetMark()->nNode, -1 ); + pRedlPam->GetMark()->nNode = aInsEndIdx; + SwCntntNode *const pPrevNode = + pRedlPam->GetMark()->nNode.GetNode().GetCntntNode(); + pRedlPam->GetMark()->nContent.Assign( pPrevNode, pPrevNode->Len() ); + + pRedlUndo->SetValues( *pRedlPam ); + } + + if( pRedlUndo ) pRedlUndo->SetOffset( aSttIdx ); delete pRedlPam, pRedlPam = 0; diff --git a/sw/source/core/doc/docstat.cxx b/sw/source/core/doc/docstat.cxx index 6ebc2d9a8f..8455adb859 100644 --- a/sw/source/core/doc/docstat.cxx +++ b/sw/source/core/doc/docstat.cxx @@ -45,10 +45,10 @@ SwDocStat::SwDocStat() : nOLE(0), nPage(1), nPara(1), + nAllPara(1), nWord(0), nChar(0), - bModified(TRUE), - pInternStat(0) + bModified(TRUE) {} /************************************************************************ @@ -62,9 +62,9 @@ void SwDocStat::Reset() nOLE = 0; nPage = 1; nPara = 1; + nAllPara= 1; nWord = 0; nChar = 0; bModified = TRUE; - pInternStat = 0; } diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx index fea0cd217c..8b173a1221 100644 --- a/sw/source/core/docnode/swthreadmanager.cxx +++ b/sw/source/core/docnode/swthreadmanager.cxx @@ -39,35 +39,29 @@ @author OD */ -SwThreadManager* SwThreadManager::mpThreadManager = 0; -osl::Mutex* SwThreadManager::mpGetManagerMutex = new osl::Mutex(); +bool SwThreadManager::mbThreadManagerInstantiated = false; SwThreadManager::SwThreadManager() : mpThreadManagerImpl( new ThreadManager( SwThreadJoiner::GetThreadJoiner() ) ) { mpThreadManagerImpl->Init(); + mbThreadManagerInstantiated = true; } SwThreadManager::~SwThreadManager() { - delete mpThreadManagerImpl; } +struct InitInstance : public rtl::Static<SwThreadManager, InitInstance> {}; + SwThreadManager& SwThreadManager::GetThreadManager() { - osl::MutexGuard aGuard(*mpGetManagerMutex); - - if ( mpThreadManager == 0 ) - { - mpThreadManager = new SwThreadManager(); - } - - return *mpThreadManager; + return InitInstance::get(); } bool SwThreadManager::ExistsThreadManager() { - return (mpThreadManager != 0); + return mbThreadManagerInstantiated; } oslInterlockedCount SwThreadManager::AddThread( const rtl::Reference< ObservableThread >& rThread ) diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index d5204f1c1d..3d54971e41 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1132,7 +1132,7 @@ String SwDocInfoField::Expand() const uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties()); uno::Reference < beans::XPropertySet > xSet( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); uno::Reference < beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo(); - + uno::Any aAny; if( xSetInfo->hasPropertyByName( aName ) ) aAny = xSet->getPropertyValue( aName ); @@ -1147,16 +1147,9 @@ String SwDocInfoField::Expand() const ->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), uno::UNO_QUERY ); uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING ); aNew >>= sVal; - ((SwDocInfoField*)this)->aContent = sVal; + const_cast<SwDocInfoField*>(this)->aContent = sVal; } } - else - { - // property is "void" - means it has not been added until now - do it! - aAny <<= ::rtl::OUString(aContent); - uno::Reference < beans::XPropertyContainer > xCont( xSet, uno::UNO_QUERY ); - xCont->addProperty( aName, ::com::sun::star::beans::PropertyAttribute::REMOVEABLE, aAny ); - } } catch (uno::Exception&) {} } @@ -1877,6 +1870,11 @@ void SwPostItField::SetTextObject( OutlinerParaObject* pText ) mpText = pText; } +sal_uInt32 SwPostItField::GetNumberOfParagraphs() const +{ + return (mpText) ? mpText->Count() : 1; +} + /*-----------------05.03.98 13:42------------------- --------------------------------------------------*/ diff --git a/sw/source/core/inc/swthreadmanager.hxx b/sw/source/core/inc/swthreadmanager.hxx index 7ec4df7585..1029efb217 100644 --- a/sw/source/core/inc/swthreadmanager.hxx +++ b/sw/source/core/inc/swthreadmanager.hxx @@ -34,6 +34,10 @@ #include <osl/mutex.hxx> #include <rtl/ref.hxx> +#include <boost/utility.hpp> +#include <memory> + + class ObservableThread; class ThreadManager; @@ -45,6 +49,7 @@ class ThreadManager; @author OD */ class SwThreadManager + : private ::boost::noncopyable { public: @@ -52,6 +57,9 @@ class SwThreadManager static bool ExistsThreadManager(); + // private: don't call! + SwThreadManager(); + // private: don't call! ~SwThreadManager(); oslInterlockedCount AddThread( const rtl::Reference< ObservableThread >& rThread ); @@ -76,12 +84,9 @@ class SwThreadManager bool StartingOfThreadsSuspended(); private: - static SwThreadManager* mpThreadManager; - static osl::Mutex* mpGetManagerMutex; + static bool mbThreadManagerInstantiated; - ThreadManager* mpThreadManagerImpl; - - SwThreadManager(); + ::std::auto_ptr<ThreadManager> mpThreadManagerImpl; }; #endif diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index 4ac576d66a..4e89d45a19 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -523,13 +523,11 @@ void SwAttrHandler::PushAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ) { - ASSERT( rItem.Which() < RES_TXTATR_WITHEND_END || - RES_UNKNOWNATR_CONTAINER == rItem.Which() , + ASSERT( rItem.Which() < RES_TXTATR_WITHEND_END, "I do not want this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); // robust - if ( RES_TXTATR_WITHEND_END <= rItem.Which() || - RES_UNKNOWNATR_CONTAINER == rItem.Which() ) + if ( RES_TXTATR_WITHEND_END <= rItem.Which() ) return sal_False; USHORT nStack = StackPos[ rItem.Which() ]; @@ -557,6 +555,9 @@ sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ) void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) { + if ( RES_TXTATR_WITHEND_END <= rAttr.Which() ) + return; // robust + // these special attributes in fact represent a collection of attributes // they have to be removed from each stack they belong to if ( RES_TXTATR_INETFMT == rAttr.Which() || @@ -583,7 +584,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) } // this is the usual case, we have a basic attribute, remove it from the // stack and reset the font - else if ( RES_UNKNOWNATR_CONTAINER != rAttr.Which() ) + else { aAttrStack[ StackPos[ rAttr.Which() ] ].Remove( rAttr ); // reset font according to attribute on top of stack @@ -600,13 +601,13 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) void SwAttrHandler::Pop( const SwTxtAttr& rAttr ) { - ASSERT( rAttr.Which() < RES_TXTATR_WITHEND_END || - RES_UNKNOWNATR_CONTAINER == rAttr.Which() , + ASSERT( rAttr.Which() < RES_TXTATR_WITHEND_END, "I do not have this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); - if ( RES_UNKNOWNATR_CONTAINER != rAttr.Which() && - rAttr.Which() < RES_TXTATR_WITHEND_END ) + if ( rAttr.Which() < RES_TXTATR_WITHEND_END ) + { aAttrStack[ StackPos[ rAttr.Which() ] ].Remove( rAttr ); + } } /************************************************************************* diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 6f83edd429..114c5b4e92 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -386,7 +386,9 @@ USHORT SwFntObj::GetFontHeight( const ViewShell* pSh, const OutputDevice& rOut ) const FontMetric aOutMet( rRefDev.GetFontMetric() ); long nTmpPrtHeight = (USHORT)aOutMet.GetAscent() + aOutMet.GetDescent(); (void) nTmpPrtHeight; - ASSERT( nTmpPrtHeight == nPrtHeight, "GetTextHeight != Ascent + Descent" ) + // #i106098#: do not compare with == here due to rounding error + ASSERT( abs(nTmpPrtHeight - nPrtHeight) < 3, + "GetTextHeight != Ascent + Descent" ); #endif ((OutputDevice&)rRefDev).SetFont( aOldFnt ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 7930190ffa..1b0744a177 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -943,9 +943,7 @@ void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen, bool bNoExp = false; bool bResort = false; const USHORT coArrSz = static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) + - static_cast<USHORT>(RES_UNKNOWNATR_END) - - static_cast<USHORT>(RES_UNKNOWNATR_BEGIN); + static_cast<USHORT>(RES_CHRATR_BEGIN); BOOL aDontExp[ coArrSz ]; memset( &aDontExp, 0, coArrSz * sizeof(BOOL) ); @@ -980,14 +978,6 @@ void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen, nWhPos = static_cast<USHORT>(nWhich - RES_CHRATR_BEGIN); } - else if (isUNKNOWNATR(nWhich)) - { - nWhPos = static_cast<USHORT>( - nWhich - - static_cast<USHORT>(RES_UNKNOWNATR_BEGIN) + - static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) ); - } else continue; diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 7bd02bf4e4..8aa1e690dd 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1065,11 +1065,6 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr, case RES_TXTATR_TOXMARK: pNew = new SwTxtTOXMark( (SwTOXMark&)rNew, nStt, &nEnd ); break; - case RES_UNKNOWNATR_CONTAINER: - case RES_TXTATR_UNKNOWN_CONTAINER: - pNew = new SwTxtXMLAttrContainer( (SvXMLAttrContainerItem&)rNew, - nStt, nEnd ); - break; case RES_TXTATR_CJK_RUBY: pNew = new SwTxtRuby( (SwFmtRuby&)rNew, nStt, nEnd ); break; @@ -1669,8 +1664,7 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, SfxItemSet aCharSet( *rSet.GetPool(), aCharAutoFmtSetRange ); - USHORT nWhich, nCount = 0; - SwTxtAttr* pNew; + USHORT nCount = 0; SfxItemIter aIter( *pSet ); const SfxPoolItem* pItem = aIter.GetCurItem(); @@ -1678,8 +1672,10 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, { if ( pItem && (reinterpret_cast<SfxPoolItem*>(-1) != pItem)) { - nWhich = pItem->Which(); - if ( isCHRATR(nWhich) || isTXTATR(nWhich) || isUNKNOWNATR(nWhich) ) + const USHORT nWhich = pItem->Which(); + ASSERT( isCHRATR(nWhich) || isTXTATR(nWhich), + "SwTxtNode::SetAttr(): unknown attribute" ); + if ( isCHRATR(nWhich) || isTXTATR(nWhich) ) { if ((RES_TXTATR_CHARFMT == nWhich) && (GetDoc()->GetDfltCharFmt() == @@ -1698,7 +1694,8 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, } else { - pNew = MakeTxtAttr( *GetDoc(), + + SwTxtAttr *const pNew = MakeTxtAttr( *GetDoc(), const_cast<SfxPoolItem&>(*pItem), nStt, nEnd ); if ( pNew ) { @@ -1862,20 +1859,18 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, } const USHORT nSize = m_pSwpHints->Count(); - USHORT n; - xub_StrLen nAttrStart; - const xub_StrLen* pAttrEnd; if( nStt == nEnd ) // kein Bereich: { - for( n = 0; n < nSize; ++n ) // + for (USHORT n = 0; n < nSize; ++n) { const SwTxtAttr* pHt = (*m_pSwpHints)[n]; - nAttrStart = *pHt->GetStart(); + const xub_StrLen nAttrStart = *pHt->GetStart(); if( nAttrStart > nEnd ) // ueber den Bereich hinaus break; - if( 0 == ( pAttrEnd = pHt->GetEnd() )) // nie Attribute ohne Ende + const xub_StrLen* pAttrEnd = pHt->GetEnd(); + if ( ! pAttrEnd ) // no attributes without end continue; if( ( nAttrStart < nStt && @@ -1889,22 +1884,21 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, else // es ist ein Bereich definiert { // --> FME 2007-03-13 #i75299# - std::vector< SwPoolItemEndPair >* pAttrArr = 0; + ::std::auto_ptr< std::vector< SwPoolItemEndPair > > pAttrArr; // <-- const USHORT coArrSz = static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) + - static_cast<USHORT>(RES_UNKNOWNATR_END) - - static_cast<USHORT>(RES_UNKNOWNATR_BEGIN); + static_cast<USHORT>(RES_CHRATR_BEGIN); - for( n = 0; n < nSize; ++n ) + for (USHORT n = 0; n < nSize; ++n) { const SwTxtAttr* pHt = (*m_pSwpHints)[n]; - nAttrStart = *pHt->GetStart(); + const xub_StrLen nAttrStart = *pHt->GetStart(); if( nAttrStart > nEnd ) // ueber den Bereich hinaus break; - if( 0 == ( pAttrEnd = pHt->GetEnd() )) // nie Attribute ohne Ende + const xub_StrLen* pAttrEnd = pHt->GetEnd(); + if ( ! pAttrEnd ) // no attributes without end continue; BOOL bChkInvalid = FALSE; @@ -1927,7 +1921,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, if( bChkInvalid ) { // uneindeutig ? - SfxItemIter* pItemIter = 0; + ::std::auto_ptr< SfxItemIter > pItemIter; const SfxPoolItem* pItem = 0; if ( RES_TXTATR_AUTOFMT == pHt->Which() ) @@ -1935,7 +1929,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, const SfxItemSet* pAutoSet = CharFmt::GetItemSet( pHt->GetAttr() ); if ( pAutoSet ) { - pItemIter = new SfxItemIter( *pAutoSet ); + pItemIter.reset( new SfxItemIter( *pAutoSet ) ); pItem = pItemIter->GetCurItem(); } } @@ -1947,9 +1941,14 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, while ( pItem ) { const USHORT nHintWhich = pItem->Which(); + ASSERT(!isUNKNOWNATR(nHintWhich), + "SwTxtNode::GetAttr(): unkonwn attribute?"); - if( !pAttrArr ) - pAttrArr = new std::vector< SwPoolItemEndPair >( coArrSz ); + if ( !pAttrArr.get() ) + { + pAttrArr.reset( + new std::vector< SwPoolItemEndPair >(coArrSz)); + } std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin(); if (isCHRATR(nHintWhich) || @@ -1957,12 +1956,6 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, { pPrev += nHintWhich - RES_CHRATR_BEGIN; } - else if (isUNKNOWNATR(nHintWhich)) - { - pPrev += nHintWhich - RES_UNKNOWNATR_BEGIN + ( - static_cast< USHORT >(RES_TXTATR_WITHEND_END) - - static_cast< USHORT >(RES_CHRATR_BEGIN) ); - } else { pPrev = pAttrArr->end(); @@ -2006,28 +1999,21 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, } } - pItem = ( pItemIter && !pItemIter->IsAtEnd() ) ? pItemIter->NextItem() : 0; + pItem = ( pItemIter.get() && !pItemIter->IsAtEnd() ) + ? pItemIter->NextItem() : 0; } // end while - - delete pItemIter; } } - if( pAttrArr ) + if ( pAttrArr.get() ) { - for( n = 0; n < coArrSz; ++n ) + for (USHORT n = 0; n < coArrSz; ++n) { const SwPoolItemEndPair& rItemPair = (*pAttrArr)[ n ]; if( (0 != rItemPair.mpItem) && ((SfxPoolItem*)-1 != rItemPair.mpItem) ) { - USHORT nWh; - if( n < static_cast<USHORT>( static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) ) ) - nWh = static_cast<USHORT>(n + RES_CHRATR_BEGIN); - else - nWh = n - static_cast<USHORT>( static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) + - static_cast<USHORT>(RES_UNKNOWNATR_BEGIN) ); + const USHORT nWh = + static_cast<USHORT>(n + RES_CHRATR_BEGIN); if( nEnd <= rItemPair.mnEndPos ) // hinter oder genau Ende { @@ -2039,8 +2025,6 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, rSet.InvalidateItem( nWh ); } } - - delete pAttrArr; } } if( aFmtSet.Count() ) diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index f500d28596..d9d94b05b2 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -31,7 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> #include <hints.hxx> #include <sfx2/objsh.hxx> @@ -52,13 +51,6 @@ TYPEINIT1(SwTxtINetFmt,SwClient); TYPEINIT1(SwTxtRuby,SwClient); -// ATT_XMLCONTAINERITEM ****************************** - -SwTxtXMLAttrContainer::SwTxtXMLAttrContainer( - SvXMLAttrContainerItem& rAttr, - xub_StrLen nStt, xub_StrLen nEnde ) - : SwTxtAttrEnd( rAttr, nStt, nEnde ) -{} /************************************************************************* * class SwTxtCharFmt diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index db2743218f..15f98f4d1f 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1676,6 +1676,7 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, void SwTxtNode::CountWords( SwDocStat& rStat, xub_StrLen nStt, xub_StrLen nEnd ) const { + ++rStat.nAllPara; // #i93174#: count _all_ paragraphs if( nStt < nEnd ) { if ( !IsHidden() ) diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 44ac5f49c4..72da13fe5a 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -833,7 +833,7 @@ SwHistoryResetAttrSet::SwHistoryResetAttrSet( const SfxItemSet& rSet, , m_Array( (BYTE)rSet.Count() ) { SfxItemIter aIter( rSet ); - bool bAutoStyle = true; + bool bAutoStyle = false; while( TRUE ) { diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 38a83445c5..9338e5fbc5 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -666,14 +666,9 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, { if( !pHistory ) pHistory = new SwHistory; - if( pAPos->nNode < pEnd->nNode && - ( ( nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType ) || - ( pStt->nNode < pAPos->nNode || !pStt->nContent.GetIndex() ) ) ) + if (IsDestroyFrameAnchoredAtChar( + *pAPos, *pStt, *pEnd, nDelCntntType)) { - // Here we identified the objects to destroy: - // - anchored between start and end of the selection - // - anchored in start of the selection with "CheckNoContent" - // - anchored in start of sel. and the selection start at pos 0 pHistory->Add( *pFmt, nChainInsPos ); n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1; } @@ -1388,3 +1383,20 @@ String DenoteSpecialCharacters(const String & rStr) return aResult; } + +bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos, + SwPosition const & rStart, SwPosition const & rEnd, + DelCntntType const nDelCntntType) +{ + + // Here we identified the objects to destroy: + // - anchored between start and end of the selection + // - anchored in start of the selection with "CheckNoContent" + // - anchored in start of sel. and the selection start at pos 0 + return (rAnchorPos.nNode < rEnd.nNode) + && ( (nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType) + || (rStart.nNode < rAnchorPos.nNode) + || !rStart.nContent.GetIndex() + ); +} + diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 944e239daf..8ce47d86dc 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -247,6 +247,12 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter ) // im aSaveRange steht der kopierte, sprich der originale. SwDoc& rDoc = rIter.GetDoc(); + SwPosition* pStart = rIter.pAktPam->Start(); + SwPosition* pEnd = rIter.pAktPam->End(); + + SwNodeIndex aPrevIdx( pStart->nNode, -1 ); + ULONG nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); + if( 0 == ( nsRedlineMode_t::REDLINE_SHOW_DELETE & rDoc.GetRedlineMode()) ) { // die beiden Redline Objecte suchen und diese dann anzeigen lassen, @@ -254,17 +260,17 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter ) // das Geloeschte ist versteckt, also suche das INSERT // Redline Object. Dahinter steht das Geloeschte USHORT nFnd = rDoc.GetRedlinePos( - *rDoc.GetNodes()[ nSttNode + nOffset + 1 ], + *rDoc.GetNodes()[ nSttNode + 1 ], nsRedlineType_t::REDLINE_INSERT ); ASSERT( USHRT_MAX != nFnd && nFnd+1 < rDoc.GetRedlineTbl().Count(), "kein Insert Object gefunden" ); ++nFnd; - rDoc.GetRedlineTbl()[nFnd]->Show(); - SetPaM( *rIter.pAktPam ); + rDoc.GetRedlineTbl()[nFnd]->Show( 1 ); } { SwPaM aTmp( *rIter.pAktPam->GetMark() ); + aTmp.GetMark()->nContent = 0; aTmp.SetMark(); aTmp.GetPoint()->nNode = nSaveEndNode; aTmp.GetPoint()->nContent.Assign( aTmp.GetCntntNode(), nSaveEndCntnt ); @@ -272,13 +278,52 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter ) } rDoc.DelFullPara( *rIter.pAktPam ); + + SwPaM* pPam = rIter.pAktPam; + pPam->DeleteMark(); + pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 ); + SwCntntNode* pCNd = pPam->GetCntntNode(); + pPam->GetPoint()->nContent.Assign(pCNd, 0 ); + pPam->SetMark(); + + pPam->GetPoint()->nNode += nOffsetTemp; + pCNd = pPam->GetCntntNode(); + pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); + + SetValues( *pPam ); + SetPaM( *rIter.pAktPam ); } void SwUndoRedlineSort::_Redo( SwUndoIter& rIter ) { SwPaM& rPam = *rIter.pAktPam; + + SwPaM* pPam = &rPam; + SwPosition* pStart = pPam->Start(); + SwPosition* pEnd = pPam->End(); + + SwNodeIndex aPrevIdx( pStart->nNode, -1 ); + ULONG nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); + xub_StrLen nCntStt = pStart->nContent.GetIndex(); + rIter.GetDoc().SortText( rPam, *pOpt ); + + pPam->DeleteMark(); + pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 ); + SwCntntNode* pCNd = pPam->GetCntntNode(); + xub_StrLen nLen = pCNd->Len(); + if( nLen > nCntStt ) + nLen = nCntStt; + pPam->GetPoint()->nContent.Assign(pCNd, nLen ); + pPam->SetMark(); + + pPam->GetPoint()->nNode += nOffsetTemp; + pCNd = pPam->GetCntntNode(); + pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); + + SetValues( rPam ); + SetPaM( rPam ); rPam.GetPoint()->nNode = nSaveEndNode; rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), nSaveEndCntnt ); diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 8671230214..d59d33988b 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -719,10 +719,6 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: aResult.Result = beans::TolerantPropertySetResultType::SUCCESS; aResultVector.push_back( aResult ); } - // this assertion should never occur! - DBG_ASSERT( !aResultVector.size() || aResult.Result != beans::TolerantPropertySetResultType::UNKNOWN_FAILURE, - "unknown failure while retrieving property" ); - } } catch (beans::UnknownPropertyException &) diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 327bfd7c68..6809c389d1 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -831,7 +831,6 @@ lcl_ExportHints( case RES_TXTATR_AUTOFMT: case RES_TXTATR_INETFMT: case RES_TXTATR_CHARFMT: - case RES_TXTATR_UNKNOWN_CONTAINER: break; // these are handled as properties of a "Text" portion default: DBG_ERROR("unknown attribute"); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 8182f28e59..3e8ae6d726 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -158,7 +158,7 @@ ULONG SwReader::Read( const Reader& rOptions ) SwNodeIndex aSplitIdx( pDoc->GetNodes() ); RedlineMode_t eOld = pDoc->GetRedlineMode(); - pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); + RedlineMode_t ePostReadRedlineMode( nsRedlineMode_t::REDLINE_IGNORE ); // Array von FlyFormaten SwSpzFrmFmts aFlyFrmArr; @@ -170,6 +170,8 @@ ULONG SwReader::Read( const Reader& rOptions ) if( bSaveUndo ) pUndo = new SwUndoInsDoc( *pPam ); + pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); + SwPaM* pUndoPam = 0; if( bDocUndo || pCrsr ) { @@ -190,8 +192,15 @@ ULONG SwReader::Read( const Reader& rOptions ) xub_StrLen nEndCntnt = pCNd ? pCNd->Len() - nSttCntnt : 0; SwNodeIndex aEndPos( pPam->GetPoint()->nNode, 1 ); + pDoc->SetRedlineMode_intern( eOld ); + nError = po->Read( *pDoc, GetBaseURL(), *pPam, aFileName ); + // an ODF document may contain redline mode in settings.xml; save it! + ePostReadRedlineMode = pDoc->GetRedlineMode(); + + pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); + if( !IsError( nError )) // dann setzen wir das Ende mal richtig { aEndPos--; @@ -230,13 +239,27 @@ ULONG SwReader::Read( const Reader& rOptions ) const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor(); if( USHRT_MAX == aFlyFrmArr.GetPos( pFrmFmt) ) { - if( FLY_PAGE == rAnchor.GetAnchorId() || - ( FLY_AT_CNTNT == rAnchor.GetAnchorId() && - rAnchor.GetCntntAnchor() && - ( pUndoPam->GetPoint()->nNode == - rAnchor.GetCntntAnchor()->nNode || - pUndoPam->GetMark()->nNode == - rAnchor.GetCntntAnchor()->nNode ) ) ) + SwPosition const*const pFrameAnchor( + rAnchor.GetCntntAnchor()); + if ( (FLY_PAGE == rAnchor.GetAnchorId()) + || ( pFrameAnchor + && ( ( (FLY_AT_CNTNT == rAnchor.GetAnchorId()) + && ( (pUndoPam->GetPoint()->nNode == + pFrameAnchor->nNode) + || (pUndoPam->GetMark()->nNode == + pFrameAnchor->nNode) + ) + ) + // #i97570# also check frames anchored AT char + || ( (FLY_AUTO_CNTNT == rAnchor.GetAnchorId()) + && !IsDestroyFrameAnchoredAtChar( + *pFrameAnchor, + *pUndoPam->GetPoint(), + *pUndoPam->GetMark()) + ) + ) + ) + ) { if( bChkHeaderFooter && FLY_AT_CNTNT == rAnchor.GetAnchorId() && @@ -351,7 +374,9 @@ ULONG SwReader::Read( const Reader& rOptions ) pDoc->UpdateLinks( TRUE ); // <-- - eOld = (RedlineMode_t)(pDoc->GetRedlineMode() & ~nsRedlineMode_t::REDLINE_IGNORE); + // not insert: set the redline mode read from settings.xml + eOld = static_cast<RedlineMode_t>( + ePostReadRedlineMode & ~nsRedlineMode_t::REDLINE_IGNORE); pDoc->SetFieldsDirty(false, NULL, 0); } diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index f2ec2a722d..25544a79c5 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -41,13 +41,9 @@ #include <com/sun/star/xforms/XFormsSupplier.hpp> #include <svx/svdmodel.hxx> #include <svx/svdpage.hxx> -#ifndef _XMLGRHLP_HXX -#ifndef _XMLGRHLP_HXX #include <svx/xmlgrhlp.hxx> -#endif #include <svx/xmleohlp.hxx> #include <svx/xmlgrhlp.hxx> -#endif #include <svx/eeitem.hxx> #include <svx/svddef.hxx> #include <xmloff/nmspmap.hxx> @@ -66,9 +62,7 @@ #include <xmltexte.hxx> #include <xmlexp.hxx> #include <sfx2/viewsh.hxx> -#ifndef _COMPHELPER_PROCESSFACTORYHXX_ #include <comphelper/processfactory.hxx> -#endif #include <docary.hxx> #include <svx/unolingu.hxx> #include <svx/forbiddencharacterstable.hxx> @@ -326,13 +320,15 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) // figures given above // The styles in pDoc also count the default style that never // gets exported -> subtract one. - sal_Int32 nRef = 1; + sal_Int32 nRef = 1; // meta.xml nRef += pDoc->GetCharFmts()->Count() - 1; nRef += pDoc->GetFrmFmts()->Count() - 1; nRef += pDoc->GetTxtFmtColls()->Count() - 1; // nRef += pDoc->GetPageDescCnt(); - nRef += aDocStat.nPara; - pProgress->SetReference( 2*nRef ); + nRef *= 2; // for the above styles, xmloff will increment by 2! + // #i93174#: count all paragraphs for the progress bar + nRef += aDocStat.nAllPara; // 1: only content, no autostyle + pProgress->SetReference( nRef ); pProgress->SetValue( 0 ); } } diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index 84a39dd84b..a561791253 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -38,16 +38,11 @@ #include "xmlexpit.hxx" #include <xmloff/nmspmap.hxx> #include <xmloff/XMLTextListAutoStylePool.hxx> -#ifndef _XMLOFF_XMLTEXTMASTERPAGEEXPORT #include <xmloff/XMLTextMasterPageExport.hxx> -#endif -#ifndef _XMLOFF_TXTPRMAP_HXX #include <xmloff/txtprmap.hxx> -#endif #include <xmloff/xmlaustp.hxx> #include <xmloff/families.hxx> -#include <xmloff/ProgressBarHelper.hxx> #include <format.hxx> #include <fmtpdsc.hxx> #include <pagedesc.hxx> @@ -58,6 +53,7 @@ #include "xmlexp.hxx" #include <SwStyleNameMapper.hxx> + using ::rtl::OUString; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; |