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