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