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