LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/vcl - regband.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-12-27 Functions: 1 1 100.0 %
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 _SV_REGBAND_HXX
      21             : #define _SV_REGBAND_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <tools/poly.hxx>
      25             : 
      26             : /* =======================================================================
      27             : 
      28             : class ImplRegionBand
      29             : 
      30             : This class handles one y-band of the region. In this band may contain one
      31             : or more seprarations in x-direction. The y-Band do not contain any
      32             : separation after creation.
      33             : 
      34             : The separations are modified with basic clipping functions like Union and
      35             : Intersection - the Class will process the clipping for the actual band.
      36             : 
      37             : The actual separations may be checked by functions like IsInside or
      38             : IsOver.
      39             : 
      40             : ======================================================================= */
      41             : 
      42             : // ------------------------
      43             : // - ImplRegionBand-Types -
      44             : // ------------------------
      45             : 
      46             : // element for the list with x-separations
      47             : struct ImplRegionBandSep
      48             : {
      49             :     ImplRegionBandSep*          mpNextSep;
      50             :     long                        mnXLeft;
      51             :     long                        mnXRight;
      52             :     sal_Bool                        mbRemoved;
      53             : };
      54             : 
      55             : enum LineType { LINE_ASCENDING, LINE_DESCENDING, LINE_HORIZONTAL };
      56             : 
      57             : // element for the list with x-separations
      58             : struct ImplRegionBandPoint
      59             : {
      60             :     ImplRegionBandPoint*        mpNextBandPoint;
      61             :     long                        mnX;
      62             :     long                        mnLineId;
      63             :     sal_Bool                        mbEndPoint;
      64             :     LineType                    meLineType;
      65             : };
      66             : 
      67             : // ------------------
      68             : // - ImplRegionBand -
      69             : // ------------------
      70             : 
      71             : class ImplRegionBand
      72             : {
      73             : public:
      74             :     ImplRegionBand*             mpNextBand;         // pointer to the next element of the list
      75             :     ImplRegionBand*             mpPrevBand;         // pointer to the previous element of the list (only used temporaery)
      76             :     ImplRegionBandSep*          mpFirstSep;         // root of the list with x-separations
      77             :     ImplRegionBandPoint*        mpFirstBandPoint;   // root of the list with lines
      78             :     long                        mnYTop;             // actual boundary of the band
      79             :     long                        mnYBottom;
      80             :     sal_Bool                        mbTouched;
      81             : 
      82             :                                 // create y-band with boundaries
      83             :                                 ImplRegionBand( long nYTop, long nYBottom );
      84             :                                 /** copy y-band with with all data
      85             :                                     @param theSourceBand
      86             :                                         The new ImplRegionBand object will
      87             :                                         be a copy of this band.
      88             :                                     @param bIgnorePoints
      89             :                                         When <TRUE/> (the default) the
      90             :                                         band points pointed to by
      91             :                                         mpFirstBandPoint are not copied.
      92             :                                         When <FALSE/> they are copied.
      93             :                                         You need the points when you are
      94             :                                         planning to call ProcessPoints()
      95             :                                         later on.
      96             :                                 */
      97             :                                 ImplRegionBand( const ImplRegionBand & theSourceBand,
      98             :                                                 const bool bIgnorePoints = true);
      99             :                                 ~ImplRegionBand();
     100             : 
     101             :     long                        GetXLeftBoundary() const;
     102             :     long                        GetXRightBoundary() const;
     103             : 
     104             :                                 // combine overlapping bands
     105             :     sal_Bool                        OptimizeBand();
     106             : 
     107             :                                 // generate separations from lines and process
     108             :                                 // union with existing separations
     109             :     void                        ProcessPoints();
     110             :                                 // insert point in the list for later processing
     111             :     sal_Bool                        InsertPoint( long nX, long nLineID,
     112             :                                              sal_Bool bEndPoint, LineType eLineType );
     113             : 
     114             :     void                        Union( long nXLeft, long nXRight );
     115             :     void                        Intersect( long nXLeft, long nXRight );
     116             :     void                        Exclude( long nXLeft, long nXRight );
     117             :     void                        XOr( long nXLeft, long nXRight );
     118             : 
     119             :     void                        MoveX( long nHorzMove );
     120             :     void                        ScaleX( double fHorzScale );
     121             : 
     122             :     sal_Bool                        IsInside( long nX );
     123             : 
     124      135853 :     sal_Bool                        IsEmpty() const { return ((!mpFirstSep) && (!mpFirstBandPoint)); }
     125             : 
     126             :     sal_Bool                        operator==( const ImplRegionBand& rRegionBand ) const;
     127             : 
     128             :     /** Split the called band at the given vertical coordinate.  After the
     129             :         split the called band will cover the upper part not including nY.
     130             :         The new band will cover the lower part including nY.
     131             :         @param nY
     132             :             The band is split at this y coordinate.  The new, lower band
     133             :             will include this very value.
     134             :         @return
     135             :             Returns the new, lower band.
     136             :     */
     137             :     ImplRegionBand*             SplitBand (const sal_Int32 nY);
     138             : };
     139             : 
     140             : #endif  // _SV_REGBAND_HXX
     141             : 
     142             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10