sw: rStart variable isn't a reference
Change-Id: I48c402e3dcd9606d7f40ee2096fa8803d5499d73
This commit is contained in:
@@ -72,23 +72,26 @@ namespace
|
|||||||
{
|
{
|
||||||
io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, nullptr);
|
io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, nullptr);
|
||||||
|
|
||||||
SwPosition rStart = pField->GetMarkStart();
|
SwPosition start = pField->GetMarkStart();
|
||||||
SwTextNode const*const pStartTextNode = rStart.nNode.GetNode().GetTextNode();
|
SwTextNode const*const pStartTextNode = start.nNode.GetNode().GetTextNode();
|
||||||
sal_Unicode ch_start = 0;
|
sal_Unicode ch_start = 0;
|
||||||
if( pStartTextNode && ( rStart.nContent.GetIndex() < pStartTextNode->GetText().getLength() ) )
|
if (pStartTextNode && (start.nContent.GetIndex() < pStartTextNode->GetText().getLength()))
|
||||||
ch_start = pStartTextNode->GetText()[rStart.nContent.GetIndex()];
|
ch_start = pStartTextNode->GetText()[start.nContent.GetIndex()];
|
||||||
if( ( ch_start != aStartMark ) && ( aEndMark != CH_TXT_ATR_FORMELEMENT ) )
|
if( ( ch_start != aStartMark ) && ( aEndMark != CH_TXT_ATR_FORMELEMENT ) )
|
||||||
{
|
{
|
||||||
SwPaM aStartPaM(rStart);
|
SwPaM aStartPaM(start);
|
||||||
io_pDoc->getIDocumentContentOperations().InsertString(aStartPaM, OUString(aStartMark));
|
io_pDoc->getIDocumentContentOperations().InsertString(aStartPaM, OUString(aStartMark));
|
||||||
--rStart.nContent;
|
--start.nContent; // restore, it was moved by InsertString
|
||||||
pField->SetMarkStartPos( rStart );
|
// do not manipulate via reference directly but call SetMarkStartPos
|
||||||
|
// which works even if start and end pos were the same
|
||||||
|
pField->SetMarkStartPos( start );
|
||||||
}
|
}
|
||||||
|
|
||||||
SwPosition& rEnd = pField->GetMarkEnd();
|
SwPosition& rEnd = pField->GetMarkEnd();
|
||||||
SwTextNode const*const pEndTextNode = rEnd.nNode.GetNode().GetTextNode();
|
SwTextNode const*const pEndTextNode = rEnd.nNode.GetNode().GetTextNode();
|
||||||
const sal_Int32 nEndPos = ( rEnd == rStart || rEnd.nContent.GetIndex() == 0 ) ?
|
const sal_Int32 nEndPos = (rEnd == start || rEnd.nContent.GetIndex() == 0)
|
||||||
rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1;
|
? rEnd.nContent.GetIndex()
|
||||||
|
: rEnd.nContent.GetIndex() - 1;
|
||||||
sal_Unicode ch_end = 0;
|
sal_Unicode ch_end = 0;
|
||||||
if ( pEndTextNode && ( nEndPos < pEndTextNode->GetText().getLength() ) )
|
if ( pEndTextNode && ( nEndPos < pEndTextNode->GetText().getLength() ) )
|
||||||
ch_end = pEndTextNode->GetText()[nEndPos];
|
ch_end = pEndTextNode->GetText()[nEndPos];
|
||||||
|
Reference in New Issue
Block a user