diff options
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/annotations/annotationmanager.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationwindow.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/dlg/headerfooterdlg.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel3.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fubullet.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsfil.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/func/fuparagr.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/func/futext.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unosrch.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/view/NotesPanelViewShell.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 24 | ||||
-rw-r--r-- | sd/source/ui/view/drviews4.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drviewse.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvs2.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/sdview2.cxx | 3 |
21 files changed, 91 insertions, 110 deletions
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index d172d5acd0af..e3743c97ca42 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -610,7 +610,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq ) aStr += sQuote + "\"\n"; for( sal_Int32 nIdx = 0; nIdx >= 0; ) - aOutliner.Insert( aStr.getToken( 0, '\n', nIdx ), EE_PARA_APPEND, -1 ); + aOutliner.Insert(aStr.getToken(0, '\n', nIdx), EE_PARA_MAX, -1); if( aOutliner.GetParagraphCount() > 1 ) { @@ -618,8 +618,8 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq ) aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC)); ESelection aSel; - aSel.nEndPara = aOutliner.GetParagraphCount()-2; - aSel.nEndPos = aOutliner.GetText( aOutliner.GetParagraph( aSel.nEndPara ) ).getLength(); + aSel.end.nPara = aOutliner.GetParagraphCount() - 2; + aSel.end.nIndex = aOutliner.GetText( aOutliner.GetParagraph( aSel.end.nPara ) ).getLength(); aOutliner.QuickSetAttribs( aAnswerSet, aSel ); } diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index 1de79f30cb2c..01b9181f020c 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -354,7 +354,7 @@ void AnnotationWindow::FillMenuButton() void AnnotationWindow::StartEdit() { - GetOutlinerView()->SetSelection(ESelection::NoSelection()); + GetOutlinerView()->SetSelection(ESelection::AtEnd()); GetOutlinerView()->ShowCursor(); } @@ -455,8 +455,7 @@ void AnnotationWindow::SetLanguage(const SvxLanguageItem &aNewItem) mpOutliner->SetModifyHdl( Link<LinkParamNone*,void>() ); ESelection aOld = GetOutlinerView()->GetSelection(); - ESelection aNewSelection( 0, 0, mpOutliner->GetParagraphCount()-1, EE_TEXTPOS_ALL ); - GetOutlinerView()->SetSelection( aNewSelection ); + GetOutlinerView()->SetSelection(ESelection::All()); SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs()); aEditAttr.Put(aNewItem); GetOutlinerView()->SetAttribs( aEditAttr ); diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index fe5c17045efe..056c56b32e97 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -570,7 +570,7 @@ bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool if( pOPO ) pOutl->SetText( *pOPO ); - EPosition aDateFieldPosition; + EPaM aDateFieldPosition; bool bHasDateFieldItem = false; sal_Int32 nParaCount = pEdit->GetParagraphCount(); diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index e4e3f9d4d171..1ebde799f15a 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -341,8 +341,8 @@ void DrawDocShell::Execute( SfxRequest& rReq ) { ESelection aSel = rEditView.GetSelection(); aOldSel = aSel; - aSel.nStartPos = 0; - aSel.nEndPos = EE_TEXTPOS_ALL; + aSel.start.nIndex = 0; + aSel.end.nIndex = EE_TEXTPOS_MAX; rEditView.SetSelection( aSel ); } diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index a19e6ff51a3a..ba2e1d71cc50 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -138,8 +138,7 @@ void FuBullet::InsertFormattingMark( sal_Unicode cMark ) pOV->InsertText( aStr, true); ESelection aSel = pOV->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); pOV->SetSelection(aSel); rUndoMgr.LeaveListAction(); @@ -270,8 +269,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq ) pOV->SetAttribs(aSet); ESelection aSel = pOV->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); pOV->SetSelection(aSel); // do not go ahead with setting attributes of special characters diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 639c9845ba14..630ea14ae3aa 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -473,8 +473,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) { Paragraph* pPara = aOutliner.GetParagraph( 0 ); sal_uLong nLen = aOutliner.GetText( pPara ).getLength(); - aOutliner.QuickDelete( ESelection( 0, nLen, 1, 0 ) ); - aOutliner.QuickInsertLineBreak( ESelection( 0, nLen, 0, nLen ) ); + aOutliner.QuickInsertLineBreak(ESelection(0, nLen, 1, 0)); } } } diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx index ac5d87636098..2640b9251f19 100644 --- a/sd/source/ui/func/fuparagr.cxx +++ b/sd/source/ui/func/fuparagr.cxx @@ -82,8 +82,8 @@ void FuParagraph::DoExecute( SfxRequest& rReq ) if( pOutlView && pOutliner ) { ESelection eSelection = pOutlView->GetSelection(); - aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.nStartPara ) ) ); - aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.nStartPara ) ) ); + aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.start.nPara ) ) ); + aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.start.nPara ) ) ); } SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); @@ -114,13 +114,13 @@ void FuParagraph::DoExecute( SfxRequest& rReq ) if( const SfxBoolItem* pItem = pArgs->GetItemIfSet( ATTR_NUMBER_NEWSTART, false ) ) { const bool bNewStart = pItem->GetValue(); - pOutliner->SetParaIsNumberingRestart( eSelection.nStartPara, bNewStart ); + pOutliner->SetParaIsNumberingRestart( eSelection.start.nPara, bNewStart ); } if( const SfxInt16Item* pItem = pArgs->GetItemIfSet( ATTR_NUMBER_NEWSTART_AT, false ) ) { const sal_Int16 nStartAt = pItem->GetValue(); - pOutliner->SetNumberingStartValue( eSelection.nStartPara, nStartAt ); + pOutliner->SetNumberingStartValue( eSelection.start.nPara, nStartAt ); } } diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 24f8ad1e3046..799dc51c42aa 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -1098,9 +1098,8 @@ void FuText::SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag) else { // Move cursor to end of text - ESelection aNewSelection = ESelection::NotFound(); if (pOLV != nullptr) - pOLV->SetSelection(aNewSelection); + pOLV->SetSelection(ESelection::AtEnd()); } } else @@ -1376,11 +1375,7 @@ void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFo pOLV = pView->GetTextEditOutlinerView(); if( pOLV ) { - EditEngine& rEditEngine = pOLV->GetEditView().getEditEngine(); - ESelection aSel; - aSel.nEndPara = rEditEngine.GetParagraphCount() - 1; - aSel.nEndPos = rEditEngine.GetTextLen(aSel.nEndPara); - pOLV->SetSelection(aSel); + pOLV->SetSelection(ESelection::All()); ChangeFontSize( bGrow, pOLV, pFontList, pView ); } diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index 13e9643e95fb..8ed2ece29d7c 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -461,14 +461,14 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: ESelection aEndSel( GetSelection( xPortion->getEnd() ) ); // special case for empty portions with content or length one portions with content (fields) - if( (aStartSel.nStartPos == aEndSel.nStartPos) || ( (aStartSel.nStartPos == (aEndSel.nStartPos - 1)) && (nLen > 1) ) ) + if( (aStartSel.start.nIndex == aEndSel.start.nIndex) || ( (aStartSel.start.nIndex == (aEndSel.start.nIndex - 1)) && (nLen > 1) ) ) { for( sal_Int32 i = 0; i < nLen; i++ ) { if( ndbg < (nTextLen+2) ) { - *pPos++ = aStartSel.nStartPos; - *pPara++ = aStartSel.nStartPara; + *pPos++ = aStartSel.start.nIndex; + *pPara++ = aStartSel.start.nPara; ndbg += 1; } @@ -478,7 +478,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: } } - nLastPos = aStartSel.nStartPos; + nLastPos = aStartSel.start.nIndex; } // normal case else @@ -487,8 +487,8 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: { if( ndbg < (nTextLen+2) ) { - *pPos++ = aStartSel.nStartPos++; - *pPara++ = aStartSel.nStartPara; + *pPos++ = aStartSel.start.nIndex++; + *pPara++ = aStartSel.start.nPara; ndbg += 1; } @@ -498,10 +498,10 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: } } - nLastPos = aStartSel.nStartPos - 1; - DBG_ASSERT( aEndSel.nStartPos == aStartSel.nStartPos, "Search is not working" ); + nLastPos = aStartSel.start.nIndex - 1; + DBG_ASSERT( aEndSel.start.nIndex == aStartSel.start.nIndex, "Search is not working" ); } - nLastPara = aStartSel.nStartPara; + nLastPara = aStartSel.start.nPara; } } } @@ -529,7 +529,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: sal_Int32 nEndPos = 0; for( nStartPos = 0; nStartPos < nTextLen; nStartPos++ ) { - if( pConvertPara[nStartPos] == aSel.nStartPara && pConvertPos[nStartPos] == aSel.nStartPos ) + if( pConvertPara[nStartPos] == aSel.start.nPara && pConvertPos[nStartPos] == aSel.start.nIndex ) break; } diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx b/sd/source/ui/view/NotesPanelViewShell.cxx index e2fadf2a2c5c..2834a895b712 100644 --- a/sd/source/ui/view/NotesPanelViewShell.cxx +++ b/sd/source/ui/view/NotesPanelViewShell.cxx @@ -426,7 +426,7 @@ void NotesPanelViewShell::GetCtrlState(SfxItemSet& rSet) if (pFieldItem) { ESelection aSel = pOLV->GetSelection(); - if (abs(aSel.nEndPos - aSel.nStartPos) == 1) + if (abs(aSel.end.nIndex - aSel.start.nIndex) == 1) { const SvxFieldData* pField = pFieldItem->GetField(); if (auto pUrlField = dynamic_cast<const SvxURLField*>(pField)) @@ -531,7 +531,7 @@ void NotesPanelViewShell::GetAttrState(SfxItemSet& rSet) OutlinerView* pOV = mpNotesPanelView->GetOutlinerView(); ESelection aESel(pOV->GetSelection()); - if (aESel.nStartPara != aESel.nEndPara || aESel.nStartPos != aESel.nEndPos) + if (aESel.HasRange()) // spanned selection, i.e. StyleSheet and/or // attribution not necessarily unique rSet.DisableItem(nWhich); @@ -845,10 +845,10 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) EE_FEATURE_FIELD); ESelection aSel(pOutlinerView->GetSelection()); pOutlinerView->InsertField(aURLItem); - if (aSel.nStartPos <= aSel.nEndPos) - aSel.nEndPos = aSel.nStartPos + 1; + if (aSel.start.nIndex <= aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex + 1; else - aSel.nStartPos = aSel.nEndPos + 1; + aSel.start.nIndex = aSel.end.nIndex + 1; pOutlinerView->SetSelection(aSel); } @@ -1020,8 +1020,8 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) { // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); - if (aSel.nStartPos == aSel.nEndPos) - aSel.nEndPos++; + if (aSel.start.nIndex == aSel.end.nIndex) + aSel.end.nIndex++; pOutlinerView->SetSelection(aSel); } @@ -1061,10 +1061,10 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); bool bSel = true; - if (aSel.nStartPos == aSel.nEndPos) + if (aSel.start.nIndex == aSel.end.nIndex) { bSel = false; - aSel.nEndPos++; + aSel.end.nIndex++; } pOutlinerView->SetSelection(aSel); @@ -1072,7 +1072,7 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) // reset selection to original state if (!bSel) - aSel.nEndPos--; + aSel.end.nIndex--; pOutlinerView->SetSelection(aSel); pField.reset(); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index d25744a4926e..6f37edc79e70 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -560,13 +560,11 @@ void SdOutliner::Initialize (bool bDirectionIsForward) ESelection aSelection = getOutlinerView()->GetSelection (); if (mbDirectionIsForward) { - aSelection.nEndPara = aSelection.nStartPara; - aSelection.nEndPos = aSelection.nStartPos; + aSelection.CollapseToStart(); } else { - aSelection.nStartPara = aSelection.nEndPara; - aSelection.nStartPos = aSelection.nEndPos; + aSelection.CollapseToEnd(); } getOutlinerView()->SetSelection (aSelection); } @@ -1776,20 +1774,14 @@ void SdOutliner::EnterEditMode (bool bGrabFocus) ESelection SdOutliner::GetSearchStartPosition() const { + // The default constructor uses the beginning of the text as default. ESelection aPosition; - if (mbDirectionIsForward) - { - // The default constructor uses the beginning of the text as default. - aPosition = ESelection (); - } - else + if (!mbDirectionIsForward) { // Retrieve the position after the last character in the last // paragraph. sal_Int32 nParagraphCount = GetParagraphCount(); - if (nParagraphCount == 0) - aPosition = ESelection(); - else + if (nParagraphCount != 0) { sal_Int32 nLastParagraphLength = GetEditEngine().GetTextLen ( nParagraphCount-1); diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 4bdc074a0574..3e800881960b 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -482,8 +482,8 @@ void TextObjectBar::GetAttrStateImpl(ViewShell* mpViewShell, ::sd::View* mpView, { ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; - sal_Int32 nEndPara = aSel.nEndPara; + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; if( !aSel.HasRange() ) { nStartPara = 0; diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index b90bff224518..898f11687d8f 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -136,8 +136,8 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR { ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; - sal_Int32 nEndPara = aSel.nEndPara; + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; if( !aSel.HasRange() ) { nStartPara = 0; @@ -192,8 +192,8 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR { ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; - sal_Int32 nEndPara = aSel.nEndPara; + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; if( !aSel.HasRange() ) { nStartPara = 0; @@ -447,8 +447,8 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR SvxNumRule aNewRule(pItem->GetNumRule()); ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; - sal_Int32 nEndPara = aSel.nEndPara; + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara) { sal_uInt16 nLevel = pOL->GetDepth(nPara); @@ -614,7 +614,7 @@ SET_ADJUST: // set anchor ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; + sal_Int32 nStartPara = aSel.start.nPara; if (!aSel.HasRange()) nStartPara = 0; @@ -776,7 +776,7 @@ SET_ADJUST: // set anchor ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; + sal_Int32 nStartPara = aSel.start.nPara; if (!aSel.HasRange()) nStartPara = 0; diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index d67963b2a823..2803fb0721eb 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -411,7 +411,7 @@ private: for (svx::ClassificationResult const & rResult : rResults) { - ESelection aPosition(nParagraph, EE_TEXTPOS_MAX_COUNT); + ESelection aPosition(nParagraph, EE_TEXTPOS_MAX); switch (rResult.meType) { @@ -2330,13 +2330,13 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { //we are on the last paragraph aSel.Adjust(); - if (aSel.nEndPara == pOL->GetParagraphCount() - 1) + if (aSel.end.nPara == pOL->GetParagraphCount() - 1) { - sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara); + sal_uInt16 nDepth = pOL->GetDepth(aSel.end.nPara); //there exists a previous numbering level if (nDepth != sal_uInt16(-1) && nDepth > 0) { - Paragraph* pPara = pOL->GetParagraph(aSel.nEndPara); + Paragraph* pPara = pOL->GetParagraph(aSel.end.nPara); pOL->Remove(pPara, 1); } } @@ -2369,14 +2369,14 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { //we are on the last paragraph aSel.Adjust(); - if (aSel.nEndPara == pOL->GetParagraphCount() - 1) + if (aSel.end.nPara == pOL->GetParagraphCount() - 1) { - sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara); + sal_uInt16 nDepth = pOL->GetDepth(aSel.end.nPara); //there exists a previous numbering level if (nDepth < 8) { sal_uInt16 nNewDepth = nDepth+1; - pOL->Insert(SdResId(STR_PRESOBJ_MPOUTLINE_ARY[nNewDepth]), EE_PARA_APPEND, nNewDepth); + pOL->Insert(SdResId(STR_PRESOBJ_MPOUTLINE_ARY[nNewDepth]), EE_PARA_MAX, nNewDepth); } } } @@ -2474,8 +2474,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // select field, then it will be deleted when inserting ESelection aSel = pOLV->GetSelection(); - if( aSel.nStartPos == aSel.nEndPos ) - aSel.nEndPos++; + if (aSel.start.nIndex == aSel.end.nIndex) + aSel.end.nIndex++; pOLV->SetSelection( aSel ); } @@ -2552,10 +2552,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD ); - if( aSel.nStartPos == aSel.nEndPos ) + if (aSel.start.nIndex == aSel.end.nIndex) { bSelectionWasModified = true; - aSel.nEndPos++; + aSel.end.nIndex++; pOLV->SetSelection( aSel ); } @@ -2581,7 +2581,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) // restore selection to original if(bSelectionWasModified) { - aSel.nEndPos--; + aSel.end.nIndex--; pOLV->SetSelection( aSel ); } } diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 6652f8d64e9c..6db20f982c80 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -603,7 +603,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) if( pOLV->GetOutliner() ) { ESelection aSelection( pOLV->GetSelection() ); - eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos ); + eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.start.nPara, aSelection.start.nIndex ); } //fdo#44998 if the outliner has captured the mouse events release the lock @@ -627,10 +627,10 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) // select field, so that it will be deleted on insert ESelection aSel = pOLV->GetSelection(); bool bSel = true; - if( aSel.nStartPos == aSel.nEndPos ) + if (aSel.start.nIndex == aSel.end.nIndex) { bSel = false; - aSel.nEndPos++; + aSel.end.nIndex++; } pOLV->SetSelection( aSel ); @@ -638,7 +638,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) // reset selection back to original state if( !bSel ) - aSel.nEndPos--; + aSel.end.nIndex--; pOLV->SetSelection( aSel ); } } diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 8bb8748e2e36..b63253fa36e4 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1530,9 +1530,9 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { //and are on the last paragraph aSel.Adjust(); - if (aSel.nEndPara == pOL->GetParagraphCount() - 1) + if (aSel.end.nPara == pOL->GetParagraphCount() - 1) { - sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara); + sal_uInt16 nDepth = pOL->GetDepth(aSel.end.nPara); if (nDepth != sal_uInt16(-1)) { //there exists another numbering level that diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index b68d3e09cfdf..7cd214e19331 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -899,18 +899,18 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) { OUString sInput = pOLV->GetSurroundingText(); ESelection aSel( pOLV->GetSelection() ); - if( aSel.nStartPos > aSel.nEndPos ) - aSel.nEndPos = aSel.nStartPos; + if (aSel.start.nIndex > aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex; //calculate a valid end-position by reading logical characters sal_Int32 nUtf16Pos=0; - while( (nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.nEndPos) ) + while ((nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.end.nIndex)) { sInput.iterateCodePoints(&nUtf16Pos); //The mouse can set the cursor in the middle of a multi-unit character, // so reset to the proper end of the logical characters - if( nUtf16Pos > aSel.nEndPos ) - aSel.nEndPos = nUtf16Pos; + if (nUtf16Pos > aSel.end.nIndex) + aSel.end.nIndex = nUtf16Pos; } ToggleUnicodeCodepoint aToggle; @@ -921,7 +921,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) { OUString sStringToReplace = aToggle.StringToReplace(); mpDrawView->BegUndo(sStringToReplace +"->"+ sReplacement); - aSel.nStartPos = aSel.nEndPos - sStringToReplace.getLength(); + aSel.start.nIndex = aSel.end.nIndex - sStringToReplace.getLength(); pOLV->SetSelection( aSel ); pOLV->InsertText(sReplacement, true); mpDrawView->EndUndo(); @@ -1496,10 +1496,10 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText, ESelection aSel( pOLV->GetSelection() ); SvxFieldItem aURLItem( SvxURLField( rURL, rText, SvxURLFormat::Repr ), EE_FEATURE_FIELD ); pOLV->InsertField( aURLItem ); - if ( aSel.nStartPos <= aSel.nEndPos ) - aSel.nEndPos = aSel.nStartPos + 1; + if (aSel.start.nIndex <= aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex + 1; else - aSel.nStartPos = aSel.nEndPos + 1; + aSel.start.nIndex = aSel.end.nIndex + 1; pOLV->SetSelection( aSel ); } else diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 0d9286ffcc62..8444d9129b57 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -799,7 +799,7 @@ OUString DrawViewShell::GetSelectionText(bool bCompleteWords) OUString aStrCurrentDelimiters = pOl->GetWordDelimiters(); pOl->SetWordDelimiters(u" .,;\"'"_ustr); - aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos ); + aStrSelection = pOl->GetWord(aSel.end); pOl->SetWordDelimiters( aStrCurrentDelimiters ); } else diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 7cdbfa094f64..99935ec3ec57 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -359,10 +359,10 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) SvxURLFormat::Repr), EE_FEATURE_FIELD); ESelection aSel( pOutlinerView->GetSelection() ); pOutlinerView->InsertField(aURLItem); - if ( aSel.nStartPos <= aSel.nEndPos ) - aSel.nEndPos = aSel.nStartPos + 1; + if (aSel.start.nIndex <= aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex + 1; else - aSel.nStartPos = aSel.nEndPos + 1; + aSel.start.nIndex = aSel.end.nIndex + 1; pOutlinerView->SetSelection( aSel ); } @@ -534,8 +534,8 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); - if( aSel.nStartPos == aSel.nEndPos ) - aSel.nEndPos++; + if (aSel.start.nIndex == aSel.end.nIndex) + aSel.end.nIndex++; pOutlinerView->SetSelection( aSel ); } @@ -572,10 +572,10 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); bool bSel = true; - if( aSel.nStartPos == aSel.nEndPos ) + if (aSel.start.nIndex == aSel.end.nIndex) { bSel = false; - aSel.nEndPos++; + aSel.end.nIndex++; } pOutlinerView->SetSelection( aSel ); @@ -583,7 +583,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) // reset selection to original state if( !bSel ) - aSel.nEndPos--; + aSel.end.nIndex--; pOutlinerView->SetSelection( aSel ); pField.reset(); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 90fa7e8cafdb..f55ad226fa4e 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -355,7 +355,7 @@ void OutlineViewShell::GetCtrlState(SfxItemSet &rSet) if (pFieldItem) { ESelection aSel = pOLV->GetSelection(); - if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 ) + if (abs(aSel.end.nIndex - aSel.start.nIndex) == 1) { const SvxFieldData* pField = pFieldItem->GetField(); if ( auto pUrlField = dynamic_cast< const SvxURLField *>( pField ) ) @@ -1484,8 +1484,7 @@ void OutlineViewShell::GetAttrState( SfxItemSet& rSet ) OutlinerView* pOV = pOlView->GetViewByWindow(pActWin); ESelection aESel(pOV->GetSelection()); - if (aESel.nStartPara != aESel.nEndPara || - aESel.nStartPos != aESel.nEndPos) + if (aESel.HasRange()) // spanned selection, i.e. StyleSheet and/or // attribution not necessarily unique rSet.DisableItem(nWhich); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index fd4abde21279..8f5937172c0c 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -303,8 +303,7 @@ void View::DoPaste (::sd::Window* pWindow) for( sal_Int32 nPara = nParaCount - 2; nPara >= 0; nPara-- ) { const sal_Int32 nParaLen = rEdit.GetTextLen( nPara ); - pOutliner->QuickDelete( ESelection( nPara, nParaLen, nPara+1, 0 ) ); - pOutliner->QuickInsertLineBreak( ESelection( nPara, nParaLen, nPara, nParaLen ) ); + pOutliner->QuickInsertLineBreak(ESelection(nPara, nParaLen, nPara + 1, 0)); } DBG_ASSERT( rEdit.GetParagraphCount() <= 1, "Titleobject contains hard line breaks" ); |