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