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