LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svx - svdhlpln.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 26 15.4 %
Date: 2013-07-09 Functions: 4 18 22.2 %
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 _SVDHLPLN_HXX
      21             : #define _SVDHLPLN_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <tools/color.hxx>
      25             : #include <tools/gen.hxx>
      26             : 
      27             : #include <vcl/pointr.hxx>
      28             : #include "svx/svxdllapi.h"
      29             : 
      30             : class OutputDevice;
      31             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      32             : 
      33             : enum SdrHelpLineKind {SDRHELPLINE_POINT,SDRHELPLINE_VERTICAL,SDRHELPLINE_HORIZONTAL};
      34             : 
      35             : #define SDRHELPLINE_POINT_PIXELSIZE 15 /* Tatsaechliche Groesse= PIXELSIZE*2+1 */
      36             : 
      37             : class SdrHelpLine {
      38             :     Point            aPos; // je nach Wert von eKind ist X oder Y evtl. belanglos
      39             :     SdrHelpLineKind  eKind;
      40             : 
      41             :     // #i27493#
      42             :     // Helper method to draw a hor or ver two-colored dashed line
      43             :     void ImpDrawDashedTwoColorLine(OutputDevice& rOut, sal_Int32 nStart, sal_Int32 nEnd, sal_Int32 nFixPos,
      44             :         sal_Int32 nStepWidth, Color aColA, Color aColB, sal_Bool bHorizontal) const;
      45             : 
      46             : public:
      47           0 :     explicit SdrHelpLine(SdrHelpLineKind eNewKind=SDRHELPLINE_POINT): eKind(eNewKind) {}
      48           0 :     SdrHelpLine(SdrHelpLineKind eNewKind, const Point& rNewPos): aPos(rNewPos), eKind(eNewKind) {}
      49           0 :     bool operator==(const SdrHelpLine& rCmp) const { return aPos==rCmp.aPos && eKind==rCmp.eKind; }
      50           0 :     bool operator!=(const SdrHelpLine& rCmp) const { return !operator==(rCmp); }
      51             : 
      52           0 :     void            SetKind(SdrHelpLineKind eNewKind) { eKind=eNewKind; }
      53           0 :     SdrHelpLineKind GetKind() const                   { return eKind; }
      54           0 :     void            SetPos(const Point& rPnt)         { aPos=rPnt; }
      55           0 :     const Point&    GetPos() const                    { return aPos; }
      56             : 
      57             :     Pointer         GetPointer() const;
      58             :     bool            IsHit(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
      59             :     // OutputDevice wird benoetigt, da Fangpunkte eine feste Pixelgroesse haben
      60             :     Rectangle       GetBoundRect(const OutputDevice& rOut) const;
      61             : };
      62             : 
      63             : #define SDRHELPLINE_NOTFOUND 0xFFFF
      64             : 
      65             : class SVX_DLLPUBLIC SdrHelpLineList {
      66             :     std::vector<SdrHelpLine*> aList;
      67             : protected:
      68           0 :     SdrHelpLine* GetObject(sal_uInt16 i) const { return aList[i]; }
      69             : public:
      70        2391 :     SdrHelpLineList(): aList() {}
      71             :     SdrHelpLineList(const SdrHelpLineList& rSrcList): aList()      { *this=rSrcList; }
      72        2385 :     ~SdrHelpLineList()                                                     { Clear(); }
      73             :     void               Clear();
      74             :     void               operator=(const SdrHelpLineList& rSrcList);
      75             :     bool operator==(const SdrHelpLineList& rCmp) const;
      76         203 :     bool operator!=(const SdrHelpLineList& rCmp) const                 { return !operator==(rCmp); }
      77        4184 :     sal_uInt16             GetCount() const                                    { return sal_uInt16(aList.size()); }
      78           0 :     void               Insert(const SdrHelpLine& rHL)                          { aList.push_back(new SdrHelpLine(rHL)); }
      79           0 :     void               Insert(const SdrHelpLine& rHL, sal_uInt16 nPos)
      80             :     {
      81           0 :         if(nPos==0xFFFF)
      82           0 :             aList.push_back(new SdrHelpLine(rHL));
      83             :         else
      84           0 :             aList.insert(aList.begin() + nPos, new SdrHelpLine(rHL));
      85           0 :     }
      86           0 :     void               Delete(sal_uInt16 nPos)
      87             :     {
      88           0 :         SdrHelpLine* p = aList[nPos];
      89           0 :         delete p;
      90           0 :         aList.erase(aList.begin() + nPos);
      91           0 :     }
      92             :     void               Move(sal_uInt16 nPos, sal_uInt16 nNewPos)
      93             :     {
      94             :         SdrHelpLine* p = aList[nPos];
      95             :         aList.erase(aList.begin() + nPos);
      96             :         aList.insert(aList.begin() + nNewPos, p);
      97             :     }
      98           0 :     SdrHelpLine&       operator[](sal_uInt16 nPos)                             { return *GetObject(nPos); }
      99           0 :     const SdrHelpLine& operator[](sal_uInt16 nPos) const                       { return *GetObject(nPos); }
     100             :     sal_uInt16             HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
     101             : };
     102             : 
     103             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     104             : 
     105             : #endif //_SVDHLPLN_HXX
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10