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