LCOV - code coverage report
Current view: top level - include/svx - svdopath.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 5 6 83.3 %
Date: 2014-11-03 Functions: 5 6 83.3 %
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_SVDOPATH_HXX
      21             : #define INCLUDED_SVX_SVDOPATH_HXX
      22             : 
      23             : #include <svx/svdotext.hxx>
      24             : #include <svx/xpoly.hxx>
      25             : #include <svx/svxdllapi.h>
      26             : #include <basegfx/vector/b2enums.hxx>
      27             : 
      28             : class ImpPathForDragAndCreate;
      29             : 
      30             : // Helper class SdrPathObjGeoData
      31             : // used for undo/redo
      32             : 
      33             : class SdrPathObjGeoData : public SdrTextObjGeoData
      34             : {
      35             : public:
      36             :     basegfx::B2DPolyPolygon maPathPolygon;
      37             :     SdrObjKind                  meKind;
      38             : 
      39             :     SdrPathObjGeoData();
      40             :     virtual ~SdrPathObjGeoData();
      41             : };
      42             : 
      43             : 
      44             : class SVX_DLLPUBLIC SdrPathObj : public SdrTextObj
      45             : {
      46             : private:
      47             :     friend class ImpPathForDragAndCreate;
      48             : 
      49             : protected:
      50             :     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
      51             : 
      52             :     basegfx::B2DPolyPolygon maPathPolygon;
      53             :     SdrObjKind                  meKind;
      54             : 
      55             :     // for isolation of old Drag/Create code
      56             :     ImpPathForDragAndCreate*    mpDAC;
      57             : 
      58             :     // brightness - used in EnhancedCustomShapes2d.cxx for DARKEN[LESS] and LIGHTEN[LESS] segments implementation
      59             :     double mdBrightness;
      60             : 
      61             : protected:
      62             :     // helper functions for GET, SET, INS etc. PNT
      63             :     void ImpSetClosed(bool bClose);
      64             :     void ImpForceKind();
      65             :     void ImpForceLineWink();
      66             :     ImpPathForDragAndCreate& impGetDAC() const;
      67             :     void impDeleteDAC() const;
      68             : 
      69             : public:
      70             :     static bool ImpFindPolyPnt(const basegfx::B2DPolyPolygon& rPoly, sal_uInt32 nAbsPnt, sal_uInt32& rPolyNum, sal_uInt32& rPointNum);
      71             :     virtual void SetRectsDirty(bool bNotMyself = false) SAL_OVERRIDE;
      72        3772 :     double GetBrightness() { return mdBrightness; }
      73             : 
      74             : public:
      75             :     TYPEINFO_OVERRIDE();
      76             :     SdrPathObj(SdrObjKind eNewKind);
      77             :     SdrPathObj(SdrObjKind eNewKind, const basegfx::B2DPolyPolygon& rPathPoly, double dBrightness = 1.0);
      78             :     virtual ~SdrPathObj();
      79             : 
      80             :     virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const SAL_OVERRIDE;
      81             :     virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
      82             :     virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const SAL_OVERRIDE;
      83             :     virtual SdrPathObj* Clone() const SAL_OVERRIDE;
      84             :     SdrPathObj& operator=(const SdrPathObj& rObj);
      85             : 
      86             :     virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
      87             :     virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
      88             :     virtual basegfx::B2DPolyPolygon TakeXorPoly() const SAL_OVERRIDE;
      89             :     virtual void RecalcSnapRect() SAL_OVERRIDE;
      90             :     virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
      91             :     virtual sal_uInt32 GetHdlCount() const SAL_OVERRIDE;
      92             :     virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const SAL_OVERRIDE;
      93             :     virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const SAL_OVERRIDE;
      94             :     virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const SAL_OVERRIDE;
      95             :     virtual void AddToHdlList(SdrHdlList& rHdlList) const SAL_OVERRIDE;
      96             : 
      97             :     // special drag methods
      98             :     virtual bool hasSpecialDrag() const SAL_OVERRIDE;
      99             :     virtual bool beginSpecialDrag(SdrDragStat& rDrag) const SAL_OVERRIDE;
     100             :     virtual bool applySpecialDrag(SdrDragStat& rDrag) SAL_OVERRIDE;
     101             :     virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const SAL_OVERRIDE;
     102             :     virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const SAL_OVERRIDE;
     103             : 
     104             :     virtual bool BegCreate(SdrDragStat& rStat) SAL_OVERRIDE;
     105             :     virtual bool MovCreate(SdrDragStat& rStat) SAL_OVERRIDE;
     106             :     virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
     107             :     virtual bool BckCreate(SdrDragStat& rStat) SAL_OVERRIDE;
     108             :     virtual void BrkCreate(SdrDragStat& rStat) SAL_OVERRIDE;
     109             :     virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const SAL_OVERRIDE;
     110             :     Pointer GetCreatePointer() const SAL_OVERRIDE;
     111             : 
     112             :     // during drag or create, allow accessing the so-far created/modified polyPolygon
     113             :     basegfx::B2DPolyPolygon getObjectPolyPolygon(const SdrDragStat& rDrag) const;
     114             :     basegfx::B2DPolyPolygon getDragPolyPolygon(const SdrDragStat& rDrag) const;
     115             : 
     116             :     virtual void NbcMove(const Size& aSize) SAL_OVERRIDE;
     117             :     virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) SAL_OVERRIDE;
     118             :     virtual void NbcRotate(const Point& rRefPnt, long nAngle, double fSin, double fCos) SAL_OVERRIDE;
     119             :     virtual void NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) SAL_OVERRIDE;
     120             :     virtual void NbcShear(const Point& rRefPnt, long nAngle, double fTan, bool bVShear) SAL_OVERRIDE;
     121             : 
     122             :     virtual sal_uInt32 GetSnapPointCount() const SAL_OVERRIDE;
     123             :     virtual Point GetSnapPoint(sal_uInt32 i) const SAL_OVERRIDE;
     124             : 
     125             :     virtual bool IsPolyObj() const SAL_OVERRIDE;
     126             :     virtual sal_uInt32 GetPointCount() const SAL_OVERRIDE;
     127             :     virtual Point GetPoint(sal_uInt32 nHdlNum) const SAL_OVERRIDE;
     128             :     virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 nHdlNum) SAL_OVERRIDE;
     129             : 
     130             :     // insert point
     131             :     sal_uInt32 NbcInsPointOld(const Point& rPos, bool bNewObj, bool bHideHim);
     132             :     sal_uInt32 NbcInsPoint(sal_uInt32 i, const Point& rPos, bool bNewObj, bool bHideHim);
     133             : 
     134             :     // rip at given point
     135             :     SdrObject* RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index);
     136             : 
     137             : protected:
     138             :     virtual SdrObjGeoData* NewGeoData() const SAL_OVERRIDE;
     139             :     virtual void SaveGeoData(SdrObjGeoData& rGeo) const SAL_OVERRIDE;
     140             :     virtual void RestGeoData(const SdrObjGeoData& rGeo) SAL_OVERRIDE;
     141             : 
     142             : public:
     143             :     virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
     144             : 
     145             :     // Bezier-polygon getter/setter
     146      189629 :     const basegfx::B2DPolyPolygon& GetPathPoly() const { return maPathPolygon; }
     147             :     void SetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly);
     148             :     void NbcSetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly);
     149             : 
     150             :     // special functions for Bezier-polygon handling
     151       88119 :     bool IsClosed() const { return meKind==OBJ_POLY || meKind==OBJ_PATHPOLY || meKind==OBJ_PATHFILL || meKind==OBJ_FREEFILL || meKind==OBJ_SPLNFILL; }
     152       18578 :     bool IsLine() const { return meKind==OBJ_PLIN || meKind==OBJ_PATHPLIN || meKind==OBJ_PATHLINE || meKind==OBJ_FREELINE || meKind==OBJ_SPLNLINE || meKind==OBJ_LINE; }
     153             :     bool IsFreeHand() const { return meKind==OBJ_FREELINE || meKind==OBJ_FREEFILL; }
     154          52 :     bool IsBezier() const { return meKind==OBJ_PATHLINE || meKind==OBJ_PATHFILL; }
     155           0 :     bool IsSpline() const { return meKind==OBJ_SPLNLINE || meKind==OBJ_SPLNFILL; }
     156             : 
     157             :     // close/open path
     158             :     // if opening, move end point by "nOpenDistance"
     159             :     void ToggleClosed(); // long nOpenDistance);
     160             : 
     161             :     // transformation interface for StarOfficeAPI. This implements support for
     162             :     // homogen 3x3 matrices containing the transformation of the SdrObject. At the
     163             :     // moment it contains a shearX, rotation and translation, but for setting all linear
     164             :     // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
     165             :     //
     166             :     // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
     167             :     // with the base geometry and returns TRUE. Otherwise it returns FALSE.
     168             :     virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const SAL_OVERRIDE;
     169             :     // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
     170             :     // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
     171             :     // to use (0,0) as upper left and will be scaled to the given size in the matrix.
     172             :     virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) SAL_OVERRIDE;
     173             : };
     174             : 
     175             : #endif // INCLUDED_SVX_SVDOPATH_HXX
     176             : 
     177             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10