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 : #include <anchoredobjectposition.hxx>
21 : #ifndef _ENVIRONMENTOFANCHOREDOBJECT
22 : #include <environmentofanchoredobject.hxx>
23 : #endif
24 : #include <flyfrm.hxx>
25 : #include <flyfrms.hxx>
26 : #include <txtfrm.hxx>
27 : #include <pagefrm.hxx>
28 : #include <frmtool.hxx>
29 : #include <svx/svdobj.hxx>
30 : #include <dflyobj.hxx>
31 : #include <dcontact.hxx>
32 : #include <frmfmt.hxx>
33 : #include <fmtornt.hxx>
34 : // #i62875#
35 : #include <fmtfollowtextflow.hxx>
36 : #include <editeng/lrspitem.hxx>
37 : #include <editeng/ulspitem.hxx>
38 : #include <ndtxt.hxx>
39 : #include <IDocumentSettingAccess.hxx>
40 :
41 : using namespace ::com::sun::star;
42 : using namespace objectpositioning;
43 :
44 : // **************************************************************************
45 : // constructor, destructor, initialization
46 : // **************************************************************************
47 666 : SwAnchoredObjectPosition::SwAnchoredObjectPosition( SdrObject& _rDrawObj )
48 : : mrDrawObj( _rDrawObj ),
49 : mbIsObjFly( false ),
50 : mpAnchoredObj( 0 ),
51 : mpAnchorFrm( 0 ),
52 : mpContact( 0 ),
53 : // #i62875#
54 : mbFollowTextFlow( false ),
55 666 : mbDoNotCaptureAnchoredObj( false )
56 : {
57 : #if OSL_DEBUG_LEVEL > 0
58 : // assert, if object isn't of excepted type
59 : const bool bObjOfExceptedType =
60 : mrDrawObj.ISA(SwVirtFlyDrawObj) || // object representing fly frame
61 : mrDrawObj.ISA(SwDrawVirtObj) || // 'virtual' drawing object
62 : ( !mrDrawObj.ISA(SdrVirtObj) && // 'master' drawing object
63 : !mrDrawObj.ISA(SwFlyDrawObj) ); // - indirectly checked
64 : (void) bObjOfExceptedType;
65 : OSL_ENSURE( bObjOfExceptedType,
66 : "SwAnchoredObjectPosition(..) - object of unexcepted type!" );
67 : #endif
68 :
69 666 : _GetInfoAboutObj();
70 666 : }
71 :
72 : /** determine information about object
73 :
74 : members <mbIsObjFly>, <mpFrmOfObj>, <mpAnchorFrm>, <mpContact>,
75 : <mbFollowTextFlow> and <mbDoNotCaptureAnchoredObj> are set
76 :
77 : @author OD
78 : */
79 666 : void SwAnchoredObjectPosition::_GetInfoAboutObj()
80 : {
81 : // determine, if object represents a fly frame
82 : {
83 666 : mbIsObjFly = mrDrawObj.ISA(SwVirtFlyDrawObj);
84 : }
85 :
86 : // determine contact object
87 : {
88 666 : mpContact = static_cast<SwContact*>(GetUserCall( &mrDrawObj ));
89 : OSL_ENSURE( mpContact,
90 : "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing SwContact-object." );
91 : }
92 :
93 : // determine anchored object, the object belongs to
94 : {
95 : // #i26791#
96 666 : mpAnchoredObj = mpContact->GetAnchoredObj( &mrDrawObj );
97 : OSL_ENSURE( mpAnchoredObj,
98 : "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing anchored object." );
99 : }
100 :
101 : // determine frame, the object is anchored at
102 : {
103 : // #i26791#
104 666 : mpAnchorFrm = mpAnchoredObj->AnchorFrm();
105 : OSL_ENSURE( mpAnchorFrm,
106 : "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing anchor frame." );
107 : }
108 :
109 : // determine format the object belongs to
110 : {
111 : // #i28701#
112 666 : mpFrmFmt = &mpAnchoredObj->GetFrmFmt();
113 : OSL_ENSURE( mpFrmFmt,
114 : "<SwAnchoredObjectPosition::_GetInfoAboutObj() - missing frame format." );
115 : }
116 :
117 : // #i62875# - determine attribute value of <Follow-Text-Flow>
118 : {
119 666 : mbFollowTextFlow = mpFrmFmt->GetFollowTextFlow().GetValue();
120 : }
121 :
122 : // determine, if anchored object has not to be captured on the page.
123 : // the following conditions must be hold to *not* capture it:
124 : // - corresponding document compatibility flag is set
125 : // - it's a drawing object
126 : // - it doesn't follow the text flow
127 : {
128 719 : mbDoNotCaptureAnchoredObj = !mbIsObjFly && !mbFollowTextFlow &&
129 719 : mpFrmFmt->getIDocumentSettingAccess()->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE);
130 : }
131 666 : }
132 :
133 666 : SwAnchoredObjectPosition::~SwAnchoredObjectPosition()
134 666 : {}
135 :
136 0 : bool SwAnchoredObjectPosition::IsAnchoredToChar() const
137 : {
138 0 : return false;
139 : }
140 :
141 0 : const SwFrm* SwAnchoredObjectPosition::ToCharOrientFrm() const
142 : {
143 0 : return NULL;
144 : }
145 :
146 0 : const SwRect* SwAnchoredObjectPosition::ToCharRect() const
147 : {
148 0 : return NULL;
149 : }
150 :
151 : // #i22341#
152 0 : SwTwips SwAnchoredObjectPosition::ToCharTopOfLine() const
153 : {
154 0 : return 0L;
155 : }
156 :
157 : /** helper method to determine top of a frame for the vertical
158 : object positioning
159 :
160 : #i11860#
161 :
162 : @author OD
163 : */
164 305 : SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrm& _rFrm,
165 : const SwRectFn& _fnRect,
166 : const bool _bVert ) const
167 : {
168 305 : SwTwips nTopOfFrmForObjPos = (_rFrm.Frm().*_fnRect->fnGetTop)();
169 :
170 305 : if ( _rFrm.IsTxtFrm() )
171 : {
172 305 : const SwTxtFrm& rTxtFrm = static_cast<const SwTxtFrm&>(_rFrm);
173 305 : if ( _bVert )
174 : {
175 : nTopOfFrmForObjPos -=
176 0 : rTxtFrm.GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid();
177 : }
178 : else
179 : {
180 : nTopOfFrmForObjPos +=
181 305 : rTxtFrm.GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid();
182 : }
183 : }
184 :
185 305 : return nTopOfFrmForObjPos;
186 : }
187 :
188 8 : void SwAnchoredObjectPosition::_GetVertAlignmentValues(
189 : const SwFrm& _rVertOrientFrm,
190 : const SwFrm& _rPageAlignLayFrm,
191 : const sal_Int16 _eRelOrient,
192 : SwTwips& _orAlignAreaHeight,
193 : SwTwips& _orAlignAreaOffset ) const
194 : {
195 8 : SwTwips nHeight = 0;
196 8 : SwTwips nOffset = 0;
197 8 : SWRECTFN( (&_rVertOrientFrm) )
198 : // #i11860# - top of <_rVertOrientFrm> for object positioning
199 8 : const SwTwips nVertOrientTop = _GetTopForObjPos( _rVertOrientFrm, fnRect, bVert );
200 : // #i11860# - upper space amount of <_rVertOrientFrm> considered
201 : // for previous frame
202 : const SwTwips nVertOrientUpperSpaceForPrevFrmAndPageGrid =
203 8 : _rVertOrientFrm.IsTxtFrm()
204 : ? static_cast<const SwTxtFrm&>(_rVertOrientFrm).
205 8 : GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid()
206 16 : : 0;
207 8 : switch ( _eRelOrient )
208 : {
209 : case text::RelOrientation::FRAME:
210 : {
211 : // #i11860# - consider upper space of previous frame
212 1 : nHeight = (_rVertOrientFrm.Frm().*fnRect->fnGetHeight)() -
213 1 : nVertOrientUpperSpaceForPrevFrmAndPageGrid;
214 1 : nOffset = 0;
215 : }
216 1 : break;
217 : case text::RelOrientation::PRINT_AREA:
218 : {
219 2 : nHeight = (_rVertOrientFrm.Prt().*fnRect->fnGetHeight)();
220 : // #i11860# - consider upper space of previous frame
221 2 : nOffset = (_rVertOrientFrm.*fnRect->fnGetTopMargin)() -
222 2 : nVertOrientUpperSpaceForPrevFrmAndPageGrid;
223 : // if aligned to page in horizontal layout, consider header and
224 : // footer frame height appropriately.
225 2 : if( _rVertOrientFrm.IsPageFrm() && !bVert )
226 : {
227 : const SwFrm* pPrtFrm =
228 0 : static_cast<const SwPageFrm&>(_rVertOrientFrm).Lower();
229 0 : while( pPrtFrm )
230 : {
231 0 : if( pPrtFrm->IsHeaderFrm() )
232 : {
233 0 : nHeight -= pPrtFrm->Frm().Height();
234 0 : nOffset += pPrtFrm->Frm().Height();
235 : }
236 0 : else if( pPrtFrm->IsFooterFrm() )
237 : {
238 0 : nHeight -= pPrtFrm->Frm().Height();
239 : }
240 0 : pPrtFrm = pPrtFrm->GetNext();
241 : }
242 : }
243 : }
244 2 : break;
245 : case text::RelOrientation::PAGE_FRAME:
246 : {
247 2 : nHeight = (_rPageAlignLayFrm.Frm().*fnRect->fnGetHeight)();
248 : nOffset = (*fnRect->fnYDiff)(
249 6 : (_rPageAlignLayFrm.Frm().*fnRect->fnGetTop)(),
250 8 : nVertOrientTop );
251 : }
252 2 : break;
253 : case text::RelOrientation::PAGE_PRINT_AREA:
254 : {
255 3 : nHeight = (_rPageAlignLayFrm.Prt().*fnRect->fnGetHeight)();
256 3 : nOffset = (_rPageAlignLayFrm.*fnRect->fnGetTopMargin)() +
257 : (*fnRect->fnYDiff)(
258 9 : (_rPageAlignLayFrm.Frm().*fnRect->fnGetTop)(),
259 12 : nVertOrientTop );
260 : // if aligned to page in horizontal layout, consider header and
261 : // footer frame height appropriately.
262 3 : if( _rPageAlignLayFrm.IsPageFrm() && !bVert )
263 : {
264 : const SwFrm* pPrtFrm =
265 3 : static_cast<const SwPageFrm&>(_rPageAlignLayFrm).Lower();
266 9 : while( pPrtFrm )
267 : {
268 3 : if( pPrtFrm->IsHeaderFrm() )
269 : {
270 0 : nHeight -= pPrtFrm->Frm().Height();
271 0 : nOffset += pPrtFrm->Frm().Height();
272 : }
273 3 : else if( pPrtFrm->IsFooterFrm() )
274 : {
275 0 : nHeight -= pPrtFrm->Frm().Height();
276 : }
277 3 : pPrtFrm = pPrtFrm->GetNext();
278 : }
279 : }
280 : }
281 3 : break;
282 : // #i22341# - vertical alignment at top of line
283 : case text::RelOrientation::TEXT_LINE:
284 : {
285 0 : if ( IsAnchoredToChar() )
286 : {
287 0 : nHeight = 0;
288 0 : nOffset = (*fnRect->fnYDiff)( ToCharTopOfLine(), nVertOrientTop );
289 : }
290 : else
291 : {
292 : OSL_FAIL( "<SwAnchoredObjectPosition::_GetVertAlignmentValues(..)> - invalid relative alignment" );
293 : }
294 : }
295 0 : break;
296 : case text::RelOrientation::CHAR:
297 : {
298 0 : if ( IsAnchoredToChar() )
299 : {
300 0 : nHeight = (ToCharRect()->*fnRect->fnGetHeight)();
301 0 : nOffset = (*fnRect->fnYDiff)( (ToCharRect()->*fnRect->fnGetTop)(),
302 0 : nVertOrientTop );
303 : }
304 : else
305 : {
306 : OSL_FAIL( "<SwAnchoredObjectPosition::_GetVertAlignmentValues(..)> - invalid relative alignment" );
307 : }
308 : }
309 0 : break;
310 : // no break here, because text::RelOrientation::CHAR is invalid, if !mbAnchorToChar
311 : default:
312 : {
313 : OSL_FAIL( "<SwAnchoredObjectPosition::_GetVertAlignmentValues(..)> - invalid relative alignment" );
314 : }
315 : }
316 :
317 8 : _orAlignAreaHeight = nHeight;
318 8 : _orAlignAreaOffset = nOffset;
319 8 : }
320 :
321 : // #i26791# - add output parameter <_roVertOffsetToFrmAnchorPos>
322 0 : SwTwips SwAnchoredObjectPosition::_GetVertRelPos(
323 : const SwFrm& _rVertOrientFrm,
324 : const SwFrm& _rPageAlignLayFrm,
325 : const sal_Int16 _eVertOrient,
326 : const sal_Int16 _eRelOrient,
327 : const SwTwips _nVertPos,
328 : const SvxLRSpaceItem& _rLRSpacing,
329 : const SvxULSpaceItem& _rULSpacing,
330 : SwTwips& _roVertOffsetToFrmAnchorPos ) const
331 : {
332 0 : SwTwips nRelPosY = 0;
333 0 : SWRECTFN( (&_rVertOrientFrm) );
334 :
335 : SwTwips nAlignAreaHeight;
336 : SwTwips nAlignAreaOffset;
337 : _GetVertAlignmentValues( _rVertOrientFrm, _rPageAlignLayFrm,
338 0 : _eRelOrient, nAlignAreaHeight, nAlignAreaOffset );
339 :
340 0 : nRelPosY = nAlignAreaOffset;
341 0 : const SwRect aObjBoundRect( GetAnchoredObj().GetObjRect() );
342 0 : const SwTwips nObjHeight = (aObjBoundRect.*fnRect->fnGetHeight)();
343 :
344 0 : switch ( _eVertOrient )
345 : {
346 : case text::VertOrientation::NONE:
347 : {
348 : // 'manual' vertical position
349 0 : nRelPosY += _nVertPos;
350 : }
351 0 : break;
352 : case text::VertOrientation::TOP:
353 : {
354 : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
355 : nRelPosY += bVert
356 : ? ( bVertL2R
357 : ? _rLRSpacing.GetLeft()
358 : : _rLRSpacing.GetRight() )
359 0 : : _rULSpacing.GetUpper();
360 : }
361 0 : break;
362 : case text::VertOrientation::CENTER:
363 : {
364 0 : nRelPosY += (nAlignAreaHeight / 2) - (nObjHeight / 2);
365 : }
366 0 : break;
367 : case text::VertOrientation::BOTTOM:
368 : {
369 : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
370 : nRelPosY += nAlignAreaHeight -
371 : ( nObjHeight + ( bVert
372 : ? ( bVertL2R
373 : ? _rLRSpacing.GetRight()
374 : : _rLRSpacing.GetLeft() )
375 0 : : _rULSpacing.GetLower() ) );
376 : }
377 0 : break;
378 : default:
379 : {
380 : OSL_FAIL( "<SwAnchoredObjectPosition::_GetVertRelPos(..) - invalid vertical positioning" );
381 : }
382 : }
383 :
384 : // #i26791#
385 0 : _roVertOffsetToFrmAnchorPos = nAlignAreaOffset;
386 :
387 0 : return nRelPosY;
388 : }
389 :
390 : /** adjust calculated vertical in order to keep object inside
391 : 'page' alignment layout frame.
392 :
393 : #i28701# - parameter <_nTopOfAnch> and <_bVert> added
394 : #i31805# - add parameter <_bCheckBottom>
395 : #i26945# - add parameter <_bFollowTextFlow>
396 : #i62875# - method now private and renamed.
397 : OD 2009-09-01 #mongolianlayout# - add parameter <bVertL2R>
398 :
399 : @author OD
400 : */
401 61 : SwTwips SwAnchoredObjectPosition::_ImplAdjustVertRelPos( const SwTwips nTopOfAnch,
402 : const bool bVert,
403 : const bool bVertL2R,
404 : const SwFrm& rPageAlignLayFrm,
405 : const SwTwips nProposedRelPosY,
406 : const bool bFollowTextFlow,
407 : const bool bCheckBottom ) const
408 : {
409 61 : SwTwips nAdjustedRelPosY = nProposedRelPosY;
410 :
411 61 : const Size aObjSize( GetAnchoredObj().GetObjRect().SSize() );
412 :
413 : // determine the area of 'page' alignment frame, to which the vertical
414 : // position is restricted.
415 : // #i28701# - Extend restricted area for the vertical
416 : // position to area of the page frame, if wrapping style influence is
417 : // considered on object positioning. Needed to avoid layout loops in the
418 : // object positioning algorithm considering the wrapping style influence
419 : // caused by objects, which follow the text flow and thus are restricted
420 : // to its environment (e.g. page header/footer).
421 61 : SwRect aPgAlignArea;
422 : {
423 : // #i26945# - no extension of restricted area, if
424 : // object's attribute follow text flow is set and its inside a table
425 76 : if ( GetFrmFmt().getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) &&
426 15 : ( !bFollowTextFlow ||
427 0 : !GetAnchoredObj().GetAnchorFrm()->IsInTab() ) )
428 : {
429 15 : aPgAlignArea = rPageAlignLayFrm.FindPageFrm()->Frm();
430 : }
431 : else
432 : {
433 46 : aPgAlignArea = rPageAlignLayFrm.Frm();
434 : }
435 : }
436 :
437 61 : if ( bVert )
438 : {
439 : // #i31805# - consider value of <_bCheckBottom>
440 0 : if ( !bVertL2R )
441 : {
442 0 : if ( bCheckBottom &&
443 0 : nTopOfAnch - nAdjustedRelPosY - aObjSize.Width() <
444 0 : aPgAlignArea.Left() )
445 : {
446 0 : nAdjustedRelPosY = aPgAlignArea.Left() +
447 : nTopOfAnch -
448 0 : aObjSize.Width();
449 : }
450 : // #i32964# - correction
451 0 : if ( nTopOfAnch - nAdjustedRelPosY > aPgAlignArea.Right() )
452 : {
453 0 : nAdjustedRelPosY = nTopOfAnch - aPgAlignArea.Right();
454 : }
455 : }
456 : else
457 : {
458 0 : if ( bCheckBottom &&
459 0 : nTopOfAnch + nAdjustedRelPosY + aObjSize.Width() >
460 0 : aPgAlignArea.Right() )
461 : {
462 0 : nAdjustedRelPosY = aPgAlignArea.Right() -
463 : nTopOfAnch -
464 0 : aObjSize.Width();
465 : }
466 0 : if ( nTopOfAnch + nAdjustedRelPosY < aPgAlignArea.Left() )
467 : {
468 0 : nAdjustedRelPosY = aPgAlignArea.Left() - nTopOfAnch;
469 : }
470 : }
471 : }
472 : else
473 : {
474 : // #i31805# - consider value of <bCheckBottom>
475 183 : if ( bCheckBottom &&
476 61 : nTopOfAnch + nAdjustedRelPosY + aObjSize.Height() >
477 61 : aPgAlignArea.Top() + aPgAlignArea.Height() )
478 : {
479 8 : nAdjustedRelPosY = aPgAlignArea.Top() + aPgAlignArea.Height() -
480 : nTopOfAnch -
481 8 : aObjSize.Height();
482 : }
483 61 : if ( nTopOfAnch + nAdjustedRelPosY < aPgAlignArea.Top() )
484 : {
485 2 : nAdjustedRelPosY = aPgAlignArea.Top() - nTopOfAnch;
486 : }
487 : }
488 :
489 61 : return nAdjustedRelPosY;
490 : }
491 :
492 : /** adjust calculated horizontal in order to keep object inside
493 : 'page' alignment layout frame.
494 :
495 : #i62875# - method now private and renamed.
496 :
497 : @author OD
498 : */
499 61 : SwTwips SwAnchoredObjectPosition::_ImplAdjustHoriRelPos(
500 : const SwFrm& _rPageAlignLayFrm,
501 : const SwTwips _nProposedRelPosX ) const
502 : {
503 61 : SwTwips nAdjustedRelPosX = _nProposedRelPosX;
504 :
505 61 : const SwFrm& rAnchorFrm = GetAnchorFrm();
506 61 : const bool bVert = rAnchorFrm.IsVertical();
507 :
508 61 : const Size aObjSize( GetAnchoredObj().GetObjRect().SSize() );
509 :
510 61 : if( bVert )
511 : {
512 0 : if ( rAnchorFrm.Frm().Top() + nAdjustedRelPosX + aObjSize.Height() >
513 0 : _rPageAlignLayFrm.Frm().Bottom() )
514 : {
515 0 : nAdjustedRelPosX = _rPageAlignLayFrm.Frm().Bottom() -
516 0 : rAnchorFrm.Frm().Top() -
517 0 : aObjSize.Height();
518 : }
519 0 : if ( rAnchorFrm.Frm().Top() + nAdjustedRelPosX <
520 0 : _rPageAlignLayFrm.Frm().Top() )
521 : {
522 0 : nAdjustedRelPosX = _rPageAlignLayFrm.Frm().Top() -
523 0 : rAnchorFrm.Frm().Top();
524 : }
525 : }
526 : else
527 : {
528 122 : if ( rAnchorFrm.Frm().Left() + nAdjustedRelPosX + aObjSize.Width() >
529 61 : _rPageAlignLayFrm.Frm().Right() )
530 : {
531 5 : nAdjustedRelPosX = _rPageAlignLayFrm.Frm().Right() -
532 5 : rAnchorFrm.Frm().Left() -
533 5 : aObjSize.Width();
534 : }
535 122 : if ( rAnchorFrm.Frm().Left() + nAdjustedRelPosX <
536 61 : _rPageAlignLayFrm.Frm().Left() )
537 : {
538 0 : nAdjustedRelPosX = _rPageAlignLayFrm.Frm().Left() -
539 0 : rAnchorFrm.Frm().Left();
540 : }
541 : }
542 :
543 61 : return nAdjustedRelPosX;
544 : }
545 :
546 : /** determine alignment value for horizontal position of object
547 :
548 : @author OD
549 : */
550 61 : void SwAnchoredObjectPosition::_GetHoriAlignmentValues( const SwFrm& _rHoriOrientFrm,
551 : const SwFrm& _rPageAlignLayFrm,
552 : const sal_Int16 _eRelOrient,
553 : const bool _bObjWrapThrough,
554 : SwTwips& _orAlignAreaWidth,
555 : SwTwips& _orAlignAreaOffset,
556 : bool& _obAlignedRelToPage ) const
557 : {
558 61 : SwTwips nWidth = 0;
559 61 : SwTwips nOffset = 0;
560 61 : SWRECTFN( (&_rHoriOrientFrm) )
561 61 : switch ( _eRelOrient )
562 : {
563 : case text::RelOrientation::PRINT_AREA:
564 : {
565 4 : nWidth = (_rHoriOrientFrm.Prt().*fnRect->fnGetWidth)();
566 4 : nOffset = (_rHoriOrientFrm.*fnRect->fnGetLeftMargin)();
567 4 : if ( _rHoriOrientFrm.IsTxtFrm() )
568 : {
569 : // consider movement of text frame left
570 4 : nOffset += static_cast<const SwTxtFrm&>(_rHoriOrientFrm).GetBaseOfstForFly( !_bObjWrapThrough );
571 : }
572 0 : else if ( _rHoriOrientFrm.IsPageFrm() && bVert )
573 : {
574 : // for to-page anchored objects, consider header/footer frame
575 : // in vertical layout
576 : const SwFrm* pPrtFrm =
577 0 : static_cast<const SwPageFrm&>(_rHoriOrientFrm).Lower();
578 0 : while( pPrtFrm )
579 : {
580 0 : if( pPrtFrm->IsHeaderFrm() )
581 : {
582 0 : nWidth -= pPrtFrm->Frm().Height();
583 0 : nOffset += pPrtFrm->Frm().Height();
584 : }
585 0 : else if( pPrtFrm->IsFooterFrm() )
586 : {
587 0 : nWidth -= pPrtFrm->Frm().Height();
588 : }
589 0 : pPrtFrm = pPrtFrm->GetNext();
590 : }
591 : }
592 4 : break;
593 : }
594 : case text::RelOrientation::PAGE_LEFT:
595 : {
596 : // align at left border of page frame/fly frame/cell frame
597 0 : nWidth = (_rPageAlignLayFrm.*fnRect->fnGetLeftMargin)();
598 : nOffset = (*fnRect->fnXDiff)(
599 0 : (_rPageAlignLayFrm.Frm().*fnRect->fnGetLeft)(),
600 0 : (_rHoriOrientFrm.Frm().*fnRect->fnGetLeft)() );
601 0 : _obAlignedRelToPage = true;
602 : }
603 0 : break;
604 : case text::RelOrientation::PAGE_RIGHT:
605 : {
606 : // align at right border of page frame/fly frame/cell frame
607 0 : nWidth = (_rPageAlignLayFrm.*fnRect->fnGetRightMargin)();
608 : nOffset = (*fnRect->fnXDiff)(
609 0 : (_rPageAlignLayFrm.*fnRect->fnGetPrtRight)(),
610 0 : (_rHoriOrientFrm.Frm().*fnRect->fnGetLeft)() );
611 0 : _obAlignedRelToPage = true;
612 : }
613 0 : break;
614 : case text::RelOrientation::FRAME_LEFT:
615 : {
616 : // align at left border of anchor frame
617 0 : nWidth = (_rHoriOrientFrm.*fnRect->fnGetLeftMargin)();
618 0 : nOffset = 0;
619 : }
620 0 : break;
621 : case text::RelOrientation::FRAME_RIGHT:
622 : {
623 : // align at right border of anchor frame
624 : // Unify and simplify
625 0 : nWidth = (_rHoriOrientFrm.*fnRect->fnGetRightMargin)();
626 0 : nOffset = (_rHoriOrientFrm.Prt().*fnRect->fnGetRight)();
627 : }
628 0 : break;
629 : case text::RelOrientation::CHAR:
630 : {
631 : // alignment relative to character - assure, that corresponding
632 : // character rectangle is set.
633 0 : if ( IsAnchoredToChar() )
634 : {
635 0 : nWidth = 0;
636 : nOffset = (*fnRect->fnXDiff)(
637 0 : (ToCharRect()->*fnRect->fnGetLeft)(),
638 0 : (ToCharOrientFrm()->Frm().*fnRect->fnGetLeft)() );
639 0 : break;
640 : }
641 : // no break!
642 : }
643 : case text::RelOrientation::PAGE_PRINT_AREA:
644 : {
645 5 : nWidth = (_rPageAlignLayFrm.Prt().*fnRect->fnGetWidth)();
646 : nOffset = (*fnRect->fnXDiff)(
647 10 : (_rPageAlignLayFrm.*fnRect->fnGetPrtLeft)(),
648 15 : (_rHoriOrientFrm.Frm().*fnRect->fnGetLeft)() );
649 5 : if ( _rHoriOrientFrm.IsPageFrm() && bVert )
650 : {
651 : // for to-page anchored objects, consider header/footer frame
652 : // in vertical layout
653 : const SwFrm* pPrtFrm =
654 0 : static_cast<const SwPageFrm&>(_rHoriOrientFrm).Lower();
655 0 : while( pPrtFrm )
656 : {
657 0 : if( pPrtFrm->IsHeaderFrm() )
658 : {
659 0 : nWidth -= pPrtFrm->Frm().Height();
660 0 : nOffset += pPrtFrm->Frm().Height();
661 : }
662 0 : else if( pPrtFrm->IsFooterFrm() )
663 : {
664 0 : nWidth -= pPrtFrm->Frm().Height();
665 : }
666 0 : pPrtFrm = pPrtFrm->GetNext();
667 : }
668 : }
669 5 : _obAlignedRelToPage = true;
670 5 : break;
671 : }
672 : case text::RelOrientation::PAGE_FRAME:
673 : {
674 24 : nWidth = (_rPageAlignLayFrm.Frm().*fnRect->fnGetWidth)();
675 : nOffset = (*fnRect->fnXDiff)(
676 48 : (_rPageAlignLayFrm.Frm().*fnRect->fnGetLeft)(),
677 72 : (_rHoriOrientFrm.Frm().*fnRect->fnGetLeft)() );
678 24 : _obAlignedRelToPage = true;
679 24 : break;
680 : }
681 : default:
682 : {
683 28 : nWidth = (_rHoriOrientFrm.Frm().*fnRect->fnGetWidth)();
684 28 : nOffset = _rHoriOrientFrm.IsTxtFrm() ?
685 28 : static_cast<const SwTxtFrm&>(_rHoriOrientFrm).GetBaseOfstForFly( !_bObjWrapThrough ) :
686 56 : 0;
687 28 : break;
688 : }
689 : }
690 :
691 61 : _orAlignAreaWidth = nWidth;
692 61 : _orAlignAreaOffset = nOffset;
693 61 : }
694 :
695 : /** toggle given horizontal orientation and relative alignment
696 :
697 : @author OD
698 : */
699 61 : void SwAnchoredObjectPosition::_ToggleHoriOrientAndAlign(
700 : const bool _bToggleLeftRight,
701 : sal_Int16& _ioeHoriOrient,
702 : sal_Int16& _iopeRelOrient
703 : ) const
704 : {
705 61 : if( _bToggleLeftRight )
706 : {
707 : // toggle orientation
708 0 : switch ( _ioeHoriOrient )
709 : {
710 : case text::HoriOrientation::RIGHT :
711 : {
712 0 : _ioeHoriOrient = text::HoriOrientation::LEFT;
713 : }
714 0 : break;
715 : case text::HoriOrientation::LEFT :
716 : {
717 0 : _ioeHoriOrient = text::HoriOrientation::RIGHT;
718 : }
719 0 : break;
720 : default:
721 0 : break;
722 : }
723 :
724 : // toggle relative alignment
725 0 : switch ( _iopeRelOrient )
726 : {
727 : case text::RelOrientation::PAGE_RIGHT :
728 : {
729 0 : _iopeRelOrient = text::RelOrientation::PAGE_LEFT;
730 : }
731 0 : break;
732 : case text::RelOrientation::PAGE_LEFT :
733 : {
734 0 : _iopeRelOrient = text::RelOrientation::PAGE_RIGHT;
735 : }
736 0 : break;
737 : case text::RelOrientation::FRAME_RIGHT :
738 : {
739 0 : _iopeRelOrient = text::RelOrientation::FRAME_LEFT;
740 : }
741 0 : break;
742 : case text::RelOrientation::FRAME_LEFT :
743 : {
744 0 : _iopeRelOrient = text::RelOrientation::FRAME_RIGHT;
745 : }
746 0 : break;
747 : default:
748 0 : break;
749 : }
750 : }
751 61 : }
752 :
753 : /** calculate relative horizontal position
754 :
755 : @author OD
756 : */
757 61 : SwTwips SwAnchoredObjectPosition::_CalcRelPosX(
758 : const SwFrm& _rHoriOrientFrm,
759 : const SwEnvironmentOfAnchoredObject& _rEnvOfObj,
760 : const SwFmtHoriOrient& _rHoriOrient,
761 : const SvxLRSpaceItem& _rLRSpacing,
762 : const SvxULSpaceItem& _rULSpacing,
763 : const bool _bObjWrapThrough,
764 : const SwTwips _nRelPosY,
765 : SwTwips& _roHoriOffsetToFrmAnchorPos
766 : ) const
767 : {
768 : // determine 'page' alignment layout frame
769 : const SwFrm& rPageAlignLayFrm =
770 61 : _rEnvOfObj.GetHoriEnvironmentLayoutFrm( _rHoriOrientFrm );
771 :
772 61 : const bool bEvenPage = !rPageAlignLayFrm.OnRightPage();
773 61 : const bool bToggle = _rHoriOrient.IsPosToggle() && bEvenPage;
774 :
775 : // determine orientation and relative alignment
776 61 : sal_Int16 eHoriOrient = _rHoriOrient.GetHoriOrient();
777 61 : sal_Int16 eRelOrient = _rHoriOrient.GetRelationOrient();
778 : // toggle orientation and relative alignment
779 61 : _ToggleHoriOrientAndAlign( bToggle, eHoriOrient, eRelOrient );
780 :
781 : // determine alignment parameter
782 : // <nWidth>: 'width' of alignment area
783 : // <nOffset>: offset of alignment area, relative to 'left' of anchor frame
784 61 : SwTwips nWidth = 0;
785 61 : SwTwips nOffset = 0;
786 61 : bool bAlignedRelToPage = false;
787 : _GetHoriAlignmentValues( _rHoriOrientFrm, rPageAlignLayFrm,
788 : eRelOrient, _bObjWrapThrough,
789 61 : nWidth, nOffset, bAlignedRelToPage );
790 :
791 61 : const SwFrm& rAnchorFrm = GetAnchorFrm();
792 61 : SWRECTFN( (&_rHoriOrientFrm) )
793 61 : SwTwips nObjWidth = (GetAnchoredObj().GetObjRect().*fnRect->fnGetWidth)();
794 61 : SwTwips nRelPosX = nOffset;
795 61 : if ( _rHoriOrient.GetHoriOrient() == text::HoriOrientation::NONE )
796 : {
797 : // 'manual' horizonal position
798 53 : const bool bR2L = rAnchorFrm.IsRightToLeft();
799 53 : if( IsAnchoredToChar() && text::RelOrientation::CHAR == eRelOrient )
800 : {
801 0 : if( bR2L )
802 0 : nRelPosX -= _rHoriOrient.GetPos();
803 : else
804 0 : nRelPosX += _rHoriOrient.GetPos();
805 : }
806 53 : else if ( bToggle || ( !_rHoriOrient.IsPosToggle() && bR2L ) )
807 : {
808 : // Correction: consider <nOffset> also for
809 : // toggling from left to right.
810 0 : nRelPosX += nWidth - nObjWidth - _rHoriOrient.GetPos();
811 : }
812 : else
813 : {
814 53 : nRelPosX += _rHoriOrient.GetPos();
815 : }
816 : }
817 8 : else if ( text::HoriOrientation::CENTER == eHoriOrient )
818 8 : nRelPosX += (nWidth / 2) - (nObjWidth / 2);
819 0 : else if ( text::HoriOrientation::RIGHT == eHoriOrient )
820 : nRelPosX += nWidth -
821 : ( nObjWidth +
822 0 : ( bVert ? _rULSpacing.GetLower() : _rLRSpacing.GetRight() ) );
823 : else
824 0 : nRelPosX += bVert ? _rULSpacing.GetUpper() : _rLRSpacing.GetLeft();
825 :
826 : // adjust relative position by distance between anchor frame and
827 : // the frame, the object is oriented at.
828 61 : if ( &rAnchorFrm != &_rHoriOrientFrm )
829 : {
830 0 : SwTwips nLeftOrient = (_rHoriOrientFrm.Frm().*fnRect->fnGetLeft)();
831 0 : SwTwips nLeftAnchor = (rAnchorFrm.Frm().*fnRect->fnGetLeft)();
832 0 : nRelPosX += (*fnRect->fnXDiff)( nLeftOrient, nLeftAnchor );
833 : }
834 :
835 : // adjust calculated relative horizontal position, in order to
836 : // keep object inside 'page' alignment layout frame
837 : const SwFrm& rEnvironmentLayFrm =
838 61 : _rEnvOfObj.GetHoriEnvironmentLayoutFrm( _rHoriOrientFrm );
839 61 : nRelPosX = _AdjustHoriRelPos( rEnvironmentLayFrm, nRelPosX );
840 :
841 : // if object is a Writer fly frame and it's anchored to a content and
842 : // it is horizontal positioned left or right, but not relative to character,
843 : // it has to be drawn aside another object, which have the same horizontal
844 : // position and lay below it.
845 107 : if ( GetAnchoredObj().ISA(SwFlyFrm) &&
846 46 : ( GetContact().ObjAnchoredAtPara() || GetContact().ObjAnchoredAtChar() ) &&
847 : ( eHoriOrient == text::HoriOrientation::LEFT || eHoriOrient == text::HoriOrientation::RIGHT ) &&
848 : eRelOrient != text::RelOrientation::CHAR )
849 : {
850 : nRelPosX = _AdjustHoriRelPosForDrawAside( _rHoriOrientFrm,
851 : nRelPosX, _nRelPosY,
852 : eHoriOrient, eRelOrient,
853 : _rLRSpacing, _rULSpacing,
854 0 : bEvenPage );
855 : }
856 :
857 : // #i26791#
858 61 : _roHoriOffsetToFrmAnchorPos = nOffset;
859 :
860 61 : return nRelPosX;
861 : }
862 :
863 : // **************************************************************************
864 : // method incl. helper methods for adjusting proposed horizontal position,
865 : // if object has to draw aside another object.
866 : // **************************************************************************
867 : /** adjust calculated horizontal position in order to draw object
868 : aside other objects with same positioning
869 :
870 : @author OD
871 : */
872 0 : SwTwips SwAnchoredObjectPosition::_AdjustHoriRelPosForDrawAside(
873 : const SwFrm& _rHoriOrientFrm,
874 : const SwTwips _nProposedRelPosX,
875 : const SwTwips _nRelPosY,
876 : const sal_Int16 _eHoriOrient,
877 : const sal_Int16 _eRelOrient,
878 : const SvxLRSpaceItem& _rLRSpacing,
879 : const SvxULSpaceItem& _rULSpacing,
880 : const bool _bEvenPage
881 : ) const
882 : {
883 : // #i26791#
884 0 : if ( !GetAnchorFrm().ISA(SwTxtFrm) ||
885 0 : !GetAnchoredObj().ISA(SwFlyAtCntFrm) )
886 : {
887 : OSL_FAIL( "<SwAnchoredObjectPosition::_AdjustHoriRelPosForDrawAside(..) - usage for wrong anchor type" );
888 0 : return _nProposedRelPosX;
889 : }
890 :
891 0 : const SwTxtFrm& rAnchorTxtFrm = static_cast<const SwTxtFrm&>(GetAnchorFrm());
892 : // #i26791#
893 : const SwFlyAtCntFrm& rFlyAtCntFrm =
894 0 : static_cast<const SwFlyAtCntFrm&>(GetAnchoredObj());
895 0 : const SwRect aObjBoundRect( GetAnchoredObj().GetObjRect() );
896 0 : SWRECTFN( (&_rHoriOrientFrm) )
897 :
898 0 : SwTwips nAdjustedRelPosX = _nProposedRelPosX;
899 :
900 : // determine proposed object bound rectangle
901 0 : Point aTmpPos = (rAnchorTxtFrm.Frm().*fnRect->fnGetPos)();
902 0 : if( bVert )
903 : {
904 0 : aTmpPos.X() -= _nRelPosY + aObjBoundRect.Width();
905 0 : aTmpPos.Y() += nAdjustedRelPosX;
906 : }
907 : else
908 : {
909 0 : aTmpPos.X() += nAdjustedRelPosX;
910 0 : aTmpPos.Y() += _nRelPosY;
911 : }
912 0 : SwRect aTmpObjRect( aTmpPos, aObjBoundRect.SSize() );
913 :
914 0 : const sal_uInt32 nObjOrdNum = GetObject().GetOrdNum();
915 0 : const SwPageFrm* pObjPage = rFlyAtCntFrm.FindPageFrm();
916 0 : const SwFrm* pObjContext = ::FindKontext( &rAnchorTxtFrm, FRM_COLUMN );
917 0 : sal_uLong nObjIndex = rAnchorTxtFrm.GetTxtNode()->GetIndex();
918 0 : SwOrderIter aIter( pObjPage, sal_True );
919 0 : const SwFlyFrm* pFly = ((SwVirtFlyDrawObj*)aIter.Bottom())->GetFlyFrm();
920 0 : while ( pFly && nObjOrdNum > pFly->GetVirtDrawObj()->GetOrdNumDirect() )
921 : {
922 0 : if ( _DrawAsideFly( pFly, aTmpObjRect, pObjContext, nObjIndex,
923 0 : _bEvenPage, _eHoriOrient, _eRelOrient ) )
924 : {
925 0 : if( bVert )
926 : {
927 0 : const SvxULSpaceItem& rOtherUL = pFly->GetFmt()->GetULSpace();
928 0 : const SwTwips nOtherTop = pFly->Frm().Top() - rOtherUL.GetUpper();
929 0 : const SwTwips nOtherBot = pFly->Frm().Bottom() + rOtherUL.GetLower();
930 0 : if ( nOtherTop <= aTmpObjRect.Bottom() + _rULSpacing.GetLower() &&
931 0 : nOtherBot >= aTmpObjRect.Top() - _rULSpacing.GetUpper() )
932 : {
933 0 : if ( _eHoriOrient == text::HoriOrientation::LEFT )
934 : {
935 0 : SwTwips nTmp = nOtherBot + 1 + _rULSpacing.GetUpper() -
936 0 : rAnchorTxtFrm.Frm().Top();
937 0 : if ( nTmp > nAdjustedRelPosX &&
938 0 : rAnchorTxtFrm.Frm().Top() + nTmp +
939 0 : aObjBoundRect.Height() + _rULSpacing.GetLower()
940 0 : <= pObjPage->Frm().Height() + pObjPage->Frm().Top() )
941 : {
942 0 : nAdjustedRelPosX = nTmp;
943 : }
944 : }
945 0 : else if ( _eHoriOrient == text::HoriOrientation::RIGHT )
946 : {
947 0 : SwTwips nTmp = nOtherTop - 1 - _rULSpacing.GetLower() -
948 0 : aObjBoundRect.Height() -
949 0 : rAnchorTxtFrm.Frm().Top();
950 0 : if ( nTmp < nAdjustedRelPosX &&
951 0 : rAnchorTxtFrm.Frm().Top() + nTmp - _rULSpacing.GetUpper()
952 0 : >= pObjPage->Frm().Top() )
953 : {
954 0 : nAdjustedRelPosX = nTmp;
955 : }
956 : }
957 0 : aTmpObjRect.Pos().Y() = rAnchorTxtFrm.Frm().Top() +
958 0 : nAdjustedRelPosX;
959 : }
960 : }
961 : else
962 : {
963 0 : const SvxLRSpaceItem& rOtherLR = pFly->GetFmt()->GetLRSpace();
964 0 : const SwTwips nOtherLeft = pFly->Frm().Left() - rOtherLR.GetLeft();
965 0 : const SwTwips nOtherRight = pFly->Frm().Right() + rOtherLR.GetRight();
966 0 : if( nOtherLeft <= aTmpObjRect.Right() + _rLRSpacing.GetRight() &&
967 0 : nOtherRight >= aTmpObjRect.Left() - _rLRSpacing.GetLeft() )
968 : {
969 0 : if ( _eHoriOrient == text::HoriOrientation::LEFT )
970 : {
971 0 : SwTwips nTmp = nOtherRight + 1 + _rLRSpacing.GetLeft() -
972 0 : rAnchorTxtFrm.Frm().Left();
973 0 : if ( nTmp > nAdjustedRelPosX &&
974 0 : rAnchorTxtFrm.Frm().Left() + nTmp +
975 0 : aObjBoundRect.Width() + _rLRSpacing.GetRight()
976 0 : <= pObjPage->Frm().Width() + pObjPage->Frm().Left() )
977 : {
978 0 : nAdjustedRelPosX = nTmp;
979 : }
980 : }
981 0 : else if ( _eHoriOrient == text::HoriOrientation::RIGHT )
982 : {
983 0 : SwTwips nTmp = nOtherLeft - 1 - _rLRSpacing.GetRight() -
984 0 : aObjBoundRect.Width() -
985 0 : rAnchorTxtFrm.Frm().Left();
986 0 : if ( nTmp < nAdjustedRelPosX &&
987 0 : rAnchorTxtFrm.Frm().Left() + nTmp - _rLRSpacing.GetLeft()
988 0 : >= pObjPage->Frm().Left() )
989 : {
990 0 : nAdjustedRelPosX = nTmp;
991 : }
992 : }
993 0 : aTmpObjRect.Pos().X() = rAnchorTxtFrm.Frm().Left() +
994 0 : nAdjustedRelPosX;
995 : }
996 : } // end of <if (bVert)>
997 : } // end of <if _DrawAsideFly(..)>
998 :
999 0 : pFly = ((SwVirtFlyDrawObj*)aIter.Next())->GetFlyFrm();
1000 : } // end of <loop on fly frames
1001 :
1002 0 : return nAdjustedRelPosX;
1003 : }
1004 :
1005 : /** detemine, if object has to draw aside given fly frame
1006 :
1007 : method used by <_AdjustHoriRelPosForDrawAside(..)>
1008 :
1009 : @author OD
1010 : */
1011 0 : bool SwAnchoredObjectPosition::_DrawAsideFly( const SwFlyFrm* _pFly,
1012 : const SwRect& _rObjRect,
1013 : const SwFrm* _pObjContext,
1014 : const sal_uLong _nObjIndex,
1015 : const bool _bEvenPage,
1016 : const sal_Int16 _eHoriOrient,
1017 : const sal_Int16 _eRelOrient
1018 : ) const
1019 : {
1020 0 : bool bRetVal = false;
1021 :
1022 0 : SWRECTFN( (&GetAnchorFrm()) )
1023 :
1024 0 : if ( _pFly->IsFlyAtCntFrm() &&
1025 0 : (_pFly->Frm().*fnRect->fnBottomDist)( (_rObjRect.*fnRect->fnGetTop)() ) < 0 &&
1026 0 : (_rObjRect.*fnRect->fnBottomDist)( (_pFly->Frm().*fnRect->fnGetTop)() ) < 0 &&
1027 0 : ::FindKontext( _pFly->GetAnchorFrm(), FRM_COLUMN ) == _pObjContext )
1028 : {
1029 : sal_uLong nOtherIndex =
1030 0 : static_cast<const SwTxtFrm*>(_pFly->GetAnchorFrm())->GetTxtNode()->GetIndex();
1031 0 : if( _nObjIndex >= nOtherIndex )
1032 : {
1033 0 : const SwFmtHoriOrient& rHori = _pFly->GetFmt()->GetHoriOrient();
1034 0 : sal_Int16 eOtherRelOrient = rHori.GetRelationOrient();
1035 0 : if( text::RelOrientation::CHAR != eOtherRelOrient )
1036 : {
1037 0 : sal_Int16 eOtherHoriOrient = rHori.GetHoriOrient();
1038 0 : _ToggleHoriOrientAndAlign( _bEvenPage && rHori.IsPosToggle(),
1039 : eOtherHoriOrient,
1040 0 : eOtherRelOrient );
1041 0 : if ( eOtherHoriOrient == _eHoriOrient &&
1042 0 : _Minor( _eRelOrient, eOtherRelOrient, text::HoriOrientation::LEFT == _eHoriOrient ) )
1043 : {
1044 0 : bRetVal = true;
1045 : }
1046 : }
1047 : }
1048 : }
1049 :
1050 0 : return bRetVal;
1051 : }
1052 :
1053 : /** determine, if object has to draw aside another object
1054 :
1055 : the different alignments of the objects determines, if one has
1056 : to draw aside another one. Thus, the given alignment are checked
1057 : against each other, which one has to be drawn aside the other one.
1058 : depending on parameter _bLeft check is done for left or right
1059 : positioning.
1060 : method used by <_DrawAsideFly(..)>
1061 :
1062 : @author OD
1063 : */
1064 0 : bool SwAnchoredObjectPosition::_Minor( sal_Int16 _eRelOrient1,
1065 : sal_Int16 _eRelOrient2,
1066 : bool _bLeft ) const
1067 : {
1068 : bool bRetVal;
1069 :
1070 : // draw aside order for left horizontal position
1071 : //! one array entry for each value in text::RelOrientation
1072 : static sal_uInt16 const aLeft[ 10 ] =
1073 : { 5, 6, 0, 1, 8, 4, 7, 2, 3, 9 };
1074 : // draw aside order for right horizontal position
1075 : //! one array entry for each value in text::RelOrientation
1076 : static sal_uInt16 const aRight[ 10 ] =
1077 : { 5, 6, 0, 8, 1, 7, 4, 2, 3, 9 };
1078 :
1079 : // decide depending on given order, which frame has to draw aside another frame
1080 0 : if( _bLeft )
1081 0 : bRetVal = aLeft[ _eRelOrient1 ] >= aLeft[ _eRelOrient2 ];
1082 : else
1083 0 : bRetVal = aRight[ _eRelOrient1 ] >= aRight[ _eRelOrient2 ];
1084 :
1085 0 : return bRetVal;
1086 : }
1087 :
1088 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|