summaryrefslogtreecommitdiff
path: root/extensions/source/scanner/grid.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-08 14:43:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-08 16:57:05 +0000
commitad5432935de1abcb2fbff732d7e2eb2782cc0a6a (patch)
tree439edf0d643e135165ebdc050cb6a443f1a87121 /extensions/source/scanner/grid.cxx
parenteb0359b3482aa6ebd443cb72a160055191f96c99 (diff)
Clean up uses of integer types
Change-Id: Iaf07f989776c80abd998977e0a2a67f503d0860e Reviewed-on: https://gerrit.libreoffice.org/34975 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'extensions/source/scanner/grid.cxx')
-rw-r--r--extensions/source/scanner/grid.cxx27
1 files changed, 15 insertions, 12 deletions
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 4f8c285bcb90..f7d08a96a28a 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -29,6 +29,7 @@
#include <vcl/builderfactory.hxx>
#include <algorithm>
+#include <limits>
#include <memory>
class GridWindow : public vcl::Window
@@ -87,8 +88,10 @@ class GridWindow : public vcl::Window
bool m_bCutValues;
// stuff for handles
- std::vector< impHandle > m_aHandles;
- sal_uInt32 m_nDragIndex;
+ using Handles = std::vector<impHandle>;
+ static constexpr auto npos = std::numeric_limits<Handles::size_type>::max();
+ Handles m_aHandles;
+ Handles::size_type m_nDragIndex;
BitmapEx m_aMarkerBitmap;
@@ -151,7 +154,7 @@ GridWindow::GridWindow(vcl::Window* pParent)
, m_BmOffY(0)
, m_bCutValues(false)
, m_aHandles()
- , m_nDragIndex(0xffffffff)
+ , m_nDragIndex(npos)
{
SetMapMode(MapMode(MapUnit::MapPixel));
}
@@ -536,11 +539,11 @@ void GridWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRec
void GridWindow::MouseMove( const MouseEvent& rEvt )
{
- if( rEvt.GetButtons() == MOUSE_LEFT && m_nDragIndex != 0xffffffff )
+ if( rEvt.GetButtons() == MOUSE_LEFT && m_nDragIndex != npos )
{
Point aPoint( rEvt.GetPosPixel() );
- if( m_nDragIndex == 0L || m_nDragIndex == m_aHandles.size() - 1L)
+ if( m_nDragIndex == 0 || m_nDragIndex == m_aHandles.size() - 1L)
{
aPoint.X() = m_aHandles[m_nDragIndex].maPos.X();
}
@@ -571,9 +574,9 @@ void GridWindow::MouseButtonUp( const MouseEvent& rEvt )
{
if( rEvt.GetButtons() == MOUSE_LEFT )
{
- if( m_nDragIndex != 0xffffffff )
+ if( m_nDragIndex != npos )
{
- m_nDragIndex = 0xffffffff;
+ m_nDragIndex = npos;
computeNew();
Invalidate(m_aGridArea);
}
@@ -585,9 +588,9 @@ void GridWindow::MouseButtonUp( const MouseEvent& rEvt )
void GridWindow::MouseButtonDown( const MouseEvent& rEvt )
{
Point aPoint( rEvt.GetPosPixel() );
- sal_uInt32 nMarkerIndex = 0xffffffff;
+ Handles::size_type nMarkerIndex = npos;
- for(sal_uInt32 a(0L); nMarkerIndex == 0xffffffff && a < m_aHandles.size(); a++)
+ for(Handles::size_type a(0L); nMarkerIndex == npos && a < m_aHandles.size(); a++)
{
if(m_aHandles[a].isHit(*this, aPoint))
{
@@ -598,7 +601,7 @@ void GridWindow::MouseButtonDown( const MouseEvent& rEvt )
if( rEvt.GetButtons() == MOUSE_LEFT )
{
// user wants to drag a button
- if( nMarkerIndex != 0xffffffff )
+ if( nMarkerIndex != npos )
{
m_nDragIndex = nMarkerIndex;
}
@@ -606,13 +609,13 @@ void GridWindow::MouseButtonDown( const MouseEvent& rEvt )
else if( rEvt.GetButtons() == MOUSE_RIGHT )
{
// user wants to add/delete a button
- if( nMarkerIndex != 0xffffffff )
+ if( nMarkerIndex != npos )
{
if( nMarkerIndex != 0L && nMarkerIndex != m_aHandles.size() - 1L)
{
// delete marker under mouse
if( m_nDragIndex == nMarkerIndex )
- m_nDragIndex = 0xffffffff;
+ m_nDragIndex = npos;
m_aHandles.erase(m_aHandles.begin() + nMarkerIndex);
}