LCOV - code coverage report
Current view: top level - svx/inc/svx - svdglue.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 30 20.0 %
Date: 2012-08-25 Functions: 6 26 23.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 8 0.0 %

           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 _SVDGLUE_HXX
      30                 :            : #define _SVDGLUE_HXX
      31                 :            : 
      32                 :            : class Window;
      33                 :            : class OutputDevice;
      34                 :            : class SvStream;
      35                 :            : class SdrObject;
      36                 :            : 
      37                 :            : #include <tools/gen.hxx>
      38                 :            : #include "svx/svxdllapi.h"
      39                 :            : #include <vector>
      40                 :            : 
      41                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      42                 :            : 
      43                 :            : #define SDRESC_SMART  0x0000
      44                 :            : #define SDRESC_LEFT   0x0001
      45                 :            : #define SDRESC_RIGHT  0x0002
      46                 :            : #define SDRESC_TOP    0x0004
      47                 :            : #define SDRESC_BOTTOM 0x0008
      48                 :            : #define SDRESC_LO    0x0010 /* ni */
      49                 :            : #define SDRESC_LU    0x0020 /* ni */
      50                 :            : #define SDRESC_RO    0x0040 /* ni */
      51                 :            : #define SDRESC_RU    0x0080 /* ni */
      52                 :            : #define SDRESC_HORZ  (SDRESC_LEFT|SDRESC_RIGHT)
      53                 :            : #define SDRESC_VERT  (SDRESC_TOP|SDRESC_BOTTOM)
      54                 :            : #define SDRESC_ALL   0x00FF
      55                 :            : 
      56                 :            : #define SDRHORZALIGN_CENTER   0x0000
      57                 :            : #define SDRHORZALIGN_LEFT     0x0001
      58                 :            : #define SDRHORZALIGN_RIGHT    0x0002
      59                 :            : #define SDRHORZALIGN_DONTCARE 0x0010
      60                 :            : #define SDRVERTALIGN_CENTER   0x0000
      61                 :            : #define SDRVERTALIGN_TOP      0x0100
      62                 :            : #define SDRVERTALIGN_BOTTOM   0x0200
      63                 :            : #define SDRVERTALIGN_DONTCARE 0x1000
      64                 :            : 
      65                 :            : class SVX_DLLPUBLIC SdrGluePoint {
      66                 :            :     // Bezugspunkt ist SdrObject::GetSnapRect().Center()
      67                 :            :     // bNoPercent=FALSE: Position ist -5000..5000 (1/100)% bzw. 0..10000 (je nach Align)
      68                 :            :     // bNoPercent=sal_True : Position ist in log Einh, rel zum Bezugspunkt
      69                 :            :     Point    aPos;
      70                 :            :     sal_uInt16   nEscDir;
      71                 :            :     sal_uInt16   nId;
      72                 :            :     sal_uInt16   nAlign;
      73                 :            :     sal_uInt8 bNoPercent:1;
      74                 :            :     sal_uInt8 bReallyAbsolute:1; // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
      75                 :            :     sal_uInt8 bUserDefined:1; // #i38892#
      76                 :            : public:
      77                 :          0 :     SdrGluePoint(): nEscDir(SDRESC_SMART),nId(0),nAlign(0) { bNoPercent=sal_False; bReallyAbsolute=sal_False; bUserDefined=sal_True; }
      78                 :        272 :     SdrGluePoint(const Point& rNewPos, bool bNewPercent= sal_True, sal_uInt16 nNewAlign=0): aPos(rNewPos),nEscDir(SDRESC_SMART),nId(0),nAlign(nNewAlign) { bNoPercent=!bNewPercent; bReallyAbsolute = sal_False; bUserDefined = sal_True; }
      79                 :            :     bool operator==(const SdrGluePoint& rCmpGP) const   { return aPos==rCmpGP.aPos && nEscDir==rCmpGP.nEscDir && nId==rCmpGP.nId && nAlign==rCmpGP.nAlign && bNoPercent==rCmpGP.bNoPercent && bReallyAbsolute==rCmpGP.bReallyAbsolute && bUserDefined==rCmpGP.bUserDefined; }
      80                 :            :     bool operator!=(const SdrGluePoint& rCmpGP) const   { return !operator==(rCmpGP); }
      81                 :        544 :     const Point& GetPos() const                             { return aPos; }
      82                 :          0 :     void         SetPos(const Point& rNewPos)               { aPos=rNewPos; }
      83                 :        272 :     sal_uInt16       GetEscDir() const                          { return nEscDir; }
      84                 :          0 :     void         SetEscDir(sal_uInt16 nNewEsc)                  { nEscDir=nNewEsc; }
      85                 :          0 :     sal_uInt16       GetId() const                              { return nId; }
      86                 :          0 :     void         SetId(sal_uInt16 nNewId)                       { nId=nNewId; }
      87                 :        272 :     bool         IsPercent() const                          { return bNoPercent ? false : true; }
      88                 :        272 :     void         SetPercent(bool bOn)                   { bNoPercent  = !bOn; }
      89                 :            :     // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
      90                 :            :     bool         IsReallyAbsolute() const                   { return bReallyAbsolute ? true : false; }
      91                 :            :     void         SetReallyAbsolute(bool bOn, const SdrObject& rObj);
      92                 :            : 
      93                 :            :     // #i38892#
      94                 :          0 :     bool         IsUserDefined() const                      { return bUserDefined ? true : false; }
      95                 :          0 :     void         SetUserDefined(bool bNew)              { bUserDefined = bNew ? true : false; }
      96                 :            : 
      97                 :        272 :     sal_uInt16       GetAlign() const                           { return nAlign; }
      98                 :          0 :     void         SetAlign(sal_uInt16 nAlg)                      { nAlign=nAlg; }
      99                 :          0 :     sal_uInt16       GetHorzAlign() const                       { return nAlign&0x00FF; }
     100                 :          0 :     void         SetHorzAlign(sal_uInt16 nAlg)                  { nAlign=(nAlign&0xFF00)|(nAlg&0x00FF); }
     101                 :          0 :     sal_uInt16       GetVertAlign() const                       { return nAlign&0xFF00; }
     102                 :          0 :     void         SetVertAlign(sal_uInt16 nAlg)                  { nAlign=(nAlign&0x00FF)|(nAlg&0xFF00); }
     103                 :            :     bool         IsHit(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj) const;
     104                 :            :     void         Invalidate(Window& rWin, const SdrObject* pObj) const;
     105                 :            :     Point        GetAbsolutePos(const SdrObject& rObj) const;
     106                 :            :     void         SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj);
     107                 :            :     long         GetAlignAngle() const;
     108                 :            :     void         SetAlignAngle(long nWink);
     109                 :            :     long         EscDirToAngle(sal_uInt16 nEsc) const;
     110                 :            :     sal_uInt16       EscAngleToDir(long nWink) const;
     111                 :            :     void         Rotate(const Point& rRef, long nWink, double sn, double cs, const SdrObject* pObj);
     112                 :            :     void         Mirror(const Point& rRef1, const Point& rRef2, long nWink, const SdrObject* pObj);
     113                 :            :     void         Shear (const Point& rRef, long nWink, double tn, bool bVShear, const SdrObject* pObj);
     114                 :            : };
     115                 :            : 
     116                 :            : #define SDRGLUEPOINT_NOTFOUND 0xFFFF
     117                 :            : 
     118                 :            : class SVX_DLLPUBLIC SdrGluePointList {
     119                 :            :     std::vector<SdrGluePoint*> aList;
     120                 :            : protected:
     121                 :          0 :     SdrGluePoint* GetObject(sal_uInt16 i) const { return aList[i]; }
     122                 :            : public:
     123                 :          0 :     SdrGluePointList(): aList() {}
     124         [ #  # ]:          0 :     SdrGluePointList(const SdrGluePointList& rSrcList): aList()     { *this=rSrcList; }
     125         [ #  # ]:          0 :     ~SdrGluePointList()                                                     { Clear(); }
     126                 :            :     void                Clear();
     127                 :            :     void                operator=(const SdrGluePointList& rSrcList);
     128                 :          0 :     sal_uInt16              GetCount() const                                    { return sal_uInt16(aList.size()); }
     129                 :            :     // Beim Insert wird dem Objekt (also dem GluePoint) automatisch eine Id zugewiesen.
     130                 :            :     // ReturnCode ist der Index des neuen GluePoints in der Liste
     131                 :            :     sal_uInt16              Insert(const SdrGluePoint& rGP);
     132                 :          0 :     void                Delete(sal_uInt16 nPos)
     133                 :            :     {
     134                 :          0 :         SdrGluePoint* p = aList[nPos];
     135 [ #  # ][ #  # ]:          0 :         aList.erase(aList.begin()+nPos);
     136                 :          0 :         delete p;
     137                 :          0 :     }
     138                 :          0 :     SdrGluePoint&       operator[](sal_uInt16 nPos)                             { return *GetObject(nPos); }
     139                 :          0 :     const SdrGluePoint& operator[](sal_uInt16 nPos) const                       { return *GetObject(nPos); }
     140                 :            :     sal_uInt16          FindGluePoint(sal_uInt16 nId) const;
     141                 :            :     sal_uInt16          HitTest(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj, bool bBack = false, bool bNext = false, sal_uInt16 nId0=0) const;
     142                 :            :     void                Invalidate(Window& rWin, const SdrObject* pObj) const;
     143                 :            :     // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
     144                 :            :     void                SetReallyAbsolute(bool bOn, const SdrObject& rObj);
     145                 :            :     void                Rotate(const Point& rRef, long nWink, double sn, double cs, const SdrObject* pObj);
     146                 :            :     void                Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj);
     147                 :            :     void                Mirror(const Point& rRef1, const Point& rRef2, long nWink, const SdrObject* pObj);
     148                 :            :     void                Shear (const Point& rRef, long nWink, double tn, bool bVShear, const SdrObject* pObj);
     149                 :            : };
     150                 :            : 
     151                 :            : 
     152                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     153                 :            : 
     154                 :            : #endif //_SVDGLUE_HXX
     155                 :            : 
     156                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10