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