Kaydet (Commit) bbf59cb8 authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Björn Michaelsen

Related fdo#86929: Kill FOREACHPAM_START for good (part2)

Change-Id: Ia6e166a4158d28f1a4145e51040f2f5637827197
Reviewed-on: https://gerrit.libreoffice.org/13466Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
üst 3fcd2ccb
...@@ -54,11 +54,12 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM ) ...@@ -54,11 +54,12 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM )
void SwEditShell::GCAttr() void SwEditShell::GCAttr()
{ {
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
if ( !PCURCRSR->HasMark() ) {
if ( !rPaM.HasMark() )
{ {
SwTxtNode *const pTxtNode = SwTxtNode *const pTxtNode =
PCURCRSR->GetPoint()->nNode.GetNode().GetTxtNode(); rPaM.GetPoint()->nNode.GetNode().GetTxtNode();
if (pTxtNode) if (pTxtNode)
{ {
pTxtNode->GCAttr(); pTxtNode->GCAttr();
...@@ -66,8 +67,8 @@ void SwEditShell::GCAttr() ...@@ -66,8 +67,8 @@ void SwEditShell::GCAttr()
} }
else else
{ {
const SwNodeIndex& rEnd = PCURCRSR->End()->nNode; const SwNodeIndex& rEnd = rPaM.End()->nNode;
SwNodeIndex aIdx( PCURCRSR->Start()->nNode ); SwNodeIndex aIdx( rPaM.Start()->nNode );
SwNode* pNd = &aIdx.GetNode(); SwNode* pNd = &aIdx.GetNode();
do { do {
if( pNd->IsTxtNode() ) if( pNd->IsTxtNode() )
...@@ -76,7 +77,7 @@ void SwEditShell::GCAttr() ...@@ -76,7 +77,7 @@ void SwEditShell::GCAttr()
while( 0 != ( pNd = GetDoc()->GetNodes().GoNext( &aIdx )) && while( 0 != ( pNd = GetDoc()->GetNodes().GoNext( &aIdx )) &&
aIdx <= rEnd ); aIdx <= rEnd );
} }
FOREACHPAM_END() }
} }
/// Set the attribute as new default attribute in the document. /// Set the attribute as new default attribute in the document.
...@@ -104,13 +105,14 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, sal_uInt16 nFlags ) ...@@ -104,13 +105,14 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, sal_uInt16 nFlags )
bool bIsTblMode = IsTableMode(); bool bIsTblMode = IsTableMode();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL); GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
if( PCURCRSR->HasMark() && ( bIsTblMode || {
*PCURCRSR->GetPoint() != *PCURCRSR->GetMark() )) if( rPaM.HasMark() && ( bIsTblMode ||
*rPaM.GetPoint() != *rPaM.GetMark() ))
{ {
GetDoc()->getIDocumentContentOperations().InsertPoolItem(*PCURCRSR, rHint, nFlags ); GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, rHint, nFlags );
} }
FOREACHPAM_END() }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL); GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
} }
......
...@@ -481,10 +481,10 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const ...@@ -481,10 +481,10 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
if( !nDefDist ) if( !nDefDist )
return false; return false;
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
sal_uLong nSttNd = PCURCRSR->GetMark()->nNode.GetIndex(), sal_uLong nSttNd = rPaM.GetMark()->nNode.GetIndex(),
nEndNd = PCURCRSR->GetPoint()->nNode.GetIndex(); nEndNd = rPaM.GetPoint()->nNode.GetIndex();
if( nSttNd > nEndNd ) if( nSttNd > nEndNd )
std::swap(nSttNd, nEndNd); std::swap(nSttNd, nEndNd);
...@@ -516,7 +516,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const ...@@ -516,7 +516,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
if( !bRet ) if( !bRet )
break; break;
FOREACHPAM_END() }
return bRet; return bRet;
} }
......
...@@ -121,9 +121,10 @@ long SwEditShell::Delete() ...@@ -121,9 +121,10 @@ long SwEditShell::Delete()
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_DELETE, &aRewriter); GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_DELETE, &aRewriter);
} }
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
DeleteSel( *PCURCRSR, &bUndo ); {
FOREACHPAM_END() DeleteSel( rPaM, &bUndo );
}
// If undo container then close here // If undo container then close here
if( bUndo ) if( bUndo )
...@@ -151,15 +152,15 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) ...@@ -151,15 +152,15 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
SwPosition * pPos = 0; SwPosition * pPos = 0;
boost::shared_ptr<SwPosition> pInsertPos; boost::shared_ptr<SwPosition> pInsertPos;
sal_uInt16 nMove = 0; sal_uInt16 nMove = 0;
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
if( !pPos ) if( !pPos )
{ {
if( pDestShell == this ) if( pDestShell == this )
{ {
// First cursor represents the target position!! // First cursor represents the target position!!
PCURCRSR->DeleteMark(); rPaM.DeleteMark();
pPos = (SwPosition*)PCURCRSR->GetPoint(); pPos = (SwPosition*)rPaM.GetPoint();
continue; continue;
} }
else else
...@@ -184,9 +185,9 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) ...@@ -184,9 +185,9 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
SwPosition *pTmp = IsBlockMode() ? pInsertPos.get() : pPos; SwPosition *pTmp = IsBlockMode() ? pInsertPos.get() : pPos;
// Check if a selection would be copied into itself // Check if a selection would be copied into itself
if( pDestShell->GetDoc() == GetDoc() && if( pDestShell->GetDoc() == GetDoc() &&
*PCURCRSR->Start() <= *pTmp && *pTmp < *PCURCRSR->End() ) *rPaM.Start() <= *pTmp && *pTmp < *rPaM.End() )
return sal_False; return sal_False;
FOREACHPAM_END() }
} }
pDestShell->StartAllAction(); pDestShell->StartAllAction();
...@@ -199,15 +200,15 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) ...@@ -199,15 +200,15 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
std::list< boost::shared_ptr<SwPosition> >::iterator pNextInsert = aInsertList.begin(); std::list< boost::shared_ptr<SwPosition> >::iterator pNextInsert = aInsertList.begin();
pDestShell->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); pDestShell->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
if( !pPos ) if( !pPos )
{ {
if( pDestShell == this ) if( pDestShell == this )
{ {
// First cursor represents the target position!! // First cursor represents the target position!!
PCURCRSR->DeleteMark(); rPaM.DeleteMark();
pPos = (SwPosition*)PCURCRSR->GetPoint(); pPos = (SwPosition*)rPaM.GetPoint();
continue; continue;
} }
else else
...@@ -225,7 +226,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) ...@@ -225,7 +226,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
} }
// Only for a selection (non-text nodes have selection but Point/GetMark are equal) // Only for a selection (non-text nodes have selection but Point/GetMark are equal)
if( !PCURCRSR->HasMark() || *PCURCRSR->GetPoint() == *PCURCRSR->GetMark() ) if( !rPaM.HasMark() || *rPaM.GetPoint() == *rPaM.GetMark() )
continue; continue;
if( bFirstMove ) if( bFirstMove )
...@@ -236,7 +237,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) ...@@ -236,7 +237,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
bFirstMove = false; bFirstMove = false;
} }
const bool bSuccess( GetDoc()->getIDocumentContentOperations().CopyRange( *PCURCRSR, *pPos, false ) ); const bool bSuccess( GetDoc()->getIDocumentContentOperations().CopyRange( rPaM, *pPos, false ) );
if (!bSuccess) if (!bSuccess)
continue; continue;
...@@ -244,7 +245,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) ...@@ -244,7 +245,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
pDestShell->GetDoc()->MakeUniqueNumRules(aInsertPaM); pDestShell->GetDoc()->MakeUniqueNumRules(aInsertPaM);
bRet = true; bRet = true;
FOREACHPAM_END() }
// Maybe nothing has been moved? // Maybe nothing has been moved?
if( !bFirstMove ) if( !bFirstMove )
...@@ -302,14 +303,15 @@ bool SwEditShell::Replace( const OUString& rNewStr, bool bRegExpRplc ) ...@@ -302,14 +303,15 @@ bool SwEditShell::Replace( const OUString& rNewStr, bool bRegExpRplc )
StartAllAction(); StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
if( PCURCRSR->HasMark() && *PCURCRSR->GetMark() != *PCURCRSR->GetPoint() ) {
if( rPaM.HasMark() && *rPaM.GetMark() != *rPaM.GetPoint() )
{ {
bRet = GetDoc()->getIDocumentContentOperations().ReplaceRange( *PCURCRSR, rNewStr, bRegExpRplc ) bRet = GetDoc()->getIDocumentContentOperations().ReplaceRange( rPaM, rNewStr, bRegExpRplc )
|| bRet; || bRet;
SaveTblBoxCntnt( PCURCRSR->GetPoint() ); SaveTblBoxCntnt( rPaM.GetPoint() );
} }
FOREACHPAM_END() }
// close Undo container here // close Undo container here
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
......
...@@ -58,14 +58,15 @@ void SwEditShell::SetTxtFmtColl(SwTxtFmtColl *pFmt, ...@@ -58,14 +58,15 @@ void SwEditShell::SetTxtFmtColl(SwTxtFmtColl *pFmt,
aRewriter.AddRule(UndoArg1, pLocal->GetName()); aRewriter.AddRule(UndoArg1, pLocal->GetName());
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter); GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
if ( !PCURCRSR->HasReadonlySel( GetViewOptions()->IsFormView() ) ) if ( !rPaM.HasReadonlySel( GetViewOptions()->IsFormView() ) )
{ {
GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs ); GetDoc()->SetTxtFmtColl( rPaM, pLocal, true, bResetListAttrs );
} }
FOREACHPAM_END() }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter); GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter);
EndAllAction(); EndAllAction();
} }
......
...@@ -204,11 +204,12 @@ void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints) ...@@ -204,11 +204,12 @@ void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints)
? nsSetAttrMode::SETATTR_FORCEHINTEXPAND ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
: nsSetAttrMode::SETATTR_DEFAULT; : nsSetAttrMode::SETATTR_DEFAULT;
FOREACHPAM_START(GetCrsr()) // for each PaM for(SwPaM& rPaM : GetCrsr()->GetRingContainer()) // for each PaM
const bool bSuccess(GetDoc()->getIDocumentContentOperations().InsertPoolItem(*PCURCRSR, aFld, nInsertFlags)); {
const bool bSuccess(GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, aFld, nInsertFlags));
OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed"); OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed");
(void) bSuccess; (void) bSuccess;
FOREACHPAM_END() }
EndAllAction(); EndAllAction();
} }
...@@ -284,12 +285,13 @@ void SwEditShell::UpdateFlds( SwField &rFld ) ...@@ -284,12 +285,13 @@ void SwEditShell::UpdateFlds( SwField &rFld )
SwMsgPoolItem aFldHint( RES_TXTATR_FIELD ); // Search-Hint SwMsgPoolItem aFldHint( RES_TXTATR_FIELD ); // Search-Hint
SwMsgPoolItem aAnnotationFldHint( RES_TXTATR_ANNOTATION ); SwMsgPoolItem aAnnotationFldHint( RES_TXTATR_ANNOTATION );
SwMsgPoolItem aInputFldHint( RES_TXTATR_INPUTFIELD ); SwMsgPoolItem aInputFldHint( RES_TXTATR_INPUTFIELD );
FOREACHPAM_START(GetCrsr()) // for each PaM for(SwPaM& rPaM : GetCrsr()->GetRingContainer()) // for each PaM
if( PCURCRSR->HasMark() && bOkay ) // ... with selection {
if( rPaM.HasMark() && bOkay ) // ... with selection
{ {
// copy of the PaM // copy of the PaM
SwPaM aCurPam( *PCURCRSR->GetMark(), *PCURCRSR->GetPoint() ); SwPaM aCurPam( *rPaM.GetMark(), *rPaM.GetPoint() );
SwPaM aPam( *PCURCRSR->GetPoint() ); SwPaM aPam( *rPaM.GetPoint() );
SwPosition *pCurStt = aCurPam.Start(), *pCurEnd = SwPosition *pCurStt = aCurPam.Start(), *pCurEnd =
aCurPam.End(); aCurPam.End();
...@@ -331,7 +333,7 @@ void SwEditShell::UpdateFlds( SwField &rFld ) ...@@ -331,7 +333,7 @@ void SwEditShell::UpdateFlds( SwField &rFld )
if( bTblSelBreak ) // If table section and table formula are updated -> finish if( bTblSelBreak ) // If table section and table formula are updated -> finish
break; break;
FOREACHPAM_END() }
} }
GetDoc()->getIDocumentState().SetModified(); GetDoc()->getIDocumentState().SetModified();
EndAllAction(); EndAllAction();
......
...@@ -216,37 +216,38 @@ bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) ...@@ -216,37 +216,38 @@ bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
pInsDoc->SetColumnSelection( true ); pInsDoc->SetColumnSelection( true );
bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false); bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false);
{ {
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
if( !PCURCRSR->HasMark() )
{ {
SwCntntNode *const pNd = PCURCRSR->GetCntntNode(); if( !rPaM.HasMark() )
if (0 != pNd &&
( bColSel || !pNd->GetTxtNode() ) )
{ {
PCURCRSR->SetMark(); SwCntntNode *const pNd = rPaM.GetCntntNode();
PCURCRSR->Move( fnMoveForward, fnGoCntnt ); if (0 != pNd &&
bRet = GetDoc()->getIDocumentContentOperations().CopyRange( *PCURCRSR, aPos, false ) ( bColSel || !pNd->GetTxtNode() ) )
|| bRet; {
PCURCRSR->Exchange(); rPaM.SetMark();
PCURCRSR->DeleteMark(); rPaM.Move( fnMoveForward, fnGoCntnt );
bRet = GetDoc()->getIDocumentContentOperations().CopyRange( rPaM, aPos, false )
|| bRet;
rPaM.Exchange();
rPaM.DeleteMark();
}
}
else
{
// Make a copy, so that in case we need to adjust the selection
// for the purpose of copying, our shell cursor is not touched.
// (Otherwise we would have to restore it.)
SwPaM aPaM(rPaM);
if (bSelectAll)
{
// Selection starts at the first para of the first cell,
// but we want to copy the table and the start node before
// the first cell as well.
aPaM.Start()->nNode = aPaM.Start()->nNode.GetNode().FindTableNode()->GetIndex();
}
bRet = GetDoc()->getIDocumentContentOperations().CopyRange( aPaM, aPos, false ) || bRet;
} }
} }
else
{
// Make a copy, so that in case we need to adjust the selection
// for the purpose of copying, our shell cursor is not touched.
// (Otherwise we would have to restore it.)
SwPaM aPaM(*PCURCRSR);
if (bSelectAll)
// Selection starts at the first para of the first cell,
// but we want to copy the table and the start node before
// the first cell as well.
aPaM.Start()->nNode = aPaM.Start()->nNode.GetNode().FindTableNode()->GetIndex();
bRet = GetDoc()->getIDocumentContentOperations().CopyRange( aPaM, aPos, false ) || bRet;
}
FOREACHPAM_END()
} }
} }
......
...@@ -68,17 +68,17 @@ using namespace com::sun::star; ...@@ -68,17 +68,17 @@ using namespace com::sun::star;
void SwEditShell::Insert( sal_Unicode c, bool bOnlyCurrCrsr ) void SwEditShell::Insert( sal_Unicode c, bool bOnlyCurrCrsr )
{ {
StartAllAction(); StartAllAction();
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
const bool bSuccess = GetDoc()->getIDocumentContentOperations().InsertString(*PCURCRSR, OUString(c)); const bool bSuccess = GetDoc()->getIDocumentContentOperations().InsertString(rPaM, OUString(c));
OSL_ENSURE( bSuccess, "Doc->Insert() failed." ); OSL_ENSURE( bSuccess, "Doc->Insert() failed." );
(void) bSuccess; (void) bSuccess;
SaveTblBoxCntnt( PCURCRSR->GetPoint() ); SaveTblBoxCntnt( rPaM.GetPoint() );
if( bOnlyCurrCrsr ) if( bOnlyCurrCrsr )
break; break;
FOREACHPAM_END() }
EndAllAction(); EndAllAction();
} }
...@@ -167,13 +167,14 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints ) ...@@ -167,13 +167,14 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints )
void SwEditShell::Overwrite(const OUString &rStr) void SwEditShell::Overwrite(const OUString &rStr)
{ {
StartAllAction(); StartAllAction();
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
if( !GetDoc()->getIDocumentContentOperations().Overwrite(*PCURCRSR, rStr ) ) {
if( !GetDoc()->getIDocumentContentOperations().Overwrite(rPaM, rStr ) )
{ {
OSL_FAIL( "Doc->getIDocumentContentOperations().Overwrite(Str) failed." ); OSL_FAIL( "Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
} }
SaveTblBoxCntnt( PCURCRSR->GetPoint() ); SaveTblBoxCntnt( rPaM.GetPoint() );
FOREACHPAM_END() }
EndAllAction(); EndAllAction();
} }
...@@ -182,11 +183,12 @@ long SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart ) ...@@ -182,11 +183,12 @@ long SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart )
StartAllAction(); StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
// Here, a table cell becomes a normal text cell. // Here, a table cell becomes a normal text cell.
GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode ); GetDoc()->ClearBoxNumAttrs( rPaM.GetPoint()->nNode );
GetDoc()->getIDocumentContentOperations().SplitNode( *PCURCRSR->GetPoint(), bCheckTableStart ); GetDoc()->getIDocumentContentOperations().SplitNode( *rPaM.GetPoint(), bCheckTableStart );
FOREACHPAM_END() }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
...@@ -205,10 +207,11 @@ bool SwEditShell::AppendTxtNode() ...@@ -205,10 +207,11 @@ bool SwEditShell::AppendTxtNode()
StartAllAction(); StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode ); {
bRet = GetDoc()->getIDocumentContentOperations().AppendTxtNode( *PCURCRSR->GetPoint()) || bRet; GetDoc()->ClearBoxNumAttrs( rPaM.GetPoint()->nNode );
FOREACHPAM_END() bRet = GetDoc()->getIDocumentContentOperations().AppendTxtNode( *rPaM.GetPoint()) || bRet;
}
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
...@@ -1026,12 +1029,11 @@ void SwEditShell::TransliterateText( sal_uInt32 nType ) ...@@ -1026,12 +1029,11 @@ void SwEditShell::TransliterateText( sal_uInt32 nType )
if( pCrsr->GetNext() != pCrsr ) if( pCrsr->GetNext() != pCrsr )
{ {
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
if( PCURCRSR->HasMark() ) if( rPaM.HasMark() )
GetDoc()->getIDocumentContentOperations().TransliterateText( *PCURCRSR, aTrans ); GetDoc()->getIDocumentContentOperations().TransliterateText( rPaM, aTrans );
}
FOREACHPAM_END()
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
} }
else else
...@@ -1042,12 +1044,12 @@ void SwEditShell::TransliterateText( sal_uInt32 nType ) ...@@ -1042,12 +1044,12 @@ void SwEditShell::TransliterateText( sal_uInt32 nType )
void SwEditShell::CountWords( SwDocStat& rStat ) const void SwEditShell::CountWords( SwDocStat& rStat ) const
{ {
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
if( PCURCRSR->HasMark() ) if( rPaM.HasMark() )
GetDoc()->CountWords( *PCURCRSR, rStat ); GetDoc()->CountWords( rPaM, rStat );
FOREACHPAM_END() }
} }
void SwEditShell::ApplyViewOptions( const SwViewOption &rOpt ) void SwEditShell::ApplyViewOptions( const SwViewOption &rOpt )
......
...@@ -110,9 +110,10 @@ bool SwEditShell::RejectRedlinesInSelection() ...@@ -110,9 +110,10 @@ bool SwEditShell::RejectRedlinesInSelection()
bool SwEditShell::SetRedlineComment( const OUString& rS ) bool SwEditShell::SetRedlineComment( const OUString& rS )
{ {
bool bRet = false; bool bRet = false;
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( *PCURCRSR, rS ); {
FOREACHPAM_END() bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( rPaM, rS );
}
return bRet; return bRet;
} }
......
...@@ -41,12 +41,13 @@ SwEditShell::InsertSection( ...@@ -41,12 +41,13 @@ SwEditShell::InsertSection(
StartAllAction(); StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL ); GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL );
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
SwSection const*const pNew = SwSection const*const pNew =
GetDoc()->InsertSwSection( *PCURCRSR, rNewData, 0, pAttr ); GetDoc()->InsertSwSection( rPaM, rNewData, 0, pAttr );
if( !pRet ) if( !pRet )
pRet = pNew; pRet = pNew;
FOREACHPAM_END() }
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL ); GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL );
EndAllAction(); EndAllAction();
...@@ -183,10 +184,10 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet, ...@@ -183,10 +184,10 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet,
{ {
// for all section in the selection // for all section in the selection
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
const SwPosition* pStt = PCURCRSR->Start(), const SwPosition* pStt = rPaM.Start(),
* pEnd = PCURCRSR->End(); * pEnd = rPaM.End();
const SwSectionNode* pSttSectNd = pStt->nNode.GetNode().FindSectionNode(), const SwSectionNode* pSttSectNd = pStt->nNode.GetNode().FindSectionNode(),
* pEndSectNd = pEnd->nNode.GetNode().FindSectionNode(); * pEndSectNd = pEnd->nNode.GetNode().FindSectionNode();
...@@ -224,7 +225,7 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet, ...@@ -224,7 +225,7 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet,
} }
} }
FOREACHPAM_END() }
} }
} }
...@@ -253,10 +254,11 @@ void SwEditShell::_SetSectionAttr( SwSectionFmt& rSectFmt, ...@@ -253,10 +254,11 @@ void SwEditShell::_SetSectionAttr( SwSectionFmt& rSectFmt,
sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const
{ {
sal_uInt16 nRet = 0; sal_uInt16 nRet = 0;
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
const SwPosition* pStt = PCURCRSR->Start(), const SwPosition* pStt = rPaM.Start(),
* pEnd = PCURCRSR->End(); * pEnd = rPaM.End();
const SwCntntNode* pCNd; const SwCntntNode* pCNd;
// check the selection, if Start at Node begin and End at Node end // check the selection, if Start at Node begin and End at Node end
if( pStt->nContent.GetIndex() || if( pStt->nContent.GetIndex() ||
...@@ -286,7 +288,7 @@ sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const ...@@ -286,7 +288,7 @@ sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const
if( &aSIdx.GetNode() != aEIdx.GetNode().StartOfSectionNode() ) if( &aSIdx.GetNode() != aEIdx.GetNode().StartOfSectionNode() )
++nRet; ++nRet;
FOREACHPAM_END() }
return nRet; return nRet;
} }
......
...@@ -126,11 +126,12 @@ bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts, ...@@ -126,11 +126,12 @@ bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts,
SwWait aWait( *GetDoc()->GetDocShell(), true ); SwWait aWait( *GetDoc()->GetDocShell(), true );
bool bRet = false; bool bRet = false;
StartAllAction(); StartAllAction();
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
if( PCURCRSR->HasMark() ) {
bRet |= 0 != GetDoc()->TextToTable( rInsTblOpts, *PCURCRSR, cCh, if( rPaM.HasMark() )
bRet |= 0 != GetDoc()->TextToTable( rInsTblOpts, rPaM, cCh,
eAdj, pTAFmt ); eAdj, pTAFmt );
FOREACHPAM_END() }
EndAllAction(); EndAllAction();
return bRet; return bRet;
} }
...@@ -185,14 +186,15 @@ bool SwEditShell::TableToText( sal_Unicode cCh ) ...@@ -185,14 +186,15 @@ bool SwEditShell::TableToText( sal_Unicode cCh )
bool SwEditShell::IsTextToTableAvailable() const bool SwEditShell::IsTextToTableAvailable() const
{ {
bool bOnlyText = false; bool bOnlyText = false;
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
if( PCURCRSR->HasMark() && *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() ) {
if( rPaM.HasMark() && *rPaM.GetPoint() != *rPaM.GetMark() )
{ {
bOnlyText = true; bOnlyText = true;
// check if selection is in listing // check if selection is in listing
sal_uLong nStt = PCURCRSR->GetMark()->nNode.GetIndex(), sal_uLong nStt = rPaM.GetMark()->nNode.GetIndex(),
nEnd = PCURCRSR->GetPoint()->nNode.GetIndex(); nEnd = rPaM.GetPoint()->nNode.GetIndex();
if( nStt > nEnd ) { sal_uLong n = nStt; nStt = nEnd; nEnd = n; } if( nStt > nEnd ) { sal_uLong n = nStt; nStt = nEnd; nEnd = n; }
for( ; nStt <= nEnd; ++nStt ) for( ; nStt <= nEnd; ++nStt )
...@@ -205,7 +207,7 @@ bool SwEditShell::IsTextToTableAvailable() const ...@@ -205,7 +207,7 @@ bool SwEditShell::IsTextToTableAvailable() const
if( !bOnlyText ) if( !bOnlyText )
break; break;
} }
FOREACHPAM_END() }
return bOnlyText; return bOnlyText;
} }
......
...@@ -60,10 +60,10 @@ void SwEditShell::Insert(const SwTOXMark& rMark) ...@@ -60,10 +60,10 @@ void SwEditShell::Insert(const SwTOXMark& rMark)
{ {
bool bInsAtPos = rMark.IsAlternativeText(); bool bInsAtPos = rMark.IsAlternativeText();
StartAllAction(); StartAllAction();
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
const SwPosition *pStt = PCURCRSR->Start(), const SwPosition *pStt = rPaM.Start(),
*pEnd = PCURCRSR->End(); *pEnd = rPaM.End();
if( bInsAtPos ) if( bInsAtPos )
{ {
SwPaM aTmp( *pStt ); SwPaM aTmp( *pStt );
...@@ -72,10 +72,10 @@ void SwEditShell::Insert(const SwTOXMark& rMark) ...@@ -72,10 +72,10 @@ void SwEditShell::Insert(const SwTOXMark& rMark)
else if( *pEnd != *pStt ) else if( *pEnd != *pStt )
{ {
GetDoc()->getIDocumentContentOperations().InsertPoolItem( GetDoc()->getIDocumentContentOperations().InsertPoolItem(
*PCURCRSR, rMark, nsSetAttrMode::SETATTR_DONTEXPAND ); rPaM, rMark, nsSetAttrMode::SETATTR_DONTEXPAND );
} }
FOREACHPAM_END() }
EndAllAction(); EndAllAction();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment