LibreOffice Module sw (master)  1
anchoredobjectposition.cxx
Go to the documentation of this file.
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 
22 #include <flyfrm.hxx>
23 #include <flyfrms.hxx>
24 #include <txtfrm.hxx>
25 #include <pagefrm.hxx>
26 #include <frmatr.hxx>
27 #include <frmtool.hxx>
28 #include <svx/svdobj.hxx>
29 #include <dflyobj.hxx>
30 #include <dcontact.hxx>
31 #include <frmfmt.hxx>
32 #include <fmtornt.hxx>
33 #include <fmtfsize.hxx>
34 #include <fmtfollowtextflow.hxx>
35 #include <editeng/lrspitem.hxx>
36 #include <editeng/ulspitem.hxx>
37 #include <ndtxt.hxx>
39 #include <textboxhelper.hxx>
40 #include <fmtsrnd.hxx>
41 #include <svx/sdtagitm.hxx>
42 
43 using namespace ::com::sun::star;
44 using namespace objectpositioning;
45 
47  : mrDrawObj( _rDrawObj ),
48  mpAnchoredObj( nullptr ),
49  mpAnchorFrame( nullptr ),
50  mpContact( nullptr ),
51  mbIsObjFly( false ),
52  // #i62875#
53  mbFollowTextFlow( false ),
54  mbDoNotCaptureAnchoredObj( false )
55 {
56 #if OSL_DEBUG_LEVEL > 0
57  // assert, if object isn't of expected type
58  const bool bObjOfExceptedType =
59  dynamic_cast<const SwVirtFlyDrawObj*>( &mrDrawObj) != nullptr || // object representing fly frame
60  dynamic_cast<const SwDrawVirtObj*>( &mrDrawObj) != nullptr || // 'virtual' drawing object
61  ( dynamic_cast<const SdrVirtObj*>( &mrDrawObj) == nullptr && // 'master' drawing object
62  dynamic_cast<const SwFlyDrawObj*>( &mrDrawObj) == nullptr ); // - indirectly checked
63  OSL_ENSURE( bObjOfExceptedType,
64  "SwAnchoredObjectPosition(..) - object of unexpected type!" );
65 #endif
66 
68 }
69 
76 {
77  // determine, if object represents a fly frame
78  {
79  mbIsObjFly = dynamic_cast<const SwVirtFlyDrawObj*>( &mrDrawObj) != nullptr;
80  }
81 
82  // determine contact object
83  {
85  assert(mpContact &&
86  "SwAnchoredObjectPosition::GetInfoAboutObj() - missing SwContact-object.");
87  }
88 
89  // determine anchored object, the object belongs to
90  {
91  // #i26791#
94  "SwAnchoredObjectPosition::GetInfoAboutObj() - missing anchored object.");
95  }
96 
97  // determine frame, the object is anchored at
98  {
99  // #i26791#
101  OSL_ENSURE( mpAnchorFrame,
102  "SwAnchoredObjectPosition::GetInfoAboutObj() - missing anchor frame." );
103  }
104 
105  // determine format the object belongs to
106  {
107  // #i28701#
110  "<SwAnchoredObjectPosition::GetInfoAboutObj() - missing frame format.");
111  }
112 
113  // #i62875# - determine attribute value of <Follow-Text-Flow>
114  {
116  }
117 
118  // determine, if anchored object has not to be captured on the page.
119  // the following conditions must be hold to *not* capture it:
120  // - corresponding document compatibility flag is set
121  // - it's a drawing object or it's a non-textbox wrap-though fly frame
122  // - it doesn't follow the text flow
123  {
125  bool bWrapThrough = mpFrameFormat->GetSurround().GetSurround() == css::text::WrapTextMode_THROUGH;
126  mbDoNotCaptureAnchoredObj = (!mbIsObjFly || (!bTextBox && bWrapThrough)) && !mbFollowTextFlow &&
128  }
129 }
130 
132 {}
133 
135 {
136  return false;
137 }
138 
140 {
141  return nullptr;
142 }
143 
145 {
146  return nullptr;
147 }
148 
149 // #i22341#
151 {
152  return 0;
153 }
154 
161  const SwRectFn& _fnRect,
162  const bool _bVert ) const
163 {
164  SwTwips nTopOfFrameForObjPos = (_rFrame.getFrameArea().*_fnRect->fnGetTop)();
165 
166  if ( _rFrame.IsTextFrame() )
167  {
168  const SwTextFrame& rTextFrame = static_cast<const SwTextFrame&>(_rFrame);
169  if ( _bVert )
170  {
171  nTopOfFrameForObjPos -=
173  }
174  else
175  {
176  nTopOfFrameForObjPos +=
178 
179  const SwFormatSurround& rSurround = mpFrameFormat->GetSurround();
180  bool bWrapThrough = rSurround.GetSurround() == css::text::WrapTextMode_THROUGH;
181  // If the frame format is a TextBox of a draw shape, then use the
182  // surround of the original shape.
184 
185  // Get the offset between the top of the text frame and the top of
186  // the first line inside the frame that has more than just fly
187  // portions.
188  nTopOfFrameForObjPos += rTextFrame.GetBaseVertOffsetForFly(!bWrapThrough);
189  }
190  }
191 
192  return nTopOfFrameForObjPos;
193 }
194 
196  const SwFrame& _rVertOrientFrame,
197  const SwFrame& _rPageAlignLayFrame,
198  const sal_Int16 _eRelOrient,
199  SwTwips& _orAlignAreaHeight,
200  SwTwips& _orAlignAreaOffset ) const
201 {
202  SwTwips nHeight = 0;
203  SwTwips nOffset = 0;
204  SwRectFnSet aRectFnSet(&_rVertOrientFrame);
205  // #i11860# - top of <_rVertOrientFrame> for object positioning
206  const SwTwips nVertOrientTop = GetTopForObjPos( _rVertOrientFrame, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
207  // #i11860# - upper space amount of <_rVertOrientFrame> considered
208  // for previous frame
209  const SwTwips nVertOrientUpperSpaceForPrevFrameAndPageGrid =
210  _rVertOrientFrame.IsTextFrame()
211  ? static_cast<const SwTextFrame&>(_rVertOrientFrame).
212  GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid()
213  : 0;
214  switch ( _eRelOrient )
215  {
216  case text::RelOrientation::FRAME:
217  {
218  // #i11860# - consider upper space of previous frame
219  nHeight = aRectFnSet.GetHeight(_rVertOrientFrame.getFrameArea()) -
220  nVertOrientUpperSpaceForPrevFrameAndPageGrid;
221  nOffset = 0;
222  }
223  break;
224  case text::RelOrientation::PRINT_AREA:
225  {
226  nHeight = aRectFnSet.GetHeight(_rVertOrientFrame.getFramePrintArea());
227  // #i11860# - consider upper space of previous frame
228  nOffset = aRectFnSet.GetTopMargin(_rVertOrientFrame) -
229  nVertOrientUpperSpaceForPrevFrameAndPageGrid;
230  // if aligned to page in horizontal layout, consider header and
231  // footer frame height appropriately.
232  if( _rVertOrientFrame.IsPageFrame() && !aRectFnSet.IsVert() )
233  {
234  const SwFrame* pPrtFrame =
235  static_cast<const SwPageFrame&>(_rVertOrientFrame).Lower();
236  while( pPrtFrame )
237  {
238  if( pPrtFrame->IsHeaderFrame() )
239  {
240  nHeight -= pPrtFrame->getFrameArea().Height();
241  nOffset += pPrtFrame->getFrameArea().Height();
242  }
243  else if( pPrtFrame->IsFooterFrame() )
244  {
245  nHeight -= pPrtFrame->getFrameArea().Height();
246  }
247  pPrtFrame = pPrtFrame->GetNext();
248  }
249  }
250  }
251  break;
252  case text::RelOrientation::PAGE_FRAME:
253  case text::RelOrientation::PAGE_PRINT_AREA_TOP:
254  {
255  nHeight = aRectFnSet.GetHeight(_rPageAlignLayFrame.getFrameArea());
256  nOffset = aRectFnSet.YDiff(
257  aRectFnSet.GetTop(_rPageAlignLayFrame.getFrameArea()),
258  nVertOrientTop );
259  }
260  break;
261  case text::RelOrientation::PAGE_PRINT_AREA:
262  {
263  nHeight = aRectFnSet.GetHeight(_rPageAlignLayFrame.getFramePrintArea());
264  nOffset = aRectFnSet.GetTopMargin(_rPageAlignLayFrame) +
265  aRectFnSet.YDiff(
266  aRectFnSet.GetTop(_rPageAlignLayFrame.getFrameArea()),
267  nVertOrientTop );
268  // if aligned to page in horizontal layout, consider header and
269  // footer frame height appropriately.
270  if( _rPageAlignLayFrame.IsPageFrame() && !aRectFnSet.IsVert() )
271  {
272  const SwFrame* pPrtFrame =
273  static_cast<const SwPageFrame&>(_rPageAlignLayFrame).Lower();
274  while( pPrtFrame )
275  {
276  if( pPrtFrame->IsHeaderFrame() )
277  {
278  nHeight -= pPrtFrame->getFrameArea().Height();
279  nOffset += pPrtFrame->getFrameArea().Height();
280  }
281  else if( pPrtFrame->IsFooterFrame() )
282  {
283  nHeight -= pPrtFrame->getFrameArea().Height();
284  }
285  pPrtFrame = pPrtFrame->GetNext();
286  }
287  }
288  }
289  break;
290  case text::RelOrientation::PAGE_PRINT_AREA_BOTTOM:
291  {
292  nHeight = aRectFnSet.GetBottomMargin(_rPageAlignLayFrame);
293  nOffset = aRectFnSet.YDiff(
294  aRectFnSet.GetPrtBottom(_rPageAlignLayFrame),
295  nVertOrientTop);
296 
297  if (_rPageAlignLayFrame.IsPageFrame() && !aRectFnSet.IsVert())
298  {
299  const SwFrame* pPrtFrame =
300  static_cast<const SwPageFrame&>(_rPageAlignLayFrame).Lower();
301 
302  while (pPrtFrame)
303  {
304  if (pPrtFrame->IsFooterFrame())
305  {
306  nHeight += pPrtFrame->getFrameArea().Height();
307  nOffset -= pPrtFrame->getFrameArea().Height();
308  }
309  pPrtFrame = pPrtFrame->GetNext();
310  }
311  }
312 
313  }
314  break;
315  // #i22341# - vertical alignment at top of line
316  case text::RelOrientation::TEXT_LINE:
317  {
318  if ( IsAnchoredToChar() )
319  {
320  nHeight = 0;
321  nOffset = aRectFnSet.YDiff( ToCharTopOfLine(), nVertOrientTop );
322  }
323  else
324  {
325  OSL_FAIL( "<SwAnchoredObjectPosition::GetVertAlignmentValues(..)> - invalid relative alignment" );
326  }
327  }
328  break;
329  case text::RelOrientation::CHAR:
330  {
331  if ( IsAnchoredToChar() )
332  {
333  nHeight = aRectFnSet.GetHeight(*ToCharRect());
334  nOffset = aRectFnSet.YDiff( aRectFnSet.GetTop(*ToCharRect()),
335  nVertOrientTop );
336  }
337  else
338  {
339  OSL_FAIL( "<SwAnchoredObjectPosition::GetVertAlignmentValues(..)> - invalid relative alignment" );
340  }
341  }
342  break;
343  // no break here, because text::RelOrientation::CHAR is invalid, if !mbAnchorToChar
344  default:
345  {
346  OSL_FAIL( "<SwAnchoredObjectPosition::GetVertAlignmentValues(..)> - invalid relative alignment" );
347  }
348  }
349 
350  _orAlignAreaHeight = nHeight;
351  _orAlignAreaOffset = nOffset;
352 }
353 
354 // #i26791# - add output parameter <_roVertOffsetToFrameAnchorPos>
356  const SwFrame& _rVertOrientFrame,
357  const SwFrame& _rPageAlignLayFrame,
358  const sal_Int16 _eVertOrient,
359  const sal_Int16 _eRelOrient,
360  const SwTwips _nVertPos,
361  const SvxLRSpaceItem& _rLRSpacing,
362  const SvxULSpaceItem& _rULSpacing,
363  SwTwips& _roVertOffsetToFrameAnchorPos ) const
364 {
365  SwTwips nRelPosY = 0;
366  SwRectFnSet aRectFnSet(&_rVertOrientFrame);
367 
368  SwTwips nAlignAreaHeight;
369  SwTwips nAlignAreaOffset;
370  GetVertAlignmentValues( _rVertOrientFrame, _rPageAlignLayFrame,
371  _eRelOrient, nAlignAreaHeight, nAlignAreaOffset );
372 
373  nRelPosY = nAlignAreaOffset;
374  const SwRect aObjBoundRect( GetAnchoredObj().GetObjRect() );
375  const SwTwips nObjHeight = aRectFnSet.GetHeight(aObjBoundRect);
376 
377  switch ( _eVertOrient )
378  {
380  {
381  // 'manual' vertical position
382  nRelPosY += _nVertPos;
383  }
384  break;
385  case text::VertOrientation::TOP:
386  {
387  nRelPosY += aRectFnSet.IsVert()
388  ? ( aRectFnSet.IsVertL2R()
389  ? _rLRSpacing.GetLeft()
390  : _rLRSpacing.GetRight() )
391  : _rULSpacing.GetUpper();
392  }
393  break;
394  case text::VertOrientation::CENTER:
395  {
396  nRelPosY += (nAlignAreaHeight / 2) - (nObjHeight / 2);
397  }
398  break;
399  case text::VertOrientation::BOTTOM:
400  {
401  nRelPosY += nAlignAreaHeight -
402  ( nObjHeight + ( aRectFnSet.IsVert()
403  ? ( aRectFnSet.IsVertL2R()
404  ? _rLRSpacing.GetRight()
405  : _rLRSpacing.GetLeft() )
406  : _rULSpacing.GetLower() ) );
407  }
408  break;
409  default:
410  {
411  OSL_FAIL( "<SwAnchoredObjectPosition::GetVertRelPos(..) - invalid vertical positioning" );
412  }
413  }
414 
415  // #i26791#
416  _roVertOffsetToFrameAnchorPos = nAlignAreaOffset;
417 
418  return nRelPosY;
419 }
420 
431  const bool bVert,
432  const bool bVertL2R,
433  const SwFrame& rPageAlignLayFrame,
434  const SwTwips nProposedRelPosY,
435  const bool bFollowTextFlow,
436  const bool bCheckBottom ) const
437 {
438  SwTwips nAdjustedRelPosY = nProposedRelPosY;
439  // TODO: Replace the following condition with the correction
440  // of the implementation of option FollowTextFlow.
442  !(GetAnchorFrame().IsInTab() && DoesObjFollowsTextFlow()) )
443  {
444  return nAdjustedRelPosY;
445  }
446 
447  const Size aObjSize(GetAnchoredObj().GetObjRect().SSize());
448  // determine the area of 'page' alignment frame, to which the vertical
449  // position is restricted.
450  // #i28701# - Extend restricted area for the vertical
451  // position to area of the page frame, if wrapping style influence is
452  // considered on object positioning. Needed to avoid layout loops in the
453  // object positioning algorithm considering the wrapping style influence
454  // caused by objects, which follow the text flow and thus are restricted
455  // to its environment (e.g. page header/footer).
456  SwRect aPgAlignArea;
457  {
458  // #i26945# - no extension of restricted area, if
459  // object's attribute follow text flow is set and its inside a table
460  if ( GetFrameFormat().getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) &&
461  ( !bFollowTextFlow ||
462  !GetAnchoredObj().GetAnchorFrame()->IsInTab() ) )
463  {
464  aPgAlignArea = rPageAlignLayFrame.FindPageFrame()->getFrameArea();
465  }
466  else
467  {
468  aPgAlignArea = rPageAlignLayFrame.getFrameArea();
469  }
470  }
471 
472  if ( bVert )
473  {
474  // #i31805# - consider value of <_bCheckBottom>
475  if ( !bVertL2R )
476  {
477  if ( bCheckBottom &&
478  nTopOfAnch - nAdjustedRelPosY - aObjSize.Width() <
479  aPgAlignArea.Left() )
480  {
481  nAdjustedRelPosY = aPgAlignArea.Left() +
482  nTopOfAnch -
483  aObjSize.Width();
484  }
485  // #i32964# - correction
486  if ( nTopOfAnch - nAdjustedRelPosY > aPgAlignArea.Right() )
487  {
488  nAdjustedRelPosY = nTopOfAnch - aPgAlignArea.Right();
489  }
490  }
491  else
492  {
493  // tdf#112443 if position is completely off-page
494  // return the proposed position and do not adjust it...
495  // tdf#120839 .. unless anchored to char (anchor can jump on other page)
497  if ( bDisablePositioning && !IsAnchoredToChar() && nTopOfAnch + nAdjustedRelPosY > aPgAlignArea.Right() )
498  {
499  return nProposedRelPosY;
500  }
501 
502  if ( bCheckBottom &&
503  nTopOfAnch + nAdjustedRelPosY + aObjSize.Width() >
504  aPgAlignArea.Right() )
505  {
506  nAdjustedRelPosY = aPgAlignArea.Right() -
507  nTopOfAnch -
508  aObjSize.Width();
509  }
510  if ( nTopOfAnch + nAdjustedRelPosY < aPgAlignArea.Left() )
511  {
512  nAdjustedRelPosY = aPgAlignArea.Left() - nTopOfAnch;
513  }
514  }
515  }
516  else
517  {
518  // tdf#112443 if position is completely off-page
519  // return the proposed position and do not adjust it...
521 
522  // tdf#123002 disable the positioning in header and footer only
523  // we should limit this since anchors of body frames may appear on other pages
524  const bool bIsFooterOrHeader = GetAnchorFrame().GetUpper()
526 
527  if ( bDisablePositioning && bIsFooterOrHeader && nTopOfAnch + nAdjustedRelPosY > aPgAlignArea.Bottom() )
528  {
529  return nProposedRelPosY;
530  }
531 
532  // #i31805# - consider value of <bCheckBottom>
533  if ( bCheckBottom &&
534  nTopOfAnch + nAdjustedRelPosY + aObjSize.Height() >
535  aPgAlignArea.Top() + aPgAlignArea.Height() )
536  {
537  nAdjustedRelPosY = aPgAlignArea.Top() + aPgAlignArea.Height() -
538  nTopOfAnch -
539  aObjSize.Height();
540  }
541  if ( nTopOfAnch + nAdjustedRelPosY < aPgAlignArea.Top() )
542  {
543  nAdjustedRelPosY = aPgAlignArea.Top() - nTopOfAnch;
544  }
545  }
546  return nAdjustedRelPosY;
547 }
548 
555  const SwFrame& _rPageAlignLayFrame,
556  const SwTwips _nProposedRelPosX ) const
557 {
558  SwTwips nAdjustedRelPosX = _nProposedRelPosX;
559 
561  return nAdjustedRelPosX;
562 
563  const SwFrame& rAnchorFrame = GetAnchorFrame();
564  const bool bVert = rAnchorFrame.IsVertical();
565 
566  const Size aObjSize( GetAnchoredObj().GetObjRect().SSize() );
567 
568  if( bVert )
569  {
570  if ( rAnchorFrame.getFrameArea().Top() + nAdjustedRelPosX + aObjSize.Height() >
571  _rPageAlignLayFrame.getFrameArea().Bottom() )
572  {
573  nAdjustedRelPosX = _rPageAlignLayFrame.getFrameArea().Bottom() -
574  rAnchorFrame.getFrameArea().Top() -
575  aObjSize.Height();
576  }
577  if ( rAnchorFrame.getFrameArea().Top() + nAdjustedRelPosX <
578  _rPageAlignLayFrame.getFrameArea().Top() )
579  {
580  nAdjustedRelPosX = _rPageAlignLayFrame.getFrameArea().Top() -
581  rAnchorFrame.getFrameArea().Top();
582  }
583  }
584  else
585  {
586  if ( rAnchorFrame.getFrameArea().Left() + nAdjustedRelPosX + aObjSize.Width() >
587  _rPageAlignLayFrame.getFrameArea().Right() )
588  {
589  nAdjustedRelPosX = _rPageAlignLayFrame.getFrameArea().Right() -
590  rAnchorFrame.getFrameArea().Left() -
591  aObjSize.Width();
592  }
593  if ( rAnchorFrame.getFrameArea().Left() + nAdjustedRelPosX <
594  _rPageAlignLayFrame.getFrameArea().Left() )
595  {
596  nAdjustedRelPosX = _rPageAlignLayFrame.getFrameArea().Left() -
597  rAnchorFrame.getFrameArea().Left();
598  }
599  }
600 
601  return nAdjustedRelPosX;
602 }
603 
606  const SwFrame& _rPageAlignLayFrame,
607  const sal_Int16 _eRelOrient,
608  const bool _bObjWrapThrough,
609  SwTwips& _orAlignAreaWidth,
610  SwTwips& _orAlignAreaOffset,
611  bool& _obAlignedRelToPage ) const
612 {
613  SwTwips nWidth = 0;
614  SwTwips nOffset = 0;
615  SwRectFnSet aRectFnSet(&_rHoriOrientFrame);
616  switch ( _eRelOrient )
617  {
618  case text::RelOrientation::PRINT_AREA:
619  {
620  nWidth = aRectFnSet.GetWidth(_rHoriOrientFrame.getFramePrintArea());
621  nOffset = aRectFnSet.GetLeftMargin(_rHoriOrientFrame);
622  if ( _rHoriOrientFrame.IsTextFrame() )
623  {
624  // consider movement of text frame left
625  nOffset += static_cast<const SwTextFrame&>(_rHoriOrientFrame).GetBaseOffsetForFly( !_bObjWrapThrough );
626  }
627  else if ( _rHoriOrientFrame.IsPageFrame() && aRectFnSet.IsVert() )
628  {
629  // for to-page anchored objects, consider header/footer frame
630  // in vertical layout
631  const SwFrame* pPrtFrame =
632  static_cast<const SwPageFrame&>(_rHoriOrientFrame).Lower();
633  while( pPrtFrame )
634  {
635  if( pPrtFrame->IsHeaderFrame() )
636  {
637  nWidth -= pPrtFrame->getFrameArea().Height();
638  nOffset += pPrtFrame->getFrameArea().Height();
639  }
640  else if( pPrtFrame->IsFooterFrame() )
641  {
642  nWidth -= pPrtFrame->getFrameArea().Height();
643  }
644  pPrtFrame = pPrtFrame->GetNext();
645  }
646  }
647  break;
648  }
649  case text::RelOrientation::PAGE_LEFT:
650  {
651  // align at left border of page frame/fly frame/cell frame
652  nWidth = aRectFnSet.GetLeftMargin(_rPageAlignLayFrame);
653  nOffset = aRectFnSet.XDiff(
654  aRectFnSet.GetLeft(_rPageAlignLayFrame.getFrameArea()),
655  aRectFnSet.GetLeft(_rHoriOrientFrame.getFrameArea()) );
656  _obAlignedRelToPage = true;
657  }
658  break;
659  case text::RelOrientation::PAGE_RIGHT:
660  {
661  // align at right border of page frame/fly frame/cell frame
662  nWidth = aRectFnSet.GetRightMargin(_rPageAlignLayFrame);
663  nOffset = aRectFnSet.XDiff(
664  aRectFnSet.GetPrtRight(_rPageAlignLayFrame),
665  aRectFnSet.GetLeft(_rHoriOrientFrame.getFrameArea()) );
666  _obAlignedRelToPage = true;
667  }
668  break;
669  case text::RelOrientation::FRAME_LEFT:
670  {
671  // align at left border of anchor frame
672  nWidth = aRectFnSet.GetLeftMargin(_rHoriOrientFrame);
673  nOffset = 0;
674  }
675  break;
676  case text::RelOrientation::FRAME_RIGHT:
677  {
678  // align at right border of anchor frame
679  // Unify and simplify
680  nWidth = aRectFnSet.GetRightMargin(_rHoriOrientFrame);
681  nOffset = aRectFnSet.GetRight(_rHoriOrientFrame.getFramePrintArea());
682  }
683  break;
684  case text::RelOrientation::CHAR:
685  {
686  // alignment relative to character - assure, that corresponding
687  // character rectangle is set.
688  if ( IsAnchoredToChar() )
689  {
690  nWidth = 0;
691  nOffset = aRectFnSet.XDiff(
692  aRectFnSet.GetLeft(*ToCharRect()),
693  aRectFnSet.GetLeft(ToCharOrientFrame()->getFrameArea()) );
694  break;
695  }
696  [[fallthrough]];
697  }
698  case text::RelOrientation::PAGE_PRINT_AREA:
699  {
700  nWidth = aRectFnSet.GetWidth(_rPageAlignLayFrame.getFramePrintArea());
701  nOffset = aRectFnSet.XDiff(
702  aRectFnSet.GetPrtLeft(_rPageAlignLayFrame),
703  aRectFnSet.GetLeft(_rHoriOrientFrame.getFrameArea()) );
704  if ( _rHoriOrientFrame.IsPageFrame() && aRectFnSet.IsVert() )
705  {
706  // for to-page anchored objects, consider header/footer frame
707  // in vertical layout
708  const SwFrame* pPrtFrame =
709  static_cast<const SwPageFrame&>(_rHoriOrientFrame).Lower();
710  while( pPrtFrame )
711  {
712  if( pPrtFrame->IsHeaderFrame() )
713  {
714  nWidth -= pPrtFrame->getFrameArea().Height();
715  nOffset += pPrtFrame->getFrameArea().Height();
716  }
717  else if( pPrtFrame->IsFooterFrame() )
718  {
719  nWidth -= pPrtFrame->getFrameArea().Height();
720  }
721  pPrtFrame = pPrtFrame->GetNext();
722  }
723  }
724  _obAlignedRelToPage = true;
725  break;
726  }
727  case text::RelOrientation::PAGE_FRAME:
728  {
729  nWidth = aRectFnSet.GetWidth(_rPageAlignLayFrame.getFrameArea());
730  nOffset = aRectFnSet.XDiff(
731  aRectFnSet.GetLeft(_rPageAlignLayFrame.getFrameArea()),
732  aRectFnSet.GetLeft(_rHoriOrientFrame.getFrameArea()) );
733  _obAlignedRelToPage = true;
734  break;
735  }
736  default:
737  {
738  nWidth = aRectFnSet.GetWidth(_rHoriOrientFrame.getFrameArea());
739 
740  bool bWrapThrough = _bObjWrapThrough;
741  // If the frame format is a TextBox of a draw shape, then use the
742  // surround of the original shape.
744 
745  bool bIgnoreFlysAnchoredAtFrame = !bWrapThrough;
746  nOffset = _rHoriOrientFrame.IsTextFrame() ?
747  static_cast<const SwTextFrame&>(_rHoriOrientFrame).GetBaseOffsetForFly( bIgnoreFlysAnchoredAtFrame ) :
748  0;
749  break;
750  }
751  }
752 
753  _orAlignAreaWidth = nWidth;
754  _orAlignAreaOffset = nOffset;
755 }
756 
759  const bool _bToggleLeftRight,
760  sal_Int16& _ioeHoriOrient,
761  sal_Int16& _iopeRelOrient
762  )
763 {
764  if( !_bToggleLeftRight )
765  return;
766 
767  // toggle orientation
768  switch ( _ioeHoriOrient )
769  {
770  case text::HoriOrientation::RIGHT :
771  {
772  _ioeHoriOrient = text::HoriOrientation::LEFT;
773  }
774  break;
775  case text::HoriOrientation::LEFT :
776  {
777  _ioeHoriOrient = text::HoriOrientation::RIGHT;
778  }
779  break;
780  default:
781  break;
782  }
783 
784  // toggle relative alignment
785  switch ( _iopeRelOrient )
786  {
787  case text::RelOrientation::PAGE_RIGHT :
788  {
789  _iopeRelOrient = text::RelOrientation::PAGE_LEFT;
790  }
791  break;
792  case text::RelOrientation::PAGE_LEFT :
793  {
794  _iopeRelOrient = text::RelOrientation::PAGE_RIGHT;
795  }
796  break;
797  case text::RelOrientation::FRAME_RIGHT :
798  {
799  _iopeRelOrient = text::RelOrientation::FRAME_LEFT;
800  }
801  break;
802  case text::RelOrientation::FRAME_LEFT :
803  {
804  _iopeRelOrient = text::RelOrientation::FRAME_RIGHT;
805  }
806  break;
807  default:
808  break;
809  }
810 }
811 
814  const SwFrame& _rHoriOrientFrame,
815  const SwEnvironmentOfAnchoredObject& _rEnvOfObj,
816  const SwFormatHoriOrient& _rHoriOrient,
817  const SvxLRSpaceItem& _rLRSpacing,
818  const SvxULSpaceItem& _rULSpacing,
819  const bool _bObjWrapThrough,
820  const SwTwips _nRelPosY,
821  SwTwips& _roHoriOffsetToFrameAnchorPos
822  ) const
823 {
824  // determine 'page' alignment layout frame
825  const SwFrame& rPageAlignLayFrame =
826  _rEnvOfObj.GetHoriEnvironmentLayoutFrame( _rHoriOrientFrame );
827 
828  const bool bEvenPage = !rPageAlignLayFrame.OnRightPage();
829  const bool bToggle = _rHoriOrient.IsPosToggle() && bEvenPage;
830 
831  // determine orientation and relative alignment
832  sal_Int16 eHoriOrient = _rHoriOrient.GetHoriOrient();
833  sal_Int16 eRelOrient = _rHoriOrient.GetRelationOrient();
834  // toggle orientation and relative alignment
835  ToggleHoriOrientAndAlign( bToggle, eHoriOrient, eRelOrient );
836 
837  // determine alignment parameter
838  // <nWidth>: 'width' of alignment area
839  // <nOffset>: offset of alignment area, relative to 'left' of anchor frame
840  SwTwips nWidth = 0;
841  SwTwips nOffset = 0;
842  bool bAlignedRelToPage = false;
843  GetHoriAlignmentValues( _rHoriOrientFrame, rPageAlignLayFrame,
844  eRelOrient, _bObjWrapThrough,
845  nWidth, nOffset, bAlignedRelToPage );
846 
847  const SwFrame& rAnchorFrame = GetAnchorFrame();
848  SwRectFnSet aRectFnSet(&_rHoriOrientFrame);
849  SwTwips nObjWidth = aRectFnSet.GetWidth(GetAnchoredObj().GetObjRect());
850  SwTwips nRelPosX = nOffset;
851  if ( _rHoriOrient.GetHoriOrient() == text::HoriOrientation::NONE )
852  {
853  // 'manual' horizontal position
854  const bool bR2L = rAnchorFrame.IsRightToLeft();
855  if( IsAnchoredToChar() && text::RelOrientation::CHAR == eRelOrient )
856  {
857  if( bR2L )
858  nRelPosX -= _rHoriOrient.GetPos();
859  else
860  nRelPosX += _rHoriOrient.GetPos();
861  }
862  else if ( bToggle || ( !_rHoriOrient.IsPosToggle() && bR2L ) )
863  {
864  // Correction: consider <nOffset> also for
865  // toggling from left to right.
866  nRelPosX += nWidth - nObjWidth - _rHoriOrient.GetPos();
867  }
868  else
869  {
870  nRelPosX += _rHoriOrient.GetPos();
871  }
872  }
873  else if ( text::HoriOrientation::CENTER == eHoriOrient )
874  nRelPosX += (nWidth / 2) - (nObjWidth / 2);
875  else if ( text::HoriOrientation::RIGHT == eHoriOrient )
876  nRelPosX += nWidth -
877  ( nObjWidth +
878  ( aRectFnSet.IsVert() ? _rULSpacing.GetLower() : _rLRSpacing.GetRight() ) );
879  else
880  nRelPosX += aRectFnSet.IsVert() ? _rULSpacing.GetUpper() : _rLRSpacing.GetLeft();
881 
882  // adjust relative position by distance between anchor frame and
883  // the frame, the object is oriented at.
884  if ( &rAnchorFrame != &_rHoriOrientFrame )
885  {
886  SwTwips nLeftOrient = aRectFnSet.GetLeft(_rHoriOrientFrame.getFrameArea());
887  SwTwips nLeftAnchor = aRectFnSet.GetLeft(rAnchorFrame.getFrameArea());
888  nRelPosX += aRectFnSet.XDiff( nLeftOrient, nLeftAnchor );
889  }
890 
891  // adjust calculated relative horizontal position, in order to
892  // keep object inside 'page' alignment layout frame
893  const SwFrame& rEnvironmentLayFrame =
894  _rEnvOfObj.GetHoriEnvironmentLayoutFrame( _rHoriOrientFrame );
895  bool bFollowTextFlow = GetFrameFormat().GetFollowTextFlow().GetValue();
896  bool bWrapThrough = GetFrameFormat().GetSurround().GetSurround() != text::WrapTextMode_THROUGH;
897  // Don't try to keep wrap-though objects inside the cell, even if they are following text flow.
898  if (!rEnvironmentLayFrame.IsInTab() || !bFollowTextFlow || bWrapThrough)
899  {
900  nRelPosX = AdjustHoriRelPos( rEnvironmentLayFrame, nRelPosX );
901  }
902 
903  // if object is a Writer fly frame and it's anchored to a content and
904  // it is horizontal positioned left or right, but not relative to character,
905  // it has to be drawn aside another object, which have the same horizontal
906  // position and lay below it.
907  if ( dynamic_cast<const SwFlyFrame*>( &GetAnchoredObj() ) != nullptr &&
909  ( eHoriOrient == text::HoriOrientation::LEFT || eHoriOrient == text::HoriOrientation::RIGHT ) &&
910  eRelOrient != text::RelOrientation::CHAR )
911  {
912  nRelPosX = AdjustHoriRelPosForDrawAside( _rHoriOrientFrame,
913  nRelPosX, _nRelPosY,
914  eHoriOrient, eRelOrient,
915  _rLRSpacing, _rULSpacing,
916  bEvenPage );
917  }
918 
919  // #i26791#
920  _roHoriOffsetToFrameAnchorPos = nOffset;
921 
922  return nRelPosX;
923 }
924 
925 // method incl. helper methods for adjusting proposed horizontal position,
926 // if object has to draw aside another object.
931  const SwFrame& _rHoriOrientFrame,
932  const SwTwips _nProposedRelPosX,
933  const SwTwips _nRelPosY,
934  const sal_Int16 _eHoriOrient,
935  const sal_Int16 _eRelOrient,
936  const SvxLRSpaceItem& _rLRSpacing,
937  const SvxULSpaceItem& _rULSpacing,
938  const bool _bEvenPage
939  ) const
940 {
941  // #i26791#
942  if ( dynamic_cast<const SwTextFrame*>( &GetAnchorFrame() ) == nullptr ||
943  dynamic_cast<const SwFlyAtContentFrame*>( &GetAnchoredObj() ) == nullptr )
944  {
945  OSL_FAIL( "<SwAnchoredObjectPosition::AdjustHoriRelPosForDrawAside(..) - usage for wrong anchor type" );
946  return _nProposedRelPosX;
947  }
948 
949  const SwTextFrame& rAnchorTextFrame = static_cast<const SwTextFrame&>(GetAnchorFrame());
950  // #i26791#
951  const SwFlyAtContentFrame& rFlyAtContentFrame =
952  static_cast<const SwFlyAtContentFrame&>(GetAnchoredObj());
953  const SwRect aObjBoundRect( GetAnchoredObj().GetObjRect() );
954  SwRectFnSet aRectFnSet(&_rHoriOrientFrame);
955 
956  SwTwips nAdjustedRelPosX = _nProposedRelPosX;
957 
958  // determine proposed object bound rectangle
959  Point aTmpPos = aRectFnSet.GetPos(rAnchorTextFrame.getFrameArea());
960  if( aRectFnSet.IsVert() )
961  {
962  aTmpPos.AdjustX( -(_nRelPosY + aObjBoundRect.Width()) );
963  aTmpPos.AdjustY(nAdjustedRelPosX );
964  }
965  else
966  {
967  aTmpPos.AdjustX(nAdjustedRelPosX );
968  aTmpPos.AdjustY(_nRelPosY );
969  }
970  SwRect aTmpObjRect( aTmpPos, aObjBoundRect.SSize() );
971 
972  const sal_uInt32 nObjOrdNum = GetObject().GetOrdNum();
973  const SwPageFrame* pObjPage = rFlyAtContentFrame.FindPageFrame();
974  const SwFrame* pObjContext = ::FindContext( &rAnchorTextFrame, SwFrameType::Column );
975  sal_uLong nObjIndex = rAnchorTextFrame.GetTextNodeFirst()->GetIndex();
976  SwOrderIter aIter( pObjPage );
977  const SwFlyFrame* pFly = static_cast<const SwVirtFlyDrawObj*>(aIter.Bottom())->GetFlyFrame();
978  while ( pFly && nObjOrdNum > pFly->GetVirtDrawObj()->GetOrdNumDirect() )
979  {
980  if ( DrawAsideFly( pFly, aTmpObjRect, pObjContext, nObjIndex,
981  _bEvenPage, _eHoriOrient, _eRelOrient ) )
982  {
983  if( aRectFnSet.IsVert() )
984  {
985  const SvxULSpaceItem& rOtherUL = pFly->GetFormat()->GetULSpace();
986  const SwTwips nOtherTop = pFly->getFrameArea().Top() - rOtherUL.GetUpper();
987  const SwTwips nOtherBot = pFly->getFrameArea().Bottom() + rOtherUL.GetLower();
988  if ( nOtherTop <= aTmpObjRect.Bottom() + _rULSpacing.GetLower() &&
989  nOtherBot >= aTmpObjRect.Top() - _rULSpacing.GetUpper() )
990  {
991  if ( _eHoriOrient == text::HoriOrientation::LEFT )
992  {
993  SwTwips nTmp = nOtherBot + 1 + _rULSpacing.GetUpper() -
994  rAnchorTextFrame.getFrameArea().Top();
995  if ( nTmp > nAdjustedRelPosX &&
996  rAnchorTextFrame.getFrameArea().Top() + nTmp +
997  aObjBoundRect.Height() + _rULSpacing.GetLower()
998  <= pObjPage->getFrameArea().Height() + pObjPage->getFrameArea().Top() )
999  {
1000  nAdjustedRelPosX = nTmp;
1001  }
1002  }
1003  else if ( _eHoriOrient == text::HoriOrientation::RIGHT )
1004  {
1005  SwTwips nTmp = nOtherTop - 1 - _rULSpacing.GetLower() -
1006  aObjBoundRect.Height() -
1007  rAnchorTextFrame.getFrameArea().Top();
1008  if ( nTmp < nAdjustedRelPosX &&
1009  rAnchorTextFrame.getFrameArea().Top() + nTmp - _rULSpacing.GetUpper()
1010  >= pObjPage->getFrameArea().Top() )
1011  {
1012  nAdjustedRelPosX = nTmp;
1013  }
1014  }
1015  aTmpObjRect.Pos().setY( rAnchorTextFrame.getFrameArea().Top() +
1016  nAdjustedRelPosX );
1017  }
1018  }
1019  else
1020  {
1021  const SvxLRSpaceItem& rOtherLR = pFly->GetFormat()->GetLRSpace();
1022  const SwTwips nOtherLeft = pFly->getFrameArea().Left() - rOtherLR.GetLeft();
1023  const SwTwips nOtherRight = pFly->getFrameArea().Right() + rOtherLR.GetRight();
1024  if( nOtherLeft <= aTmpObjRect.Right() + _rLRSpacing.GetRight() &&
1025  nOtherRight >= aTmpObjRect.Left() - _rLRSpacing.GetLeft() )
1026  {
1027  if ( _eHoriOrient == text::HoriOrientation::LEFT )
1028  {
1029  SwTwips nTmp = nOtherRight + 1 + _rLRSpacing.GetLeft() -
1030  rAnchorTextFrame.getFrameArea().Left();
1031  if ( nTmp > nAdjustedRelPosX &&
1032  rAnchorTextFrame.getFrameArea().Left() + nTmp +
1033  aObjBoundRect.Width() + _rLRSpacing.GetRight()
1034  <= pObjPage->getFrameArea().Width() + pObjPage->getFrameArea().Left() )
1035  {
1036  nAdjustedRelPosX = nTmp;
1037  }
1038  }
1039  else if ( _eHoriOrient == text::HoriOrientation::RIGHT )
1040  {
1041  SwTwips nTmp = nOtherLeft - 1 - _rLRSpacing.GetRight() -
1042  aObjBoundRect.Width() -
1043  rAnchorTextFrame.getFrameArea().Left();
1044  if ( nTmp < nAdjustedRelPosX &&
1045  rAnchorTextFrame.getFrameArea().Left() + nTmp - _rLRSpacing.GetLeft()
1046  >= pObjPage->getFrameArea().Left() )
1047  {
1048  nAdjustedRelPosX = nTmp;
1049  }
1050  }
1051  aTmpObjRect.Pos().setX( rAnchorTextFrame.getFrameArea().Left() +
1052  nAdjustedRelPosX );
1053  }
1054  } // end of <if (bVert)>
1055  } // end of <if DrawAsideFly(..)>
1056 
1057  pFly = static_cast<const SwVirtFlyDrawObj*>(aIter.Next())->GetFlyFrame();
1058  } // end of <loop on fly frames
1059 
1060  return nAdjustedRelPosX;
1061 }
1062 
1068  const SwRect& _rObjRect,
1069  const SwFrame* _pObjContext,
1070  const sal_uLong _nObjIndex,
1071  const bool _bEvenPage,
1072  const sal_Int16 _eHoriOrient,
1073  const sal_Int16 _eRelOrient
1074  ) const
1075 {
1076  bool bRetVal = false;
1077 
1078  SwRectFnSet aRectFnSet(&GetAnchorFrame());
1079 
1080  if ( _pFly->IsFlyAtContentFrame() &&
1081  aRectFnSet.BottomDist( _pFly->getFrameArea(), aRectFnSet.GetTop(_rObjRect) ) < 0 &&
1082  aRectFnSet.BottomDist( _rObjRect, aRectFnSet.GetTop(_pFly->getFrameArea()) ) < 0 &&
1083  ::FindContext( _pFly->GetAnchorFrame(), SwFrameType::Column ) == _pObjContext )
1084  {
1085  sal_uLong nOtherIndex =
1086  static_cast<const SwTextFrame*>(_pFly->GetAnchorFrame())->GetTextNodeFirst()->GetIndex();
1087  if (sw::FrameContainsNode(static_cast<SwTextFrame const&>(*_pFly->GetAnchorFrame()), _nObjIndex)
1088  || nOtherIndex < _nObjIndex)
1089  {
1090  const SwFormatHoriOrient& rHori = _pFly->GetFormat()->GetHoriOrient();
1091  sal_Int16 eOtherRelOrient = rHori.GetRelationOrient();
1092  if( text::RelOrientation::CHAR != eOtherRelOrient )
1093  {
1094  sal_Int16 eOtherHoriOrient = rHori.GetHoriOrient();
1095  ToggleHoriOrientAndAlign( _bEvenPage && rHori.IsPosToggle(),
1096  eOtherHoriOrient,
1097  eOtherRelOrient );
1098  if ( eOtherHoriOrient == _eHoriOrient &&
1099  Minor_( _eRelOrient, eOtherRelOrient, text::HoriOrientation::LEFT == _eHoriOrient ) )
1100  {
1101  bRetVal = true;
1102  }
1103  }
1104  }
1105  }
1106 
1107  return bRetVal;
1108 }
1109 
1119 bool SwAnchoredObjectPosition::Minor_( sal_Int16 _eRelOrient1,
1120  sal_Int16 _eRelOrient2,
1121  bool _bLeft )
1122 {
1123  bool bRetVal;
1124 
1125  // draw aside order for left horizontal position
1127  static sal_uInt16 const aLeft[ 10 ] =
1128  { 5, 6, 0, 1, 8, 4, 7, 2, 3, 9 };
1129  // draw aside order for right horizontal position
1131  static sal_uInt16 const aRight[ 10 ] =
1132  { 5, 6, 0, 8, 1, 7, 4, 2, 3, 9 };
1133 
1134  // decide depending on given order, which frame has to draw aside another frame
1135  if( _bLeft )
1136  bRetVal = aLeft[ _eRelOrient1 ] >= aLeft[ _eRelOrient2 ];
1137  else
1138  bRetVal = aRight[ _eRelOrient1 ] >= aRight[ _eRelOrient2 ];
1139 
1140  return bRetVal;
1141 }
1142 
1143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GetValue() const
SwTwips ImplAdjustHoriRelPos(const SwFrame &_rPageAlignLayFrame, const SwTwips _nProposedRelPosX) const
adjust calculated horizontal in order to keep object inside 'page' alignment layout frame...
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2771
Base class of the Writer layout elements.
Definition: frame.hxx:298
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:151
void GetInfoAboutObj()
determine information about object
tools::Long GetRight(const SwRect &rRect) const
Definition: frame.hxx:1361
const SdrObject * Next()
Definition: frmtool.cxx:2624
SwTwips GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
Definition: txtfrm.cxx:4004
sal_uLong GetIndex() const
Definition: node.hxx:290
void Right(const tools::Long nRight)
Definition: swrect.hxx:200
Point GetPos(const SwRect &rRect) const
Definition: frame.hxx:1364
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2860
tools::Long GetPrtRight(const SwFrame &rFrame) const
Definition: frame.hxx:1393
const SwFrame * FindContext(const SwFrame *pFrame, SwFrameType nAdditionalContextTyp)
provides the area of a frame in that no Fly from another area can overlap
Definition: frmtool.cxx:3510
sal_uInt16 GetLower() const
tools::Long BottomDist(const SwRect &rRect, tools::Long nPos) const
Definition: frame.hxx:1395
tools::Long GetLeftMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1386
SwTwips AdjustHoriRelPosForDrawAside(const SwFrame &_rHoriOrientFrame, const SwTwips _nProposedRelPosX, const SwTwips _nRelPosY, const sal_Int16 _eHoriOrient, const sal_Int16 _eRelOrient, const SvxLRSpaceItem &_rLRSpacing, const SvxULSpaceItem &_rULSpacing, const bool _bEvenPage) const
adjust calculated horizontal position in order to draw object aside other objects with same positioni...
void Left(const tools::Long nLeft)
Definition: swrect.hxx:195
SwRectFn FnRect() const
Definition: frame.hxx:1350
SwTwips GetPos() const
Definition: fmtornt.hxx:92
sal_uIntPtr sal_uLong
tools::Long GetRight() const
const SwRect & getFramePrintArea() const
Definition: frame.hxx:179
bool IsVert() const
Definition: frame.hxx:1348
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
tools::Long GetWidth(const SwRect &rRect) const
Definition: frame.hxx:1362
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:171
static void ToggleHoriOrientAndAlign(const bool _bToggleLeftRight, sal_Int16 &_ioeHoriOrient, sal_Int16 &_iopeRelOrient)
toggle given horizontal orientation and relative alignment
bool IsFlyAtContentFrame() const
Definition: flyfrm.hxx:197
tools::Long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1358
SwTwips ImplAdjustVertRelPos(const SwTwips nTopOfAnch, const bool bVert, const bool bVertL2R, const SwFrame &rPageAlignLayFrame, const SwTwips nProposedRelPosY, const bool bFollowTextFlow, const bool bCheckBottom) const
adjust calculated vertical in order to keep object inside 'page' alignment layout frame...
const SwRect & getFrameArea() const
Definition: frame.hxx:178
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool IsInTab() const
Definition: frame.hxx:936
const SwLayoutFrame & GetHoriEnvironmentLayoutFrame(const SwFrame &_rHoriOrientFrame) const
determine environment layout frame for possible horizontal object positions respectively for alignmen...
bool DrawAsideFly(const SwFlyFrame *_pFly, const SwRect &_rObjRect, const SwFrame *_pObjContext, const sal_uLong _nObjIndex, const bool _bEvenPage, const sal_Int16 _eHoriOrient, const sal_Int16 _eRelOrient) const
determine, if object has to draw aside given fly frame
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
bool IsTextFrame() const
Definition: frame.hxx:1215
tools::Long GetPrtLeft(const SwFrame &rFrame) const
Definition: frame.hxx:1392
void Width(tools::Long nNew)
Definition: swrect.hxx:187
bool OnRightPage() const
Definition: frame.hxx:716
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
SwFrameFormat * FindFrameFormat(SdrObject *pObj)
The Get reverse way: seeks the format to the specified object.
Definition: dcontact.cxx:120
tools::Long GetLeft(const SwRect &rRect) const
Definition: frame.hxx:1360
static bool IsDraggingOffPageAllowed(const SwFrameFormat *)
method to determine if dragging objects off page is allowed
SwTwips GetVertRelPos(const SwFrame &_rVertOrientFrame, const SwFrame &_rPageAlignLayFrame, const sal_Int16 _eVertOrient, const sal_Int16 _eRelOrient, const SwTwips _nVertPos, const SvxLRSpaceItem &_rLRSpacing, const SvxULSpaceItem &_rULSpacing, SwTwips &_roVertOffsetToFrameAnchorPos) const
SwFrame * AnchorFrame()
sal_uInt32 GetOrdNumDirect() const
tools::Long XDiff(tools::Long n1, tools::Long n2) const
Definition: frame.hxx:1403
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:448
bool FrameContainsNode(SwContentFrame const &rFrame, sal_uLong nNodeIndex)
Definition: txtfrm.cxx:284
const SwFormatFollowTextFlow & GetFollowTextFlow(bool=true) const
static bool Minor_(sal_Int16 _eRelOrient1, sal_Int16 _eRelOrient2, bool _bLeft)
determine, if object has to draw aside another object
tools::Long GetPrtBottom(const SwFrame &rFrame) const
Definition: frame.hxx:1391
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
SwPageFrame * FindPageFrame()
Definition: frame.hxx:663
tools::Long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1363
SwTwips CalcRelPosX(const SwFrame &_rHoriOrientFrame, const SwEnvironmentOfAnchoredObject &_rEnvOfObj, const SwFormatHoriOrient &_rHoriOrient, const SvxLRSpaceItem &_rLRSpacing, const SvxULSpaceItem &_rULSpacing, const bool _bObjWrapThrough, const SwTwips _nRelPosY, SwTwips &_roHoriOffsetToFrameAnchorPos) const
calculate relative horizontal position
tools::Long GetLeft() const
const SwFrame * mpAnchorFrame
SwLayoutFrame * GetUpper()
Definition: frame.hxx:661
tools::Long Width() const
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
SwTwips GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() const
method to determine the upper space amount, which is considered for the previous frame and the page g...
Definition: flowfrm.cxx:1668
sal_uInt32 GetOrdNum() const
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
void GetHoriAlignmentValues(const SwFrame &_rHoriOrientFrame, const SwFrame &_rPageAlignLayFrame, const sal_Int16 _eRelOrient, const bool _bObjWrapThrough, SwTwips &_orAlignAreaWidth, SwTwips &_orAlignAreaOffset, bool &_obAlignedRelToPage) const
determine alignment values for horizontal position of object
tools::Long GetTopMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1384
tools::Long YDiff(tools::Long n1, tools::Long n2) const
Definition: frame.hxx:1404
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:736
tools::Long GetRightMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1387
void SSize(const Size &rNew)
Definition: swrect.hxx:178
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const =0
A page of the document layout.
Definition: pagefrm.hxx:41
tools::Long SwTwips
Definition: swtypes.hxx:49
virtual const SwFrame * ToCharOrientFrame() const
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:209
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
bool IsPosToggle() const
Definition: fmtornt.hxx:95
SwTwips AdjustHoriRelPos(const SwFrame &_rPageAlignLayFrame, const SwTwips _nProposedRelPosX) const
adjust calculated horizontal in order to keep object inside 'page' alignment layout frame for object ...
tools::Long GetBottomMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1385
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
virtual SwFrameFormat & GetFrameFormat()=0
bool IsRightToLeft() const
Definition: frame.hxx:968
void Top(const tools::Long nTop)
Definition: swrect.hxx:204
tools::Long Height() const
bool IsVertL2R() const
Definition: frame.hxx:1349
bool IsPageFrame() const
Definition: frame.hxx:1159
void GetVertAlignmentValues(const SwFrame &_rVertOrientFrame, const SwFrame &_rPageAlignLayFrame, const sal_Int16 _eRelOrient, SwTwips &_orAlignAreaHeight, SwTwips &_orAlignAreaOffset) const
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
SwTwips GetTopForObjPos(const SwFrame &_rFrame, const SwRectFn &_fnRect, const bool _bVert) const
helper method to determine top of a frame for the vertical object positioning
bool IsVertical() const
Definition: frame.hxx:954
const SwFrame * GetAnchorFrame() const
void Height(tools::Long nNew)
Definition: swrect.hxx:191
bool ObjAnchoredAtPara() const
Definition: dcontact.hxx:148
bool IsFooterFrame() const
Definition: frame.hxx:1175
bool ObjAnchoredAtChar() const
Definition: dcontact.hxx:149
const SdrObject * Bottom()
Definition: frmtool.cxx:2597
sal_uInt16 GetUpper() const
bool IsHeaderFrame() const
Definition: frame.hxx:1171
SwRectGet fnGetTop
Definition: frame.hxx:1272
static void getShapeWrapThrough(const SwFrameFormat *pTextBox, bool &rWrapThrough)
If pTextBox is a textbox, then set rWrapThrough to the surround of its shape.
SwFrame * GetNext()
Definition: frame.hxx:659
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74