LCOV - code coverage report
Current view: top level - extensions/source/scanner - grid.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 14 0.0 %
Date: 2014-04-14 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef _EXTENSIONS_SCANNER_GRID_HXX
      20             : #define _EXTENSIONS_SCANNER_GRID_HXX
      21             : 
      22             : #include <vcl/window.hxx>
      23             : #include <vcl/button.hxx>
      24             : #include <vcl/lstbox.hxx>
      25             : #include <vcl/dialog.hxx>
      26             : 
      27             : class GridWindow : public ModalDialog
      28             : {
      29             :     // helper class for handles
      30             :     struct impHandle
      31             :     {
      32             :         Point           maPos;
      33             :         sal_uInt16      mnOffX;
      34             :         sal_uInt16      mnOffY;
      35             : 
      36           0 :         impHandle(const Point& rPos, sal_uInt16 nX, sal_uInt16 nY)
      37           0 :         :   maPos(rPos), mnOffX(nX), mnOffY(nY)
      38             :         {
      39           0 :         }
      40             : 
      41           0 :         bool operator<(const impHandle& rComp) const
      42             :         {
      43           0 :             return (maPos.X() < rComp.maPos.X());
      44             :         }
      45             : 
      46           0 :         void draw(Window& rWin, const BitmapEx& rBitmapEx)
      47             :         {
      48           0 :             const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
      49           0 :             rWin.DrawBitmapEx(maPos - aOffset, rBitmapEx);
      50           0 :         }
      51             : 
      52           0 :         bool isHit(Window& rWin, const Point& rPos)
      53             :         {
      54           0 :             const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
      55           0 :             const Rectangle aTarget(maPos - aOffset, maPos + aOffset);
      56           0 :             return aTarget.IsInside(rPos);
      57             :         }
      58             :     };
      59             : 
      60             :     Rectangle       m_aGridArea;
      61             : 
      62             :     double          m_fMinX;
      63             :     double          m_fMinY;
      64             :     double          m_fMaxX;
      65             :     double          m_fMaxY;
      66             : 
      67             :     double          m_fChunkX;
      68             :     double          m_fMinChunkX;
      69             :     double          m_fChunkY;
      70             :     double          m_fMinChunkY;
      71             : 
      72             :     double*         m_pXValues;
      73             :     double*         m_pOrigYValues;
      74             :     int             m_nValues;
      75             :     double*         m_pNewYValues;
      76             : 
      77             :     sal_uInt16      m_BmOffX;
      78             :     sal_uInt16      m_BmOffY;
      79             : 
      80             :     sal_Bool            m_bCutValues;
      81             : 
      82             :     // stuff for handles
      83             :     std::vector< impHandle >    m_aHandles;
      84             :     sal_uInt32                  m_nDragIndex;
      85             : 
      86             :     BitmapEx        m_aMarkerBitmap;
      87             : 
      88             :     OKButton        m_aOKButton;
      89             :     CancelButton    m_aCancelButton;
      90             : 
      91             :     ListBox         m_aResetTypeBox;
      92             :     PushButton      m_aResetButton;
      93             : 
      94             : 
      95             :     Point transform( double x, double y );
      96             :     void transform( const Point& rOriginal, double& x, double& y );
      97             : 
      98             :     double findMinX();
      99             :     double findMinY();
     100             :     double findMaxX();
     101             :     double findMaxY();
     102             : 
     103             :     void drawGrid();
     104             :     void drawOriginal();
     105             :     void drawNew();
     106             :     void drawHandles();
     107             : 
     108             :     void computeExtremes();
     109             :     void computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut );
     110             :     void computeNew();
     111             :     double interpolate( double x, double* pNodeX, double* pNodeY, int nNodes );
     112             : 
     113             :     DECL_LINK( ClickButtonHdl, Button* );
     114             : 
     115             :     virtual void MouseMove( const MouseEvent& ) SAL_OVERRIDE;
     116             :     virtual void MouseButtonDown( const MouseEvent& ) SAL_OVERRIDE;
     117             :     virtual void MouseButtonUp( const MouseEvent& ) SAL_OVERRIDE;
     118             : public:
     119             :     GridWindow( double* pXValues, double* pYValues, int nValues,
     120             :                 Window* pParent, sal_Bool bCutValues = sal_True );
     121             :     virtual ~GridWindow();
     122             : 
     123             :     void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
     124             :     double getMinX() { return m_fMinX; }
     125             :     double getMinY() { return m_fMinY; }
     126             :     double getMaxX() { return m_fMaxX; }
     127             :     double getMaxY() { return m_fMaxY; }
     128             : 
     129             :     int countValues() { return m_nValues; }
     130             :     double* getXValues() { return m_pXValues; }
     131             :     double* getOrigYValues() { return m_pOrigYValues; }
     132           0 :     double* getNewYValues() { return m_pNewYValues; }
     133             : 
     134             :     void drawLine( double x1, double y1, double x2, double y2 );
     135             : 
     136             :     virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     137             : };
     138             : 
     139             : #endif // _EXTENSIONS_SCANNER_GRID_HXX
     140             : 
     141             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10