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