LibreOffice Module sw (master)  1
atrfrm.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 
20 #include <com/sun/star/text/WrapTextMode.hpp>
21 #include <com/sun/star/text/TextContentAnchorType.hpp>
22 #include <com/sun/star/container/XIndexContainer.hpp>
23 #include <com/sun/star/text/TextGridMode.hpp>
24 #include <sal/log.hxx>
25 #include <o3tl/any.hxx>
26 #include <o3tl/safeint.hxx>
27 #include <svtools/unoimap.hxx>
28 #include <vcl/imap.hxx>
29 #include <vcl/imapobj.hxx>
30 #include <unotools/intlwrapper.hxx>
31 #include <unotools/syslocale.hxx>
32 #include <frmfmt.hxx>
33 #include <unocoll.hxx>
34 #include <unosett.hxx>
35 #include <fmtclds.hxx>
36 #include <fmtornt.hxx>
37 #include <fmthdft.hxx>
38 #include <fmtpdsc.hxx>
39 #include <fmtcntnt.hxx>
40 #include <fmtfsize.hxx>
41 #include <fmtfordr.hxx>
42 #include <fmtsrnd.hxx>
43 #include <fmtlsplt.hxx>
44 #include <fmtrowsplt.hxx>
45 #include <fmtftntx.hxx>
46 #include <fmteiro.hxx>
47 #include <fmturl.hxx>
48 #include <fmtcnct.hxx>
49 #include <section.hxx>
50 #include <fmtline.hxx>
51 #include <tgrditem.hxx>
52 #include <hfspacingitem.hxx>
54 #include <IDocumentUndoRedo.hxx>
57 #include <pagefrm.hxx>
58 #include <rootfrm.hxx>
59 #include <cntfrm.hxx>
60 #include <notxtfrm.hxx>
61 #include <txtfrm.hxx>
62 #include <crsrsh.hxx>
63 #include <dflyobj.hxx>
64 #include <dcontact.hxx>
65 #include <frmtool.hxx>
66 #include <flyfrms.hxx>
67 #include <pagedesc.hxx>
68 #include <grfatr.hxx>
69 #include <ndnotxt.hxx>
70 #include <node2lay.hxx>
71 #include <fmtclbl.hxx>
72 #include <swunohelper.hxx>
73 #include <unoframe.hxx>
74 #include <SwStyleNameMapper.hxx>
75 #include <editeng/brushitem.hxx>
76 #include <vcl/GraphicObject.hxx>
77 #include <unomid.h>
78 #include <strings.hrc>
79 #include <svx/svdundo.hxx>
80 #include <sortedobjs.hxx>
81 #include <HandleAnchorNodeChg.hxx>
82 #include <calbck.hxx>
83 #include <pagedeschint.hxx>
84 #include <drawdoc.hxx>
85 #include <hints.hxx>
86 #include <frameformats.hxx>
87 
88 #include <ndtxt.hxx>
89 
91 #include <svl/itemiter.hxx>
92 #include <wrtsh.hxx>
93 #include <txtfld.hxx>
94 #include <cellatr.hxx>
95 
96 using namespace ::com::sun::star;
97 
98 namespace sw {
99 
100 bool GetAtPageRelOrientation(sal_Int16 & rOrientation, bool const isIgnorePrintArea)
101 {
102  switch (rOrientation)
103  {
104  case text::RelOrientation::CHAR:
105  case text::RelOrientation::FRAME:
106  rOrientation = text::RelOrientation::PAGE_FRAME;
107  return true;
108  case text::RelOrientation::PRINT_AREA:
109  if (isIgnorePrintArea)
110  {
111  return false;
112  }
113  else
114  {
115  rOrientation = text::RelOrientation::PAGE_PRINT_AREA;
116  return true;
117  }
118  case text::RelOrientation::FRAME_LEFT:
119  rOrientation = text::RelOrientation::PAGE_LEFT;
120  return true;
121  case text::RelOrientation::FRAME_RIGHT:
122  rOrientation = text::RelOrientation::PAGE_RIGHT;
123  return true;
124  default:
125  return false;
126  }
127 }
128 
129 } // namespace sw
130 
132 
133 static sal_Int16 lcl_IntToRelation(const uno::Any& rVal)
134 {
135  sal_Int16 nVal = text::RelOrientation::FRAME;
136  if (!(rVal >>= nVal))
137  SAL_WARN("sw.core", "lcl_IntToRelation: read from Any failed!");
138  return nVal;
139 }
140 
141 static void lcl_DelHFFormat( SwClient *pToRemove, SwFrameFormat *pFormat )
142 {
143  //If the client is the last one who uses this format, then we have to delete
144  //it - before this is done, we may need to delete the content-section.
145  SwDoc* pDoc = pFormat->GetDoc();
146  pFormat->Remove( pToRemove );
147  if( pDoc->IsInDtor() )
148  {
149  delete pFormat;
150  return;
151  }
152 
153  // Anything other than frames registered?
154  bool bDel = true;
155  {
156  // nested scope because DTOR of SwClientIter resets the flag bTreeChg.
157  // It's suboptimal if the format is deleted beforehand.
158  SwIterator<SwClient,SwFrameFormat> aIter(*pFormat);
159  for(SwClient* pLast = aIter.First(); bDel && pLast; pLast = aIter.Next())
160  if (dynamic_cast<const SwFrame*>(pLast) == nullptr)
161  bDel = false;
162  }
163 
164  if ( !bDel )
165  return;
166 
167  // If there is a Cursor registered in one of the nodes, we need to call the
168  // ParkCursor in an (arbitrary) shell.
169  SwFormatContent& rCnt = const_cast<SwFormatContent&>(pFormat->GetContent());
170  if ( rCnt.GetContentIdx() )
171  {
172  SwNode *pNode = nullptr;
173  {
174  // #i92993#
175  // Begin with start node of page header/footer to assure that
176  // complete content is checked for cursors and the complete content
177  // is deleted on below made method call <pDoc->getIDocumentContentOperations().DeleteSection(pNode)>
178  SwNodeIndex aIdx( *rCnt.GetContentIdx(), 0 );
179  // If there is a Cursor registered in one of the nodes, we need to call the
180  // ParkCursor in an (arbitrary) shell.
181  pNode = & aIdx.GetNode();
182  sal_uInt32 nEnd = pNode->EndOfSectionIndex();
183  while ( aIdx < nEnd )
184  {
185  if ( pNode->IsContentNode() &&
186  static_cast<SwContentNode*>(pNode)->HasWriterListeners() )
187  {
188  SwCursorShell *pShell = SwIterator<SwCursorShell,SwContentNode>( *static_cast<SwContentNode*>(pNode) ).First();
189  if( pShell )
190  {
191  pShell->ParkCursor( aIdx );
192  aIdx = nEnd-1;
193  }
194  }
195  ++aIdx;
196  pNode = & aIdx.GetNode();
197  }
198  }
199  rCnt.SetNewContentIdx( nullptr );
200 
201  // When deleting a header/footer-format, we ALWAYS need to disable
202  // the undo function (Bug 31069)
203  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
204 
205  OSL_ENSURE( pNode, "A big problem." );
207  }
208  delete pFormat;
209 }
210 
212  // Don't inherit the SvxSizeItem override (might or might not be relevant; added "just in case"
213  // when changing SwFormatFrameSize to derive from SvxSizeItem instead of directly from
214  // SfxPoolItem):
215  return SfxPoolItem::ScaleMetrics(lMult, lDiv);
216 }
217 
219  // Don't inherit the SvxSizeItem override (might or might not be relevant; added "just in case"
220  // when changing SwFormatFrameSize to derive from SvxSizeItem instead of directly from
221  // SfxPoolItem):
222  return SfxPoolItem::HasMetrics();
223 }
224 
225 // Partially implemented inline in hxx
227  : SvxSizeItem( RES_FRM_SIZE, {nWidth, nHeight} ),
228  m_eFrameHeightType( eSize ),
229  m_eFrameWidthType( SwFrameSize::Fixed )
230 {
231  m_nWidthPercent = m_eWidthPercentRelation = m_nHeightPercent = m_eHeightPercentRelation = 0;
232 }
233 
234 bool SwFormatFrameSize::operator==( const SfxPoolItem& rAttr ) const
235 {
236  assert(SfxPoolItem::operator==(rAttr));
237  return( m_eFrameHeightType == static_cast<const SwFormatFrameSize&>(rAttr).m_eFrameHeightType &&
238  m_eFrameWidthType == static_cast<const SwFormatFrameSize&>(rAttr).m_eFrameWidthType &&
239  SvxSizeItem::operator==(rAttr)&&
240  m_nWidthPercent == static_cast<const SwFormatFrameSize&>(rAttr).GetWidthPercent() &&
241  m_eWidthPercentRelation == static_cast<const SwFormatFrameSize&>(rAttr).GetWidthPercentRelation() &&
242  m_nHeightPercent == static_cast<const SwFormatFrameSize&>(rAttr).GetHeightPercent() &&
243  m_eHeightPercentRelation == static_cast<const SwFormatFrameSize&>(rAttr).GetHeightPercentRelation() );
244 }
245 
247 {
248  return new SwFormatFrameSize( *this );
249 }
250 
251 bool SwFormatFrameSize::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
252 {
253  // here we convert always!
254  nMemberId &= ~CONVERT_TWIPS;
255  switch ( nMemberId )
256  {
257  case MID_FRMSIZE_SIZE:
258  {
259  awt::Size aTmp;
260  aTmp.Height = convertTwipToMm100(GetHeight());
261  aTmp.Width = convertTwipToMm100(GetWidth());
262  rVal <<= aTmp;
263  }
264  break;
266  rVal <<= static_cast<sal_Int16>(GetHeightPercent() != SwFormatFrameSize::SYNCED ? GetHeightPercent() : 0);
267  break;
269  rVal <<= GetHeightPercentRelation();
270  break;
272  rVal <<= static_cast<sal_Int16>(GetWidthPercent() != SwFormatFrameSize::SYNCED ? GetWidthPercent() : 0);
273  break;
275  rVal <<= GetWidthPercentRelation();
276  break;
279  break;
282  break;
283  case MID_FRMSIZE_WIDTH :
284  rVal <<= static_cast<sal_Int32>(convertTwipToMm100(GetWidth()));
285  break;
286  case MID_FRMSIZE_HEIGHT:
287  // #95848# returned size should never be zero.
288  // (there was a bug that allowed for setting height to 0.
289  // Thus there some documents existing with that not allowed
290  // attribute value which may cause problems on import.)
291  rVal <<= static_cast<sal_Int32>(convertTwipToMm100(GetHeight() < MINLAY ? MINLAY : GetHeight() ));
292  break;
294  rVal <<= static_cast<sal_Int16>(GetHeightSizeType());
295  break;
298  break;
300  rVal <<= static_cast<sal_Int16>(GetWidthSizeType());
301  break;
302  }
303  return true;
304 }
305 
306 bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
307 {
308  bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
309  nMemberId &= ~CONVERT_TWIPS;
310  bool bRet = true;
311  switch ( nMemberId )
312  {
313  case MID_FRMSIZE_SIZE:
314  {
315  awt::Size aVal;
316  if(!(rVal >>= aVal))
317  bRet = false;
318  else
319  {
320  Size aTmp(aVal.Width, aVal.Height);
321  if(bConvert)
322  {
323  aTmp.setHeight( convertMm100ToTwip(aTmp.Height()) );
324  aTmp.setWidth( convertMm100ToTwip(aTmp.Width()) );
325  }
326  SetSize(aTmp);
327  }
328  }
329  break;
331  {
332  sal_Int16 nSet = 0;
333  rVal >>= nSet;
334  if(nSet >= 0 && nSet < SwFormatFrameSize::SYNCED)
335  SetHeightPercent(static_cast<sal_uInt8>(nSet));
336  else
337  bRet = false;
338  }
339  break;
341  {
342  sal_Int16 eSet = 0;
343  rVal >>= eSet;
345  }
346  break;
348  {
349  sal_Int16 nSet = 0;
350  rVal >>= nSet;
351  if(nSet >= 0 && nSet < SwFormatFrameSize::SYNCED)
352  SetWidthPercent(static_cast<sal_uInt8>(nSet));
353  else
354  bRet = false;
355  }
356  break;
358  {
359  sal_Int16 eSet = 0;
360  rVal >>= eSet;
362  }
363  break;
365  {
366  bool bSet = *o3tl::doAccess<bool>(rVal);
367  if(bSet)
370  SetHeightPercent( 0 );
371  }
372  break;
374  {
375  bool bSet = *o3tl::doAccess<bool>(rVal);
376  if(bSet)
379  SetWidthPercent(0);
380  }
381  break;
382  case MID_FRMSIZE_WIDTH :
383  {
384  sal_Int32 nWd = 0;
385  if(rVal >>= nWd)
386  {
387  if(bConvert)
388  nWd = convertMm100ToTwip(nWd);
389  if(nWd < MINLAY)
390  nWd = MINLAY;
391  SetWidth(nWd);
392  }
393  else
394  bRet = false;
395  }
396  break;
397  case MID_FRMSIZE_HEIGHT:
398  {
399  sal_Int32 nHg = 0;
400  if(rVal >>= nHg)
401  {
402  if(bConvert)
403  nHg = convertMm100ToTwip(nHg);
404  if(nHg < MINLAY)
405  nHg = MINLAY;
406  SetHeight(nHg);
407  }
408  else
409  bRet = false;
410  }
411  break;
413  {
414  sal_Int16 nType = 0;
415  if((rVal >>= nType) && nType >= 0 && nType <= static_cast<int>(SwFrameSize::Minimum) )
416  {
417  SetHeightSizeType(static_cast<SwFrameSize>(nType));
418  }
419  else
420  bRet = false;
421  }
422  break;
424  {
425  bool bSet = *o3tl::doAccess<bool>(rVal);
427  }
428  break;
430  {
431  sal_Int16 nType = 0;
432  if((rVal >>= nType) && nType >= 0 && nType <= static_cast<int>(SwFrameSize::Minimum) )
433  {
434  SetWidthSizeType(static_cast<SwFrameSize>(nType));
435  }
436  else
437  bRet = false;
438  }
439  break;
440  default:
441  bRet = false;
442  }
443  return bRet;
444 }
445 
447 {
448  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatFrameSize"));
449  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
450 
451  std::stringstream aSize;
452  aSize << GetSize();
453  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("size"), BAD_CAST(aSize.str().c_str()));
454 
455  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eFrameHeightType"), BAD_CAST(OString::number(static_cast<int>(m_eFrameHeightType)).getStr()));
456  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eFrameWidthType"), BAD_CAST(OString::number(static_cast<int>(m_eFrameWidthType)).getStr()));
457  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidthPercent"), BAD_CAST(OString::number(m_nWidthPercent).getStr()));
458  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eWidthPercentRelation"), BAD_CAST(OString::number(m_eWidthPercentRelation).getStr()));
459  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nHeightPercent"), BAD_CAST(OString::number(m_nHeightPercent).getStr()));
460  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eHeightPercentRelation"), BAD_CAST(OString::number(m_eHeightPercentRelation).getStr()));
461 
462  xmlTextWriterEndElement(pWriter);
463 }
464 
465 // Partially implemented inline in hxx
467  : SfxEnumItem( RES_FILL_ORDER, nFO )
468 {}
469 
471 {
472  return new SwFormatFillOrder( GetValue() );
473 }
474 
476 {
478 }
479 
480 // Partially implemented inline in hxx
482  : SfxPoolItem( RES_HEADER ),
483  SwClient( pHeaderFormat ),
484  m_bActive( pHeaderFormat )
485 {
486 }
487 
489  : SfxPoolItem( RES_HEADER ),
490  SwClient( const_cast<sw::BroadcastingModify*>(static_cast<const sw::BroadcastingModify*>(rCpy.GetRegisteredIn())) ),
491  m_bActive( rCpy.IsActive() )
492 {
493 }
494 
496  : SfxPoolItem( RES_HEADER ),
497  SwClient( nullptr ),
498  m_bActive( bOn )
499 {
500 }
501 
503 {
504  if ( GetHeaderFormat() )
505  lcl_DelHFFormat( this, GetHeaderFormat() );
506 }
507 
508 bool SwFormatHeader::operator==( const SfxPoolItem& rAttr ) const
509 {
510  assert(SfxPoolItem::operator==(rAttr));
511  return ( GetRegisteredIn() == static_cast<const SwFormatHeader&>(rAttr).GetRegisteredIn() &&
512  m_bActive == static_cast<const SwFormatHeader&>(rAttr).IsActive() );
513 }
514 
516 {
517  return new SwFormatHeader( *this );
518 }
519 
521 {
522  rFormat.Add(this);
523 }
524 
525 // Partially implemented inline in hxx
527  : SfxPoolItem( RES_FOOTER ),
528  SwClient( pFooterFormat ),
529  m_bActive( pFooterFormat )
530 {
531 }
532 
534  : SfxPoolItem( RES_FOOTER ),
535  SwClient( const_cast<sw::BroadcastingModify*>(static_cast<const sw::BroadcastingModify*>(rCpy.GetRegisteredIn())) ),
536  m_bActive( rCpy.IsActive() )
537 {
538 }
539 
541  : SfxPoolItem( RES_FOOTER ),
542  SwClient( nullptr ),
543  m_bActive( bOn )
544 {
545 }
546 
548 {
549  if ( GetFooterFormat() )
550  lcl_DelHFFormat( this, GetFooterFormat() );
551 }
552 
554 {
555  rFormat.Add(this);
556 }
557 
558 bool SwFormatFooter::operator==( const SfxPoolItem& rAttr ) const
559 {
560  assert(SfxPoolItem::operator==(rAttr));
561  return ( GetRegisteredIn() == static_cast<const SwFormatFooter&>(rAttr).GetRegisteredIn() &&
562  m_bActive == static_cast<const SwFormatFooter&>(rAttr).IsActive() );
563 }
564 
566 {
567  return new SwFormatFooter( *this );
568 }
569 
570 // Partially implemented inline in hxx
573 {
574  m_pStartNode.reset( rCpy.GetContentIdx() ?
575  new SwNodeIndex( *rCpy.GetContentIdx() ) : nullptr);
576 }
577 
580 {
581  m_pStartNode.reset( pStartNd ? new SwNodeIndex( *pStartNd ) : nullptr);
582 }
583 
585 {
586 }
587 
589 {
590  m_pStartNode.reset( pIdx ? new SwNodeIndex( *pIdx ) : nullptr );
591 }
592 
593 bool SwFormatContent::operator==( const SfxPoolItem& rAttr ) const
594 {
595  assert(SfxPoolItem::operator==(rAttr));
596  if( static_cast<bool>(m_pStartNode) != static_cast<bool>(static_cast<const SwFormatContent&>(rAttr).m_pStartNode) )
597  return false;
598  if( m_pStartNode )
599  return ( *m_pStartNode == *static_cast<const SwFormatContent&>(rAttr).GetContentIdx() );
600  return true;
601 }
602 
604 {
605  return new SwFormatContent( *this );
606 }
607 
609 {
610  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatContent"));
611  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
612  if (m_pStartNode)
613  {
614  xmlTextWriterWriteAttribute(
615  pWriter, BAD_CAST("startNode"),
616  BAD_CAST(OString::number(m_pStartNode->GetNode().GetIndex()).getStr()));
617  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("startNodePtr"), "%p",
618  &m_pStartNode->GetNode());
619  }
620  xmlTextWriterEndElement(pWriter);
621 }
622 
623 // Partially implemented inline in hxx
626  SwClient( const_cast<SwPageDesc*>(rCpy.GetPageDesc()) ),
627  m_oNumOffset( rCpy.m_oNumOffset ),
628  m_pDefinedIn( nullptr )
629 {
630 }
631 
634  SwClient( const_cast<SwPageDesc*>(pDesc) ),
635  m_pDefinedIn( nullptr )
636 {
637 }
638 
640 {
641  if(this == &rCpy)
642  return *this;
643 
644  if (rCpy.GetPageDesc())
645  RegisterToPageDesc(*const_cast<SwPageDesc*>(rCpy.GetPageDesc()));
646  m_oNumOffset = rCpy.m_oNumOffset;
647  m_pDefinedIn = nullptr;
648 
649  return *this;
650 }
651 
653 
655 {
656  return (GetRegisteredIn() != nullptr);
657 }
658 
659 bool SwFormatPageDesc::operator==( const SfxPoolItem& rAttr ) const
660 {
661  assert(SfxPoolItem::operator==(rAttr));
662  return ( m_pDefinedIn == static_cast<const SwFormatPageDesc&>(rAttr).m_pDefinedIn ) &&
663  ( m_oNumOffset == static_cast<const SwFormatPageDesc&>(rAttr).m_oNumOffset ) &&
664  ( GetPageDesc() == static_cast<const SwFormatPageDesc&>(rAttr).GetPageDesc() );
665 }
666 
668 {
669  return new SwFormatPageDesc( *this );
670 }
671 
673 {
674  if (const SwPageDescHint* pHint = dynamic_cast<const SwPageDescHint*>(&rHint))
675  {
676  // mba: shouldn't that be broadcasted also?
677  SwFormatPageDesc aDfltDesc(pHint->GetPageDesc());
678  SwPageDesc* pDesc = pHint->GetPageDesc();
679  const sw::BroadcastingModify* pMod = GetDefinedIn();
680  if(pMod)
681  {
682  if(auto pContentNode = dynamic_cast<const SwContentNode*>(pMod))
683  const_cast<SwContentNode*>(pContentNode)->SetAttr(aDfltDesc);
684  else if(auto pFormat = dynamic_cast<const SwFormat*>(pMod))
685  const_cast<SwFormat*>(pFormat)->SetFormatAttr( aDfltDesc );
686  else
687  {
688  SAL_WARN("sw.core", "SwFormatPageDesc registered at " << typeid(pMod).name() << ".");
689  RegisterToPageDesc(*pDesc);
690  }
691  }
692  else
693  // there could be an Undo-copy
694  RegisterToPageDesc(*pDesc);
695  }
696  else if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
697  {
698  if(RES_OBJECTDYING == pLegacy->GetWhich())
699  {
700  m_pDefinedIn = nullptr;
701  EndListeningAll();
702  }
703  }
704 }
705 
707 {
708  rDesc.Add( this );
709 }
710 
711 bool SwFormatPageDesc::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
712 {
713  // here we convert always!
714  nMemberId &= ~CONVERT_TWIPS;
715  bool bRet = true;
716  switch ( nMemberId )
717  {
719  {
720  ::std::optional<sal_uInt16> oOffset = GetNumOffset();
721  if (oOffset)
722  {
723  rVal <<= static_cast<sal_Int16>(*oOffset);
724  }
725  else
726  {
727  rVal.clear();
728  }
729  }
730  break;
731 
733  {
734  const SwPageDesc* pDesc = GetPageDesc();
735  if( pDesc )
736  {
737  OUString aString;
739  rVal <<= aString;
740  }
741  else
742  rVal.clear();
743  }
744  break;
745  default:
746  OSL_ENSURE( false, "unknown MemberId" );
747  bRet = false;
748  }
749  return bRet;
750 }
751 
752 bool SwFormatPageDesc::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
753 {
754  // here we convert always!
755  nMemberId &= ~CONVERT_TWIPS;
756  bool bRet = true;
757  switch ( nMemberId )
758  {
760  {
761  sal_Int16 nOffset = 0;
762  if (!rVal.hasValue())
763  {
764  SetNumOffset(std::nullopt);
765  }
766  else if (rVal >>= nOffset)
767  SetNumOffset( nOffset );
768  else
769  bRet = false;
770  }
771  break;
772 
774  /* Doesn't work, because the attribute doesn't need the name but a
775  * pointer to the PageDesc (it's a client of it). The pointer can
776  * only be requested from the document using the name.
777  */
778  default:
779  OSL_ENSURE( false, "unknown MemberId" );
780  bRet = false;
781  }
782  return bRet;
783 }
784 
786 {
787  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatPageDesc"));
788  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
789  if (m_oNumOffset)
790  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("oNumOffset"), BAD_CAST(OString::number(*m_oNumOffset).getStr()));
791  else
792  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("oNumOffset"), BAD_CAST("none"));
793  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("pPageDesc"), "%p", GetPageDesc());
794  if (const SwPageDesc* pPageDesc = GetPageDesc())
795  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(pPageDesc->GetName().toUtf8().getStr()));
796  xmlTextWriterEndElement(pWriter);
797 }
798 
799 // class SwFormatCol
800 // Partially implemented inline in hxx
801 
803  m_nWish ( 0 ),
804  m_nLeft ( 0 ),
805  m_nRight( 0 )
806 {
807 }
808 
809 bool SwColumn::operator==( const SwColumn &rCmp ) const
810 {
811  return m_nWish == rCmp.GetWishWidth() &&
812  GetLeft() == rCmp.GetLeft() &&
813  GetRight() == rCmp.GetRight();
814 }
815 
817 {
818  xmlTextWriterStartElement(pWriter, BAD_CAST("SwColumn"));
819  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWish"), BAD_CAST(OString::number(m_nWish).getStr()));
820  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nUpper"), BAD_CAST(OString::number(0).getStr()));
821  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLower"), BAD_CAST(OString::number(0).getStr()));
822  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLeft"), BAD_CAST(OString::number(m_nLeft).getStr()));
823  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nRight"), BAD_CAST(OString::number(m_nRight).getStr()));
824  xmlTextWriterEndElement(pWriter);
825 }
826 
828  : SfxPoolItem( RES_COL ),
829  m_eLineStyle( rCpy.m_eLineStyle ),
830  m_nLineWidth( rCpy.m_nLineWidth),
831  m_aLineColor( rCpy.m_aLineColor),
832  m_nLineHeight( rCpy.GetLineHeight() ),
833  m_eAdj( rCpy.GetLineAdj() ),
834  m_nWidth( rCpy.GetWishWidth() ),
835  m_aWidthAdjustValue( rCpy.m_aWidthAdjustValue ),
836  m_bOrtho( rCpy.IsOrtho() )
837 {
838  m_aColumns.reserve(rCpy.GetNumCols());
839  for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i )
840  {
841  m_aColumns.emplace_back(rCpy.GetColumns()[i] );
842  }
843 }
844 
846 
848 {
849  if (this != &rCpy)
850  {
851  m_eLineStyle = rCpy.m_eLineStyle;
852  m_nLineWidth = rCpy.m_nLineWidth;
853  m_aLineColor = rCpy.m_aLineColor;
854  m_nLineHeight = rCpy.GetLineHeight();
855  m_eAdj = rCpy.GetLineAdj();
856  m_nWidth = rCpy.GetWishWidth();
858  m_bOrtho = rCpy.IsOrtho();
859 
860  m_aColumns.clear();
861  for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i )
862  {
863  m_aColumns.emplace_back(rCpy.GetColumns()[i] );
864  }
865  }
866  return *this;
867 }
868 
870  : SfxPoolItem( RES_COL )
871  , m_eLineStyle( SvxBorderLineStyle::NONE)
872  ,
873  m_nLineWidth(0),
874  m_nLineHeight( 100 ),
875  m_eAdj( COLADJ_NONE ),
876  m_nWidth( USHRT_MAX ),
877  m_aWidthAdjustValue( 0 ),
878  m_bOrtho( true )
879 {
880 }
881 
882 bool SwFormatCol::operator==( const SfxPoolItem& rAttr ) const
883 {
884  assert(SfxPoolItem::operator==(rAttr));
885  const SwFormatCol &rCmp = static_cast<const SwFormatCol&>(rAttr);
886  if( !(m_eLineStyle == rCmp.m_eLineStyle &&
887  m_nLineWidth == rCmp.m_nLineWidth &&
888  m_aLineColor == rCmp.m_aLineColor &&
889  m_nLineHeight == rCmp.GetLineHeight() &&
890  m_eAdj == rCmp.GetLineAdj() &&
891  m_nWidth == rCmp.GetWishWidth() &&
892  m_bOrtho == rCmp.IsOrtho() &&
893  m_aColumns.size() == rCmp.GetNumCols() &&
895  ) )
896  return false;
897 
898  for ( size_t i = 0; i < m_aColumns.size(); ++i )
899  if ( !(m_aColumns[i] == rCmp.GetColumns()[i]) )
900  return false;
901 
902  return true;
903 }
904 
906 {
907  return new SwFormatCol( *this );
908 }
909 
910 sal_uInt16 SwFormatCol::GetGutterWidth( bool bMin ) const
911 {
912  sal_uInt16 nRet = 0;
913  if ( m_aColumns.size() == 2 )
914  nRet = m_aColumns[0].GetRight() + m_aColumns[1].GetLeft();
915  else if ( m_aColumns.size() > 2 )
916  {
917  bool bSet = false;
918  for ( size_t i = 1; i+1 < m_aColumns.size(); ++i )
919  {
920  const sal_uInt16 nTmp = m_aColumns[i].GetRight() + m_aColumns[i+1].GetLeft();
921  if ( bSet )
922  {
923  if ( nTmp != nRet )
924  {
925  if ( !bMin )
926  return USHRT_MAX;
927  if ( nRet > nTmp )
928  nRet = nTmp;
929  }
930  }
931  else
932  {
933  bSet = true;
934  nRet = nTmp;
935  }
936  }
937  }
938  return nRet;
939 }
940 
941 void SwFormatCol::SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct )
942 {
943  if ( m_bOrtho )
944  Calc( nNew, nAct );
945  else
946  {
947  sal_uInt16 nHalf = nNew / 2;
948  for (size_t i = 0; i < m_aColumns.size(); ++i)
949  {
950  SwColumn &rCol = m_aColumns[i];
951  rCol.SetLeft(nHalf);
952  rCol.SetRight(nHalf);
953  if ( i == 0 )
954  rCol.SetLeft(0);
955  else if ( i+1 == m_aColumns.size() )
956  rCol.SetRight(0);
957  }
958  }
959 }
960 
961 void SwFormatCol::Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct )
962 {
963  // Deleting seems to be a bit radical on the first sight; but otherwise we
964  // have to initialize all values of the remaining SwColumns.
965  m_aColumns.clear();
966  for ( sal_uInt16 i = 0; i < nNumCols; ++i )
967  {
968  m_aColumns.emplace_back( );
969  }
970  m_bOrtho = true;
972  if( nNumCols )
973  Calc( nGutterWidth, nAct );
974 }
975 
976 void SwFormatCol::SetOrtho( bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct )
977 {
978  m_bOrtho = bNew;
979  if ( bNew && !m_aColumns.empty() )
980  Calc( nGutterWidth, nAct );
981 }
982 
983 sal_uInt16 SwFormatCol::CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const
984 {
985  assert(nCol < m_aColumns.size());
986  if ( m_nWidth != nAct )
987  {
988  tools::Long nW = m_aColumns[nCol].GetWishWidth();
989  nW *= nAct;
990  nW /= m_nWidth;
991  return sal_uInt16(nW);
992  }
993  else
994  return m_aColumns[nCol].GetWishWidth();
995 }
996 
997 sal_uInt16 SwFormatCol::CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const
998 {
999  assert(nCol < m_aColumns.size());
1000  sal_uInt16 nRet = CalcColWidth( nCol, nAct );
1001  const SwColumn *pCol = &m_aColumns[nCol];
1002  nRet = nRet - pCol->GetLeft();
1003  nRet = nRet - pCol->GetRight();
1004  return nRet;
1005 }
1006 
1007 void SwFormatCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct )
1008 {
1009  if (!GetNumCols())
1010  return;
1011 
1012  //First set the column widths with the current width, then calculate the
1013  //column's requested width using the requested total width.
1014  const sal_uInt16 nGutterHalf = nGutterWidth ? nGutterWidth / 2 : 0;
1015 
1016  //Width of PrtAreas is totalwidth - spacings / count
1017  sal_uInt16 nSpacings;
1018  bool bFail = o3tl::checked_multiply<sal_uInt16>(GetNumCols() - 1, nGutterWidth, nSpacings);
1019  if (bFail)
1020  {
1021  SAL_WARN("sw.core", "SwFormatVertOrient::Calc: overflow");
1022  return;
1023  }
1024 
1025  const sal_uInt16 nPrtWidth = (nAct - nSpacings) / GetNumCols();
1026  sal_uInt16 nAvail = nAct;
1027 
1028  //The first column is PrtWidth + (gap width / 2)
1029  const sal_uInt16 nLeftWidth = nPrtWidth + nGutterHalf;
1030  SwColumn &rFirstCol = m_aColumns.front();
1031  rFirstCol.SetWishWidth(nLeftWidth);
1032  rFirstCol.SetRight(nGutterHalf);
1033  rFirstCol.SetLeft(0);
1034  nAvail = nAvail - nLeftWidth;
1035 
1036  //Column 2 to n-1 is PrtWidth + gap width
1037  const sal_uInt16 nMidWidth = nPrtWidth + nGutterWidth;
1038 
1039  for (sal_uInt16 i = 1; i < GetNumCols()-1; ++i)
1040  {
1041  SwColumn &rCol = m_aColumns[i];
1042  rCol.SetWishWidth(nMidWidth);
1043  rCol.SetLeft(nGutterHalf);
1044  rCol.SetRight(nGutterHalf);
1045  nAvail = nAvail - nMidWidth;
1046  }
1047 
1048  //The last column is equivalent to the first one - to compensate rounding
1049  //errors we add the remaining space of the other columns to the last one.
1050  SwColumn &rLastCol = m_aColumns.back();
1051  rLastCol.SetWishWidth(nAvail);
1052  rLastCol.SetLeft(nGutterHalf);
1053  rLastCol.SetRight(0);
1054 
1055  //Convert the current width to the requested width.
1056  for (SwColumn &rCol: m_aColumns)
1057  {
1058  tools::Long nTmp = rCol.GetWishWidth();
1059  nTmp *= GetWishWidth();
1060  nTmp /= nAct;
1061  rCol.SetWishWidth(sal_uInt16(nTmp));
1062  }
1063 }
1064 
1065 bool SwFormatCol::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1066 {
1067  // here we convert always!
1068  nMemberId &= ~CONVERT_TWIPS;
1069  if(MID_COLUMN_SEPARATOR_LINE == nMemberId)
1070  {
1071  OSL_FAIL("not implemented");
1072  }
1073  else
1074  {
1075  uno::Reference< text::XTextColumns > xCols = new SwXTextColumns(*this);
1076  rVal <<= xCols;
1077  }
1078  return true;
1079 }
1080 
1081 bool SwFormatCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1082 {
1083  // here we convert always!
1084  nMemberId &= ~CONVERT_TWIPS;
1085  bool bRet = false;
1086  if(MID_COLUMN_SEPARATOR_LINE == nMemberId)
1087  {
1088  OSL_FAIL("not implemented");
1089  }
1090  else
1091  {
1092  uno::Reference< text::XTextColumns > xCols;
1093  rVal >>= xCols;
1094  if(xCols.is())
1095  {
1096  uno::Sequence<text::TextColumn> aSetColumns = xCols->getColumns();
1097  const text::TextColumn* pArray = aSetColumns.getConstArray();
1098  m_aColumns.clear();
1099  //max count is 64k here - this is something the array can't do
1100  sal_uInt16 nCount = std::min( static_cast<sal_uInt16>(aSetColumns.getLength()),
1101  sal_uInt16(0x3fff) );
1102  sal_uInt16 nWidthSum = 0;
1103  // #101224# one column is no column
1104 
1105  if(nCount > 1)
1106  for(sal_uInt16 i = 0; i < nCount; i++)
1107  {
1108  SwColumn aCol;
1109  aCol.SetWishWidth(pArray[i].Width );
1110  nWidthSum = nWidthSum + pArray[i].Width;
1111  aCol.SetLeft (convertMm100ToTwip(pArray[i].LeftMargin));
1112  aCol.SetRight(convertMm100ToTwip(pArray[i].RightMargin));
1113  m_aColumns.insert(m_aColumns.begin() + i, aCol);
1114  }
1115  bRet = true;
1116  m_nWidth = nWidthSum;
1117  m_bOrtho = false;
1118 
1119  auto pSwColums = comphelper::getUnoTunnelImplementation<SwXTextColumns>(xCols);
1120  if(pSwColums)
1121  {
1122  m_bOrtho = pSwColums->IsAutomaticWidth();
1123  m_nLineWidth = pSwColums->GetSepLineWidth();
1124  m_aLineColor = pSwColums->GetSepLineColor();
1125  m_nLineHeight = pSwColums->GetSepLineHeightRelative();
1126  switch ( pSwColums->GetSepLineStyle() )
1127  {
1128  default:
1129  case 0: m_eLineStyle = SvxBorderLineStyle::NONE; break;
1130  case 1: m_eLineStyle = SvxBorderLineStyle::SOLID; break;
1131  case 2: m_eLineStyle = SvxBorderLineStyle::DOTTED; break;
1132  case 3: m_eLineStyle = SvxBorderLineStyle::DASHED; break;
1133  }
1134  if(!pSwColums->GetSepLineIsOn())
1135  m_eAdj = COLADJ_NONE;
1136  else switch(pSwColums->GetSepLineVertAlign())
1137  {
1138  case style::VerticalAlignment_TOP: m_eAdj = COLADJ_TOP; break;
1139  case style::VerticalAlignment_MIDDLE: m_eAdj = COLADJ_CENTER; break;
1140  case style::VerticalAlignment_BOTTOM: m_eAdj = COLADJ_BOTTOM; break;
1141  default: OSL_ENSURE( false, "unknown alignment" ); break;
1142  }
1143  }
1144  }
1145  }
1146  return bRet;
1147 }
1148 
1150 {
1151  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatCol"));
1152  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1153  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eLineStyle"), BAD_CAST(OString::number(static_cast<sal_Int16>(m_eLineStyle)).getStr()));
1154  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLineWidth"), BAD_CAST(OString::number(m_nLineWidth).getStr()));
1155  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aLineColor"), BAD_CAST(m_aLineColor.AsRGBHexString().toUtf8().getStr()));
1156  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLineHeight"), BAD_CAST(OString::number(m_nLineHeight).getStr()));
1157  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eAdj"), BAD_CAST(OString::number(m_eAdj).getStr()));
1158  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidth"), BAD_CAST(OString::number(m_nWidth).getStr()));
1159  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidthAdjustValue"), BAD_CAST(OString::number(m_aWidthAdjustValue).getStr()));
1160  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bOrtho"), BAD_CAST(OString::boolean(m_bOrtho).getStr()));
1161 
1162  xmlTextWriterStartElement(pWriter, BAD_CAST("aColumns"));
1163  for (const SwColumn& rColumn : m_aColumns)
1164  rColumn.dumpAsXml(pWriter);
1165  xmlTextWriterEndElement(pWriter);
1166 
1167  xmlTextWriterEndElement(pWriter);
1168 }
1169 
1170 // Partially implemented inline in hxx
1171 SwFormatSurround::SwFormatSurround( css::text::WrapTextMode eFly ) :
1172  SfxEnumItem( RES_SURROUND, eFly )
1173 {
1174  m_bAnchorOnly = m_bContour = m_bOutside = false;
1175 }
1176 
1177 bool SwFormatSurround::operator==( const SfxPoolItem& rAttr ) const
1178 {
1179  assert(SfxPoolItem::operator==(rAttr));
1180  return ( GetValue() == static_cast<const SwFormatSurround&>(rAttr).GetValue() &&
1181  m_bAnchorOnly== static_cast<const SwFormatSurround&>(rAttr).m_bAnchorOnly &&
1182  m_bContour== static_cast<const SwFormatSurround&>(rAttr).m_bContour &&
1183  m_bOutside== static_cast<const SwFormatSurround&>(rAttr).m_bOutside );
1184 }
1185 
1187 {
1188  return new SwFormatSurround( *this );
1189 }
1190 
1192 {
1193  return 6;
1194 }
1195 
1196 bool SwFormatSurround::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1197 {
1198  // here we convert always!
1199  nMemberId &= ~CONVERT_TWIPS;
1200  bool bRet = true;
1201  switch ( nMemberId )
1202  {
1204  rVal <<= GetSurround();
1205  break;
1207  rVal <<= IsAnchorOnly();
1208  break;
1209  case MID_SURROUND_CONTOUR:
1210  rVal <<= IsContour();
1211  break;
1213  rVal <<= IsOutside();
1214  break;
1215  default:
1216  OSL_ENSURE( false, "unknown MemberId" );
1217  bRet = false;
1218  }
1219  return bRet;
1220 }
1221 
1222 bool SwFormatSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1223 {
1224  // here we convert always!
1225  nMemberId &= ~CONVERT_TWIPS;
1226  bool bRet = true;
1227  switch ( nMemberId )
1228  {
1230  {
1231  css::text::WrapTextMode eVal = static_cast<css::text::WrapTextMode>(SWUnoHelper::GetEnumAsInt32( rVal ));
1232  if( eVal >= css::text::WrapTextMode_NONE && eVal <= css::text::WrapTextMode_RIGHT )
1233  SetValue( eVal );
1234  else {
1235  //exception
1236  ;
1237  }
1238  }
1239  break;
1240 
1242  SetAnchorOnly( *o3tl::doAccess<bool>(rVal) );
1243  break;
1244  case MID_SURROUND_CONTOUR:
1245  SetContour( *o3tl::doAccess<bool>(rVal) );
1246  break;
1248  SetOutside( *o3tl::doAccess<bool>(rVal) );
1249  break;
1250  default:
1251  OSL_ENSURE( false, "unknown MemberId" );
1252  bRet = false;
1253  }
1254  return bRet;
1255 }
1256 
1258 {
1259  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatSurround"));
1260  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1261  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(static_cast<sal_Int32>(GetValue())).getStr()));
1262 
1263  OUString aPresentation;
1264  IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
1265  GetPresentation(SfxItemPresentation::Nameless, MapUnit::Map100thMM, MapUnit::Map100thMM, aPresentation, aIntlWrapper);
1266  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(aPresentation.toUtf8().getStr()));
1267 
1268  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bAnchorOnly"), BAD_CAST(OString::boolean(m_bAnchorOnly).getStr()));
1269  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bContour"), BAD_CAST(OString::boolean(m_bContour).getStr()));
1270  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bOutside"), BAD_CAST(OString::boolean(m_bOutside).getStr()));
1271 
1272  xmlTextWriterEndElement(pWriter);
1273 }
1274 
1275 // Partially implemented inline in hxx
1277  sal_Int16 eRel )
1279  m_nYPos( nY ),
1280  m_eOrient( eVert ),
1281  m_eRelation( eRel )
1282 {}
1283 
1285 {
1286  assert(SfxPoolItem::operator==(rAttr));
1287  return ( m_nYPos == static_cast<const SwFormatVertOrient&>(rAttr).m_nYPos &&
1288  m_eOrient == static_cast<const SwFormatVertOrient&>(rAttr).m_eOrient &&
1289  m_eRelation == static_cast<const SwFormatVertOrient&>(rAttr).m_eRelation );
1290 }
1291 
1293 {
1294  return new SwFormatVertOrient( *this );
1295 }
1296 
1297 bool SwFormatVertOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1298 {
1299  // here we convert always!
1300  nMemberId &= ~CONVERT_TWIPS;
1301  bool bRet = true;
1302  switch ( nMemberId )
1303  {
1304  case MID_VERTORIENT_ORIENT:
1305  {
1306  rVal <<= m_eOrient;
1307  }
1308  break;
1310  rVal <<= m_eRelation;
1311  break;
1313  rVal <<= static_cast<sal_Int32>(convertTwipToMm100(GetPos()));
1314  break;
1315  default:
1316  OSL_ENSURE( false, "unknown MemberId" );
1317  bRet = false;
1318  }
1319  return bRet;
1320 }
1321 
1322 bool SwFormatVertOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1323 {
1324  bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
1325  nMemberId &= ~CONVERT_TWIPS;
1326  bool bRet = true;
1327  switch ( nMemberId )
1328  {
1329  case MID_VERTORIENT_ORIENT:
1330  {
1331  sal_uInt16 nVal = text::VertOrientation::NONE;
1332  rVal >>= nVal;
1333  m_eOrient = nVal;
1334  }
1335  break;
1337  {
1339  }
1340  break;
1342  {
1343  sal_Int32 nVal = 0;
1344  rVal >>= nVal;
1345  if(bConvert)
1346  nVal = convertMm100ToTwip(nVal);
1347  SetPos( nVal );
1348  }
1349  break;
1350  default:
1351  OSL_ENSURE( false, "unknown MemberId" );
1352  bRet = false;
1353  }
1354  return bRet;
1355 }
1356 
1358 {
1359  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatVertOrient"));
1360  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1361  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nYPos"), BAD_CAST(OString::number(m_nYPos).getStr()));
1362  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eOrient"), BAD_CAST(OString::number(m_eOrient).getStr()));
1363  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eRelation"), BAD_CAST(OString::number(m_eRelation).getStr()));
1364  xmlTextWriterEndElement(pWriter);
1365 }
1366 
1367 // Partially implemented inline in hxx
1369  sal_Int16 eRel, bool bPos )
1371  m_nXPos( nX ),
1372  m_eOrient( eHori ),
1373  m_eRelation( eRel ),
1374  m_bPosToggle( bPos )
1375 {}
1376 
1378 {
1379  assert(SfxPoolItem::operator==(rAttr));
1380  return ( m_nXPos == static_cast<const SwFormatHoriOrient&>(rAttr).m_nXPos &&
1381  m_eOrient == static_cast<const SwFormatHoriOrient&>(rAttr).m_eOrient &&
1382  m_eRelation == static_cast<const SwFormatHoriOrient&>(rAttr).m_eRelation &&
1383  m_bPosToggle == static_cast<const SwFormatHoriOrient&>(rAttr).m_bPosToggle );
1384 }
1385 
1387 {
1388  return new SwFormatHoriOrient( *this );
1389 }
1390 
1391 bool SwFormatHoriOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1392 {
1393  // here we convert always!
1394  nMemberId &= ~CONVERT_TWIPS;
1395  bool bRet = true;
1396  switch ( nMemberId )
1397  {
1398  case MID_HORIORIENT_ORIENT:
1399  {
1400  rVal <<= m_eOrient;
1401  }
1402  break;
1404  rVal <<= m_eRelation;
1405  break;
1407  rVal <<= static_cast<sal_Int32>(convertTwipToMm100(GetPos()));
1408  break;
1410  rVal <<= IsPosToggle();
1411  break;
1412  default:
1413  OSL_ENSURE( false, "unknown MemberId" );
1414  bRet = false;
1415  }
1416  return bRet;
1417 }
1418 
1419 bool SwFormatHoriOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1420 {
1421  bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
1422  nMemberId &= ~CONVERT_TWIPS;
1423  bool bRet = true;
1424  switch ( nMemberId )
1425  {
1426  case MID_HORIORIENT_ORIENT:
1427  {
1428  sal_Int16 nVal = text::HoriOrientation::NONE;
1429  rVal >>= nVal;
1430  m_eOrient = nVal;
1431  }
1432  break;
1434  {
1436  }
1437  break;
1439  {
1440  sal_Int32 nVal = 0;
1441  if(!(rVal >>= nVal))
1442  bRet = false;
1443  if(bConvert)
1444  nVal = convertMm100ToTwip(nVal);
1445  SetPos( nVal );
1446  }
1447  break;
1449  SetPosToggle( *o3tl::doAccess<bool>(rVal));
1450  break;
1451  default:
1452  OSL_ENSURE( false, "unknown MemberId" );
1453  bRet = false;
1454  }
1455  return bRet;
1456 }
1457 
1459 {
1460  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatHoriOrient"));
1461  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1462  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nXPos"), BAD_CAST(OString::number(m_nXPos).getStr()));
1463  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eOrient"), BAD_CAST(OString::number(m_eOrient).getStr()));
1464  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eRelation"), BAD_CAST(OString::number(m_eRelation).getStr()));
1465  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bPosToggle"), BAD_CAST(OString::boolean(m_bPosToggle).getStr()));
1466  xmlTextWriterEndElement(pWriter);
1467 }
1468 
1469 // Partially implemented inline in hxx
1471  : SfxPoolItem( RES_ANCHOR ),
1472  m_eAnchorId( nRnd ),
1473  m_nPageNumber( nPage ),
1474  // OD 2004-05-05 #i28701# - get always new increased order number
1475  m_nOrder( ++s_nOrderCounter )
1476 {}
1477 
1479  : SfxPoolItem( RES_ANCHOR )
1480  , m_pContentAnchor( (rCpy.GetContentAnchor())
1481  ? new SwPosition( *rCpy.GetContentAnchor() ) : nullptr )
1482  , m_eAnchorId( rCpy.GetAnchorId() )
1483  , m_nPageNumber( rCpy.GetPageNum() )
1484  // OD 2004-05-05 #i28701# - get always new increased order number
1485  , m_nOrder( ++s_nOrderCounter )
1486 {
1487 }
1488 
1490 {
1491 }
1492 
1494 {
1495  // anchor only to paragraphs, or start nodes in case of RndStdIds::FLY_AT_FLY
1496  // also allow table node, this is used when a table is selected and is converted to a frame by the UI
1497  assert(!pPos
1498  || ((RndStdIds::FLY_AT_FLY == m_eAnchorId) &&
1499  dynamic_cast<SwStartNode*>(&pPos->nNode.GetNode()))
1500  || (RndStdIds::FLY_AT_PARA == m_eAnchorId && dynamic_cast<SwTableNode*>(&pPos->nNode.GetNode()))
1501  || dynamic_cast<SwTextNode*>(&pPos->nNode.GetNode()));
1502  m_pContentAnchor .reset( pPos ? new SwPosition( *pPos ) : nullptr );
1503  // Flys anchored AT paragraph should not point into the paragraph content
1504  if (m_pContentAnchor &&
1505  ((RndStdIds::FLY_AT_PARA == m_eAnchorId) || (RndStdIds::FLY_AT_FLY == m_eAnchorId)))
1506  {
1507  m_pContentAnchor->nContent.Assign( nullptr, 0 );
1508  }
1509 }
1510 
1512 {
1513  if (this != &rAnchor)
1514  {
1515  m_eAnchorId = rAnchor.GetAnchorId();
1516  m_nPageNumber = rAnchor.GetPageNum();
1517  // OD 2004-05-05 #i28701# - get always new increased order number
1519 
1520  m_pContentAnchor.reset( (rAnchor.GetContentAnchor())
1521  ? new SwPosition(*(rAnchor.GetContentAnchor()))
1522  : nullptr );
1523  }
1524  return *this;
1525 }
1526 
1527 bool SwFormatAnchor::operator==( const SfxPoolItem& rAttr ) const
1528 {
1529  assert(SfxPoolItem::operator==(rAttr));
1530  SwFormatAnchor const& rFormatAnchor(static_cast<SwFormatAnchor const&>(rAttr));
1531  // OD 2004-05-05 #i28701# - Note: <mnOrder> hasn't to be considered.
1532  return ( m_eAnchorId == rFormatAnchor.GetAnchorId() &&
1533  m_nPageNumber == rFormatAnchor.GetPageNum() &&
1534  // compare anchor: either both do not point into a textnode or
1535  // both do (valid m_pContentAnchor) and the positions are equal
1536  ((m_pContentAnchor.get() == rFormatAnchor.m_pContentAnchor.get()) ||
1537  (m_pContentAnchor && rFormatAnchor.GetContentAnchor() &&
1538  (*m_pContentAnchor == *rFormatAnchor.GetContentAnchor()))));
1539 }
1540 
1542 {
1543  return new SwFormatAnchor( *this );
1544 }
1545 
1546 // OD 2004-05-05 #i28701#
1547 sal_uInt32 SwFormatAnchor::s_nOrderCounter = 0;
1548 
1549 // OD 2004-05-05 #i28701#
1550 
1551 bool SwFormatAnchor::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1552 {
1553  // here we convert always!
1554  nMemberId &= ~CONVERT_TWIPS;
1555  bool bRet = true;
1556  switch ( nMemberId )
1557  {
1558  case MID_ANCHOR_ANCHORTYPE:
1559 
1560  text::TextContentAnchorType eRet;
1561  switch (GetAnchorId())
1562  {
1563  case RndStdIds::FLY_AT_CHAR:
1564  eRet = text::TextContentAnchorType_AT_CHARACTER;
1565  break;
1566  case RndStdIds::FLY_AT_PAGE:
1567  eRet = text::TextContentAnchorType_AT_PAGE;
1568  break;
1569  case RndStdIds::FLY_AT_FLY:
1570  eRet = text::TextContentAnchorType_AT_FRAME;
1571  break;
1572  case RndStdIds::FLY_AS_CHAR:
1573  eRet = text::TextContentAnchorType_AS_CHARACTER;
1574  break;
1575  //case RndStdIds::FLY_AT_PARA:
1576  default:
1577  eRet = text::TextContentAnchorType_AT_PARAGRAPH;
1578  }
1579  rVal <<= eRet;
1580  break;
1581  case MID_ANCHOR_PAGENUM:
1582  rVal <<= static_cast<sal_Int16>(GetPageNum());
1583  break;
1585  {
1586  if (m_pContentAnchor && RndStdIds::FLY_AT_FLY == m_eAnchorId)
1587  {
1588  SwFrameFormat* pFormat = m_pContentAnchor->nNode.GetNode().GetFlyFormat();
1589  if(pFormat)
1590  {
1591  uno::Reference<text::XTextFrame> const xRet(
1592  SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat));
1593  rVal <<= xRet;
1594  }
1595  }
1596  }
1597  break;
1598  default:
1599  OSL_ENSURE( false, "unknown MemberId" );
1600  bRet = false;
1601  }
1602  return bRet;
1603 }
1604 
1605 bool SwFormatAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1606 {
1607  // here we convert always!
1608  nMemberId &= ~CONVERT_TWIPS;
1609  bool bRet = true;
1610  switch ( nMemberId )
1611  {
1612  case MID_ANCHOR_ANCHORTYPE:
1613  {
1614  RndStdIds eAnchor;
1615  switch( static_cast<text::TextContentAnchorType>(SWUnoHelper::GetEnumAsInt32( rVal )) )
1616  {
1617  case text::TextContentAnchorType_AS_CHARACTER:
1618  eAnchor = RndStdIds::FLY_AS_CHAR;
1619  break;
1620  case text::TextContentAnchorType_AT_PAGE:
1621  eAnchor = RndStdIds::FLY_AT_PAGE;
1622  if( GetPageNum() > 0 )
1623  {
1624  // If the anchor type is page and a valid page number
1625  // has been set, the content position isn't required
1626  // any longer.
1627  m_pContentAnchor.reset();
1628  }
1629  break;
1630  case text::TextContentAnchorType_AT_FRAME:
1631  eAnchor = RndStdIds::FLY_AT_FLY;
1632  break;
1633  case text::TextContentAnchorType_AT_CHARACTER:
1634  eAnchor = RndStdIds::FLY_AT_CHAR;
1635  break;
1636  //case text::TextContentAnchorType_AT_PARAGRAPH:
1637  default:
1638  eAnchor = RndStdIds::FLY_AT_PARA;
1639  break;
1640  }
1641  SetType( eAnchor );
1642  }
1643  break;
1644  case MID_ANCHOR_PAGENUM:
1645  {
1646  sal_Int16 nVal = 0;
1647  if((rVal >>= nVal) && nVal > 0)
1648  {
1649  SetPageNum( nVal );
1650  if (RndStdIds::FLY_AT_PAGE == GetAnchorId())
1651  {
1652  // If the anchor type is page and a valid page number
1653  // is set, the content position has to be deleted to not
1654  // confuse the layout (frmtool.cxx). However, if the
1655  // anchor type is not page, any content position will
1656  // be kept.
1657  m_pContentAnchor.reset();
1658  }
1659  }
1660  else
1661  bRet = false;
1662  }
1663  break;
1665  //no break here!;
1666  default:
1667  OSL_ENSURE( false, "unknown MemberId" );
1668  bRet = false;
1669  }
1670  return bRet;
1671 }
1672 
1674 {
1675  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatAnchor"));
1676  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1677 
1678  if (m_pContentAnchor)
1679  {
1680  std::stringstream aContentAnchor;
1681  aContentAnchor << *m_pContentAnchor;
1682  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_pContentAnchor"), BAD_CAST(aContentAnchor.str().c_str()));
1683  }
1684  else
1685  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_pContentAnchor"), "%p", m_pContentAnchor.get());
1686  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_eAnchorType"), BAD_CAST(OString::number(static_cast<int>(m_eAnchorId)).getStr()));
1687  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nPageNumber"), BAD_CAST(OString::number(m_nPageNumber).getStr()));
1688  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nOrder"), BAD_CAST(OString::number(m_nOrder).getStr()));
1689  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("s_nOrderCounter"), BAD_CAST(OString::number(s_nOrderCounter).getStr()));
1690  OUString aPresentation;
1691  IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
1692  GetPresentation(SfxItemPresentation::Nameless, MapUnit::Map100thMM, MapUnit::Map100thMM, aPresentation, aIntlWrapper);
1693  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(aPresentation.toUtf8().getStr()));
1694 
1695  xmlTextWriterEndElement(pWriter);
1696 }
1697 
1698 // Partially implemented inline in hxx
1700  SfxPoolItem( RES_URL ),
1701  m_bIsServerMap( false )
1702 {
1703 }
1704 
1706  SfxPoolItem( RES_URL ),
1707  m_sTargetFrameName( rURL.GetTargetFrameName() ),
1708  m_sURL( rURL.GetURL() ),
1709  m_sName( rURL.GetName() ),
1710  m_bIsServerMap( rURL.IsServerMap() )
1711 {
1712  if (rURL.GetMap())
1713  m_pMap.reset( new ImageMap( *rURL.GetMap() ) );
1714 }
1715 
1717 {
1718 }
1719 
1720 bool SwFormatURL::operator==( const SfxPoolItem &rAttr ) const
1721 {
1722  assert(SfxPoolItem::operator==(rAttr));
1723  const SwFormatURL &rCmp = static_cast<const SwFormatURL&>(rAttr);
1724  bool bRet = m_bIsServerMap == rCmp.IsServerMap() &&
1725  m_sURL == rCmp.GetURL() &&
1727  m_sName == rCmp.GetName();
1728  if ( bRet )
1729  {
1730  if ( m_pMap && rCmp.GetMap() )
1731  bRet = *m_pMap == *rCmp.GetMap();
1732  else
1733  bRet = m_pMap.get() == rCmp.GetMap();
1734  }
1735  return bRet;
1736 }
1737 
1739 {
1740  return new SwFormatURL( *this );
1741 }
1742 
1743 void SwFormatURL::SetURL(const OUString &rURL, bool bServerMap)
1744 {
1745  m_sURL = rURL;
1746  m_bIsServerMap = bServerMap;
1747 }
1748 
1750 {
1751  m_pMap.reset( pM ? new ImageMap( *pM ) : nullptr);
1752 }
1753 
1754 bool SwFormatURL::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1755 {
1756  // here we convert always!
1757  nMemberId &= ~CONVERT_TWIPS;
1758  bool bRet = true;
1759  switch ( nMemberId )
1760  {
1761  case MID_URL_URL:
1762  rVal <<= GetURL();
1763  break;
1764  case MID_URL_TARGET:
1765  rVal <<= GetTargetFrameName();
1766  break;
1767  case MID_URL_HYPERLINKNAME:
1768  rVal <<= GetName();
1769  break;
1770  case MID_URL_CLIENTMAP:
1771  {
1772  uno::Reference< uno::XInterface > xInt;
1773  if(m_pMap)
1774  {
1776  }
1777  else
1778  {
1779  ImageMap aEmptyMap;
1781  }
1782  uno::Reference< container::XIndexContainer > xCont(xInt, uno::UNO_QUERY);
1783  rVal <<= xCont;
1784  }
1785  break;
1786  case MID_URL_SERVERMAP:
1787  rVal <<= IsServerMap();
1788  break;
1789  default:
1790  OSL_ENSURE( false, "unknown MemberId" );
1791  bRet = false;
1792  }
1793  return bRet;
1794 }
1795 
1796 bool SwFormatURL::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1797 {
1798  // here we convert always!
1799  nMemberId &= ~CONVERT_TWIPS;
1800  bool bRet = true;
1801  switch ( nMemberId )
1802  {
1803  case MID_URL_URL:
1804  {
1805  OUString sTmp;
1806  rVal >>= sTmp;
1807  SetURL( sTmp, m_bIsServerMap );
1808  }
1809  break;
1810  case MID_URL_TARGET:
1811  {
1812  OUString sTmp;
1813  rVal >>= sTmp;
1814  SetTargetFrameName( sTmp );
1815  }
1816  break;
1817  case MID_URL_HYPERLINKNAME:
1818  {
1819  OUString sTmp;
1820  rVal >>= sTmp;
1821  SetName( sTmp );
1822  }
1823  break;
1824  case MID_URL_CLIENTMAP:
1825  {
1826  uno::Reference<container::XIndexContainer> xCont;
1827  if(!rVal.hasValue())
1828  m_pMap.reset();
1829  else if(rVal >>= xCont)
1830  {
1831  if(!m_pMap)
1832  m_pMap.reset(new ImageMap);
1833  bRet = SvUnoImageMap_fillImageMap( xCont, *m_pMap );
1834  }
1835  else
1836  bRet = false;
1837  }
1838  break;
1839  case MID_URL_SERVERMAP:
1840  m_bIsServerMap = *o3tl::doAccess<bool>(rVal);
1841  break;
1842  default:
1843  OSL_ENSURE( false, "unknown MemberId" );
1844  bRet = false;
1845  }
1846  return bRet;
1847 }
1848 
1850 {
1851  return new SwFormatEditInReadonly( *this );
1852 }
1853 
1855 {
1856  return new SwFormatLayoutSplit( *this );
1857 }
1858 
1860 {
1861  return new SwFormatRowSplit( *this );
1862 }
1863 
1865 {
1866  return new SwFormatNoBalancedColumns( *this );
1867 }
1868 
1870 {
1871  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatNoBalancedColumns"));
1872  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1873  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(GetValue()).getStr()));
1874  xmlTextWriterEndElement(pWriter);
1875 }
1876 
1877 // class SwFormatFootnoteEndAtTextEnd
1878 
1880 {
1881  return sal_uInt16( FTNEND_ATTXTEND_END );
1882 }
1883 
1885  const SwFormatFootnoteEndAtTextEnd& rAttr )
1886 {
1887  SfxEnumItem::SetValue( rAttr.GetValue() );
1888  m_aFormat = rAttr.m_aFormat;
1889  m_nOffset = rAttr.m_nOffset;
1890  m_sPrefix = rAttr.m_sPrefix;
1891  m_sSuffix = rAttr.m_sSuffix;
1892  return *this;
1893 }
1894 
1896 {
1897  const SwFormatFootnoteEndAtTextEnd& rAttr = static_cast<const SwFormatFootnoteEndAtTextEnd&>(rItem);
1898  return SfxEnumItem::operator==( rItem ) &&
1900  m_nOffset == rAttr.m_nOffset &&
1901  m_sPrefix == rAttr.m_sPrefix &&
1902  m_sSuffix == rAttr.m_sSuffix;
1903 }
1904 
1906 {
1907  nMemberId &= ~CONVERT_TWIPS;
1908  switch(nMemberId)
1909  {
1910  case MID_COLLECT :
1911  rVal <<= GetValue() >= FTNEND_ATTXTEND;
1912  break;
1913  case MID_RESTART_NUM :
1914  rVal <<= GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ;
1915  break;
1916  case MID_NUM_START_AT: rVal <<= static_cast<sal_Int16>(m_nOffset); break;
1917  case MID_OWN_NUM :
1918  rVal <<= GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT;
1919  break;
1920  case MID_NUM_TYPE : rVal <<= static_cast<sal_Int16>(m_aFormat.GetNumberingType()); break;
1921  case MID_PREFIX : rVal <<= m_sPrefix; break;
1922  case MID_SUFFIX : rVal <<= m_sSuffix; break;
1923  default: return false;
1924  }
1925  return true;
1926 }
1927 
1929 {
1930  bool bRet = true;
1931  nMemberId &= ~CONVERT_TWIPS;
1932  switch(nMemberId)
1933  {
1934  case MID_COLLECT :
1935  {
1936  bool bVal = *o3tl::doAccess<bool>(rVal);
1937  if(!bVal && GetValue() >= FTNEND_ATTXTEND)
1939  else if(bVal && GetValue() < FTNEND_ATTXTEND)
1941  }
1942  break;
1943  case MID_RESTART_NUM :
1944  {
1945  bool bVal = *o3tl::doAccess<bool>(rVal);
1946  if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ)
1948  else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMSEQ)
1950  }
1951  break;
1952  case MID_NUM_START_AT:
1953  {
1954  sal_Int16 nVal = 0;
1955  rVal >>= nVal;
1956  if(nVal >= 0)
1957  m_nOffset = nVal;
1958  else
1959  bRet = false;
1960  }
1961  break;
1962  case MID_OWN_NUM :
1963  {
1964  bool bVal = *o3tl::doAccess<bool>(rVal);
1965  if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT)
1967  else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMANDFMT)
1969  }
1970  break;
1971  case MID_NUM_TYPE :
1972  {
1973  sal_Int16 nVal = 0;
1974  rVal >>= nVal;
1975  if(nVal >= 0 &&
1976  (nVal <= SVX_NUM_ARABIC ||
1977  SVX_NUM_CHARS_UPPER_LETTER_N == nVal ||
1978  SVX_NUM_CHARS_LOWER_LETTER_N == nVal ))
1979  m_aFormat.SetNumberingType(static_cast<SvxNumType>(nVal));
1980  else
1981  bRet = false;
1982  }
1983  break;
1984  case MID_PREFIX :
1985  {
1986  OUString sVal; rVal >>= sVal;
1987  m_sPrefix = sVal;
1988  }
1989  break;
1990  case MID_SUFFIX :
1991  {
1992  OUString sVal; rVal >>= sVal;
1993  m_sSuffix = sVal;
1994  }
1995  break;
1996  default: bRet = false;
1997  }
1998  return bRet;
1999 }
2000 
2001 // class SwFormatFootnoteAtTextEnd
2002 
2004 {
2005  return new SwFormatFootnoteAtTextEnd(*this);
2006 }
2007 
2008 // class SwFormatEndAtTextEnd
2009 
2011 {
2012  return new SwFormatEndAtTextEnd(*this);
2013 }
2014 
2015 //class SwFormatChain
2016 
2017 bool SwFormatChain::operator==( const SfxPoolItem &rAttr ) const
2018 {
2019  assert(SfxPoolItem::operator==(rAttr));
2020 
2021  return GetPrev() == static_cast<const SwFormatChain&>(rAttr).GetPrev() &&
2022  GetNext() == static_cast<const SwFormatChain&>(rAttr).GetNext();
2023 }
2024 
2027 {
2028  SetPrev( rCpy.GetPrev() );
2029  SetNext( rCpy.GetNext() );
2030 }
2031 
2033 {
2034  SwFormatChain *pRet = new SwFormatChain;
2035  pRet->SetPrev( GetPrev() );
2036  pRet->SetNext( GetNext() );
2037  return pRet;
2038 }
2039 
2041 {
2042  if ( pFormat )
2043  pFormat->Add( &m_aPrev );
2044  else
2046 }
2047 
2049 {
2050  if ( pFormat )
2051  pFormat->Add( &m_aNext );
2052  else
2054 }
2055 
2056 bool SwFormatChain::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2057 {
2058  // here we convert always!
2059  nMemberId &= ~CONVERT_TWIPS;
2060  bool bRet = true;
2061  OUString aRet;
2062  switch ( nMemberId )
2063  {
2064  case MID_CHAIN_PREVNAME:
2065  if ( GetPrev() )
2066  aRet = GetPrev()->GetName();
2067  break;
2068  case MID_CHAIN_NEXTNAME:
2069  if ( GetNext() )
2070  aRet = GetNext()->GetName();
2071  break;
2072  default:
2073  OSL_ENSURE( false, "unknown MemberId" );
2074  bRet = false;
2075  }
2076  rVal <<= aRet;
2077  return bRet;
2078 }
2079 
2082 {
2083  m_nStartValue = 0;
2084  m_bCountLines = true;
2085 }
2086 
2088 {
2089 }
2090 
2092 {
2093  assert(SfxPoolItem::operator==(rAttr));
2094 
2095  return m_nStartValue == static_cast<const SwFormatLineNumber&>(rAttr).GetStartValue() &&
2096  m_bCountLines == static_cast<const SwFormatLineNumber&>(rAttr).IsCount();
2097 }
2098 
2100 {
2101  return new SwFormatLineNumber( *this );
2102 }
2103 
2104 bool SwFormatLineNumber::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2105 {
2106  // here we convert always!
2107  nMemberId &= ~CONVERT_TWIPS;
2108  bool bRet = true;
2109  switch ( nMemberId )
2110  {
2111  case MID_LINENUMBER_COUNT:
2112  rVal <<= IsCount();
2113  break;
2115  rVal <<= static_cast<sal_Int32>(GetStartValue());
2116  break;
2117  default:
2118  OSL_ENSURE( false, "unknown MemberId" );
2119  bRet = false;
2120  }
2121  return bRet;
2122 }
2123 
2124 bool SwFormatLineNumber::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2125 {
2126  // here we convert always!
2127  nMemberId &= ~CONVERT_TWIPS;
2128  bool bRet = true;
2129  switch ( nMemberId )
2130  {
2131  case MID_LINENUMBER_COUNT:
2132  SetCountLines( *o3tl::doAccess<bool>(rVal) );
2133  break;
2135  {
2136  sal_Int32 nVal = 0;
2137  if(rVal >>= nVal)
2138  SetStartValue( nVal );
2139  else
2140  bRet = false;
2141  }
2142  break;
2143  default:
2144  OSL_ENSURE( false, "unknown MemberId" );
2145  bRet = false;
2146  }
2147  return bRet;
2148 }
2149 
2151  : SfxPoolItem( RES_TEXTGRID ), m_aColor( COL_LIGHTGRAY ), m_nLines( 20 )
2152  , m_nBaseHeight( 400 ), m_nRubyHeight( 200 ), m_eGridType( GRID_NONE )
2153  , m_bRubyTextBelow( false ), m_bPrintGrid( true ), m_bDisplayGrid( true )
2154  , m_nBaseWidth(400), m_bSnapToChars( true ), m_bSquaredMode(true)
2155 {
2156 }
2157 
2159 {
2160 }
2161 
2162 bool SwTextGridItem::operator==( const SfxPoolItem& rAttr ) const
2163 {
2164  assert(SfxPoolItem::operator==(rAttr));
2165  SwTextGridItem const& rOther(static_cast<SwTextGridItem const&>(rAttr));
2166  return m_eGridType == rOther.GetGridType()
2167  && m_nLines == rOther.GetLines()
2168  && m_nBaseHeight == rOther.GetBaseHeight()
2169  && m_nRubyHeight == rOther.GetRubyHeight()
2170  && m_bRubyTextBelow == rOther.GetRubyTextBelow()
2171  && m_bDisplayGrid == rOther.GetDisplayGrid()
2172  && m_bPrintGrid == rOther.GetPrintGrid()
2173  && m_aColor == rOther.GetColor()
2174  && m_nBaseWidth == rOther.GetBaseWidth()
2175  && m_bSnapToChars == rOther.GetSnapToChars()
2176  && m_bSquaredMode == rOther.GetSquaredMode();
2177 }
2178 
2180 {
2181  return new SwTextGridItem( *this );
2182 }
2183 
2184 bool SwTextGridItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2185 {
2186  bool bRet = true;
2187 
2188  switch( nMemberId & ~CONVERT_TWIPS )
2189  {
2190  case MID_GRID_COLOR:
2191  rVal <<= GetColor();
2192  break;
2193  case MID_GRID_LINES:
2194  rVal <<= GetLines();
2195  break;
2196  case MID_GRID_RUBY_BELOW:
2197  rVal <<= m_bRubyTextBelow;
2198  break;
2199  case MID_GRID_PRINT:
2200  rVal <<= m_bPrintGrid;
2201  break;
2202  case MID_GRID_DISPLAY:
2203  rVal <<= m_bDisplayGrid;
2204  break;
2205  case MID_GRID_BASEHEIGHT:
2206  OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0,
2207  "This value needs TWIPS-MM100 conversion" );
2208  rVal <<= static_cast<sal_Int32>(convertTwipToMm100(m_nBaseHeight));
2209  break;
2210  case MID_GRID_BASEWIDTH:
2211  OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0,
2212  "This value needs TWIPS-MM100 conversion" );
2213  rVal <<= static_cast<sal_Int32>(convertTwipToMm100(m_nBaseWidth));
2214  break;
2215  case MID_GRID_RUBYHEIGHT:
2216  OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0,
2217  "This value needs TWIPS-MM100 conversion" );
2218  rVal <<= static_cast<sal_Int32>(convertTwipToMm100(m_nRubyHeight));
2219  break;
2220  case MID_GRID_TYPE:
2221  switch( GetGridType() )
2222  {
2223  case GRID_NONE:
2224  rVal <<= text::TextGridMode::NONE;
2225  break;
2226  case GRID_LINES_ONLY:
2227  rVal <<= text::TextGridMode::LINES;
2228  break;
2229  case GRID_LINES_CHARS:
2230  rVal <<= text::TextGridMode::LINES_AND_CHARS;
2231  break;
2232  default:
2233  OSL_FAIL("unknown SwTextGrid value");
2234  bRet = false;
2235  break;
2236  }
2237  break;
2238  case MID_GRID_SNAPTOCHARS:
2239  rVal <<= m_bSnapToChars;
2240  break;
2242  rVal <<= !m_bSquaredMode;
2243  break;
2244  default:
2245  OSL_FAIL("Unknown SwTextGridItem member");
2246  bRet = false;
2247  break;
2248  }
2249 
2250  return bRet;
2251 }
2252 
2253 bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2254 {
2255  bool bRet = true;
2256  switch( nMemberId & ~CONVERT_TWIPS )
2257  {
2258  case MID_GRID_COLOR:
2259  {
2260  Color nTmp;
2261  bRet = (rVal >>= nTmp);
2262  if( bRet )
2263  SetColor( nTmp );
2264  }
2265  break;
2266  case MID_GRID_LINES:
2267  {
2268  sal_Int16 nTmp = 0;
2269  bRet = (rVal >>= nTmp);
2270  if( bRet && (nTmp >= 0) )
2271  SetLines( static_cast<sal_uInt16>(nTmp) );
2272  else
2273  bRet = false;
2274  }
2275  break;
2276  case MID_GRID_RUBY_BELOW:
2277  SetRubyTextBelow( *o3tl::doAccess<bool>(rVal) );
2278  break;
2279  case MID_GRID_PRINT:
2280  SetPrintGrid( *o3tl::doAccess<bool>(rVal) );
2281  break;
2282  case MID_GRID_DISPLAY:
2283  SetDisplayGrid( *o3tl::doAccess<bool>(rVal) );
2284  break;
2285  case MID_GRID_BASEHEIGHT:
2286  case MID_GRID_BASEWIDTH:
2287  case MID_GRID_RUBYHEIGHT:
2288  {
2289  OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0,
2290  "This value needs TWIPS-MM100 conversion" );
2291  sal_Int32 nTmp = 0;
2292  bRet = (rVal >>= nTmp);
2293  nTmp = convertMm100ToTwip( nTmp );
2294  if( bRet && (nTmp >= 0) && ( nTmp <= SAL_MAX_UINT16) )
2295  {
2296  // rhbz#1043551 round up to 5pt -- 0 causes divide-by-zero
2297  // in layout; 1pt ties the painting code up in knots for
2298  // minutes with bazillion lines...
2299 #define MIN_TEXTGRID_SIZE 100
2300  if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEHEIGHT )
2301  {
2302  nTmp = std::max<sal_Int32>(nTmp, MIN_TEXTGRID_SIZE);
2303  SetBaseHeight( static_cast<sal_uInt16>(nTmp) );
2304  }
2305  else if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEWIDTH )
2306  {
2307  nTmp = std::max<sal_Int32>(nTmp, MIN_TEXTGRID_SIZE);
2308  SetBaseWidth( static_cast<sal_uInt16>(nTmp) );
2309  }
2310  else
2311  SetRubyHeight( static_cast<sal_uInt16>(nTmp) );
2312  }
2313  else
2314  bRet = false;
2315  }
2316  break;
2317  case MID_GRID_TYPE:
2318  {
2319  sal_Int16 nTmp = 0;
2320  bRet = (rVal >>= nTmp);
2321  if( bRet )
2322  {
2323  switch( nTmp )
2324  {
2327  break;
2328  case text::TextGridMode::LINES:
2330  break;
2331  case text::TextGridMode::LINES_AND_CHARS:
2333  break;
2334  default:
2335  bRet = false;
2336  break;
2337  }
2338  }
2339  break;
2340  }
2341  case MID_GRID_SNAPTOCHARS:
2342  SetSnapToChars( *o3tl::doAccess<bool>(rVal) );
2343  break;
2345  {
2346  bool bStandard = *o3tl::doAccess<bool>(rVal);
2347  SetSquaredMode( !bStandard );
2348  break;
2349  }
2350  default:
2351  OSL_FAIL("Unknown SwTextGridItem member");
2352  bRet = false;
2353  }
2354 
2355  return bRet;
2356 }
2357 
2359 {
2360  if (bNew == m_bSquaredMode)
2361  {
2362  //same paper mode, not switch
2363  return;
2364  }
2365 
2366  // use default value when grid is disable
2367  if (m_eGridType == GRID_NONE)
2368  {
2369  m_bSquaredMode = bNew;
2370  Init();
2371  return;
2372  }
2373 
2374  if (m_bSquaredMode)
2375  {
2376  //switch from "squared mode" to "standard mode"
2379  m_nRubyHeight = 0;
2380  }
2381  else
2382  {
2383  //switch from "standard mode" to "squared mode"
2387  }
2389 }
2390 
2392 {
2393  if (m_bSquaredMode)
2394  {
2395  m_nLines = 20;
2396  m_nBaseHeight = 400;
2397  m_nRubyHeight = 200;
2399  m_bRubyTextBelow = false;
2400  m_bPrintGrid = true;
2401  m_bDisplayGrid = true;
2402  m_bSnapToChars = true;
2403  m_nBaseWidth = 400;
2404  }
2405  else
2406  {
2407  m_nLines = 44;
2408  m_nBaseHeight = 312;
2409  m_nRubyHeight = 0;
2411  m_bRubyTextBelow = false;
2412  m_bPrintGrid = true;
2413  m_bDisplayGrid = true;
2414  m_nBaseWidth = 210;
2415  m_bSnapToChars = true;
2416  }
2417 }
2418 
2420 {
2421  return new SwHeaderAndFooterEatSpacingItem( Which(), GetValue() );
2422 }
2423 
2425  SwAttrPool& rPool,
2426  const char* pFormatNm,
2427  SwFrameFormat *pDrvdFrame,
2428  sal_uInt16 nFormatWhich,
2429  const sal_uInt16* pWhichRange)
2430 : SwFormat(rPool, pFormatNm, (pWhichRange ? pWhichRange : aFrameFormatSetRange), pDrvdFrame, nFormatWhich),
2431  m_wXObject(),
2432  maFillAttributes(),
2433  m_ffList(nullptr),
2434  m_pOtherTextBoxFormat(nullptr)
2435 {
2436 }
2437 
2439  SwAttrPool& rPool,
2440  const OUString &rFormatNm,
2441  SwFrameFormat *pDrvdFrame,
2442  sal_uInt16 nFormatWhich,
2443  const sal_uInt16* pWhichRange)
2444 : SwFormat(rPool, rFormatNm, (pWhichRange ? pWhichRange : aFrameFormatSetRange), pDrvdFrame, nFormatWhich),
2445  m_wXObject(),
2446  maFillAttributes(),
2447  m_ffList(nullptr),
2448  m_pOtherTextBoxFormat(nullptr)
2449 {
2450 }
2451 
2453 {
2454  if( !GetDoc()->IsInDtor())
2455  {
2456  const SwFormatAnchor& rAnchor = GetAnchor();
2457  if (rAnchor.GetContentAnchor() != nullptr)
2458  {
2459  rAnchor.GetContentAnchor()->nNode.GetNode().RemoveAnchoredFly(this);
2460  }
2461  }
2462 
2463  if( nullptr != m_pOtherTextBoxFormat )
2464  {
2466  m_pOtherTextBoxFormat = nullptr;
2467  }
2468 }
2469 
2470 void SwFrameFormat::SetName( const OUString& rNewName, bool bBroadcast )
2471 {
2472  if (m_ffList != nullptr) {
2473  SwFrameFormats::iterator it = m_ffList->find( this );
2474  assert( m_ffList->end() != it );
2475  SAL_INFO_IF(m_aFormatName == rNewName, "sw.core", "SwFrmFmt not really renamed, as both names are equal");
2476 
2478  // As it's a non-unique list, rename should never fail!
2479  bool const renamed =
2480  m_ffList->m_PosIndex.modify( it,
2481  change_name( rNewName ), change_name( m_aFormatName ) );
2482  assert(renamed);
2483  (void)renamed; // unused in NDEBUG
2484  if (bBroadcast) {
2485  const SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
2486  GetNotifier().Broadcast(sw::LegacyModifyHint( &aOld, &aNew ));
2487  }
2488  }
2489  else
2490  SwFormat::SetName( rNewName, bBroadcast );
2491 }
2492 
2494 {
2495  if( nullptr != pFormat )
2496  {
2497  assert( (Which() == RES_DRAWFRMFMT && pFormat->Which() == RES_FLYFRMFMT)
2498  || (Which() == RES_FLYFRMFMT && pFormat->Which() == RES_DRAWFRMFMT) );
2499  assert( nullptr == m_pOtherTextBoxFormat );
2500  }
2501  else
2502  {
2503  assert( nullptr != m_pOtherTextBoxFormat );
2504  }
2505  bool bChanged = m_pOtherTextBoxFormat != pFormat;
2506  m_pOtherTextBoxFormat = pFormat;
2507 
2508  SdrObject* pObj = FindSdrObject();
2509 
2510  if (pObj)
2511  {
2512  SwFlyDrawObj* pSwFlyDraw = dynamic_cast<SwFlyDrawObj*>(pObj);
2513 
2514  if (pSwFlyDraw)
2515  pSwFlyDraw->SetTextBox(true);
2516  }
2517 
2518  if (m_pOtherTextBoxFormat && bChanged && Which() == RES_DRAWFRMFMT)
2519  {
2520  // This is a shape of a shape+frame pair and my frame has changed. Make sure my content is
2521  // in sync with the frame's content.
2523  {
2524  SwAttrSet aSet(GetAttrSet());
2526  aSet.Put(aContent);
2527  SetFormatAttr(aSet);
2528  }
2529  }
2530 }
2531 
2533 {
2534  return true;
2535 }
2536 
2537 void SwFrameFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
2538 {
2539  auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
2540  if(!pLegacy)
2541  return;
2542  const sal_uInt16 nNewWhich = pLegacy->m_pNew ? pLegacy->m_pNew->Which() : 0;
2543  const SwAttrSetChg* pNewAttrSetChg = nullptr;
2544  const SwFormatHeader* pH = nullptr;
2545  const SwFormatFooter* pF = nullptr;
2546  const SwPosition* pNewAnchorPosition = nullptr;
2547  switch(nNewWhich)
2548  {
2549  case RES_ATTRSET_CHG:
2550  {
2551  pNewAttrSetChg = static_cast<const SwAttrSetChg*>(pLegacy->m_pNew);
2552  pH = pNewAttrSetChg->GetChgSet()->GetItem(RES_HEADER, false);
2553  pF = pNewAttrSetChg->GetChgSet()->GetItem(RES_FOOTER, false);
2554 
2555  // reset fill information
2557  {
2558  SfxItemIter aIter(*pNewAttrSetChg->GetChgSet());
2559  for(const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
2560  {
2561  if(!IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST)
2562  {
2563  maFillAttributes.reset();
2564  break;
2565  }
2566  }
2567  }
2568  const SwFormatAnchor* pAnchor = pNewAttrSetChg->GetChgSet()->GetItem(RES_ANCHOR, false);
2569  if(pAnchor)
2570  {
2571  pNewAnchorPosition = pAnchor->GetContentAnchor();
2572  assert(pNewAnchorPosition == nullptr || // style's set must not contain position!
2573  pNewAttrSetChg->GetTheChgdSet() == &m_aSet);
2574  }
2575  break;
2576  }
2577  case RES_FMT_CHG:
2578  {
2579  // reset fill information on format change (e.g. style changed)
2581  maFillAttributes.reset();
2582  break;
2583  }
2584  case RES_HEADER:
2585  pH = static_cast<const SwFormatHeader*>(pLegacy->m_pNew);
2586  break;
2587  case RES_FOOTER:
2588  pF = static_cast<const SwFormatFooter*>(pLegacy->m_pNew);
2589  break;
2590  case RES_ANCHOR:
2591  pNewAnchorPosition = static_cast<const SwFormatAnchor*>(pLegacy->m_pNew)->GetContentAnchor();
2592  break;
2593  }
2594  const sal_uInt16 nOldWhich = pLegacy->m_pOld ? pLegacy->m_pOld->Which() : 0;
2595  const SwPosition* pOldAnchorPosition = nullptr;
2596  switch(nOldWhich)
2597  {
2598  case RES_ATTRSET_CHG:
2599  {
2600  const SwAttrSetChg* pOldAttrSetChg = nullptr;
2601  pOldAttrSetChg = static_cast<const SwAttrSetChg*>(pLegacy->m_pOld);
2602  const SwFormatAnchor* pAnchor = pOldAttrSetChg->GetChgSet()->GetItem(RES_ANCHOR, false);
2603  if(pAnchor)
2604  {
2605  pOldAnchorPosition = pAnchor->GetContentAnchor();
2606  assert(pOldAnchorPosition == nullptr || // style's set must not contain position!
2607  pOldAttrSetChg->GetTheChgdSet() == &m_aSet);
2608  }
2609  break;
2610  }
2611  case RES_ANCHOR:
2612  pOldAnchorPosition = static_cast<const SwFormatAnchor*>(pLegacy->m_pOld)->GetContentAnchor();
2613  break;
2614  case RES_REMOVE_UNO_OBJECT:
2615  SetXObject(uno::Reference<uno::XInterface>(nullptr));
2616  break;
2617  }
2618 
2619  assert(nOldWhich == nNewWhich || !nOldWhich || !nNewWhich);
2620  if(pH && pH->IsActive() && !pH->GetHeaderFormat())
2621  { //If he doesn't have one, I'll add one
2622  SwFrameFormat* pFormat = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFormat(RndStdIds::HEADER, nullptr);
2623  const_cast<SwFormatHeader*>(pH)->RegisterToFormat(*pFormat);
2624  }
2625  if(pF && pF->IsActive() && !pF->GetFooterFormat())
2626  { //If he doesn't have one, I'll add one
2627  SwFrameFormat* pFormat = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFormat(RndStdIds::FOOTER, nullptr);
2628  const_cast<SwFormatFooter*>(pF)->RegisterToFormat(*pFormat);
2629  }
2630  SwFormat::SwClientNotify(rMod, rHint);
2631  if(pOldAnchorPosition != nullptr && (pNewAnchorPosition == nullptr || pOldAnchorPosition->nNode.GetIndex() != pNewAnchorPosition->nNode.GetIndex()))
2632  pOldAnchorPosition->nNode.GetNode().RemoveAnchoredFly(this);
2633  if(pNewAnchorPosition != nullptr && (pOldAnchorPosition == nullptr || pOldAnchorPosition->nNode.GetIndex() != pNewAnchorPosition->nNode.GetIndex()))
2634  pNewAnchorPosition->nNode.GetNode().AddAnchoredFly(this);
2635 }
2636 
2638 {
2639  rFormat.Add( this );
2640 }
2641 
2644 {
2645  SwIterator<SwFrame,SwFormat> aIter( *this );
2646  SwFrame * pLast = aIter.First();
2647  if( pLast )
2648  do {
2649  pLast->Cut();
2650  SwFrame::DestroyFrame(pLast);
2651  } while( nullptr != ( pLast = aIter.Next() ));
2652 }
2653 
2655 {
2656  assert(false); // unimplemented in base class
2657 }
2658 
2659 SwRect SwFrameFormat::FindLayoutRect( const bool bPrtArea, const Point* pPoint ) const
2660 {
2661  SwRect aRet;
2662  SwFrame *pFrame = nullptr;
2663  if( auto pSectionFormat = dynamic_cast<const SwSectionFormat*>( this ))
2664  {
2665  // get the Frame using Node2Layout
2666  const SwSectionNode* pSectNd = pSectionFormat->GetSectionNode();
2667  if( pSectNd )
2668  {
2669  SwNode2Layout aTmp( *pSectNd, pSectNd->GetIndex() - 1 );
2670  pFrame = aTmp.NextFrame();
2671 
2672  if( pFrame && !pFrame->KnowsFormat(*this) )
2673  {
2674  // the Section doesn't have his own Frame, so if someone
2675  // needs the real size, we have to implement this by requesting
2676  // the matching Frame from the end.
2677  // PROBLEM: what happens if SectionFrames overlaps multiple
2678  // pages?
2679  if( bPrtArea )
2680  aRet = pFrame->getFramePrintArea();
2681  else
2682  {
2683  aRet = pFrame->getFrameArea();
2684  aRet.Pos().AdjustY( -1 );
2685  }
2686  pFrame = nullptr; // the rect is finished by now
2687  }
2688  }
2689  }
2690  else
2691  {
2692  const SwFrameType nFrameType = RES_FLYFRMFMT == Which() ? SwFrameType::Fly : FRM_ALL;
2693  std::pair<Point, bool> tmp;
2694  if (pPoint)
2695  {
2696  tmp.first = *pPoint;
2697  tmp.second = false;
2698  }
2699  pFrame = ::GetFrameOfModify(nullptr, *this, nFrameType, nullptr, pPoint ? &tmp : nullptr);
2700  }
2701 
2702  if( pFrame )
2703  {
2704  if( bPrtArea )
2705  aRet = pFrame->getFramePrintArea();
2706  else
2707  aRet = pFrame->getFrameArea();
2708  }
2709  return aRet;
2710 }
2711 
2713 {
2714  if( RES_FLYFRMFMT == Which() )
2715  {
2716  Point aNullPt;
2717  std::pair<Point, bool> const tmp(aNullPt, false);
2718  SwFlyFrame* pFly = static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *this, SwFrameType::Fly,
2719  nullptr, &tmp));
2720  return pFly ? pFly->GetVirtDrawObj() : nullptr;
2721  }
2722  return FindSdrObject();
2723 }
2724 
2725 bool SwFrameFormat::IsLowerOf( const SwFrameFormat& rFormat ) const
2726 {
2727  //Also linking from inside to outside or from outside to inside is not
2728  //allowed.
2730  if( pSFly )
2731  {
2732  SwFlyFrame *pAskFly = SwIterator<SwFlyFrame,SwFormat>(rFormat).First();
2733  if( pAskFly )
2734  return pSFly->IsLowerOf( pAskFly );
2735  }
2736 
2737  // let's try it using the node positions
2738  const SwFormatAnchor* pAnchor = &rFormat.GetAnchor();
2739  if ((RndStdIds::FLY_AT_PAGE != pAnchor->GetAnchorId()) && pAnchor->GetContentAnchor())
2740  {
2741  const SwFrameFormats& rFormats = *GetDoc()->GetSpzFrameFormats();
2742  const SwNode* pFlyNd = pAnchor->GetContentAnchor()->nNode.GetNode().
2743  FindFlyStartNode();
2744  while( pFlyNd )
2745  {
2746  // then we walk up using the anchor
2747  size_t n;
2748  for( n = 0; n < rFormats.size(); ++n )
2749  {
2750  const SwFrameFormat* pFormat = rFormats[ n ];
2751  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2752  if( pIdx && pFlyNd == &pIdx->GetNode() )
2753  {
2754  if( pFormat == this )
2755  return true;
2756 
2757  pAnchor = &pFormat->GetAnchor();
2758  if ((RndStdIds::FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
2759  !pAnchor->GetContentAnchor() )
2760  {
2761  return false;
2762  }
2763 
2764  pFlyNd = pAnchor->GetContentAnchor()->nNode.GetNode().
2765  FindFlyStartNode();
2766  break;
2767  }
2768  }
2769  if( n >= rFormats.size() )
2770  {
2771  OSL_ENSURE( false, "Fly section but no format found" );
2772  return false;
2773  }
2774  }
2775  }
2776  return false;
2777 }
2778 
2779 // #i31698#
2781 {
2782  return SwFrameFormat::HORI_L2R;
2783 }
2784 
2786 {
2787  // empty body, because default implementation does nothing
2788 }
2789 
2790 // #i28749#
2792 {
2793  return text::PositionLayoutDir::PositionInLayoutDirOfAnchor;
2794 }
2796 {
2797  // empty body, because default implementation does nothing
2798 }
2799 
2801 {
2802  return SwResId(STR_FRAME);
2803 }
2804 
2806 {
2807  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFrameFormat"));
2808  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
2809  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
2810  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%d", Which());
2811 
2812  const char* pWhich = nullptr;
2813  switch (Which())
2814  {
2815  case RES_FLYFRMFMT:
2816  pWhich = "fly frame format";
2817  break;
2818  case RES_DRAWFRMFMT:
2819  pWhich = "draw frame format";
2820  break;
2821  }
2822  if (pWhich)
2823  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("which"), BAD_CAST(pWhich));
2824 
2826  {
2827  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("OtherTextBoxFormat"), "%p", m_pOtherTextBoxFormat);
2828  }
2829 
2830  GetAttrSet().dumpAsXml(pWriter);
2831 
2832  if (const SdrObject* pSdrObject = FindSdrObject())
2833  pSdrObject->dumpAsXml(pWriter);
2834 
2835  xmlTextWriterEndElement(pWriter);
2836 }
2837 
2838 void SwFrameFormats::dumpAsXml(xmlTextWriterPtr pWriter, const char* pName) const
2839 {
2840  xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
2841  for (const SwFrameFormat *pFormat : m_PosIndex)
2842  pFormat->dumpAsXml(pWriter);
2843  xmlTextWriterEndElement(pWriter);
2844 }
2845 
2846 
2847 SwFlyFrameFormat::SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, SwFrameFormat *pDrvdFrame )
2848  : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FLYFRMFMT )
2849 {}
2850 
2852 {
2853  SwIterator<SwFlyFrame,SwFormat> aIter( *this );
2854  SwFlyFrame * pLast = aIter.First();
2855  if( pLast )
2856  do
2857  {
2858  SwFrame::DestroyFrame(pLast);
2859  } while( nullptr != ( pLast = aIter.Next() ));
2860 
2861 }
2862 
2864 {
2865  if(!m_pContact)
2866  {
2867  SwDrawModel* pDrawModel(GetDoc()->getIDocumentDrawModelAccess().GetOrCreateDrawModel());
2868  m_pContact.reset(new SwFlyDrawContact(this, *pDrawModel));
2869  }
2870 
2871  return m_pContact.get();
2872 }
2873 
2877 {
2878  // is there a layout?
2879  if( !GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() )
2880  return;
2881 
2882  sw::BroadcastingModify *pModify = nullptr;
2883  // OD 24.07.2003 #111032# - create local copy of anchor attribute for possible changes.
2884  SwFormatAnchor aAnchorAttr( GetAnchor() );
2885  switch( aAnchorAttr.GetAnchorId() )
2886  {
2887  case RndStdIds::FLY_AS_CHAR:
2888  case RndStdIds::FLY_AT_PARA:
2889  case RndStdIds::FLY_AT_CHAR:
2890  if( aAnchorAttr.GetContentAnchor() )
2891  {
2892  pModify = aAnchorAttr.GetContentAnchor()->nNode.GetNode().GetContentNode();
2893  }
2894  break;
2895 
2896  case RndStdIds::FLY_AT_FLY:
2897  if( aAnchorAttr.GetContentAnchor() )
2898  {
2899  //First search in the content because this is O(1)
2900  //This can go wrong for linked frames because in this case it's
2901  //possible, that no Frame exists for this content.
2902  //In such a situation we also need to search from StartNode to
2903  //FrameFormat.
2904  SwNodeIndex aIdx( aAnchorAttr.GetContentAnchor()->nNode );
2905  SwContentNode *pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
2906  // #i105535#
2907  if ( pCNd == nullptr )
2908  {
2909  pCNd = aAnchorAttr.GetContentAnchor()->nNode.GetNode().GetContentNode();
2910  }
2911  if ( pCNd )
2912  {
2914  {
2915  pModify = pCNd;
2916  }
2917  }
2918  // #i105535#
2919  if ( pModify == nullptr )
2920  {
2921  const SwNodeIndex &rIdx = aAnchorAttr.GetContentAnchor()->nNode;
2922  SwFrameFormats& rFormats = *GetDoc()->GetSpzFrameFormats();
2923  for( size_t i = 0; i < rFormats.size(); ++i )
2924  {
2925  SwFrameFormat* pFlyFormat = rFormats[i];
2926  if( pFlyFormat->GetContent().GetContentIdx() &&
2927  rIdx == *pFlyFormat->GetContent().GetContentIdx() )
2928  {
2929  pModify = pFlyFormat;
2930  break;
2931  }
2932  }
2933  }
2934  }
2935  break;
2936 
2937  case RndStdIds::FLY_AT_PAGE:
2938  {
2939  sal_uInt16 nPgNum = aAnchorAttr.GetPageNum();
2941  if( nPgNum == 0 && aAnchorAttr.GetContentAnchor() )
2942  {
2943  SwContentNode *pCNd = aAnchorAttr.GetContentAnchor()->nNode.GetNode().GetContentNode();
2945  for ( SwFrame* pFrame = aIter.First(); pFrame != nullptr; pFrame = aIter.Next() )
2946  {
2947  pPage = pFrame->FindPageFrame();
2948  if( pPage )
2949  {
2950  nPgNum = pPage->GetPhyPageNum();
2951  aAnchorAttr.SetPageNum( nPgNum );
2952  aAnchorAttr.SetAnchor( nullptr );
2953  SetFormatAttr( aAnchorAttr );
2954  break;
2955  }
2956  }
2957  }
2958  while ( pPage )
2959  {
2960  if ( pPage->GetPhyPageNum() == nPgNum )
2961  {
2962  // #i50432# - adjust synopsis of <PlaceFly(..)>
2963  pPage->PlaceFly( nullptr, this );
2964  break;
2965  }
2966  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
2967  }
2968  }
2969  break;
2970  default:
2971  break;
2972  }
2973 
2974  if( !pModify )
2975  return;
2976 
2978  for( SwFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
2979  {
2980  bool bAdd = !pFrame->IsContentFrame() ||
2981  !static_cast<SwContentFrame*>(pFrame)->IsFollow();
2982 
2983  if ( RndStdIds::FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrame->IsFlyFrame() )
2984  {
2985  SwFrame* pFlyFrame = pFrame->FindFlyFrame();
2986  if ( pFlyFrame )
2987  {
2988  pFrame = pFlyFrame;
2989  }
2990  else
2991  {
2992  aAnchorAttr.SetType( RndStdIds::FLY_AT_PARA );
2993  SetFormatAttr( aAnchorAttr );
2994  MakeFrames();
2995  return;
2996  }
2997  }
2998 
2999  if (bAdd)
3000  {
3001  switch (aAnchorAttr.GetAnchorId())
3002  {
3003  case RndStdIds::FLY_AS_CHAR:
3004  case RndStdIds::FLY_AT_PARA:
3005  case RndStdIds::FLY_AT_CHAR:
3006  {
3007  assert(pFrame->IsTextFrame());
3008  bAdd = IsAnchoredObjShown(*static_cast<SwTextFrame*>(pFrame), aAnchorAttr);
3009  }
3010  break;
3011  default:
3012  break;
3013  }
3014  }
3015 
3016  if (bAdd && pFrame->GetDrawObjs())
3017  {
3018  // #i28701# - new type <SwSortedObjs>
3019  SwSortedObjs &rObjs = *pFrame->GetDrawObjs();
3020  for(SwAnchoredObject* pObj : rObjs)
3021  {
3022  // #i28701# - consider changed type of
3023  // <SwSortedObjs> entries.
3024  if( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr &&
3025  (&pObj->GetFrameFormat()) == this )
3026  {
3027  bAdd = false;
3028  break;
3029  }
3030  }
3031  }
3032 
3033  if( bAdd )
3034  {
3035  SwFlyFrame *pFly = nullptr; // avoid warnings
3036  switch( aAnchorAttr.GetAnchorId() )
3037  {
3038  case RndStdIds::FLY_AT_FLY:
3039  pFly = new SwFlyLayFrame( this, pFrame, pFrame );
3040  break;
3041 
3042  case RndStdIds::FLY_AT_PARA:
3043  case RndStdIds::FLY_AT_CHAR:
3044  pFly = new SwFlyAtContentFrame( this, pFrame, pFrame );
3045  break;
3046 
3047  case RndStdIds::FLY_AS_CHAR:
3048  pFly = new SwFlyInContentFrame( this, pFrame, pFrame );
3049  break;
3050 
3051  default:
3052  assert(false && "New anchor type" );
3053  }
3054  pFrame->AppendFly( pFly );
3055  pFly->GetFormat()->SetObjTitle(GetObjTitle());
3057  SwPageFrame *pPage = pFly->FindPageFrame();
3058  if( pPage )
3059  ::RegistFlys( pPage, pFly );
3060  }
3061  }
3062 }
3063 
3064 SwFlyFrame* SwFlyFrameFormat::GetFrame( const Point* pPoint ) const
3065 {
3066  std::pair<Point, bool> tmp;
3067  if (pPoint)
3068  {
3069  tmp.first = *pPoint;
3070  tmp.second = false;
3071  }
3072  return static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *this, SwFrameType::Fly,
3073  nullptr, &tmp));
3074 }
3075 
3077 {
3078  SwFlyFrame* pFlyFrame( GetFrame() );
3079  if ( pFlyFrame )
3080  {
3081  return pFlyFrame;
3082  }
3083  else
3084  {
3085  return nullptr;
3086  }
3087 }
3088 
3090 {
3091  bool bRet = true;
3092  switch( rInfo.Which() )
3093  {
3094  case RES_CONTENT_VISIBLE:
3095  {
3096  static_cast<SwPtrMsgPoolItem&>(rInfo).pObject = SwIterator<SwFrame,SwFormat>( *this ).First();
3097  }
3098  bRet = false;
3099  break;
3100 
3101  default:
3102  bRet = SwFrameFormat::GetInfo( rInfo );
3103  break;
3104  }
3105  return bRet;
3106 }
3107 
3108 // #i73249#
3109 void SwFlyFrameFormat::SetObjTitle( const OUString& rTitle, bool bBroadcast )
3110 {
3111  SdrObject* pMasterObject = FindSdrObject();
3112  OSL_ENSURE( pMasterObject, "<SwFlyFrameFormat::SetObjTitle(..)> - missing <SdrObject> instance" );
3113  msTitle = rTitle;
3114  if ( !pMasterObject )
3115  {
3116  return;
3117  }
3118 
3119  const SwStringMsgPoolItem aOld(RES_TITLE_CHANGED, pMasterObject->GetTitle());
3120  pMasterObject->SetTitle(rTitle);
3121  if(bBroadcast)
3122  {
3123  const SwStringMsgPoolItem aNew(RES_TITLE_CHANGED, rTitle);
3124  GetNotifier().Broadcast(sw::LegacyModifyHint(&aOld, &aNew));
3125  }
3126 }
3127 
3129 {
3130  const SdrObject* pMasterObject = FindSdrObject();
3131  OSL_ENSURE( pMasterObject, "<SwFlyFrameFormat::GetObjTitle(..)> - missing <SdrObject> instance" );
3132  if ( !pMasterObject )
3133  {
3134  return msTitle;
3135  }
3136  if (!pMasterObject->GetTitle().isEmpty())
3137  return pMasterObject->GetTitle();
3138  else
3139  return msTitle;
3140 }
3141 
3142 void SwFlyFrameFormat::SetObjDescription( const OUString& rDescription, bool bBroadcast )
3143 {
3144  SdrObject* pMasterObject = FindSdrObject();
3145  OSL_ENSURE( pMasterObject, "<SwFlyFrameFormat::SetDescription(..)> - missing <SdrObject> instance" );
3146  msDesc = rDescription;
3147  if ( !pMasterObject )
3148  {
3149  return;
3150  }
3151 
3152  const SwStringMsgPoolItem aOld( RES_DESCRIPTION_CHANGED, pMasterObject->GetDescription() );
3153  pMasterObject->SetDescription( rDescription );
3154  if(bBroadcast)
3155  {
3156  const SwStringMsgPoolItem aNew( RES_DESCRIPTION_CHANGED, rDescription );
3157  GetNotifier().Broadcast(sw::LegacyModifyHint(&aOld, &aNew));
3158  }
3159 }
3160 
3162 {
3163  const SdrObject* pMasterObject = FindSdrObject();
3164  OSL_ENSURE( pMasterObject, "<SwFlyFrameFormat::GetDescription(..)> - missing <SdrObject> instance" );
3165  if ( !pMasterObject )
3166  {
3167  return msDesc;
3168  }
3169  if (!pMasterObject->GetDescription().isEmpty())
3170  return pMasterObject->GetDescription();
3171  else
3172  return msDesc;
3173 }
3174 
3185 {
3187  {
3188  return getSdrAllFillAttributesHelper()->isTransparent();
3189  }
3190 
3191  // NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
3192  // and there is no background graphic, it "inherites" the background
3193  // from its anchor.
3194  std::unique_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
3195  if ( aBackground &&
3196  aBackground->GetColor().IsTransparent() &&
3197  aBackground->GetColor() != COL_TRANSPARENT
3198  )
3199  {
3200  return true;
3201  }
3202  else
3203  {
3204  const GraphicObject *pTmpGrf = aBackground->GetGraphicObject();
3205  if ( pTmpGrf &&
3206  pTmpGrf->GetAttr().IsTransparent()
3207  )
3208  {
3209  return true;
3210  }
3211  }
3212 
3213  return false;
3214 }
3215 
3227 {
3229  {
3230  return !getSdrAllFillAttributesHelper()->isUsed();
3231  }
3232  else
3233  {
3234  std::unique_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
3235  if ( aBackground &&
3236  (aBackground->GetColor() == COL_TRANSPARENT) &&
3237  !(aBackground->GetGraphicObject()) )
3238  {
3239  return true;
3240  }
3241  }
3242 
3243  return false;
3244 }
3245 
3247  const SwFormatAnchor& _rNewAnchorFormat,
3248  SwFlyFrame const * _pKeepThisFlyFrame )
3249  : mrFlyFrameFormat( _rFlyFrameFormat ),
3250  mbAnchorNodeChanged( false ),
3251  mpWrtShell(nullptr)
3252 {
3253  const SwFormatAnchor& aOldAnchorFormat(_rFlyFrameFormat.GetAnchor());
3254  const RndStdIds nNewAnchorType( _rNewAnchorFormat.GetAnchorId() );
3255  if ( ((nNewAnchorType == RndStdIds::FLY_AT_PARA) ||
3256  (nNewAnchorType == RndStdIds::FLY_AT_CHAR)) &&
3257  _rNewAnchorFormat.GetContentAnchor() &&
3258  _rNewAnchorFormat.GetContentAnchor()->nNode.GetNode().GetContentNode() )
3259  {
3260  if ( aOldAnchorFormat.GetAnchorId() == nNewAnchorType &&
3261  aOldAnchorFormat.GetContentAnchor() &&
3262  aOldAnchorFormat.GetContentAnchor()->nNode.GetNode().GetContentNode() &&
3263  aOldAnchorFormat.GetContentAnchor()->nNode !=
3264  _rNewAnchorFormat.GetContentAnchor()->nNode )
3265  {
3266  // determine 'old' number of anchor frames
3267  sal_uInt32 nOldNumOfAnchFrame( 0 );
3269  *(aOldAnchorFormat.GetContentAnchor()->nNode.GetNode().GetContentNode()) );
3270  for( SwFrame* pOld = aOldIter.First(); pOld; pOld = aOldIter.Next() )
3271  {
3272  ++nOldNumOfAnchFrame;
3273  }
3274  // determine 'new' number of anchor frames
3275  sal_uInt32 nNewNumOfAnchFrame( 0 );
3277  *(_rNewAnchorFormat.GetContentAnchor()->nNode.GetNode().GetContentNode()) );
3278  for( SwFrame* pNew = aNewIter.First(); pNew; pNew = aNewIter.Next() )
3279  {
3280  ++nNewNumOfAnchFrame;
3281  }
3282  if ( nOldNumOfAnchFrame != nNewNumOfAnchFrame )
3283  {
3284  // delete existing fly frames except <_pKeepThisFlyFrame>
3286  SwFrame* pFrame = aIter.First();
3287  if ( pFrame )
3288  {
3289  do {
3290  if ( pFrame != _pKeepThisFlyFrame )
3291  {
3292  pFrame->Cut();
3293  SwFrame::DestroyFrame(pFrame);
3294  }
3295  } while( nullptr != ( pFrame = aIter.Next() ));
3296  }
3297  // indicate, that re-creation of fly frames necessary
3298  mbAnchorNodeChanged = true;
3299  }
3300  }
3301  }
3302 
3303  if (aOldAnchorFormat.GetContentAnchor()
3304  && aOldAnchorFormat.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
3305  {
3306  mpCommentAnchor.reset(new SwPosition(*aOldAnchorFormat.GetContentAnchor()));
3307  }
3308 
3309  if (_pKeepThisFlyFrame)
3310  {
3311  SwViewShell* pViewShell = _pKeepThisFlyFrame->getRootFrame()->GetCurrShell();
3312  mpWrtShell = dynamic_cast<SwWrtShell*>(pViewShell);
3313  }
3314 }
3315 
3317 {
3318  if ( mbAnchorNodeChanged )
3319  {
3321  }
3322 
3323  // See if the fly frame had a comment: if so, move it to the new anchor as well.
3324  if (!mpCommentAnchor)
3325  {
3326  return;
3327  }
3328 
3329  SwTextNode* pTextNode = mpCommentAnchor->nNode.GetNode().GetTextNode();
3330  if (!pTextNode)
3331  {
3332  return;
3333  }
3334 
3335  const SwTextField* pField = pTextNode->GetFieldTextAttrAt(mpCommentAnchor->nContent.GetIndex());
3336  if (!pField || pField->GetFormatField().GetField()->GetTyp()->Which() != SwFieldIds::Postit)
3337  {
3338  return;
3339  }
3340 
3341  if (!mpWrtShell)
3342  {
3343  return;
3344  }
3345 
3346  // Save current cursor position, so we can restore it later.
3347  mpWrtShell->Push();
3348 
3349  // Set up the source of the move: the old comment anchor.
3350  {
3351  SwPaM& rCursor = mpWrtShell->GetCurrentShellCursor();
3352  *rCursor.GetPoint() = *mpCommentAnchor;
3353  rCursor.SetMark();
3354  *rCursor.GetMark() = *mpCommentAnchor;
3355  ++rCursor.GetMark()->nContent;
3356  }
3357 
3358  // Set up the target of the move: the new comment anchor.
3359  const SwFormatAnchor& rNewAnchorFormat = mrFlyFrameFormat.GetAnchor();
3361  *mpWrtShell->GetCurrentShellCursor().GetPoint() = *rNewAnchorFormat.GetContentAnchor();
3362 
3363  // Move by copying and deleting.
3364  mpWrtShell->SwEditShell::Copy(*mpWrtShell);
3366 
3367  mpWrtShell->Delete();
3368 
3370 }
3371 
3372 namespace sw
3373 {
3385 }
3386 
3388 {
3390 }
3391 
3393 {
3395 }
3396 
3398 {
3400 }
3401 
3402 // #i31698#
3404 {
3405  return meLayoutDir;
3406 }
3407 
3409 {
3410  meLayoutDir = _eLayoutDir;
3411 }
3412 
3413 // #i28749#
3415 {
3416  return mnPositionLayoutDir;
3417 }
3418 void SwDrawFrameFormat::SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir )
3419 {
3420  switch ( _nPositionLayoutDir )
3421  {
3422  case text::PositionLayoutDir::PositionInHoriL2R:
3423  case text::PositionLayoutDir::PositionInLayoutDirOfAnchor:
3424  {
3425  mnPositionLayoutDir = _nPositionLayoutDir;
3426  }
3427  break;
3428  default:
3429  {
3430  OSL_FAIL( "<SwDrawFrameFormat::SetPositionLayoutDir(..)> - invalid attribute value." );
3431  }
3432  }
3433 }
3434 
3436 {
3437  OUString aResult;
3438  const SdrObject * pSdrObj = FindSdrObject();
3439 
3440  if (pSdrObj)
3441  {
3442  if (pSdrObj != m_pSdrObjectCached)
3443  {
3445  m_pSdrObjectCached = pSdrObj;
3446  }
3447 
3448  aResult = m_sSdrObjectCachedComment;
3449  }
3450  else
3451  aResult = SwResId(STR_GRAPHIC);
3452 
3453  return aResult;
3454 }
3455 
3457  const SwFlyFrame *pFly ) const
3458 {
3459  const SwFormatURL &rURL = GetURL();
3460  if( !rURL.GetMap() )
3461  return nullptr;
3462 
3463  if( !pFly )
3464  {
3465  pFly = SwIterator<SwFlyFrame,SwFormat>( *this ).First();
3466  if( !pFly )
3467  return nullptr;
3468  }
3469 
3470  //Original size for OLE and graphic is TwipSize, otherwise the size of
3471  //FrameFormat of the Fly.
3472  const SwFrame *pRef;
3473  const SwNoTextNode *pNd = nullptr;
3474  Size aOrigSz;
3475  if( pFly->Lower() && pFly->Lower()->IsNoTextFrame() )
3476  {
3477  pRef = pFly->Lower();
3478  pNd = static_cast<const SwNoTextFrame*>(pRef)->GetNode()->GetNoTextNode();
3479  aOrigSz = pNd->GetTwipSize();
3480  }
3481  else
3482  {
3483  pRef = pFly;
3484  aOrigSz = pFly->GetFormat()->GetFrameSize().GetSize();
3485  }
3486 
3487  if( !aOrigSz.IsEmpty() )
3488  {
3489  Point aPos( rPoint );
3490  Size aActSz ( pRef == pFly ? pFly->getFrameArea().SSize() : pRef->getFramePrintArea().SSize() );
3491  const MapMode aSrc ( MapUnit::MapTwip );
3492  const MapMode aDest( MapUnit::Map100thMM );
3493  aOrigSz = OutputDevice::LogicToLogic( aOrigSz, aSrc, aDest );
3494  aActSz = OutputDevice::LogicToLogic( aActSz, aSrc, aDest );
3495  aPos -= pRef->getFrameArea().Pos();
3496  aPos -= pRef->getFramePrintArea().Pos();
3497  aPos = OutputDevice::LogicToLogic( aPos, aSrc, aDest );
3498  sal_uInt32 nFlags = 0;
3499  if ( pFly != pRef && pNd->IsGrfNode() )
3500  {
3501  const MirrorGraph nMirror = pNd->GetSwAttrSet().
3502  GetMirrorGrf().GetValue();
3503  if ( MirrorGraph::Both == nMirror )
3505  else if ( MirrorGraph::Vertical == nMirror )
3506  nFlags = IMAP_MIRROR_VERT;
3507  else if ( MirrorGraph::Horizontal == nMirror )
3508  nFlags = IMAP_MIRROR_HORZ;
3509 
3510  }
3511  return const_cast<ImageMap*>(rURL.GetMap())->GetHitIMapObject( aOrigSz,
3512  aActSz, aPos, nFlags );
3513  }
3514 
3515  return nullptr;
3516 }
3517 
3519 {
3521  {
3522  // create FillAttributes on demand
3523  if(!maFillAttributes)
3524  {
3525  const_cast< SwFrameFormat* >(this)->maFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(GetAttrSet());
3526  }
3527  }
3528  else
3529  {
3530  // FALLBACKBREAKHERE assert wrong usage
3531  OSL_ENSURE(false, "getSdrAllFillAttributesHelper() call only valid for RES_FLYFRMFMT and RES_FRMFMT (!)");
3532  }
3533 
3534  return maFillAttributes;
3535 }
3536 
3537 void SwFrameFormat::MoveTableBox(SwTableBox& rTableBox, const SwFrameFormat* pOldFormat)
3538 {
3539  Add(&rTableBox);
3540  if(!pOldFormat)
3541  return;
3542  const auto& rOld = pOldFormat->GetFormatAttr(RES_BOXATR_FORMAT);
3543  const auto& rNew = GetFormatAttr(RES_BOXATR_FORMAT);
3544  if(rOld != rNew)
3545  SwClientNotify(*this, sw::LegacyModifyHint(&rOld, &rNew));
3546 }
3547 
3548 
3549 namespace sw {
3550 
3552 {
3553  const SwFlyFrameFormat* pFlyFrameFormat = dynamic_cast<const SwFlyFrameFormat*>(&rFormat);
3554  if (!pFlyFrameFormat)
3555  return false;
3556  SwFlyFrame* pFlyFrame = pFlyFrameFormat->GetFrame();
3557  if (!pFlyFrame) // fdo#54648: "hidden" drawing object has no layout frame
3558  {
3559  return false;
3560  }
3561  SwPageFrame* pPageFrame = pFlyFrame->FindPageFrameOfAnchor();
3562  SwFrame* pHeader = pPageFrame->Lower();
3563  if (pHeader->GetType() == SwFrameType::Header)
3564  {
3565  const SwFrame* pFrame = pFlyFrame->GetAnchorFrame();
3566  while (pFrame)
3567  {
3568  if (pFrame == pHeader)
3569  return true;
3570  pFrame = pFrame->GetUpper();
3571  }
3572  }
3573  return false;
3574 }
3575 
3577 {
3578 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
3579  SwNodes const& rNodes(rDoc.GetNodes());
3580  sal_uLong const count(rNodes.Count());
3581  for (sal_uLong i = 0; i != count; ++i)
3582  {
3583  SwNode const*const pNode(rNodes[i]);
3584  std::vector<SwFrameFormat*> const*const pFlys(pNode->GetAnchoredFlys());
3585  if (pFlys)
3586  {
3587  for (const auto& rpFly : *pFlys)
3588  {
3589  SwFormatAnchor const& rAnchor((*rpFly).GetAnchor(false));
3590  assert(&rAnchor.GetContentAnchor()->nNode.GetNode() == pNode);
3591  }
3592  }
3593  }
3594  SwFrameFormats const*const pSpzFrameFormats(rDoc.GetSpzFrameFormats());
3595  if (!pSpzFrameFormats)
3596  return;
3597 
3598  for (auto it = pSpzFrameFormats->begin(); it != pSpzFrameFormats->end(); ++it)
3599  {
3600  SwFormatAnchor const& rAnchor((**it).GetAnchor(false));
3601  if (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
3602  {
3603  assert(!rAnchor.GetContentAnchor()
3604  // for invalid documents that lack text:anchor-page-number
3605  // it may have an anchor before MakeFrames() is called
3607  }
3608  else
3609  {
3610  SwNode & rNode(rAnchor.GetContentAnchor()->nNode.GetNode());
3611  std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
3612  assert(std::find(pFlys->begin(), pFlys->end(), *it) != pFlys->end());
3613  switch (rAnchor.GetAnchorId())
3614  {
3615  case RndStdIds::FLY_AT_FLY:
3616  assert(rNode.IsStartNode());
3617  break;
3618  case RndStdIds::FLY_AT_PARA:
3619  assert(rNode.IsTextNode() || rNode.IsTableNode());
3620  break;
3621  case RndStdIds::FLY_AS_CHAR:
3622  case RndStdIds::FLY_AT_CHAR:
3623  assert(rNode.IsTextNode());
3624  break;
3625  default:
3626  assert(false);
3627  break;
3628  }
3629  }
3630  }
3631 #else
3632  (void) rDoc;
3633 #endif
3634 }
3635 
3636 } // namespace sw
3637 
3638 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~SwFormatURL() override
Definition: atrfrm.cxx:1716
OUString AsRGBHexString() const
sal_uInt16 m_nWish
Desired width, borders included.
Definition: fmtclds.hxx:35
SwFormatAnchor & operator=(const SwFormatAnchor &)
Definition: atrfrm.cxx:1511
SwFormatSurround(css::text::WrapTextMode eNew=css::text::WrapTextMode_PARALLEL)
Definition: atrfrm.cxx:1171
const SwAttrSet * GetChgSet() const
What has changed.
Definition: hints.hxx:281
#define MID_GRID_SNAPTOCHARS
Definition: unomid.h:129
virtual ~FindSdrObjectHint() override
Definition: atrfrm.cxx:3381
bool GetValue() const
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrdesc.cxx:426
SvxNumType GetNumberingType() const
virtual ~DrawFormatLayoutCopyHint() override
Definition: atrfrm.cxx:3377
void SetTextBox(bool bIsTextBox)
Definition: dflyobj.hxx:52
Starts a section of nodes in the document model.
Definition: node.hxx:312
const sw::BroadcastingModify * GetDefinedIn() const
Query / set where attribute is anchored.
Definition: fmtpdsc.hxx:68
bool IsContour() const
Definition: fmtsrnd.hxx:53
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: atrfrm.cxx:2537
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2770
Base class of the Writer layout elements.
Definition: frame.hxx:298
tools::Long GetWidth() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:1257
SwFrameFormats * m_ffList
Definition: frmfmt.hxx:74
const ::std::optional< sal_uInt16 > & GetNumOffset() const
Definition: fmtpdsc.hxx:64
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: atrfrm.cxx:672
constexpr TypedWhichId< SwFormatFillOrder > RES_FILL_ORDER(RES_FRMATR_BEGIN)
SVX_NUM_CHARS_UPPER_LETTER_N
const size_t count(pCandidateA->getBorderLines().size())
sal_uLong GetIndex() const
Definition: node.hxx:291
SwFlyDrawContact * GetOrCreateContact()
Definition: atrfrm.cxx:2863
bool hasValue()
void Add(SwClient *pDepend)
Definition: calbck.cxx:171
std::unique_ptr< SwPosition > m_pContentAnchor
0 for page-bound frames.
Definition: fmtanchr.hxx:36
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2859
#define MID_SURROUND_SURROUNDTYPE
Definition: unomid.h:29
SwTextGrid m_eGridType
Definition: tgrditem.hxx:39
virtual SwFormatFillOrder * Clone(SfxItemPool *pPool=nullptr) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfrm.cxx:470
#define MID_PREFIX
Definition: unomid.h:99
void SetWidthPercentRelation(sal_Int16 n)
Definition: fmtfsize.hxx:96
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:1391
Marks a position in the document model.
Definition: pam.hxx:35
void dumpAsXml(xmlTextWriterPtr pWriter) const
const SwField * GetField() const
Definition: fmtfld.hxx:110
constexpr TypedWhichId< SwStringMsgPoolItem > RES_NAME_CHANGED(185)
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:823
virtual SwFormatFooter * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:565
bool IsGrfNode() const
Definition: node.hxx:660
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
OUString GetObjDescription() const
Definition: atrfrm.cxx:3161
sal_Int16 mnPositionLayoutDir
Definition: frmfmt.hxx:364
bool m_bActive
Only for controlling (creation of content).
Definition: fmthdft.hxx:35
bool IsOrtho() const
Definition: fmtclds.hxx:121
void SetHeight(tools::Long n)
SwFlyFrameFormat & mrFlyFrameFormat
void SetPosToggle(bool bNew)
Definition: fmtornt.hxx:96
virtual SwFrameFormat * MakeLayoutFormat(RndStdIds eRequest, const SfxItemSet *pSet)=0
bool m_bOrtho
Only if this flag is set, the setting of GutterWidth will be accompanied by a "visual rearrangement"...
Definition: fmtclds.hxx:82
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
void setWidth(tools::Long nWidth)
void dumpAsXml(xmlTextWriterPtr pWriter, const char *pName) const
Definition: atrfrm.cxx:2838
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
bool IsLowerOf(const SwLayoutFrame *pUpper) const
Definition: fly.cxx:2147
virtual SwFormatURL * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:1738
virtual const SwRootFrame * GetCurrentLayout() const =0
#define IMAP_MIRROR_HORZ
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1796
bool GetDisplayGrid() const
Definition: tgrditem.hxx:93
void ScaleMetrics(tools::Long lMult, tools::Long lDiv) override
Definition: atrfrm.cxx:211
sal_Int16 m_eRelation
Definition: fmtornt.hxx:69
sal_uInt16 GetBaseWidth() const
Definition: tgrditem.hxx:97
virtual ~CheckDrawFrameFormatLayerHint() override
Definition: atrfrm.cxx:3375
constexpr TypedWhichId< SwStringMsgPoolItem > RES_TITLE_CHANGED(186)
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
OUString msDesc
Definition: frmfmt.hxx:191
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define MID_FRMSIZE_SIZE_TYPE
Definition: unomid.h:76
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
virtual SwFormatNoBalancedColumns * Clone(SfxItemPool *pPool=nullptr) const override
"pure virtual methods" of SfxPoolItem
Definition: atrfrm.cxx:1864
virtual SwFormatLineNumber * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:2099
void SetLeft(sal_uInt16 nNew)
Definition: fmtclds.hxx:47
const_iterator find(const value_type &x) const
Definition: docfmt.cxx:2061
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:2056
SwNodeIndex nNode
Definition: pam.hxx:37
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
std::unique_ptr< SwPosition > mpCommentAnchor
If the fly frame has a comment, this points to the old comment anchor.
virtual SwFormatContent * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:603
sal_uInt16 char char * pDesc
virtual bool HasMetrics() const
SwFrameType GetType() const
Definition: frame.hxx:503
bool m_bRubyTextBelow
Definition: tgrditem.hxx:40
#define MID_SUFFIX
Definition: unomid.h:100
SwFrameSize m_eFrameWidthType
Definition: fmtfsize.hxx:46
virtual SwFormatCol * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:905
virtual ~GetZOrderHint() override
Definition: atrfrm.cxx:3383
#define MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT
Definition: unomid.h:84
#define MID_FRMSIZE_REL_WIDTH
Definition: unomid.h:72
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
virtual Size GetTwipSize() const =0
SwFormatFillOrder(SwFillOrder=ATT_TOP_DOWN)
Definition: atrfrm.cxx:466
SwTwips GetPos() const
Definition: fmtornt.hxx:92
sal_uIntPtr sal_uLong
#define SAL_INFO_IF(condition, area, stream)
-""- and with own numberformat
Definition: fmtftntx.hxx:33
sal_Int16 m_eRelation
Definition: fmtornt.hxx:37
long Long
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
OUString m_aFormatName
Definition: format.hxx:50
const SwRect & getFramePrintArea() const
Definition: frame.hxx:179
OUString GetDescription() const
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: atrfrm.cxx:2659
#define MINLAY
Definition: swtypes.hxx:66
Color m_aColor
sal_uInt16 m_nLeft
Left border.
Definition: fmtclds.hxx:38
const SwPosition * GetMark() const
Definition: pam.hxx:209
void SetRight(sal_uInt16 nNew)
Definition: fmtclds.hxx:48
bool IsAnchoredObjShown(SwTextFrame const &rFrame, SwFormatAnchor const &rAnchor)
Definition: frmtool.cxx:1280
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1714
virtual void ScaleMetrics(tools::Long lMult, tools::Long lDiv)
#define MID_VERTORIENT_RELATION
Definition: unomid.h:35
#define MID_URL_HYPERLINKNAME
Definition: unomid.h:47
sal_Int64 n
virtual OUString GetDescription() const
Definition: atrfrm.cxx:2800
If text in multi-column sections should be evenly distributed.
Definition: fmtclbl.hxx:28
ByPos & m_PosIndex
Definition: doc.hxx:187
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: atrfrm.cxx:816
#define MID_PAGEDESC_PAGENUMOFFSET
Definition: unomid.h:27
TElementType * Next()
Definition: calbck.hxx:333
const SfxPoolItem * m_pNew
Definition: calbck.hxx:74
void SetRubyHeight(sal_uInt16 nNew)
Definition: tgrditem.hxx:79
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1322
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:306
bool SvUnoImageMap_fillImageMap(const Reference< XInterface > &xImageMap, ImageMap &rMap)
SwFormatRowSplit(bool bSplit=true)
Definition: fmtrowsplt.hxx:32
SwAnchoredObject * GetAnchoredObj() const
Definition: atrfrm.cxx:3076
#define MIN_TEXTGRID_SIZE
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:785
sal_uInt8 m_nHeightPercent
Definition: fmtfsize.hxx:49
bool GetRubyTextBelow() const
Definition: tgrditem.hxx:85
virtual ~SwFlyFrameFormat() override
Definition: atrfrm.cxx:2851
Color m_aLineColor
Color of the separator line.
Definition: fmtclds.hxx:71
#define MID_NUM_START_AT
Definition: unomid.h:96
SwNode & GetNode() const
Definition: ndindex.hxx:119
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:752
virtual SwFormatLayoutSplit * Clone(SfxItemPool *pPool=nullptr) const override
"pure virtual methods" of SfxPoolItem
Definition: atrfrm.cxx:1854
MirrorGraph
Definition: grfatr.hxx:31
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
void DestroyCursor()
transform TableCursor to normal cursor, nullify Tablemode
Definition: crsrsh.cxx:151
virtual SwFormatHeader * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:515
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:383
virtual ~SwTextGridItem() override
Definition: atrfrm.cxx:2158
void Pos(const Point &rNew)
Definition: swrect.hxx:169
#define MID_SURROUND_ANCHORONLY
Definition: unomid.h:30
#define IMAP_MIRROR_VERT
Dialog to specify the properties of date form field.
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
SwFrameSize m_eFrameHeightType
Definition: fmtfsize.hxx:45
SwColLineAdj m_eAdj
Line will be adjusted top, centered or bottom.
Definition: fmtclds.hxx:76
SwAttrSet m_aSet
Definition: format.hxx:51
void SetPrev(SwFlyFrameFormat *pFormat)
Definition: atrfrm.cxx:2040
#define MID_PAGEDESC_PAGEDESCNAME
Definition: unomid.h:26
SwClient * Remove(SwClient *pDepend)
Definition: calbck.cxx:224
const_iterator end() const
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
virtual SwTextGridItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:2179
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
EmbeddedObjectRef * pObject
virtual ~SwDrawFrameFormat() override
Definition: atrfrm.cxx:3387
virtual ~CreatePortionHint() override
Definition: atrfrm.cxx:3380
SwHandleAnchorNodeChg(SwFlyFrameFormat &_rFlyFrameFormat, const SwFormatAnchor &_rNewAnchorFormat, SwFlyFrame const *_pKeepThisFlyFrame=nullptr)
checks, if re-creation of fly frames for an anchor node change at the given fly frame format is neces...
Definition: atrfrm.cxx:3246
void SetOutside(bool bNew)
Definition: fmtsrnd.hxx:58
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:160
void SetContour(bool bNew)
Definition: fmtsrnd.hxx:57
#define MID_ANCHOR_PAGENUM
Definition: unomid.h:44
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:1754
#define MID_COLLECT
Definition: unomid.h:94
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
void SetNewContentIdx(const SwNodeIndex *pIdx)
Definition: atrfrm.cxx:588
void SetDisplayGrid(bool bNew)
Definition: tgrditem.hxx:94
Value in Var-direction gives minimum (can be exceeded but not be less).
void SetOrtho(bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This too re-arranges columns automatically if flag is set.
Definition: atrfrm.cxx:976
const OUString & GetName() const
Definition: pagedesc.hxx:186
virtual bool operator==(const SfxPoolItem &) const override
Definition: atrfrm.cxx:1895
bool m_bPrintGrid
Definition: tgrditem.hxx:41
bool IsActive() const
Definition: fmthdft.hxx:89
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:188
void AddAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2116
constexpr auto convertTwipToMm100(N n)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_CONTENT_VISIBLE(183)
Used by the UI to modify the document model.
Definition: wrtsh.hxx:91
virtual bool operator==(SfxPoolItem const &other) const override
virtual ~SwFormatHeader() override
Definition: atrfrm.cxx:502
void SetTargetFrameName(const OUString &rStr)
Definition: fmturl.hxx:61
SvxBorderLineStyle
void SetSquaredMode(bool bNew)
Definition: tgrditem.hxx:106
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
#define MID_FRMSIZE_HEIGHT
Definition: unomid.h:75
bool GetSnapToChars() const
Definition: tgrditem.hxx:101
wrapper class for the positioning of Writer fly frames and drawing objects
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:734
virtual SwFormatFootnoteAtTextEnd * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:2003
OUString m_sName
void SetRubyTextBelow(bool bNew)
Definition: tgrditem.hxx:86
#define MID_FRMSIZE_SIZE
Definition: unomid.h:70
void SetBaseWidth(sal_uInt16 nNew)
Definition: tgrditem.hxx:98
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
SwIndex nContent
Definition: pam.hxx:38
virtual ~RestoreFlyAnchorHint() override
Definition: atrfrm.cxx:3379
const SwRect & getFrameArea() const
Definition: frame.hxx:178
#define SAL_MAX_UINT16
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual ~SwFormatFooter() override
Definition: atrfrm.cxx:547
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:1297
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:1673
#define MID_GRID_STANDARD_MODE
Definition: unomid.h:130
void SetOtherTextBoxFormat(SwFrameFormat *pFormat)
Definition: atrfrm.cxx:2493
SwFlyFrameFormat(const SwFlyFrameFormat &rCpy)=delete
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1081
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1222
virtual sal_Int16 GetPositionLayoutDir() const override
Definition: atrfrm.cxx:3414
const OUString & GetName() const
Definition: format.hxx:115
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:608
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
int nCount
at page or document end
Definition: fmtftntx.hxx:30
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
sal_Int16 m_eWidthPercentRelation
Definition: fmtfsize.hxx:48
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:1149
SVX_NUM_ARABIC
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2470
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:41
bool IsAnchorOnly() const
Definition: fmtsrnd.hxx:52
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(161)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(160)
std::vector< SwFrameFormat * > const * GetAnchoredFlys() const
Definition: node.hxx:297
static sal_Int16 lcl_IntToRelation(const uno::Any &rVal)
Definition: atrfrm.cxx:133
#define FRM_ALL
Definition: frame.hxx:101
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: format.cxx:226
virtual ~CollectTextObjectsHint() override
Definition: atrfrm.cxx:3382
virtual bool operator==(const SfxPoolItem &) const override
Definition: atrfrm.cxx:1177
sal_uLong GetStartValue() const
Definition: fmtline.hxx:57
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:195
OUString GetObjTitle() const
Definition: atrfrm.cxx:3128
#define MID_LINENUMBER_STARTVALUE
Definition: unomid.h:61
SwFormatFootnoteAtTextEnd(SwFootnoteEndPosEnum ePos=FTNEND_ATPGORDOCEND)
Definition: fmtftntx.hxx:87
bool IsTransparent() const
SAL_DLLPRIVATE void SetXObject(css::uno::Reference< css::uno::XInterface > const &xObject)
Definition: frmfmt.hxx:170
bool m_bSquaredMode
Definition: tgrditem.hxx:47
OUString m_sURL
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1092
void SetColor(const Color &rCol)
Definition: tgrditem.hxx:70
void SetMap(const ImageMap *pM)
Pointer will be copied.
Definition: atrfrm.cxx:1749
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:1065
sal_Int16 m_eOrient
Definition: fmtornt.hxx:36
sal_Int16 m_eOrient
Definition: fmtornt.hxx:68
virtual SwFormatEndAtTextEnd * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:2010
constexpr TypedWhichId< SwStringMsgPoolItem > RES_DESCRIPTION_CHANGED(187)
virtual void SetPositionLayoutDir(const sal_Int16 _nPositionLayoutDir) override
Definition: atrfrm.cxx:3418
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfrm.cxx:1720
SwColumns m_aColumns
Information concerning the columns.
Definition: fmtclds.hxx:78
bool HasMetrics() const override
Definition: atrfrm.cxx:218
sal_uInt16 m_nBaseWidth
Definition: tgrditem.hxx:45
bool IsBackgroundBrushInherited() const
SwFlyFrameFormat::IsBackgroundBrushInherited.
Definition: atrfrm.cxx:3226
sal_uInt32 m_nOrder
#i28701# - getting anchor positions ordered
Definition: fmtanchr.hxx:43
SwFormatFrameSize(SwFrameSize eSize=SwFrameSize::Variable, SwTwips nWidth=0, SwTwips nHeight=0)
Definition: atrfrm.cxx:226
const OUString & GetName() const
Definition: fmturl.hxx:71
Specific frame formats (frames, DrawObjects).
#define MID_COLUMN_SEPARATOR_LINE
Definition: unomid.h:91
#define MID_SURROUND_CONTOUR
Definition: unomid.h:31
void EndListeningAll()
Definition: calbck.cxx:135
Base class for various Writer styles.
Definition: format.hxx:46
void SetHeightPercentRelation(sal_Int16 n)
Definition: fmtfsize.hxx:94
void PlaceFly(SwFlyFrame *pFly, SwFlyFrameFormat *pFormat)
Definition: flylay.cxx:1108
sw::BroadcastingModify * m_pDefinedIn
Points to the object in which the attribute was set (ContentNode/Format).
Definition: fmtpdsc.hxx:38
bool GetAtPageRelOrientation(sal_Int16 &rOrientation, bool const isIgnorePrintArea)
Definition: atrfrm.cxx:100
ContactObject for connection between frames (or their formats respectively) in SwClient and the drawo...
Definition: dcontact.hxx:175
virtual void Cut()=0
void MoveTableBox(SwTableBox &rTableBox, const SwFrameFormat *pOldFormat)
Definition: atrfrm.cxx:3537
#define MID_FRMSIZE_WIDTH
Definition: unomid.h:74
OUString m_sTargetFrameName
Target frame for URL.
Definition: fmturl.hxx:35
#define MID_CHAIN_NEXTNAME
Definition: unomid.h:57
virtual bool IsBackgroundTransparent() const override
SwFlyFrameFormat::IsBackgroundTransparent.
Definition: atrfrm.cxx:3184
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
#define MID_NUM_TYPE
Definition: unomid.h:98
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:1869
struct _xmlTextWriter * xmlTextWriterPtr
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:2184
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfrm.cxx:2017
sal_uInt16 char * pName
#define MID_ANCHOR_ANCHORTYPE
Definition: unomid.h:43
bool m_bIsServerMap
A ServerSideImageMap with the URL.
Definition: fmturl.hxx:41
Style of a layout element.
Definition: frmfmt.hxx:58
virtual void MakeFrames() override
Register DrawObjects in the arrays at layout.
Definition: atrfrm.cxx:3392
virtual SwFormatRowSplit * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:1859
virtual sal_uInt16 GetValueCount() const override
Definition: atrfrm.cxx:475
virtual SwPaM & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:185
SwFormatAnchor(RndStdIds eRnd=RndStdIds::FLY_AT_PAGE, sal_uInt16 nPageNum=0)
Definition: atrfrm.cxx:1470
virtual SwFormatSurround * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:1186
#define MID_GRID_LINES
Definition: unomid.h:121
#define MID_HORIORIENT_POSITION
Definition: unomid.h:40
#define MID_URL_CLIENTMAP
Definition: unomid.h:48
bool IsEmpty() const
#define MID_GRID_BASEHEIGHT
Definition: unomid.h:122
void Broadcast(const SfxHint &rHint)
SwPaM * CreateCursor()
delete the current cursor and make the following into the current
Definition: crsrsh.cxx:123
SwTwips m_nYPos
Contains always the current RelPos.
Definition: fmtornt.hxx:35
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:1551
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
virtual bool operator==(const SfxPoolItem &) const override
Definition: atrfrm.cxx:234
int i
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
#define MID_URL_URL
Definition: unomid.h:50
bool m_bCountLines
Also count lines of paragraph.
Definition: fmtline.hxx:33
virtual SwFormatVertOrient * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:1292
virtual void SetLayoutDir(const SwFrameFormat::tLayoutDir _eLayoutDir) override
Definition: atrfrm.cxx:3408
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
const SwPosition * GetPoint() const
Definition: pam.hxx:207
#define MID_FRMSIZE_WIDTH_TYPE
Definition: unomid.h:86
SwFrameType
Definition: frame.hxx:73
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: format.cxx:712
virtual SwFrameFormat::tLayoutDir GetLayoutDir() const
Definition: atrfrm.cxx:2780
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
#define MID_GRID_RUBYHEIGHT
Definition: unomid.h:123
#define MID_GRID_PRINT
Definition: unomid.h:126
SwFrame * GetFrameOfModify(const SwRootFrame *pLayout, sw::BroadcastingModify const &, SwFrameType const nFrameType, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr)
const GraphicAttr & GetAttr() const
virtual ~SwFormatPageDesc() override
Definition: atrfrm.cxx:652
virtual bool GetInfo(SfxPoolItem &rInfo) const override
Definition: atrfrm.cxx:3089
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SwPageFrame * FindPageFrame()
Definition: frame.hxx:663
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2241
void ParkCursor(const SwNodeIndex &rIdx)
Remove selections and additional cursors of all shells.
Definition: crsrsh.cxx:2873
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
sal_uInt8 GetLineHeight() const
Definition: fmtclds.hxx:123
#define MID_VERTORIENT_POSITION
Definition: unomid.h:36
const SwFrame * Lower() const
Definition: layfrm.hxx:101
sal_uInt16 GetGutterWidth(bool bMin=false) const
Definition: atrfrm.cxx:910
TElementType * First()
Definition: calbck.hxx:325
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:60
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfrm.cxx:659
SwContentNode * GetContentNode()
Definition: node.hxx:619
virtual SwHeaderAndFooterEatSpacingItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:2419
FlyAnchors.
Definition: fmtanchr.hxx:34
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:1905
sal_uInt16 CalcColWidth(sal_uInt16 nCol, sal_uInt16 nAct) const
Calculates current width of column nCol.
Definition: atrfrm.cxx:983
void SetWidthSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:84
SwClient m_aNext
Next SwFlyFrameFormat (if existent).
Definition: fmtcnct.hxx:33
SwNoTextNode * GetNoTextNode()
Definition: ndnotxt.hxx:96
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
SwTwips m_nXPos
Contains always the current RelPos.
Definition: fmtornt.hxx:67
const SwFormatURL & GetURL(bool=true) const
Definition: fmturl.hxx:78
sal_uInt16 m_nPageNumber
Page number for page-bound frames.
Definition: fmtanchr.hxx:40
SwLayoutFrame * GetUpper()
Definition: frame.hxx:661
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
tools::Long Width() const
virtual void SetName(const OUString &rNewName, bool bBroadcast=false)
Definition: format.cxx:145
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1419
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2643
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfrm.cxx:1377
OUString GetTitle() const
virtual bool operator==(const SfxPoolItem &) const override
"pure virtual methods" of SfxPoolItem
Definition: atrfrm.cxx:1527
SwFormatPageDesc(const SwPageDesc *pDesc=nullptr)
Definition: atrfrm.cxx:632
SwFrameSize GetWidthSizeType() const
Definition: fmtfsize.hxx:83
sal_Int16 m_aWidthAdjustValue
Definition: fmtclds.hxx:80
virtual sal_uInt16 GetValueCount() const override
Definition: atrfrm.cxx:1191
constexpr auto convertMm100ToTwip(N n)
sal_uInt16 m_nWidth
Total desired width of all columns.
Definition: fmtclds.hxx:79
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
bool KnowsPageDesc() const
Definition: atrfrm.cxx:654
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1605
void SetBaseHeight(sal_uInt16 nNew)
Definition: tgrditem.hxx:76
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
SwFrameSize
Definition: fmtfsize.hxx:35
Marks a node in the document model.
Definition: ndindex.hxx:31
#define MID_SURROUND_CONTOUROUTSIDE
Definition: unomid.h:32
sal_uInt16 m_nLineHeight
Percentile height of lines.
Definition: fmtclds.hxx:73
static SfxPoolItem * CreateDefault()
Definition: atrfrm.cxx:131
const SwAttrSet * GetTheChgdSet() const
Where it has changed.
Definition: hints.hxx:285
static void lcl_DelHFFormat(SwClient *pToRemove, SwFrameFormat *pFormat)
Definition: atrfrm.cxx:141
OUString SwResId(const char *pId)
Definition: swmodule.cxx:166
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1774
SwFrameFormat * m_pOtherTextBoxFormat
Definition: frmfmt.hxx:76
virtual OUString GetDescription() const override
Definition: atrfrm.cxx:3435
RndStdIds m_eAnchorId
Definition: fmtanchr.hxx:39
void SetURL(const OUString &rURL, bool bServerMap)
Definition: atrfrm.cxx:1743
#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:123
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
SAL_DLLPRIVATE void Calc(sal_uInt16 nGutterWidth, sal_uInt16 nAct)
Definition: atrfrm.cxx:1007
void SSize(const Size &rNew)
Definition: swrect.hxx:178
tools::Long GetHeight() const
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: atrfrm.cxx:2805
SwFormatVertOrient(SwTwips nY=0, sal_Int16 eVert=css::text::VertOrientation::NONE, sal_Int16 eRel=css::text::RelOrientation::PRINT_AREA)
Definition: atrfrm.cxx:1276
void RegisterToFormat(SwFormat &rFormat)
Definition: atrfrm.cxx:553
A page of the document layout.
Definition: pagefrm.hxx:41
SVX_NUM_CHARS_LOWER_LETTER_N
void SetAnchorOnly(bool bNew)
Definition: fmtsrnd.hxx:56
virtual SwFormatFrameSize * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:246
Frame cannot be moved in Var-direction.
tools::Long SwTwips
Definition: swtypes.hxx:49
static sal_uInt16 nPgNum
Definition: viewport.cxx:49
void SetCountLines(bool b)
Definition: fmtline.hxx:61
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(179)
virtual SwFormatAnchor * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:1541
sal_uInt16 GetLines() const
Definition: tgrditem.hxx:72
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
virtual bool operator==(const SfxPoolItem &) const override
Definition: atrfrm.cxx:2162
void SetWidth(tools::Long n)
SwFieldType * GetTyp() const
Definition: fldbas.hxx:392
sal_uInt16 m_nBaseHeight
Definition: tgrditem.hxx:37
std::unique_ptr< ImageMap > m_pMap
ClientSide images.
Definition: fmturl.hxx:39
at end of the current text end
Definition: fmtftntx.hxx:31
IMapObject * GetIMapObject(const Point &rPoint, const SwFlyFrame *pFly=nullptr) const
Definition: atrfrm.cxx:3456
OUString m_sURL
Simple URL.
Definition: fmturl.hxx:36
sal_Int16 GetHeightPercentRelation() const
Definition: fmtfsize.hxx:89
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const override
Definition: atrfrm.cxx:3518
bool Delete()
Delete content of all ranges.
Definition: eddel.cxx:125
sal_uInt16 const aFrameFormatSetRange[]
Definition: init.cxx:233
virtual ~DrawFrameFormatHint() override
Definition: atrfrm.cxx:3374
const ImageMap * GetMap() const
Definition: fmturl.hxx:68
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:449
void SetHeightPercent(sal_uInt8 n)
Definition: fmtfsize.hxx:93
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:99
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:2104
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:1196
SwFormatHoriOrient(SwTwips nX=0, sal_Int16 eHori=css::text::HoriOrientation::NONE, sal_Int16 eRel=css::text::RelOrientation::PRINT_AREA, bool bPos=false)
Definition: atrfrm.cxx:1368
sal_Int16 GetAdjustValue() const
Definition: fmtclds.hxx:95
SwColumn()
Definition: atrfrm.cxx:802
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:446
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
const SdrObject * m_pSdrObjectCached
Definition: frmfmt.hxx:356
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:122
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:681
virtual ~SwFormatContent() override
Definition: atrfrm.cxx:584
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwFormatContent(const SwStartNode *pStartNode=nullptr)
Definition: atrfrm.cxx:578
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
#define MID_HORIORIENT_ORIENT
Definition: unomid.h:38
bool IsFlyFrameFormatInHeader(const SwFrameFormat &rFormat)
Definition: atrfrm.cxx:3551
virtual void DelFrames() override
DrawObjects are removed from the arrays at the layout.
Definition: atrfrm.cxx:3397
SwClient m_aPrev
Previous SwFlyFrameFormat (if existent).
Definition: fmtcnct.hxx:33
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1928
#define MID_FRMSIZE_REL_HEIGHT_RELATION
Definition: unomid.h:88
virtual void MakeFrames() override
Creates the views.
Definition: atrfrm.cxx:2876
bool IsPosToggle() const
Definition: fmtornt.hxx:95
SwFillOrder
Definition: fmtfordr.hxx:26
virtual ~WW8AnchorConvHint() override
Definition: atrfrm.cxx:3378
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:2124
constexpr TypedWhichId< SwFormatChain > RES_CHAIN(114)
SwFrameFormat(SwAttrPool &rPool, const char *pFormatNm, SwFrameFormat *pDrvdFrame, sal_uInt16 nFormatWhich=RES_FRMFMT, const sal_uInt16 *pWhichRange=nullptr)
Definition: atrfrm.cxx:2424
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:50
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:2253
void SetWishWidth(sal_uInt16 nNew)
Definition: fmtclds.hxx:46
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:1357
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(115)
virtual ~GetObjectConnectedHint() override
Definition: atrfrm.cxx:3384
#define MID_ANCHOR_ANCHORFRAME
Definition: unomid.h:45
#define MID_CHAIN_PREVNAME
Definition: unomid.h:56
#define MID_GRID_DISPLAY
Definition: unomid.h:127
sal_uInt16 CalcPrtColWidth(sal_uInt16 nCol, sal_uInt16 nAct) const
As above except that it.
Definition: atrfrm.cxx:997
sal_uLong m_nLineWidth
Width of the separator line.
Definition: fmtclds.hxx:70
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
sal_uInt16 GetRight() const
Definition: fmtclds.hxx:52
OUString msTitle
Definition: frmfmt.hxx:190
bool IsLowerOf(const SwFrameFormat &rFormat) const
Definition: atrfrm.cxx:2725
SwPageFrame * FindPageFrameOfAnchor()
method to determine the page frame, on which the 'anchor' of the given anchored object is...
#define MID_OWN_NUM
Definition: unomid.h:97
void SwitchPaperMode(bool bNew)
Definition: atrfrm.cxx:2358
#define MID_VERTORIENT_ORIENT
Definition: unomid.h:34
unsigned char sal_uInt8
void SetName(const OUString &rNm)
Definition: fmturl.hxx:72
#define MID_GRID_TYPE
Definition: unomid.h:124
bool m_bSnapToChars
Definition: tgrditem.hxx:46
void SetSnapToChars(bool bNew)
Definition: tgrditem.hxx:102
SwTwips GetPos() const
Definition: fmtornt.hxx:59
SwFormatHeader(bool bOn=false)
Definition: atrfrm.cxx:495
void SetWidthPercent(sal_uInt8 n)
Definition: fmtfsize.hxx:95
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
const OUString & GetTargetFrameName() const
Definition: fmturl.hxx:65
#define MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH
Definition: unomid.h:85
#define MID_FRMSIZE_REL_WIDTH_RELATION
Definition: unomid.h:87
virtual sal_Int16 GetPositionLayoutDir() const
Definition: atrfrm.cxx:2791
SwFormatNoBalancedColumns(bool bFlag=false)
Definition: fmtclbl.hxx:31
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:711
#define MID_GRID_BASEWIDTH
Definition: unomid.h:128
const Color & GetColor() const
Definition: tgrditem.hxx:69
virtual bool operator==(const SfxPoolItem &) const override
"pure virtual methods" of SfxPoolItem
Definition: atrfrm.cxx:508
bool IsNoTextFrame() const
Definition: frame.hxx:1219
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2654
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwNodes & GetNodes()
Definition: doc.hxx:408
virtual bool operator==(const SfxPoolItem &) const override
"pure virtual methods" of SfxPoolItem
Definition: atrfrm.cxx:558
virtual sal_uInt16 GetValueCount() const override
Definition: atrfrm.cxx:1879
void RemoveAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2129
SwHeaderAndFooterEatSpacingItem(sal_uInt16 nId=RES_HEADER_FOOTER_EAT_SPACING, bool bPrt=false)
virtual SwFormatChain * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:2032
std::unique_ptr< SwNodeIndex > m_pStartNode
Definition: fmtcntnt.hxx:33
SwFormatEditInReadonly(sal_uInt16 nId=RES_EDIT_IN_READONLY, bool bPrt=false)
Definition: fmteiro.hxx:32
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:159
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3193
void SetDescription(const OUString &rStr)
tools::Long Height() const
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
void SetSize(const Size &rSize)
virtual bool operator==(const SfxPoolItem &) const override
"pure virtual methods" of SfxPoolItem
Definition: atrfrm.cxx:882
QPRO_FUNC_TYPE nType
const char * name
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfrm.cxx:2091
virtual SwFormatEditInReadonly * Clone(SfxItemPool *pPool=nullptr) const override
"pure virtual method" of SfxPoolItem
Definition: atrfrm.cxx:1849
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:368
static sal_uInt32 s_nOrderCounter
Definition: fmtanchr.hxx:44
bool operator==(const SwColumn &) const
Definition: atrfrm.cxx:809
void RegisterToFormat(SwFormat &rFormat)
Definition: atrfrm.cxx:2637
sal_uInt16 m_nLines
Definition: tgrditem.hxx:36
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(157)
ColumnDescriptor.
Definition: fmtclds.hxx:33
virtual bool supportsFullDrawingLayerFillAttributeSet() const override
Definition: atrfrm.cxx:2532
bool m_bDisplayGrid
Definition: tgrditem.hxx:42
SwFormatPageDesc & operator=(const SwFormatPageDesc &rCpy)
Definition: atrfrm.cxx:639
virtual SwFrameFormat::tLayoutDir GetLayoutDir() const override
Definition: atrfrm.cxx:3403
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
Color m_aColor
Definition: tgrditem.hxx:35
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:718
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:324
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfrm.cxx:1458
-""- and with own number sequence
Definition: fmtftntx.hxx:32
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:93
#define MID_HORIORIENT_PAGETOGGLE
Definition: unomid.h:41
#define MID_HORIORIENT_RELATION
Definition: unomid.h:39
SwFormatFootnoteEndAtTextEnd & operator=(const SwFormatFootnoteEndAtTextEnd &rAttr)
Definition: atrfrm.cxx:1884
sal_uInt16 GetLeft() const
Definition: fmtclds.hxx:51
void setHeight(tools::Long nHeight)
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
#define MID_FRMSIZE_REL_HEIGHT
Definition: unomid.h:71
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
bool IsInDtor() const
Definition: doc.hxx:403
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
Reference< XInterface > SvUnoImageMap_createInstance()
std::unique_ptr< SwFlyDrawContact > m_pContact
Definition: frmfmt.hxx:198
::std::optional< sal_uInt16 > m_oNumOffset
Offset page number.
Definition: fmtpdsc.hxx:37
ByPos::iterator iterator
#define SAL_WARN(area, stream)
void SetNext(SwFlyFrameFormat *pFormat)
Definition: atrfrm.cxx:2048
RndStdIds
SvxBorderLineStyle m_eLineStyle
style of the separator line
Definition: fmtclds.hxx:69
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
Definition: fmtpdsc.hxx:65
constexpr TypedWhichId< SwFormatLineNumber > RES_LINENUMBER(116)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
sal_uInt8 m_nWidthPercent
Definition: fmtfsize.hxx:47
void SetStartValue(sal_uLong nNew)
Definition: fmtline.hxx:60
bool GetSquaredMode() const
Definition: tgrditem.hxx:105
size_t size() const
#define MID_URL_TARGET
Definition: unomid.h:51
virtual OUString GetComment() const override
SwFormatCol & operator=(const SwFormatCol &)
Definition: atrfrm.cxx:847
SwTextGrid GetGridType() const
Definition: tgrditem.hxx:81
SwSectionNode * GetSectionNode()
Definition: node.hxx:611
void RegistFlys(SwPageFrame *, const SwLayoutFrame *)
Definition: frmtool.cxx:3154
void SetObjTitle(const OUString &rTitle, bool bBroadcast=false)
Definition: atrfrm.cxx:3109
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfrm.cxx:593
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:478
bool IsOutside() const
Definition: fmtsrnd.hxx:54
#define MID_GRID_RUBY_BELOW
Definition: unomid.h:125
const SwFrame * GetAnchorFrame() const
OUString m_sName
Name of the anchor.
Definition: fmturl.hxx:37
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfrm.cxx:1284
bool IsCount() const
Definition: fmtline.hxx:58
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
#define MID_URL_SERVERMAP
Definition: unomid.h:49
void SetPrintGrid(bool bNew)
Definition: tgrditem.hxx:90
void SetNumberingType(SvxNumType nSet)
SwFormatEndAtTextEnd(SwFootnoteEndPosEnum ePos=FTNEND_ATPGORDOCEND)
Definition: fmtftntx.hxx:97
Frame is variable in Var-direction.
bool IsActive() const
Definition: fmthdft.hxx:58
bool m_bActive
Definition: fmthdft.hxx:66
bool IsInvalidItem(const SfxPoolItem *pItem)
sal_uInt16 GetBaseHeight() const
Definition: tgrditem.hxx:75
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrdesc.cxx:290
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:961
SwFrameFormat::tLayoutDir meLayoutDir
Definition: frmfmt.hxx:362
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes
Definition: frmfmt.hxx:71
bool m_bPosToggle
Flip position on even pages.
Definition: fmtornt.hxx:70
virtual ~SwFormatLineNumber() override
Definition: atrfrm.cxx:2087
sal_uInt16 m_nRubyHeight
Definition: tgrditem.hxx:38
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
virtual ~ContactChangedHint() override
Definition: atrfrm.cxx:3376
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
sal_Int16 m_eHeightPercentRelation
Definition: fmtfsize.hxx:50
virtual ~SwFormatAnchor() override
Definition: atrfrm.cxx:1489
virtual SwFormatPageDesc * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:667
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:208
bool IsServerMap() const
Definition: fmturl.hxx:67
void RegisterToPageDesc(SwPageDesc &)
Definition: atrfrm.cxx:706
class for collecting anchored objects
Definition: sortedobjs.hxx:48
void SetHeightSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:81
virtual ~SwFrameFormat() override
Definition: atrfrm.cxx:2452
void SetGutterWidth(sal_uInt16 nNew, sal_uInt16 nAct)
Adjusts borders for columns in aColumns.
Definition: atrfrm.cxx:941
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:251
#define MID_GRID_COLOR
Definition: unomid.h:120
const SvEventDescription * sw_GetSupportedMacroItems()
Definition: unocoll.cxx:459
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:52
SwFieldIds Which() const
Definition: fldbas.hxx:272
void SetObjDescription(const OUString &rDescription, bool bBroadcast=false)
Definition: atrfrm.cxx:3142
virtual SwFormatHoriOrient * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:1386
void SetTitle(const OUString &rStr)
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1293
virtual void SetPositionLayoutDir(const sal_Int16 _nPositionLayoutDir)
Definition: atrfrm.cxx:2795
sal_Int16 GetWidthPercentRelation() const
Definition: fmtfsize.hxx:92
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:138
virtual void SetLayoutDir(const SwFrameFormat::tLayoutDir _eLayoutDir)
Definition: atrfrm.cxx:2785
sal_uInt16 GetRubyHeight() const
Definition: tgrditem.hxx:78
bool GetPrintGrid() const
Definition: tgrditem.hxx:89
#define MID_RESTART_NUM
Definition: unomid.h:95
sal_uInt16 Which() const
SwRootFrame * getRootFrame()
Definition: frame.hxx:662
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2712
sal_Int32 GetEnumAsInt32(const css::uno::Any &rVal)
Definition: swunohelper.cxx:50
SwFormatFooter(bool bOn=false)
Definition: atrfrm.cxx:540
void RegisterToFormat(SwFormat &rFormat)
Definition: atrfrm.cxx:520
void SetGridType(SwTextGrid eNew)
Definition: tgrditem.hxx:82
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_MSG_BEGIN)
const Size & GetSize() const
~SwHandleAnchorNodeChg() COVERITY_NOEXCEPT_FALSE
calls , if re-creation of fly frames is necessary.
Definition: atrfrm.cxx:3316
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
OUString m_sSdrObjectCachedComment
Definition: frmfmt.hxx:357
void SetLines(sal_uInt16 nNew)
Definition: tgrditem.hxx:73
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
sal_uInt16 m_nRight
Right border.
Definition: fmtclds.hxx:39
bool m_bAnchorOnly
Definition: fmtsrnd.hxx:33
SwFlyFrame * GetFrame(const Point *pDocPos=nullptr) const
Definition: atrfrm.cxx:3064
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:710
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1493
SwColLineAdj GetLineAdj() const
Definition: fmtclds.hxx:120
virtual ~SwFormatCol() override
Definition: atrfrm.cxx:845
#define CONVERT_TWIPS
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
sal_uLong m_nStartValue
Starting value for the paragraph. 0 == no starting value.
Definition: fmtline.hxx:32
const OUString & GetURL() const
Definition: fmturl.hxx:66
SwFormatLayoutSplit(bool bSplit=true)
Definition: fmtlsplt.hxx:32
void CheckAnchoredFlyConsistency(SwDoc const &rDoc)
Definition: atrfrm.cxx:3576
SwFrame * GetNext()
Definition: frame.hxx:659
Base class of the Writer document model elements.
Definition: node.hxx:80
#define MID_LINENUMBER_COUNT
Definition: unomid.h:60
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo