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