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

Generated by: LCOV version 1.10