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

Generated by: LCOV version 1.10