From bfb9c45c4b685979f0c30259c75f9b4e0145be2d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 9 Oct 2009 11:17:39 +0200 Subject: #i100658#: SwDocInfoField::Expand(): do not add properties that are not found --- sw/source/core/fields/docufld.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index d5204f1c1d..926d676e2a 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 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(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&) {} } -- cgit v1.2.3 From 5fb9b55ba43167de8fef3e81dee621f04ee83461 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 9 Oct 2009 11:18:24 +0200 Subject: #i96786#: SwDoc::UpdateDocStat(): do not set modified flag on Doc/Shell --- sw/source/core/doc/doc.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 3eb6ffbf62..42efe798b2 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1091,12 +1091,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 xDPS( - GetDocShell()->GetModel(), uno::UNO_QUERY_THROW); - uno::Reference xDocProps( + SfxObjectShell * const pObjShell( GetDocShell() ); + if (pObjShell) + { + const uno::Reference xDPS( + pObjShell->GetModel(), uno::UNO_QUERY_THROW); + const uno::Reference 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 -- cgit v1.2.3 From daad365c6e5c1bc7d177728358f6d8a609044602 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 9 Oct 2009 11:24:38 +0200 Subject: #i97384#: apply patch from majun51 --- sw/source/filter/basflt/shellio.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 8182f28e59..2d8c1e4368 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -158,7 +158,6 @@ ULONG SwReader::Read( const Reader& rOptions ) SwNodeIndex aSplitIdx( pDoc->GetNodes() ); RedlineMode_t eOld = pDoc->GetRedlineMode(); - pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); // Array von FlyFormaten SwSpzFrmFmts aFlyFrmArr; @@ -170,6 +169,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 +191,12 @@ 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 ); + pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); + if( !IsError( nError )) // dann setzen wir das Ende mal richtig { aEndPos--; -- cgit v1.2.3 From 8c9e849a90a957dba0ede272212cefa551391c12 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 16 Oct 2009 15:49:11 +0200 Subject: #i93179#: fix ASSERT triggered by debug code --- sw/source/core/doc/docredln.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sw/source') 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 ) -- cgit v1.2.3 From 65f74b1a17cc502578fc26585c6433e50ae28c09 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 20 Oct 2009 17:14:56 +0200 Subject: #i106098#: SwFntObj::GetFontHeight(): make ASSERT rounding-tolerant --- sw/source/core/txtnode/fntcache.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 6b8d098618..246eb00ef6 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 ); -- cgit v1.2.3 From 3fb34a77eba25f9924dd72577d6faec8a28a99a0 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 20 Oct 2009 19:25:59 +0200 Subject: #i93174#: fix progress bar reference for ODF export SwDocStat: add a counter for all paragraphs SwDocStat: remove unused SwInternStat member SwPostItField: add GetNumberOfParagraphs() SwDoc::UpdateDocStat(): count paragraphs in SwPostItFields (notes) SwTxtNode::CountWords(): count all paragraphs SwXMLExport::exportDoc(): count paragraphs only once, not twice --- sw/inc/docstat.hxx | 11 ++++------- sw/inc/docufld.hxx | 2 ++ sw/source/core/doc/doc.cxx | 20 ++++++++++++++++++++ sw/source/core/doc/docstat.cxx | 6 +++--- sw/source/core/fields/docufld.cxx | 5 +++++ sw/source/core/txtnode/txtedt.cxx | 1 + sw/source/filter/xml/xmlexp.cxx | 14 +++++--------- sw/source/filter/xml/xmlfmte.cxx | 6 +----- 8 files changed, 41 insertions(+), 24 deletions(-) (limited to 'sw/source') diff --git a/sw/inc/docstat.hxx b/sw/inc/docstat.hxx index ce641a9f23..bc7f8111fd 100644 --- a/sw/inc/docstat.hxx +++ b/sw/inc/docstat.hxx @@ -33,12 +33,6 @@ #include #include "swdllapi.h" -/////////////////////////////////////////////////////////////////////////// -// PRODUCT: struct SwInternStat ist nur fuer CORE Interne Statistics und -// hat nichts in einer ProductVersion zu suchen. -/////////////////////////////////////////////////////////////////////////// - -struct SwInternStat; struct SW_DLLPUBLIC SwDocStat { @@ -46,11 +40,14 @@ struct SW_DLLPUBLIC SwDocStat USHORT nGrf; USHORT nOLE; ULONG nPage; + /// paragraphs for document statistic: non-empty and non-hidden ones ULONG nPara; + /// all paragraphs, including empty/hidden ones + ULONG nAllPara; ULONG nWord; ULONG nChar; BOOL bModified; - SwInternStat* pInternStat; + SwDocStat(); void Reset(); }; diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 68219053da..181162ca24 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -548,6 +548,8 @@ public: const OutlinerParaObject* GetTextObject() const; void SetTextObject( OutlinerParaObject* pText ); + sal_uInt32 GetNumberOfParagraphs() const; + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nWhich ) const; virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nWhich ); virtual String GetDescription() const; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 42efe798b2..c4ddacd2ba 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -106,6 +106,8 @@ #include #include #include +#include + #include #include @@ -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(aIter.First( TYPE(SwFmtFld) )); + while (pFmtFld) + { + if (pFmtFld->IsFldInDoc()) + { + SwPostItField const * const pField( + static_cast(pFmtFld->GetFld())); + rStat.nAllPara += pField->GetNumberOfParagraphs(); + } + pFmtFld = static_cast(aIter.Next()); + } + } + rStat.nPage = GetRootFrm() ? GetRootFrm()->GetPageNum() : 0; rStat.bModified = FALSE; SetDocStat( rStat ); 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/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 926d676e2a..3d54971e41 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1870,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/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/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 #include #include -#ifndef _XMLGRHLP_HXX -#ifndef _XMLGRHLP_HXX #include -#endif #include #include -#endif #include #include #include @@ -66,9 +62,7 @@ #include #include #include -#ifndef _COMPHELPER_PROCESSFACTORYHXX_ #include -#endif #include #include #include @@ -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 #include -#ifndef _XMLOFF_XMLTEXTMASTERPAGEEXPORT #include -#endif -#ifndef _XMLOFF_TXTPRMAP_HXX #include -#endif #include #include -#include #include #include #include @@ -58,6 +53,7 @@ #include "xmlexp.hxx" #include + using ::rtl::OUString; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; -- cgit v1.2.3 From d5f5381641b1009d3de726a6fa333ffe6dc0fb6e Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 29 Oct 2009 13:31:29 +0100 Subject: #i91504#: apply patch from majun51 --- sw/source/core/doc/docsort.cxx | 13 ++++++++++- sw/source/core/undo/unredln.cxx | 51 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 4 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 5414b72869..31dc3ab4da 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 @@ -484,6 +484,17 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlPam ), true); + if( pRedlUndo ) + { + + SwNodeIndex aInsEndIdx( pRedlPam->GetMark()->nNode, -1 ); + pRedlPam->GetMark()->nNode = aInsEndIdx; + SwCntntNode* pCNd = pRedlPam->GetMark()->nNode.GetNode().GetCntntNode(); + pRedlPam->GetMark()->nContent.Assign( pCNd, pCNd->Len() ); + + pRedlUndo->SetValues( *pRedlPam ); + } + if( pRedlUndo ) pRedlUndo->SetOffset( aSttIdx ); 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 ); -- cgit v1.2.3 From cbf11ed0d64a73104686051fa5e0a39d0e0ae1a7 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 29 Oct 2009 13:36:21 +0100 Subject: #i91504#: SwDoc::SortText(): fix ASSERT from ~SwIndexReg() on creation of DELETE redline. fix warning on unxsoli4 (rename variable). --- sw/source/core/doc/docsort.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 31dc3ab4da..752b146b9f 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -471,26 +471,31 @@ 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* pCNd = pRedlPam->GetMark()->nNode.GetNode().GetCntntNode(); - pRedlPam->GetMark()->nContent.Assign( pCNd, pCNd->Len() ); + SwCntntNode *const pPrevNode = + pRedlPam->GetMark()->nNode.GetNode().GetCntntNode(); + pRedlPam->GetMark()->nContent.Assign( pPrevNode, pPrevNode->Len() ); pRedlUndo->SetValues( *pRedlPam ); } -- cgit v1.2.3 From 0391735e7f91176adba6b8ce6fb844285deab2fe Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 29 Oct 2009 18:48:25 +0100 Subject: #i105643#: apply patch from cmc --- sw/source/core/docnode/swthreadmanager.cxx | 21 ++++++++++----------- sw/source/core/inc/swthreadmanager.hxx | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx index fea0cd217c..d69410b9fd 100644 --- a/sw/source/core/docnode/swthreadmanager.cxx +++ b/sw/source/core/docnode/swthreadmanager.cxx @@ -39,13 +39,13 @@ @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() @@ -53,21 +53,20 @@ SwThreadManager::~SwThreadManager() delete mpThreadManagerImpl; } -SwThreadManager& SwThreadManager::GetThreadManager() -{ - osl::MutexGuard aGuard(*mpGetManagerMutex); - - if ( mpThreadManager == 0 ) - { - mpThreadManager = new SwThreadManager(); +struct InitInstance : public rtl::StaticWithInit { + SwThreadManager operator () () { + return SwThreadManager(); } +}; - return *mpThreadManager; +SwThreadManager& SwThreadManager::GetThreadManager() +{ + 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/inc/swthreadmanager.hxx b/sw/source/core/inc/swthreadmanager.hxx index 7ec4df7585..e0933be181 100644 --- a/sw/source/core/inc/swthreadmanager.hxx +++ b/sw/source/core/inc/swthreadmanager.hxx @@ -76,8 +76,8 @@ class SwThreadManager bool StartingOfThreadsSuspended(); private: - static SwThreadManager* mpThreadManager; - static osl::Mutex* mpGetManagerMutex; + static bool mbThreadManagerInstantiated; + friend struct InitInstance; ThreadManager* mpThreadManagerImpl; -- cgit v1.2.3 From bb84813f15c61941ebc6d0bcbb511edd82f69e5f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 29 Oct 2009 18:52:32 +0100 Subject: #i106401#: apply (slightly modified) patch from cmc --- sw/inc/swrect.hxx | 129 +++++++++++++++++-------------------- sw/source/core/bastyp/swrect.cxx | 119 ++++++++++++++++++---------------- sw/source/core/bastyp/swregion.cxx | 2 +- 3 files changed, 124 insertions(+), 126 deletions(-) (limited to 'sw/source') diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index 136eff0922..dd191916f8 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -35,10 +35,8 @@ class SvStream; class SwRect { - long nX; - long nY; - long nWidth; - long nHeight; + Point m_Point; + Size m_Size; public: @@ -177,137 +175,133 @@ typedef void (SwRect:: *SwRectSetPos)( const Point& ); //---------------------------------- Set-Methoden inline void SwRect::Chg( const Point& rNP, const Size &rNS ) { - nX = rNP.X(); nY = rNP.Y(); - nWidth = rNS.Width(); nHeight = rNS.Height(); + m_Point = rNP; + m_Size = rNS; } inline void SwRect::Pos( const Point& rNew ) { - nX = rNew.X(); nY = rNew.Y(); + m_Point = rNew; } inline void SwRect::Pos( const long nNewX, const long nNewY ) { - nX = nNewX; nY = nNewY; + m_Point.setX(nNewX); + m_Point.setY(nNewY); } inline void SwRect::SSize( const Size& rNew ) { - nWidth = rNew.Width(); nHeight = rNew.Height(); + m_Size = rNew; } inline void SwRect::SSize( const long nNewHeight, const long nNewWidth ) { - nWidth = nNewWidth; nHeight = nNewHeight; + m_Size.setWidth(nNewWidth); + m_Size.setHeight(nNewHeight); } inline void SwRect::Width( long nNew ) { - nWidth = nNew; + m_Size.setWidth(nNew); } inline void SwRect::Height( long nNew ) { - nHeight = nNew; + m_Size.setHeight(nNew); } inline void SwRect::Left( const long nLeft ) { - nWidth += nX - nLeft; - nX = nLeft; + m_Size.Width() += m_Point.getX() - nLeft; + m_Point.setX(nLeft); } inline void SwRect::Right( const long nRight ) { - nWidth = nRight - nX + 1; + m_Size.setWidth(nRight - m_Point.getX() + 1); } inline void SwRect::Top( const long nTop ) { - nHeight += nY - nTop; - nY = nTop; + m_Size.Height() += m_Point.getY() - nTop; + m_Point.setY(nTop); } inline void SwRect::Bottom( const long nBottom ) { - nHeight = nBottom - nY + 1; + m_Size.setHeight(nBottom - m_Point.getY() + 1); } //----------------------------------- Get-Methoden inline const Point &SwRect::Pos() const { - return *(Point*)(&nX); + return m_Point; } inline Point &SwRect::Pos() { - return *(Point*)(&nX); + return m_Point; } inline const Size &SwRect::SSize() const { - return *(Size*)(&nWidth); + return m_Size; } inline Size &SwRect::SSize() { - return *(Size*)(&nWidth); + return m_Size; } inline long SwRect::Width() const { - return nWidth; + return m_Size.Width(); } inline long SwRect::Height() const { - return nHeight; + return m_Size.Height(); } inline long SwRect::Left() const { - return nX; + return m_Point.X(); } inline long SwRect::Right() const { - return nWidth ? nX + nWidth - 1 : nX; + return m_Size.getWidth() ? m_Point.getX() + m_Size.getWidth() - 1 : m_Point.getX(); } inline long SwRect::Top() const { - return nY; + return m_Point.Y(); } inline long SwRect::Bottom() const { - return nHeight ? nY + nHeight - 1 : nY; + return m_Size.getHeight() ? m_Point.getY() + m_Size.getHeight() - 1 : m_Point.getY(); } //----------------------------------- operatoren inline SwRect &SwRect::operator = ( const SwRect &rRect ) { - nX = rRect.Left(); - nY = rRect.Top(); - nWidth = rRect.Width(); - nHeight = rRect.Height(); + m_Point = rRect.m_Point; + m_Size = rRect.m_Size; return *this; } inline BOOL SwRect::operator == ( const SwRect& rRect ) const { - return (nX == rRect.Left() && - nY == rRect.Top() && - nWidth == rRect.Width() && - nHeight == rRect.Height()); + return (m_Point == rRect.m_Point && m_Size == rRect.m_Size); } inline BOOL SwRect::operator != ( const SwRect& rRect ) const { - return (nX != rRect.Left() || - nY != rRect.Top() || - nWidth != rRect.Width() || - nHeight != rRect.Height()); + return (m_Point != rRect.m_Point || m_Size != rRect.m_Size); } inline SwRect &SwRect::operator+=( const Point &rPt ) { - nX += rPt.X(); nY += rPt.Y(); + m_Point += rPt; return *this; } inline SwRect &SwRect::operator-=( const Point &rPt ) { - nX -= rPt.X(); nY -= rPt.Y(); + m_Point -= rPt; return *this; } inline SwRect &SwRect::operator+=( const Size &rSz ) { - nWidth += rSz.Width(); nHeight += rSz.Height(); + m_Size.Width() += rSz.Width(); + m_Size.Height() += rSz.Height(); return *this; } inline SwRect &SwRect::operator-=( const Size &rSz ) { - nWidth -= rSz.Width(); nHeight -= rSz.Height(); + m_Size.Width() -= rSz.Width(); + m_Size.Height() -= rSz.Height(); return *this; } @@ -315,10 +309,10 @@ inline SwRect &SwRect::operator-=( const Size &rSz ) //--------------------------- Sonstiges inline Rectangle SwRect::SVRect() const { - ASSERT( nWidth && nHeight, "SVRect() ohne Widht oder Height" ); - return Rectangle( nX, nY, - nX + nWidth - 1, //Right() - nY + nHeight - 1 ); //Bottom() + ASSERT( !IsEmpty(), "SVRect() without Width or Height" ); + return Rectangle( m_Point.getX(), m_Point.getY(), + m_Point.getX() + m_Size.getWidth() - 1, //Right() + m_Point.getY() + m_Size.getHeight() - 1 ); //Bottom() } inline SwRect SwRect::GetIntersection( const SwRect& rRect ) const @@ -328,51 +322,44 @@ inline SwRect SwRect::GetIntersection( const SwRect& rRect ) const inline BOOL SwRect::HasArea() const { - return nHeight && nWidth; + return !IsEmpty(); } inline BOOL SwRect::IsEmpty() const { - return !(nHeight && nWidth); + return !(m_Size.getHeight() && m_Size.getWidth()); } inline void SwRect::Clear() { - nX = nY = nWidth = nHeight = 0; + m_Point.setX(0); + m_Point.setY(0); + m_Size.setWidth(0); + m_Size.setHeight(0); } //-------------------------- CToren inline SwRect::SwRect() : - nX( 0 ), - nY( 0 ), - nWidth ( 0 ), - nHeight( 0 ) + m_Point( 0, 0 ), + m_Size( 0, 0 ) { } inline SwRect::SwRect( const SwRect &rRect ) : - nX( rRect.Left() ), - nY( rRect.Top() ), - nWidth ( rRect.Width() ), - nHeight( rRect.Height() ) + m_Point( rRect.m_Point ), + m_Size( rRect.m_Size ) { } inline SwRect::SwRect( const Point& rLT, const Size& rSize ) : - nX( rLT.X() ), - nY( rLT.Y() ), - nWidth ( rSize.Width() ), - nHeight( rSize.Height()) + m_Point( rLT ), + m_Size( rSize ) { } inline SwRect::SwRect( const Point& rLT, const Point& rRB ) : - nX( rLT.X() ), - nY( rLT.Y() ), - nWidth ( rRB.X() - rLT.X() + 1 ), - nHeight( rRB.Y() - rLT.Y() + 1 ) + m_Point( rLT ), + m_Size( rRB.X() - rLT.X() + 1, rRB.Y() - rLT.Y() + 1 ) { } inline SwRect::SwRect( long X, long Y, long W, long H ) : - nX( X ), - nY( Y ), - nWidth ( W ), - nHeight( H ) + m_Point( X, Y ), + m_Size( W, H ) { } 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 ); } -- cgit v1.2.3 From e866ee8eb2361296ef719b840f0f2aa3670a00e6 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 2 Nov 2009 18:35:37 +0100 Subject: #i104106#: fix wrong initialization of variable, causing reset of AUTOFMT --- sw/source/core/undo/rolbck.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sw/source') 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 ) { -- cgit v1.2.3 From 2218cdff62ab1d63134c81f7b0eae170b742a3e0 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 4 Nov 2009 13:54:00 +0100 Subject: #i97570#: SwReader::Read(): also create UNDO object for frames anchored AT char --- sw/inc/undobj.hxx | 5 +++++ sw/source/core/undo/undobj.cxx | 26 +++++++++++++++++++------- sw/source/filter/basflt/shellio.cxx | 28 +++++++++++++++++++++------- 3 files changed, 45 insertions(+), 14 deletions(-) (limited to 'sw/source') diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index f45806e558..9a86b86475 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -206,6 +206,11 @@ namespace nsDelCntntType const DelCntntType DELCNT_CHKNOCNTNT = 0x80; } +/// will DelCntntIndex destroy a frame anchored at character at rAnchorPos? +bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos, + SwPosition const & rStart, SwPosition const & rEnd, + DelCntntType const nDelCntntType = nsDelCntntType::DELCNT_ALL); + // diese Klasse muss in ein Undo-Object vererbt werden, wenn dieses Inhalt // fuers Redo/Undo ... speichert class SwUndoSaveCntnt 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/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 2d8c1e4368..610c372372 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -235,13 +235,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() && -- cgit v1.2.3 From c5bad04172a876c131c66bad8297bb2071037606 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 5 Nov 2009 18:17:28 +0100 Subject: #i58667#: lcl_InsAttr(): fix insertion of user defined attributes --- sw/source/core/doc/docfmt.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sw/source') 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 ); -- cgit v1.2.3 From c18f5c2ae97afe6b19734367967f819fb7423aaf Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 5 Nov 2009 18:38:26 +0100 Subject: #i58667#: sw refactoring: remove class SwTxtXMLAttrContainer. adapt code to the fact that there are no RES_UNKNOWNATR_CONTAINER text hints. --- sw/inc/txatbase.hxx | 8 ---- sw/inc/txtatr.hxx | 9 ---- sw/source/core/text/atrstck.cxx | 19 ++++---- sw/source/core/txtnode/ndtxt.cxx | 12 +---- sw/source/core/txtnode/thints.cxx | 80 ++++++++++++++-------------------- sw/source/core/txtnode/txtatr2.cxx | 8 ---- sw/source/core/unocore/unoportenum.cxx | 1 - 7 files changed, 43 insertions(+), 94 deletions(-) (limited to 'sw/source') diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx index da08842e02..706e481763 100644 --- a/sw/inc/txatbase.hxx +++ b/sw/inc/txatbase.hxx @@ -121,7 +121,6 @@ public: inline const SwTOXMark &GetTOXMark() const; inline const SwFmtRefMark &GetRefMark() const; inline const SwFmtINetFmt &GetINetFmt() const; - inline const SvXMLAttrContainerItem &GetXMLAttrContainer() const; inline const SwFmtRuby &GetRuby() const; inline const SwFmtMeta &GetMeta() const; @@ -230,13 +229,6 @@ inline const SwFmtINetFmt& SwTxtAttr::GetINetFmt() const return (const SwFmtINetFmt&)(*m_pAttr); } -inline const SvXMLAttrContainerItem& SwTxtAttr::GetXMLAttrContainer() const -{ - ASSERT( m_pAttr && m_pAttr->Which() == RES_UNKNOWNATR_CONTAINER, - "Wrong attribute" ); - return (const SvXMLAttrContainerItem&)(*m_pAttr); -} - inline const SwFmtRuby& SwTxtAttr::GetRuby() const { ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY, diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx index 5a36625d52..3af8e54bf6 100644 --- a/sw/inc/txtatr.hxx +++ b/sw/inc/txtatr.hxx @@ -60,15 +60,6 @@ public: }; -// ATT_XMLCONTAINERITEM ****************************** - -class SwTxtXMLAttrContainer : public SwTxtAttrEnd -{ -public: - SwTxtXMLAttrContainer( SvXMLAttrContainerItem& rAttr, - xub_StrLen nStart, xub_StrLen nEnd ); -}; - // ****************************** class SwTxtAttrNesting : public SwTxtAttrEnd 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/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(RES_TXTATR_WITHEND_END) - - static_cast(RES_CHRATR_BEGIN) + - static_cast(RES_UNKNOWNATR_END) - - static_cast(RES_UNKNOWNATR_BEGIN); + static_cast(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(nWhich - RES_CHRATR_BEGIN); } - else if (isUNKNOWNATR(nWhich)) - { - nWhPos = static_cast( - nWhich - - static_cast(RES_UNKNOWNATR_BEGIN) + - static_cast(RES_TXTATR_WITHEND_END) - - static_cast(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(-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(*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(RES_TXTATR_WITHEND_END) - - static_cast(RES_CHRATR_BEGIN) + - static_cast(RES_UNKNOWNATR_END) - - static_cast(RES_UNKNOWNATR_BEGIN); + static_cast(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( static_cast(RES_TXTATR_WITHEND_END) - - static_cast(RES_CHRATR_BEGIN) ) ) - nWh = static_cast(n + RES_CHRATR_BEGIN); - else - nWh = n - static_cast( static_cast(RES_TXTATR_WITHEND_END) - - static_cast(RES_CHRATR_BEGIN) + - static_cast(RES_UNKNOWNATR_BEGIN) ); + const USHORT nWh = + static_cast(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 #include #include @@ -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/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"); -- cgit v1.2.3 From 2ca8afdf9abef10c1b00c9e089efd2d6a068af9d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 9 Nov 2009 15:47:17 +0100 Subject: #i106724#: SwXTextPortion::GetPropertyValuesTolerant_Impl: remove bogus ASSERT --- sw/source/core/unocore/unoport.cxx | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sw/source') 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 &) -- cgit v1.2.3 From 7595f782937b4d2281a6dbbafdc21a18c7989554 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 10 Nov 2009 16:14:33 +0100 Subject: #i105643#: fix regression by making singleton SwThreadManager ctor public --- sw/source/core/docnode/swthreadmanager.cxx | 7 +------ sw/source/core/inc/swthreadmanager.hxx | 13 +++++++++---- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx index d69410b9fd..8b173a1221 100644 --- a/sw/source/core/docnode/swthreadmanager.cxx +++ b/sw/source/core/docnode/swthreadmanager.cxx @@ -50,14 +50,9 @@ SwThreadManager::SwThreadManager() SwThreadManager::~SwThreadManager() { - delete mpThreadManagerImpl; } -struct InitInstance : public rtl::StaticWithInit { - SwThreadManager operator () () { - return SwThreadManager(); - } -}; +struct InitInstance : public rtl::Static {}; SwThreadManager& SwThreadManager::GetThreadManager() { diff --git a/sw/source/core/inc/swthreadmanager.hxx b/sw/source/core/inc/swthreadmanager.hxx index e0933be181..1029efb217 100644 --- a/sw/source/core/inc/swthreadmanager.hxx +++ b/sw/source/core/inc/swthreadmanager.hxx @@ -34,6 +34,10 @@ #include #include +#include +#include + + 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 ); @@ -77,11 +85,8 @@ class SwThreadManager private: static bool mbThreadManagerInstantiated; - friend struct InitInstance; - ThreadManager* mpThreadManagerImpl; - - SwThreadManager(); + ::std::auto_ptr mpThreadManagerImpl; }; #endif -- cgit v1.2.3 From ac926713efc96ddd53f84099d46bca7d94ee5823 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 11 Nov 2009 12:28:01 +0100 Subject: #i97384#: fix regression: respect redline mode in document's settings.xml --- sw/source/filter/basflt/shellio.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 610c372372..3e8ae6d726 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -158,6 +158,7 @@ ULONG SwReader::Read( const Reader& rOptions ) SwNodeIndex aSplitIdx( pDoc->GetNodes() ); RedlineMode_t eOld = pDoc->GetRedlineMode(); + RedlineMode_t ePostReadRedlineMode( nsRedlineMode_t::REDLINE_IGNORE ); // Array von FlyFormaten SwSpzFrmFmts aFlyFrmArr; @@ -195,6 +196,9 @@ ULONG SwReader::Read( const Reader& rOptions ) 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 @@ -370,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( + ePostReadRedlineMode & ~nsRedlineMode_t::REDLINE_IGNORE); pDoc->SetFieldsDirty(false, NULL, 0); } -- cgit v1.2.3