[Libreoffice-commits] core.git: include/vcl vcl/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 28 09:37:35 UTC 2021
include/vcl/settings.hxx | 4 -
include/vcl/textview.hxx | 1
vcl/source/edit/textview.cxx | 106 ++++---------------------------------------
vcl/source/edit/vclmedit.cxx | 4 -
4 files changed, 12 insertions(+), 103 deletions(-)
New commits:
commit 85e2aa4191497db91a11fb340d143f80e6ac8baa
Author: Noel Grandin <noel at peralex.com>
AuthorDate: Thu Jan 28 10:31:37 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jan 28 10:36:48 2021 +0100
remove unused SelectionOptions values
Focus is dead since
commit 6a22fc81e219667566b9cc3ed5e9de1898c1fe6b
Date: Thu Apr 23 20:49:05 2020 +0200
loplugin:unusedmethods
Invert seems to have dead since initial import
Change-Id: I9f03a9cd9abef6d056331ead47bfff5ffcef512b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110044
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 427447c8d1b2..f09e50608e76 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -181,13 +181,11 @@ namespace o3tl
enum class SelectionOptions
{
NONE = 0x0000,
- Focus = 0x0001,
- Invert = 0x0002,
ShowFirst = 0x0004,
};
namespace o3tl
{
- template<> struct typed_flags<SelectionOptions> : is_typed_flags<SelectionOptions, 0x0007> {};
+ template<> struct typed_flags<SelectionOptions> : is_typed_flags<SelectionOptions, 0x0004> {};
}
enum class DisplayOptions
diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx
index d913dfd99c0a..105fd352089c 100644
--- a/include/vcl/textview.hxx
+++ b/include/vcl/textview.hxx
@@ -98,7 +98,6 @@ class VCL_DLLPUBLIC TextView final : public vcl::unohelper::DragAndDropClient
void ImpPaint(vcl::RenderContext& rRenderContext, const Point& rStartPos, tools::Rectangle const* pPaintArea, TextSelection const* pSelection);
void ImpPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
void ImpShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bEndKey );
- void ImpHighlight( const TextSelection& rSel );
void ImpSetSelection( const TextSelection& rSelection );
Point ImpGetOutputStartPos( const Point& rStartDocPos ) const;
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index f7095a0d590c..73a68de7ca42 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -139,7 +139,6 @@ struct ImpTextView
bool mbReadOnly : 1;
bool mbPaintSelection : 1;
bool mbAutoIndent : 1;
- bool mbHighlightSelection : 1;
bool mbCursorEnabled : 1;
bool mbClickedInSelection : 1;
bool mbCursorAtEndOfLine;
@@ -157,7 +156,6 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* pWindow ) :
mpImpl->mbAutoScroll = true;
mpImpl->mbInsertMode = true;
mpImpl->mbReadOnly = false;
- mpImpl->mbHighlightSelection = false;
mpImpl->mbAutoIndent = false;
mpImpl->mbCursorEnabled = true;
mpImpl->mbClickedInSelection = false;
@@ -175,9 +173,6 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* pWindow ) :
pWindow->SetCursor( mpImpl->mpCursor.get() );
pWindow->SetInputContext( InputContext( pEng->GetFont(), InputContextFlags::Text|InputContextFlags::ExtText ) );
- if ( pWindow->GetSettings().GetStyleSettings().GetSelectionOptions() & SelectionOptions::Invert )
- mpImpl->mbHighlightSelection = true;
-
pWindow->SetLineColor();
if ( pWindow->GetDragGestureRecognizer().is() )
@@ -291,85 +286,11 @@ void TextView::ImpPaint(vcl::RenderContext& rRenderContext, const tools::Rectang
return;
TextSelection *pDrawSelection = nullptr;
- if (!mpImpl->mbHighlightSelection && mpImpl->maSelection.HasRange())
+ if (mpImpl->maSelection.HasRange())
pDrawSelection = &mpImpl->maSelection;
Point aStartPos = ImpGetOutputStartPos(mpImpl->maStartDocPos);
ImpPaint(rRenderContext, aStartPos, &rRect, pDrawSelection);
- if (mpImpl->mbHighlightSelection)
- ImpHighlight(mpImpl->maSelection);
-}
-
-void TextView::ImpHighlight( const TextSelection& rSel )
-{
- TextSelection aSel( rSel );
- aSel.Justify();
- if ( !(aSel.HasRange() && !mpImpl->mpTextEngine->IsInUndo() && mpImpl->mpTextEngine->GetUpdateMode()) )
- return;
-
- mpImpl->mpCursor->Hide();
-
- SAL_WARN_IF( mpImpl->mpTextEngine->mpIdleFormatter->IsActive(), "vcl", "ImpHighlight: Not formatted!" );
-
- tools::Rectangle aVisArea( mpImpl->maStartDocPos, mpImpl->mpWindow->GetOutputSizePixel() );
- tools::Long nY = 0;
- const sal_uInt32 nStartPara = aSel.GetStart().GetPara();
- const sal_uInt32 nEndPara = aSel.GetEnd().GetPara();
- for ( sal_uInt32 nPara = 0; nPara <= nEndPara; ++nPara )
- {
- const tools::Long nParaHeight = mpImpl->mpTextEngine->CalcParaHeight( nPara );
- if ( ( nPara >= nStartPara ) && ( ( nY + nParaHeight ) > aVisArea.Top() ) )
- {
- TEParaPortion* pTEParaPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( nPara );
- std::vector<TextLine>::size_type nStartLine = 0;
- std::vector<TextLine>::size_type nEndLine = pTEParaPortion->GetLines().size() -1;
- if ( nPara == nStartPara )
- nStartLine = pTEParaPortion->GetLineNumber( aSel.GetStart().GetIndex(), false );
- if ( nPara == nEndPara )
- nEndLine = pTEParaPortion->GetLineNumber( aSel.GetEnd().GetIndex(), true );
-
- // iterate over all lines
- for ( std::vector<TextLine>::size_type nLine = nStartLine; nLine <= nEndLine; nLine++ )
- {
- TextLine& rLine = pTEParaPortion->GetLines()[ nLine ];
- sal_Int32 nStartIndex = rLine.GetStart();
- sal_Int32 nEndIndex = rLine.GetEnd();
- if ( ( nPara == nStartPara ) && ( nLine == nStartLine ) )
- nStartIndex = aSel.GetStart().GetIndex();
- if ( ( nPara == nEndPara ) && ( nLine == nEndLine ) )
- nEndIndex = aSel.GetEnd().GetIndex();
-
- // possible if at the beginning of a wrapped line
- if ( nEndIndex < nStartIndex )
- nEndIndex = nStartIndex;
-
- tools::Rectangle aTmpRect( mpImpl->mpTextEngine->GetEditCursor( TextPaM( nPara, nStartIndex ), false ) );
- aTmpRect.AdjustTop(nY );
- aTmpRect.AdjustBottom(nY );
- Point aTopLeft( aTmpRect.TopLeft() );
-
- aTmpRect = mpImpl->mpTextEngine->GetEditCursor( TextPaM( nPara, nEndIndex ), true );
- aTmpRect.AdjustTop(nY );
- aTmpRect.AdjustBottom(nY );
- Point aBottomRight( aTmpRect.BottomRight() );
- aBottomRight.AdjustX( -1 );
-
- // only paint if in the visible region
- if ( ( aTopLeft.X() < aBottomRight.X() ) && ( aBottomRight.Y() >= aVisArea.Top() ) )
- {
- Point aPnt1( GetWindowPos( aTopLeft ) );
- Point aPnt2( GetWindowPos( aBottomRight ) );
-
- tools::Rectangle aRect( aPnt1, aPnt2 );
- mpImpl->mpWindow->Invert( aRect );
- }
- }
- }
- nY += nParaHeight;
-
- if ( nY >= aVisArea.Bottom() )
- break;
- }
}
void TextView::ImpSetSelection( const TextSelection& rSelection )
@@ -417,24 +338,17 @@ void TextView::ImpShowHideSelection(const TextSelection* pRange)
if ( !pRangeOrSelection->HasRange() )
return;
- if ( mpImpl->mbHighlightSelection )
- {
- ImpHighlight( *pRangeOrSelection );
- }
+ if( mpImpl->mpWindow->IsPaintTransparent() )
+ mpImpl->mpWindow->Invalidate();
else
{
- if( mpImpl->mpWindow->IsPaintTransparent() )
- mpImpl->mpWindow->Invalidate();
- else
- {
- TextSelection aRange( *pRangeOrSelection );
- aRange.Justify();
- bool bVisCursor = mpImpl->mpCursor->IsVisible();
- mpImpl->mpCursor->Hide();
- Invalidate();
- if (bVisCursor)
- mpImpl->mpCursor->Show();
- }
+ TextSelection aRange( *pRangeOrSelection );
+ aRange.Justify();
+ bool bVisCursor = mpImpl->mpCursor->IsVisible();
+ mpImpl->mpCursor->Hide();
+ Invalidate();
+ if (bVisCursor)
+ mpImpl->mpCursor->Show();
}
}
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 785871f8cf32..1bedc444f2f0 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -849,9 +849,7 @@ void TextWindow::GetFocus()
return;
bool bGotoCursor = !mpExtTextView->IsReadOnly();
- if ( mbFocusSelectionHide && IsReallyVisible()
- && ( mbSelectOnTab &&
- (!mbInMBDown || ( GetSettings().GetStyleSettings().GetSelectionOptions() & SelectionOptions::Focus ) )) )
+ if ( mbFocusSelectionHide && IsReallyVisible() && mbSelectOnTab && !mbInMBDown )
{
// select everything, but do not scroll
bool bAutoScroll = mpExtTextView->IsAutoScroll();
More information about the Libreoffice-commits
mailing list