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