LibreOffice Module sw (master)  1
textboxhelper.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 
10 #include <textboxhelper.hxx>
11 #include <fmtcntnt.hxx>
12 #include <fmtanchr.hxx>
13 #include <fmtcnct.hxx>
14 #include <fmtornt.hxx>
15 #include <fmtfsize.hxx>
16 #include <doc.hxx>
18 #include <docsh.hxx>
19 #include <unocoll.hxx>
20 #include <unoframe.hxx>
21 #include <unodraw.hxx>
22 #include <unotextrange.hxx>
23 #include <cmdid.h>
24 #include <unomid.h>
25 #include <unoprnms.hxx>
26 #include <mvsave.hxx>
27 #include <fmtsrnd.hxx>
28 #include <frmfmt.hxx>
29 #include <frameformats.hxx>
30 
31 #include <editeng/unoprnms.hxx>
32 #include <editeng/memberids.h>
33 #include <svx/svdoashp.hxx>
34 #include <svx/svdpage.hxx>
35 #include <svl/itemiter.hxx>
37 #include <sal/log.hxx>
38 #include <tools/UnitConversion.hxx>
39 
40 #include <com/sun/star/document/XActionLockable.hpp>
41 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
42 #include <com/sun/star/text/SizeType.hpp>
43 #include <com/sun/star/text/TextContentAnchorType.hpp>
44 #include <com/sun/star/text/WrapTextMode.hpp>
45 #include <com/sun/star/text/XTextDocument.hpp>
46 #include <com/sun/star/table/BorderLine2.hpp>
47 #include <com/sun/star/text/WritingMode.hpp>
48 #include <com/sun/star/text/WritingMode2.hpp>
49 
50 using namespace com::sun::star;
51 
53 {
54  // If TextBox wasn't enabled previously
55  if (pShape->GetAttrSet().HasItem(RES_CNTNT))
56  return;
57 
58  // Create the associated TextFrame and insert it into the document.
59  uno::Reference<text::XTextContent> xTextFrame(
61  uno::UNO_QUERY);
62  uno::Reference<text::XTextDocument> xTextDocument(
63  pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
64  uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(),
65  uno::UNO_QUERY);
66  try
67  {
68  SdrObject* pSourceSDRShape = pShape->FindRealSdrObject();
69  uno::Reference<text::XTextContent> XSourceShape(pSourceSDRShape->getUnoShape(),
70  uno::UNO_QUERY_THROW);
71  xTextContentAppend->insertTextContentWithProperties(
72  xTextFrame, uno::Sequence<beans::PropertyValue>(), XSourceShape->getAnchor());
73  }
74  catch (uno::Exception&)
75  {
76  xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>());
77  }
78  // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
79  uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY);
80  auto pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get());
81  assert(nullptr != pTextFrame);
82  SwFrameFormat* pFormat = pTextFrame->GetFrameFormat();
83 
84  assert(nullptr != dynamic_cast<SwDrawFrameFormat*>(pShape));
85  assert(nullptr != dynamic_cast<SwFlyFrameFormat*>(pFormat));
86 
87  pShape->SetOtherTextBoxFormat(pFormat);
88  pFormat->SetOtherTextBoxFormat(pShape);
89 
90  // Initialize properties.
91  uno::Reference<beans::XPropertySet> xPropertySet(xTextFrame, uno::UNO_QUERY);
92  uno::Any aEmptyBorder = uno::makeAny(table::BorderLine2());
93  xPropertySet->setPropertyValue(UNO_NAME_TOP_BORDER, aEmptyBorder);
94  xPropertySet->setPropertyValue(UNO_NAME_BOTTOM_BORDER, aEmptyBorder);
95  xPropertySet->setPropertyValue(UNO_NAME_LEFT_BORDER, aEmptyBorder);
96  xPropertySet->setPropertyValue(UNO_NAME_RIGHT_BORDER, aEmptyBorder);
97 
98  xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::makeAny(sal_Int32(100)));
99 
100  xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, uno::makeAny(text::SizeType::FIX));
101 
102  xPropertySet->setPropertyValue(UNO_NAME_SURROUND, uno::makeAny(text::WrapTextMode_THROUGH));
103 
104  uno::Reference<container::XNamed> xNamed(xTextFrame, uno::UNO_QUERY);
105  xNamed->setName(pShape->GetDoc()->GetUniqueFrameName());
106 
107  // Link its text range to the original shape.
108  uno::Reference<text::XTextRange> xTextBox(xTextFrame, uno::UNO_QUERY_THROW);
109  SwUnoInternalPaM aInternalPaM(*pShape->GetDoc());
110  if (sw::XTextRangeToSwPaM(aInternalPaM, xTextBox))
111  {
112  SwAttrSet aSet(pShape->GetAttrSet());
113  SwFormatContent aContent(aInternalPaM.GetNode().StartOfSectionNode());
114  aSet.Put(aContent);
115  pShape->SetFormatAttr(aSet);
116  }
117 
118  // Also initialize the properties, which are not constant, but inherited from the shape's ones.
119  uno::Reference<drawing::XShape> xShape(pShape->FindRealSdrObject()->getUnoShape(),
120  uno::UNO_QUERY);
121  syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::makeAny(xShape->getSize()));
122 
123  uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
124  syncProperty(pShape, RES_FOLLOW_TEXT_FLOW, MID_FOLLOW_TEXT_FLOW,
125  xShapePropertySet->getPropertyValue(UNO_NAME_IS_FOLLOWING_TEXT_FLOW));
126  syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT,
127  xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT));
128  syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION,
129  xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION));
130  syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT,
131  xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT));
132  syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION,
133  xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION));
134  syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION,
135  xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION));
136  syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION,
137  xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION));
138  syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT,
139  xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT));
140  syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0,
141  xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST));
142  text::WritingMode eMode;
143  if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= eMode)
144  syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode)));
145 
146  const SwFormatAnchor& rAnch = pShape->GetAnchor();
147  if (!((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE && rAnch.GetPageNum() != 0)
148  || ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA
149  || rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
150  && rAnch.GetContentAnchor())))
151  return;
152 
153  SfxItemSet aTxFrmSet(pFormat->GetDoc()->GetAttrPool(), aFrameFormatSetRange);
154  SwFormatAnchor aNewAnch = pFormat->GetAnchor();
155 
156  if (pShape->GetAnchor().GetContentAnchor())
157  aNewAnch.SetAnchor(pShape->GetAnchor().GetContentAnchor());
158  if (pShape->GetAnchor().GetPageNum() > 0)
159  aNewAnch.SetPageNum(pShape->GetAnchor().GetPageNum());
160 
161  aNewAnch.SetType(pShape->GetAnchor().GetAnchorId());
162  aTxFrmSet.Put(aNewAnch);
163 
164  SwFormatVertOrient aVOri(pFormat->GetVertOrient());
165  SwFormatHoriOrient aHOri(pFormat->GetHoriOrient());
166  aVOri.SetVertOrient(pShape->GetVertOrient().GetVertOrient());
167  aHOri.SetHoriOrient(pShape->GetHoriOrient().GetHoriOrient());
168  aVOri.SetRelationOrient(pShape->GetVertOrient().GetRelationOrient());
169  aHOri.SetRelationOrient(pShape->GetHoriOrient().GetRelationOrient());
170  aTxFrmSet.Put(aVOri);
171  aTxFrmSet.Put(aHOri);
172 
173  if (aTxFrmSet.Count())
174  pFormat->SetFormatAttr(aTxFrmSet);
175 }
176 
178 {
179  // If a TextBox was enabled previously
180  if (pShape->GetAttrSet().HasItem(RES_CNTNT))
181  {
182  SwFrameFormat* pFormat = pShape->GetOtherTextBoxFormat();
183 
184  // Unlink the TextBox's text range from the original shape.
185  pShape->ResetFormatAttr(RES_CNTNT);
186 
187  // Delete the associated TextFrame.
188  if (pFormat)
189  pShape->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat(pFormat);
190  }
191 }
192 
193 bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType)
194 {
195  assert(nType == RES_FLYFRMFMT || nType == RES_DRAWFRMFMT);
196  if (!pFormat || pFormat->Which() != nType || !pFormat->GetAttrSet().HasItem(RES_CNTNT))
197  return false;
198 
199  sal_uInt16 nOtherType = (pFormat->Which() == RES_FLYFRMFMT) ? sal_uInt16(RES_DRAWFRMFMT)
200  : sal_uInt16(RES_FLYFRMFMT);
201  SwFrameFormat* pOtherFormat = pFormat->GetOtherTextBoxFormat();
202  if (!pOtherFormat)
203  return false;
204 
205  assert(pOtherFormat->Which() == nOtherType);
206  if (pOtherFormat->Which() != nOtherType)
207  return false;
208 
209  const SwFormatContent& rContent = pFormat->GetContent();
210  return pOtherFormat->GetAttrSet().HasItem(RES_CNTNT) && pOtherFormat->GetContent() == rContent;
211 }
212 
213 sal_Int32 SwTextBoxHelper::getCount(SdrPage const* pPage)
214 {
215  sal_Int32 nRet = 0;
216  for (std::size_t i = 0; i < pPage->GetObjCount(); ++i)
217  {
218  SdrObject* p = pPage->GetObj(i);
219  if (p && p->IsTextBox())
220  continue;
221  ++nRet;
222  }
223  return nRet;
224 }
225 
226 sal_Int32 SwTextBoxHelper::getCount(const SwDoc* pDoc)
227 {
228  sal_Int32 nRet = 0;
229  const SwFrameFormats& rSpzFrameFormats = *pDoc->GetSpzFrameFormats();
230  for (const auto pFormat : rSpzFrameFormats)
231  {
232  if (isTextBox(pFormat, RES_FLYFRMFMT))
233  ++nRet;
234  }
235  return nRet;
236 }
237 
238 uno::Any SwTextBoxHelper::getByIndex(SdrPage const* pPage, sal_Int32 nIndex)
239 {
240  if (nIndex < 0)
241  throw lang::IndexOutOfBoundsException();
242 
243  SdrObject* pRet = nullptr;
244  sal_Int32 nCount = 0; // Current logical index.
245  for (std::size_t i = 0; i < pPage->GetObjCount(); ++i)
246  {
247  SdrObject* p = pPage->GetObj(i);
248  if (p && p->IsTextBox())
249  continue;
250  if (nCount == nIndex)
251  {
252  pRet = p;
253  break;
254  }
255  ++nCount;
256  }
257 
258  if (!pRet)
259  throw lang::IndexOutOfBoundsException();
260 
261  return uno::makeAny(uno::Reference<drawing::XShape>(pRet->getUnoShape(), uno::UNO_QUERY));
262 }
263 
264 sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject)
265 {
266  if (const SdrPage* pPage = pObject->getSdrPageFromSdrObject())
267  {
268  sal_Int32 nOrder = 0; // Current logical order.
269  for (std::size_t i = 0; i < pPage->GetObjCount(); ++i)
270  {
271  SdrObject* p = pPage->GetObj(i);
272  if (p && p->IsTextBox())
273  continue;
274  if (p == pObject)
275  return nOrder;
276  ++nOrder;
277  }
278  }
279 
280  SAL_WARN("sw.core", "SwTextBoxHelper::getOrdNum: no page or page doesn't contain the object");
281  return pObject->GetOrdNum();
282 }
283 
284 void SwTextBoxHelper::getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough)
285 {
287  if (pShape)
288  rWrapThrough = pShape->GetSurround().GetSurround() == css::text::WrapTextMode_THROUGH;
289 }
290 
292  sal_uInt16 nType)
293 {
294  if (!isTextBox(pFormat, nType))
295  return nullptr;
296  return pFormat->GetOtherTextBoxFormat();
297 }
298 
299 SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(uno::Reference<drawing::XShape> const& xShape)
300 {
301  auto pShape = dynamic_cast<SwXShape*>(xShape.get());
302  if (!pShape)
303  return nullptr;
304 
305  SwFrameFormat* pFormat = pShape->GetFrameFormat();
306  return getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT);
307 }
308 
309 template <typename T> static void lcl_queryInterface(const SwFrameFormat* pShape, uno::Any& rAny)
310 {
312  {
313  uno::Reference<T> const xInterface(
314  SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), uno::UNO_QUERY);
315  rAny <<= xInterface;
316  }
317 }
318 
320 {
321  uno::Any aRet;
322 
324  {
325  lcl_queryInterface<text::XTextAppend>(pShape, aRet);
326  }
327  else if (rType == cppu::UnoType<css::text::XText>::get())
328  {
329  lcl_queryInterface<text::XText>(pShape, aRet);
330  }
331  else if (rType == cppu::UnoType<css::text::XTextRange>::get())
332  {
333  lcl_queryInterface<text::XTextRange>(pShape, aRet);
334  }
335 
336  return aRet;
337 }
338 
340 {
341  tools::Rectangle aRet;
342  aRet.SetEmpty();
343  auto pSdrShape = pShape->FindRealSdrObject();
344  auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(pSdrShape);
345  if (pCustomShape)
346  {
347  // Need to temporarily release the lock acquired in
348  // SdXMLShapeContext::AddShape(), otherwise we get an empty rectangle,
349  // see EnhancedCustomShapeEngine::getTextBounds().
350  uno::Reference<document::XActionLockable> xLockable(pCustomShape->getUnoShape(),
351  uno::UNO_QUERY);
352  sal_Int16 nLocks = 0;
353  if (xLockable.is())
354  nLocks = xLockable->resetActionLocks();
355  pCustomShape->GetTextBounds(aRet);
356  if (nLocks)
357  xLockable->setActionLocks(nLocks);
358  }
359  else if (pSdrShape)
360  {
361  // fallback - get *any* bound rect we can possibly get hold of
362  aRet = pSdrShape->GetCurrentBoundRect();
363  }
364 
365  if (!bAbsolute && pSdrShape)
366  {
367  // Relative, so count the logic (reference) rectangle, see the EnhancedCustomShape2d ctor.
368  Point aPoint(pSdrShape->GetSnapRect().Center());
369  Size aSize(pSdrShape->GetLogicRect().GetSize());
370  aPoint.AdjustX(-(aSize.Width() / 2));
371  aPoint.AdjustY(-(aSize.Height() / 2));
372  tools::Rectangle aLogicRect(aPoint, aSize);
373  aRet.Move(-1 * aLogicRect.Left(), -1 * aLogicRect.Top());
374  }
375 
376  return aRet;
377 }
378 
379 void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPropertyName,
380  const css::uno::Any& rValue)
381 {
382  if (rPropertyName == "CustomShapeGeometry")
383  {
384  // CustomShapeGeometry changes the textbox position offset and size, so adjust both.
385  syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::Any());
386 
387  SdrObject* pObject = pShape->FindRealSdrObject();
388  if (pObject)
389  {
390  tools::Rectangle aRectangle(pObject->GetSnapRect());
391  syncProperty(
393  uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Left()))));
394  syncProperty(
396  uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Top()))));
397  }
398 
399  SwFrameFormat* pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT);
400  if (!pFormat)
401  return;
402 
403  comphelper::SequenceAsHashMap aCustomShapeGeometry(rValue);
404  auto it = aCustomShapeGeometry.find("TextPreRotateAngle");
405  if (it == aCustomShapeGeometry.end())
406  {
407  it = aCustomShapeGeometry.find("TextRotateAngle");
408  }
409 
410  if (it != aCustomShapeGeometry.end())
411  {
412  auto nAngle = it->second.has<sal_Int32>() ? it->second.get<sal_Int32>() : 0;
413  if (nAngle == 0)
414  {
415  nAngle = it->second.has<double>() ? it->second.get<double>() : 0;
416  }
417 
418  sal_Int16 nDirection = 0;
419  switch (nAngle)
420  {
421  case -90:
422  nDirection = text::WritingMode2::TB_RL;
423  break;
424  case -270:
425  nDirection = text::WritingMode2::BT_LR;
426  break;
427  }
428 
429  if (nDirection)
430  {
431  syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(nDirection));
432  }
433  }
434  }
435  else if (rPropertyName == UNO_NAME_TEXT_VERT_ADJUST)
436  syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, rValue);
437  else if (rPropertyName == UNO_NAME_TEXT_AUTOGROWHEIGHT)
438  syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, rValue);
439  else if (rPropertyName == UNO_NAME_TEXT_LEFTDIST)
440  syncProperty(pShape, RES_BOX, LEFT_BORDER_DISTANCE, rValue);
441  else if (rPropertyName == UNO_NAME_TEXT_RIGHTDIST)
442  syncProperty(pShape, RES_BOX, RIGHT_BORDER_DISTANCE, rValue);
443  else if (rPropertyName == UNO_NAME_TEXT_UPPERDIST)
444  syncProperty(pShape, RES_BOX, TOP_BORDER_DISTANCE, rValue);
445  else if (rPropertyName == UNO_NAME_TEXT_LOWERDIST)
446  syncProperty(pShape, RES_BOX, BOTTOM_BORDER_DISTANCE, rValue);
447  else if (rPropertyName == UNO_NAME_TEXT_WRITINGMODE)
448  {
449  text::WritingMode eMode;
450  if (rValue >>= eMode)
451  syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode)));
452  }
453 }
454 
455 void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
456  css::uno::Any& rValue)
457 {
458  if (!pShape)
459  return;
460 
461  nMemberID &= ~CONVERT_TWIPS;
462 
463  SwFrameFormat* pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT);
464  if (!pFormat)
465  return;
466 
467  if (nWID != RES_CHAIN)
468  return;
469 
470  switch (nMemberID)
471  {
472  case MID_CHAIN_PREVNAME:
473  case MID_CHAIN_NEXTNAME:
474  {
475  const SwFormatChain& rChain = pFormat->GetChain();
476  rChain.QueryValue(rValue, nMemberID);
477  }
478  break;
479  case MID_CHAIN_NAME:
480  rValue <<= pFormat->GetName();
481  break;
482  }
483 }
484 
485 void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
486  const css::uno::Any& rValue)
487 {
488  // No shape yet? Then nothing to do, initial properties are set by create().
489  if (!pShape)
490  return;
491 
492  uno::Any aValue(rValue);
493  nMemberID &= ~CONVERT_TWIPS;
494 
495  SwFrameFormat* pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT);
496  if (!pFormat)
497  return;
498 
499  OUString aPropertyName;
500  bool bAdjustX = false;
501  bool bAdjustY = false;
502  bool bAdjustSize = false;
503  switch (nWID)
504  {
505  case RES_HORI_ORIENT:
506  switch (nMemberID)
507  {
509  aPropertyName = UNO_NAME_HORI_ORIENT;
510  break;
512  aPropertyName = UNO_NAME_HORI_ORIENT_RELATION;
513  break;
515  aPropertyName = UNO_NAME_HORI_ORIENT_POSITION;
516  bAdjustX = true;
517  break;
518  }
519  break;
520  case RES_LR_SPACE:
521  {
522  switch (nMemberID)
523  {
524  case MID_L_MARGIN:
525  aPropertyName = UNO_NAME_LEFT_MARGIN;
526  break;
527  case MID_R_MARGIN:
528  aPropertyName = UNO_NAME_RIGHT_MARGIN;
529  break;
530  }
531  break;
532  }
533  case RES_VERT_ORIENT:
534  switch (nMemberID)
535  {
537  aPropertyName = UNO_NAME_VERT_ORIENT;
538  break;
540  aPropertyName = UNO_NAME_VERT_ORIENT_RELATION;
541  break;
543  aPropertyName = UNO_NAME_VERT_ORIENT_POSITION;
544  bAdjustY = true;
545  break;
546  }
547  break;
548  case RES_FRM_SIZE:
549  switch (nMemberID)
550  {
552  aPropertyName = UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT;
553  break;
555  aPropertyName = UNO_NAME_RELATIVE_HEIGHT_RELATION;
556  break;
558  aPropertyName = UNO_NAME_RELATIVE_WIDTH_RELATION;
559  break;
560  default:
561  aPropertyName = UNO_NAME_SIZE;
562  bAdjustSize = true;
563  break;
564  }
565  break;
566  case RES_ANCHOR:
567  switch (nMemberID)
568  {
570  if (aValue.get<text::TextContentAnchorType>()
571  == text::TextContentAnchorType_AS_CHARACTER)
572  {
573  uno::Reference<beans::XPropertySet> const xPropertySet(
574  SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat),
575  uno::UNO_QUERY);
576  xPropertySet->setPropertyValue(UNO_NAME_SURROUND,
577  uno::makeAny(text::WrapTextMode_THROUGH));
578  return;
579  }
580  break;
581  }
582  break;
583  case FN_TEXT_RANGE:
584  {
585  uno::Reference<text::XTextRange> xRange;
586  rValue >>= xRange;
587  SwUnoInternalPaM aInternalPaM(*pFormat->GetDoc());
588  if (sw::XTextRangeToSwPaM(aInternalPaM, xRange))
589  {
590  SwFormatAnchor aAnchor(pFormat->GetAnchor());
591  aAnchor.SetAnchor(aInternalPaM.Start());
592  pFormat->SetFormatAttr(aAnchor);
593  }
594  }
595  break;
596  case RES_CHAIN:
597  switch (nMemberID)
598  {
599  case MID_CHAIN_PREVNAME:
600  aPropertyName = UNO_NAME_CHAIN_PREV_NAME;
601  break;
602  case MID_CHAIN_NEXTNAME:
603  aPropertyName = UNO_NAME_CHAIN_NEXT_NAME;
604  break;
605  }
606  break;
608  aPropertyName = UNO_NAME_TEXT_VERT_ADJUST;
609  break;
610  case RES_BOX:
611  switch (nMemberID)
612  {
614  aPropertyName = UNO_NAME_LEFT_BORDER_DISTANCE;
615  break;
617  aPropertyName = UNO_NAME_RIGHT_BORDER_DISTANCE;
618  break;
619  case TOP_BORDER_DISTANCE:
620  aPropertyName = UNO_NAME_TOP_BORDER_DISTANCE;
621  break;
623  aPropertyName = UNO_NAME_BOTTOM_BORDER_DISTANCE;
624  break;
625  }
626  break;
627  case RES_OPAQUE:
628  aPropertyName = UNO_NAME_OPAQUE;
629  break;
630  case RES_FRAMEDIR:
631  aPropertyName = UNO_NAME_WRITING_MODE;
632  break;
634  switch (nMemberID)
635  {
636  case MID_ALLOW_OVERLAP:
637  aPropertyName = UNO_NAME_ALLOW_OVERLAP;
638  break;
639  }
640  break;
641  }
642 
643  if (aPropertyName.isEmpty())
644  return;
645 
646  // Position/size should be the text position/size, not the shape one as-is.
647  if (bAdjustX || bAdjustY || bAdjustSize)
648  {
649  tools::Rectangle aRect = getTextRectangle(pShape, /*bAbsolute=*/false);
650  if (!aRect.IsEmpty())
651  {
652  if (bAdjustX || bAdjustY)
653  {
654  sal_Int32 nValue;
655  if (aValue >>= nValue)
656  {
657  if (bAdjustX)
658  nValue += TWIPS_TO_MM(aRect.getX());
659  else if (bAdjustY)
660  nValue += TWIPS_TO_MM(aRect.getY());
661  aValue <<= nValue;
662  }
663  }
664  else if (bAdjustSize)
665  {
666  awt::Size aSize(TWIPS_TO_MM(aRect.getWidth()), TWIPS_TO_MM(aRect.getHeight()));
667  aValue <<= aSize;
668  }
669  }
670  }
671 
672  uno::Reference<beans::XPropertySet> const xPropertySet(
673  SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), uno::UNO_QUERY);
674  xPropertySet->setPropertyValue(aPropertyName, aValue);
675 }
676 
678  std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks)
679 {
680  for (const auto pFormat : rFormats)
681  {
682  if (SwFrameFormat* pTextBox = getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT))
683  rLinks[pFormat] = pTextBox;
684  }
685 }
686 
688  std::map<const SwFrameFormat*, SwFormatContent>& rOldContent)
689 {
690  if (pShape->Which() == RES_DRAWFRMFMT)
691  {
692  if (pShape->GetContent().GetContentIdx())
693  rOldContent.insert(std::make_pair(pShape, pShape->GetContent()));
694  pShape->ResetFormatAttr(RES_CNTNT);
695  }
696 }
697 
698 void SwTextBoxHelper::restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew,
699  SavedLink& rSavedLinks, SavedContent& rResetContent)
700 {
701  std::size_t i = 0;
702  for (const auto& rIt : rOld)
703  {
704  auto aTextBoxIt = rSavedLinks.find(rIt.GetFormat());
705  if (aTextBoxIt != rSavedLinks.end())
706  {
707  std::size_t j = 0;
708  for (const auto& rJt : rOld)
709  {
710  if (rJt.GetFormat() == aTextBoxIt->second)
711  rNew[i]->SetFormatAttr(rNew[j]->GetContent());
712  ++j;
713  }
714  }
715  if (rResetContent.find(rIt.GetFormat()) != rResetContent.end())
716  const_cast<SwFrameFormat*>(rIt.GetFormat())
717  ->SetFormatAttr(rResetContent[rIt.GetFormat()]);
718  ++i;
719  }
720 }
721 
723 {
724  SwFrameFormat* pFormat = getOtherTextBoxFormat(&rShape, RES_DRAWFRMFMT);
725  if (!pFormat)
726  return;
727 
728  SfxItemSet aTextBoxSet(pFormat->GetDoc()->GetAttrPool(), aFrameFormatSetRange);
729 
730  SfxItemIter aIter(rSet);
731  const SfxPoolItem* pItem = aIter.GetCurItem();
732 
733  const RndStdIds aAnchId = rShape.GetAnchor().GetAnchorId();
734  if ((aAnchId == RndStdIds::FLY_AT_PAGE && rShape.GetAnchor().GetPageNum() != 0)
735  || ((aAnchId == RndStdIds::FLY_AT_PARA || aAnchId == RndStdIds::FLY_AT_CHAR)
736  && rShape.GetAnchor().GetContentAnchor()))
737  {
738  SwFormatAnchor aNewAnch = pFormat->GetAnchor();
739  if (rShape.GetAnchor().GetContentAnchor())
740  aNewAnch.SetAnchor(rShape.GetAnchor().GetContentAnchor());
741  if (rShape.GetAnchor().GetPageNum() > 0)
742  aNewAnch.SetPageNum(rShape.GetAnchor().GetPageNum());
743  aNewAnch.SetType(rShape.GetAnchor().GetAnchorId());
744  aTextBoxSet.Put(aNewAnch);
745  }
746  do
747  {
748  switch (pItem->Which())
749  {
750  case RES_VERT_ORIENT:
751  {
752  auto& rOrient = static_cast<const SwFormatVertOrient&>(*pItem);
753  SwFormatVertOrient aOrient(rOrient);
754 
755  tools::Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
756  if (!aRect.IsEmpty())
757  aOrient.SetPos(aOrient.GetPos() + aRect.getY());
758 
759  if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
760  && rShape.GetAnchor().GetPageNum() != 0)
762  aTextBoxSet.Put(aOrient);
763 
764  // restore height (shrunk for extending beyond the page bottom - tdf#91260)
765  SwFormatFrameSize aSize(pFormat->GetFrameSize());
766  if (!aRect.IsEmpty())
767  {
768  aSize.SetHeight(aRect.getHeight());
769  aTextBoxSet.Put(aSize);
770  }
771  }
772  break;
773  case RES_HORI_ORIENT:
774  {
775  auto& rOrient = static_cast<const SwFormatHoriOrient&>(*pItem);
776  SwFormatHoriOrient aOrient(rOrient);
777 
778  tools::Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
779  if (!aRect.IsEmpty())
780  aOrient.SetPos(aOrient.GetPos() + aRect.getX());
781 
782  if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
783  && rShape.GetAnchor().GetPageNum() != 0)
785  aTextBoxSet.Put(aOrient);
786  }
787  break;
788  case RES_FRM_SIZE:
789  {
790  // In case the shape got resized, then we need to adjust both
791  // the position and the size of the textbox (e.g. larger
792  // rounded edges of a rectangle -> need to push right/down the
793  // textbox).
794  SwFormatVertOrient aVertOrient(rShape.GetVertOrient());
795  SwFormatHoriOrient aHoriOrient(rShape.GetHoriOrient());
796  SwFormatFrameSize aSize(pFormat->GetFrameSize());
797 
798  tools::Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
799  if (!aRect.IsEmpty())
800  {
801  aVertOrient.SetPos(aVertOrient.GetPos() + aRect.getY());
802  aTextBoxSet.Put(aVertOrient);
803 
804  aHoriOrient.SetPos(aHoriOrient.GetPos() + aRect.getX());
805  aTextBoxSet.Put(aHoriOrient);
806 
807  aSize.SetWidth(aRect.getWidth());
808  aSize.SetHeight(aRect.getHeight());
809  aTextBoxSet.Put(aSize);
810  }
811  }
812  break;
813  default:
814  SAL_WARN("sw.core", "SwTextBoxHelper::syncFlyFrameAttr: unhandled which-id: "
815  << pItem->Which());
816  break;
817  }
818 
819  pItem = aIter.NextItem();
820  } while (pItem && (0 != pItem->Which()));
821 
822  if (aTextBoxSet.Count())
823  pFormat->GetDoc()->SetFlyFrameAttr(*pFormat, aTextBoxSet);
824 }
825 
826 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long getHeight() const
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
#define MID_CHAIN_NAME
Definition: unomid.h:58
static css::uno::Any getByIndex(SdrPage const *pPage, sal_Int32 nIndex)
Get a shape by index, excluding TextBoxes.
#define UNO_NAME_HORI_ORIENT_POSITION
Definition: unoprnms.hxx:263
#define UNO_NAME_TEXT_RIGHTDIST
SwDocShell * GetDocShell()
Definition: doc.hxx:1348
#define UNO_NAME_BOTTOM_BORDER
Definition: unoprnms.hxx:356
#define UNO_NAME_RELATIVE_HEIGHT_RELATION
Definition: unoprnms.hxx:189
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:2079
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
#define UNO_NAME_IS_FOLLOWING_TEXT_FLOW
Definition: unoprnms.hxx:738
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
static void destroy(SwFrameFormat *pShape)
Destroy a TextBox for a shape.
long getWidth() const
#define UNO_NAME_ALLOW_OVERLAP
Definition: unoprnms.hxx:864
constexpr TypedWhichId< SdrTextVertAdjustItem > RES_TEXT_VERT_ADJUST(130)
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
SwTwips GetPos() const
Definition: fmtornt.hxx:92
#define MID_VERTORIENT_RELATION
Definition: unomid.h:35
static sal_Int32 getOrdNum(const SdrObject *pObject)
Get the order of the shape, excluding TextBoxes.
#define UNO_NAME_TEXT_LOWERDIST
SdrObject * GetObj(size_t nNum) const
Definition: doc.hxx:184
virtual bool IsTextBox() const
size_t GetObjCount() const
OUString GetUniqueFrameName() const
Definition: doclay.cxx:1378
#define RIGHT_BORDER_DISTANCE
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
#define UNO_NAME_WRITING_MODE
Definition: unoprnms.hxx:690
#define UNO_NAME_VERT_ORIENT
Definition: unoprnms.hxx:328
#define UNO_NAME_TEXT_UPPERDIST
long getY() const
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
EmbeddedObjectRef * pObject
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType)
If we have an associated TextFrame, then return that.
static void resetLink(SwFrameFormat *pShape, std::map< const SwFrameFormat *, SwFormatContent > &rOldContent)
Reset the shape -> textbox link on the shape, and save it to the map, so it can be restored later...
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:739
std::map< const SwFrameFormat *, const SwFrameFormat * > SavedLink
Maps a draw format to a fly format.
static css::uno::Any queryInterface(const SwFrameFormat *pShape, const css::uno::Type &rType)
Get interface of a shape's TextBox, if there is any.
void Move(long nHorzMoveDelta, long nVertMoveDelta)
virtual const tools::Rectangle & GetSnapRect() const
bool IsEmpty() const
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
#define UNO_NAME_RELATIVE_WIDTH_RELATION
Definition: unoprnms.hxx:187
#define UNO_NAME_CHAIN_NEXT_NAME
Definition: unoprnms.hxx:230
void SetHoriOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:89
virtual css::uno::Reference< css::uno::XInterface > getUnoShape()
#define MID_FRMSIZE_SIZE
Definition: unomid.h:70
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
SdrPage * getSdrPageFromSdrObject() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
#define MID_FOLLOW_TEXT_FLOW
Definition: unomid.h:152
void SetOtherTextBoxFormat(SwFrameFormat *pFormat)
Definition: atrfrm.cxx:2516
static void restoreLinks(std::set< ZSortFly > &rOld, std::vector< SwFrameFormat * > &rNew, SavedLink &rSavedLinks, SavedContent &rResetContent)
Undo the effect of saveLinks() + individual resetLink() calls.
const OUString & GetName() const
Definition: format.hxx:111
int nCount
#define UNO_NAME_SIZE
Definition: unoprnms.hxx:302
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
Mode eMode
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
#define UNO_NAME_VERT_ORIENT_RELATION
Definition: unoprnms.hxx:331
long Top() const
long getX() const
#define UNO_NAME_TEXT_WRITINGMODE
#define FN_TEXT_RANGE
Definition: cmdid.h:802
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange)
Definition: unoobj2.cxx:952
css::uno::Reference< css::frame::XModel > GetBaseModel() const
constexpr TypedWhichId< SwFormatWrapInfluenceOnObjPos > RES_WRAP_INFLUENCE_ON_OBJPOS(125)
Specific frame formats (frames, DrawObjects).
#define LEFT_BORDER_DISTANCE
static void saveLinks(const SwFrameFormats &rFormats, std::map< const SwFrameFormat *, const SwFrameFormat * > &rLinks)
Saves the current shape -> textbox links in a map, so they can be restored later. ...
static void lcl_queryInterface(const SwFrameFormat *pShape, uno::Any &rAny)
#define UNO_NAME_HORI_ORIENT
Definition: unoprnms.hxx:259
#define MID_CHAIN_NEXTNAME
Definition: unomid.h:57
#define MID_L_MARGIN
#define MID_ANCHOR_ANCHORTYPE
Definition: unomid.h:43
Style of a layout element.
Definition: frmfmt.hxx:57
#define MID_HORIORIENT_POSITION
Definition: unomid.h:40
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
#define UNO_NAME_RIGHT_BORDER
Definition: unoprnms.hxx:354
#define UNO_NAME_FILL_TRANSPARENCE
SwFrameFormat * GetOtherTextBoxFormat() const
Definition: frmfmt.hxx:101
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
#define MID_VERTORIENT_POSITION
Definition: unomid.h:36
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:60
FlyAnchors.
Definition: fmtanchr.hxx:34
void SetRelationOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:90
#define BOTTOM_BORDER_DISTANCE
static void getProperty(SwFrameFormat const *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, css::uno::Any &rValue)
Get a property of the underlying TextFrame.
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
sal_uInt32 GetOrdNum() const
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
#define UNO_NAME_LEFT_BORDER
Definition: unoprnms.hxx:353
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
#define MID_R_MARGIN
#define MID_FRMSIZE_IS_AUTO_HEIGHT
Definition: unomid.h:77
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
#define UNO_NAME_LEFT_BORDER_DISTANCE
Definition: unoprnms.hxx:358
#define UNO_NAME_CHAIN_PREV_NAME
Definition: unoprnms.hxx:231
bool SetFlyFrameAttr(SwFrameFormat &rFlyFormat, SfxItemSet &rSet)
Definition: docfly.cxx:558
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
#define UNO_NAME_RIGHT_MARGIN
Definition: unoprnms.hxx:68
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
#define UNO_NAME_TOP_BORDER
Definition: unoprnms.hxx:355
sal_uInt16 const aFrameFormatSetRange[]
Definition: init.cxx:233
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
#define UNO_NAME_TOP_BORDER_DISTANCE
Definition: unoprnms.hxx:360
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
#define UNO_NAME_TEXT_VERT_ADJUST
Definition: unoprnms.hxx:853
#define UNO_NAME_SURROUND
Definition: unoprnms.hxx:309
#define MID_HORIORIENT_ORIENT
Definition: unomid.h:38
#define MID_FRMSIZE_REL_HEIGHT_RELATION
Definition: unomid.h:88
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:650
constexpr TypedWhichId< SwFormatChain > RES_CHAIN(114)
constexpr sal_Int64 convertTwipToMm100(sal_Int64 n)
#define MID_CHAIN_PREVNAME
Definition: unomid.h:56
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
std::map< const SwFrameFormat *, SwFormatContent > SavedContent
Maps a draw format to content.
iterator find(const OUString &rKey)
Any makeAny(Color const &value)
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
#define UNO_NAME_LEFT_MARGIN
Definition: unoprnms.hxx:67
#define MID_VERTORIENT_ORIENT
Definition: unomid.h:34
unsigned char sal_uInt8
static void create(SwFrameFormat *pShape)
Create a TextBox for a shape.
#define UNO_NAME_BOTTOM_BORDER_DISTANCE
Definition: unoprnms.hxx:361
SwTwips GetPos() const
Definition: fmtornt.hxx:59
#define UNO_NAME_TEXT_LEFTDIST
#define MID_FRMSIZE_REL_WIDTH_RELATION
Definition: unomid.h:87
#define TWIPS_TO_MM(val)
#define UNO_NAME_HORI_ORIENT_RELATION
Definition: unoprnms.hxx:262
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3174
#define TOP_BORDER_DISTANCE
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
#define UNO_NAME_TEXT_AUTOGROWHEIGHT
void * p
void SetHeight(long n)
static css::uno::Reference< css::uno::XInterface > MakeInstance(SwServiceType nObjectType, SwDoc &rDoc)
Definition: unocoll.cxx:512
bool GetTextBounds(tools::Rectangle &rTextBound) const
static sal_Int32 getCount(const SwDoc *pDoc)
Count number of shapes in the document, excluding TextBoxes.
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
static tools::Rectangle getTextRectangle(SwFrameFormat *pShape, bool bAbsolute=true)
Return the textbox rectangle of a draw shape (in twips).
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(157)
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
long Left() const
void SetRelationOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:57
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:93
#define UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT
Definition: unoprnms.hxx:590
#define MID_HORIORIENT_RELATION
Definition: unomid.h:39
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
static void syncFlyFrameAttr(SwFrameFormat &rShape, SfxItemSet const &rSet)
Similar to syncProperty(), but used by the internal API (e.g. for UI purposes).
#define SAL_WARN(area, stream)
static void syncProperty(SwFrameFormat *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any &rValue)
Sync property of TextBox with the one of the shape.
RndStdIds
#define UNO_NAME_SIZE_TYPE
Definition: unoprnms.hxx:257
#define UNO_NAME_RIGHT_BORDER_DISTANCE
Definition: unoprnms.hxx:359
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
#define UNO_NAME_VERT_ORIENT_POSITION
Definition: unoprnms.hxx:330
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(123)
#define UNO_NAME_OPAQUE
Definition: unoprnms.hxx:281
sal_uInt16 Which() const
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2739
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
sal_Int16 nValue
#define MID_ALLOW_OVERLAP
Definition: unomid.h:149
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1516
#define CONVERT_TWIPS
static void getShapeWrapThrough(const SwFrameFormat *pTextBox, bool &rWrapThrough)
If pTextBox is a textbox, then set rWrapThrough to the surround of its shape.