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