LibreOffice Module sw (master)  1
xmltble.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/XTextTable.hpp>
21 #include <com/sun/star/text/XTextSection.hpp>
22 
23 #include <hintids.hxx>
24 #include <rtl/ustrbuf.hxx>
25 #include <xmloff/xmlnmspe.hxx>
26 #include <xmloff/xmltoken.hxx>
27 #include <xmloff/xmluconv.hxx>
28 #include <xmloff/numehelp.hxx>
29 #include <svl/zforlist.hxx>
30 #include <editeng/brushitem.hxx>
31 #include <editeng/boxitem.hxx>
32 #include <editeng/xmlcnitm.hxx>
33 #include <fmtrowsplt.hxx>
34 #include <editeng/frmdiritem.hxx>
35 #include <list>
36 #include <swtable.hxx>
37 #include <doc.hxx>
38 #include <pam.hxx>
39 #include <frmfmt.hxx>
40 #include <wrtswtbl.hxx>
41 #include <fmtfsize.hxx>
42 #include <fmtornt.hxx>
43 #include <cellatr.hxx>
44 #include <ddefld.hxx>
45 #include <swddetbl.hxx>
46 #include <ndole.hxx>
47 #include <xmloff/nmspmap.hxx>
48 #include <sfx2/linkmgr.hxx>
49 #include <unotbl.hxx>
50 #include "xmltexte.hxx"
51 #include "xmlexp.hxx"
52 #include <o3tl/any.hxx>
53 #include <o3tl/sorted_vector.hxx>
54 #include <textboxhelper.hxx>
55 
56 using namespace ::com::sun::star;
57 using namespace ::com::sun::star::uno;
58 using namespace ::com::sun::star::text;
59 using namespace ::com::sun::star::beans;
60 using namespace ::com::sun::star::lang;
61 using namespace ::com::sun::star::container;
62 using namespace ::xmloff::token;
63 using table::XCell;
64 using std::vector;
65 using std::advance;
66 
67 
69 {
70  OUString sStyleName;
71  sal_uInt32 nRelWidth;
72 
73 public:
74 
75  explicit SwXMLTableColumn_Impl(sal_uInt32 nPosition)
76  : SwWriteTableCol(nPosition)
77  , nRelWidth(0)
78  {};
79 
80  void SetStyleName( const OUString& rName ) { sStyleName = rName; }
81  const OUString& GetStyleName() const { return sStyleName; }
82 
83  void SetRelWidth( sal_uInt32 nSet ) { nRelWidth = nSet; }
84  sal_uInt32 GetRelWidth() const { return nRelWidth; }
85 };
86 
88 {
89  bool operator()( SwXMLTableColumn_Impl* const& lhs, SwXMLTableColumn_Impl* const& rhs ) const
90  {
91  sal_Int32 n = static_cast<sal_Int32>(lhs->GetWidthOpt()) - static_cast<sal_Int32>(rhs->GetWidthOpt());
92  if( !n )
93  n = static_cast<sal_Int32>(lhs->GetRelWidth()) - static_cast<sal_Int32>(rhs->GetRelWidth());
94  return n < 0;
95  }
96 };
97 
98 class SwXMLTableColumns_Impl : public o3tl::sorted_vector<std::unique_ptr<SwXMLTableColumn_Impl>, o3tl::less_uniqueptr_to<SwXMLTableColumn_Impl> > {
99 };
100 
101 class SwXMLTableColumnsSortByWidth_Impl : public o3tl::sorted_vector<SwXMLTableColumn_Impl*, SwXMLTableColumnCmpWidth_Impl> {};
102 
104 {
107  sal_uInt32 nWidth;
108 
109 public:
110 
111  explicit SwXMLTableLines_Impl( const SwTableLines& rLines );
112 
113  sal_uInt32 GetWidth() const { return nWidth; }
114  const SwTableLines *GetLines() const { return pLines; }
115 
116  const SwXMLTableColumns_Impl& GetColumns() const { return aCols; }
117 };
118 
120  pLines( &rLines ),
121  nWidth( 0 )
122 {
123 #if OSL_DEBUG_LEVEL > 0
124  sal_uInt32 nEndCPos = 0U;
125 #endif
126  const size_t nLines = rLines.size();
127  for( size_t nLine=0U; nLine<nLines; ++nLine )
128  {
129  const SwTableLine *pLine = rLines[nLine];
130  const SwTableBoxes& rBoxes = pLine->GetTabBoxes();
131  const size_t nBoxes = rBoxes.size();
132 
133  sal_uInt32 nCPos = 0U;
134  for( size_t nBox=0U; nBox<nBoxes; ++nBox )
135  {
136  const SwTableBox *pBox = rBoxes[nBox];
137 
138  if( nBox < nBoxes-1U || nWidth==0 )
139  {
140  nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox );
141  std::unique_ptr<SwXMLTableColumn_Impl> pCol(
142  new SwXMLTableColumn_Impl( nCPos ));
143 
144  aCols.insert( std::move(pCol) );
145 
146  if( nBox==nBoxes-1U )
147  {
148  OSL_ENSURE( nLine==0U && nWidth==0,
149  "parent width will be lost" );
150  nWidth = nCPos;
151  }
152  }
153  else
154  {
155 #if OSL_DEBUG_LEVEL > 0
156  sal_uInt32 nCheckPos =
157  nCPos + SwWriteTable::GetBoxWidth( pBox );
158  if( !nEndCPos )
159  {
160  nEndCPos = nCheckPos;
161  }
162 #endif
163  nCPos = nWidth;
164 #if OSL_DEBUG_LEVEL > 0
166  OSL_ENSURE( aCols.find(&aCol) != aCols.end(), "couldn't find last column" );
167  OSL_ENSURE( SwXMLTableColumn_Impl(nCheckPos) ==
168  SwXMLTableColumn_Impl(nCPos),
169  "rows have different total widths" );
170 #endif
171  }
172  }
173  }
174 }
175 
176 typedef vector< SwFrameFormat* > SwXMLFrameFormats_Impl;
177 
179 {
180 private:
182 public:
183  bool AddRow( SwFrameFormat& rFrameFormat, const OUString& rNamePrefix, sal_uInt32 nLine );
184  bool AddCell( SwFrameFormat& rFrameFormat, const OUString& rNamePrefix,
185  sal_uInt32 nCol, sal_uInt32 nRow, bool bTop );
186 };
187 
189  const OUString& rNamePrefix,
190  sal_uInt32 nLine )
191 {
192  const SwFormatFrameSize *pFrameSize = nullptr;
193  const SwFormatRowSplit* pRowSplit = nullptr;
194  const SvxBrushItem *pBrush = nullptr;
195 
196  const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet();
197  const SfxPoolItem *pItem;
198  if( SfxItemState::SET == rItemSet.GetItemState( RES_FRM_SIZE, false, &pItem ) )
199  pFrameSize = static_cast<const SwFormatFrameSize *>(pItem);
200 
201  if( SfxItemState::SET == rItemSet.GetItemState( RES_ROW_SPLIT, false, &pItem ) )
202  pRowSplit = static_cast<const SwFormatRowSplit *>(pItem);
203 
204  if( SfxItemState::SET == rItemSet.GetItemState( RES_BACKGROUND, false, &pItem ) )
205  pBrush = static_cast<const SvxBrushItem *>(pItem);
206 
207  // empty styles have not to be exported
208  if( !pFrameSize && !pBrush && !pRowSplit )
209  return false;
210 
211  // order is: -/brush, size/-, size/brush
212  bool bInsert = true;
213  SwXMLFrameFormats_Impl::iterator i;
214  for( i = aFormatList.begin(); i < aFormatList.end(); ++i )
215  {
216  const SwFormatFrameSize *pTestFrameSize = nullptr;
217  const SwFormatRowSplit* pTestRowSplit = nullptr;
218  const SvxBrushItem *pTestBrush = nullptr;
219  const SwFrameFormat *pTestFormat = *i;
220  const SfxItemSet& rTestSet = pTestFormat->GetAttrSet();
221  if( SfxItemState::SET == rTestSet.GetItemState( RES_FRM_SIZE, false,
222  &pItem ) )
223  {
224  if( !pFrameSize )
225  break;
226 
227  pTestFrameSize = static_cast<const SwFormatFrameSize *>(pItem);
228  }
229  else
230  {
231  if( pFrameSize )
232  continue;
233  }
234 
235  if( SfxItemState::SET == rTestSet.GetItemState( RES_BACKGROUND, false,
236  &pItem ) )
237  {
238  if( !pBrush )
239  break;
240 
241  pTestBrush = static_cast<const SvxBrushItem *>(pItem);
242  }
243  else
244  {
245  if( pBrush )
246  continue;
247  }
248 
249  if( SfxItemState::SET == rTestSet.GetItemState( RES_ROW_SPLIT, false,
250  &pItem ) )
251  {
252  if( !pRowSplit )
253  break;
254 
255  pTestRowSplit = static_cast<const SwFormatRowSplit *>(pItem);
256  }
257  else
258  {
259  if( pRowSplit )
260  continue;
261  }
262 
263  if( pFrameSize &&
264  ( pFrameSize->GetHeightSizeType() != pTestFrameSize->GetHeightSizeType() ||
265  pFrameSize->GetHeight() != pTestFrameSize->GetHeight() ) )
266  continue;
267 
268  if( pBrush && (*pBrush != *pTestBrush) )
269  continue;
270 
271  if( pRowSplit && (!pRowSplit->GetValue() != !pTestRowSplit->GetValue()) )
272  continue;
273 
274  // found!
275  rFrameFormat.SetName( pTestFormat->GetName() );
276  bInsert = false;
277  break;
278  }
279 
280  if( bInsert )
281  {
282  rFrameFormat.SetName( rNamePrefix + "." + OUString::number(nLine+1) );
283  if ( i != aFormatList.end() ) ++i;
284  aFormatList.insert( i, &rFrameFormat );
285  }
286 
287  return bInsert;
288 }
289 
290 static OUString lcl_xmltble_appendBoxPrefix(const OUString& rNamePrefix,
291  sal_uInt32 nCol, sal_uInt32 nRow, bool bTop )
292 {
293  if( bTop )
294  {
295  OUString sTmp;
296  sw_GetTableBoxColStr( static_cast<sal_uInt16>(nCol), sTmp );
297  return rNamePrefix + "." + sTmp + OUString::number(nRow + 1);
298  }
299  return rNamePrefix
300  + "." + OUString::number(nCol + 1)
301  + "." + OUString::number(nRow + 1);
302 }
303 
305  const OUString& rNamePrefix,
306  sal_uInt32 nCol, sal_uInt32 nRow, bool bTop )
307 {
308  const SwFormatVertOrient *pVertOrient = nullptr;
309  const SvxBrushItem *pBrush = nullptr;
310  const SvxBoxItem *pBox = nullptr;
311  const SwTableBoxNumFormat *pNumFormat = nullptr;
312  const SvxFrameDirectionItem *pFrameDir = nullptr;
313  const SvXMLAttrContainerItem *pAttCnt = nullptr;
314 
315  const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet();
316  const SfxPoolItem *pItem;
317  if( SfxItemState::SET == rItemSet.GetItemState( RES_VERT_ORIENT, false,
318  &pItem ) )
319  pVertOrient = static_cast<const SwFormatVertOrient *>(pItem);
320 
321  if( SfxItemState::SET == rItemSet.GetItemState( RES_BACKGROUND, false, &pItem ) )
322  pBrush = static_cast<const SvxBrushItem *>(pItem);
323 
324  if( SfxItemState::SET == rItemSet.GetItemState( RES_BOX, false, &pItem ) )
325  pBox = static_cast<const SvxBoxItem *>(pItem);
326 
327  if ( SfxItemState::SET == rItemSet.GetItemState( RES_BOXATR_FORMAT,
328  false, &pItem ) )
329  pNumFormat = static_cast<const SwTableBoxNumFormat *>(pItem);
330  if ( SfxItemState::SET == rItemSet.GetItemState( RES_FRAMEDIR,
331  false, &pItem ) )
332  pFrameDir = static_cast<const SvxFrameDirectionItem *>(pItem);
333  if ( SfxItemState::SET == rItemSet.GetItemState( RES_UNKNOWNATR_CONTAINER,
334  false, &pItem ) )
335  pAttCnt = static_cast<const SvXMLAttrContainerItem *>(pItem);
336 
337  // empty styles have not to be exported
338  if( !pVertOrient && !pBrush && !pBox && !pNumFormat && !pFrameDir && !pAttCnt )
339  return false;
340 
341  // order is: -/-/-/num,
342  // -/-/box/-, -/-/box/num,
343  // -/brush/-/-, -/brush/-/num, -/brush/box/-, -/brush/box/num,
344  // vert/-/-/-, vert/-/-/num, vert/-/box/-, ver/-/box/num,
345  // vert/brush/-/-, vert/brush/-/num, vert/brush/box/-,
346  // vert/brush/box/num
347  bool bInsert = true;
348  SwXMLFrameFormats_Impl::iterator i;
349  for( i = aFormatList.begin(); i < aFormatList.end(); ++i )
350  {
351  const SwFormatVertOrient *pTestVertOrient = nullptr;
352  const SvxBrushItem *pTestBrush = nullptr;
353  const SvxBoxItem *pTestBox = nullptr;
354  const SwTableBoxNumFormat *pTestNumFormat = nullptr;
355  const SvxFrameDirectionItem *pTestFrameDir = nullptr;
356  const SvXMLAttrContainerItem *pTestAttCnt = nullptr;
357  const SwFrameFormat* pTestFormat = *i;
358  const SfxItemSet& rTestSet = pTestFormat->GetAttrSet();
359  if( SfxItemState::SET == rTestSet.GetItemState( RES_VERT_ORIENT, false,
360  &pItem ) )
361  {
362  if( !pVertOrient )
363  break;
364 
365  pTestVertOrient = static_cast<const SwFormatVertOrient *>(pItem);
366  }
367  else
368  {
369  if( pVertOrient )
370  continue;
371  }
372 
373  if( SfxItemState::SET == rTestSet.GetItemState( RES_BACKGROUND, false,
374  &pItem ) )
375  {
376  if( !pBrush )
377  break;
378 
379  pTestBrush = static_cast<const SvxBrushItem *>(pItem);
380  }
381  else
382  {
383  if( pBrush )
384  continue;
385  }
386 
387  if( SfxItemState::SET == rTestSet.GetItemState( RES_BOX, false, &pItem ) )
388  {
389  if( !pBox )
390  break;
391 
392  pTestBox = static_cast<const SvxBoxItem *>(pItem);
393  }
394  else
395  {
396  if( pBox )
397  continue;
398  }
399 
400  if ( SfxItemState::SET == rTestSet.GetItemState( RES_BOXATR_FORMAT,
401  false, &pItem ) )
402  {
403  if( !pNumFormat )
404  break;
405 
406  pTestNumFormat = static_cast<const SwTableBoxNumFormat *>(pItem);
407  }
408  else
409  {
410  if( pNumFormat )
411  continue;
412 
413  }
414 
415  if ( SfxItemState::SET == rTestSet.GetItemState( RES_FRAMEDIR,
416  false, &pItem ) )
417  {
418  if( !pFrameDir )
419  break;
420 
421  pTestFrameDir = static_cast<const SvxFrameDirectionItem *>(pItem);
422  }
423  else
424  {
425  if( pFrameDir )
426  continue;
427 
428  }
429 
430  if ( SfxItemState::SET == rTestSet.GetItemState( RES_UNKNOWNATR_CONTAINER,
431  false, &pItem ) )
432  {
433  if( !pAttCnt )
434  break;
435 
436  pTestAttCnt = static_cast<const SvXMLAttrContainerItem *>(pItem);
437  }
438  else
439  {
440  if ( pAttCnt )
441  continue;
442 
443  }
444 
445  if( pVertOrient &&
446  pVertOrient->GetVertOrient() != pTestVertOrient->GetVertOrient() )
447  continue;
448 
449  if( pBrush && ( *pBrush != *pTestBrush ) )
450  continue;
451 
452  if( pBox && ( *pBox != *pTestBox ) )
453  continue;
454 
455  if( pNumFormat && pNumFormat->GetValue() != pTestNumFormat->GetValue() )
456  continue;
457 
458  if( pFrameDir && pFrameDir->GetValue() != pTestFrameDir->GetValue() )
459  continue;
460 
461  if( pAttCnt && ( *pAttCnt != *pTestAttCnt ) )
462  continue;
463 
464  // found!
465  rFrameFormat.SetName( pTestFormat->GetName() );
466  bInsert = false;
467  break;
468  }
469 
470  if( bInsert )
471  {
472  rFrameFormat.SetName( lcl_xmltble_appendBoxPrefix( rNamePrefix, nCol, nRow, bTop ) );
473  if ( i != aFormatList.end() ) ++i;
474  aFormatList.insert( i, &rFrameFormat );
475  }
476 
477  return bInsert;
478 }
479 
481 {
483  Reference<XTextSection> m_xBaseSection;
485  sal_uInt32 const m_nPrefix;
486 
487 public:
488 
489  inline SwXMLTableInfo_Impl( const SwTable *pTable, sal_uInt16 nPrefix );
490 
491  const SwTable *GetTable() const { return m_pTable; }
492  const SwFrameFormat *GetTableFormat() const { return m_pTable->GetFrameFormat(); }
493 
494  bool IsBaseSectionValid() const { return m_bBaseSectionValid; }
495  const Reference<XTextSection>& GetBaseSection() const { return m_xBaseSection; }
496  inline void SetBaseSection( const Reference < XTextSection >& rBase );
498  sal_uInt16 GetPrefix() const { return m_nPrefix; }
499 };
500 
501 inline SwXMLTableInfo_Impl::SwXMLTableInfo_Impl(const SwTable *pTable, sal_uInt16 nPrefix) :
502  m_pTable(pTable),
503  m_bBaseSectionValid(false),
504  m_nPrefix(nPrefix)
505 {
506 }
507 
509  const Reference < XTextSection >& rBaseSection )
510 {
511  m_xBaseSection = rBaseSection;
512  m_bBaseSectionValid = true;
513 }
514 
516 {
517  // <style:style ...>
518  CheckAttrList();
519 
520  // style:name="..."
521  bool bEncoded = false;
522  AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
523  EncodeStyleName( rCol.GetStyleName(), &bEncoded ) );
524  if( bEncoded )
525  AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, rCol.GetStyleName() );
526 
527  // style:family="table-column"
528  AddAttribute( XML_NAMESPACE_STYLE, XML_FAMILY, XML_TABLE_COLUMN );
529 
530  {
531  SvXMLElementExport aElem( *this, XML_NAMESPACE_STYLE, XML_STYLE, true,
532  true );
533  OUStringBuffer sValue;
534  if( rCol.GetWidthOpt() )
535  {
537  rCol.GetWidthOpt() );
538  AddAttribute( XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH,
539  sValue.makeStringAndClear() );
540  }
541  if( rCol.GetRelWidth() )
542  {
543  sValue.append( static_cast<sal_Int32>(rCol.GetRelWidth()) );
544  sValue.append( '*' );
545  AddAttribute( XML_NAMESPACE_STYLE, XML_REL_COLUMN_WIDTH,
546  sValue.makeStringAndClear() );
547  }
548 
549  {
550  SvXMLElementExport aElemExport( *this, XML_NAMESPACE_STYLE,
552  true, true );
553  }
554  }
555 }
556 
558  sal_uInt32 nAbsWidth, sal_uInt32 nBaseWidth,
559  const OUString& rNamePrefix,
563  SwXMLTableInfo_Impl& rTableInfo,
564  bool bTop )
565 {
566  // pass 1: calculate columns
567  SwXMLTableLines_Impl *pLines = new SwXMLTableLines_Impl( rLines );
568  if( !m_pTableLines )
570 
571  m_pTableLines->push_back( pLines );
572 
573  // pass 2: export column styles
574  {
575  const SwXMLTableColumns_Impl& rCols = pLines->GetColumns();
576  sal_uInt32 nCPos = 0U;
577  const size_t nColumns = rCols.size();
578  for( size_t nColumn=0U; nColumn<nColumns; ++nColumn )
579  {
580  SwXMLTableColumn_Impl *pColumn = rCols[nColumn].get();
581 
582  sal_uInt32 nOldCPos = nCPos;
583  nCPos = pColumn->GetPos();
584 
585  sal_uInt32 nWidth = nCPos - nOldCPos;
586 
587  // If a base width is given, the table has either an automatic
588  // or margin alignment, or a percentage width. In either case,
589  // relative widths should be exported.
590  if( nBaseWidth )
591  {
592  pColumn->SetRelWidth( nWidth );
593  }
594 
595  // If an absolute width is given, the table either has a fixed
596  // width, or the current width is known from the layout. In the
597  // later case, a base width is set in addition and must be used
598  // to "absolutize" the relative column width.
599  if( nAbsWidth )
600  {
601  sal_uInt32 nColAbsWidth = nWidth;
602  if( nBaseWidth )
603  {
604  nColAbsWidth *= nAbsWidth;
605  nColAbsWidth += (nBaseWidth/2UL);
606  nColAbsWidth /= nBaseWidth;
607  }
608  pColumn->SetWidthOpt( nColAbsWidth, false );
609  }
610 
612  if( it != rExpCols.end() )
613  {
614  pColumn->SetStyleName( (*it)->GetStyleName() );
615  }
616  else
617  {
618  if( bTop )
619  {
620  OUString sTmp;
621  sw_GetTableBoxColStr( nColumn, sTmp );
622  pColumn->SetStyleName( rNamePrefix + "." + sTmp );
623  }
624  else
625  {
626  pColumn->SetStyleName( rNamePrefix + "." + OUString::number(nColumn + 1U) );
627  }
628  ExportTableColumnStyle( *pColumn );
629  rExpCols.insert( pColumn );
630  }
631  }
632  }
633 
634  // pass 3: export line/rows
635  const size_t nLines = rLines.size();
636  for( size_t nLine=0U; nLine<nLines; ++nLine )
637  {
638  SwTableLine *pLine = rLines[nLine];
639 
640  SwFrameFormat *pFrameFormat = pLine->GetFrameFormat();
641  if( rExpRows.AddRow( *pFrameFormat, rNamePrefix, nLine ) )
642  ExportFormat( *pFrameFormat, XML_TABLE_ROW );
643 
644  const SwTableBoxes& rBoxes = pLine->GetTabBoxes();
645  const size_t nBoxes = rBoxes.size();
646 
647  sal_uInt32 nCPos = 0U;
648  size_t nCol = 0U;
649  for( size_t nBox=0U; nBox<nBoxes; nBox++ )
650  {
651  SwTableBox *pBox = rBoxes[nBox];
652 
653  if( nBox < nBoxes-1U )
654  nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox );
655  else
656  nCPos = pLines->GetWidth();
657 
658  // and their index
659  const size_t nOldCol = nCol;
660  SwXMLTableColumn_Impl aCol( nCPos );
662  OSL_ENSURE( it != pLines->GetColumns().end(), "couldn't find column" );
663  nCol = it - pLines->GetColumns().begin();
664 
665  const SwStartNode *pBoxSttNd = pBox->GetSttNd();
666  if( pBoxSttNd )
667  {
668  SwFrameFormat *pFrameFormat2 = pBox->GetFrameFormat();
669  if( rExpCells.AddCell( *pFrameFormat2, rNamePrefix, nOldCol, nLine,
670  bTop) )
671  ExportFormat( *pFrameFormat2, XML_TABLE_CELL );
672 
673  Reference < XCell > xCell = SwXCell::CreateXCell(
674  const_cast<SwFrameFormat *>(rTableInfo.GetTableFormat()),
675  pBox,
676  const_cast<SwTable *>(rTableInfo.GetTable()) );
677  if (xCell.is())
678  {
679  Reference < XText > xText( xCell, UNO_QUERY );
680  if( !rTableInfo.IsBaseSectionValid() )
681  {
682  Reference<XPropertySet> xCellPropertySet( xCell,
683  UNO_QUERY );
684  Any aAny = xCellPropertySet->getPropertyValue("TextSection");
685  Reference < XTextSection > xTextSection;
686  aAny >>= xTextSection;
687  rTableInfo.SetBaseSection( xTextSection );
688  }
689 
690  const bool bExportContent = bool(getExportFlags() & SvXMLExportFlags::CONTENT );
691  if ( !bExportContent )
692  {
693  // AUTOSTYLES - not needed anymore if we are currently exporting content.xml
694  GetTextParagraphExport()->collectTextAutoStyles(
695  xText, rTableInfo.GetBaseSection(), IsShowProgress() );
696  }
697  }
698  else {
699  OSL_FAIL("here should be a XCell");
700  }
701  }
702  else
703  {
705  nAbsWidth, nBaseWidth,
706  lcl_xmltble_appendBoxPrefix( rNamePrefix,
707  nOldCol, nLine, bTop ),
708  rExpCols, rExpRows, rExpCells,
709  rTableInfo );
710  }
711 
712  nCol++;
713  }
714  }
715 }
716 
718 {
719  const SwTable& rTable = rTableNd.GetTable();
720  const SwFrameFormat *pTableFormat = rTable.GetFrameFormat();
721 
722  if( !pTableFormat )
723  return;
724 
725  sal_Int16 eTabHoriOri = pTableFormat->GetHoriOrient().GetHoriOrient();
726  const SwFormatFrameSize& rFrameSize = pTableFormat->GetFrameSize();
727 
728  sal_uInt32 nAbsWidth = rFrameSize.GetSize().Width();
729  sal_uInt32 nBaseWidth = 0;
730  sal_Int8 nPrcWidth = rFrameSize.GetWidthPercent();
731 
732  bool bFixAbsWidth = nPrcWidth != 0 || /*text::*/HoriOrientation::NONE == eTabHoriOri
733  || /*text::*/HoriOrientation::FULL == eTabHoriOri;
734  if( bFixAbsWidth )
735  {
736  nBaseWidth = nAbsWidth;
737  nAbsWidth = pTableFormat->FindLayoutRect(true).Width();
738  if( !nAbsWidth )
739  {
740  // TODO?
741  }
742  }
743  ExportTableFormat( *pTableFormat, nAbsWidth );
744 
748  SwXMLTableInfo_Impl aTableInfo( &rTable, XML_NAMESPACE_TABLE );
749  ExportTableLinesAutoStyles( rTable.GetTabLines(), nAbsWidth, nBaseWidth,
750  pTableFormat->GetName(), aExpCols, aExpRows, aExpCells,
751  aTableInfo, true);
752 
753 }
754 
756  sal_uInt32 nColSpan,
757  sal_uInt32 nRowSpan,
758  SwXMLTableInfo_Impl& rTableInfo )
759 {
760  const SwStartNode *pBoxSttNd = rBox.GetSttNd();
761  if( pBoxSttNd )
762  {
763  const SwFrameFormat *pFrameFormat = rBox.GetFrameFormat();
764  if( pFrameFormat )
765  {
766  const OUString& sName = pFrameFormat->GetName();
767  if( !sName.isEmpty() )
768  {
769  AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(sName) );
770  }
771  }
772  }
773 
774  if( nRowSpan != 1 )
775  {
776  AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED,
777  OUString::number(nRowSpan) );
778  }
779 
780  if( nColSpan != 1 )
781  {
782  AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED,
783  OUString::number(nColSpan) );
784  }
785 
786  {
787  if( pBoxSttNd )
788  {
789  // start node -> normal cell
790  // get cell range for table
791  Reference<XCell> xCell = SwXCell::CreateXCell( const_cast<SwFrameFormat *>(rTableInfo.GetTableFormat()),
792  const_cast<SwTableBox *>(&rBox),
793  const_cast<SwTable *>(rTableInfo.GetTable()) );
794 
795  if (xCell.is())
796  {
797  Reference<XText> xText( xCell, UNO_QUERY );
798 
799  // get formula (and protection)
800  const OUString sCellFormula = xCell->getFormula();
801 
802  // if this cell has a formula, export it
803  // (with value and number format)
804  if (!sCellFormula.isEmpty())
805  {
806  const OUString sQValue =
808  XML_NAMESPACE_OOOW, sCellFormula, false );
809  // formula
810  AddAttribute(XML_NAMESPACE_TABLE, XML_FORMULA, sQValue );
811  }
812 
813  // value and format (if NumberFormat != -1)
814  Reference<XPropertySet> xCellPropertySet(xCell,
815  UNO_QUERY);
816  if (xCellPropertySet.is())
817  {
818  sal_Int32 nNumberFormat = 0;
819  Any aAny = xCellPropertySet->getPropertyValue("NumberFormat");
820  aAny >>= nNumberFormat;
821 
822  if (static_cast<sal_Int32>(getSwDefaultTextFormat()) == nNumberFormat)
823  {
824  // text format
825  AddAttribute( XML_NAMESPACE_OFFICE,
827  }
828  else if ( (-1 != nNumberFormat) && !xText->getString().isEmpty() )
829  {
830  // number format key:
831  // (export values only if cell contains text;)
834  *this, nNumberFormat, xCell->getValue() );
835  }
836  // else: invalid key; ignore
837 
838  // cell protection
839  aAny = xCellPropertySet->getPropertyValue("IsProtected");
840  if (*o3tl::doAccess<bool>(aAny))
841  {
842  AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED,
843  XML_TRUE );
844  }
845 
846  if( !rTableInfo.IsBaseSectionValid() )
847  {
848  aAny = xCellPropertySet->getPropertyValue("TextSection");
849  Reference < XTextSection > xTextSection;
850  aAny >>= xTextSection;
851  rTableInfo.SetBaseSection( xTextSection );
852  }
853  }
854 
855  // export cell element
856  SvXMLElementExport aElem( *this, rTableInfo.GetPrefix(),
857  XML_TABLE_CELL, true, true );
858 
859  // export cell content
860  GetTextParagraphExport()->exportText( xText,
861  rTableInfo.GetBaseSection(),
862  IsShowProgress() );
863  }
864  else
865  {
866  OSL_FAIL("here should be a XCell");
867  ClearAttrList();
868  }
869  }
870  else
871  {
872  // no start node -> merged cells: export subtable in cell
873  SvXMLElementExport aElem( *this, XML_NAMESPACE_TABLE,
874  XML_TABLE_CELL, true, true );
875  {
876  AddAttribute( XML_NAMESPACE_TABLE, XML_IS_SUB_TABLE,
877  GetXMLToken( XML_TRUE ) );
878 
879  SvXMLElementExport aElemExport( *this, XML_NAMESPACE_TABLE,
880  XML_TABLE, true, true );
881  ExportTableLines( rBox.GetTabLines(), rTableInfo );
882  }
883  }
884  }
885 }
886 
888  const SwXMLTableLines_Impl& rLines,
889  SwXMLTableInfo_Impl& rTableInfo )
890 {
891  if( rLine.hasSoftPageBreak() )
892  {
893  SvXMLElementExport aElem( *this, XML_NAMESPACE_TEXT,
894  XML_SOFT_PAGE_BREAK, true, true );
895  }
896  const SwFrameFormat *pFrameFormat = rLine.GetFrameFormat();
897  if( pFrameFormat )
898  {
899  const OUString& sName = pFrameFormat->GetName();
900  if( !sName.isEmpty() )
901  {
902  AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(sName) );
903  }
904  }
905 
906  {
907  SvXMLElementExport aElem( *this, rTableInfo.GetPrefix(), XML_TABLE_ROW, true, true );
908  const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
909  const size_t nBoxes = rBoxes.size();
910 
911  sal_uInt32 nCPos = 0U;
912  size_t nCol = 0U;
913  for( size_t nBox=0U; nBox<nBoxes; ++nBox )
914  {
915  const SwTableBox *pBox = rBoxes[nBox];
916 
917  // NEW TABLES
918  const long nRowSpan = pBox->getRowSpan();
919  if( nRowSpan < 1 )
920  {
921  SvXMLElementExport aElem2( *this, rTableInfo.GetPrefix(),
923  false );
924  }
925 
926  if( nBox < nBoxes-1U )
927  nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox );
928  else
929  nCPos = rLines.GetWidth();
930 
931  // and their index
932  const size_t nOldCol = nCol;
933  SwXMLTableColumn_Impl aCol( nCPos );
935  OSL_ENSURE( it != rLines.GetColumns().end(), "couldn't find column" );
936  nCol = it - rLines.GetColumns().begin();
937 
938  // #i95726# - Some fault tolerance, if table is somehow corrupted.
939  if ( nCol < nOldCol )
940  {
941  OSL_FAIL( "table and/or table information seems to be corrupted." );
942  // NOTE: nOldCol is not necessarily a valid index into
943  // GetColumns(), but that doesn't matter here
944  nCol = nOldCol;
945  }
946 
947  const sal_uInt32 nColSpan = nCol - nOldCol + 1U;
948 
949  if ( nRowSpan >= 1 )
950  ExportTableBox( *pBox, nColSpan, static_cast< sal_uInt32 >(nRowSpan), rTableInfo );
951 
952  for( size_t i=nOldCol; i<nCol; ++i )
953  {
954  SvXMLElementExport aElemExport( *this, rTableInfo.GetPrefix(),
956  false );
957  }
958 
959  nCol++;
960  }
961  }
962 }
963 
965  SwXMLTableInfo_Impl& rTableInfo,
966  sal_uInt32 nHeaderRows )
967 {
968  OSL_ENSURE( m_pTableLines && !m_pTableLines->empty(),
969  "SwXMLExport::ExportTableLines: table columns infos missing" );
970  if( !m_pTableLines || m_pTableLines->empty() )
971  return;
972 
973  SwXMLTableLines_Impl* pLines = nullptr;
974  size_t nInfoPos;
975  for( nInfoPos=0; nInfoPos < m_pTableLines->size(); nInfoPos++ )
976  {
977  if( m_pTableLines->at( nInfoPos )->GetLines() == &rLines )
978  {
979  pLines = m_pTableLines->at( nInfoPos );
980  break;
981  }
982  }
983  OSL_ENSURE( pLines,
984  "SwXMLExport::ExportTableLines: table columns info missing" );
985  OSL_ENSURE( 0==nInfoPos,
986  "SwXMLExport::ExportTableLines: table columns infos are unsorted" );
987  if( !pLines )
988  return;
989 
990  SwXMLTableLinesCache_Impl::iterator it = m_pTableLines->begin();
991  advance( it, nInfoPos );
992  m_pTableLines->erase( it );
993 
994  if( m_pTableLines->empty() )
995  m_pTableLines.reset();
996 
997  // pass 2: export columns
998  const SwXMLTableColumns_Impl& rCols = pLines->GetColumns();
999  size_t nColumn = 0U;
1000  const size_t nColumns = rCols.size();
1001  sal_Int32 nColRep = 1;
1002  SwXMLTableColumn_Impl *pColumn = (nColumns > 0) ? rCols.front().get() : nullptr;
1003  while( pColumn )
1004  {
1005  nColumn++;
1006  SwXMLTableColumn_Impl *pNextColumn =
1007  (nColumn < nColumns) ? rCols[nColumn].get() : nullptr;
1008  if( pNextColumn &&
1009  pNextColumn->GetStyleName() == pColumn->GetStyleName() )
1010  {
1011  nColRep++;
1012  }
1013  else
1014  {
1015  AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME,
1016  EncodeStyleName(pColumn->GetStyleName()) );
1017 
1018  if( nColRep > 1 )
1019  {
1020  AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
1021  OUString::number(nColRep) );
1022  }
1023 
1024  {
1025  SvXMLElementExport aElem( *this, rTableInfo.GetPrefix(), XML_TABLE_COLUMN, true, true );
1026  }
1027 
1028  nColRep = 1;
1029  }
1030  pColumn = pNextColumn;
1031  }
1032 
1033  // pass 3: export line/rows
1034  const size_t nLines = rLines.size();
1035  // export header rows, if present
1036  if( nHeaderRows > 0 )
1037  {
1038  SvXMLElementExport aElem( *this, XML_NAMESPACE_TABLE,
1039  XML_TABLE_HEADER_ROWS, true, true );
1040 
1041  OSL_ENSURE( nHeaderRows <= nLines, "more headers then lines?" );
1042  for( size_t nLine = 0U; nLine < nHeaderRows; ++nLine )
1043  ExportTableLine( *(rLines[nLine]), *pLines, rTableInfo );
1044  }
1045  // export remaining rows
1046  for( size_t nLine = nHeaderRows; nLine < nLines; ++nLine )
1047  {
1048  ExportTableLine( *(rLines[nLine]), *pLines, rTableInfo );
1049  }
1050 
1051  delete pLines;
1052 }
1053 
1054 static void lcl_xmltble_ClearName_Line( SwTableLine* pLine );
1055 
1057 {
1058  if( !pBox->GetSttNd() )
1059  {
1060  for( SwTableLine* pLine : pBox->GetTabLines() )
1061  lcl_xmltble_ClearName_Line( pLine );
1062  }
1063  else
1064  {
1065  SwFrameFormat *pFrameFormat = pBox->GetFrameFormat();
1066  if( pFrameFormat && !pFrameFormat->GetName().isEmpty() )
1067  pFrameFormat->SetName( OUString() );
1068  }
1069 }
1070 
1072 {
1073  for( SwTableBox* pBox : pLine->GetTabBoxes() )
1074  lcl_xmltble_ClearName_Box( pBox );
1075 }
1076 
1077 void SwXMLExport::ExportTable( const SwTableNode& rTableNd )
1078 {
1079  const SwTable& rTable = rTableNd.GetTable();
1080  const SwFrameFormat *pTableFormat = rTable.GetFrameFormat();
1081  if( pTableFormat && !pTableFormat->GetName().isEmpty() )
1082  {
1083  AddAttribute( XML_NAMESPACE_TABLE, XML_NAME, pTableFormat->GetName() );
1084  AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME,
1085  EncodeStyleName( pTableFormat->GetName() ) );
1086  }
1087 
1088  // table:template-name=
1089  if (!rTable.GetTableStyleName().isEmpty())
1090  AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, rTable.GetTableStyleName());
1091 
1092  sal_uInt16 nPrefix = XML_NAMESPACE_TABLE;
1093  if (const SwFrameFormat* pFlyFormat = rTableNd.GetFlyFormat())
1094  {
1095  if (SwTextBoxHelper::isTextBox(pFlyFormat, RES_FLYFRMFMT))
1096  nPrefix = XML_NAMESPACE_LO_EXT;
1097  }
1098 
1099  {
1100  SvXMLElementExport aElem( *this, nPrefix, XML_TABLE, true, true );
1101 
1102  // export DDE source (if this is a DDE table)
1103  if ( dynamic_cast<const SwDDETable*>( &rTable) != nullptr )
1104  {
1105  // get DDE Field Type (contains the DDE connection)
1106  const SwDDEFieldType* pDDEFieldType =
1107  static_cast<const SwDDETable&>(rTable).GetDDEFieldType();
1108 
1109  // connection name
1110  AddAttribute( XML_NAMESPACE_OFFICE, XML_NAME,
1111  pDDEFieldType->GetName() );
1112 
1113  // DDE command
1114  const OUString& sCmd = pDDEFieldType->GetCmd();
1115  sal_Int32 nIdx{ 0 };
1116  AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION,
1117  sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
1118  AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_ITEM,
1119  sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
1120  AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_TOPIC,
1121  sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
1122 
1123  // auto update
1124  if (pDDEFieldType->GetType() == SfxLinkUpdateMode::ALWAYS)
1125  {
1126  AddAttribute( XML_NAMESPACE_OFFICE,
1128  }
1129 
1130  // DDE source element (always empty)
1131  SvXMLElementExport aSource(*this, XML_NAMESPACE_OFFICE,
1132  XML_DDE_SOURCE, true, false);
1133  }
1134 
1135  SwXMLTableInfo_Impl aTableInfo( &rTable, nPrefix );
1136  ExportTableLines( rTable.GetTabLines(), aTableInfo, rTable.GetRowsToRepeat() );
1137 
1138  for( SwTableLine *pLine : const_cast<SwTable &>(rTable).GetTabLines() )
1139  lcl_xmltble_ClearName_Line( pLine );
1140  }
1141 }
1142 
1144  const Reference < XTextContent > & rTextContent,
1145  bool bAutoStyles, bool _bProgress )
1146 {
1147  bool bOldShowProgress = static_cast<SwXMLExport&>(GetExport()).IsShowProgress();
1148  static_cast<SwXMLExport&>(GetExport()).SetShowProgress( _bProgress );
1149 
1150  Reference < XTextTable > xTextTable( rTextContent, UNO_QUERY );
1151  OSL_ENSURE( xTextTable.is(), "text table missing" );
1152  if( xTextTable.is() )
1153  {
1154  SwXTextTable *pXTable = nullptr;
1155  Reference<XUnoTunnel> xTableTunnel( rTextContent, UNO_QUERY);
1156  if( xTableTunnel.is() )
1157  {
1158  pXTable = reinterpret_cast< SwXTextTable * >(
1159  sal::static_int_cast< sal_IntPtr >( xTableTunnel->getSomething( SwXTextTable::getUnoTunnelId() )));
1160  OSL_ENSURE( pXTable, "SwXTextTable missing" );
1161  }
1162  if( pXTable )
1163  {
1164  SwFrameFormat *const pFormat = pXTable->GetFrameFormat();
1165  OSL_ENSURE( pFormat, "table format missing" );
1166  const SwTable *pTable = SwTable::FindTable( pFormat );
1167  OSL_ENSURE( pTable, "table missing" );
1168  const SwTableNode *pTableNd = pTable->GetTableNode();
1169  OSL_ENSURE( pTableNd, "table node missing" );
1170  if( bAutoStyles )
1171  {
1172  SwNodeIndex aIdx( *pTableNd );
1173  // AUTOSTYLES: Optimization: Do not export table autostyle if
1174  // we are currently exporting the content.xml stuff and
1175  // the table is located in header/footer:
1176  // During the flat XML export (used e.g. by .sdw-export)
1177  // ALL flags are set at the same time.
1178  const bool bExportStyles = bool( GetExport().getExportFlags() & SvXMLExportFlags::STYLES );
1179  if ( bExportStyles || !pFormat->GetDoc()->IsInHeaderFooter( aIdx ) )
1180  static_cast<SwXMLExport&>(GetExport()).ExportTableAutoStyles( *pTableNd );
1181  }
1182  else
1183  {
1184  static_cast<SwXMLExport&>(GetExport()).ExportTable( *pTableNd );
1185  }
1186  }
1187  }
1188 
1189  static_cast<SwXMLExport&>(GetExport()).SetShowProgress( bOldShowProgress );
1190 }
1191 
1193 {
1194  if ( m_pTableLines )
1195  {
1197  delete p;
1198  m_pTableLines->clear();
1199  m_pTableLines.reset();
1200  }
1201 }
1202 
1203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GetValue() const
long Width() const
Starts a section of nodes in the document model.
Definition: node.hxx:303
#define RES_FRM_SIZE
Definition: hintids.hxx:196
XML_DISPLAY_NAME
XML_NUMBER_ROWS_SPANNED
XML_VALUE_TYPE
XML_STYLE_NAME
void ExportTableAutoStyles(const SwTableNode &rTableNd)
Definition: xmltble.cxx:717
XML_STRING
bool AddCell(SwFrameFormat &rFrameFormat, const OUString &rNamePrefix, sal_uInt32 nCol, sal_uInt32 nRow, bool bTop)
Definition: xmltble.cxx:304
signed char sal_Int8
XML_NAME
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
void CheckAttrList()
#define RES_FRAMEDIR
Definition: hintids.hxx:227
std::vector< SwXMLTableLines_Impl * > SwXMLTableLinesCache_Impl
Definition: xmlexp.hxx:44
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: atrfrm.cxx:2647
const sal_Unicode cTokenSeparator
const Reference< XTextSection > & GetBaseSection() const
Definition: xmltble.cxx:495
SfxLinkUpdateMode GetType() const
Definition: ddefld.hxx:83
sal_uInt32 GetRelWidth() const
Definition: xmltble.cxx:84
void SetRelWidth(sal_uInt32 nSet)
Definition: xmltble.cxx:83
XML_SOFT_PAGE_BREAK
Reference< XTextSection > m_xBaseSection
Definition: xmltble.cxx:483
SwXMLTableColumn_Impl(sal_uInt32 nPosition)
Definition: xmltble.cxx:75
static sal_uInt32 GetBoxWidth(const SwTableBox *pBox)
Definition: wrtswtbl.cxx:85
const_iterator find(const Value &x) const
SwTableLine is one table row in the document model.
Definition: swtable.hxx:344
sal_uInt32 nWidth
Definition: xmltble.cxx:107
sal_uInt16 GetRowsToRepeat() const
Definition: swtable.hxx:193
XML_TABLE_COLUMN_PROPERTIES
const SwTable * GetTable() const
Definition: xmltble.cxx:491
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
#define RES_UNKNOWNATR_CONTAINER
Definition: hintids.hxx:269
bool IsInHeaderFooter(const SwNodeIndex &rIdx) const
Definition: doclay.cxx:1542
sal_uInt32 GetWidthOpt() const
Definition: wrtswtbl.hxx:184
size_type size() const
Definition: swtable.hxx:74
SvXMLExport & GetExport()
void AddAttribute(sal_uInt16 nPrefix, const sal_Char *pName, const OUString &rValue)
const Value & front() const
XML_IS_SUB_TABLE
XML_TEMPLATE_NAME
OUString const & GetCmd() const
Definition: ddefld.cxx:229
void sw_GetTableBoxColStr(sal_uInt16 nCol, OUString &rNm)
Definition: swtable.cxx:1786
XML_STYLE
XML_TABLE_CELL
XML_TABLE
XML_NUMBER_COLUMNS_REPEATED
const OUString & GetName() const
Definition: format.hxx:111
XML_PROTECTED
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2454
const SwTable & GetTable() const
Definition: node.hxx:497
const OUString & GetTableStyleName() const
Return the table style name of this table.
Definition: swtable.hxx:188
XML_NUMBER_COLUMNS_SPANNED
void SetWidthOpt(sal_uInt32 nWidth, bool bRel)
Definition: wrtswtbl.hxx:180
size_type size() const
void DeleteTableLines()
Definition: xmltble.cxx:1192
static SwXCell * CreateXCell(SwFrameFormat *pTableFormat, SwTableBox *pBox, SwTable *pTable=nullptr)
Definition: unotbl.cxx:1184
#define RES_ROW_SPLIT
Definition: hintids.hxx:229
void ExportFormat(const SwFormat &rFormat, enum::xmloff::token::XMLTokenEnum eClass)
Definition: xmlfmte.cxx:49
#define RES_BACKGROUND
Definition: hintids.hxx:212
#define RES_FLYFRMFMT
Definition: hintids.hxx:276
static OUString lcl_xmltble_appendBoxPrefix(const OUString &rNamePrefix, sal_uInt32 nCol, sal_uInt32 nRow, bool bTop)
Definition: xmltble.cxx:290
bool IsBaseSectionValid() const
Definition: xmltble.cxx:494
static SwTable * FindTable(SwFrameFormat const *const pFormat)
Definition: swtable.cxx:1920
Style of a layout element.
Definition: frmfmt.hxx:57
bool IsShowProgress() const
Definition: xmlexp.hxx:126
XML_TABLE_ROW
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
XML_DDE_SOURCE
static void lcl_xmltble_ClearName_Line(SwTableLine *pLine)
Definition: xmltble.cxx:1071
XML_DDE_APPLICATION
sal_uInt32 nRelWidth
Definition: xmltble.cxx:71
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
#define RES_VERT_ORIENT
Definition: hintids.hxx:209
const SwFrameFormat * GetTableFormat() const
Definition: xmltble.cxx:492
SwXMLTableLines_Impl(const SwTableLines &rLines)
Definition: xmltble.cxx:119
vector< SwFrameFormat * > SwXMLFrameFormats_Impl
Definition: xmltble.cxx:176
OUString sName
void ExportTableColumnStyle(const SwXMLTableColumn_Impl &rCol)
Definition: xmltble.cxx:515
int i
sal_uInt32 const m_nPrefix
Definition: xmltble.cxx:485
bool hasSoftPageBreak() const
const SvXMLUnitConverter & GetTwipUnitConverter() const
Definition: xmlexp.hxx:137
SwXMLFrameFormats_Impl aFormatList
Definition: xmltble.cxx:181
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
SwXMLTableInfo_Impl(const SwTable *pTable, sal_uInt16 nPrefix)
Definition: xmltble.cxx:501
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:366
Marks a node in the document model.
Definition: ndindex.hxx:31
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:425
void ExportTableLines(const SwTableLines &rLines, SwXMLTableInfo_Impl &rTableInfo, sal_uInt32 nHeaderRows=0)
Definition: xmltble.cxx:964
void ExportTableFormat(const SwFrameFormat &rFormat, sal_uInt32 nAbsWidth)
Definition: xmliteme.cxx:218
const_iterator end() const
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
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
void SetBaseSection(const Reference< XTextSection > &rBase)
Definition: xmltble.cxx:508
const SwTableLines * GetLines() const
Definition: xmltble.cxx:114
virtual void exportTable(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress) override
Definition: xmltble.cxx:1143
SwTableLines & GetTabLines()
Definition: swtable.hxx:198
const SvXMLNamespaceMap & GetNamespaceMap() const
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:110
XML_REL_COLUMN_WIDTH
XML_COVERED_TABLE_CELL
const SwXMLTableColumns_Impl & GetColumns() const
Definition: xmltble.cxx:116
SwTableLines & GetTabLines()
Definition: swtable.hxx:418
const_iterator begin() const
const SwTable * m_pTable
Definition: xmltble.cxx:482
sal_uInt16 GetPrefix() const
The namespace (table or loext) that should be used for the elements.
Definition: xmltble.cxx:498
XML_COLUMN_WIDTH
bool operator()(SwXMLTableColumn_Impl *const &lhs, SwXMLTableColumn_Impl *const &rhs) const
Definition: xmltble.cxx:89
OUString EncodeStyleName(const OUString &rName, bool *pEncoded=nullptr) const
void ClearAttrList()
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:354
void ExportTable(const SwTableNode &rTableNd)
Definition: xmltble.cxx:1077
void ExportTableLine(const SwTableLine &rLine, const SwXMLTableLines_Impl &rLines, SwXMLTableInfo_Impl &rTableInfo)
Definition: xmltble.cxx:887
std::vector< SwTableBox * > SwTableBoxes
Definition: swtable.hxx:103
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:439
long getRowSpan() const
Definition: swtable.cxx:102
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
void Width(long nNew)
Definition: swrect.hxx:185
const SwTableLines * pLines
Definition: xmltble.cxx:106
XML_DDE_TOPIC
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
const OUString & GetStyleName() const
Definition: xmltble.cxx:81
XML_DDE_ITEM
XML_TABLE_COLUMN
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
SwXMLTableColumns_Impl aCols
Definition: xmltble.cxx:105
XML_TRUE
sal_uInt32 GetWidth() const
Definition: xmltble.cxx:113
sal_uInt32 GetValue() const
#define RES_BOX
Definition: hintids.hxx:213
bool AddRow(SwFrameFormat &rFrameFormat, const OUString &rNamePrefix, sal_uInt32 nLine)
Definition: xmltble.cxx:188
static void lcl_xmltble_ClearName_Box(SwTableBox *pBox)
Definition: xmltble.cxx:1056
void ExportTableBox(const SwTableBox &rBox, sal_uInt32 nColSpan, sal_uInt32 nRowSpan, SwXMLTableInfo_Impl &rTableInfo)
Definition: xmltble.cxx:755
XML_FAMILY
void ExportTableLinesAutoStyles(const SwTableLines &rLines, sal_uInt32 nAbsWidth, sal_uInt32 nBaseWidth, const OUString &rNamePrefix, SwXMLTableColumnsSortByWidth_Impl &rExpCols, SwXMLTableFrameFormatsSort_Impl &rExpRows, SwXMLTableFrameFormatsSort_Impl &rExpCells, SwXMLTableInfo_Impl &rTableInfo, bool bTop=false)
Definition: xmltble.cxx:557
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
std::pair< const_iterator, bool > insert(Value &&x)
void SetStyleName(const OUString &rName)
Definition: xmltble.cxx:80
XML_TABLE_HEADER_ROWS
XML_AUTOMATIC_UPDATE
long GetHeight() const
virtual OUString GetName() const override
Only in derived classes.
Definition: ddefld.cxx:213
static SW_DLLPUBLIC const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotbl.cxx:2023
SvXMLExportFlags getExportFlags() const
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:708
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
constexpr sal_uInt32 getSwDefaultTextFormat()
The number formatter's default locale's @ Text format.
Definition: cellatr.hxx:34
const Size & GetSize() const
#define RES_BOXATR_FORMAT
Definition: hintids.hxx:263
std::vector< SwXMLTableColumn_Impl * >::const_iterator const_iterator
void SetNumberFormatAttributes(const sal_Int32 nNumberFormat, const double &rValue, bool bExportValue=true, sal_uInt16 nNamespace=XML_NAMESPACE_OFFICE, bool bExportCurrencySymbol=true)
sal_uInt32 GetPos() const
Definition: wrtswtbl.hxx:171
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
std::unique_ptr< SwXMLTableLinesCache_Impl > m_pTableLines
Definition: xmlexp.hxx:52
SwTableNode * GetTableNode() const
Definition: swtable.cxx:1927
XML_FORMULA
SW_DLLPUBLIC SwFrameFormat * GetFrameFormat()
Definition: unotbl.cxx:2066