summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/crsr/bookmrk.cxx2
-rw-r--r--sw/source/core/crsr/findattr.cxx31
-rw-r--r--sw/source/core/doc/doccorr.cxx16
-rw-r--r--sw/source/core/doc/docedt.cxx13
-rw-r--r--sw/source/core/doc/docfmt.cxx70
-rw-r--r--sw/source/core/layout/fly.cxx5
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx16
-rw-r--r--sw/source/core/txtnode/thints.cxx5
-rw-r--r--sw/source/core/unocore/unoframe.cxx2
-rw-r--r--sw/source/core/unocore/unoportenum.cxx12
-rw-r--r--sw/source/core/unocore/unotext.cxx14
11 files changed, 96 insertions, 90 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 5b6d5701ed62..8586b911eb16 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -109,7 +109,7 @@ namespace sw { namespace mark
, m_aName(rName)
{
lcl_FixPosition(*m_pPos1);
- if(aPaM.HasMark())
+ if (aPaM.HasMark() && (*aPaM.GetMark() != *aPaM.GetPoint()))
{
MarkBase::SetOtherMarkPos(*(aPaM.GetMark()));
lcl_FixPosition(*m_pPos2);
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index b505134e4395..88f345e62bcf 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -311,15 +311,33 @@ void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam )
pItem = aIter.NextItem();
}
}
+
+static bool
+lcl_IsAttributeIgnorable(xub_StrLen const nNdStart, xub_StrLen const nNdEnd,
+ _SwSrchChrAttr const& rTmp)
+{
+ // #i115528#: if there is a paragraph attribute, it has been added by the
+ // SwAttrCheckArr ctor, and nFound is 1.
+ // if the paragraph is entirely covered by hints that override the paragraph
+ // attribute, then this function must find an attribute to decrement nFound!
+ // so check for an empty search range, let attributes that start/end there
+ // cover it, and hope for the best...
+ return ((nNdEnd == nNdStart)
+ ? ((rTmp.nEnd < nNdStart) || (nNdEnd < rTmp.nStt))
+ : ((rTmp.nEnd <= nNdStart) || (nNdEnd <= rTmp.nStt)));
+}
+
int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr )
{
_SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() );
- // alle die nicht im Bereich sind -> ignorieren
- if( aTmp.nEnd <= nNdStt || aTmp.nStt >= nNdEnd )
+
+ // ignore all attributes not in search range
+ if (lcl_IsAttributeIgnorable(nNdStt, nNdEnd, aTmp))
+ {
return Found();
+ }
const SfxPoolItem* pItem;
-
// --------------------------------------------------------------
// Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht
// --------------------------------------------------------------
@@ -473,9 +491,12 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr )
int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr )
{
_SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() );
- // alle die nicht im Bereich sind -> ignorieren
- if( aTmp.nEnd < nNdStt || aTmp.nStt >= nNdEnd )
+
+ // ignore all attributes not in search range
+ if (lcl_IsAttributeIgnorable(nNdStt, nNdEnd, aTmp))
+ {
return Found();
+ }
const SfxPoolItem* pItem;
// --------------------------------------------------------------
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index 6585b3359004..dec5f24f6f7d 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -210,10 +210,22 @@ void SwDoc::CorrAbs(const SwNodeIndex& rOldNode,
getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset);
{ // fix redlines
SwRedlineTbl& rTbl = *pRedlineTbl;
- for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ for (sal_uInt16 n = 0; n < rTbl.Count(); )
{
// is on position ??
- lcl_PaMCorrAbs(*rTbl[ n ], *aPam.Start(), *aPam.End(), aNewPos);
+ SwRedline *const pRedline( rTbl[ n ] );
+ bool const bChanged =
+ lcl_PaMCorrAbs(*pRedline, *aPam.Start(), *aPam.End(), aNewPos);
+ // clean up empty redlines: docredln.cxx asserts these as invalid
+ if (bChanged && (*pRedline->GetPoint() == *pRedline->GetMark())
+ && (pRedline->GetContentIdx() == NULL))
+ {
+ rTbl.DeleteAndDestroy(n);
+ }
+ else
+ {
+ ++n;
+ }
}
}
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index ef5ecb8c255c..274070a377a9 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -2515,8 +2515,6 @@ SetRedlineMode( eOld );
rPam.GetMark()->nNode = aPtNd;
rPam.GetMark()->nContent.Assign( aPtNd.GetNode().GetCntntNode(),
nPtCnt );
- if( bJoinTxt )
- rPam.Move( fnMoveBackward );
if( pUndoRpl )
{
@@ -2642,8 +2640,15 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
return sal_False;
}
}
- // text::Bookmarks usw. verschieben
- CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True );
+ // move bookmarks, redlines etc.
+ if (aRg.aStart == aRg.aEnd) // only first CorrAbs variant handles this
+ {
+ CorrAbs( aRg.aStart, *rPam.GetPoint(), 0, sal_True );
+ }
+ else
+ {
+ CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True );
+ }
// was ist mit Fly's ??
{
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 67999d21381c..991201a4947e 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -493,45 +493,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
SwTxtNode* pTNd = aTmpStt.GetNode().GetTxtNode();
if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
{
- SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END );
-
- while( sal_True )
+ if (pHst)
{
- if( IsInRange( aCharFmtSetRange, pItem->Which() ))
- {
- pTNd->GetOrCreateSwpHints();
-
- aCharSet.Put( *pItem );
-
- if( pHst )
- {
- SwRegHistory aRegH( pTNd, *pTNd, pHst );
- pTNd->ResetAttr( pItem->Which() );
- }
- else
- pTNd->ResetAttr( pItem->Which() );
- }
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
+ SwRegHistory history(pTNd, *pTNd, pHst);
+ pTNd->FmtToTxtAttr(pTNd);
}
-
- if ( aCharSet.Count() )
+ else
{
- if ( pHst )
- {
- SwRegHistory history( pTNd, *pTNd, pHst );
- history.InsertItems( aCharSet, 0, pTNd->GetTxt().Len(),
- nsSetAttrMode::SETATTR_NOFORMATATTR );
- }
- else
- {
- SwTxtAttr* pNew =
- MakeTxtAttr( *this, aCharSet, 0, pTNd->GetTxt().Len() );
- pTNd->InsertHint( pNew );
- }
+ pTNd->FmtToTxtAttr(pTNd);
}
}
@@ -545,29 +514,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode();
if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
{
- SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- while( sal_True )
+ if (pHst)
{
- if( IsInRange( aCharFmtSetRange, pItem->Which() ))
- {
- SwTxtAttr* pTAttr = MakeTxtAttr( *this,
- const_cast<SfxPoolItem&>(*pItem),
- 0, pTNd->GetTxt().Len() );
- SwpHints & rHints = pTNd->GetOrCreateSwpHints();
- rHints.SwpHintsArray::Insert( pTAttr );
- if ( pHst )
- {
- SwRegHistory aRegH( pTNd, *pTNd, pHst );
- pTNd->ResetAttr( pItem->Which() );
- pHst->Add( pTAttr, aTmpEnd.GetIndex(), true );
- }
- else
- pTNd->ResetAttr( pItem->Which() );
- }
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
+ SwRegHistory history(pTNd, *pTNd, pHst);
+ pTNd->FmtToTxtAttr(pTNd);
+ }
+ else
+ {
+ pTNd->FmtToTxtAttr(pTNd);
}
}
}
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 544082e93335..44264004cf07 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2352,7 +2352,10 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj )
// Assure the control objects and group objects containing controls are on the control layer
if ( ::CheckControlLayer( _rNewObj.DrawObj() ) )
{
- const IDocumentDrawModelAccess* pIDDMA = GetUpper()->GetFmt()->getIDocumentDrawModelAccess();
+ const IDocumentDrawModelAccess* pIDDMA = (IsFlyFrm())
+ ? static_cast<SwFlyFrm*>(this)->GetFmt()->
+ getIDocumentDrawModelAccess()
+ : GetUpper()->GetFmt()->getIDocumentDrawModelAccess();
const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer());
const SdrLayerID aControlLayerID(pIDDMA->GetControlsId());
const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId());
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 13262cf15ae3..350bc4dea8e9 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2100,12 +2100,18 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
if ( -1 != nDestPageNum )
{
- // Destination Export
- const sal_Int32 nDestId =
- pPDFExtOutDevData->CreateDest( rDestRect.SVRect(), nDestPageNum );
+ if ( aIBeg->nLinkId != -1 )
+ {
+ // Destination Export
+ const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest( rDestRect.SVRect(), nDestPageNum );
- // Connect Link and Destination:
- pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, nDestId );
+ // Connect Link and Destination:
+ pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, nDestId );
+ }
+ else
+ {
+ pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, rDestRect.SVRect(), nDestPageNum );
+ }
}
}
else
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index cfda0e1bd529..74039a66ca58 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2101,7 +2101,7 @@ struct RemovePresentAttrs
const SwTxtAttr* const pAutoStyle(i_rAttrSpan.second);
SfxItemIter aIter(m_rAttrSet);
const SfxPoolItem* pItem(aIter.GetCurItem());
- while (true)
+ while (pItem)
{
const sal_uInt16 nWhich(pItem->Which());
if (CharFmt::IsItemIncluded(nWhich, pAutoStyle))
@@ -2143,7 +2143,8 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_uInt16 nLength,
const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->GetEnd());
o_rSpanMap.insert(AttrSpanMap_t::value_type(aSpan, pHint));
- if (aSpan.first != nLastEnd)
+ // < not != because there may be multiple CHARFMT at same range
+ if (nLastEnd < aSpan.first)
{
// insert dummy span covering the gap
o_rSpanMap.insert(AttrSpanMap_t::value_type(
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 9681279c350f..14ffb5c2442d 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2078,6 +2078,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
aFrmSet.Put( SwFmtAnchor( FLY_AT_PAGE, 1 ));
}
+ aPam.DeleteMark(); // mark position node will be deleted!
+ aIntPam.DeleteMark(); // mark position node will be deleted!
pFmt = pDoc->MakeFlyAndMove( *m_pCopySource, aFrmSet,
0,
pParentFrmFmt );
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 138f3d615ae2..620b9d212f70 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -155,12 +155,16 @@ namespace
++ppMark)
{
::sw::mark::IMark* const pBkmk = ppMark->get();
- bool hasOther = pBkmk->IsExpanded();
+ ::sw::mark::CrossRefBookmark *const pCrossRefMark(
+ dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk));
+ bool const hasOther = pBkmk->IsExpanded();
const SwPosition& rStartPos = pBkmk->GetMarkStart();
if(rStartPos.nNode == nOwnNode)
{
- const sal_uInt8 nType = hasOther ? BKM_TYPE_START : BKM_TYPE_START_END;
+ // #i109272#: cross reference marks: need special handling!
+ sal_uInt8 const nType = (hasOther || pCrossRefMark)
+ ? BKM_TYPE_START : BKM_TYPE_START_END;
rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr(
new SwXBookmarkPortion_Impl(
SwXBookmark::CreateXBookmark(rDoc, *pBkmk),
@@ -173,8 +177,10 @@ namespace
auto_ptr<SwPosition> pCrossRefEndPos;
const SwPosition* pEndPos = NULL;
if(hasOther)
+ {
pEndPos = &rEndPos;
- else if(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk))
+ }
+ else if (pCrossRefMark)
{
// Crossrefbookmarks only remember the start position but have to span the whole paragraph
pCrossRefEndPos = auto_ptr<SwPosition>(new SwPosition(rEndPos));
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 2bb2842fb508..73751f2a1259 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1754,13 +1754,15 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
// DelFullPara is called
const uno::Reference< text::XTextRange> xInsertTextRange =
new SwXTextRange(aStartPam, this);
+ aStartPam.DeleteMark(); // mark position node may be deleted!
pNewFrame->attach( xInsertTextRange );
pNewFrame->setName(m_pImpl->m_pDoc->GetUniqueFrameName());
}
- if (!aStartPam.GetTxt().Len())
+ SwTxtNode *const pTxtNode(aStartPam.GetNode()->GetTxtNode());
+ OSL_ASSERT(pTxtNode);
+ if (!pTxtNode || !pTxtNode->Len()) // don't remove if it contains text!
{
- bool bMoved = false;
{ // has to be in a block to remove the SwIndexes before
// DelFullPara is called
SwPaM aMovePam( *aStartPam.GetNode() );
@@ -1772,14 +1774,8 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
m_pImpl->m_pDoc->SetAttr(
aNewAnchor, *pNewFrame->GetFrmFmt() );
}
- bMoved = true;
- }
- if (bMoved)
- {
- aStartPam.DeleteMark();
-// SwPaM aDelPam( *aStartPam.GetNode() );
- m_pImpl->m_pDoc->DelFullPara(aStartPam/*aDelPam*/);
}
+ m_pImpl->m_pDoc->DelFullPara(aStartPam);
}
}
catch (lang::IllegalArgumentException& rIllegal)