LibreOffice Module sw (master)  1
tocntntanchoredobjectposition.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 
21 #include <anchoredobject.hxx>
22 #include <frame.hxx>
23 #include <txtfrm.hxx>
24 #include <pagefrm.hxx>
25 #include <sectfrm.hxx>
26 #include <tabfrm.hxx>
27 #include <rootfrm.hxx>
28 #include <viewopt.hxx>
29 #include <viewsh.hxx>
30 #include <frmfmt.hxx>
32 #include <fmtsrnd.hxx>
33 #include <fmtfsize.hxx>
34 #include <fmtanchr.hxx>
35 #include <fmtornt.hxx>
36 #include <editeng/lrspitem.hxx>
37 #include <editeng/ulspitem.hxx>
38 #include <svx/svdobj.hxx>
39 #include <pam.hxx>
41 #include <frmatr.hxx>
42 #include <frmtool.hxx>
43 #include <ndtxt.hxx>
44 #include <dflyobj.hxx>
45 
46 using namespace objectpositioning;
47 using namespace ::com::sun::star;
48 
50  : SwAnchoredObjectPosition ( _rDrawObj ),
51  mpVertPosOrientFrame( nullptr ),
52  // #i26791#
53  maOffsetToFrameAnchorPos( Point() ),
54  mbAnchorToChar ( false ),
55  mpToCharOrientFrame( nullptr ),
56  mpToCharRect( nullptr ),
57  // #i22341#
58  mnToCharTopOfLine( 0 )
59 {}
60 
62 {}
63 
65 {
66  return mbAnchorToChar;
67 }
68 
70 {
71  return mpToCharOrientFrame;
72 }
73 
75 {
76  return mpToCharRect;
77 }
78 
79 // #i22341#
81 {
82  return mnToCharTopOfLine;
83 }
84 
86 {
87  OSL_ENSURE( dynamic_cast<const SwTextFrame*>( &GetAnchorFrame()) != nullptr ,
88  "SwToContentAnchoredObjectPosition::GetAnchorTextFrame() - wrong anchor frame type" );
89 
90  return static_cast<SwTextFrame&>(GetAnchorFrame());
91 }
92 
93 // #i23512#
94 static bool lcl_DoesVertPosFits( const SwTwips _nRelPosY,
95  const SwTwips _nAvail,
96  const SwLayoutFrame* _pUpperOfOrientFrame,
97  const bool _bBrowse,
98  const bool _bGrowInTable,
99  SwLayoutFrame*& _orpLayoutFrameToGrow )
100 {
101  bool bVertPosFits = false;
102 
103  if ( _nRelPosY <= _nAvail )
104  {
105  bVertPosFits = true;
106  }
107  else if ( _bBrowse )
108  {
109  if ( _pUpperOfOrientFrame->IsInSct() )
110  {
111  SwSectionFrame* pSctFrame =
112  const_cast<SwSectionFrame*>(_pUpperOfOrientFrame->FindSctFrame());
113  bVertPosFits = pSctFrame->GetUpper()->Grow( _nRelPosY - _nAvail, true ) > 0;
114  // Note: do not provide a layout frame for a grow.
115  }
116  else
117  {
118  bVertPosFits = const_cast<SwLayoutFrame*>(_pUpperOfOrientFrame)->
119  Grow( _nRelPosY - _nAvail, true ) > 0;
120  if ( bVertPosFits )
121  _orpLayoutFrameToGrow = const_cast<SwLayoutFrame*>(_pUpperOfOrientFrame);
122  }
123  }
124  else if ( _pUpperOfOrientFrame->IsInTab() && _bGrowInTable )
125  {
126  // #i45085# - check, if upper frame would grow the
127  // excepted amount of twips.
128  const SwTwips nTwipsGrown = const_cast<SwLayoutFrame*>(_pUpperOfOrientFrame)->
129  Grow( _nRelPosY - _nAvail, true );
130  bVertPosFits = ( nTwipsGrown == ( _nRelPosY - _nAvail ) );
131  if ( bVertPosFits )
132  _orpLayoutFrameToGrow = const_cast<SwLayoutFrame*>(_pUpperOfOrientFrame);
133  }
134 
135  return bVertPosFits;
136 }
137 
139 {
140  // get format of object
141  const SwFrameFormat& rFrameFormat = GetFrameFormat();
142 
143  // declare and set <pFooter> to footer frame, if object is anchored
144  // at a frame belonging to the footer.
145  const SwFrame* pFooter = GetAnchorFrame().FindFooterOrHeader();
146  if ( pFooter && !pFooter->IsFooterFrame() )
147  pFooter = nullptr;
148 
149  // declare and set <bBrowse> to true, if document is in browser mode and
150  // object is anchored at the body, but not at frame belonging to a table.
151  bool bBrowse = GetAnchorFrame().IsInDocBody() && !GetAnchorFrame().IsInTab();
152  if( bBrowse )
153  {
155  if( !pSh || !pSh->GetViewOptions()->getBrowseMode() )
156  bBrowse = false;
157  }
158 
159  // determine left/right and its upper/lower spacing.
160  const SvxLRSpaceItem &rLR = rFrameFormat.GetLRSpace();
161  const SvxULSpaceItem &rUL = rFrameFormat.GetULSpace();
162 
163  // determine, if object has no surrounding.
164  const SwFormatSurround& rSurround = rFrameFormat.GetSurround();
165  const bool bNoSurround = rSurround.GetSurround() == css::text::WrapTextMode_NONE;
166  const bool bWrapThrough = rSurround.GetSurround() == css::text::WrapTextMode_THROUGH;
167 
168  // new class <SwEnvironmentOfAnchoredObject>
170 
171  // #i18732# - grow only, if object has to follow the text flow
172  const bool bGrow = DoesObjFollowsTextFlow() &&
173  ( !GetAnchorFrame().IsInTab() ||
174  !rFrameFormat.GetFrameSize().GetHeightPercent() );
175 
176  // get text frame the object is anchored at
177  const SwTextFrame& rAnchorTextFrame = GetAnchorTextFrame();
178  SwRectFnSet aRectFnSet(&rAnchorTextFrame);
179 
180  const SwRect aObjBoundRect( GetAnchoredObj().GetObjRect() );
181 
182  // local variable keeping the calculated relative position; initialized with
183  // current relative position.
184  // #i26791# - use new object instance of <SwAnchoredObject>
185  Point aRelPos( GetAnchoredObj().GetCurrRelPos() );
186 
187  SwTwips nRelDiff = 0;
188 
189  bool bMoveable = rAnchorTextFrame.IsMoveable();
190 
191  // determine frame the object position has to be oriented at.
192  const SwTextFrame* pOrientFrame = &rAnchorTextFrame;
193  const SwTextFrame* pAnchorFrameForVertPos = &rAnchorTextFrame;
194  {
195  // if object is at-character anchored, determine character-rectangle
196  // and frame, position has to be oriented at.
197  mbAnchorToChar = (RndStdIds::FLY_AT_CHAR == rFrameFormat.GetAnchor().GetAnchorId());
198  if ( mbAnchorToChar )
199  {
200  const SwFormatAnchor& rAnch = rFrameFormat.GetAnchor();
201  // #i26791# - use new object instance of <SwAnchoredObject>
202  // Due to table break algorithm the character
203  // rectangle can have no height. Thus, check also the width
204  if ( ( !GetAnchoredObj().GetLastCharRect().Height() &&
205  !GetAnchoredObj().GetLastCharRect().Width() ) ||
206  !GetAnchoredObj().GetLastTopOfLine() )
207  {
209  // Due to table break algorithm the character
210  // rectangle can have no height. Thus, check also the width
211  if ( ( !GetAnchoredObj().GetLastCharRect().Height() &&
212  !GetAnchoredObj().GetLastCharRect().Width() ) ||
213  !GetAnchoredObj().GetLastTopOfLine() )
214  {
215  // Get default for <mpVertPosOrientFrame>, if it's not set.
216  if ( !mpVertPosOrientFrame )
217  {
218  mpVertPosOrientFrame = rAnchorTextFrame.GetUpper();
219  }
220  return;
221  }
222  }
224  // #i22341# - get top of line, in which the anchor character is.
226  pOrientFrame = &(const_cast<SwTextFrame&>(rAnchorTextFrame).GetFrameAtOfst(
227  rAnchorTextFrame.MapModelToViewPos(*rAnch.GetContentAnchor())));
228  mpToCharOrientFrame = pOrientFrame;
229  }
230  }
231  aRectFnSet.Refresh(pOrientFrame);
232 
233  // determine vertical position
234  {
235 
236  // determine vertical positioning and alignment attributes
237  SwFormatVertOrient aVert( rFrameFormat.GetVertOrient() );
238 
239  // #i18732# - determine layout frame for vertical
240  // positions aligned to 'page areas'.
241  const SwLayoutFrame& rPageAlignLayFrame =
242  aEnvOfObj.GetVertEnvironmentLayoutFrame( *pOrientFrame );
243 
244  if ( aVert.GetVertOrient() != text::VertOrientation::NONE )
245  {
246  // #i18732# - adjustments for follow text flow or not
247  // AND vertical alignment at 'page areas'.
248  SwTwips nAlignAreaHeight;
249  SwTwips nAlignAreaOffset;
250  GetVertAlignmentValues( *pOrientFrame, rPageAlignLayFrame,
251  aVert.GetRelationOrient(),
252  nAlignAreaHeight, nAlignAreaOffset );
253 
254  // determine relative vertical position
255  SwTwips nRelPosY = nAlignAreaOffset;
256  const SwTwips nObjHeight = aRectFnSet.GetHeight(aObjBoundRect);
257  const SwTwips nUpperSpace = aRectFnSet.IsVert()
258  ? ( aRectFnSet.IsVertL2R()
259  ? rLR.GetLeft()
260  : rLR.GetRight() )
261  : rUL.GetUpper();
262  // --> OD 2009-08-31 #monglianlayout#
263  const SwTwips nLowerSpace = aRectFnSet.IsVert()
264  ? ( aRectFnSet.IsVertL2R()
265  ? rLR.GetLeft()
266  : rLR.GetRight() )
267  : rUL.GetLower();
268  switch ( aVert.GetVertOrient() )
269  {
270  case text::VertOrientation::CHAR_BOTTOM:
271  {
272  if ( mbAnchorToChar )
273  {
274  // bottom (to character anchored)
275  nRelPosY += nAlignAreaHeight + nUpperSpace;
276  if ( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() )
277  {
278  nRelPosY += nObjHeight;
279  }
280  break;
281  }
282  [[fallthrough]];
283  }
285  {
286  // #i22341# - special case for vertical
287  // alignment at top of line
288  if ( mbAnchorToChar &&
289  aVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE )
290  {
291  nRelPosY -= (nObjHeight + nLowerSpace);
292  }
293  else
294  {
295  nRelPosY += nUpperSpace;
296  }
297  }
298  break;
299  // #i22341#
300  case text::VertOrientation::LINE_TOP:
301  {
302  if ( mbAnchorToChar &&
303  aVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE )
304  {
305  nRelPosY -= (nObjHeight + nLowerSpace);
306  }
307  else
308  {
309  OSL_FAIL( "<SwToContentAnchoredObjectPosition::CalcPosition()> - unknown combination of vertical position and vertical alignment." );
310  }
311  }
312  break;
313  case text::VertOrientation::CENTER:
314  {
315  nRelPosY += (nAlignAreaHeight / 2) - (nObjHeight / 2);
316  }
317  break;
318  // #i22341#
319  case text::VertOrientation::LINE_CENTER:
320  {
321  if ( mbAnchorToChar &&
322  aVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE )
323  {
324  nRelPosY += (nAlignAreaHeight / 2) - (nObjHeight / 2);
325  }
326  else
327  {
328  OSL_FAIL( "<SwToContentAnchoredObjectPosition::CalcPosition()> - unknown combination of vertical position and vertical alignment." );
329  }
330  }
331  break;
333  {
334  if ( ( aVert.GetRelationOrient() == text::RelOrientation::FRAME ||
335  aVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA ) &&
336  bNoSurround )
337  {
338  // bottom (aligned to 'paragraph areas')
339  nRelPosY += nAlignAreaHeight + nUpperSpace;
340  }
341  else
342  {
343  // #i22341# - special case for vertical
344  // alignment at top of line
345  if ( mbAnchorToChar &&
346  aVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE )
347  {
348  nRelPosY += nUpperSpace;
349  }
350  else
351  {
352  nRelPosY += nAlignAreaHeight -
353  ( nObjHeight + nLowerSpace );
354  }
355  }
356  }
357  break;
358  // #i22341#
359  case text::VertOrientation::LINE_BOTTOM:
360  {
361  if ( mbAnchorToChar &&
362  aVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE )
363  {
364  nRelPosY += nUpperSpace;
365  }
366  else
367  {
368  OSL_FAIL( "<SwToContentAnchoredObjectPosition::CalcPosition()> - unknown combination of vertical position and vertical alignment." );
369  }
370  }
371  break;
372  default:
373  break;
374  }
375 
376  // adjust relative position by distance between anchor frame and
377  // the frame, the object is oriented at.
378  // #i28701# - correction: adjust relative position,
379  // only if the floating screen object has to follow the text flow.
380  if ( DoesObjFollowsTextFlow() && pOrientFrame != &rAnchorTextFrame )
381  {
382  // #i11860# - use new method <GetTopForObjPos>
383  // to get top of frame for object positioning.
384  const SwTwips nTopOfOrient = GetTopForObjPos( *pOrientFrame, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
385  nRelPosY += aRectFnSet.YDiff( nTopOfOrient,
386  GetTopForObjPos( rAnchorTextFrame, aRectFnSet.FnRect(), aRectFnSet.IsVert() ) );
387  }
388 
389  // #i42124# - capture object inside vertical
390  // layout environment.
391  {
392  const SwTwips nTopOfAnch =
393  GetTopForObjPos( *pOrientFrame, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
394  const SwLayoutFrame& rVertEnvironLayFrame =
396  *(pOrientFrame->GetUpper()) );
397  const bool bCheckBottom = !DoesObjFollowsTextFlow();
398  nRelPosY = AdjustVertRelPos( nTopOfAnch, aRectFnSet.IsVert(), aRectFnSet.IsVertL2R(),
399  rVertEnvironLayFrame, nRelPosY,
401  bCheckBottom );
402  }
403 
404  // keep calculated relative vertical position - needed for filters
405  // (including the xml-filter)
406  {
407  // determine position
408  SwTwips nAttrRelPosY = nRelPosY - nAlignAreaOffset;
409  // set
410  if ( nAttrRelPosY != aVert.GetPos() )
411  {
412  aVert.SetPos( nAttrRelPosY );
413  const_cast<SwFrameFormat&>(rFrameFormat).LockModify();
414  const_cast<SwFrameFormat&>(rFrameFormat).SetFormatAttr( aVert );
415  const_cast<SwFrameFormat&>(rFrameFormat).UnlockModify();
416  }
417  }
418 
419  // determine absolute 'vertical' position, depending on layout-direction
420  // #i26791# - determine offset to 'vertical' frame
421  // anchor position, depending on layout-direction
422  if ( aRectFnSet.IsVert() )
423  {
424  aRelPos.setX( nRelPosY );
425  maOffsetToFrameAnchorPos.setX( nAlignAreaOffset );
426  }
427  else
428  {
429  aRelPos.setY( nRelPosY );
430  maOffsetToFrameAnchorPos.setY( nAlignAreaOffset );
431  }
432  }
433 
434  // Determine upper of frame vertical position is oriented at.
435  // #i28701# - determine 'virtual' anchor frame.
436  // This frame is used in the following instead of the 'real' anchor
437  // frame <rAnchorTextFrame> for the 'vertical' position in all cases.
438  const SwLayoutFrame* pUpperOfOrientFrame = nullptr;
439  {
440  // #i28701# - As long as the anchor frame is on the
441  // same page as <pOrientFrame> and the vertical position isn't aligned
442  // automatic at the anchor character or the top of the line of the
443  // anchor character, the anchor frame determines the vertical position.
444  if ( &rAnchorTextFrame == pOrientFrame ||
445  ( rAnchorTextFrame.FindPageFrame() == pOrientFrame->FindPageFrame() &&
446  aVert.GetVertOrient() == text::VertOrientation::NONE &&
447  aVert.GetRelationOrient() != text::RelOrientation::CHAR &&
448  aVert.GetRelationOrient() != text::RelOrientation::TEXT_LINE ) )
449  {
450  pUpperOfOrientFrame = rAnchorTextFrame.GetUpper();
451  pAnchorFrameForVertPos = &rAnchorTextFrame;
452  }
453  else
454  {
455  pUpperOfOrientFrame = pOrientFrame->GetUpper();
456  pAnchorFrameForVertPos = pOrientFrame;
457  }
458  }
459 
460  // ignore one-column sections.
461  // #i23512# - correction: also ignore one-columned
462  // sections with footnotes/endnotes
463  if ( pUpperOfOrientFrame->IsInSct() )
464  {
465  const SwSectionFrame* pSctFrame = pUpperOfOrientFrame->FindSctFrame();
466  const bool bIgnoreSection = pUpperOfOrientFrame->IsSctFrame() ||
467  ( pSctFrame->Lower()->IsColumnFrame() &&
468  !pSctFrame->Lower()->GetNext() );
469  if ( bIgnoreSection )
470  pUpperOfOrientFrame = pSctFrame->GetUpper();
471  }
472 
473  if ( aVert.GetVertOrient() == text::VertOrientation::NONE )
474  {
475  // local variable <nRelPosY> for calculation of relative vertical
476  // distance to anchor.
477  SwTwips nRelPosY = 0;
478  // #i26791# - local variable <nVertOffsetToFrameAnchorPos>
479  // for determination of the 'vertical' offset to the frame anchor
480  // position
481  SwTwips nVertOffsetToFrameAnchorPos( 0 );
482  // #i22341# - add special case for vertical alignment
483  // at top of line.
484  if ( mbAnchorToChar &&
485  ( aVert.GetRelationOrient() == text::RelOrientation::CHAR ||
486  aVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE ) )
487  {
488  // #i11860# - use new method <GetTopForObjPos>
489  // to get top of frame for object positioning.
490  SwTwips nTopOfOrient = GetTopForObjPos( *pOrientFrame, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
491  if ( aVert.GetRelationOrient() == text::RelOrientation::CHAR )
492  {
493  nVertOffsetToFrameAnchorPos = aRectFnSet.YDiff(
494  aRectFnSet.GetBottom(*ToCharRect()),
495  nTopOfOrient );
496  }
497  else
498  {
499  nVertOffsetToFrameAnchorPos = aRectFnSet.YDiff( ToCharTopOfLine(),
500  nTopOfOrient );
501  }
502  nRelPosY = nVertOffsetToFrameAnchorPos - aVert.GetPos();
503  }
504  else
505  {
506  // #i28701# - correction: use <pAnchorFrameForVertPos>
507  // instead of <pOrientFrame> and do not adjust relative position
508  // to get correct vertical position.
509  nVertOffsetToFrameAnchorPos = 0;
510  // #i11860# - use new method <GetTopForObjPos>
511  // to get top of frame for object positioning.
512  const SwTwips nTopOfOrient =
513  GetTopForObjPos( *pAnchorFrameForVertPos, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
514  // Increase <nRelPosY> by margin height,
515  // if position is vertical aligned to "paragraph text area"
516  if ( aVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA )
517  {
518  // #i11860# - consider upper space amount of previous frame
519  SwTwips nTopMargin = aRectFnSet.GetTopMargin(*pAnchorFrameForVertPos);
520  if ( pAnchorFrameForVertPos->IsTextFrame() )
521  {
522  nTopMargin -= pAnchorFrameForVertPos->
523  GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid();
524  }
525  nVertOffsetToFrameAnchorPos += nTopMargin;
526  }
527  // #i18732# - adjust <nRelPosY> by difference
528  // between 'page area' and 'anchor' frame, if position is
529  // vertical aligned to 'page areas'
530  else if ( aVert.GetRelationOrient() == text::RelOrientation::PAGE_FRAME )
531  {
532  nVertOffsetToFrameAnchorPos += aRectFnSet.YDiff(
533  aRectFnSet.GetTop(rPageAlignLayFrame.getFrameArea()),
534  nTopOfOrient );
535  }
536  else if ( aVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA )
537  {
538  SwRect aPgPrtRect( rPageAlignLayFrame.getFrameArea() );
539  if ( rPageAlignLayFrame.IsPageFrame() )
540  {
541  aPgPrtRect =
542  static_cast<const SwPageFrame&>(rPageAlignLayFrame).PrtWithoutHeaderAndFooter();
543  }
544  nVertOffsetToFrameAnchorPos += aRectFnSet.YDiff(
545  aRectFnSet.GetTop(aPgPrtRect),
546  nTopOfOrient );
547  }
548  nRelPosY = nVertOffsetToFrameAnchorPos + aVert.GetPos();
549  }
550 
551  // <pUpperOfOrientFrame>: layout frame, at which the position has to
552  // is oriented at
553  // <nRelPosY>: rest of the relative distance in the current
554  // layout frame
555  // <nAvail>: space, which is available in the current
556  // layout frame
557 
558  // #i26791# - determine offset to 'vertical'
559  // frame anchor position, depending on layout-direction
560  if ( aRectFnSet.IsVert() )
561  maOffsetToFrameAnchorPos.setX( nVertOffsetToFrameAnchorPos );
562  else
563  maOffsetToFrameAnchorPos.setY( nVertOffsetToFrameAnchorPos );
564  // #i11860# - use new method <GetTopForObjPos>
565  // to get top of frame for object positioning.
566  const SwTwips nTopOfAnch = GetTopForObjPos( *pAnchorFrameForVertPos, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
567  if( nRelPosY <= 0 )
568  {
569  // Allow negative position, but keep it
570  // inside environment layout frame.
571  const SwLayoutFrame& rVertEnvironLayFrame =
572  aEnvOfObj.GetVertEnvironmentLayoutFrame( *pUpperOfOrientFrame );
573  // #i31805# - do not check, if bottom of
574  // anchored object would fit into environment layout frame, if
575  // anchored object has to follow the text flow.
576  const bool bCheckBottom = !DoesObjFollowsTextFlow();
577  nRelPosY = AdjustVertRelPos( nTopOfAnch, aRectFnSet.IsVert(), aRectFnSet.IsVertL2R(),
578  rVertEnvironLayFrame, nRelPosY,
580  bCheckBottom );
581  if ( aRectFnSet.IsVert() )
582  aRelPos.setX( nRelPosY );
583  else
584  aRelPos.setY( nRelPosY );
585  }
586  else
587  {
588  aRectFnSet.Refresh(pAnchorFrameForVertPos);
589  SwTwips nAvail =
590  aRectFnSet.YDiff( aRectFnSet.GetPrtBottom(*pUpperOfOrientFrame),
591  nTopOfAnch );
592  const bool bInFootnote = pAnchorFrameForVertPos->IsInFootnote();
593  while ( nRelPosY )
594  {
595  // #i23512# - correction:
596  // consider section frame for grow in online layout.
597  // use new local method <lcl_DoesVertPosFits(..)>
598  SwLayoutFrame* pLayoutFrameToGrow = nullptr;
599  const bool bDoesVertPosFits = lcl_DoesVertPosFits(
600  nRelPosY, nAvail, pUpperOfOrientFrame, bBrowse,
601  bGrow, pLayoutFrameToGrow );
602 
603  if ( bDoesVertPosFits )
604  {
605  SwTwips nTmpRelPosY =
606  aRectFnSet.YDiff( aRectFnSet.GetPrtBottom(*pUpperOfOrientFrame),
607  nTopOfAnch ) -
608  nAvail + nRelPosY;
609  // #i28701# - adjust calculated
610  // relative vertical position to object's environment.
611  const SwFrame& rVertEnvironLayFrame =
612  aEnvOfObj.GetVertEnvironmentLayoutFrame( *pUpperOfOrientFrame );
613  // Do not check, if bottom of
614  // anchored object would fit into environment layout
615  // frame, if anchored object has to follow the text flow.
616  const bool bCheckBottom = !DoesObjFollowsTextFlow();
617  nTmpRelPosY = AdjustVertRelPos( nTopOfAnch, aRectFnSet.IsVert(), aRectFnSet.IsVertL2R(),
618  rVertEnvironLayFrame,
619  nTmpRelPosY,
621  bCheckBottom );
622  if ( aRectFnSet.IsVert() )
623  aRelPos.setX( nTmpRelPosY );
624  else
625  aRelPos.setY( nTmpRelPosY );
626 
627  // #i23512# - use local variable
628  // <pLayoutFrameToGrow> provided by new method
629  // <lcl_DoesVertPosFits(..)>.
630  if ( pLayoutFrameToGrow )
631  {
632  pLayoutFrameToGrow->Grow( nRelPosY - nAvail );
633  }
634  nRelPosY = 0;
635  }
636  else
637  {
638  // #i26495# - floating screen objects,
639  // which are anchored inside a table, doesn't follow
640  // the text flow.
641  if ( DoesObjFollowsTextFlow() &&
642  !( aVert.GetRelationOrient() == text::RelOrientation::PAGE_FRAME ||
643  aVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA ) &&
644  !GetAnchorFrame().IsInTab() )
645  {
646  if ( bMoveable )
647  {
648  // follow the text flow
649  nRelPosY -= nAvail;
650  MakePageType eMakePage = bInFootnote ? MAKEPAGE_NONE
651  : MAKEPAGE_APPEND;
652  const bool bInSct = pUpperOfOrientFrame->IsInSct();
653  if( bInSct )
654  eMakePage = MAKEPAGE_NOSECTION;
655 
656  const SwLayoutFrame* pTmp =
657  pUpperOfOrientFrame->GetLeaf( eMakePage, true, &rAnchorTextFrame );
658  if ( pTmp &&
659  ( !bInSct ||
660  pUpperOfOrientFrame->FindSctFrame()->IsAnFollow( pTmp->FindSctFrame() ) ) )
661  {
662  pUpperOfOrientFrame = pTmp;
663  bMoveable = rAnchorTextFrame.IsMoveable( pUpperOfOrientFrame );
664  aRectFnSet.Refresh(pUpperOfOrientFrame);
665  nAvail = aRectFnSet.GetHeight(pUpperOfOrientFrame->getFramePrintArea());
666  }
667  else
668  {
669  // if there isn't enough space in the (columned)
670  // section, leave it and set available space <nAvail>
671  // to the space below the section.
672  // if the new available space isn't also enough,
673  // new pages can be created.
674  if( bInSct )
675  {
676  const SwFrame* pSct = pUpperOfOrientFrame->FindSctFrame();
677  pUpperOfOrientFrame = pSct->GetUpper();
678  nAvail = aRectFnSet.YDiff(
679  aRectFnSet.GetPrtBottom(*pUpperOfOrientFrame),
680  aRectFnSet.GetPrtBottom(*pSct) );
681  }
682  else
683  {
684 #if OSL_DEBUG_LEVEL > 1
685  OSL_FAIL( "<SwToContentAnchoredObjectPosition::CalcPosition()> - !bInSct" );
686 #endif
687  nRelDiff = nRelPosY;
688  nRelPosY = 0;
689  }
690  }
691  }
692  else
693  {
694  nRelPosY = 0;
695  }
696  }
697  else
698  {
699  // #i18732# - do not follow text flow respectively
700  // align at 'page areas', but stay inside given environment
701  const SwFrame& rVertEnvironLayFrame =
702  aEnvOfObj.GetVertEnvironmentLayoutFrame( *pUpperOfOrientFrame );
703  nRelPosY = AdjustVertRelPos( nTopOfAnch, aRectFnSet.IsVert(), aRectFnSet.IsVertL2R(),
704  rVertEnvironLayFrame,
705  nRelPosY,
707  if( aRectFnSet.IsVert() )
708  aRelPos.setX( nRelPosY );
709  else
710  aRelPos.setY( nRelPosY );
711  nRelPosY = 0;
712  }
713  }
714  } // end of <while ( nRelPosY )>
715  } // end of else <nRelPosY <= 0>
716  } // end of <aVert.GetVertOrient() == text::VertOrientation::NONE>
717 
718  // We need to calculate the part's absolute position, in order for
719  // it to be put onto the right page and to be pulled into the
720  // LayLeaf's PrtArea
721  const SwTwips nTopOfAnch = GetTopForObjPos( *pAnchorFrameForVertPos, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
722  if( aRectFnSet.IsVert() )
723  {
724  // --> OD 2009-08-31 #monglianlayout#
725  if ( !aRectFnSet.IsVertL2R() )
726  {
727  GetAnchoredObj().SetObjLeft( nTopOfAnch -
728  ( aRelPos.X() - nRelDiff ) -
729  aObjBoundRect.Width() );
730  }
731  else
732  {
733  GetAnchoredObj().SetObjLeft( nTopOfAnch +
734  ( aRelPos.X() - nRelDiff ) );
735  }
736  }
737  else
738  {
739  GetAnchoredObj().SetObjTop( nTopOfAnch +
740  ( aRelPos.Y() - nRelDiff ) );
741  }
742 
743  // grow environment under certain conditions
744  // ignore one-column sections.
745  // #i23512# - correction: also ignore one-columned
746  // sections with footnotes/endnotes
747  if ( pUpperOfOrientFrame->IsInSct() )
748  {
749  const SwSectionFrame* pSctFrame = pUpperOfOrientFrame->FindSctFrame();
750  const bool bIgnoreSection = pUpperOfOrientFrame->IsSctFrame() ||
751  ( pSctFrame->Lower()->IsColumnFrame() &&
752  !pSctFrame->Lower()->GetNext() );
753  if ( bIgnoreSection )
754  pUpperOfOrientFrame = pSctFrame->GetUpper();
755  }
756  SwTwips nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(),
757  aRectFnSet.GetPrtBottom(*pUpperOfOrientFrame) );
758  if( nDist < 0 )
759  {
760  // #i23512# - correction:
761  // consider section frame for grow in online layout and
762  // consider page alignment for grow in table.
763  SwLayoutFrame* pLayoutFrameToGrow = nullptr;
764  if ( bBrowse && rAnchorTextFrame.IsMoveable() )
765  {
766  if ( pUpperOfOrientFrame->IsInSct() )
767  {
768  pLayoutFrameToGrow = const_cast<SwLayoutFrame*>(
769  pUpperOfOrientFrame->FindSctFrame()->GetUpper());
770  nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(),
771  aRectFnSet.GetPrtBottom(*pLayoutFrameToGrow) );
772  if ( nDist >= 0 )
773  {
774  pLayoutFrameToGrow = nullptr;
775  }
776  }
777  else
778  {
779  pLayoutFrameToGrow =
780  const_cast<SwLayoutFrame*>(pUpperOfOrientFrame);
781  }
782  }
783  else if ( rAnchorTextFrame.IsInTab() && bGrow )
784  {
785  pLayoutFrameToGrow = const_cast<SwLayoutFrame*>(pUpperOfOrientFrame);
786  }
787  if ( pLayoutFrameToGrow )
788  {
789  pLayoutFrameToGrow->Grow( -nDist );
790  }
791  }
792 
793  if ( DoesObjFollowsTextFlow() &&
794  !( aVert.GetRelationOrient() == text::RelOrientation::PAGE_FRAME ||
795  aVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA ) )
796  {
797 
798  nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(),
799  aRectFnSet.GetPrtBottom(*pUpperOfOrientFrame) );
800  // #i26945# - floating screen objects, which are
801  // anchored inside a table, doesn't follow the text flow. But, they
802  // have to stay inside its layout environment.
803  if ( nDist < 0 && pOrientFrame->IsInTab() )
804  {
805  // If the anchor frame is the first content of the table cell
806  // and has no follow, the table frame is notified,
807  // that the object doesn't fit into the table cell.
808  // Adjustment of position isn't needed in this case.
809  if ( pOrientFrame == &rAnchorTextFrame &&
810  !pOrientFrame->GetFollow() &&
811  !pOrientFrame->GetIndPrev() )
812  {
813  const_cast<SwTabFrame*>(pOrientFrame->FindTabFrame())
814  ->SetDoesObjsFit( false );
815  }
816  else
817  {
818  SwTwips nTmpRelPosY( 0 );
819  if ( aRectFnSet.IsVert() )
820  nTmpRelPosY = aRelPos.X() - nDist;
821  else
822  nTmpRelPosY = aRelPos.Y() + nDist;
823  const SwLayoutFrame& rVertEnvironLayFrame =
824  aEnvOfObj.GetVertEnvironmentLayoutFrame( *pUpperOfOrientFrame );
825  nTmpRelPosY = AdjustVertRelPos( nTopOfAnch, aRectFnSet.IsVert(), aRectFnSet.IsVertL2R(),
826  rVertEnvironLayFrame,
827  nTmpRelPosY,
829  false );
830  if ( aRectFnSet.IsVert() )
831  {
832  aRelPos.setX( nTmpRelPosY );
833  // --> OD 2009-08-31 #mongolianlayout#
834  if ( !aRectFnSet.IsVertL2R() )
835  {
836  GetAnchoredObj().SetObjLeft( nTopOfAnch -
837  aRelPos.X() -
838  aObjBoundRect.Width() );
839  }
840  else
841  {
842  GetAnchoredObj().SetObjLeft( nTopOfAnch + aRelPos.X() );
843  }
844  }
845  else
846  {
847  aRelPos.setY( nTmpRelPosY );
848  GetAnchoredObj().SetObjTop( nTopOfAnch + aRelPos.Y() );
849  }
850  // If the anchor frame is the first content of the table cell
851  // and the object still doesn't fit, the table frame is notified,
852  // that the object doesn't fit into the table cell.
853  nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(),
854  aRectFnSet.GetPrtBottom(*pUpperOfOrientFrame) );
855  if ( nDist < 0 &&
856  pOrientFrame == &rAnchorTextFrame && !pOrientFrame->GetIndPrev() )
857  {
858  const_cast<SwTabFrame*>(pOrientFrame->FindTabFrame())
859  ->SetDoesObjsFit( false );
860  }
861  }
862  }
863  else
864  {
865  // follow text flow
866  const bool bInFootnote = rAnchorTextFrame.IsInFootnote();
867  while( bMoveable && nDist < 0 )
868  {
869  bool bInSct = pUpperOfOrientFrame->IsInSct();
870  if ( bInSct )
871  {
872  const SwLayoutFrame* pTmp = pUpperOfOrientFrame->FindSctFrame()->GetUpper();
873  nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(),
874  aRectFnSet.GetPrtBottom(*pTmp) );
875  // #i23129# - Try to flow into next
876  // section|section column. Thus, do *not* leave section
877  // area, if anchored object doesn't fit into upper of section.
878  // But the anchored object is allowed to overlap bottom
879  // section|section column.
880  if ( nDist >= 0 )
881  {
882  break;
883  }
884  }
885  if ( !bInSct &&
886  aRectFnSet.GetTop(GetAnchoredObj().GetObjRect()) ==
887  aRectFnSet.GetPrtTop(*pUpperOfOrientFrame) )
888  // It doesn't fit, moving it would not help either anymore
889  break;
890 
891  const SwLayoutFrame* pNextLay = pUpperOfOrientFrame->GetLeaf(
892  ( bInSct
894  : ( bInFootnote ? MAKEPAGE_NONE : MAKEPAGE_APPEND ) ),
895  true, &rAnchorTextFrame );
896  // correction:
897  // If anchor is in footnote and proposed next layout environment
898  // isn't a footnote frame, object can't follow the text flow
899  if ( bInFootnote && pNextLay && !pNextLay->IsFootnoteFrame() )
900  {
901  pNextLay = nullptr;
902  }
903  if ( pNextLay )
904  {
905  SwRectFnSet fnRectX(pNextLay);
906  if ( !bInSct ||
907  ( pUpperOfOrientFrame->FindSctFrame()->IsAnFollow( pNextLay->FindSctFrame() ) &&
908  fnRectX.GetHeight(pNextLay->getFramePrintArea()) ) )
909  {
910  SwTwips nTmpRelPosY =
911  aRectFnSet.YDiff( aRectFnSet.GetPrtTop(*pNextLay),
912  nTopOfAnch );
913  if ( aRectFnSet.IsVert() )
914  aRelPos.setX( nTmpRelPosY );
915  else
916  aRelPos.setY( nTmpRelPosY );
917  pUpperOfOrientFrame = pNextLay;
918  aRectFnSet.Refresh(pUpperOfOrientFrame);
919  bMoveable = rAnchorTextFrame.IsMoveable( pUpperOfOrientFrame );
920  if( fnRectX.IsVert() )
921  {
922  // --> OD 2009-08-31 #mongolianlayout#
923  if ( !aRectFnSet.IsVertL2R() )
924  {
925  GetAnchoredObj().SetObjLeft( nTopOfAnch -
926  aRelPos.X() -
927  aObjBoundRect.Width() );
928  }
929  else
930  {
931  GetAnchoredObj().SetObjLeft( nTopOfAnch +
932  aRelPos.X() );
933  }
934  }
935  else
936  GetAnchoredObj().SetObjTop( nTopOfAnch +
937  aRelPos.Y() );
938  nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(),
939  aRectFnSet.GetPrtBottom(*pUpperOfOrientFrame) );
940  }
941  // #i23129# - leave section area
942  else if ( bInSct )
943  {
944  const SwLayoutFrame* pTmp = pUpperOfOrientFrame->FindSctFrame()->GetUpper();
945  nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(),
946  aRectFnSet.GetPrtBottom(*pTmp) );
947  if( nDist < 0 )
948  pUpperOfOrientFrame = pTmp;
949  else
950  break;
951  }
952  }
953  else if ( bInSct )
954  {
955  // If we don't have enough room within the Area, we take a look at
956  // the Page
957  const SwLayoutFrame* pTmp = pUpperOfOrientFrame->FindSctFrame()->GetUpper();
958  nDist = aRectFnSet.BottomDist( GetAnchoredObj().GetObjRect(),
959  aRectFnSet.GetPrtBottom(*pTmp) );
960  if( nDist < 0 )
961  pUpperOfOrientFrame = pTmp;
962  else
963  break;
964  }
965  else
966  bMoveable = false;
967  }
968  }
969  }
970 
971  // keep layout frame vertical position is oriented at.
972  mpVertPosOrientFrame = pUpperOfOrientFrame;
973 
974  }
975 
976  // determine 'horizontal' position
977  {
978  // determine horizontal positioning and alignment attributes
979  SwFormatHoriOrient aHori( rFrameFormat.GetHoriOrient() );
980 
981  // set calculated vertical position in order to determine correct
982  // frame, the horizontal position is oriented at.
983  const SwTwips nTopOfAnch = GetTopForObjPos( *pAnchorFrameForVertPos, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
984  if( aRectFnSet.IsVert() )
985  {
986  // --> OD 2009-08-31 #mongolianlayout#
987  if ( !aRectFnSet.IsVertL2R() )
988  {
989  GetAnchoredObj().SetObjLeft( nTopOfAnch -
990  aRelPos.X() - aObjBoundRect.Width() );
991  }
992  else
993  {
994  GetAnchoredObj().SetObjLeft( nTopOfAnch + aRelPos.X() );
995  }
996  }
997  else
998  GetAnchoredObj().SetObjTop( nTopOfAnch + aRelPos.Y() );
999 
1000  // determine frame, horizontal position is oriented at.
1001  // #i28701# - If floating screen object doesn't follow
1002  // the text flow, its horizontal position is oriented at <pOrientFrame>.
1003  const SwFrame* pHoriOrientFrame = DoesObjFollowsTextFlow()
1005  : pOrientFrame;
1006 
1007  // #i26791# - get 'horizontal' offset to frame anchor position.
1008  SwTwips nHoriOffsetToFrameAnchorPos( 0 );
1009  SwTwips nRelPosX = CalcRelPosX( *pHoriOrientFrame, aEnvOfObj,
1010  aHori, rLR, rUL, bWrapThrough,
1011  ( aRectFnSet.IsVert() ? aRelPos.X() : aRelPos.Y() ),
1012  nHoriOffsetToFrameAnchorPos );
1013 
1014  // #i26791# - determine offset to 'horizontal' frame
1015  // anchor position, depending on layout-direction
1016  if ( aRectFnSet.IsVert() )
1017  {
1018  aRelPos.setY( nRelPosX );
1019  maOffsetToFrameAnchorPos.setY( nHoriOffsetToFrameAnchorPos );
1020  }
1021  else
1022  {
1023  aRelPos.setX( nRelPosX );
1024  maOffsetToFrameAnchorPos.setX( nHoriOffsetToFrameAnchorPos );
1025  }
1026 
1027  // save calculated horizontal position - needed for filters
1028  // (including the xml-filter)
1029  {
1030  SwTwips nAttrRelPosX = nRelPosX - nHoriOffsetToFrameAnchorPos;
1031  if ( aHori.GetHoriOrient() != text::HoriOrientation::NONE &&
1032  aHori.GetPos() != nAttrRelPosX )
1033  {
1034  aHori.SetPos( nAttrRelPosX );
1035  const_cast<SwFrameFormat&>(rFrameFormat).LockModify();
1036  const_cast<SwFrameFormat&>(rFrameFormat).SetFormatAttr( aHori );
1037  const_cast<SwFrameFormat&>(rFrameFormat).UnlockModify();
1038  }
1039  }
1040  }
1041 
1042  // set absolute position at object
1043  const SwTwips nTopOfAnch = GetTopForObjPos( *pAnchorFrameForVertPos, aRectFnSet.FnRect(), aRectFnSet.IsVert() );
1044  if( aRectFnSet.IsVert() )
1045  {
1046  // --> OD 2009-08-31 #mongolianlayout#
1047  if ( !aRectFnSet.IsVertL2R() )
1048  {
1049  GetAnchoredObj().SetObjLeft( nTopOfAnch -
1050  aRelPos.X() - aObjBoundRect.Width() );
1051  }
1052  else
1053  {
1054  GetAnchoredObj().SetObjLeft( nTopOfAnch + aRelPos.X() );
1055  }
1056  GetAnchoredObj().SetObjTop( rAnchorTextFrame.getFrameArea().Top() +
1057  aRelPos.Y() );
1058  }
1059  else
1060  {
1061  GetAnchoredObj().SetObjLeft( rAnchorTextFrame.getFrameArea().Left() +
1062  aRelPos.X() );
1063  GetAnchoredObj().SetObjTop( nTopOfAnch + aRelPos.Y() );
1064  }
1065 
1066  // set relative position at object
1067  GetAnchoredObj().SetCurrRelPos( aRelPos );
1068 }
1069 
1074  const SwLayoutFrame& _rProposedFrame ) const
1075 {
1076  const SwFrame* pHoriVirtAnchFrame = &_rProposedFrame;
1077 
1078  // Search for first lower content frame, which is the anchor or a follow
1079  // of the anchor (Note: <Anchor.IsAnFollow( Anchor )> is true)
1080  // If none found, <_rProposedFrame> is returned.
1081  const SwFrame* pFrame = _rProposedFrame.Lower();
1082  while ( pFrame )
1083  {
1084  if ( pFrame->IsContentFrame() &&
1085  GetAnchorTextFrame().IsAnFollow( static_cast<const SwContentFrame*>(pFrame) ) )
1086  {
1087  pHoriVirtAnchFrame = pFrame;
1088  break;
1089  }
1090  pFrame = pFrame->GetNext();
1091  }
1092 
1093  return *pHoriVirtAnchFrame;
1094 }
1095 
1096 
1097 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long GetLeft() const
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:547
void CheckCharRectAndTopOfLine(const bool _bCheckForParaPorInf)
check anchor character rectangle and top of line
Base class of the Writer layout elements.
Definition: frame.hxx:295
static bool lcl_DoesVertPosFits(const SwTwips _nRelPosY, const SwTwips _nAvail, const SwLayoutFrame *_pUpperOfOrientFrame, const bool _bBrowse, const bool _bGrowInTable, SwLayoutFrame *&_orpLayoutFrameToGrow)
const SwRect & GetLastCharRect() const
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
long BottomDist(const SwRect &rRect, long nPos) const
Definition: frame.hxx:1375
bool IsInDocBody() const
Definition: frame.hxx:919
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1462
sal_uInt16 GetLower() const
bool IsInSct() const
Definition: frame.hxx:943
const SwLayoutFrame & GetVertEnvironmentLayoutFrame(const SwFrame &_rVertOrientFrame) const
determine environment layout frame for possible vertical object positions respectively for alignments...
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
void Refresh(const SwFrame *pFrame)
Definition: frame.hxx:1320
bool IsInFootnote() const
Definition: frame.hxx:925
SwRectFn FnRect() const
Definition: frame.hxx:1330
const SwRect & getFramePrintArea() const
Definition: frame.hxx:176
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:30
long GetBottom(const SwRect &rRect) const
Definition: frame.hxx:1339
long SwTwips
Definition: swtypes.hxx:49
bool IsVert() const
Definition: frame.hxx:1328
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
long GetPrtTop(const SwFrame &rFrame) const
Definition: frame.hxx:1370
bool IsFootnoteFrame() const
Definition: frame.hxx:1178
long YDiff(long n1, long n2) const
Definition: frame.hxx:1384
long GetPrtBottom(const SwFrame &rFrame) const
Definition: frame.hxx:1371
void SetCurrRelPos(Point _aRelPos)
void Top(const long nTop)
Definition: swrect.hxx:202
bool IsMoveable(const SwLayoutFrame *_pLayoutFrame=nullptr) const
determine, if frame is moveable in given environment
Definition: findfrm.cxx:1359
const SwRect & getFrameArea() const
Definition: frame.hxx:175
void setX(long nX)
bool getBrowseMode() const
Definition: viewopt.hxx:426
bool IsInTab() const
Definition: frame.hxx:931
bool IsTextFrame() const
Definition: frame.hxx:1210
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
bool IsSctFrame() const
Definition: frame.hxx:1190
void setY(long nY)
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:844
void SetObjTop(const SwTwips _nTop)
long const nTopMargin
bool IsColumnFrame() const
Definition: frame.hxx:1158
virtual void CalcPosition() override
calculate position of object
SwTwips AdjustVertRelPos(const SwTwips nTopOfAnch, const bool bVert, const bool bVertL2R, const SwFrame &rPageAlignLayFrame, const SwTwips nProposedRelPosY, const bool bFollowTextFlow, const bool bCheckBottom=true) const
adjust calculated vertical in order to keep object inside 'page' alignment layout frame...
Style of a layout element.
Definition: frmfmt.hxx:57
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
Definition: txtfrm.cxx:1258
bool IsContentFrame() const
Definition: frame.hxx:1206
SwFrame * GetIndPrev() const
Definition: frame.hxx:702
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
const SwFrame * Lower() const
Definition: layfrm.hxx:100
FlyAnchors.
Definition: fmtanchr.hxx:34
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
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
long GetTopMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1364
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
A page of the document layout.
Definition: pagefrm.hxx:40
long X() const
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1091
void Left(const long nLeft)
Definition: swrect.hxx:193
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
SwLayoutFrame * GetLeaf(MakePageType eMakePage, bool bFwd)
Definition: flowfrm.cxx:783
MakePageType
Definition: frame.hxx:110
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
void Width(long nNew)
Definition: swrect.hxx:185
SwTwips GetLastTopOfLine() const
bool IsVertL2R() const
Definition: frame.hxx:1329
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
bool IsAnFollow(const SwFlowFrame *pFlow) const
Definition: flowfrm.cxx:667
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
void SetObjLeft(const SwTwips _nLeft)
long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1338
const SwFrame & GetHoriVirtualAnchor(const SwLayoutFrame &_pProposedFrame) const
determine frame for horizontal position
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
bool IsFooterFrame() const
Definition: frame.hxx:1170
SwRootFrame * getRootFrame()
Definition: frame.hxx:657
long Y() const
sal_uInt16 GetUpper() const
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1075
SwFrame * GetNext()
Definition: frame.hxx:654
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74