LibreOffice Module sw (master)  1
xmldump.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 
10 #include <frame.hxx>
11 #include <frmfmt.hxx>
12 #include <ftnfrm.hxx>
13 #include <sectfrm.hxx>
14 #include <tabfrm.hxx>
15 #include <pagefrm.hxx>
16 #include <txtfrm.hxx>
17 #include <cellfrm.hxx>
18 #include <flyfrm.hxx>
19 #include <hffrm.hxx>
20 #include <rootfrm.hxx>
21 #include <ndtxt.hxx>
22 #include <sortedobjs.hxx>
23 #include <swfont.hxx>
24 #include <txttypes.hxx>
25 #include <anchoredobject.hxx>
26 #include <libxml/xmlwriter.h>
27 #include <SwPortionHandler.hxx>
28 #include <view.hxx>
29 #include <svx/svdobj.hxx>
30 
31 #include "porlay.hxx"
32 
33 namespace {
34 
35 class XmlPortionDumper:public SwPortionHandler
36 {
37  private:
38  xmlTextWriterPtr m_Writer;
39  TextFrameIndex m_Ofs;
40  const OUString& m_rText;
41  OUString m_aLine;
42 
43  static const char* getTypeName(PortionType nType)
44  {
45  switch (nType)
46  {
47  case PortionType::NONE:
48  return "PortionType::NONE";
50  return "PortionType::FlyCnt";
51 
52  case PortionType::Hole:
53  return "PortionType::Hole";
55  return "PortionType::TempEnd";
56  case PortionType::Break:
57  return "PortionType::Break";
58  case PortionType::Kern:
59  return "PortionType::Kern";
60  case PortionType::Arrow:
61  return "PortionType::Arrow";
62  case PortionType::Multi:
63  return "PortionType::Multi";
65  return "PortionType::HiddenText";
67  return "PortionType::ControlChar";
69  return "PortionType::Bookmark";
70 
71  case PortionType::Text:
72  return "PortionType::Text";
73  case PortionType::Lay:
74  return "PortionType::Lay";
75  case PortionType::Para:
76  return "PortionType::Para";
78  return "PortionType::Hanging";
79 
80  case PortionType::Drop:
81  return "PortionType::Drop";
82  case PortionType::Tox:
83  return "PortionType::Tox";
85  return "PortionType::IsoTox";
86  case PortionType::Ref:
87  return "PortionType::Ref";
89  return "PortionType::IsoRef";
90  case PortionType::Meta:
91  return "PortionType::Meta";
93  return "PortionType::FieldMark";
95  return "PortionType::FieldFormCheckbox";
97  return "PortionType::InputField";
98 
100  return "PortionType::Expand";
101  case PortionType::Blank:
102  return "PortionType::Blank";
104  return "PortionType::PostIts";
105 
106  case PortionType::Hyphen:
107  return "PortionType::Hyphen";
109  return "PortionType::HyphenStr";
111  return "PortionType::SoftHyphen";
113  return "PortionType::SoftHyphenStr";
115  return "PortionType::SoftHyphenComp";
116 
117  case PortionType::Field:
118  return "PortionType::Field";
119  case PortionType::Hidden:
120  return "PortionType::Hidden";
122  return "PortionType::QuoVadis";
124  return "PortionType::ErgoSum";
126  return "PortionType::Combined";
128  return "PortionType::Footnote";
129 
131  return "PortionType::FootnoteNum";
132  case PortionType::Number:
133  return "PortionType::Number";
134  case PortionType::Bullet:
135  return "PortionType::Bullet";
136  case PortionType::GrfNum:
137  return "PortionType::GrfNum";
138 
139  case PortionType::Glue:
140  return "PortionType::Glue";
141 
142  case PortionType::Margin:
143  return "PortionType::Margin";
144 
145  case PortionType::Fix:
146  return "PortionType::Fix";
147  case PortionType::Fly:
148  return "PortionType::Fly";
149 
150  case PortionType::Table:
151  return "PortionType::Table";
152 
154  return "PortionType::TabRight";
156  return "PortionType::TabCenter";
158  return "PortionType::TabDecimal";
159 
161  return "PortionType::TabLeft";
162  default:
163  return "Unknown";
164  }
165  }
166 
167  public:
168  explicit XmlPortionDumper(xmlTextWriterPtr some_writer, const OUString& rText)
169  : m_Writer(some_writer)
170  , m_Ofs(0)
171  , m_rText(rText)
172  {
173  }
174 
181  virtual void Text( TextFrameIndex nLength,
182  PortionType nType,
183  sal_Int32 nHeight,
184  sal_Int32 nWidth) override
185  {
186  (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("Text"));
187  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nLength"), "%i",
188  static_cast<int>(static_cast<sal_Int32>(nLength)));
189  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nType"), "%s",
190  getTypeName(nType));
191  if (nHeight > 0)
192  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nHeight"), "%i",
193  static_cast<int>(nHeight));
194  if (nWidth > 0)
195  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nWidth"), "%i",
196  static_cast<int>(nWidth));
197  if (nLength > TextFrameIndex(0))
198  (void)xmlTextWriterWriteAttribute(
199  m_Writer, BAD_CAST("Portion"),
200  BAD_CAST(m_rText.copy(sal_Int32(m_Ofs), sal_Int32(nLength)).toUtf8().getStr()));
201 
202  (void)xmlTextWriterEndElement(m_Writer);
203  m_aLine += m_rText.subView(sal_Int32(m_Ofs), sal_Int32(nLength));
204  m_Ofs += nLength;
205  }
206 
217  virtual void Special( TextFrameIndex nLength,
218  const OUString & rText,
219  PortionType nType,
220  sal_Int32 nHeight,
221  sal_Int32 nWidth,
222  const SwFont* pFont ) override
223  {
224  (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("Special"));
225  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nLength"), "%i",
226  static_cast<int>(static_cast<sal_Int32>(nLength)));
227  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nType"), "%s",
228  getTypeName(nType));
229  OString sText8 = OUStringToOString( rText, RTL_TEXTENCODING_UTF8 );
230  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("rText"), "%s", sText8.getStr());
231 
232  if (nHeight > 0)
233  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nHeight"), "%i",
234  static_cast<int>(nHeight));
235 
236  if (nWidth > 0)
237  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nWidth"), "%i",
238  static_cast<int>(nWidth));
239 
240  if (pFont)
241  pFont->dumpAsXml(m_Writer);
242 
243  (void)xmlTextWriterEndElement(m_Writer);
244  m_aLine += rText;
245  m_Ofs += nLength;
246  }
247 
248  virtual void LineBreak( sal_Int32 nWidth ) override
249  {
250  (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("LineBreak"));
251  if (nWidth > 0)
252  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nWidth"), "%i",
253  static_cast<int>(nWidth));
254  if (!m_aLine.isEmpty())
255  {
256  (void)xmlTextWriterWriteAttribute(m_Writer, BAD_CAST("Line"),
257  BAD_CAST(m_aLine.toUtf8().getStr()));
258  m_aLine.clear();
259  }
260  (void)xmlTextWriterEndElement(m_Writer);
261  }
262 
267  virtual void Skip( TextFrameIndex nLength ) override
268  {
269  (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("Skip"));
270  (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nLength"), "%i",
271  static_cast<int>(static_cast<sal_Int32>(nLength)));
272  (void)xmlTextWriterEndElement(m_Writer);
273  m_Ofs += nLength;
274  }
275 
276  virtual void Finish( ) override
277  {
278  (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("Finish"));
279  (void)xmlTextWriterEndElement(m_Writer);
280  }
281 
282 };
283 
284  xmlTextWriterPtr lcl_createDefaultWriter()
285  {
286  xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 );
287  xmlTextWriterSetIndent(writer,1);
288  (void)xmlTextWriterSetIndentString(writer, BAD_CAST(" "));
289  (void)xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
290  return writer;
291  }
292 
293  void lcl_freeWriter( xmlTextWriterPtr writer )
294  {
295  (void)xmlTextWriterEndDocument( writer );
296  xmlFreeTextWriter( writer );
297  }
298 }
299 
301 {
302  const SwFrame* pFrame = this;
303  while (pFrame->GetUpper())
304  {
305  pFrame = pFrame->GetUpper();
306  }
307 
308  pFrame->dumpAsXml(writer);
309 }
310 
312 {
313  bool bCreateWriter = ( nullptr == writer );
314  if ( bCreateWriter )
315  writer = lcl_createDefaultWriter();
316 
317  const char *name = nullptr;
318 
319  switch ( GetType( ) )
320  {
321  case SwFrameType::Root:
322  name = "root";
323  break;
324  case SwFrameType::Page:
325  name = "page";
326  break;
327  case SwFrameType::Column:
328  name = "column";
329  break;
330  case SwFrameType::Header:
331  name = "header";
332  break;
333  case SwFrameType::Footer:
334  name = "footer";
335  break;
337  name = "ftncont";
338  break;
339  case SwFrameType::Ftn:
340  name = "ftn";
341  break;
342  case SwFrameType::Body:
343  name = "body";
344  break;
345  case SwFrameType::Fly:
346  name = "fly";
347  break;
349  name = "section";
350  break;
351  case SwFrameType::Tab:
352  name = "tab";
353  break;
354  case SwFrameType::Row:
355  name = "row";
356  break;
357  case SwFrameType::Cell:
358  name = "cell";
359  break;
360  case SwFrameType::Txt:
361  name = "txt";
362  break;
363  case SwFrameType::NoTxt:
364  name = "notxt";
365  break;
366  default: break;
367  }
368 
369  if ( name != nullptr )
370  {
371  (void)xmlTextWriterStartElement( writer, reinterpret_cast<const xmlChar *>(name) );
372 
373  dumpAsXmlAttributes( writer );
374 
375  if (IsRootFrame())
376  {
377  const SwRootFrame* pRootFrame = static_cast<const SwRootFrame*>(this);
378  (void)xmlTextWriterStartElement(writer, BAD_CAST("sfxViewShells"));
379  SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>));
380  while (pView)
381  {
382  if (pRootFrame->GetCurrShell()->GetSfxViewShell() && pView->GetObjectShell() == pRootFrame->GetCurrShell()->GetSfxViewShell()->GetObjectShell())
383  pView->dumpAsXml(writer);
384  pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>));
385  }
386  (void)xmlTextWriterEndElement(writer);
387  }
388 
389  if (IsPageFrame())
390  {
391  const SwPageFrame* pPageFrame = static_cast<const SwPageFrame*>(this);
392  (void)xmlTextWriterStartElement(writer, BAD_CAST("page_status"));
393  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidFlyLayout"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidFlyLayout()).getStr()));
394  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidFlyContent"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidFlyContent()).getStr()));
395  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidFlyInCnt"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidFlyInCnt()).getStr()));
396  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidLayout"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidLayout()).getStr()));
397  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidContent"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidContent()).getStr()));
398  (void)xmlTextWriterEndElement(writer);
399  (void)xmlTextWriterStartElement(writer, BAD_CAST("page_info"));
400  (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("phyNum"), "%d", pPageFrame->GetPhyPageNum());
401  (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("virtNum"), "%d", pPageFrame->GetVirtPageNum());
402  OUString aFormatName = pPageFrame->GetPageDesc()->GetName();
403  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("pageDesc"), "%s", BAD_CAST(OUStringToOString(aFormatName, RTL_TEXTENCODING_UTF8).getStr()));
404  (void)xmlTextWriterEndElement(writer);
405  if (auto const* pObjs = pPageFrame->GetSortedObjs())
406  {
407  (void)xmlTextWriterStartElement(writer, BAD_CAST("sorted_objs"));
408  for (SwAnchoredObject const*const pObj : *pObjs)
409  { // just print pointer, full details will be printed on its anchor frame
410  // this nonsense is needed because of multiple inheritance
411  if (SwFlyFrame const* pFly = pObj->DynCastFlyFrame())
412  {
413  (void)xmlTextWriterStartElement(writer, BAD_CAST("fly"));
414  (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("ptr"), "%p", pFly);
415  }
416  else
417  {
418  (void)xmlTextWriterStartElement(writer, BAD_CAST(pObj->getElementName()));
419  (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("ptr"), "%p", pObj);
420  }
421  (void)xmlTextWriterEndElement(writer);
422  }
423  (void)xmlTextWriterEndElement(writer);
424  }
425  }
426 
427  if (IsTextFrame())
428  {
429  const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
430  sw::MergedPara const*const pMerged(pTextFrame->GetMergedPara());
431  if (pMerged)
432  {
433  (void)xmlTextWriterStartElement( writer, BAD_CAST( "merged" ) );
434  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "paraPropsNodeIndex" ), "%" SAL_PRIuUINTPTR, pMerged->pParaPropsNode->GetIndex() );
435  for (auto const& e : pMerged->extents)
436  {
437  (void)xmlTextWriterStartElement( writer, BAD_CAST( "extent" ) );
438  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), "%" SAL_PRIuUINTPTR, e.pNode->GetIndex() );
439  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "start" ), "%" SAL_PRIdINT32, e.nStart );
440  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "end" ), "%" SAL_PRIdINT32, e.nEnd );
441  (void)xmlTextWriterEndElement( writer );
442  }
443  (void)xmlTextWriterEndElement( writer );
444  }
445  }
446 
447  if (IsCellFrame())
448  {
449  SwCellFrame const* pCellFrame(static_cast<SwCellFrame const*>(this));
450  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "rowspan" ), "%ld", pCellFrame->GetLayoutRowSpan() );
451  }
452 
453  (void)xmlTextWriterStartElement( writer, BAD_CAST( "infos" ) );
454  dumpInfosAsXml( writer );
455  (void)xmlTextWriterEndElement( writer );
456 
457  // Dump Anchored objects if any
458  const SwSortedObjs* pAnchored = GetDrawObjs();
459  if ( pAnchored && pAnchored->size() > 0 )
460  {
461  (void)xmlTextWriterStartElement( writer, BAD_CAST( "anchored" ) );
462 
463  for (SwAnchoredObject* pObject : *pAnchored)
464  {
465  pObject->dumpAsXml( writer );
466  }
467 
468  (void)xmlTextWriterEndElement( writer );
469  }
470 
471  // Dump the children
472  if ( IsTextFrame( ) )
473  {
474  const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
475  OUString aText = pTextFrame->GetText( );
476  for ( int i = 0; i < 32; i++ )
477  {
478  aText = aText.replace( i, '*' );
479  }
480  OString aText8 =OUStringToOString( aText,
481  RTL_TEXTENCODING_UTF8 );
482  (void)xmlTextWriterWriteString( writer,
483  reinterpret_cast<const xmlChar *>(aText8.getStr( )) );
484  XmlPortionDumper pdumper( writer, aText );
485  pTextFrame->VisitPortions( pdumper );
486  if (const SwParaPortion* pPara = pTextFrame->GetPara())
487  {
488  pPara->dumpAsXml(writer);
489  }
490 
491  }
492  else
493  {
494  dumpChildrenAsXml( writer );
495  }
496  (void)xmlTextWriterEndElement( writer );
497  }
498 
499  if ( bCreateWriter )
500  lcl_freeWriter( writer );
501 }
502 
504 {
505  // output the Frame
506  (void)xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) );
508  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("mbFixSize"), BAD_CAST(OString::boolean(HasFixSize()).getStr()));
509  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("mbFrameAreaPositionValid"), BAD_CAST(OString::boolean(isFrameAreaPositionValid()).getStr()));
510  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("mbFrameAreaSizeValid"), BAD_CAST(OString::boolean(isFrameAreaSizeValid()).getStr()));
511  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("mbFramePrintAreaValid"), BAD_CAST(OString::boolean(isFramePrintAreaValid()).getStr()));
512  (void)xmlTextWriterEndElement( writer );
513 
514  // output the print area
515  (void)xmlTextWriterStartElement( writer, BAD_CAST( "prtBounds" ) );
517  (void)xmlTextWriterEndElement( writer );
518 }
519 
520 // Hack: somehow conversion from "..." to va_list does
521 // bomb on two string literals in the format.
522 const char* const TMP_FORMAT = "%" SAL_PRIuUINTPTR;
523 
525 {
526  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", this );
527  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "id" ), "%" SAL_PRIuUINT32, GetFrameId() );
528  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "symbol" ), "%s", BAD_CAST( typeid( *this ).name( ) ) );
529  if ( GetNext( ) )
530  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "next" ), "%" SAL_PRIuUINT32, GetNext()->GetFrameId() );
531  if ( GetPrev( ) )
532  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "prev" ), "%" SAL_PRIuUINT32, GetPrev()->GetFrameId() );
533  if ( GetUpper( ) )
534  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "upper" ), "%" SAL_PRIuUINT32, GetUpper()->GetFrameId() );
535  if ( GetLower( ) )
536  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "lower" ), "%" SAL_PRIuUINT32, GetLower()->GetFrameId() );
537  if (IsFootnoteFrame())
538  {
539  SwFootnoteFrame const*const pFF(static_cast<SwFootnoteFrame const*>(this));
540  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("ref"), "%" SAL_PRIuUINT32, pFF->GetRef()->GetFrameId() );
541  if (pFF->GetMaster())
542  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("master"), "%" SAL_PRIuUINT32, pFF->GetMaster()->GetFrameId() );
543  if (pFF->GetFollow())
544  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("follow"), "%" SAL_PRIuUINT32, pFF->GetFollow()->GetFrameId() );
545  }
546  if (IsSctFrame())
547  {
548  SwSectionFrame const*const pFrame(static_cast<SwSectionFrame const*>(this));
549  SwSectionNode const*const pNode(pFrame->GetSection() ? pFrame->GetSection()->GetFormat()->GetSectionNode() : nullptr);
550  (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("sectionNodeIndex"), TMP_FORMAT, pNode ? pNode->GetIndex() : -1);
551  }
552  if ( IsTextFrame( ) )
553  {
554  const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
555  const SwTextNode *pTextNode = pTextFrame->GetTextNodeFirst();
556  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), TMP_FORMAT, pTextNode->GetIndex() );
557 
558  OString aMode = "Horizontal";
559  if (IsVertLRBT())
560  {
561  aMode = "VertBTLR";
562  }
563  else if (IsVertLR())
564  {
565  aMode = "VertLR";
566  }
567  else if (IsVertical())
568  {
569  aMode = "Vertical";
570  }
571  (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), BAD_CAST(aMode.getStr()));
572  }
573  if (IsHeaderFrame() || IsFooterFrame())
574  {
575  const SwHeadFootFrame *pHeadFootFrame = static_cast<const SwHeadFootFrame*>(this);
576  OUString aFormatName = pHeadFootFrame->GetFormat()->GetName();
577  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "fmtName" ), "%s", BAD_CAST(OUStringToOString(aFormatName, RTL_TEXTENCODING_UTF8).getStr()));
578  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "fmtPtr" ), "%p", pHeadFootFrame->GetFormat());
579  }
580 }
581 
583 {
584  const SwFrame *pFrame = GetLower( );
585  for ( ; pFrame != nullptr; pFrame = pFrame->GetNext( ) )
586  {
587  pFrame->dumpAsXml( writer );
588  }
589 }
590 
592 {
593  bool bCreateWriter = ( nullptr == writer );
594  if ( bCreateWriter )
595  writer = lcl_createDefaultWriter();
596 
597  (void)xmlTextWriterStartElement( writer, BAD_CAST( getElementName() ) );
598  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", this );
599 
600  (void)xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) );
601  // don't call GetObjBoundRect(), it modifies the layout
602  SwRect(GetDrawObj()->GetLastBoundRect()).dumpAsXmlAttributes(writer);
603  (void)xmlTextWriterEndElement( writer );
604 
605  if (const SdrObject* pObject = GetDrawObj())
606  pObject->dumpAsXml(writer);
607 
608  (void)xmlTextWriterEndElement( writer );
609 
610  if ( bCreateWriter )
611  lcl_freeWriter( writer );
612 }
613 
615 {
616  (void)xmlTextWriterStartElement(writer, BAD_CAST("SwFont"));
617  (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("ptr"), "%p", this);
618  // do not use Color::AsRGBHexString() as that omits the transparency
619  (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("color"), "%08" SAL_PRIxUINT32, sal_uInt32(GetColor()));
620  (void)xmlTextWriterEndElement(writer);
621 }
622 
624 {
626  if ( HasFollow() )
627  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
628 
629  if (m_pPrecede != nullptr)
630  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%" SAL_PRIuUINT32, static_cast<SwTextFrame*>(m_pPrecede)->GetFrameId() );
631 }
632 
634 {
636  if ( HasFollow() )
637  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
638 
639  if (m_pPrecede != nullptr)
640  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%" SAL_PRIuUINT32, static_cast<SwSectionFrame*>( m_pPrecede )->GetFrameId() );
641 }
642 
644 {
646  if ( HasFollow() )
647  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
648 
649  if (m_pPrecede != nullptr)
650  (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%" SAL_PRIuUINT32, static_cast<SwTabFrame*>( m_pPrecede )->GetFrameId() );
651 }
652 
653 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:315
virtual const SwFlyFrame * DynCastFlyFrame() const override
Definition: fly.cxx:2961
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
sal_uLong GetIndex() const
Definition: node.hxx:291
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:565
bool IsRootFrame() const
Definition: frame.hxx:1175
SwFrameType GetType() const
Definition: frame.hxx:520
const SwRect & getFramePrintArea() const
Definition: frame.hxx:181
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:46
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:450
bool HasFollow() const
Definition: flowfrm.hxx:165
SwParaPortion * GetPara()
Definition: txtcache.cxx:90
virtual void dumpAsXml(xmlTextWriterPtr writer=nullptr) const
Definition: xmldump.cxx:311
SwSectionFormat * GetFormat()
Definition: section.hxx:336
bool IsCellFrame() const
Definition: frame.hxx:1227
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:441
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1295
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:643
void dumpAsXml(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:614
EmbeddedObjectRef * pObject
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
virtual void Text(TextFrameIndex nLength, PortionType nType, sal_Int32 nHeight=0, sal_Int32 nWidth=0)=0
(empty) destructor
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:251
bool IsFootnoteFrame() const
Definition: frame.hxx:1203
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
const OUString & GetName() const
Definition: pagedesc.hxx:196
bool IsVertLRBT() const
Definition: frame.hxx:984
virtual void Finish()=0
end of paragraph.
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:204
wrapper class for the positioning of Writer fly frames and drawing objects
bool IsInvalidFlyInCnt() const
Definition: pagefrm.hxx:233
const SwRect & getFrameArea() const
Definition: frame.hxx:180
SwSectionNode * GetSectionNode()
Definition: section.cxx:952
const OUString & GetName() const
Definition: format.hxx:115
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
bool IsTextFrame() const
Definition: frame.hxx:1235
virtual void LineBreak(sal_Int32 nWidth)=0
line break.
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:956
bool IsSctFrame() const
Definition: frame.hxx:1215
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Dump a bunch of useful data to an XML representation to ease layout understanding, debugging and testing.
Definition: xmldump.cxx:591
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:855
tools::Long GetLayoutRowSpan() const
Definition: tabfrm.cxx:5588
bool IsInvalidContent() const
Definition: pagefrm.hxx:235
virtual void Special(TextFrameIndex nLength, const OUString &rText, PortionType nType, sal_Int32 nHeight=0, sal_Int32 nWidth=0, const SwFont *pFont=nullptr)=0
special portion.
sal_uInt16 GetVirtPageNum() const
Definition: trvlfrm.cxx:1806
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:457
struct _xmlTextWriter * xmlTextWriterPtr
bool IsInvalidFlyContent() const
Definition: pagefrm.hxx:232
virtual const char * getElementName() const
The element name to show in the XML dump.
void dumpChildrenAsXml(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:582
const SdrObject * GetDrawObj() const
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:132
int i
void dumpAsXml(xmlTextWriterPtr pWriter) const override
See SfxViewShell::dumpAsXml().
Definition: viewprt.cxx:268
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:169
size_t size() const
Definition: sortedobjs.cxx:43
void dumpTopMostAsXml(xmlTextWriterPtr writer=nullptr) const
Definition: xmldump.cxx:300
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:143
SwSection * GetSection()
Definition: sectfrm.hxx:93
SwLayoutFrame * GetUpper()
Definition: frame.hxx:679
bool isFramePrintAreaValid() const
Definition: frame.hxx:169
PortionType
Definition: txttypes.hxx:23
SwFrame * GetPrev()
Definition: frame.hxx:678
SwFlowFrame * m_pPrecede
Definition: flowfrm.hxx:118
bool isFrameAreaPositionValid() const
Definition: frame.hxx:167
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:623
bool HasFixSize() const
Definition: frame.hxx:671
bool isFrameAreaSizeValid() const
Definition: frame.hxx:168
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
const Color & GetColor() const
Definition: swfont.hxx:273
A page of the document layout.
Definition: pagefrm.hxx:57
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:119
bool IsInvalidFlyLayout() const
Definition: pagefrm.hxx:231
void dumpInfosAsXml(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:503
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
bool IsVertLR() const
Definition: frame.hxx:980
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:524
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:116
const SwContentFrame * GetRef() const
Definition: ftnfrm.cxx:2891
SwFrame * GetLower()
Definition: findfrm.cxx:170
bool IsPageFrame() const
Definition: frame.hxx:1179
const char * name
virtual void Skip(TextFrameIndex nLength)=0
skip characters.
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:250
virtual SfxObjectShell * GetObjectShell() override
bool IsVertical() const
Definition: frame.hxx:974
const char *const TMP_FORMAT
Definition: xmldump.cxx:522
OString m_aLine
void VisitPortions(SwPortionHandler &rPH) const
Visit all portions for Accessibility.
Definition: txtfrm.cxx:3877
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:207
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
class for collecting anchored objects
Definition: sortedobjs.hxx:48
bool IsFooterFrame() const
Definition: frame.hxx:1195
sal_uInt32 GetFrameId() const
Definition: frame.hxx:175
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:30
bool IsInvalidLayout() const
Definition: pagefrm.hxx:234
Definition: view.hxx:144
void dumpAsXmlAttributes(xmlTextWriterPtr writer) const
Definition: swrect.cxx:221
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:633
bool IsHeaderFrame() const
Definition: frame.hxx:1191
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:395
SwFrame * GetNext()
Definition: frame.hxx:677
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo