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