summaryrefslogtreecommitdiff
path: root/vcl/source/edit
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-03 19:04:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-04 08:53:37 +0200
commit53df91adab37a65d87a44aa724b28128f32e9de5 (patch)
tree1d7b31ee1eeeb9691ccb732f0cb0e06aad4ae5b6 /vcl/source/edit
parent89c0b79911c469518c8872a4ec06b3d2c61c357c (diff)
loplugin:singlevalfields
Change-Id: Ic74b400f0b929b4c57ad70d0b0936983a3d46360 Reviewed-on: https://gerrit.libreoffice.org/80154 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/edit')
-rw-r--r--vcl/source/edit/textview.cxx64
1 files changed, 1 insertions, 63 deletions
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index f9c612a97a36..2eaa1b2f598c 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -142,7 +142,6 @@ struct ImpTextView
bool mbHighlightSelection : 1;
bool mbCursorEnabled : 1;
bool mbClickedInSelection : 1;
- bool mbSupportProtectAttribute : 1;
bool mbCursorAtEndOfLine;
};
@@ -162,8 +161,6 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* pWindow ) :
mpImpl->mbAutoIndent = false;
mpImpl->mbCursorEnabled = true;
mpImpl->mbClickedInSelection = false;
- mpImpl->mbSupportProtectAttribute = false;
- mpImpl->mbCursorAtEndOfLine = false;
// mbInSelection = false;
mpImpl->mnTravelXPos = TRAVEL_X_DONTKNOW;
@@ -579,28 +576,6 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent )
}
mpImpl->mpTextEngine->UndoActionStart();
- if(mpImpl->mbSupportProtectAttribute)
- {
- //expand selection to include all protected content - if there is any
- const TextCharAttrib* pStartAttr = mpImpl->mpTextEngine->FindCharAttrib(
- TextPaM(mpImpl->maSelection.GetStart().GetPara(),
- mpImpl->maSelection.GetStart().GetIndex()),
- TEXTATTR_PROTECTED );
- const TextCharAttrib* pEndAttr = mpImpl->mpTextEngine->FindCharAttrib(
- TextPaM(mpImpl->maSelection.GetEnd().GetPara(),
- mpImpl->maSelection.GetEnd().GetIndex()),
- TEXTATTR_PROTECTED );
- if(pStartAttr && pStartAttr->GetStart() < mpImpl->maSelection.GetStart().GetIndex())
- {
- mpImpl->maSelection.GetStart().GetIndex() = pStartAttr->GetStart();
- aOldSel = mpImpl->maSelection; // update to deleted!
- }
- if(pEndAttr && pEndAttr->GetEnd() > mpImpl->maSelection.GetEnd().GetIndex())
- {
- mpImpl->maSelection.GetEnd().GetIndex() = pEndAttr->GetEnd();
- aOldSel = mpImpl->maSelection; // update to deleted!
- }
- }
aCurSel = ImpDelete( nDel, nMode );
mpImpl->mpTextEngine->UndoActionEnd();
bModified = true;
@@ -761,24 +736,6 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
TextSelection aNewSel( mpImpl->maSelection );
aNewSel.GetStart().GetIndex() = aBoundary.startPos;
aNewSel.GetEnd().GetIndex() = aBoundary.endPos;
- if(mpImpl->mbSupportProtectAttribute)
- {
- //expand selection to include all protected content - if there is any
- const TextCharAttrib* pStartAttr = mpImpl->mpTextEngine->FindCharAttrib(
- TextPaM(aNewSel.GetStart().GetPara(), aBoundary.startPos),
- TEXTATTR_PROTECTED );
- const TextCharAttrib* pEndAttr = mpImpl->mpTextEngine->FindCharAttrib(
- TextPaM(aNewSel.GetEnd().GetPara(), aBoundary.endPos),
- TEXTATTR_PROTECTED );
- if(pStartAttr && pStartAttr->GetStart() < aNewSel.GetStart().GetIndex())
- {
- aNewSel.GetStart().GetIndex() = pStartAttr->GetStart();
- }
- if(pEndAttr && pEndAttr->GetEnd() > aNewSel.GetEnd().GetIndex())
- {
- aNewSel.GetEnd().GetIndex() = pEndAttr->GetEnd();
- }
- }
ImpSetSelection( aNewSel );
ShowSelection();
ShowCursor();
@@ -1911,19 +1868,10 @@ void TextView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
if ( !aText.isEmpty() && ( aText[ aText.getLength()-1 ] == LINE_SEP ) )
aText = aText.copy(0, aText.getLength()-1);
- TextPaM aTempStart = mpImpl->maSelection.GetStart();
if ( ImplCheckTextLen( aText ) )
ImpSetSelection( mpImpl->mpTextEngine->ImpInsertText( mpImpl->mpDDInfo->maDropPos, aText ) );
- if(mpImpl->mbSupportProtectAttribute)
- {
- mpImpl->mpTextEngine->SetAttrib( TextAttribProtect(),
- aTempStart.GetPara(),
- aTempStart.GetIndex(),
- mpImpl->maSelection.GetEnd().GetIndex(), false );
- }
if ( aPrevSel.HasRange() &&
- !mpImpl->mbSupportProtectAttribute && // don't remove currently selected element
(( rDTDE.DropAction & css::datatransfer::dnd::DNDConstants::ACTION_MOVE ) || !bStarterOfDD) )
{
// adjust selection if necessary
@@ -1997,18 +1945,8 @@ void TextView::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& rDTD
Point aDocPos = GetDocPos( aMousePos );
mpImpl->mpDDInfo->maDropPos = mpImpl->mpTextEngine->GetPaM( aDocPos );
- bool bProtected = false;
- if(mpImpl->mbSupportProtectAttribute)
- {
- const TextCharAttrib* pStartAttr = mpImpl->mpTextEngine->FindCharAttrib(
- mpImpl->mpDDInfo->maDropPos,
- TEXTATTR_PROTECTED );
- bProtected = pStartAttr != nullptr &&
- pStartAttr->GetStart() != mpImpl->mpDDInfo->maDropPos.GetIndex() &&
- pStartAttr->GetEnd() != mpImpl->mpDDInfo->maDropPos.GetIndex();
- }
// Don't drop in selection or in read only engine
- if ( IsReadOnly() || IsInSelection( mpImpl->mpDDInfo->maDropPos ) || bProtected)
+ if ( IsReadOnly() || IsInSelection( mpImpl->mpDDInfo->maDropPos ))
{
ImpHideDDCursor();
rDTDE.Context->rejectDrag();