summaryrefslogtreecommitdiff
path: root/include/svx/dlgctrl.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-16 16:13:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-19 10:13:00 +0100
commit6fbb6d80fe6203ff6f84ee85ca625b6e60bf5bae (patch)
tree1482de217efaafface8b1fa82ecd2320b82a1a68 /include/svx/dlgctrl.hxx
parent2ab300bfa18cdcc91a9311c4c9710254b0ad7753 (diff)
use std::array in createHistorical8x8FromArray
to make the assumption about the size of the array obvious in the code. Change-Id: I7ebe0b037e3be38f7e33c0160742f829288bb474 Reviewed-on: https://gerrit.libreoffice.org/49938 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svx/dlgctrl.hxx')
-rw-r--r--include/svx/dlgctrl.hxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 26cfb511700c..0cf9220cb34f 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -27,6 +27,7 @@
#include <svx/xtable.hxx>
#include <rtl/ref.hxx>
#include <o3tl/typed_flags_set.hxx>
+#include <array>
class XOBitmap;
class XOutdevItemPool;
@@ -147,11 +148,12 @@ public:
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxPixelCtl final : public Control
{
private:
- sal_uInt16 nLines, nSquares;
+ static sal_uInt16 constexpr nLines = 8;
+ static sal_uInt16 constexpr nSquares = nLines * nLines;
Color aPixelColor;
Color aBackgroundColor;
Size aRectSize;
- sal_uInt16* pPixel;
+ std::array<sal_uInt8,nSquares> maPixelData;
bool bPaintable;
//Add member identifying position
Point aFocusPosition;
@@ -163,10 +165,9 @@ private:
void ChangePixel( sal_uInt16 nPixel );
public:
- SvxPixelCtl( vcl::Window* pParent, sal_uInt16 nNumber = 8 );
+ SvxPixelCtl( vcl::Window* pParent );
virtual ~SvxPixelCtl() override;
- virtual void dispose() override;
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
@@ -178,15 +179,15 @@ public:
void SetPixelColor( const Color& rCol ) { aPixelColor = rCol; }
void SetBackgroundColor( const Color& rCol ) { aBackgroundColor = rCol; }
- sal_uInt16 GetLineCount() const { return nLines; }
+ static sal_uInt16 GetLineCount() { return nLines; }
- sal_uInt16 GetBitmapPixel( const sal_uInt16 nPixelNumber );
- sal_uInt16* GetBitmapPixelPtr() { return pPixel; }
+ sal_uInt8 GetBitmapPixel( const sal_uInt16 nPixelNumber ) const;
+ std::array<sal_uInt8,64> const & GetBitmapPixelPtr() const { return maPixelData; }
void SetPaintable( bool bTmp ) { bPaintable = bTmp; }
void Reset();
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
- long GetSquares() const { return nSquares ; }
+ static long GetSquares() { return nSquares ; }
long GetWidth() const { return aRectSize.getWidth() ; }
long GetHeight() const { return aRectSize.getHeight() ; }