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 <hffrm.hxx>
19 #include <rootfrm.hxx>
20 #include <ndtxt.hxx>
21 #include <sortedobjs.hxx>
22 #include <swfont.hxx>
23 #include <txttypes.hxx>
24 #include <anchoredobject.hxx>
25 #include <libxml/xmlwriter.h>
26 #include <SwPortionHandler.hxx>
27 #include <view.hxx>
28 #include <svx/svdobj.hxx>
29 
30 namespace {
31 
32 class XmlPortionDumper:public SwPortionHandler
33 {
34  private:
35  xmlTextWriterPtr const writer;
36  TextFrameIndex ofs;
37  const OUString& m_rText;
38  OUString m_aLine;
39 
40  static const char* getTypeName( PortionType nType )
41  {
42  switch ( nType )
43  {
44  case PortionType::NONE: return "PortionType::NONE";
45  case PortionType::FlyCnt: return "PortionType::FlyCnt";
46 
47  case PortionType::Hole: return "PortionType::Hole";
48  case PortionType::TempEnd: return "PortionType::TempEnd";
49  case PortionType::Break: return "PortionType::Break";
50  case PortionType::Kern: return "PortionType::Kern";
51  case PortionType::Arrow: return "PortionType::Arrow";
52  case PortionType::Multi: return "PortionType::Multi";
53  case PortionType::HiddenText: return "PortionType::HiddenText";
54  case PortionType::ControlChar: return "PortionType::ControlChar";
55 
56  case PortionType::Text: return "PortionType::Text";
57  case PortionType::Lay: return "PortionType::Lay";
58  case PortionType::Para: return "PortionType::Para";
59  case PortionType::Hanging: return "PortionType::Hanging";
60 
61  case PortionType::Drop: return "PortionType::Drop";
62  case PortionType::Tox: return "PortionType::Tox";
63  case PortionType::IsoTox: return "PortionType::IsoTox";
64  case PortionType::Ref: return "PortionType::Ref";
65  case PortionType::IsoRef: return "PortionType::IsoRef";
66  case PortionType::Meta: return "PortionType::Meta";
67  case PortionType::FieldMark: return "PortionType::FieldMark";
68  case PortionType::FieldFormCheckbox: return "PortionType::FieldFormCheckbox";
69 
70  case PortionType::Expand: return "PortionType::Expand";
71  case PortionType::Blank: return "PortionType::Blank";
72  case PortionType::PostIts: return "PortionType::PostIts";
73 
74  case PortionType::Hyphen: return "PortionType::Hyphen";
75  case PortionType::HyphenStr: return "PortionType::HyphenStr";
76  case PortionType::SoftHyphen: return "PortionType::SoftHyphen";
77  case PortionType::SoftHyphenStr: return "PortionType::SoftHyphenStr";
78  case PortionType::SoftHyphenComp: return "PortionType::SoftHyphenComp";
79 
80  case PortionType::Field: return "PortionType::Field";
81  case PortionType::Hidden: return "PortionType::Hidden";
82  case PortionType::QuoVadis: return "PortionType::QuoVadis";
83  case PortionType::ErgoSum: return "PortionType::ErgoSum";
84  case PortionType::Combined: return "PortionType::Combined";
85  case PortionType::Footnote: return "PortionType::Footnote";
86 
87  case PortionType::FootnoteNum: return "PortionType::FootnoteNum";
88  case PortionType::Number: return "PortionType::Number";
89  case PortionType::Bullet: return "PortionType::Bullet";
90  case PortionType::GrfNum: return "PortionType::GrfNum";
91 
92  case PortionType::Glue: return "PortionType::Glue";
93 
94  case PortionType::Margin: return "PortionType::Margin";
95 
96  case PortionType::Fix: return "PortionType::Fix";
97  case PortionType::Fly: return "PortionType::Fly";
98 
99  case PortionType::Table: return "PortionType::Table";
100 
101  case PortionType::TabRight: return "PortionType::TabRight";
102  case PortionType::TabCenter: return "PortionType::TabCenter";
103  case PortionType::TabDecimal: return "PortionType::TabDecimal";
104 
105  case PortionType::TabLeft: return "PortionType::TabLeft";
106  default:
107  return "Unknown";
108  }
109  }
110 
111  public:
112 
113  explicit XmlPortionDumper( xmlTextWriterPtr some_writer, const OUString& rText ):writer( some_writer ), ofs( 0 ), m_rText(rText)
114  {
115  }
116 
123  virtual void Text( TextFrameIndex nLength,
124  PortionType nType,
125  sal_Int32 nHeight,
126  sal_Int32 nWidth) override
127  {
128  xmlTextWriterStartElement( writer, BAD_CAST( "Text" ) );
129  xmlTextWriterWriteFormatAttribute( writer,
130  BAD_CAST( "nLength" ),
131  "%i", static_cast<int>(static_cast<sal_Int32>(nLength)) );
132  xmlTextWriterWriteFormatAttribute( writer,
133  BAD_CAST( "nType" ),
134  "%s", getTypeName( nType ) );
135  if (nHeight > 0)
136  xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("nHeight"), "%i", static_cast<int>(nHeight));
137  if (nWidth > 0)
138  xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("nWidth"), "%i", static_cast<int>(nWidth));
139  if (nLength > TextFrameIndex(0))
140  xmlTextWriterWriteAttribute(writer, BAD_CAST("Portion"),
141  BAD_CAST(m_rText.copy(sal_Int32(ofs), sal_Int32(nLength)).toUtf8().getStr()));
142 
143  xmlTextWriterEndElement( writer );
144  m_aLine += m_rText.copy(sal_Int32(ofs), sal_Int32(nLength));
145  ofs += nLength;
146  }
147 
158  virtual void Special( TextFrameIndex nLength,
159  const OUString & rText,
160  PortionType nType,
161  sal_Int32 nHeight,
162  sal_Int32 nWidth,
163  const SwFont* pFont ) override
164  {
165  xmlTextWriterStartElement( writer, BAD_CAST( "Special" ) );
166  xmlTextWriterWriteFormatAttribute( writer,
167  BAD_CAST( "nLength" ),
168  "%i", static_cast<int>(static_cast<sal_Int32>(nLength)) );
169  xmlTextWriterWriteFormatAttribute( writer,
170  BAD_CAST( "nType" ),
171  "%s", getTypeName( nType ) );
172  OString sText8 = OUStringToOString( rText, RTL_TEXTENCODING_UTF8 );
173  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "rText" ),
174  "%s", sText8.getStr( ) );
175 
176  if (nHeight > 0)
177  xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("nHeight"), "%i", static_cast<int>(nHeight));
178 
179  if (nWidth > 0)
180  xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("nWidth"), "%i", static_cast<int>(nWidth));
181 
182  if (pFont)
183  pFont->dumpAsXml(writer);
184 
185  xmlTextWriterEndElement( writer );
186  m_aLine += rText;
187  ofs += nLength;
188  }
189 
190  virtual void LineBreak( sal_Int32 nWidth ) override
191  {
192  xmlTextWriterStartElement( writer, BAD_CAST( "LineBreak" ) );
193  if (nWidth > 0)
194  xmlTextWriterWriteFormatAttribute( writer,
195  BAD_CAST( "nWidth" ),
196  "%i", static_cast<int>(nWidth) );
197  if (!m_aLine.isEmpty())
198  {
199  xmlTextWriterWriteAttribute(writer, BAD_CAST("Line"),
200  BAD_CAST(m_aLine.toUtf8().getStr()));
201  m_aLine.clear();
202  }
203  xmlTextWriterEndElement( writer );
204  }
205 
210  virtual void Skip( TextFrameIndex nLength ) override
211  {
212  xmlTextWriterStartElement( writer, BAD_CAST( "Skip" ) );
213  xmlTextWriterWriteFormatAttribute( writer,
214  BAD_CAST( "nLength" ),
215  "%i", static_cast<int>(static_cast<sal_Int32>(nLength)) );
216  xmlTextWriterEndElement( writer );
217  ofs += nLength;
218  }
219 
220  virtual void Finish( ) override
221  {
222  xmlTextWriterStartElement( writer, BAD_CAST( "Finish" ) );
223  xmlTextWriterEndElement( writer );
224  }
225 
226 };
227 
228  xmlTextWriterPtr lcl_createDefaultWriter()
229  {
230  xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 );
231  xmlTextWriterSetIndent(writer,1);
232  xmlTextWriterSetIndentString(writer, BAD_CAST(" "));
233  xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
234  return writer;
235  }
236 
237  void lcl_freeWriter( xmlTextWriterPtr writer )
238  {
239  xmlTextWriterEndDocument( writer );
240  xmlFreeTextWriter( writer );
241  }
242 }
243 
245 {
246  const SwFrame* pFrame = this;
247  while (pFrame->GetUpper())
248  {
249  pFrame = pFrame->GetUpper();
250  }
251 
252  pFrame->dumpAsXml(writer);
253 }
254 
256 {
257  bool bCreateWriter = ( nullptr == writer );
258  if ( bCreateWriter )
259  writer = lcl_createDefaultWriter();
260 
261  const char *name = nullptr;
262 
263  switch ( GetType( ) )
264  {
265  case SwFrameType::Root:
266  name = "root";
267  break;
268  case SwFrameType::Page:
269  name = "page";
270  break;
271  case SwFrameType::Column:
272  name = "column";
273  break;
274  case SwFrameType::Header:
275  name = "header";
276  break;
277  case SwFrameType::Footer:
278  name = "footer";
279  break;
281  name = "ftncont";
282  break;
283  case SwFrameType::Ftn:
284  name = "ftn";
285  break;
286  case SwFrameType::Body:
287  name = "body";
288  break;
289  case SwFrameType::Fly:
290  name = "fly";
291  break;
293  name = "section";
294  break;
295  case SwFrameType::Tab:
296  name = "tab";
297  break;
298  case SwFrameType::Row:
299  name = "row";
300  break;
301  case SwFrameType::Cell:
302  name = "cell";
303  break;
304  case SwFrameType::Txt:
305  name = "txt";
306  break;
307  case SwFrameType::NoTxt:
308  name = "notxt";
309  break;
310  default: break;
311  }
312 
313  if ( name != nullptr )
314  {
315  xmlTextWriterStartElement( writer, reinterpret_cast<const xmlChar *>(name) );
316 
317  dumpAsXmlAttributes( writer );
318 
319  if (IsRootFrame())
320  {
321  const SwRootFrame* pRootFrame = static_cast<const SwRootFrame*>(this);
322  xmlTextWriterStartElement(writer, BAD_CAST("sfxViewShells"));
323  SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>));
324  while (pView)
325  {
326  if (pView->GetObjectShell() == pRootFrame->GetCurrShell()->GetSfxViewShell()->GetObjectShell())
327  pView->dumpAsXml(writer);
328  pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>));
329  }
330  xmlTextWriterEndElement(writer);
331  }
332 
333  if (IsPageFrame())
334  {
335  const SwPageFrame* pPageFrame = static_cast<const SwPageFrame*>(this);
336  xmlTextWriterStartElement(writer, BAD_CAST("page_status"));
337  xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidFlyLayout"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidFlyLayout()).getStr()));
338  xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidFlyContent"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidFlyContent()).getStr()));
339  xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidFlyInCnt"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidFlyInCnt()).getStr()));
340  xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidLayout"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidLayout()).getStr()));
341  xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidContent"), BAD_CAST(OString::boolean(!pPageFrame->IsInvalidContent()).getStr()));
342  xmlTextWriterEndElement(writer);
343  }
344 
345  if (IsTextFrame())
346  {
347  const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
348  sw::MergedPara const*const pMerged(pTextFrame->GetMergedPara());
349  if (pMerged)
350  {
351  xmlTextWriterStartElement( writer, BAD_CAST( "merged" ) );
352  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "paraPropsNodeIndex" ), "%" SAL_PRIuUINTPTR, pMerged->pParaPropsNode->GetIndex() );
353  for (auto const& e : pMerged->extents)
354  {
355  xmlTextWriterStartElement( writer, BAD_CAST( "extent" ) );
356  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), "%" SAL_PRIuUINTPTR, e.pNode->GetIndex() );
357  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "start" ), "%" SAL_PRIdINT32, e.nStart );
358  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "end" ), "%" SAL_PRIdINT32, e.nEnd );
359  xmlTextWriterEndElement( writer );
360  }
361  xmlTextWriterEndElement( writer );
362  }
363  }
364 
365  if (IsCellFrame())
366  {
367  SwCellFrame const* pCellFrame(static_cast<SwCellFrame const*>(this));
368  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "rowspan" ), "%ld", pCellFrame->GetLayoutRowSpan() );
369  }
370 
371  xmlTextWriterStartElement( writer, BAD_CAST( "infos" ) );
372  dumpInfosAsXml( writer );
373  xmlTextWriterEndElement( writer );
374 
375  // Dump Anchored objects if any
376  const SwSortedObjs* pAnchored = GetDrawObjs();
377  if ( pAnchored && pAnchored->size() > 0 )
378  {
379  xmlTextWriterStartElement( writer, BAD_CAST( "anchored" ) );
380 
381  for (SwAnchoredObject* pObject : *pAnchored)
382  {
383  pObject->dumpAsXml( writer );
384  }
385 
386  xmlTextWriterEndElement( writer );
387  }
388 
389  // Dump the children
390  if ( IsTextFrame( ) )
391  {
392  const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
393  OUString aText = pTextFrame->GetText( );
394  for ( int i = 0; i < 32; i++ )
395  {
396  aText = aText.replace( i, '*' );
397  }
398  OString aText8 =OUStringToOString( aText,
399  RTL_TEXTENCODING_UTF8 );
400  xmlTextWriterWriteString( writer,
401  reinterpret_cast<const xmlChar *>(aText8.getStr( )) );
402  XmlPortionDumper pdumper( writer, aText );
403  pTextFrame->VisitPortions( pdumper );
404 
405  }
406  else
407  {
408  dumpChildrenAsXml( writer );
409  }
410  xmlTextWriterEndElement( writer );
411  }
412 
413  if ( bCreateWriter )
414  lcl_freeWriter( writer );
415 }
416 
418 {
419  // output the Frame
420  xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) );
421  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", getFrameArea().Left() );
422  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", getFrameArea().Top() );
423  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", getFrameArea().Width() );
424  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", getFrameArea().Height() );
425  xmlTextWriterWriteAttribute(writer, BAD_CAST("mbFixSize"), BAD_CAST(OString::boolean(HasFixSize()).getStr()));
426  xmlTextWriterWriteAttribute(writer, BAD_CAST("mbValidPos"), BAD_CAST(OString::boolean(isFrameAreaPositionValid()).getStr()));
427  xmlTextWriterWriteAttribute(writer, BAD_CAST("mbValidSize"), BAD_CAST(OString::boolean(isFrameAreaSizeValid()).getStr()));
428  xmlTextWriterWriteAttribute(writer, BAD_CAST("mbValidPrtArea"), BAD_CAST(OString::boolean(isFramePrintAreaValid()).getStr()));
429  xmlTextWriterEndElement( writer );
430 
431  // output the Prt
432  xmlTextWriterStartElement( writer, BAD_CAST( "prtBounds" ) );
433  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", getFramePrintArea().Left() );
434  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", getFramePrintArea().Top() );
435  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", getFramePrintArea().Width() );
436  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", getFramePrintArea().Height() );
437  xmlTextWriterEndElement( writer );
438 }
439 
440 // Hack: somehow conversion from "..." to va_list does
441 // bomb on two string literals in the format.
442 static const char* const TMP_FORMAT = "%" SAL_PRIuUINTPTR;
443 
445 {
446  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", this );
447  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "id" ), "%" SAL_PRIuUINT32, GetFrameId() );
448  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "symbol" ), "%s", BAD_CAST( typeid( *this ).name( ) ) );
449  if ( GetNext( ) )
450  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "next" ), "%" SAL_PRIuUINT32, GetNext()->GetFrameId() );
451  if ( GetPrev( ) )
452  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "prev" ), "%" SAL_PRIuUINT32, GetPrev()->GetFrameId() );
453  if ( GetUpper( ) )
454  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "upper" ), "%" SAL_PRIuUINT32, GetUpper()->GetFrameId() );
455  if ( GetLower( ) )
456  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "lower" ), "%" SAL_PRIuUINT32, GetLower()->GetFrameId() );
457  if (IsFootnoteFrame())
458  {
459  SwFootnoteFrame const*const pFF(static_cast<SwFootnoteFrame const*>(this));
460  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("ref"), "%" SAL_PRIuUINT32, pFF->GetRef()->GetFrameId() );
461  if (pFF->GetMaster())
462  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("master"), "%" SAL_PRIuUINT32, pFF->GetMaster()->GetFrameId() );
463  if (pFF->GetFollow())
464  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("follow"), "%" SAL_PRIuUINT32, pFF->GetFollow()->GetFrameId() );
465  }
466  if ( IsTextFrame( ) )
467  {
468  const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
469  const SwTextNode *pTextNode = pTextFrame->GetTextNodeFirst();
470  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), TMP_FORMAT, pTextNode->GetIndex() );
471 
472  OString aMode = "Horizontal";
473  if (IsVertLRBT())
474  {
475  aMode = "VertBTLR";
476  }
477  else if (IsVertLR())
478  {
479  aMode = "VertLR";
480  }
481  else if (IsVertical())
482  {
483  aMode = "Vertical";
484  }
485  xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), BAD_CAST(aMode.getStr()));
486  }
487  if (IsHeaderFrame() || IsFooterFrame())
488  {
489  const SwHeadFootFrame *pHeadFootFrame = static_cast<const SwHeadFootFrame*>(this);
490  OUString aFormatName = pHeadFootFrame->GetFormat()->GetName();
491  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "fmtName" ), "%s", BAD_CAST(OUStringToOString(aFormatName, RTL_TEXTENCODING_UTF8).getStr()));
492  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "fmtPtr" ), "%p", pHeadFootFrame->GetFormat());
493  }
494 }
495 
497 {
498  const SwFrame *pFrame = GetLower( );
499  for ( ; pFrame != nullptr; pFrame = pFrame->GetNext( ) )
500  {
501  pFrame->dumpAsXml( writer );
502  }
503 }
504 
506 {
507  bool bCreateWriter = ( nullptr == writer );
508  if ( bCreateWriter )
509  writer = lcl_createDefaultWriter();
510 
511  xmlTextWriterStartElement( writer, BAD_CAST( getElementName() ) );
512  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", this );
513 
514  xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) );
515  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", GetObjBoundRect().Left() );
516  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", GetObjBoundRect().Top() );
517  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", GetObjBoundRect().Width() );
518  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", GetObjBoundRect().Height() );
519  xmlTextWriterEndElement( writer );
520 
521  if (const SdrObject* pObject = GetDrawObj())
522  pObject->dumpAsXml(writer);
523 
524  xmlTextWriterEndElement( writer );
525 
526  if ( bCreateWriter )
527  lcl_freeWriter( writer );
528 }
529 
531 {
532  xmlTextWriterStartElement(writer, BAD_CAST("SwFont"));
533  xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("ptr"), "%p", this);
534  // do not use Color::AsRGBHexString() as that omits the transparency
535  xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("color"), "%08" SAL_PRIxUINT32, sal_uInt32(GetColor()));
536  xmlTextWriterEndElement(writer);
537 }
538 
540 {
542  if ( HasFollow() )
543  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
544 
545  if (m_pPrecede != nullptr)
546  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%" SAL_PRIuUINT32, static_cast<SwTextFrame*>(m_pPrecede)->GetFrameId() );
547 }
548 
550 {
552  if ( HasFollow() )
553  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
554 
555  if (m_pPrecede != nullptr)
556  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%" SAL_PRIuUINT32, static_cast<SwSectionFrame*>( m_pPrecede )->GetFrameId() );
557 }
558 
560 {
562  if ( HasFollow() )
563  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
564 
565  if (m_pPrecede != nullptr)
566  xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%" SAL_PRIuUINT32, static_cast<SwTabFrame*>( m_pPrecede )->GetFrameId() );
567 }
568 
569 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
sal_uLong GetIndex() const
Definition: node.hxx:282
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:543
bool IsRootFrame() const
Definition: frame.hxx:1150
SwFrameType GetType() const
Definition: frame.hxx:498
const SwRect & getFramePrintArea() const
Definition: frame.hxx:176
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:440
bool HasFollow() const
Definition: flowfrm.hxx:165
virtual void dumpAsXml(xmlTextWriterPtr writer=nullptr) const
Definition: xmldump.cxx:255
bool IsCellFrame() const
Definition: frame.hxx:1202
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:444
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1280
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:559
void dumpAsXml(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:530
EmbeddedObjectRef * pObject
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
virtual void Text(TextFrameIndex nLength, PortionType nType, sal_Int32 nHeight=0, sal_Int32 nWidth=0)=0
(empty) destructor
bool IsFootnoteFrame() const
Definition: frame.hxx:1178
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
virtual SwRect GetObjBoundRect() const =0
bool IsVertLRBT() const
Definition: frame.hxx:959
virtual void Finish()=0
end of paragraph.
wrapper class for the positioning of Writer fly frames and drawing objects
bool IsInvalidFlyInCnt() const
Definition: pagefrm.hxx:219
const SwRect & getFrameArea() const
Definition: frame.hxx:175
const OUString & GetName() const
Definition: format.hxx:111
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
bool IsTextFrame() const
Definition: frame.hxx:1210
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:958
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:505
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:848
bool IsInvalidContent() const
Definition: pagefrm.hxx:221
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.
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:447
struct _xmlTextWriter * xmlTextWriterPtr
bool IsInvalidFlyContent() const
Definition: pagefrm.hxx:218
virtual const char * getElementName() const
The element name to show in the XML dump.
void dumpChildrenAsXml(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:496
const SdrObject * GetDrawObj() const
void dumpAsXml(xmlTextWriterPtr pWriter) const override
See SfxViewShell::dumpAsXml().
Definition: viewprt.cxx:267
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:160
size_t size() const
Definition: sortedobjs.cxx:42
void dumpTopMostAsXml(xmlTextWriterPtr writer=nullptr) const
Definition: xmldump.cxx:244
int i
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
bool isFramePrintAreaValid() const
Definition: frame.hxx:164
PortionType
Definition: txttypes.hxx:23
SwFrame * GetPrev()
Definition: frame.hxx:655
SwFlowFrame * m_pPrecede
Definition: flowfrm.hxx:118
bool isFrameAreaPositionValid() const
Definition: frame.hxx:162
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:539
bool HasFixSize() const
Definition: frame.hxx:648
bool isFrameAreaSizeValid() const
Definition: frame.hxx:163
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
const Color & GetColor() const
Definition: swfont.hxx:276
A page of the document layout.
Definition: pagefrm.hxx:40
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:104
bool IsInvalidFlyLayout() const
Definition: pagefrm.hxx:217
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
void dumpInfosAsXml(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:417
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
bool IsVertLR() const
Definition: frame.hxx:955
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:444
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:101
const SwContentFrame * GetRef() const
Definition: ftnfrm.cxx:2878
SwFrame * GetLower()
Definition: findfrm.cxx:169
bool IsPageFrame() const
Definition: frame.hxx:1154
const char * name
virtual void Skip(TextFrameIndex nLength)=0
skip characters.
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:243
virtual SfxObjectShell * GetObjectShell() override
bool IsVertical() const
Definition: frame.hxx:949
Left
static const char *const TMP_FORMAT
Definition: xmldump.cxx:442
long GetLayoutRowSpan() const
Definition: tabfrm.cxx:5316
OString m_aLine
void VisitPortions(SwPortionHandler &rPH) const
Visit all portions for Accessibility.
Definition: txtfrm.cxx:3861
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
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:1170
sal_uInt32 GetFrameId() const
Definition: frame.hxx:170
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:30
bool IsInvalidLayout() const
Definition: pagefrm.hxx:220
Definition: view.hxx:146
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:549
bool IsHeaderFrame() const
Definition: frame.hxx:1166
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:393
SwFrame * GetNext()
Definition: frame.hxx:654