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