LCOV - code coverage report
Current view: top level - svx/inc/svx - svdopath.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 6 66.7 %
Date: 2012-08-25 Functions: 4 6 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 17 30 56.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SVDOPATH_HXX
      30                 :            : #define _SVDOPATH_HXX
      31                 :            : 
      32                 :            : #include <svx/svdotext.hxx>
      33                 :            : #include <svx/xpoly.hxx>
      34                 :            : #include "svx/svxdllapi.h"
      35                 :            : #include <basegfx/vector/b2enums.hxx>
      36                 :            : 
      37                 :            : //************************************************************
      38                 :            : //   Vorausdeklarationen
      39                 :            : //************************************************************
      40                 :            : 
      41                 :            : class ImpPathForDragAndCreate;
      42                 :            : 
      43                 :            : //************************************************************
      44                 :            : //   Hilfsklasse SdrPathObjGeoData
      45                 :            : //
      46                 :            : // fuer Undo/Redo
      47                 :            : //
      48                 :            : //************************************************************
      49                 :            : 
      50                 :            : class SdrPathObjGeoData : public SdrTextObjGeoData
      51                 :            : {
      52                 :            : public:
      53                 :            :     basegfx::B2DPolyPolygon maPathPolygon;
      54                 :            :     SdrObjKind                  meKind;
      55                 :            : 
      56                 :            :     SdrPathObjGeoData();
      57                 :            :     virtual ~SdrPathObjGeoData();
      58                 :            : };
      59                 :            : 
      60                 :            : //************************************************************
      61                 :            : //   SdrPathObj
      62                 :            : //************************************************************
      63                 :            : 
      64                 :            : class SVX_DLLPUBLIC SdrPathObj : public SdrTextObj
      65                 :            : {
      66                 :            : private:
      67                 :            :     friend class ImpPathForDragAndCreate;
      68                 :            : 
      69                 :            : protected:
      70                 :            :     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
      71                 :            : 
      72                 :            :     basegfx::B2DPolyPolygon maPathPolygon;
      73                 :            :     SdrObjKind                  meKind;
      74                 :            : 
      75                 :            :     // for isolation of old Drag/Create code
      76                 :            :     ImpPathForDragAndCreate*    mpDAC;
      77                 :            : 
      78                 :            :     // brightness - used in EnhancedCustomShapes2d.cxx for DARKEN[LESS] and LIGHTEN[LESS] segments implementation
      79                 :            :     double mdBrightness;
      80                 :            : 
      81                 :            : protected:
      82                 :            :     // Hilfsfunktion fuer GET/SET/INS/etc. PNT
      83                 :            :     void ImpSetClosed(sal_Bool bClose);
      84                 :            :     void ImpForceKind();
      85                 :            :     void ImpForceLineWink();
      86                 :            :     ImpPathForDragAndCreate& impGetDAC() const;
      87                 :            :     void impDeleteDAC() const;
      88                 :            : 
      89                 :            : public:
      90                 :            :     static sal_Bool ImpFindPolyPnt(const basegfx::B2DPolyPolygon& rPoly, sal_uInt32 nAbsPnt, sal_uInt32& rPolyNum, sal_uInt32& rPointNum);
      91                 :            :     virtual void SetRectsDirty(sal_Bool bNotMyself = sal_False);
      92                 :          0 :     double GetBrightness() { return mdBrightness; }
      93                 :            : 
      94                 :            : public:
      95                 :            :     TYPEINFO();
      96                 :            :     SdrPathObj(SdrObjKind eNewKind);
      97                 :            :     SdrPathObj(SdrObjKind eNewKind, const basegfx::B2DPolyPolygon& rPathPoly, double dBrightness = 1.0);
      98                 :            :     virtual ~SdrPathObj();
      99                 :            : 
     100                 :            :     virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
     101                 :            :     virtual sal_uInt16 GetObjIdentifier() const;
     102                 :            :     virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
     103                 :            :     virtual SdrPathObj* Clone() const;
     104                 :            :     SdrPathObj& operator=(const SdrPathObj& rObj);
     105                 :            : 
     106                 :            :     virtual void TakeObjNameSingul(String& rName) const;
     107                 :            :     virtual void TakeObjNamePlural(String& rName) const;
     108                 :            :     virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
     109                 :            :     virtual void RecalcSnapRect();
     110                 :            :     virtual void NbcSetSnapRect(const Rectangle& rRect);
     111                 :            :     virtual sal_uInt32 GetHdlCount() const;
     112                 :            :     virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
     113                 :            :     virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const;
     114                 :            :     virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const;
     115                 :            :     virtual void AddToHdlList(SdrHdlList& rHdlList) const;
     116                 :            : 
     117                 :            :     // special drag methods
     118                 :            :     virtual bool hasSpecialDrag() const;
     119                 :            :     virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
     120                 :            :     virtual bool applySpecialDrag(SdrDragStat& rDrag);
     121                 :            :     virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
     122                 :            :     virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
     123                 :            : 
     124                 :            :     virtual bool BegCreate(SdrDragStat& rStat);
     125                 :            :     virtual bool MovCreate(SdrDragStat& rStat);
     126                 :            :     virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
     127                 :            :     virtual bool BckCreate(SdrDragStat& rStat);
     128                 :            :     virtual void BrkCreate(SdrDragStat& rStat);
     129                 :            :     virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
     130                 :            :     Pointer GetCreatePointer() const;
     131                 :            : 
     132                 :            :     // during drag or create, allow accessing the so-far created/modified polyPolygon
     133                 :            :     basegfx::B2DPolyPolygon getObjectPolyPolygon(const SdrDragStat& rDrag) const;
     134                 :            :     basegfx::B2DPolyPolygon getDragPolyPolygon(const SdrDragStat& rDrag) const;
     135                 :            : 
     136                 :            :     virtual void NbcMove(const Size& aSize);
     137                 :            :     virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact);
     138                 :            :     virtual void NbcRotate(const Point& rRefPnt, long nAngle, double fSin, double fCos);
     139                 :            :     virtual void NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2);
     140                 :            :     virtual void NbcShear(const Point& rRefPnt, long nAngle, double fTan, bool bVShear);
     141                 :            : 
     142                 :            :     virtual sal_uInt32 GetSnapPointCount() const;
     143                 :            :     virtual Point GetSnapPoint(sal_uInt32 i) const;
     144                 :            : 
     145                 :            :     virtual sal_Bool IsPolyObj() const;
     146                 :            :     virtual sal_uInt32 GetPointCount() const;
     147                 :            :     virtual Point GetPoint(sal_uInt32 nHdlNum) const;
     148                 :            :     virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 nHdlNum);
     149                 :            : 
     150                 :            :     // Punkt einfuegen
     151                 :            :     sal_uInt32 NbcInsPointOld(const Point& rPos, sal_Bool bNewObj, sal_Bool bHideHim);
     152                 :            :     sal_uInt32 NbcInsPoint(sal_uInt32 i, const Point& rPos, sal_Bool bNewObj, sal_Bool bHideHim);
     153                 :            : 
     154                 :            :     // An diesem Punkt auftrennen
     155                 :            :     SdrObject* RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index);
     156                 :            : 
     157                 :            : protected:
     158                 :            :     virtual SdrObjGeoData* NewGeoData() const;
     159                 :            :     virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
     160                 :            :     virtual void RestGeoData(const SdrObjGeoData& rGeo);
     161                 :            : 
     162                 :            : public:
     163                 :            :     virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
     164                 :            : 
     165                 :            :     // Bezierpolygon holen/setzen
     166                 :     201484 :     const basegfx::B2DPolyPolygon& GetPathPoly() const { return maPathPolygon; }
     167                 :            :     void SetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly);
     168                 :            :     void NbcSetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly);
     169                 :            : 
     170                 :            :     // Spezialfunktionen fuer Bezierpolygon-Bearbeitung
     171 [ +  + ][ +  - ]:      83235 :     sal_Bool IsClosed() const { return meKind==OBJ_POLY || meKind==OBJ_PATHPOLY || meKind==OBJ_PATHFILL || meKind==OBJ_FREEFILL || meKind==OBJ_SPLNFILL; }
         [ +  + ][ +  - ]
                 [ -  + ]
     172 [ +  - ][ +  - ]:         40 :     sal_Bool IsLine() const { return meKind==OBJ_PLIN || meKind==OBJ_PATHPLIN || meKind==OBJ_PATHLINE || meKind==OBJ_FREELINE || meKind==OBJ_SPLNLINE || meKind==OBJ_LINE; }
         [ +  + ][ +  - ]
         [ +  - ][ -  + ]
     173                 :            :     sal_Bool IsFreeHand() const { return meKind==OBJ_FREELINE || meKind==OBJ_FREEFILL; }
     174 [ +  + ][ +  - ]:         52 :     sal_Bool IsBezier() const { return meKind==OBJ_PATHLINE || meKind==OBJ_PATHFILL; }
     175 [ #  # ][ #  # ]:          0 :     sal_Bool IsSpline() const { return meKind==OBJ_SPLNLINE || meKind==OBJ_SPLNFILL; }
     176                 :            : 
     177                 :            :     // Pfad schliessen bzw. oeffnen; im letzteren Fall den Endpunkt um
     178                 :            :     // "nOpenDistance" verschieben
     179                 :            :     void ToggleClosed(); // long nOpenDistance);
     180                 :            : 
     181                 :            :     ////////////////////////////////////////////////////////////////////////////////////////////////////
     182                 :            :     //
     183                 :            :     // transformation interface for StarOfficeAPI. This implements support for
     184                 :            :     // homogen 3x3 matrices containing the transformation of the SdrObject. At the
     185                 :            :     // moment it contains a shearX, rotation and translation, but for setting all linear
     186                 :            :     // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
     187                 :            :     //
     188                 :            :     ////////////////////////////////////////////////////////////////////////////////////////////////////
     189                 :            :     // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
     190                 :            :     // with the base geometry and returns TRUE. Otherwise it returns FALSE.
     191                 :            :     virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
     192                 :            :     // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
     193                 :            :     // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
     194                 :            :     // to use (0,0) as upper left and will be scaled to the given size in the matrix.
     195                 :            :     virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
     196                 :            : };
     197                 :            : 
     198                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     199                 :            : 
     200                 :            : #endif //_SVDOPATH_HXX
     201                 :            : 
     202                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10