summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-27 12:06:16 +0200
committerNoel Grandin <noel@peralex.com>2015-07-28 08:35:34 +0200
commit4eeeec899f44d2010189251c0f09120ade202dd8 (patch)
tree244f1d354d70cc54697acdf05db0025b05d0aa27
parent01075a7274bd3921501d382a71720581a48bfd66 (diff)
convert RGCHK constants to scoped enum
Change-Id: Iafeae0f85f751469900471cf8fccd5f763407890
-rw-r--r--editeng/source/editeng/editview.cxx2
-rw-r--r--editeng/source/editeng/impedit.cxx12
-rw-r--r--editeng/source/editeng/impedit.hxx3
-rw-r--r--forms/source/richtext/richtextimplcontrol.cxx4
-rw-r--r--include/editeng/editdata.hxx4
-rw-r--r--include/editeng/editview.hxx10
6 files changed, 20 insertions, 15 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 049c5a1eb256..d9e4431d1012 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -407,7 +407,7 @@ void EditView::HideCursor()
pImpEditView->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr());
}
-Pair EditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck )
+Pair EditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
{
return pImpEditView->Scroll( ndX, ndY, nRangeCheck );
}
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index b79a32667fe7..106888096a51 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -973,7 +973,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16
}
}
-Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck )
+Pair ImpEditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
{
DBG_ASSERT( pEditEngine->pImpEditEngine->IsFormatted(), "Scroll: Not formatted!" );
if ( !ndX && !ndY )
@@ -999,13 +999,13 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck )
aNewVisArea.Top() += ndX;
aNewVisArea.Bottom() += ndX;
}
- if ( ( nRangeCheck == RGCHK_PAPERSZ1 ) && ( aNewVisArea.Bottom() > (long)pEditEngine->pImpEditEngine->GetTextHeight() ) )
+ if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( aNewVisArea.Bottom() > (long)pEditEngine->pImpEditEngine->GetTextHeight() ) )
{
// GetTextHeight still optimizing!
long nDiff = pEditEngine->pImpEditEngine->GetTextHeight() - aNewVisArea.Bottom(); // negative
aNewVisArea.Move( 0, nDiff ); // could end up in the negative area...
}
- if ( ( aNewVisArea.Top() < 0 ) && ( nRangeCheck != RGCHK_NONE ) )
+ if ( ( aNewVisArea.Top() < 0 ) && ( nRangeCheck != ScrollRangeCheck::NONE ) )
aNewVisArea.Move( 0, -aNewVisArea.Top() );
// Horizontal:
@@ -1019,12 +1019,12 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck )
aNewVisArea.Left() -= ndY;
aNewVisArea.Right() -= ndY;
}
- if ( ( nRangeCheck == RGCHK_PAPERSZ1 ) && ( aNewVisArea.Right() > (long)pEditEngine->pImpEditEngine->CalcTextWidth( false ) ) )
+ if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( aNewVisArea.Right() > (long)pEditEngine->pImpEditEngine->CalcTextWidth( false ) ) )
{
long nDiff = pEditEngine->pImpEditEngine->CalcTextWidth( false ) - aNewVisArea.Right(); // negative
aNewVisArea.Move( nDiff, 0 ); // could end up in the negative area...
}
- if ( ( aNewVisArea.Left() < 0 ) && ( nRangeCheck != RGCHK_NONE ) )
+ if ( ( aNewVisArea.Left() < 0 ) && ( nRangeCheck != ScrollRangeCheck::NONE ) )
aNewVisArea.Move( -aNewVisArea.Left(), 0 );
// The difference must be alignt on pixel (due to scroll!)
@@ -1953,7 +1953,7 @@ void ImpEditView::dragOver(const ::com::sun::star::datatransfer::dnd::DropTarget
if ( nScrollX || nScrollY )
{
HideDDCursor();
- Scroll( nScrollX, nScrollY, RGCHK_PAPERSZ1 );
+ Scroll( nScrollX, nScrollY, ScrollRangeCheck::PaperWidthTextSize );
}
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index f78185b2cc1c..bb199c0c3f51 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -29,6 +29,7 @@
#include <editeng/SpellPortions.hxx>
#include <editeng/eedata.hxx>
#include "editeng/editeng.hxx"
+#include <editeng/editview.hxx>
#include <vcl/virdev.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/cursor.hxx>
@@ -347,7 +348,7 @@ public:
void RecalcOutputArea();
void ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16 nShowCursorFlags = 0 );
- Pair Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck = RGCHK_NEG );
+ Pair Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck = ScrollRangeCheck::NoNegative );
void SetInsertMode( bool bInsert );
bool IsInsertMode() const { return !( nControl & EVControlBits::OVERWRITE ); }
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx
index a37190d987ad..6fe4348311bf 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -320,14 +320,14 @@ namespace frm
IMPL_LINK( RichTextControlImpl, OnHScroll, ScrollBar*, _pScrollbar )
{
- m_pView->Scroll( -_pScrollbar->GetDelta(), 0, RGCHK_PAPERSZ1 );
+ m_pView->Scroll( -_pScrollbar->GetDelta(), 0, ScrollRangeCheck::PaperWidthTextSize );
return 0L;
}
IMPL_LINK( RichTextControlImpl, OnVScroll, ScrollBar*, _pScrollbar )
{
- m_pView->Scroll( 0, -_pScrollbar->GetDelta(), RGCHK_PAPERSZ1 );
+ m_pView->Scroll( 0, -_pScrollbar->GetDelta(), ScrollRangeCheck::PaperWidthTextSize );
return 0L;
}
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
index c616759e6940..349efd93045e 100644
--- a/include/editeng/editdata.hxx
+++ b/include/editeng/editdata.hxx
@@ -89,10 +89,6 @@ class ImpEditEngine;
class EditTextObject;
class SfxStyleSheet;
-#define RGCHK_NONE 0 // No correction of ViusArea when scrolling
-#define RGCHK_NEG 1 // No negative ViusArea when scrolling
-#define RGCHK_PAPERSZ1 2 // VisArea must be within paper width, Text Size
-
struct EPosition
{
sal_Int32 nPara;
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index f67fa3480f31..0467638f2f15 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -71,6 +71,14 @@ namespace linguistic2 {
}
}}}
+enum class ScrollRangeCheck
+{
+ NONE = 0, // No correction of VisArea when scrolling
+ NoNegative = 1, // No negative VisArea when scrolling
+ PaperWidthTextSize = 2, // VisArea must be within paper width, Text Size
+};
+
+
class EDITENG_DLLPUBLIC EditView
{
friend class EditEngine;
@@ -100,7 +108,7 @@ public:
void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
void Invalidate();
- Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG );
+ Pair Scroll( long nHorzScroll, long nVertScroll, ScrollRangeCheck nRangeCheck = ScrollRangeCheck::NoNegative );
void ShowCursor( bool bGotoCursor = true, bool bForceVisCursor = true );
void HideCursor();