LCOV - code coverage report
Current view: top level - svx/inc/sdr/overlay - overlaytools.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 31 45.2 %
Date: 2015-06-13 12:38:46 Functions: 16 37 43.2 %
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             : 
      20             : #ifndef INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
      21             : #define INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
      22             : 
      23             : #include <drawinglayer/primitive2d/primitivetools2d.hxx>
      24             : #include <vcl/bitmapex.hxx>
      25             : #include <basegfx/vector/b2dsize.hxx>
      26             : 
      27             : namespace drawinglayer { namespace primitive2d {
      28             : 
      29           0 : class OverlayStaticRectanglePrimitive : public DiscreteMetricDependentPrimitive2D
      30             : {
      31             : private:
      32             :     basegfx::B2DPoint maPosition;
      33             :     basegfx::B2DSize maSize;
      34             : 
      35             :     // the graphic definition
      36             :     basegfx::BColor maStrokeColor;
      37             :     basegfx::BColor maFillColor;
      38             :     double mfTransparence;
      39             : 
      40             :     // the rotation of the primitive itself
      41             :     double mfRotation;
      42             : 
      43             : protected:
      44             :     virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      45             : 
      46             : public:
      47             :     OverlayStaticRectanglePrimitive(
      48             :         const basegfx::B2DPoint& rPosition,
      49             :         const basegfx::B2DSize& rSize,
      50             :         const basegfx::BColor& rStrokeColor,
      51             :         const basegfx::BColor& rFillColor,
      52             :         double fTransparence,
      53             :         double fRotation);
      54             : 
      55             :     // compare operator
      56             :     virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
      57             : 
      58             :     DeclPrimitive2DIDBlock()
      59             : };
      60             : 
      61             : }} // end of namespace drawinglayer::primitive2d
      62             : 
      63             : // Overlay helper class which holds a BotmapEx which is to be visualized
      64             : // at the given logic position with the Bitmap's pixel size, unscaled and
      65             : // unrotated (like a marker). The discrete pixel on the bitmap assocciated
      66             : // with the target position is given in discrete X,Y coordinates
      67             : namespace drawinglayer
      68             : {
      69             :     namespace primitive2d
      70             :     {
      71         640 :         class OverlayBitmapExPrimitive : public DiscreteMetricDependentPrimitive2D
      72             :         {
      73             :         private:
      74             :             // The BitmapEx to use, PixelSize is used
      75             :             BitmapEx                                maBitmapEx;
      76             : 
      77             :             // The logic position
      78             :             basegfx::B2DPoint                       maBasePosition;
      79             : 
      80             :             // The pixel inside the BitmapEx which is assocciated with
      81             :             // the target position (offset in the bitmap)
      82             :             sal_uInt16                              mnCenterX;
      83             :             sal_uInt16                              mnCenterY;
      84             : 
      85             :             // evtl. rotation and shear around center
      86             :             double                                  mfShearX;
      87             :             double                                  mfRotation;
      88             : 
      89             :         protected:
      90             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      91             : 
      92             :         public:
      93             :             OverlayBitmapExPrimitive(
      94             :                 const BitmapEx& rBitmapEx,
      95             :                 const basegfx::B2DPoint& rBasePosition,
      96             :                 sal_uInt16 nCenterX,
      97             :                 sal_uInt16 nCenterY,
      98             :                 double fShearX = 0.0,
      99             :                 double fRotation = 0.0);
     100             : 
     101             :             // data access
     102         658 :             const BitmapEx& getBitmapEx() const { return maBitmapEx; }
     103         658 :             const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
     104         658 :             sal_uInt16 getCenterX() const { return mnCenterX; }
     105         658 :             sal_uInt16 getCenterY() const { return mnCenterY; }
     106         329 :             double getShearX() const { return mfShearX; }
     107         329 :             double getRotation() const { return mfRotation; }
     108             : 
     109             :             // compare operator
     110             :             virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
     111             : 
     112             :             DeclPrimitive2DIDBlock()
     113             :         };
     114             :     } // end of namespace primitive2d
     115             : } // end of namespace drawinglayer
     116             : 
     117             : 
     118             : // Overlay helper class for a crosshair
     119             : namespace drawinglayer
     120             : {
     121             :     namespace primitive2d
     122             :     {
     123           0 :         class OverlayCrosshairPrimitive : public ViewportDependentPrimitive2D
     124             :         {
     125             :         private:
     126             :             // The logic position
     127             :             basegfx::B2DPoint                       maBasePosition;
     128             : 
     129             :             // The stripe colors and legth
     130             :             basegfx::BColor                         maRGBColorA;
     131             :             basegfx::BColor                         maRGBColorB;
     132             :             double                                  mfDiscreteDashLength;
     133             : 
     134             :         protected:
     135             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     136             : 
     137             :         public:
     138             :             OverlayCrosshairPrimitive(
     139             :                 const basegfx::B2DPoint& rBasePosition,
     140             :                 const basegfx::BColor& rRGBColorA,
     141             :                 const basegfx::BColor& rRGBColorB,
     142             :                 double fDiscreteDashLength);
     143             : 
     144             :             // data access
     145           0 :             const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
     146           0 :             const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
     147           0 :             const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
     148           0 :             double getDiscreteDashLength() const { return mfDiscreteDashLength; }
     149             : 
     150             :             // compare operator
     151             :             virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
     152             : 
     153             :             DeclPrimitive2DIDBlock()
     154             :         };
     155             :     } // end of namespace primitive2d
     156             : } // end of namespace drawinglayer
     157             : 
     158             : 
     159             : // Overlay helper class for a hatch rectangle as used e.g. for text object
     160             : // selection hilighting
     161             : namespace drawinglayer
     162             : {
     163             :     namespace primitive2d
     164             :     {
     165          48 :         class OverlayRectanglePrimitive : public DiscreteMetricDependentPrimitive2D
     166             :         {
     167             :         private:
     168             :             // the logic rectangle definition
     169             :             basegfx::B2DRange               maObjectRange;
     170             : 
     171             :             // the graphic definition
     172             :             basegfx::BColor                 maColor;
     173             :             double                          mfTransparence;
     174             : 
     175             :             // the dscrete grow and shrink of the box
     176             :             double                          mfDiscreteGrow;
     177             :             double                          mfDiscreteShrink;
     178             : 
     179             :             // the rotation of the primitive itself
     180             :             double                          mfRotation;
     181             : 
     182             :         protected:
     183             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     184             : 
     185             :         public:
     186             :             OverlayRectanglePrimitive(
     187             :                 const basegfx::B2DRange& rObjectRange,
     188             :                 const basegfx::BColor& rColor,
     189             :                 double fTransparence,
     190             :                 double fDiscreteGrow,
     191             :                 double fDiscreteShrink,
     192             :                 double fRotation);
     193             : 
     194             :             // data access
     195          48 :             const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
     196          24 :             const basegfx::BColor& getColor() const { return maColor; }
     197          72 :             double getTransparence() const { return mfTransparence; }
     198          48 :             double getDiscreteGrow() const { return mfDiscreteGrow; }
     199          48 :             double getDiscreteShrink() const { return mfDiscreteShrink; }
     200          24 :             double getRotation() const { return mfRotation; }
     201             : 
     202             :             // compare operator
     203             :             virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
     204             : 
     205             :             DeclPrimitive2DIDBlock()
     206             :         };
     207             :     } // end of namespace primitive2d
     208             : } // end of namespace drawinglayer
     209             : 
     210             : 
     211             : // Overlay helper class for a striped helpline
     212             : 
     213             : namespace drawinglayer
     214             : {
     215             :     namespace primitive2d
     216             :     {
     217             :         enum HelplineStyle
     218             :         {
     219             :             HELPLINESTYLE_POINT,
     220             :             HELPLINESTYLE_VERTICAL,
     221             :             HELPLINESTYLE_HORIZONTAL
     222             :         };
     223             : 
     224           0 :         class OverlayHelplineStripedPrimitive : public ViewportDependentPrimitive2D
     225             :         {
     226             :         private:
     227             :             // The logic position
     228             :             basegfx::B2DPoint                       maBasePosition;
     229             : 
     230             :             // the style
     231             :             HelplineStyle                           meStyle;
     232             : 
     233             :             // The stripe colors and legth
     234             :             basegfx::BColor                         maRGBColorA;
     235             :             basegfx::BColor                         maRGBColorB;
     236             :             double                                  mfDiscreteDashLength;
     237             : 
     238             :         protected:
     239             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     240             : 
     241             :         public:
     242             :             OverlayHelplineStripedPrimitive(
     243             :                 const basegfx::B2DPoint& rBasePosition,
     244             :                 HelplineStyle eStyle,
     245             :                 const basegfx::BColor& rRGBColorA,
     246             :                 const basegfx::BColor& rRGBColorB,
     247             :                 double fDiscreteDashLength);
     248             : 
     249             :             // data access
     250           0 :             const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
     251           0 :             HelplineStyle getStyle() const { return meStyle; }
     252           0 :             const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
     253           0 :             const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
     254           0 :             double getDiscreteDashLength() const { return mfDiscreteDashLength; }
     255             : 
     256             :             // compare operator
     257             :             virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
     258             : 
     259             :             DeclPrimitive2DIDBlock()
     260             :         };
     261             :     } // end of namespace primitive2d
     262             : } // end of namespace drawinglayer
     263             : 
     264             : 
     265             : // Overlay helper class for rolling rectangle helplines. This primitive is
     266             : // only for the extended lines to the ends of the view
     267             : 
     268             : namespace drawinglayer
     269             : {
     270             :     namespace primitive2d
     271             :     {
     272           0 :         class OverlayRollingRectanglePrimitive : public ViewportDependentPrimitive2D
     273             :         {
     274             :         private:
     275             :             // The logic range
     276             :             basegfx::B2DRange                       maRollingRectangle;
     277             : 
     278             :             // The stripe colors and legth
     279             :             basegfx::BColor                         maRGBColorA;
     280             :             basegfx::BColor                         maRGBColorB;
     281             :             double                                  mfDiscreteDashLength;
     282             : 
     283             :         protected:
     284             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     285             : 
     286             :         public:
     287             :             OverlayRollingRectanglePrimitive(
     288             :                 const basegfx::B2DRange& aRollingRectangle,
     289             :                 const basegfx::BColor& rRGBColorA,
     290             :                 const basegfx::BColor& rRGBColorB,
     291             :                 double fDiscreteDashLength);
     292             : 
     293             :             // data access
     294           0 :             const basegfx::B2DRange& getRollingRectangle() const { return maRollingRectangle; }
     295           0 :             const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
     296           0 :             const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
     297           0 :             double getDiscreteDashLength() const { return mfDiscreteDashLength; }
     298             : 
     299             :             // compare operator
     300             :             virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
     301             : 
     302             :             DeclPrimitive2DIDBlock()
     303             :         };
     304             :     } // end of namespace primitive2d
     305             : } // end of namespace drawinglayer
     306             : 
     307             : 
     308             : 
     309             : #endif // INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
     310             : 
     311             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11