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 const SvxPrintItem *pHasTextChangesOnly = rItemSet.GetItemIfSet( RES_PRINT, false);
338
339 // empty styles have not to be exported
340 if( !pVertOrient && !pBrush && !pBox && !pNumFormat && !pFrameDir && !pAttCnt &&
341 !pHasTextChangesOnly )
342 {
343 m_rFormatMap.try_emplace(&rFrameFormat); // empty just to enable assert
344 return {};
345 }
346
347 // order is: -/-/-/num,
348 // -/-/box/-, -/-/box/num,
349 // -/brush/-/-, -/brush/-/num, -/brush/box/-, -/brush/box/num,
350 // vert/-/-/-, vert/-/-/num, vert/-/box/-, ver/-/box/num,
351 // vert/brush/-/-, vert/brush/-/num, vert/brush/box/-,
352 // vert/brush/box/num
353 SwXMLFrameFormats_Impl::iterator i;
354 for( i = m_aFormatList.begin(); i < m_aFormatList.end(); ++i )
355 {
356 const SwFormatVertOrient *pTestVertOrient = nullptr;
357 const SvxBrushItem *pTestBrush = nullptr;
358 const SvxBoxItem *pTestBox = nullptr;
359 const SwTableBoxNumFormat *pTestNumFormat = nullptr;
360 const SvxFrameDirectionItem *pTestFrameDir = nullptr;
361 const SvXMLAttrContainerItem *pTestAttCnt = nullptr;
362 const SvxPrintItem *pTestHasTextChangesOnly = rItemSet.GetItemIfSet( RES_PRINT, false);
363 const SwFrameFormat* pTestFormat = *i;
364 const SfxItemSet& rTestSet = pTestFormat->GetAttrSet();
365 if( const SwFormatVertOrient* pItem = rTestSet.GetItemIfSet( RES_VERT_ORIENT, false ) )
366 {
367 if( !pVertOrient )
368 break;
369
370 pTestVertOrient = pItem;
371 }
372 else
373 {
374 if( pVertOrient )
375 continue;
376 }
377
378 if( const SvxBrushItem* pItem = rTestSet.GetItemIfSet( RES_BACKGROUND, false ) )
379 {
380 if( !pBrush )
381 break;
382
383 pTestBrush = pItem;
384 }
385 else
386 {
387 if( pBrush )
388 continue;
389 }
390
391 if( const SvxBoxItem* pItem = rTestSet.GetItemIfSet( RES_BOX, false ) )
392 {
393 if( !pBox )
394 break;
395
396 pTestBox = pItem;
397 }
398 else
399 {
400 if( pBox )
401 continue;
402 }
403
404 if ( const SwTableBoxNumFormat* pItem = rTestSet.GetItemIfSet( RES_BOXATR_FORMAT,
405 false ) )
406 {
407 if( !pNumFormat )
408 break;
409
410 pTestNumFormat = pItem;
411 }
412 else
413 {
414 if( pNumFormat )
415 continue;
416
417 }
418
419 if ( const SvxFrameDirectionItem* pItem = rTestSet.GetItemIfSet( RES_FRAMEDIR,
420 false ) )
421 {
422 if( !pFrameDir )
423 break;
424
425 pTestFrameDir = pItem;
426 }
427 else
428 {
429 if( pFrameDir )
430 continue;
431
432 }
433
435 false ) )
436 {
437 if( !pAttCnt )
438 break;
439
440 pTestAttCnt = pItem;
441 }
442 else
443 {
444 if ( pAttCnt )
445 continue;
446
447 }
448
449 if( const SvxPrintItem* pItem = rTestSet.GetItemIfSet( RES_PRINT, false ) )
450 {
451 if( !pHasTextChangesOnly )
452 break;
453
454 pTestHasTextChangesOnly = pItem;
455 }
456 else
457 {
458 if( pHasTextChangesOnly )
459 continue;
460 }
461
462 if( pVertOrient &&
463 pVertOrient->GetVertOrient() != pTestVertOrient->GetVertOrient() )
464 continue;
465
466 if( pBrush && ( *pBrush != *pTestBrush ) )
467 continue;
468
469 if( pBox && ( *pBox != *pTestBox ) )
470 continue;
471
472 if( pNumFormat && pNumFormat->GetValue() != pTestNumFormat->GetValue() )
473 continue;
474
475 if( pFrameDir && pFrameDir->GetValue() != pTestFrameDir->GetValue() )
476 continue;
477
478 if( pAttCnt && ( *pAttCnt != *pTestAttCnt ) )
479 continue;
480
481 if( pHasTextChangesOnly && (!pHasTextChangesOnly->GetValue() != !pTestHasTextChangesOnly->GetValue()) )
482 continue;
483
484 // found!
485 auto const oName(m_rFormatMap.find(pTestFormat)->second);
486 assert(oName);
487 m_rFormatMap.try_emplace(&rFrameFormat, oName);
488 return {};
489 }
490
491 {
492 OUString const name(lcl_xmltble_appendBoxPrefix(rNamePrefix, nCol, nRow, bTop));
493 m_rFormatMap.try_emplace(&rFrameFormat, name);
494 if ( i != m_aFormatList.end() ) ++i;
495 m_aFormatList.insert( i, &rFrameFormat );
496 return ::std::optional<OUString>(name);
497 }
498}
499
501{
503 Reference<XTextSection> m_xBaseSection;
505 sal_uInt32 m_nPrefix;
508
509public:
510
511 inline SwXMLTableInfo_Impl( const SwTable *pTable, sal_uInt16 nPrefix,
512 SwXMLTextParagraphExport::FormatMap const& rLineFormats,
513 SwXMLTextParagraphExport::FormatMap const& rBoxFormats)
514 : m_pTable(pTable)
515 , m_bBaseSectionValid(false)
516 , m_nPrefix(nPrefix)
517 , m_rLineFormats(rLineFormats)
518 , m_rBoxFormats(rBoxFormats)
519 {
520 }
521
522 const SwTable *GetTable() const { return m_pTable; }
524
526 const Reference<XTextSection>& GetBaseSection() const { return m_xBaseSection; }
527 inline void SetBaseSection( const Reference < XTextSection >& rBase );
529 sal_uInt16 GetPrefix() const { return m_nPrefix; }
532};
533
535 const Reference < XTextSection >& rBaseSection )
536{
537 m_xBaseSection = rBaseSection;
538 m_bBaseSectionValid = true;
539}
540
542{
543 // <style:style ...>
545
546 // style:name="..."
547 bool bEncoded = false;
549 EncodeStyleName( rCol.GetStyleName(), &bEncoded ) );
550 if( bEncoded )
552
553 // style:family="table-column"
555
556 {
558 true );
559 if( rCol.GetWidthOpt() )
560 {
561 OUStringBuffer sValue;
563 rCol.GetWidthOpt() );
565 sValue.makeStringAndClear() );
566 }
567 if( rCol.GetRelWidth() )
568 {
569 OUString sValue = OUString::number(static_cast<sal_Int32>(rCol.GetRelWidth()) ) + "*";
571 sValue );
572 }
573
574 {
575 SvXMLElementExport aElemExport( *this, XML_NAMESPACE_STYLE,
577 true, true );
578 }
579 }
580}
581
583 sal_uInt32 nAbsWidth, sal_uInt32 nBaseWidth,
584 std::u16string_view rNamePrefix,
588 SwXMLTableInfo_Impl& rTableInfo,
589 bool bTop )
590{
591 // pass 1: calculate columns
592 SwXMLTableLines_Impl *pLines = new SwXMLTableLines_Impl( rLines );
593 if( !m_pTableLines )
595
596 m_pTableLines->push_back( pLines );
597
598 // pass 2: export column styles
599 {
600 const SwXMLTableColumns_Impl& rCols = pLines->GetColumns();
601 sal_uInt32 nCPos = 0U;
602 const size_t nColumns = rCols.size();
603 for( size_t nColumn=0U; nColumn<nColumns; ++nColumn )
604 {
605 SwXMLTableColumn_Impl *pColumn = rCols[nColumn].get();
606
607 sal_uInt32 nOldCPos = nCPos;
608 nCPos = pColumn->GetPos();
609
610 sal_uInt32 nWidth = nCPos - nOldCPos;
611
612 // If a base width is given, the table has either an automatic
613 // or margin alignment, or a percentage width. In either case,
614 // relative widths should be exported.
615 if( nBaseWidth )
616 {
617 pColumn->SetRelWidth( nWidth );
618 }
619
620 // If an absolute width is given, the table either has a fixed
621 // width, or the current width is known from the layout. In the
622 // later case, a base width is set in addition and must be used
623 // to "absolutize" the relative column width.
624 if( nAbsWidth )
625 {
626 sal_uInt32 nColAbsWidth = nWidth;
627 if( nBaseWidth )
628 {
629 nColAbsWidth *= nAbsWidth;
630 nColAbsWidth += (nBaseWidth/2UL);
631 nColAbsWidth /= nBaseWidth;
632 }
633 pColumn->SetWidthOpt( nColAbsWidth, false );
634 }
635
637 if( it != rExpCols.end() )
638 {
639 pColumn->SetStyleName( (*it)->GetStyleName() );
640 }
641 else
642 {
643 if( bTop )
644 {
645 OUString sTmp;
646 sw_GetTableBoxColStr( nColumn, sTmp );
647 pColumn->SetStyleName( OUString::Concat(rNamePrefix) + "." + sTmp );
648 }
649 else
650 {
651 pColumn->SetStyleName(
652 OUString::Concat(rNamePrefix) + "." + OUString::number(nColumn + 1U) );
653 }
654 ExportTableColumnStyle( *pColumn );
655 rExpCols.insert( pColumn );
656 }
657 }
658 }
659
660 // pass 3: export line/rows
661 const size_t nLines = rLines.size();
662 for( size_t nLine=0U; nLine<nLines; ++nLine )
663 {
664 SwTableLine *pLine = rLines[nLine];
665
666 SwFrameFormat *pFrameFormat = pLine->GetFrameFormat();
667 if (auto oNew = rExpRows.AddRow(*pFrameFormat, rNamePrefix, nLine))
668 {
669 ExportFormat(*pFrameFormat, XML_TABLE_ROW, std::move(oNew));
670 }
671
672 const SwTableBoxes& rBoxes = pLine->GetTabBoxes();
673 const size_t nBoxes = rBoxes.size();
674
675 sal_uInt32 nCPos = 0U;
676 size_t nCol = 0U;
677 for( size_t nBox=0U; nBox<nBoxes; nBox++ )
678 {
679 SwTableBox *pBox = rBoxes[nBox];
680
681 if( nBox < nBoxes-1U )
682 nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox );
683 else
684 nCPos = pLines->GetWidth();
685
686 // and their index
687 const size_t nOldCol = nCol;
688 SwXMLTableColumn_Impl aCol( nCPos );
689 SwXMLTableColumns_Impl::const_iterator it = pLines->GetColumns().find( &aCol );
690 OSL_ENSURE( it != pLines->GetColumns().end(), "couldn't find column" );
691 nCol = it - pLines->GetColumns().begin();
692
693 const SwStartNode *pBoxSttNd = pBox->GetSttNd();
694 if( pBoxSttNd )
695 {
696 SwFrameFormat *pFrameFormat2 = pBox->GetFrameFormat();
697 if (auto oNew = rExpCells.AddCell(*pFrameFormat2, rNamePrefix, nOldCol, nLine,
698 bTop) )
699 {
700 ExportFormat(*pFrameFormat2, XML_TABLE_CELL, std::move(oNew));
701 }
702
703 Reference < XCell > xCell = SwXCell::CreateXCell(
704 const_cast<SwFrameFormat *>(rTableInfo.GetTableFormat()),
705 pBox,
706 const_cast<SwTable *>(rTableInfo.GetTable()) );
707 if (xCell.is())
708 {
709 Reference < XText > xText( xCell, UNO_QUERY );
710 if( !rTableInfo.IsBaseSectionValid() )
711 {
712 Reference<XPropertySet> xCellPropertySet( xCell,
713 UNO_QUERY );
714 Any aAny = xCellPropertySet->getPropertyValue("TextSection");
715 Reference < XTextSection > xTextSection;
716 aAny >>= xTextSection;
717 rTableInfo.SetBaseSection( xTextSection );
718 }
719
720 const bool bExportContent = bool(getExportFlags() & SvXMLExportFlags::CONTENT );
721 if ( !bExportContent )
722 {
723 // AUTOSTYLES - not needed anymore if we are currently exporting content.xml
724 GetTextParagraphExport()->collectTextAutoStyles(
725 xText, rTableInfo.GetBaseSection(), IsShowProgress() );
726 }
727 }
728 else {
729 OSL_FAIL("here should be a XCell");
730 }
731 }
732 else
733 {
735 nAbsWidth, nBaseWidth,
736 lcl_xmltble_appendBoxPrefix( rNamePrefix,
737 nOldCol, nLine, bTop ),
738 rExpCols, rExpRows, rExpCells,
739 rTableInfo );
740 }
741
742 nCol++;
743 }
744 }
745}
746
748{
749 auto & rFormats(static_cast<SwXMLTextParagraphExport *>(GetTextParagraphExport().get())->GetTableFormats());
750 auto const it(rFormats.find(&rTableNd));
751 assert(it != rFormats.end());
752 SwXMLTextParagraphExport::FormatMap & rRowFormats(it->second.first);
753 SwXMLTextParagraphExport::FormatMap & rBoxFormats(it->second.second);
754 const SwTable& rTable = rTableNd.GetTable();
755 const SwFrameFormat *pTableFormat = rTable.GetFrameFormat();
756
757 if( !pTableFormat )
758 return;
759
760 sal_Int16 eTabHoriOri = pTableFormat->GetHoriOrient().GetHoriOrient();
761 const SwFormatFrameSize& rFrameSize = pTableFormat->GetFrameSize();
762
763 sal_uInt32 nAbsWidth = rFrameSize.GetSize().Width();
764 sal_uInt32 nBaseWidth = 0;
765 sal_Int8 nPercentWidth = rFrameSize.GetWidthPercent();
766
767 bool bFixAbsWidth = nPercentWidth != 0 || /*text::*/HoriOrientation::NONE == eTabHoriOri
768 || /*text::*/HoriOrientation::FULL == eTabHoriOri;
769 if( bFixAbsWidth )
770 {
771 nBaseWidth = nAbsWidth;
772 nAbsWidth = pTableFormat->FindLayoutRect(true).Width();
773 if( !nAbsWidth )
774 {
775 // TODO?
776 }
777 }
778 ExportTableFormat( *pTableFormat, nAbsWidth );
779
781 SwXMLTableFrameFormatsSort_Impl aExpRows(rRowFormats);
782 SwXMLTableFrameFormatsSort_Impl aExpCells(rBoxFormats);
783 SwXMLTableInfo_Impl aTableInfo(&rTable, XML_NAMESPACE_TABLE, rRowFormats, rBoxFormats);
784 ExportTableLinesAutoStyles( rTable.GetTabLines(), nAbsWidth, nBaseWidth,
785 pTableFormat->GetName(), aExpCols, aExpRows, aExpCells,
786 aTableInfo, true);
787
788}
789
791 sal_uInt32 nColSpan,
792 sal_uInt32 nRowSpan,
793 SwXMLTableInfo_Impl& rTableInfo )
794{
795 const SwStartNode *pBoxSttNd = rBox.GetSttNd();
796 if( pBoxSttNd )
797 {
798 const SwFrameFormat *pFrameFormat = rBox.GetFrameFormat();
799 if( pFrameFormat )
800 {
801 auto const it(rTableInfo.GetBoxFormats().find(pFrameFormat));
802 assert(it != rTableInfo.GetBoxFormats().end());
803 if (it->second)
804 {
805 assert(!it->second->isEmpty());
807 }
808 }
809 }
810
811 if( nRowSpan != 1 )
812 {
814 OUString::number(nRowSpan) );
815 }
816
817 if( nColSpan != 1 )
818 {
820 OUString::number(nColSpan) );
821 }
822
823 {
824 if( pBoxSttNd )
825 {
826 // start node -> normal cell
827 // get cell range for table
828 Reference<XCell> xCell = SwXCell::CreateXCell( const_cast<SwFrameFormat *>(rTableInfo.GetTableFormat()),
829 const_cast<SwTableBox *>(&rBox),
830 const_cast<SwTable *>(rTableInfo.GetTable()) );
831
832 if (xCell.is())
833 {
834 Reference<XText> xText( xCell, UNO_QUERY );
835
836 // get formula (and protection)
837 const OUString sCellFormula = xCell->getFormula();
838
839 // if this cell has a formula, export it
840 // (with value and number format)
841 if (!sCellFormula.isEmpty())
842 {
843 const OUString sQValue =
845 XML_NAMESPACE_OOOW, sCellFormula, false );
846 // formula
848 }
849
850 // value and format (if NumberFormat != -1)
851 Reference<XPropertySet> xCellPropertySet(xCell,
852 UNO_QUERY);
853 if (xCellPropertySet.is())
854 {
855 sal_Int32 nNumberFormat = 0;
856 Any aAny = xCellPropertySet->getPropertyValue("NumberFormat");
857 aAny >>= nNumberFormat;
858
859 if (static_cast<sal_Int32>(getSwDefaultTextFormat()) == nNumberFormat)
860 {
861 // text format
864 }
865 else if ( (-1 != nNumberFormat) && !xText->getString().isEmpty() )
866 {
867 // number format key:
868 // (export values only if cell contains text;)
871 *this, nNumberFormat, xCell->getValue() );
872 }
873 // else: invalid key; ignore
874
875 // cell protection
876 aAny = xCellPropertySet->getPropertyValue("IsProtected");
877 if (*o3tl::doAccess<bool>(aAny))
878 {
880 XML_TRUE );
881 }
882
883 if( !rTableInfo.IsBaseSectionValid() )
884 {
885 aAny = xCellPropertySet->getPropertyValue("TextSection");
886 Reference < XTextSection > xTextSection;
887 aAny >>= xTextSection;
888 rTableInfo.SetBaseSection( xTextSection );
889 }
890 }
891
892 // export cell element
893 SvXMLElementExport aElem( *this, rTableInfo.GetPrefix(),
894 XML_TABLE_CELL, true, true );
895
896 // export cell content
897 GetTextParagraphExport()->exportText( xText,
898 rTableInfo.GetBaseSection(),
899 IsShowProgress() );
900 }
901 else
902 {
903 OSL_FAIL("here should be a XCell");
905 }
906 }
907 else
908 {
909 // no start node -> merged cells: export subtable in cell
911 XML_TABLE_CELL, true, true );
912 {
915
916 SvXMLElementExport aElemExport( *this, XML_NAMESPACE_TABLE,
917 XML_TABLE, true, true );
918 ExportTableLines( rBox.GetTabLines(), rTableInfo );
919 }
920 }
921 }
922}
923
925 const SwXMLTableLines_Impl& rLines,
926 SwXMLTableInfo_Impl& rTableInfo )
927{
928 if( rLine.hasSoftPageBreak() )
929 {
931 XML_SOFT_PAGE_BREAK, true, true );
932 }
933 const SwFrameFormat *pFrameFormat = rLine.GetFrameFormat();
934 if( pFrameFormat )
935 {
936 auto const it(rTableInfo.GetLineFormats().find(pFrameFormat));
937 assert(it != rTableInfo.GetLineFormats().end());
938 if (it->second)
939 {
940 assert(!it->second->isEmpty());
942 }
943 }
944
945 {
946 SvXMLElementExport aElem( *this, rTableInfo.GetPrefix(), XML_TABLE_ROW, true, true );
947 const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
948 const size_t nBoxes = rBoxes.size();
949
950 sal_uInt32 nCPos = 0U;
951 size_t nCol = 0U;
952 for( size_t nBox=0U; nBox<nBoxes; ++nBox )
953 {
954 const SwTableBox *pBox = rBoxes[nBox];
955
956 // NEW TABLES
957 const sal_Int32 nRowSpan = pBox->getRowSpan();
958 if( nRowSpan < 1 )
959 {
960 // Export style of covered cell, it includes border information.
961 const SwFrameFormat* pFormat = pBox->GetFrameFormat();
962 if (pFormat)
963 {
964 auto const it(rTableInfo.GetBoxFormats().find(pFormat));
965 assert(it != rTableInfo.GetBoxFormats().end());
966 if (it->second)
967 {
968 assert(!it->second->isEmpty());
970 }
971 }
972
973 SvXMLElementExport aElem2( *this, rTableInfo.GetPrefix(),
975 false );
976 }
977
978 if( nBox < nBoxes-1U )
979 nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox );
980 else
981 nCPos = rLines.GetWidth();
982
983 // and their index
984 const size_t nOldCol = nCol;
985 SwXMLTableColumn_Impl aCol( nCPos );
986 SwXMLTableColumns_Impl::const_iterator it = rLines.GetColumns().find( &aCol );
987 OSL_ENSURE( it != rLines.GetColumns().end(), "couldn't find column" );
988 nCol = it - rLines.GetColumns().begin();
989
990 // #i95726# - Some fault tolerance, if table is somehow corrupted.
991 if ( nCol < nOldCol )
992 {
993 OSL_FAIL( "table and/or table information seems to be corrupted." );
994 // NOTE: nOldCol is not necessarily a valid index into
995 // GetColumns(), but that doesn't matter here
996 nCol = nOldCol;
997 }
998
999 const sal_uInt32 nColSpan = nCol - nOldCol + 1U;
1000
1001 if ( nRowSpan >= 1 )
1002 ExportTableBox( *pBox, nColSpan, static_cast< sal_uInt32 >(nRowSpan), rTableInfo );
1003
1004 for( size_t i=nOldCol; i<nCol; ++i )
1005 {
1006 SvXMLElementExport aElemExport( *this, rTableInfo.GetPrefix(),
1008 false );
1009 }
1010
1011 nCol++;
1012 }
1013 }
1014}
1015
1017 SwXMLTableInfo_Impl& rTableInfo,
1018 sal_uInt32 nHeaderRows )
1019{
1020 OSL_ENSURE( m_pTableLines && !m_pTableLines->empty(),
1021 "SwXMLExport::ExportTableLines: table columns infos missing" );
1022 if( !m_pTableLines || m_pTableLines->empty() )
1023 return;
1024
1025 SwXMLTableLines_Impl* pLines = nullptr;
1026 size_t nInfoPos;
1027 for( nInfoPos=0; nInfoPos < m_pTableLines->size(); nInfoPos++ )
1028 {
1029 if( m_pTableLines->at( nInfoPos )->GetLines() == &rLines )
1030 {
1031 pLines = m_pTableLines->at( nInfoPos );
1032 break;
1033 }
1034 }
1035 OSL_ENSURE( pLines,
1036 "SwXMLExport::ExportTableLines: table columns info missing" );
1037 OSL_ENSURE( 0==nInfoPos,
1038 "SwXMLExport::ExportTableLines: table columns infos are unsorted" );
1039 if( !pLines )
1040 return;
1041
1042 SwXMLTableLinesCache_Impl::iterator it = m_pTableLines->begin();
1043 advance( it, nInfoPos );
1044 m_pTableLines->erase( it );
1045
1046 if( m_pTableLines->empty() )
1047 m_pTableLines.reset();
1048
1049 // pass 2: export columns
1050 const SwXMLTableColumns_Impl& rCols = pLines->GetColumns();
1051 size_t nColumn = 0U;
1052 const size_t nColumns = rCols.size();
1053 sal_Int32 nColRep = 1;
1054 SwXMLTableColumn_Impl *pColumn = (nColumns > 0) ? rCols.front().get() : nullptr;
1055 while( pColumn )
1056 {
1057 nColumn++;
1058 SwXMLTableColumn_Impl *pNextColumn =
1059 (nColumn < nColumns) ? rCols[nColumn].get() : nullptr;
1060 if( pNextColumn &&
1061 pNextColumn->GetStyleName() == pColumn->GetStyleName() )
1062 {
1063 nColRep++;
1064 }
1065 else
1066 {
1068 EncodeStyleName(pColumn->GetStyleName()) );
1069
1070 if( nColRep > 1 )
1071 {
1073 OUString::number(nColRep) );
1074 }
1075
1076 {
1077 SvXMLElementExport aElem( *this, rTableInfo.GetPrefix(), XML_TABLE_COLUMN, true, true );
1078 }
1079
1080 nColRep = 1;
1081 }
1082 pColumn = pNextColumn;
1083 }
1084
1085 // pass 3: export line/rows
1086 const size_t nLines = rLines.size();
1087 // export header rows, if present
1088 if( nHeaderRows > 0 )
1089 {
1091 XML_TABLE_HEADER_ROWS, true, true );
1092
1093 OSL_ENSURE( nHeaderRows <= nLines, "more headers then lines?" );
1094 for( size_t nLine = 0U; nLine < nHeaderRows; ++nLine )
1095 ExportTableLine( *(rLines[nLine]), *pLines, rTableInfo );
1096 }
1097 // export remaining rows
1098 for( size_t nLine = nHeaderRows; nLine < nLines; ++nLine )
1099 {
1100 ExportTableLine( *(rLines[nLine]), *pLines, rTableInfo );
1101 }
1102
1103 delete pLines;
1104}
1105
1107{
1108 ::std::optional<sal_uInt16> oPrefix = XML_NAMESPACE_TABLE;
1109 if (const SwFrameFormat* pFlyFormat = rTableNd.GetFlyFormat())
1110 {
1112 {
1113 // TODO ODF 1.4 OFFICE-3761
1115 {
1116 oPrefix = XML_NAMESPACE_LO_EXT;
1117 }
1118 else
1119 {
1120 oPrefix.reset(); // no export to OASIS namespace yet
1121 }
1122 }
1123 }
1124
1125 if (!oPrefix)
1126 return;
1127
1128 const SwTable& rTable = rTableNd.GetTable();
1129 const SwFrameFormat *pTableFormat = rTable.GetFrameFormat();
1130 if (pTableFormat && !pTableFormat->GetName().isEmpty())
1131 {
1134 EncodeStyleName(pTableFormat->GetName()));
1135 }
1136
1137 // table:template-name=
1138 if (!rTable.GetTableStyleName().isEmpty())
1139 {
1140 OUString sStyleName;
1143 }
1144
1145 SvXMLElementExport aElem(*this, *oPrefix, XML_TABLE, true, true);
1146
1147 // export DDE source (if this is a DDE table)
1148 if ( auto pSwDdeTable = dynamic_cast<const SwDDETable*>( &rTable) )
1149 {
1150 // get DDE Field Type (contains the DDE connection)
1151 const SwDDEFieldType* pDDEFieldType = pSwDdeTable->GetDDEFieldType();
1152
1153 // connection name
1155 pDDEFieldType->GetName() );
1156
1157 // DDE command
1158 const OUString& sCmd = pDDEFieldType->GetCmd();
1159 sal_Int32 nIdx{ 0 };
1161 sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
1163 sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
1165 sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
1166
1167 // auto update
1168 if (pDDEFieldType->GetType() == SfxLinkUpdateMode::ALWAYS)
1169 {
1172 }
1173
1174 // DDE source element (always empty)
1176 XML_DDE_SOURCE, true, false);
1177 }
1178
1179 auto const& rFormats(static_cast<SwXMLTextParagraphExport const*>(GetTextParagraphExport().get())->GetTableFormats());
1180 auto const it(rFormats.find(&rTableNd));
1181 assert(it != rFormats.end());
1182 SwXMLTableInfo_Impl aTableInfo(&rTable, *oPrefix, it->second.first, it->second.second);
1183 ExportTableLines( rTable.GetTabLines(), aTableInfo, rTable.GetRowsToRepeat() );
1184}
1185
1187 // note: maTableNodes is used here only to keep the iteration order as before
1188 for (const auto* pTableNode : maTableNodes)
1189 {
1190 static_cast<SwXMLExport&>(GetExport()).ExportTableAutoStyles(*pTableNode);
1191 }
1192}
1193
1195 SwFrameFormat& rFormat, bool _bProgress)
1196{
1197 // Follow SwXMLExport::ExportTableLines/ExportTableLine/ExportTableBox
1198 for (const SwTableLine* pLine : rLines)
1199 {
1200 for (SwTableBox* pBox : pLine->GetTabBoxes())
1201 {
1202 if (pBox->getRowSpan() <= 0)
1203 continue;
1204 if (pBox->GetSttNd())
1205 {
1206 if (rtl::Reference<SwXCell> xCell = SwXCell::CreateXCell(&rFormat, pBox))
1207 exportText(xCell, true /*bAutoStyles*/, _bProgress, true /*bExportParagraph*/);
1208 }
1209 else
1210 {
1211 // no start node -> merged cells: export subtable in cell
1212 CollectTableLinesAutoStyles(pBox->GetTabLines(), rFormat, _bProgress);
1213 }
1214 }
1215 }
1216}
1217
1219 const Reference < XTextContent > & rTextContent,
1220 bool bAutoStyles, bool _bProgress )
1221{
1222 bool bOldShowProgress = static_cast<SwXMLExport&>(GetExport()).IsShowProgress();
1223 static_cast<SwXMLExport&>(GetExport()).SetShowProgress( _bProgress );
1224
1225 Reference < XTextTable > xTextTable( rTextContent, UNO_QUERY );
1226 OSL_ENSURE( xTextTable.is(), "text table missing" );
1227 if( xTextTable.is() )
1228 {
1229 SwXTextTable* pXTable = dynamic_cast<SwXTextTable*>(rTextContent.get());
1230 if( pXTable )
1231 {
1232 SwFrameFormat *const pFormat = pXTable->GetFrameFormat();
1233 OSL_ENSURE( pFormat, "table format missing" );
1234 const SwTable *pTable = SwTable::FindTable( pFormat );
1235 OSL_ENSURE( pTable, "table missing" );
1236 const SwTableNode *pTableNd = pTable->GetTableNode();
1237 OSL_ENSURE( pTableNd, "table node missing" );
1238 if( bAutoStyles )
1239 {
1240 // AUTOSTYLES: Optimization: Do not export table autostyle if
1241 // we are currently exporting the content.xml stuff and
1242 // the table is located in header/footer:
1243 // During the flat XML export (used e.g. by .sdw-export)
1244 // ALL flags are set at the same time.
1245 const bool bExportStyles = bool( GetExport().getExportFlags() & SvXMLExportFlags::STYLES );
1247 && (bExportStyles || !pFormat->GetDoc()->IsInHeaderFooter(*pTableNd)))
1248 {
1249 maTableNodes.push_back(pTableNd);
1250 m_TableFormats.try_emplace(pTableNd);
1251 // Collect all tables inside cells of this table, too
1252 CollectTableLinesAutoStyles(pTable->GetTabLines(), *pFormat, _bProgress);
1253 }
1254 }
1255 else
1256 {
1257 static_cast<SwXMLExport&>(GetExport()).ExportTable( *pTableNd );
1258 }
1259 }
1260 }
1261
1262 static_cast<SwXMLExport&>(GetExport()).SetShowProgress( bOldShowProgress );
1263}
1264
1266{
1267 if ( m_pTableLines )
1268 {
1270 delete p;
1271 m_pTableLines->clear();
1272 m_pTableLines.reset();
1273 }
1274}
1275
1276/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr sal_uInt32 getSwDefaultTextFormat()
The number formatter's default locale's @ Text format.
Definition: cellatr.hxx:37
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:194
SfxLinkUpdateMode GetType() const
Definition: ddefld.hxx:82
virtual OUString GetName() const override
Only in derived classes.
Definition: ddefld.cxx:178
bool IsInHeaderFooter(const SwNode &) const
Definition: doclay.cxx:1582
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:94
Controls if a table row is allowed to split or not.
Definition: fmtrowsplt.hxx:32
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:57
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:115
Style of a layout element.
Definition: frmfmt.hxx:72
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: atrfrm.cxx:2749
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:738
void Width(tools::Long nNew)
Definition: swrect.hxx:189
Starts a section of nodes in the document model.
Definition: node.hxx:348
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:443
sal_Int32 getRowSpan() const
Definition: swtable.hxx:540
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:481
SwTableLines & GetTabLines()
Definition: swtable.hxx:474
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:495
SwTableLine is one table row in the document model.
Definition: swtable.hxx:376
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:398
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:386
bool hasSoftPageBreak() const
size_type size() const
Definition: swtable.hxx:76
const SwTable & GetTable() const
Definition: node.hxx:542
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
SwTableNode * GetTableNode() const
Definition: swtable.cxx:2315
const OUString & GetTableStyleName() const
Return the table style name of this table.
Definition: swtable.hxx:196
SwTableLines & GetTabLines()
Definition: swtable.hxx:206
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:209
static SwTable * FindTable(SwFrameFormat const *const pFormat)
Definition: swtable.cxx:2308
sal_uInt16 GetRowsToRepeat() const
Definition: swtable.hxx:201
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:1111
std::unique_ptr< SwXMLTableLinesCache_Impl > m_pTableLines
Definition: xmlexp.hxx:55
void ExportTableAutoStyles(const SwTableNode &rTableNd)
Definition: xmltble.cxx:747
const SvXMLUnitConverter & GetTwipUnitConverter() const
Definition: xmlexp.hxx:140
void ExportTableFormat(const SwFrameFormat &rFormat, sal_uInt32 nAbsWidth)
Definition: xmliteme.cxx:239
void ExportTableColumnStyle(const SwXMLTableColumn_Impl &rCol)
Definition: xmltble.cxx:541
void ExportTableBox(const SwTableBox &rBox, sal_uInt32 nColSpan, sal_uInt32 nRowSpan, SwXMLTableInfo_Impl &rTableInfo)
Definition: xmltble.cxx:790
bool IsShowProgress() const
Definition: xmlexp.hxx:133
void ExportTable(const SwTableNode &rTableNd)
Definition: xmltble.cxx:1106
void ExportFormat(const SwFormat &rFormat, enum ::xmloff::token::XMLTokenEnum eClass, ::std::optional< OUString > const oStyleName)
Definition: xmlfmte.cxx:59
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:582
void DeleteTableLines()
Definition: xmltble.cxx:1265
void ExportTableLines(const SwTableLines &rLines, SwXMLTableInfo_Impl &rTableInfo, sal_uInt32 nHeaderRows=0)
Definition: xmltble.cxx:1016
void ExportTableLine(const SwTableLine &rLine, const SwXMLTableLines_Impl &rLines, SwXMLTableInfo_Impl &rTableInfo)
Definition: xmltble.cxx:924
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:502
sal_uInt16 GetPrefix() const
The namespace (table or loext) that should be used for the elements.
Definition: xmltble.cxx:529
bool IsBaseSectionValid() const
Definition: xmltble.cxx:525
void SetBaseSection(const Reference< XTextSection > &rBase)
Definition: xmltble.cxx:534
SwXMLTextParagraphExport::FormatMap const & m_rLineFormats
Definition: xmltble.cxx:506
sal_uInt32 m_nPrefix
Definition: xmltble.cxx:505
const SwTable * GetTable() const
Definition: xmltble.cxx:522
const Reference< XTextSection > & GetBaseSection() const
Definition: xmltble.cxx:526
SwXMLTextParagraphExport::FormatMap const & m_rBoxFormats
Definition: xmltble.cxx:507
SwXMLTextParagraphExport::FormatMap const & GetBoxFormats() const
Definition: xmltble.cxx:531
const SwFrameFormat * GetTableFormat() const
Definition: xmltble.cxx:523
SwXMLTextParagraphExport::FormatMap const & GetLineFormats() const
Definition: xmltble.cxx:530
Reference< XTextSection > m_xBaseSection
Definition: xmltble.cxx:503
SwXMLTableInfo_Impl(const SwTable *pTable, sal_uInt16 nPrefix, SwXMLTextParagraphExport::FormatMap const &rLineFormats, SwXMLTextParagraphExport::FormatMap const &rBoxFormats)
Definition: xmltble.cxx:511
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:1194
::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:1218
virtual void exportTableAutoStyles() override
Definition: xmltble.cxx:1186
SwFrameFormat * GetFrameFormat()
Definition: unotbl.cxx:1968
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(126)
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(128)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(104)
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:2146
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