LibreOffice Module sw (master)  1
htmltabw.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 <hintids.hxx>
21 #include <vcl/svapp.hxx>
22 #include <svtools/htmlout.hxx>
23 #include <svtools/htmltokn.h>
24 #include <svtools/htmlkywd.hxx>
25 #include <svtools/HtmlWriter.hxx>
26 #include <editeng/ulspitem.hxx>
27 #include <editeng/lrspitem.hxx>
28 #include <editeng/brushitem.hxx>
29 #include <editeng/boxitem.hxx>
30 #include <fmtornt.hxx>
31 #include <frmfmt.hxx>
32 #include <fmtfsize.hxx>
33 #include <fmtsrnd.hxx>
34 #include <frmatr.hxx>
35 #include <doc.hxx>
37 #include <pam.hxx>
38 #include <ndtxt.hxx>
39 #include <swrect.hxx>
40 #include <cellatr.hxx>
41 #include <poolfmt.hxx>
42 #include <swtable.hxx>
43 #include <htmltbl.hxx>
44 #include "htmlnum.hxx"
45 #include "wrthtml.hxx"
46 #include <wrtswtbl.hxx>
47 #ifdef DBG_UTIL
48 #include <viewsh.hxx>
49 #include <viewopt.hxx>
50 #endif
51 #include <rtl/strbuf.hxx>
52 #include <sal/types.h>
53 #include <osl/diagnose.h>
54 
55 #define MAX_DEPTH (3)
56 
57 using namespace ::com::sun::star;
58 
59 namespace {
60 
61 class SwHTMLWrtTable : public SwWriteTable
62 {
63  static void Pixelize( sal_uInt16& rValue );
64  void PixelizeBorders();
65 
66  void OutTableCell( SwHTMLWriter& rWrt, const SwWriteTableCell *pCell,
67  bool bOutVAlign ) const;
68 
69  void OutTableCells( SwHTMLWriter& rWrt,
70  const SwWriteTableCells& rCells,
71  const SvxBrushItem *pBrushItem ) const;
72 
73  virtual bool ShouldExpandSub( const SwTableBox *pBox,
74  bool bExpandedBefore, sal_uInt16 nDepth ) const override;
75 
76  static bool HasTabBackground( const SwTableLine& rLine,
77  bool bTop, bool bBottom, bool bLeft, bool bRight );
78  static bool HasTabBackground( const SwTableBox& rBox,
79  bool bTop, bool bBottom, bool bLeft, bool bRight );
80 
81 public:
82  SwHTMLWrtTable( const SwTableLines& rLines, tools::Long nWidth, sal_uInt32 nBWidth,
83  bool bRel, sal_uInt16 nLeftSub, sal_uInt16 nRightSub,
84  sal_uInt16 nNumOfRowsToRepeat );
85  explicit SwHTMLWrtTable( const SwHTMLTableLayout *pLayoutInfo );
86 
87  void Write( SwHTMLWriter& rWrt, sal_Int16 eAlign=text::HoriOrientation::NONE,
88  bool bTHead=false, const SwFrameFormat *pFrameFormat=nullptr,
89  const OUString *pCaption=nullptr, bool bTopCaption=false,
90  sal_uInt16 nHSpace=0, sal_uInt16 nVSpace=0 ) const;
91 };
92 
93 }
94 
95 SwHTMLWrtTable::SwHTMLWrtTable( const SwTableLines& rLines, tools::Long nWidth,
96  sal_uInt32 nBWidth, bool bRel,
97  sal_uInt16 nLSub, sal_uInt16 nRSub,
98  sal_uInt16 nNumOfRowsToRepeat )
99  : SwWriteTable(nullptr, rLines, nWidth, nBWidth, bRel, MAX_DEPTH, nLSub, nRSub, nNumOfRowsToRepeat)
100 {
101  PixelizeBorders();
102 }
103 
104 SwHTMLWrtTable::SwHTMLWrtTable( const SwHTMLTableLayout *pLayoutInfo )
105  : SwWriteTable(nullptr, pLayoutInfo)
106 {
107  // Adjust some Twip values to pixel limits
108  if( m_bCollectBorderWidth )
109  PixelizeBorders();
110 }
111 
112 void SwHTMLWrtTable::Pixelize( sal_uInt16& rValue )
113 {
114  if( rValue && Application::GetDefaultDevice() )
115  {
116  Size aSz( rValue, 0 );
117  aSz = Application::GetDefaultDevice()->LogicToPixel( aSz, MapMode(MapUnit::MapTwip) );
118  if( !aSz.Width() )
119  aSz.setWidth( 1 );
120  aSz = Application::GetDefaultDevice()->PixelToLogic( aSz, MapMode(MapUnit::MapTwip) );
121  rValue = static_cast<sal_uInt16>(aSz.Width());
122  }
123 }
124 
125 void SwHTMLWrtTable::PixelizeBorders()
126 {
127  Pixelize( m_nBorder );
128  Pixelize( m_nCellSpacing );
129  Pixelize( m_nCellPadding );
130 }
131 
132 bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox,
133  bool bTop, bool bBottom, bool bLeft, bool bRight )
134 {
135  OSL_ENSURE( bTop || bBottom || bLeft || bRight,
136  "HasTabBackground: cannot be called" );
137 
138  bool bRet = false;
139  if( rBox.GetSttNd() )
140  {
141  std::unique_ptr<SvxBrushItem> aBrushItem =
143 
146  bRet = aBrushItem && (aBrushItem->GetColor() != COL_TRANSPARENT ||
147  !aBrushItem->GetGraphicLink().isEmpty() || aBrushItem->GetGraphic());
148  }
149  else
150  {
151  const SwTableLines& rLines = rBox.GetTabLines();
152  const SwTableLines::size_type nCount = rLines.size();
153  bool bLeftRight = bLeft || bRight;
154  for( SwTableLines::size_type i=0; !bRet && i<nCount; ++i )
155  {
156  bool bT = bTop && 0 == i;
157  bool bB = bBottom && nCount-1 == i;
158  if( bT || bB || bLeftRight )
159  bRet = HasTabBackground( *rLines[i], bT, bB, bLeft, bRight);
160  }
161  }
162 
163  return bRet;
164 }
165 
166 bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine,
167  bool bTop, bool bBottom, bool bLeft, bool bRight )
168 {
169  OSL_ENSURE( bTop || bBottom || bLeft || bRight,
170  "HasTabBackground: cannot be called" );
171 
172  std::unique_ptr<SvxBrushItem> aBrushItem = rLine.GetFrameFormat()->makeBackgroundBrushItem();
175  bool bRet = aBrushItem && (aBrushItem->GetColor() != COL_TRANSPARENT ||
176  !aBrushItem->GetGraphicLink().isEmpty() || aBrushItem->GetGraphic());
177 
178  if( !bRet )
179  {
180  const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
181  const SwTableBoxes::size_type nCount = rBoxes.size();
182  bool bTopBottom = bTop || bBottom;
183  for( SwTableBoxes::size_type i=0; !bRet && i<nCount; ++i )
184  {
185  bool bL = bLeft && 0 == i;
186  bool bR = bRight && nCount-1 == i;
187  if( bTopBottom || bL || bR )
188  bRet = HasTabBackground( *rBoxes[i], bTop, bBottom, bL, bR );
189  }
190  }
191 
192  return bRet;
193 }
194 
195 static bool lcl_TableLine_HasTabBorders( const SwTableLine* pLine, bool *pBorders );
196 
197 static bool lcl_TableBox_HasTabBorders( const SwTableBox* pBox, bool *pBorders )
198 {
199  if( *pBorders )
200  return false;
201 
202  if( !pBox->GetSttNd() )
203  {
204  for( const auto& rpLine : pBox->GetTabLines() )
205  {
206  if ( lcl_TableLine_HasTabBorders( rpLine, pBorders ) )
207  break;
208  }
209  }
210  else
211  {
212  const SvxBoxItem& rBoxItem =
214 
215  *pBorders = rBoxItem.GetTop() || rBoxItem.GetBottom() ||
216  rBoxItem.GetLeft() || rBoxItem.GetRight();
217  }
218 
219  return !*pBorders;
220 }
221 
222 static bool lcl_TableLine_HasTabBorders( const SwTableLine* pLine, bool *pBorders )
223 {
224  if( *pBorders )
225  return false;
226 
227  for( const auto& rpBox : pLine->GetTabBoxes() )
228  {
229  if ( lcl_TableBox_HasTabBorders( rpBox, pBorders ) )
230  break;
231  }
232  return !*pBorders;
233 }
234 
235 bool SwHTMLWrtTable::ShouldExpandSub( const SwTableBox *pBox,
236  bool bExpandedBefore,
237  sal_uInt16 nDepth ) const
238 {
239  bool bExpand = !pBox->GetSttNd() && nDepth>0;
240  if( bExpand && bExpandedBefore )
241  {
242  // MIB 30.6.97: If a box was already expanded, another one is only
243  // expanded when it has a border.
244  bool bBorders = false;
245  lcl_TableBox_HasTabBorders( pBox, &bBorders );
246  if( !bBorders )
247  bBorders = HasTabBackground( *pBox, true, true, true, true );
248  bExpand = bBorders;
249  }
250 
251  return bExpand;
252 }
253 
254 // Write a box as single cell
255 void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt,
256  const SwWriteTableCell *pCell,
257  bool bOutVAlign ) const
258 {
259  const SwTableBox *pBox = pCell->GetBox();
260  sal_uInt16 nRow = pCell->GetRow();
261  sal_uInt16 nCol = pCell->GetCol();
262  sal_uInt16 nRowSpan = pCell->GetRowSpan();
263  sal_uInt16 nColSpan = pCell->GetColSpan();
264 
265  if ( !nRowSpan )
266  return;
267 
268  const SwStartNode* pSttNd = pBox->GetSttNd();
269  bool bHead = false;
270  if( pSttNd )
271  {
272  sal_uLong nNdPos = pSttNd->GetIndex()+1;
273 
274  // determine the type of cell (TD/TH)
275  SwNode* pNd;
276  while( !( pNd = rWrt.m_pDoc->GetNodes()[nNdPos])->IsEndNode() )
277  {
278  if( pNd->IsTextNode() )
279  {
280  // The only paragraphs relevant for the distinction are those
281  // where the style is one of the two table related styles
282  // or inherits from one of these.
283  const SwFormat *pFormat = &static_cast<SwTextNode*>(pNd)->GetAnyFormatColl();
284  sal_uInt16 nPoolId = pFormat->GetPoolFormatId();
285  while( !pFormat->IsDefault() &&
286  RES_POOLCOLL_TABLE_HDLN!=nPoolId &&
287  RES_POOLCOLL_TABLE!=nPoolId )
288  {
289  pFormat = pFormat->DerivedFrom();
290  nPoolId = pFormat->GetPoolFormatId();
291  }
292 
293  if( !pFormat->IsDefault() )
294  {
295  bHead = (RES_POOLCOLL_TABLE_HDLN==nPoolId);
296  break;
297  }
298  }
299  nNdPos++;
300  }
301  }
302 
303  rWrt.OutNewLine(); // <TH>/<TD> in new line
304  OStringBuffer sOut;
305  sOut.append('<');
306  OString aTag(bHead ? OOO_STRING_SVTOOLS_HTML_tableheader : OOO_STRING_SVTOOLS_HTML_tabledata);
307  sOut.append(rWrt.GetNamespace() + aTag);
308 
309  // output ROW- and COLSPAN
310  if( nRowSpan>1 )
311  {
312  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_rowspan).
313  append("=\"").append(static_cast<sal_Int32>(nRowSpan)).append("\"");
314  }
315  if( nColSpan > 1 )
316  {
317  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_colspan).
318  append("=\"").append(static_cast<sal_Int32>(nColSpan)).append("\"");
319  }
320 
321  tools::Long nWidth = 0;
322  bool bOutWidth = true;
323  sal_uInt32 nPercentWidth = SAL_MAX_UINT32;
324 
325  if( m_bLayoutExport )
326  {
327  if( pCell->HasPercentWidthOpt() )
328  {
329  nPercentWidth = pCell->GetWidthOpt();
330  }
331  else
332  {
333  nWidth = pCell->GetWidthOpt();
334  if( !nWidth )
335  bOutWidth = false;
336  }
337  }
338  else
339  {
340  if( HasRelWidths() )
341  nPercentWidth = GetPercentWidth(nCol, nColSpan);
342  else
343  nWidth = GetAbsWidth( nCol, nColSpan );
344  }
345 
346  if (rWrt.mbReqIF)
347  // ReqIF implies strict XHTML: no width for <td>.
348  bOutWidth = false;
349 
350  tools::Long nHeight = pCell->GetHeight() > 0
351  ? GetAbsHeight( pCell->GetHeight(), nRow, nRowSpan )
352  : 0;
353  Size aPixelSz( nWidth, nHeight );
354 
355  // output WIDTH (Argh: only for Netscape)
356  if( (aPixelSz.Width() || aPixelSz.Height()) && Application::GetDefaultDevice() )
357  {
358  Size aOldSz( aPixelSz );
359  aPixelSz = Application::GetDefaultDevice()->LogicToPixel( aPixelSz,
360  MapMode(MapUnit::MapTwip) );
361  if( aOldSz.Width() && !aPixelSz.Width() )
362  aPixelSz.setWidth( 1 );
363  if( aOldSz.Height() && !aPixelSz.Height() )
364  aPixelSz.setHeight( 1 );
365  }
366 
367  // output WIDTH: from layout or calculated
368  if( bOutWidth )
369  {
370  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
371  append("=\"");
372  if( nPercentWidth != SAL_MAX_UINT32 )
373  {
374  sOut.append(static_cast<sal_Int32>(nPercentWidth)).append('%');
375  }
376  else
377  {
378  sOut.append(static_cast<sal_Int32>(aPixelSz.Width()));
379  }
380  sOut.append("\"");
381  }
382 
383  if (rWrt.mbReqIF)
384  {
385  // ReqIF implies strict XHTML: no height for <td>.
386  nHeight = 0;
387  }
388 
389  if( nHeight )
390  {
391  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height)
392  .append("=\"").append(static_cast<sal_Int32>(aPixelSz.Height())).append("\"");
393  }
394 
395  const SfxItemSet& rItemSet = pBox->GetFrameFormat()->GetAttrSet();
396  const SfxPoolItem *pItem;
397 
398  // ALIGN is only outputted at the paragraphs from now on
399 
400  // output VALIGN
401  if( bOutVAlign )
402  {
403  sal_Int16 eVertOri = pCell->GetVertOri();
404  if( text::VertOrientation::TOP==eVertOri || text::VertOrientation::BOTTOM==eVertOri )
405  {
406  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_valign)
407  .append("=\"").append(text::VertOrientation::TOP==eVertOri ?
408  OOO_STRING_SVTOOLS_HTML_VA_top :
409  OOO_STRING_SVTOOLS_HTML_VA_bottom)
410  .append("\"");
411  }
412  }
413 
414  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
415 
416  rWrt.m_bTextAttr = false;
417  rWrt.m_bOutOpts = true;
418  const SvxBrushItem *pBrushItem = nullptr;
419  if( SfxItemState::SET==rItemSet.GetItemState( RES_BACKGROUND, false, &pItem ) )
420  {
421  pBrushItem = static_cast<const SvxBrushItem *>(pItem);
422  }
423  if( !pBrushItem )
424  pBrushItem = pCell->GetBackground();
425 
426  if( pBrushItem )
427  {
428  // output background
429  if (!rWrt.mbReqIF)
430  // Avoid non-CSS version in the ReqIF case.
431  rWrt.OutBackground( pBrushItem, false );
432 
433  if( rWrt.m_bCfgOutStyles )
434  OutCSS1_TableBGStyleOpt( rWrt, *pBrushItem );
435  }
436 
438 
439  sal_uInt32 nNumFormat = 0;
440  double nValue = 0.0;
441  bool bNumFormat = false, bValue = false;
442  if( SfxItemState::SET==rItemSet.GetItemState( RES_BOXATR_FORMAT, false, &pItem ) )
443  {
444  nNumFormat = static_cast<const SwTableBoxNumFormat *>(pItem)->GetValue();
445  bNumFormat = true;
446  }
447  if( SfxItemState::SET==rItemSet.GetItemState( RES_BOXATR_VALUE, false, &pItem ) )
448  {
449  nValue = static_cast<const SwTableBoxValue *>(pItem)->GetValue();
450  bValue = true;
451  if( !bNumFormat )
452  nNumFormat = pBox->GetFrameFormat()->GetTableBoxNumFormat().GetValue();
453  }
454 
455  if( bNumFormat || bValue )
456  {
457  sOut.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValue, nValue,
458  nNumFormat, *rWrt.m_pDoc->GetNumberFormatter(), rWrt.m_eDestEnc,
460  }
461  sOut.append('>');
462  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
463  rWrt.m_bLFPossible = true;
464 
465  rWrt.IncIndentLevel(); // indent the content of <TD>...</TD>
466 
467  if( pSttNd )
468  {
469  HTMLSaveData aSaveData( rWrt, pSttNd->GetIndex()+1,
470  pSttNd->EndOfSectionIndex() );
471  rWrt.Out_SwDoc( rWrt.m_pCurrentPam.get() );
472  }
473  else
474  {
475  sal_uInt16 nTWidth;
476  sal_uInt32 nBWidth;
477  sal_uInt16 nLSub, nRSub;
478  if( HasRelWidths() )
479  {
480  nTWidth = 100;
481  nBWidth = GetRawWidth( nCol, nColSpan );
482  nLSub = 0;
483  nRSub = 0;
484  }
485  else
486  {
487  nTWidth = GetAbsWidth( nCol, nColSpan );
488  nBWidth = nTWidth;
489  nLSub = GetLeftSpace( nCol );
490  nRSub = GetRightSpace( nCol, nColSpan );
491  }
492 
493  SwHTMLWrtTable aTableWrt( pBox->GetTabLines(), nTWidth,
494  nBWidth, HasRelWidths(), nLSub, nRSub, /*nNumOfRowsToRepeat*/0 );
495  aTableWrt.Write( rWrt );
496  }
497 
498  rWrt.DecIndentLevel(); // indent the content of <TD>...</TD>
499 
500  if( rWrt.m_bLFPossible )
501  rWrt.OutNewLine();
503  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag, false);
504  rWrt.m_bLFPossible = true;
505 }
506 
507 // output a line as lines
508 void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt,
509  const SwWriteTableCells& rCells,
510  const SvxBrushItem *pBrushItem ) const
511 {
512  // If the line contains more the one cell and all cells have the same
513  // alignment, then output the VALIGN at the line instead of the cell.
514  sal_Int16 eRowVertOri = text::VertOrientation::NONE;
515  if( rCells.size() > 1 )
516  {
517  for (SwWriteTableCells::size_type nCell = 0; nCell < rCells.size(); ++nCell)
518  {
519  sal_Int16 eCellVertOri = rCells[nCell]->GetVertOri();
520  if( 0==nCell )
521  {
522  eRowVertOri = eCellVertOri;
523  }
524  else if( eRowVertOri != eCellVertOri )
525  {
526  eRowVertOri = text::VertOrientation::NONE;
527  break;
528  }
529  }
530  }
531 
532  rWrt.OutNewLine(); // <TR> in new line
534  if( pBrushItem )
535  {
536  rWrt.OutBackground( pBrushItem, false );
537 
538  rWrt.m_bTextAttr = false;
539  rWrt.m_bOutOpts = true;
540  if( rWrt.m_bCfgOutStyles )
541  OutCSS1_TableBGStyleOpt( rWrt, *pBrushItem );
542  }
543 
544  if( text::VertOrientation::TOP==eRowVertOri || text::VertOrientation::BOTTOM==eRowVertOri )
545  {
546  OStringBuffer sOut;
547  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_valign)
548  .append("=\"").append(text::VertOrientation::TOP==eRowVertOri ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom)
549  .append("\"");
550  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
551  }
552 
553  rWrt.Strm().WriteChar( '>' );
554 
555  rWrt.IncIndentLevel(); // indent content of <TR>...</TR>
556 
557  for (const auto &rpCell : rCells)
558  {
559  OutTableCell(rWrt, rpCell.get(), text::VertOrientation::NONE == eRowVertOri);
560  }
561 
562  rWrt.DecIndentLevel(); // indent content of <TR>...</TR>
563 
564  rWrt.OutNewLine(); // </TR> in new line
566 }
567 
568 void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
569  bool bTHead, const SwFrameFormat *pFrameFormat,
570  const OUString *pCaption, bool bTopCaption,
571  sal_uInt16 nHSpace, sal_uInt16 nVSpace ) const
572 {
573  // determine value of RULES
574  bool bRowsHaveBorder = false;
575  bool bRowsHaveBorderOnly = true;
576  SwWriteTableRow *pRow = m_aRows[0].get();
577  for( SwWriteTableRows::size_type nRow=1; nRow < m_aRows.size(); ++nRow )
578  {
579  SwWriteTableRow *pNextRow = m_aRows[nRow].get();
580  bool bBorder = ( pRow->bBottomBorder || pNextRow->bTopBorder );
581  bRowsHaveBorder |= bBorder;
582  bRowsHaveBorderOnly &= bBorder;
583 
584  sal_uInt16 nBorder2 = pRow->bBottomBorder ? pRow->nBottomBorder : USHRT_MAX;
585  if( pNextRow->bTopBorder && pNextRow->nTopBorder < nBorder2 )
586  nBorder2 = pNextRow->nTopBorder;
587 
588  pRow->bBottomBorder = bBorder;
589  pRow->nBottomBorder = nBorder2;
590 
591  pNextRow->bTopBorder = bBorder;
592  pNextRow->nTopBorder = nBorder2;
593 
594  pRow = pNextRow;
595  }
596 
597  bool bColsHaveBorder = false;
598  bool bColsHaveBorderOnly = true;
599  SwWriteTableCol *pCol = m_aCols[0].get();
600  for( SwWriteTableCols::size_type nCol=1; nCol<m_aCols.size(); ++nCol )
601  {
602  SwWriteTableCol *pNextCol = m_aCols[nCol].get();
603  bool bBorder = ( pCol->bRightBorder || pNextCol->bLeftBorder );
604  bColsHaveBorder |= bBorder;
605  bColsHaveBorderOnly &= bBorder;
606  pCol->bRightBorder = bBorder;
607  pNextCol->bLeftBorder = bBorder;
608  pCol = pNextCol;
609  }
610 
611  // close previous numbering, etc
612  rWrt.ChangeParaToken( HtmlTokenId::NONE );
613 
614  if( rWrt.m_bLFPossible )
615  rWrt.OutNewLine(); // <TABLE> in new line
616  OStringBuffer sOut;
617  sOut.append('<').append(rWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_table);
618 
619  const SvxFrameDirection nOldDirection = rWrt.m_nDirection;
620  if( pFrameFormat )
621  rWrt.m_nDirection = rWrt.GetHTMLDirection( pFrameFormat->GetAttrSet() );
622  if( rWrt.m_bOutFlyFrame || nOldDirection != rWrt.m_nDirection )
623  {
624  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
625  rWrt.OutDirection( rWrt.m_nDirection );
626  }
627 
628  // output ALIGN=
629  if( text::HoriOrientation::RIGHT == eAlign )
630  {
631  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).
632  append("=\"").append(OOO_STRING_SVTOOLS_HTML_AL_right).append("\"");
633  }
634  else if( text::HoriOrientation::CENTER == eAlign )
635  {
636  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).
637  append("=\"").append(OOO_STRING_SVTOOLS_HTML_AL_center).append("\"");
638  }
639  else if( text::HoriOrientation::LEFT == eAlign )
640  {
641  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).
642  append("=\"").append(OOO_STRING_SVTOOLS_HTML_AL_left).append("\"");
643  }
644 
645  // output WIDTH: from layout or calculated
646  if( m_nTabWidth )
647  {
648  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
649  append("=\"");
650  if( HasRelWidths() )
651  sOut.append(static_cast<sal_Int32>(m_nTabWidth)).append('%');
652  else if( Application::GetDefaultDevice() )
653  {
654  sal_Int32 nPixWidth = Application::GetDefaultDevice()->LogicToPixel(
655  Size(m_nTabWidth,0), MapMode(MapUnit::MapTwip) ).Width();
656  if( !nPixWidth )
657  nPixWidth = 1;
658 
659  sOut.append(nPixWidth);
660  }
661  else
662  {
663  OSL_ENSURE( Application::GetDefaultDevice(), "no Application-Window!?" );
664  sOut.append("100%");
665  }
666  sOut.append("\"");
667  }
668 
669  if( (nHSpace || nVSpace) && Application::GetDefaultDevice())
670  {
671  Size aPixelSpc =
672  Application::GetDefaultDevice()->LogicToPixel( Size(nHSpace,nVSpace),
673  MapMode(MapUnit::MapTwip) );
674  if( !aPixelSpc.Width() && nHSpace )
675  aPixelSpc.setWidth( 1 );
676  if( !aPixelSpc.Height() && nVSpace )
677  aPixelSpc.setHeight( 1 );
678 
679  if( aPixelSpc.Width() )
680  {
681  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_hspace).
682  append("=\"").append(static_cast<sal_Int32>(aPixelSpc.Width())).append("\"");
683  }
684 
685  if( aPixelSpc.Height() )
686  {
687  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_vspace).
688  append("=\"").append(static_cast<sal_Int32>(aPixelSpc.Height())).append("\"");
689  }
690  }
691 
692  // output CELLPADDING: from layout or calculated
693  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_cellpadding).
694  append("=\"").append(static_cast<sal_Int32>(SwHTMLWriter::ToPixel(m_nCellPadding,false))).append("\"");
695 
696  // output CELLSPACING: from layout or calculated
697  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_cellspacing).
698  append("=\"").append(static_cast<sal_Int32>(SwHTMLWriter::ToPixel(m_nCellSpacing,false))).append("\"");
699 
700  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
701 
702  // output background
703  if( pFrameFormat )
704  {
705  rWrt.OutBackground( pFrameFormat->GetAttrSet(), false );
706 
707  if (rWrt.m_bCfgOutStyles)
708  rWrt.OutCSS1_TableFrameFormatOptions( *pFrameFormat );
709  }
710 
711  sOut.append('>');
712  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
713 
714  rWrt.IncIndentLevel(); // indent content of table
715 
716  // output caption
717  if( pCaption && !pCaption->isEmpty() )
718  {
719  rWrt.OutNewLine(); // <CAPTION> in new line
720  OStringBuffer sOutStr(OOO_STRING_SVTOOLS_HTML_caption);
721  sOutStr.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).append("=\"")
722  .append(bTopCaption ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom)
723  .append("\"");
724  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rWrt.GetNamespace() + sOutStr.getStr() );
725  HTMLOutFuncs::Out_String( rWrt.Strm(), *pCaption, rWrt.m_eDestEnc, &rWrt.m_aNonConvertableCharacters );
727  }
728 
729  const SwWriteTableCols::size_type nCols = m_aCols.size();
730 
731  // output <COLGRP>/<COL>: If exporting via layout only when during import
732  // some were there, otherwise always.
733  bool bColGroups = (bColsHaveBorder && !bColsHaveBorderOnly);
734  if( m_bColTags )
735  {
736  if( bColGroups )
737  {
738  rWrt.OutNewLine(); // <COLGRP> in new line
740 
741  rWrt.IncIndentLevel(); // indent content of <COLGRP>
742  }
743 
744  for( SwWriteTableCols::size_type nCol=0; nCol<nCols; ++nCol )
745  {
746  rWrt.OutNewLine(); // </COL> in new line
747 
748  const SwWriteTableCol *pColumn = m_aCols[nCol].get();
749 
750  HtmlWriter html(rWrt.Strm(), rWrt.maNamespace);
751  html.start(OOO_STRING_SVTOOLS_HTML_col);
752 
753  sal_uInt32 nWidth;
754  bool bRel;
755  if( m_bLayoutExport )
756  {
757  bRel = pColumn->HasRelWidthOpt();
758  nWidth = pColumn->GetWidthOpt();
759  }
760  else
761  {
762  bRel = HasRelWidths();
763  nWidth = bRel ? GetRelWidth(nCol,1) : GetAbsWidth(nCol,1);
764  }
765 
766  if( bRel )
767  html.attribute(OOO_STRING_SVTOOLS_HTML_O_width, OString::number(nWidth) + "*");
768  else
769  html.attribute(OOO_STRING_SVTOOLS_HTML_O_width, OString::number(SwHTMLWriter::ToPixel(nWidth,false)));
770  html.end();
771 
772  if( bColGroups && pColumn->bRightBorder && nCol<nCols-1 )
773  {
774  rWrt.DecIndentLevel(); // indent content of <COLGRP>
775  rWrt.OutNewLine(); // </COLGRP> in new line
777  false );
778  rWrt.OutNewLine(); // <COLGRP> in new line
780  rWrt.IncIndentLevel(); // indent content of <COLGRP>
781  }
782  }
783  if( bColGroups )
784  {
785  rWrt.DecIndentLevel(); // indent content of <COLGRP>
786 
787  rWrt.OutNewLine(); // </COLGRP> in new line
789  false );
790  }
791  }
792 
793  // output the lines as table lines
794 
795  // Output <TBODY>?
796  bool bTSections = (bRowsHaveBorder && !bRowsHaveBorderOnly);
797  bool bTBody = bTSections;
798 
799  // If sections must be outputted, then a THEAD around the first line only
800  // can be outputted if there is a line below the cell.
801  if( bTHead &&
802  (bTSections || bColGroups) &&
803  m_nHeadEndRow<m_aRows.size()-1 && !m_aRows[m_nHeadEndRow]->bBottomBorder )
804  bTHead = false;
805 
806  // Output <TBODY> only if <THEAD> is outputted.
807  bTSections |= bTHead;
808 
809  if( bTSections )
810  {
811  rWrt.OutNewLine(); // <THEAD>/<TDATA> in new line
813  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag);
814 
815  rWrt.IncIndentLevel(); // indent content of <THEAD>/<TDATA>
816  }
817 
818  for( SwWriteTableRows::size_type nRow = 0; nRow < m_aRows.size(); ++nRow )
819  {
820  const SwWriteTableRow *pRow2 = m_aRows[nRow].get();
821 
822  OutTableCells( rWrt, pRow2->GetCells(), pRow2->GetBackground() );
823  if( !m_nCellSpacing && nRow < m_aRows.size()-1 && pRow2->bBottomBorder &&
825  {
826  for( auto nCnt = (pRow2->nBottomBorder / DEF_LINE_WIDTH_1) - 1; nCnt; --nCnt )
827  {
828  rWrt.OutNewLine();
831  false );
832  }
833  }
834  if( ( (bTHead && nRow==m_nHeadEndRow) ||
835  (bTBody && pRow2->bBottomBorder) ) &&
836  nRow < m_aRows.size()-1 )
837  {
838  rWrt.DecIndentLevel(); // indent content of <THEAD>/<TDATA>
839  rWrt.OutNewLine(); // </THEAD>/</TDATA> in new line
841  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag, false);
842  rWrt.OutNewLine(); // <THEAD>/<TDATA> in new line
843 
844  if( bTHead && nRow==m_nHeadEndRow )
845  bTHead = false;
846 
848  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag);
849  rWrt.IncIndentLevel(); // indent content of <THEAD>/<TDATA>
850  }
851  }
852 
853  if( bTSections )
854  {
855  rWrt.DecIndentLevel(); // indent content of <THEAD>/<TDATA>
856 
857  rWrt.OutNewLine(); // </THEAD>/</TDATA> in new line
859  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag, false);
860  }
861 
862  rWrt.DecIndentLevel(); // indent content of <TABLE>
863 
864  rWrt.OutNewLine(); // </TABLE> in new line
866 
867  rWrt.m_nDirection = nOldDirection;
868 }
869 
871  const SwFrameFormat *pFlyFrameFormat,
872  const OUString *pCaption, bool bTopCaption )
873 {
874 
875  SwTable& rTable = rNode.GetTable();
876 
877  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
878  rHTMLWrt.m_bOutTable = true;
879 
880  // The horizontal alignment of the frame (if exists) has priority.
881  // NONE means that no horizontal alignment was outputted.
882  sal_Int16 eFlyHoriOri = text::HoriOrientation::NONE;
883  css::text::WrapTextMode eSurround = css::text::WrapTextMode_NONE;
884  sal_uInt8 nFlyPercentWidth = 0;
885  tools::Long nFlyWidth = 0;
886  sal_uInt16 nFlyHSpace = 0;
887  sal_uInt16 nFlyVSpace = 0;
888  if( pFlyFrameFormat )
889  {
890  eSurround = pFlyFrameFormat->GetSurround().GetSurround();
891  const SwFormatFrameSize& rFrameSize = pFlyFrameFormat->GetFrameSize();
892  nFlyPercentWidth = rFrameSize.GetWidthPercent();
893  nFlyWidth = rFrameSize.GetSize().Width();
894 
895  eFlyHoriOri = pFlyFrameFormat->GetHoriOrient().GetHoriOrient();
896  if( text::HoriOrientation::NONE == eFlyHoriOri )
897  eFlyHoriOri = text::HoriOrientation::LEFT;
898 
899  const SvxLRSpaceItem& rLRSpace = pFlyFrameFormat->GetLRSpace();
900  nFlyHSpace = static_cast< sal_uInt16 >((rLRSpace.GetLeft() + rLRSpace.GetRight()) / 2);
901 
902  const SvxULSpaceItem& rULSpace = pFlyFrameFormat->GetULSpace();
903  nFlyVSpace = (rULSpace.GetUpper() + rULSpace.GetLower()) / 2;
904  }
905 
906  // maybe open a FORM
907  bool bPreserveForm = false;
908  if( !rHTMLWrt.m_bPreserveForm )
909  {
910  rHTMLWrt.OutForm( true, &rNode );
911  bPreserveForm = rHTMLWrt.mxFormComps.is();
912  rHTMLWrt.m_bPreserveForm = bPreserveForm;
913  }
914 
915  SwFrameFormat *pFormat = rTable.GetFrameFormat();
916 
917  const SwFormatFrameSize& rFrameSize = pFormat->GetFrameSize();
918  tools::Long nWidth = rFrameSize.GetSize().Width();
919  sal_uInt8 nPercentWidth = rFrameSize.GetWidthPercent();
920  sal_uInt16 nBaseWidth = static_cast<sal_uInt16>(nWidth);
921 
922  sal_Int16 eTabHoriOri = pFormat->GetHoriOrient().GetHoriOrient();
923 
924  // text::HoriOrientation::NONE and text::HoriOrientation::FULL tables need relative widths
925  sal_uInt16 nNewDefListLvl = 0;
926  bool bRelWidths = false;
927  bool bCheckDefList = false;
928  switch( eTabHoriOri )
929  {
930  case text::HoriOrientation::FULL:
931  // Tables with automatic alignment become tables with 100% width.
932  bRelWidths = true;
933  nWidth = 100;
934  eTabHoriOri = text::HoriOrientation::LEFT;
935  break;
937  {
938  const SvxLRSpaceItem& aLRItem = pFormat->GetLRSpace();
939  if( aLRItem.GetRight() )
940  {
941  // The table width is defined on the basis of the left and
942  // right margin. Therefore we try to define the actual
943  // width of the table. If that's not possible we transform
944  // it to a table with width 100%.
945  nWidth = pFormat->FindLayoutRect(true).Width();
946  if( !nWidth )
947  {
948  bRelWidths = true;
949  nWidth = 100;
950  }
951 
952  }
953  else if( nPercentWidth )
954  {
955  // Without a right border the %-width is maintained.
956  nWidth = nPercentWidth;
957  bRelWidths = true;
958  }
959  else
960  {
961  // Without a right margin also an absolute width is maintained.
962  // We still try to define the actual width via the layout.
963  tools::Long nRealWidth = pFormat->FindLayoutRect(true).Width();
964  if( nRealWidth )
965  nWidth = nRealWidth;
966  }
967  bCheckDefList = true;
968  }
969  break;
970  case text::HoriOrientation::LEFT_AND_WIDTH:
971  eTabHoriOri = text::HoriOrientation::LEFT;
972  bCheckDefList = true;
973  [[fallthrough]];
974  default:
975  // In all other case it's possible to use directly an absolute
976  // or relative width.
977  if( nPercentWidth )
978  {
979  bRelWidths = true;
980  nWidth = nPercentWidth;
981  }
982  break;
983  }
984 
985  if( bCheckDefList )
986  {
987  OSL_ENSURE( !rHTMLWrt.GetNumInfo().GetNumRule() ||
988  rHTMLWrt.GetNextNumInfo(),
989  "NumInfo for next paragraph is missing!" );
990  const SvxLRSpaceItem& aLRItem = pFormat->GetLRSpace();
991  if( aLRItem.GetLeft() > 0 && rHTMLWrt.m_nDefListMargin > 0 &&
992  ( !rHTMLWrt.GetNumInfo().GetNumRule() ||
993  ( rHTMLWrt.GetNextNumInfo() &&
994  (rHTMLWrt.GetNextNumInfo()->IsRestart() ||
995  rHTMLWrt.GetNumInfo().GetNumRule() !=
996  rHTMLWrt.GetNextNumInfo()->GetNumRule()) ) ) )
997  {
998  // If the paragraph before the table is not numbered or the
999  // paragraph after the table starts with a new numbering or with
1000  // a different rule, we can maintain the indentation with a DL.
1001  // Otherwise we keep the indentation of the numbering.
1002  nNewDefListLvl = static_cast< sal_uInt16 >(
1003  (aLRItem.GetLeft() + (rHTMLWrt.m_nDefListMargin/2)) /
1004  rHTMLWrt.m_nDefListMargin );
1005  }
1006  }
1007 
1008  if( !pFlyFrameFormat && nNewDefListLvl != rHTMLWrt.m_nDefListLvl )
1009  rHTMLWrt.OutAndSetDefList( nNewDefListLvl );
1010 
1011  if( nNewDefListLvl )
1012  {
1013  if( rHTMLWrt.m_bLFPossible )
1014  rHTMLWrt.OutNewLine();
1016  }
1017 
1018  // eFlyHoriOri and eTabHoriOri now only contain the values of
1019  // LEFT/CENTER and RIGHT!
1020  if( eFlyHoriOri!=text::HoriOrientation::NONE )
1021  {
1022  eTabHoriOri = eFlyHoriOri;
1023  // MIB 4.7.97: If the table has a relative width, then the width is
1024  // adjusted to the width of the frame, therefore we export its width.
1025  // If fixed width, the table width is relevant. Whoever puts tables with
1026  // relative width <100% into frames is to blame when the result looks bad.
1027  if( bRelWidths )
1028  {
1029  nWidth = nFlyPercentWidth ? nFlyPercentWidth : nFlyWidth;
1030  bRelWidths = nFlyPercentWidth > 0;
1031  }
1032  }
1033 
1034  sal_Int16 eDivHoriOri = text::HoriOrientation::NONE;
1035  switch( eTabHoriOri )
1036  {
1037  case text::HoriOrientation::LEFT:
1038  // If a left-aligned table has no right sided flow, then we don't need
1039  // an ALIGN=LEFT in the table.
1040  if( eSurround==css::text::WrapTextMode_NONE || eSurround==css::text::WrapTextMode_LEFT )
1041  eTabHoriOri = text::HoriOrientation::NONE;
1042  break;
1043  case text::HoriOrientation::RIGHT:
1044  // Something like that also applies to right-aligned tables,
1045  // here we use a <DIV ALIGN=RIGHT> instead.
1046  if( eSurround==css::text::WrapTextMode_NONE || eSurround==css::text::WrapTextMode_RIGHT )
1047  {
1048  eDivHoriOri = text::HoriOrientation::RIGHT;
1049  eTabHoriOri = text::HoriOrientation::NONE;
1050  }
1051  break;
1052  case text::HoriOrientation::CENTER:
1053  // Almost nobody understands ALIGN=CENTER, therefore we abstain
1054  // from it and use a <CENTER>.
1055  eDivHoriOri = text::HoriOrientation::CENTER;
1056  eTabHoriOri = text::HoriOrientation::NONE;
1057  break;
1058  default:
1059  ;
1060  }
1061  if( text::HoriOrientation::NONE==eTabHoriOri )
1062  nFlyHSpace = nFlyVSpace = 0;
1063 
1064  if( !pFormat->GetName().isEmpty() )
1065  rHTMLWrt.OutImplicitMark( pFormat->GetName(), "table" );
1066 
1067  if( text::HoriOrientation::NONE!=eDivHoriOri )
1068  {
1069  if( rHTMLWrt.m_bLFPossible )
1070  rHTMLWrt.OutNewLine(); // <CENTER> in new line
1071  if( text::HoriOrientation::CENTER==eDivHoriOri )
1073  else
1074  {
1075  OString sOut = OOO_STRING_SVTOOLS_HTML_division
1078  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + sOut.getStr() );
1079  }
1080  rHTMLWrt.IncIndentLevel(); // indent content of <CENTER>
1081  rHTMLWrt.m_bLFPossible = true;
1082  }
1083 
1084  // If the table isn't in a frame, then you always can output a LF.
1085  if( text::HoriOrientation::NONE==eTabHoriOri )
1086  rHTMLWrt.m_bLFPossible = true;
1087 
1088  const SwHTMLTableLayout *pLayout = rTable.GetHTMLTableLayout();
1089 
1090 #ifdef DBG_UTIL
1091  {
1093  if ( pSh && pSh->GetViewOptions()->IsTest1() )
1094  pLayout = nullptr;
1095  }
1096 #endif
1097 
1098  if( pLayout && pLayout->IsExportable() )
1099  {
1100  SwHTMLWrtTable aTableWrt( pLayout );
1101  aTableWrt.Write( rHTMLWrt, eTabHoriOri, rTable.GetRowsToRepeat() > 0,
1102  pFormat, pCaption, bTopCaption,
1103  nFlyHSpace, nFlyVSpace );
1104  }
1105  else
1106  {
1107  SwHTMLWrtTable aTableWrt( rTable.GetTabLines(), nWidth,
1108  nBaseWidth, bRelWidths, 0, 0, rTable.GetRowsToRepeat() );
1109  aTableWrt.Write( rHTMLWrt, eTabHoriOri, rTable.GetRowsToRepeat() > 0,
1110  pFormat, pCaption, bTopCaption,
1111  nFlyHSpace, nFlyVSpace );
1112  }
1113 
1114  // If the table wasn't in a frame, then you always can output a LF.
1115  if( text::HoriOrientation::NONE==eTabHoriOri )
1116  rHTMLWrt.m_bLFPossible = true;
1117 
1118  if( text::HoriOrientation::NONE!=eDivHoriOri )
1119  {
1120  rHTMLWrt.DecIndentLevel(); // indent content of <CENTER>
1121  rHTMLWrt.OutNewLine(); // </CENTER> in new line
1122  OString aTag = text::HoriOrientation::CENTER == eDivHoriOri
1125  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rHTMLWrt.GetNamespace() + aTag, false);
1126  rHTMLWrt.m_bLFPossible = true;
1127  }
1128 
1129  // move Pam behind the table
1130  rHTMLWrt.m_pCurrentPam->GetPoint()->nNode = *rNode.EndOfSectionNode();
1131 
1132  if( bPreserveForm )
1133  {
1134  rHTMLWrt.m_bPreserveForm = false;
1135  rHTMLWrt.OutForm( false );
1136  }
1137 
1138  rHTMLWrt.m_bOutTable = false;
1139 
1140  if( rHTMLWrt.GetNextNumInfo() &&
1141  !rHTMLWrt.GetNextNumInfo()->IsRestart() &&
1142  rHTMLWrt.GetNextNumInfo()->GetNumRule() ==
1143  rHTMLWrt.GetNumInfo().GetNumRule() )
1144  {
1145  // If the paragraph after the table is numbered with the same rule as the
1146  // one before, then the NumInfo of the next paragraph holds the level of
1147  // paragraph before the table. Therefore NumInfo must be fetched again
1148  // to maybe close the Num list.
1149  rHTMLWrt.ClearNextNumInfo();
1150  rHTMLWrt.FillNextNumInfo();
1151  OutHTML_NumberBulletListEnd( rHTMLWrt, *rHTMLWrt.GetNextNumInfo() );
1152  }
1153  return rWrt;
1154 }
1155 
1156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool HasPercentWidthOpt() const
Definition: wrtswtbl.hxx:92
const SwTableBoxNumFormat & GetTableBoxNumFormat(bool=true) const
TableBox attributes - implemented in cellatr.hxx.
Definition: cellatr.hxx:105
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:686
Starts a section of nodes in the document model.
Definition: node.hxx:312
bool HasRelWidthOpt() const
Definition: wrtswtbl.hxx:186
std::vector< SwTableLine * >::size_type size_type
Definition: swtable.hxx:67
sal_uLong GetIndex() const
Definition: node.hxx:291
SwHTMLNumRuleInfo & GetNumInfo()
Definition: wrthtml.hxx:528
virtual bool ShouldExpandSub(const SwTableBox *pBox, bool bExpandedBefore, sal_uInt16 nDepth) const
Definition: wrtswtbl.cxx:389
sal_uInt16 GetRowSpan() const
Definition: wrtswtbl.hxx:78
bool m_bPreserveForm
Definition: wrthtml.hxx:384
sal_uInt16 GetLower() const
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars=nullptr)
bool IsDefault() const
Definition: format.hxx:113
void setWidth(tools::Long nWidth)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
void FillNextNumInfo()
#define OOO_STRING_SVTOOLS_HTML_caption
SwHTMLNumRuleInfo * GetNextNumInfo()
Definition: wrthtml.hxx:532
std::string GetValue
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1412
#define OOO_STRING_SVTOOLS_HTML_tableheader
sal_uIntPtr sal_uLong
long Long
tools::Long GetRight() const
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: atrfrm.cxx:2660
bool IsRestart() const
Definition: htmlnum.hxx:78
#define OOO_STRING_SVTOOLS_HTML_tablerow
void DecIndentLevel()
Definition: wrthtml.hxx:501
OUString m_aNonConvertableCharacters
Definition: wrthtml.hxx:294
SwTableLine is one table row in the document model.
Definition: swtable.hxx:351
SvxFrameDirection
sal_uInt16 GetRowsToRepeat() const
Definition: swtable.hxx:195
SvStream & WriteOString(const OString &rStr)
sal_Int32 m_nDefListMargin
Definition: wrthtml.hxx:326
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(152)
const editeng::SvxBorderLine * GetRight() const
#define OOO_STRING_SVTOOLS_HTML_thead
bool m_bOutTable
Definition: wrthtml.hxx:362
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:203
OString maNamespace
XML namespace, in case of XHTML.
Definition: wrthtml.hxx:397
#define DEF_LINE_WIDTH_1
sal_uInt32 GetWidthOpt() const
Definition: wrtswtbl.hxx:185
size_type size() const
Definition: swtable.hxx:75
#define OOO_STRING_SVTOOLS_HTML_tbody
void OutBackground(const SvxBrushItem *pBrushItem, bool bGraphic)
Definition: wrthtml.cxx:1271
static OutputDevice * GetDefaultDevice()
const SwTableBox * GetBox() const
Definition: wrtswtbl.hxx:73
#define SAL_MAX_UINT32
constexpr tools::Long Width() const
void OutNewLine(bool bCheck=false)
Definition: wrthtml.cxx:1432
css::uno::Any const & rValue
#define OOO_STRING_SVTOOLS_HTML_tabledata
bool m_bLFPossible
Definition: wrthtml.hxx:380
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:742
static SVT_DLLPUBLIC SvStream & Out_AsciiTag(SvStream &, const OString &rStr, bool bOn=true)
bool mbReqIF
If the ReqIF subset of XHTML should be written.
Definition: wrthtml.hxx:399
const SvxBrushItem * GetBackground() const
Definition: wrtswtbl.hxx:130
const OUString & GetName() const
Definition: format.hxx:115
int nCount
static SVT_DLLPUBLIC OString CreateTableDataOptionsValNum(bool bValue, double fVal, sal_uLong nFormat, SvNumberFormatter &rFormatter, rtl_TextEncoding eDestEnc=RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars=nullptr)
const SwWriteTableCells & GetCells() const
Definition: wrtswtbl.hxx:135
void Width(tools::Long nNew)
Definition: swrect.hxx:187
const SwTable & GetTable() const
Definition: node.hxx:501
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
sal_uInt32 GetWidthOpt() const
Definition: wrtswtbl.hxx:91
#define MAX_DEPTH
Definition: htmltabw.cxx:55
tools::Long GetHeight() const
Definition: wrtswtbl.hxx:81
Writer & OutCSS1_TableBGStyleOpt(Writer &rWrt, const SfxPoolItem &rHt)
Definition: css1atr.cxx:1799
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:147
void OutCSS1_TableCellBorderHack(const SwFrameFormat &rFrameFormat)
Definition: css1atr.cxx:2066
sal_Int16 GetVertOri() const
Definition: wrtswtbl.cxx:38
void ChangeParaToken(HtmlTokenId nNew)
Definition: htmlatr.cxx:157
Base class for various Writer styles.
Definition: format.hxx:46
#define OOO_STRING_SVTOOLS_HTML_colgroup
Table of Contents - heading.
Definition: poolfmt.hxx:342
void OutImplicitMark(std::u16string_view rMark, const char *pMarkType)
Definition: wrthtml.cxx:1224
const editeng::SvxBorderLine * GetTop() const
Style of a layout element.
Definition: frmfmt.hxx:58
rtl_TextEncoding m_eDestEnc
Definition: wrthtml.hxx:335
css::uno::Reference< css::container::XIndexContainer > mxFormComps
Definition: wrthtml.hxx:297
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const editeng::SvxBorderLine * GetLeft() const
int i
Writer & OutHTML_SwTableNode(Writer &rWrt, SwTableNode &rNode, const SwFrameFormat *pFlyFrameFormat, const OUString *pCaption, bool bTopCaption)
Definition: htmltabw.cxx:870
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
#define OOO_STRING_SVTOOLS_HTML_table
tools::Long GetLeft() const
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:373
const SvxBrushItem * GetBackground() const
Definition: wrtswtbl.hxx:84
sal_uInt16 GetCol() const
Definition: wrtswtbl.hxx:76
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:431
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
sal_uInt16 GetRow() const
Definition: wrtswtbl.hxx:75
void Out_SwDoc(SwPaM *)
Definition: wrthtml.cxx:805
SwTableLines & GetTabLines()
Definition: swtable.hxx:200
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:111
std::vector< std::unique_ptr< SwWriteTableCell > > SwWriteTableCells
Definition: wrtswtbl.hxx:95
static sal_uInt32 ToPixel(sal_uInt32 nVal, const bool bVert)
Definition: htmlatr.cxx:2592
SwTableLines & GetTabLines()
Definition: swtable.hxx:424
void ClearNextNumInfo()
bool m_bOutOpts
Definition: wrthtml.hxx:360
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
#define OOO_STRING_SVTOOLS_HTML_O_align
#define OOO_STRING_SVTOOLS_HTML_division
SwFormat * DerivedFrom() const
Definition: format.hxx:112
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:681
void OutCSS1_TableFrameFormatOptions(const SwFrameFormat &rFrameFormat)
Definition: css1atr.cxx:2045
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:361
std::vector< SwTableBox * > SwTableBoxes
Definition: swtable.hxx:104
static bool lcl_TableBox_HasTabBorders(const SwTableBox *pBox, bool *pBorders)
Definition: htmltabw.cxx:197
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:445
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
#define OOO_STRING_SVTOOLS_HTML_AL_right
void start(const OString &aElement)
bool IsTest1() const
Definition: viewopt.hxx:494
constexpr tools::Long Height() const
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
unsigned char sal_uInt8
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:423
void OutForm(bool bTagOn=true, const SwStartNode *pStNd=nullptr)
Definition: htmlforw.cxx:227
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
void IncIndentLevel()
Definition: wrthtml.hxx:497
SwHTMLTableLayout * GetHTMLTableLayout()
Definition: swtable.hxx:176
#define OOO_STRING_SVTOOLS_HTML_center
sal_uInt16 GetColSpan() const
Definition: wrtswtbl.hxx:79
SwNodes & GetNodes()
Definition: doc.hxx:408
SvxFrameDirection GetHTMLDirection(SvxFrameDirection nDir) const
Definition: wrthtml.cxx:1366
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
Definition: wrthtml.cxx:1481
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:369
SvStream & WriteChar(char nChar)
SvxBoxItem & rBoxItem
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
std::shared_ptr< SwUnoCursor > m_pCurrentPam
Definition: shellio.hxx:405
bool IsExportable() const
Definition: htmltbl.hxx:333
void setHeight(tools::Long nHeight)
Writer & OutHTML_NumberBulletListEnd(SwHTMLWriter &rWrt, const SwHTMLNumRuleInfo &rNextInfo)
SvStream & Strm()
Definition: writer.cxx:215
sal_uInt32 GetValue() const
sal_uInt16 nTopBorder
Definition: wrtswtbl.hxx:112
sal_uInt16 nBottomBorder
Definition: wrtswtbl.hxx:113
bool m_bTextAttr
Definition: wrthtml.hxx:358
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
bool m_bCfgOutStyles
Definition: wrthtml.hxx:340
void OutDirection(SvxFrameDirection nDir)
Definition: wrthtml.cxx:1385
void OutAndSetDefList(sal_uInt16 nNewLvl)
Definition: htmlatr.cxx:119
Subgroup table.
Definition: poolfmt.hxx:341
SvxFrameDirection m_nDirection
Definition: wrthtml.hxx:333
#define OOO_STRING_SVTOOLS_HTML_dd
bool IsTextNode() const
Definition: node.hxx:640
static void Write(const OUString &rString, SvStream &rStream)
Definition: ww8scan.cxx:6706
SwNumRule * GetNumRule()
Definition: htmlnum.hxx:69
const editeng::SvxBorderLine * GetBottom() const
sal_uInt16 m_nDefListLvl
Definition: wrthtml.hxx:325
SwDoc * m_pDoc
Definition: shellio.hxx:403
const Size & GetSize() const
static bool lcl_TableLine_HasTabBorders(const SwTableLine *pLine, bool *pBorders)
Definition: htmltabw.cxx:222
bool m_bOutFlyFrame
Definition: wrthtml.hxx:365
sal_Int16 nValue
sal_uInt16 GetUpper() const
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
Base class of the Writer document model elements.
Definition: node.hxx:80