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