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

Generated by: LCOV version 1.10