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