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