LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/svx - framelink.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 11 100.0 %
Date: 2012-12-27 Functions: 8 8 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 SVX_FRAMELINK_HXX
      21             : #define SVX_FRAMELINK_HXX
      22             : 
      23             : #include <algorithm>
      24             : #include <sal/types.h>
      25             : #include <tools/gen.hxx>
      26             : #include <tools/color.hxx>
      27             : #include "svx/svxdllapi.h"
      28             : #include <vcl/outdev.hxx>
      29             : #include <editeng/borderline.hxx>
      30             : 
      31             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      32             : 
      33             : class OutputDevice;
      34             : 
      35             : namespace svx {
      36             : namespace frame {
      37             : 
      38             : // ============================================================================
      39             : // Enums
      40             : // ============================================================================
      41             : 
      42             : /** Specifies how the reference points for frame borders are used.
      43             :  */
      44             : enum RefMode
      45             : {
      46             :     /** Frame borders are drawn centered to the reference points. */
      47             :     REFMODE_CENTERED,
      48             : 
      49             :     /** The reference points specify the begin of the frame border width.
      50             : 
      51             :         The result is that horizontal lines are drawn below, and vertical lines
      52             :         are drawn right of the reference points.
      53             :      */
      54             :     REFMODE_BEGIN,
      55             : 
      56             :     /** The reference points specify the end of the frame border width.
      57             : 
      58             :         The result is that horizontal lines are drawn above, and vertical lines
      59             :         are drawn left of the reference points.
      60             :      */
      61             :     REFMODE_END
      62             : };
      63             : 
      64             : // ============================================================================
      65             : // Classes
      66             : // ============================================================================
      67             : 
      68             : /** Contains the widths of primary and secondary line of a frame style.
      69             : 
      70             :     In the following, "frame style" is a complete style of one frame border,
      71             :     i.e. the double line at the left side of the frame. A "line" is always a
      72             :     trivial single line, i.e. the first line of a double frame style.
      73             : 
      74             :     The following states of the members of this struct are valid:
      75             : 
      76             :     mnPrim      mnDist      mnSecn      frame style
      77             :     -------------------------------------------------
      78             :     0           0           0           invisible
      79             :     >0          0           0           single
      80             :     >0          >0          >0          double
      81             : 
      82             :     The behaviour of the member functions for other states is not defined.
      83             : 
      84             :     Per definition the primary line in double frame styles is:
      85             :     -   The top line for horizontal frame borders.
      86             :     -   The left line for vertical frame borders.
      87             :     -   The bottom-left line for top-left to bottom-right diagonal frame borders.
      88             :     -   The top-left line for bottom-left to top-right diagonal frame borders.
      89             : 
      90             :     The following picture shows the upper end of a vertical double frame
      91             :     border.
      92             : 
      93             :         |<---------------- GetWidth() ----------------->|
      94             :         |                                               |
      95             :         |<----- mnPrim ----->||<- mnDist ->||<- mnSecn >|
      96             :         |                    ||            ||           |
      97             :         ######################              #############
      98             :         ######################              #############
      99             :         ######################              #############
     100             :         ######################              #############
     101             :         ######################  |           #############
     102             :         ######################  |           #############
     103             :                                 |
     104             :                                 |<- middle of the frame border
     105             :  */
     106             : class SVX_DLLPUBLIC Style
     107             : {
     108             : public:
     109             :     /** Constructs an invisible frame style. */
     110        3710 :     inline explicit     Style()
     111             :         : meRefMode( REFMODE_CENTERED )
     112        3710 :         , mnType( ::com::sun::star::table::BorderLineStyle::SOLID )
     113        3710 :     { Clear(); }
     114             :     /** Constructs a frame style with passed line widths. */
     115             :     inline explicit     Style( double nP, double nD, double nS, editeng::SvxBorderStyle nType ) :
     116             :                             meRefMode( REFMODE_CENTERED ), mnType( nType )
     117             :                             { Clear(); Set( nP, nD, nS ); }
     118             :     /** Constructs a frame style with passed color and line widths. */
     119             :     inline explicit     Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor,
     120             :                             double nP, double nD, double nS, editeng::SvxBorderStyle nType ) :
     121             :                             meRefMode( REFMODE_CENTERED ), mnType( nType )
     122             :                             { Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS ); }
     123             :     /** Constructs a frame style from the passed SvxBorderLine struct. */
     124             :     inline explicit     Style( const editeng::SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) :
     125             :                             meRefMode( REFMODE_CENTERED ) { Set( rBorder, fScale, nMaxWidth ); }
     126             :     /** Constructs a frame style from the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */
     127        2432 :     inline explicit     Style( const editeng::SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) :
     128        2432 :                             meRefMode( REFMODE_CENTERED ) { Set( pBorder, fScale, nMaxWidth ); }
     129             : 
     130             :     inline RefMode      GetRefMode() const { return meRefMode; }
     131             :     inline const Color& GetColorPrim() const { return maColorPrim; }
     132             :     inline const Color& GetColorSecn() const { return maColorSecn; }
     133             :     inline const Color& GetColorGap() const { return maColorGap; }
     134             :     inline bool         UseGapColor() const { return mbUseGapColor; }
     135        3710 :     inline double       Prim() const { return mnPrim; }
     136        3710 :     inline double       Dist() const { return mnDist; }
     137        3710 :     inline double       Secn() const { return mnSecn; }
     138             :     inline editeng::SvxBorderStyle Type() const { return mnType; }
     139             : 
     140             :     /** Returns the total width of this frame style. */
     141        3410 :     inline double       GetWidth() const { return mnPrim + mnDist + mnSecn; }
     142             : 
     143             :     /** Sets the frame style to invisible state. */
     144             :     void                Clear();
     145             :     /** Sets the frame style to the passed line widths. */
     146             :     void                Set( double nP, double nD, double nS );
     147             :     /** Sets the frame style to the passed line widths. */
     148             :     void                Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor,
     149             :                             double nP, double nD, double nS );
     150             :     /** Sets the frame style to the passed SvxBorderLine struct. */
     151             :     void                Set( const editeng::SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
     152             :     /** Sets the frame style to the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */
     153             :     void                Set( const editeng::SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
     154             : 
     155             :     /** Sets a new reference point handling mode, does not modify other settings. */
     156        1592 :     inline void         SetRefMode( RefMode eRefMode ) { meRefMode = eRefMode; }
     157             :     /** Sets a new color, does not modify other settings. */
     158             :     inline void         SetColorPrim( const Color& rColor ) { maColorPrim = rColor; }
     159             :     inline void         SetColorSecn( const Color& rColor ) { maColorSecn = rColor; }
     160             :     inline void         SetColorGap( bool bUseIt, const Color& rColor ) { maColorGap = rColor; mbUseGapColor = bUseIt; }
     161             :     /** Sets whether to use dotted style for single hair lines. */
     162             :     inline void         SetType( editeng::SvxBorderStyle nType ) { mnType = nType; }
     163             : 
     164             :     /** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */
     165             :     Style&              MirrorSelf();
     166             :     /** Returns this style mirrored, if it is a double frame style, otherwise a simple copy. */
     167             :     Style               Mirror() const;
     168             : 
     169             : private:
     170             :     Color               maColorPrim;
     171             :     Color               maColorSecn;
     172             :     Color               maColorGap;
     173             :     bool                mbUseGapColor;
     174             :     RefMode             meRefMode;  /// Reference point handling for this frame border.
     175             :     double              mnPrim;     /// Width of primary (single, left, or top) line.
     176             :     double              mnDist;     /// Distance between primary and secondary line.
     177             :     double              mnSecn;     /// Width of secondary (right or bottom) line.
     178             :     editeng::SvxBorderStyle      mnType;
     179             : };
     180             : 
     181             : bool operator==( const Style& rL, const Style& rR );
     182             : SVX_DLLPUBLIC bool operator<( const Style& rL, const Style& rR );
     183             : 
     184             : inline bool operator!=( const Style& rL, const Style& rR ) { return !(rL == rR); }
     185        7130 : inline bool operator>( const Style& rL, const Style& rR ) { return rR < rL; }
     186             : inline bool operator<=( const Style& rL, const Style& rR ) { return !(rR < rL); }
     187             : inline bool operator>=( const Style& rL, const Style& rR ) { return !(rL < rR); }
     188             : 
     189             : // ----------------------------------------------------------------------------
     190             : 
     191             : /** Extends the Style struct with an angle for diagonal frame borders.
     192             : 
     193             :     The angle is specified in radian (a full circle is equivalent to 2*PI).
     194             :     It is dependent on the context, how the value is interpreted, i.e. it may
     195             :     specify the angle to a horizontal or vertical frame border.
     196             :  */
     197             : class DiagStyle : public Style
     198             : {
     199             : public:
     200             :     /** Constructs an invisible diagonal frame style. */
     201             :     inline explicit     DiagStyle() : mfAngle( 0.0 ) {}
     202             :     /** Constructs a diagonal frame style passed style and angle. */
     203             :     inline explicit     DiagStyle( const Style& rStyle, double fAngle ) :
     204             :                             Style( rStyle ), mfAngle( fAngle ) {}
     205             : 
     206             :     inline double       GetAngle() const { return mfAngle; }
     207             : 
     208             :     /** Returns this style mirrored, if it is a double frame style, otherwise a simple copy. */
     209             :     inline DiagStyle    Mirror() const { return DiagStyle( Style::Mirror(), mfAngle ); }
     210             : 
     211             : private:
     212             :     double              mfAngle;    /// Angle between this and hor. or vert. border.
     213             : };
     214             : 
     215             : // ============================================================================
     216             : // Various helper functions
     217             : // ============================================================================
     218             : 
     219             : /** Returns the angle between horizontal border of a rectangle and its diagonal.
     220             : 
     221             :     The returned values represents the inner angle between the diagonals and
     222             :     horizontal borders, and is therefore in the range [0,PI/2] (inclusive). The
     223             :     passed sizes may be negative, calculation is done with absolute values.
     224             :  */
     225             : SVX_DLLPUBLIC double GetHorDiagAngle( long nWidth, long nHeight );
     226             : 
     227             : /** Returns the angle between horizontal border of a rectangle and its diagonal.
     228             : 
     229             :     The returned values represents the inner angle between the diagonals and
     230             :     horizontal borders, and is therefore in the range [0,PI/2] (inclusive). The
     231             :     passed rectangle positions may be unordered, they are adjusted internally.
     232             :  */
     233             : inline double GetHorDiagAngle( long nX1, long nX2, long nY1, long nY2 )
     234             : { return GetHorDiagAngle( nX2 - nX1, nY2 - nY1 ); }
     235             : 
     236             : /** Returns the angle between horizontal border of a rectangle and its diagonal.
     237             : 
     238             :     The returned values represents the inner angle between the diagonals and
     239             :     horizontal borders, and is therefore in the range [0,PI/2] (inclusive). The
     240             :     passed rectangle edges may be unordered, they are adjusted internally.
     241             :  */
     242             : inline double GetHorDiagAngle( const Point& rP1, const Point& rP2 )
     243             : { return GetHorDiagAngle( rP2.X() - rP1.X(), rP2.Y() - rP1.Y() ); }
     244             : 
     245             : /** Returns the angle between horizontal border of a rectangle and its diagonal.
     246             : 
     247             :     The returned values represents the inner angle between the diagonals and
     248             :     horizontal borders, and is therefore in the range [0,PI/2] (inclusive).
     249             :  */
     250             : inline double GetHorDiagAngle( const Rectangle& rRect )
     251             : { return GetHorDiagAngle( rRect.GetWidth(), rRect.GetHeight() ); }
     252             : 
     253             : // ----------------------------------------------------------------------------
     254             : 
     255             : /** Returns the angle between vertical border of a rectangle and its diagonal.
     256             : 
     257             :     The returned values represents the inner angle between the diagonals and
     258             :     vertical borders, and is therefore in the range [0,PI/2] (inclusive). The
     259             :     passed sizes may be negative, calculation is done with absolute values.
     260             :  */
     261             : inline double GetVerDiagAngle( long nWidth, long nHeight )
     262             : { return GetHorDiagAngle( nHeight, nWidth ); }
     263             : 
     264             : /** Returns the angle between vertical border of a rectangle and its diagonal.
     265             : 
     266             :     The returned values represents the inner angle between the diagonals and
     267             :     vertical borders, and is therefore in the range [0,PI/2] (inclusive). The
     268             :     passed rectangle positions may be unordered, they are adjusted internally.
     269             :  */
     270             : inline double GetVerDiagAngle( long nX1, long nX2, long nY1, long nY2 )
     271             : { return GetVerDiagAngle( nX2 - nX1, nY2 - nY1 ); }
     272             : 
     273             : /** Returns the angle between vertical border of a rectangle and its diagonal.
     274             : 
     275             :     The returned values represents the inner angle between the diagonals and
     276             :     vertical borders, and is therefore in the range [0,PI/2] (inclusive). The
     277             :     passed rectangle edges may be unordered, they are adjusted internally.
     278             :  */
     279             : inline double GetVerDiagAngle( const Point& rP1, const Point& rP2 )
     280             : { return GetVerDiagAngle( rP2.X() - rP1.X(), rP2.Y() - rP1.Y() ); }
     281             : 
     282             : /** Returns the angle between vertical border of a rectangle and its diagonal.
     283             : 
     284             :     The returned values represents the inner angle between the diagonals and
     285             :     vertical borders, and is therefore in the range [0,PI/2] (inclusive).
     286             :  */
     287             : inline double GetVerDiagAngle( const Rectangle& rRect )
     288             : { return GetVerDiagAngle( rRect.GetWidth(), rRect.GetHeight() ); }
     289             : 
     290             : // ============================================================================
     291             : 
     292             : /** Returns an X coordinate for a diagonal frame border in the specified height.
     293             : 
     294             :     This function is for usage with the top-left end of a top-left to
     295             :     bottom-right diagonal frame border, connected to the left end of a
     296             :     horizontal frame border.
     297             : 
     298             :     The function returns the relative X position (i.e. for a polygon) of the
     299             :     diagonal frame border according to the specified relative Y position. The
     300             :     mentioned positions are relative to the reference point of both frame
     301             :     borders.
     302             : 
     303             :                 +----------------------------------------------------------
     304             :                 |               The horizontal frame border.
     305             :                 |    |
     306             :     - - - - - - |  --+--  <---- Reference point for horizontal and diagonal frame borders.
     307             :       ^         | \  |  \
     308             :      nVerOffs   |  \     \ <--- The diagonal frame border.
     309             :       v         +---\     \------------------------------------------------
     310             :     - - - - - - - - -\- - -X <----- The function calculates the X position of i.e.
     311             :                       \     \       this point (relative from X of reference point).
     312             :                        \     \
     313             :              Primary -->\     \<-- Secondary
     314             : 
     315             :     @param nVerOffs
     316             :         The vertical position of the point to be calculated, relative to the Y
     317             :         coordinate of the reference point.
     318             :     @param nDiagOffs
     319             :         The width offset across the diagonal frame border (0 = middle),
     320             :         regardless of the gradient of the diagonal frame border (always
     321             :         vertical to the direction of the diagonal frame border). This value is
     322             :         not related in any way to the reference point. For details about
     323             :         relative width offsets, see description of class Style.
     324             :     @param fAngle
     325             :         Inner (right) angle between diagonal and horizontal frame border.
     326             :  */
     327             : SVX_DLLPUBLIC long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
     328             : 
     329             : /** Returns an X coordinate for a diagonal frame border in the specified height.
     330             : 
     331             :     This function is for usage with the bottom-left end of a bottom-left to
     332             :     top-right diagonal frame border, connected to the left end of a horizontal
     333             :     frame border.
     334             : 
     335             :     The function returns the relative X position (i.e. for a polygon) of the
     336             :     diagonal frame border according to the specified relative Y position. The
     337             :     mentioned positions are relative to the reference point of both frame
     338             :     borders.
     339             : 
     340             :              Primary -->/     /<--- Secondary
     341             :                        /     /
     342             :                       /     /       The function calculates the X position of i.e.
     343             :     - - - - - - - - -/- - -X <----- this point (relative from X of reference point).
     344             :       ^         +---/     /------------------------------------------------
     345             :      nVerOffs   |  /     / <--- The diagonal frame border.
     346             :       v         | /  |  /
     347             :     - - - - - - |  --+--  <---- Reference point for horizontal and diagonal frame borders.
     348             :                 |    |
     349             :                 |               The horizontal frame border.
     350             :                 +----------------------------------------------------------
     351             : 
     352             :     @param nVerOffs
     353             :         The vertical position of the point to be calculated, relative to the Y
     354             :         coordinate of the reference point.
     355             :     @param nDiagOffs
     356             :         The width offset across the diagonal frame border (0 = middle),
     357             :         regardless of the gradient of the diagonal frame border (always
     358             :         vertical to the direction of the diagonal frame border). This value is
     359             :         not related in any way to the reference point. For details about
     360             :         relative width offsets, see description of class Style.
     361             :     @param fAngle
     362             :         Inner (right) angle between diagonal and horizontal frame border.
     363             :  */
     364             : long GetBLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
     365             : 
     366             : /** Returns an X coordinate for a diagonal frame border in the specified height.
     367             : 
     368             :     This function is for usage with the bottom-right end of a top-left to
     369             :     bottom-right diagonal frame border, connected to the right end of a
     370             :     horizontal frame border.
     371             : 
     372             :     @param nVerOffs
     373             :         The vertical position of the point to be calculated, relative to the Y
     374             :         coordinate of the reference point.
     375             :     @param nDiagOffs
     376             :         The width offset across the diagonal frame border (0 = middle),
     377             :         regardless of the gradient of the diagonal frame border (always
     378             :         vertical to the direction of the diagonal frame border). This value is
     379             :         not related in any way to the reference point. For details about
     380             :         relative width offsets, see description of class Style.
     381             :     @param fAngle
     382             :         Inner (left) angle between diagonal and horizontal frame border.
     383             :  */
     384             : long GetBRDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
     385             : 
     386             : /** Returns an X coordinate for a diagonal frame border in the specified height.
     387             : 
     388             :     This function is for usage with the top-right end of a bottom-left to
     389             :     top-right diagonal frame border, connected to the right end of a horizontal
     390             :     frame border.
     391             : 
     392             :     @param nVerOffs
     393             :         The vertical position of the point to be calculated, relative to the Y
     394             :         coordinate of the reference point.
     395             :     @param nDiagOffs
     396             :         The width offset across the diagonal frame border (0 = middle),
     397             :         regardless of the gradient of the diagonal frame border (always
     398             :         vertical to the direction of the diagonal frame border). This value is
     399             :         not related in any way to the reference point. For details about
     400             :         relative width offsets, see description of class Style.
     401             :     @param fAngle
     402             :         Inner (left) angle between diagonal and horizontal frame border.
     403             :  */
     404             : long GetTRDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
     405             : 
     406             : // ============================================================================
     407             : 
     408             : /** Checks whether two horizontal frame borders are "connectable".
     409             : 
     410             :     Two borders are "connectable" in terms of this function, if both can be
     411             :     drawn with only one call of a border drawing function. This means, the two
     412             :     frame borders must have equal style and color, and none of the other
     413             :     vertical and diagonal frame borders break the lines of the two borders in
     414             :     any way (i.e. two vertical double frame borders would break the horizonal
     415             :     frame borders). Of course this function can be used for vertical frame
     416             :     borders as well.
     417             : 
     418             :     The follong picture shows the meaning of all passed parameters:
     419             : 
     420             :                       \      rTFromT      /
     421             :                         \       |       /
     422             :                    rTFromTL     |   rTFromTR
     423             :                             \   |   /
     424             :                               \ | /
     425             :     ======== rLBorder =========   ========== rRBorder =======
     426             :                               / | \
     427             :                             /   |   \
     428             :                    rBFromBL     |   rBFromBR
     429             :                         /       |       \
     430             :                       /      rBFromB      \
     431             : 
     432             :     @return
     433             :         True, if rLBorder and rRBorder can be drawn in one step without
     434             :         interruption at their connection point.
     435             :  */
     436             : SVX_DLLPUBLIC bool CheckFrameBorderConnectable(
     437             :     const Style&        rLBorder,       /// Style of the left frame border to connect.
     438             :     const Style&        rRBorder,       /// Style of the right frame border to connect.
     439             : 
     440             :     const Style&        rTFromTL,       /// Diagonal frame border from top-left to connection point.
     441             :     const Style&        rTFromT,        /// Vertical frame border from top to connection point.
     442             :     const Style&        rTFromTR,       /// Horizontal frame border from top-right to connection point.
     443             : 
     444             :     const Style&        rBFromBL,       /// Diagonal frame border from bottom-left to connection point.
     445             :     const Style&        rBFromB,        /// Vertical frame border from bottom to connection point.
     446             :     const Style&        rBFromBR        /// Horizontal frame border from bottom-right to connection point.
     447             : );
     448             : 
     449             : // ============================================================================
     450             : // Drawing functions
     451             : // ============================================================================
     452             : 
     453             : /** Draws a horizontal frame border, regards all connected frame styles.
     454             : 
     455             :     The frame style to draw is passed as parameter rBorder. The function
     456             :     calculates the adjustment in X direction for left and right end of primary
     457             :     and secondary line of the frame border (the style may present a double
     458             :     line). The line ends may differ according to the connected frame styles
     459             :     coming from top, bottom, left, right, and/or diagonal.
     460             : 
     461             :     Thick frame styles are always drawn centered (in width) to the passed
     462             :     reference points. The Y coordinates of both reference points must be equal
     463             :     (the line cannot be drawn slanted).
     464             : 
     465             :     The function preserves all settings of the passed output device.
     466             : 
     467             :     All parameters starting with "rL" refer to the left end of the processed
     468             :     frame border, all parameters starting with "rR" refer to the right end.
     469             :     The following part of the parameter name starting with "From" specifies
     470             :     where the frame border comes from. Example: "rLFromTR" means the frame
     471             :     border coming from top-right, connected to the left end of rBorder (and
     472             :     therefore a diagonal frame border).
     473             : 
     474             :     The follong picture shows the meaning of all passed parameters:
     475             : 
     476             :                  rLFromT      /                   \      rRFromT
     477             :                     |       /                       \       |
     478             :                     |   rLFromTR               rRFromTL     |
     479             :                     |   /                               \   |
     480             :                     | /                                   \ |
     481             :     --- rLFromL ---   ============== rBorder ==============   --- rRFromR ---
     482             :                     | \                                   / |
     483             :                     |   \                               /   |
     484             :                     |   rLFromBR               rRFromBL     |
     485             :                     |       \                       /       |
     486             :                  rLFromB      \                   /      rRFromB
     487             :  */
     488             : SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
     489             :     const Point&        rLPos,          /// Reference point for left end of the processed frame border.
     490             :     const Point&        rRPos,          /// Reference point for right end of the processed frame border.
     491             :     const Style&        rBorder,        /// Style of the processed frame border.
     492             : 
     493             :     const DiagStyle&    rLFromTR,       /// Diagonal frame border from top-right to left end of rBorder.
     494             :     const Style&        rLFromT,        /// Vertical frame border from top to left end of rBorder.
     495             :     const Style&        rLFromL,        /// Horizontal frame border from left to left end of rBorder.
     496             :     const Style&        rLFromB,        /// Vertical frame border from bottom to left end of rBorder.
     497             :     const DiagStyle&    rLFromBR,       /// Diagonal frame border from bottom-right to left end of rBorder.
     498             : 
     499             :     const DiagStyle&    rRFromTL,       /// Diagonal frame border from top-left to right end of rBorder.
     500             :     const Style&        rRFromT,        /// Vertical frame border from top to right end of rBorder.
     501             :     const Style&        rRFromR,        /// Horizontal frame border from right to right end of rBorder.
     502             :     const Style&        rRFromB,        /// Vertical frame border from bottom to right end of rBorder.
     503             :     const DiagStyle&    rRFromBL,       /// Diagonal frame border from bottom-left to right end of rBorder.
     504             : 
     505             :     const Color*        pForceColor = 0,/// If specified, overrides frame border color.
     506             :     const long&         rRotationT = 9000, /// Angle of the top slanted frames in 100th of degree
     507             :     const long&         rRotationB = 9000  /// Angle of the bottom slanted frames in 100th of degree
     508             : );
     509             : 
     510             : SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
     511             :     const Point&        rLPos,          /// Reference point for left end of the processed frame border.
     512             :     const Point&        rRPos,          /// Reference point for right end of the processed frame border.
     513             :     const Style&        rBorder,        /// Style of the processed frame border.
     514             : 
     515             :     const Style&        rLFromT,        /// Vertical frame border from top to left end of rBorder.
     516             :     const Style&        rLFromL,        /// Horizontal frame border from left to left end of rBorder.
     517             :     const Style&        rLFromB,        /// Vertical frame border from bottom to left end of rBorder.
     518             : 
     519             :     const Style&        rRFromT,        /// Vertical frame border from top to right end of rBorder.
     520             :     const Style&        rRFromR,        /// Horizontal frame border from right to right end of rBorder.
     521             :     const Style&        rRFromB,        /// Vertical frame border from bottom to right end of rBorder.
     522             : 
     523             :     const Color*        pForceColor = 0,/// If specified, overrides frame border color.
     524             :     const long&         rRotationT = 9000, /// Angle of the top slanted frame in 100th of degrees
     525             :     const long&         rRotationB = 9000  /// Angle of the bottom slanted frame in 100th of degrees
     526             : );
     527             : 
     528             : SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateClippedBorderPrimitives (
     529             :         const Point& rStart, const Point& rEnd, const Style& rBorder,
     530             :         const Rectangle& rClipRect );
     531             : 
     532             : /** Draws a horizontal frame border, regards all connected frame styles.
     533             : 
     534             :     The frame style to draw is passed as parameter rBorder. The function
     535             :     calculates the adjustment in X direction for left and right end of primary
     536             :     and secondary line of the frame border (the style may present a double
     537             :     line). The line ends may differ according to the connected frame styles
     538             :     coming from top, bottom, left, right, and/or diagonal.
     539             : 
     540             :     Thick frame styles are always drawn centered (in width) to the passed
     541             :     reference points. The Y coordinates of both reference points must be equal
     542             :     (the line cannot be drawn slanted).
     543             : 
     544             :     The function preserves all settings of the passed output device.
     545             : 
     546             :     All parameters starting with "rL" refer to the left end of the processed
     547             :     frame border, all parameters starting with "rR" refer to the right end.
     548             :     The following part of the parameter name starting with "From" specifies
     549             :     where the frame border comes from. Example: "rLFromTR" means the frame
     550             :     border coming from top-right, connected to the left end of rBorder (and
     551             :     therefore a diagonal frame border).
     552             : 
     553             :     The follong picture shows the meaning of all passed parameters:
     554             : 
     555             :                  rLFromT      /                   \      rRFromT
     556             :                     |       /                       \       |
     557             :                     |   rLFromTR               rRFromTL     |
     558             :                     |   /                               \   |
     559             :                     | /                                   \ |
     560             :     --- rLFromL ---   ============== rBorder ==============   --- rRFromR ---
     561             :                     | \                                   / |
     562             :                     |   \                               /   |
     563             :                     |   rLFromBR               rRFromBL     |
     564             :                     |       \                       /       |
     565             :                  rLFromB      \                   /      rRFromB
     566             :  */
     567             : SVX_DLLPUBLIC void DrawHorFrameBorder(
     568             :     OutputDevice&       rDev,           /// The output device used to draw the frame border.
     569             : 
     570             :     const Point&        rLPos,          /// Reference point for left end of the processed frame border.
     571             :     const Point&        rRPos,          /// Reference point for right end of the processed frame border.
     572             :     const Style&        rBorder,        /// Style of the processed frame border.
     573             : 
     574             :     const DiagStyle&    rLFromTR,       /// Diagonal frame border from top-right to left end of rBorder.
     575             :     const Style&        rLFromT,        /// Vertical frame border from top to left end of rBorder.
     576             :     const Style&        rLFromL,        /// Horizontal frame border from left to left end of rBorder.
     577             :     const Style&        rLFromB,        /// Vertical frame border from bottom to left end of rBorder.
     578             :     const DiagStyle&    rLFromBR,       /// Diagonal frame border from bottom-right to left end of rBorder.
     579             : 
     580             :     const DiagStyle&    rRFromTL,       /// Diagonal frame border from top-left to right end of rBorder.
     581             :     const Style&        rRFromT,        /// Vertical frame border from top to right end of rBorder.
     582             :     const Style&        rRFromR,        /// Horizontal frame border from right to right end of rBorder.
     583             :     const Style&        rRFromB,        /// Vertical frame border from bottom to right end of rBorder.
     584             :     const DiagStyle&    rRFromBL,       /// Diagonal frame border from bottom-left to right end of rBorder.
     585             : 
     586             :     const Color*        pForceColor = 0 /// If specified, overrides frame border color.
     587             : );
     588             : 
     589             : // ============================================================================
     590             : 
     591             : /** Draws a vertical frame border, regards all connected frame styles.
     592             : 
     593             :     The frame style to draw is passed as parameter rBorder. The function
     594             :     calculates the adjustment in Y direction for top and bottom end of primary
     595             :     and secondary line of the frame border (the style may present a double
     596             :     line). The line ends may differ according to the connected frame styles
     597             :     coming from left, right, top, bottom, and/or diagonal.
     598             : 
     599             :     Thick frame styles are always drawn centered (in width) to the passed
     600             :     reference points. The X coordinates of both reference points must be equal
     601             :     (the line cannot be drawn slanted).
     602             : 
     603             :     The function preserves all settings of the passed output device.
     604             : 
     605             :     All parameters starting with "rT" refer to the top end of the processed
     606             :     frame border, all parameters starting with "rB" refer to the bottom end.
     607             :     The following part of the parameter name starting with "From" specifies
     608             :     where the frame border comes from. Example: "rTFromBL" means the frame
     609             :     border coming from bottom-left, connected to the top end of rBorder (and
     610             :     therefore a diagonal frame border).
     611             : 
     612             :     The follong picture shows the meaning of all passed parameters:
     613             : 
     614             :                     |
     615             :                  rTFromT
     616             :                     |
     617             :                     |
     618             :     --- rTFromL ---   --- rTFromR ---
     619             :                   / # \
     620             :                 /   #   \
     621             :         rTFromBL    #   rTFromBR
     622             :             /       #       \
     623             :           /         #         \
     624             :                     #
     625             :                  rBorder
     626             :                     #
     627             :           \         #         /
     628             :             \       #       /
     629             :         rBFromTL    #   rBFromTR
     630             :                 \   #   /
     631             :                   \ # /
     632             :     --- rBFromL ---   --- rBFromR ---
     633             :                     |
     634             :                     |
     635             :                  rBFromB
     636             :                     |
     637             :  */
     638             : SVX_DLLPUBLIC void DrawVerFrameBorder(
     639             :     OutputDevice&       rDev,           /// The output device used to draw the frame border.
     640             : 
     641             :     const Point&        rTPos,          /// Reference point for top end of the processed frame border.
     642             :     const Point&        rBPos,          /// Reference point for bottom end of the processed frame border.
     643             :     const Style&        rBorder,        /// Style of the processed frame border.
     644             : 
     645             :     const DiagStyle&    rTFromBL,       /// Diagonal frame border from bottom-right to top end of rBorder.
     646             :     const Style&        rTFromL,        /// Horizontal frame border from left to top end of rBorder.
     647             :     const Style&        rTFromT,        /// Vertical frame border from top to top end of rBorder.
     648             :     const Style&        rTFromR,        /// Horizontal frame border from right to top end of rBorder.
     649             :     const DiagStyle&    rTFromBR,       /// Diagonal frame border from bottom-right to top end of rBorder.
     650             : 
     651             :     const DiagStyle&    rBFromTL,       /// Diagonal frame border from top-left to bottom end of rBorder.
     652             :     const Style&        rBFromL,        /// Horizontal frame border from left to bottom end of rBorder.
     653             :     const Style&        rBFromB,        /// Vertical frame border from bottom to bottom end of rBorder.
     654             :     const Style&        rBFromR,        /// Horizontal frame border from right to bottom end of rBorder.
     655             :     const DiagStyle&    rBFromTR,       /// Diagonal frame border from top-right to bottom end of rBorder.
     656             : 
     657             :     const Color*        pForceColor = 0 /// If specified, overrides frame border color.
     658             : );
     659             : 
     660             : // ============================================================================
     661             : 
     662             : /** Draws both diagonal frame borders, regards all connected frame styles.
     663             : 
     664             :     One or both passed diagonal frame styles may be invisible.
     665             : 
     666             :     The function preserves all settings of the passed output device.
     667             :  */
     668             : SVX_DLLPUBLIC void DrawDiagFrameBorders(
     669             :     OutputDevice&       rDev,           /// The output device used to draw the frame border.
     670             : 
     671             :     const Rectangle&    rRect,          /// Rectangle for both diagonal frame borders.
     672             :     const Style&        rTLBR,          /// Style of the processed top-left to bottom-right diagonal frame border.
     673             :     const Style&        rBLTR,          /// Style of the processed bottom-left to top-right diagonal frame border.
     674             : 
     675             :     const Style&        rTLFromB,       /// Vertical frame border from bottom to top-left end of rTLBR.
     676             :     const Style&        rTLFromR,       /// Horizontal frame border from right to top-left end of rTLBR.
     677             :     const Style&        rBRFromT,       /// Vertical frame border from top to bottom-right end of rTLBR.
     678             :     const Style&        rBRFromL,       /// Horizontal frame border from left to bottom-right end of rTLBR.
     679             : 
     680             :     const Style&        rBLFromT,       /// Vertical frame border from top to bottom-left end of rBLTR.
     681             :     const Style&        rBLFromR,       /// Horizontal frame border from right to bottom-left end of rBLTR.
     682             :     const Style&        rTRFromB,       /// Vertical frame border from bottom to top-right end of rBLTR.
     683             :     const Style&        rTRFromL,       /// Horizontal frame border from left to top-right end of rBLTR.
     684             : 
     685             :     const Color*        pForceColor = 0,        /// If specified, overrides frame border color.
     686             :     bool                bDiagDblClip = false    /// true = Use clipping for crossing double frame borders.
     687             : );
     688             : 
     689             : // ============================================================================
     690             : 
     691             : } // namespace frame
     692             : } // namespace svx
     693             : 
     694             : /* Yes, I love ASCII art. :-) -DR- */
     695             : 
     696             : #endif
     697             : 
     698             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10