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( nHeight )
384  {
385  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height)
386  .append("=\"").append(static_cast<sal_Int32>(aPixelSz.Height())).append("\"");
387  }
388 
389  const SfxItemSet& rItemSet = pBox->GetFrameFormat()->GetAttrSet();
390  const SfxPoolItem *pItem;
391 
392  // ALIGN is only outputted at the paragraphs from now on
393 
394  // output VALIGN
395  if( bOutVAlign )
396  {
397  sal_Int16 eVertOri = pCell->GetVertOri();
398  if( text::VertOrientation::TOP==eVertOri || text::VertOrientation::BOTTOM==eVertOri )
399  {
400  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_valign)
401  .append("=\"").append(text::VertOrientation::TOP==eVertOri ?
402  OOO_STRING_SVTOOLS_HTML_VA_top :
403  OOO_STRING_SVTOOLS_HTML_VA_bottom)
404  .append("\"");
405  }
406  }
407 
408  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
409 
410  rWrt.m_bTextAttr = false;
411  rWrt.m_bOutOpts = true;
412  const SvxBrushItem *pBrushItem = nullptr;
413  if( SfxItemState::SET==rItemSet.GetItemState( RES_BACKGROUND, false, &pItem ) )
414  {
415  pBrushItem = static_cast<const SvxBrushItem *>(pItem);
416  }
417  if( !pBrushItem )
418  pBrushItem = pCell->GetBackground();
419 
420  if( pBrushItem )
421  {
422  // output background
423  if (!rWrt.mbReqIF)
424  // Avoid non-CSS version in the ReqIF case.
425  rWrt.OutBackground( pBrushItem, false );
426 
427  if( rWrt.m_bCfgOutStyles )
428  OutCSS1_TableBGStyleOpt( rWrt, *pBrushItem );
429  }
430 
432 
433  sal_uInt32 nNumFormat = 0;
434  double nValue = 0.0;
435  bool bNumFormat = false, bValue = false;
436  if( SfxItemState::SET==rItemSet.GetItemState( RES_BOXATR_FORMAT, false, &pItem ) )
437  {
438  nNumFormat = static_cast<const SwTableBoxNumFormat *>(pItem)->GetValue();
439  bNumFormat = true;
440  }
441  if( SfxItemState::SET==rItemSet.GetItemState( RES_BOXATR_VALUE, false, &pItem ) )
442  {
443  nValue = static_cast<const SwTableBoxValue *>(pItem)->GetValue();
444  bValue = true;
445  if( !bNumFormat )
446  nNumFormat = pBox->GetFrameFormat()->GetTableBoxNumFormat().GetValue();
447  }
448 
449  if( bNumFormat || bValue )
450  {
451  sOut.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValue, nValue,
452  nNumFormat, *rWrt.m_pDoc->GetNumberFormatter(), rWrt.m_eDestEnc,
454  }
455  sOut.append('>');
456  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
457  rWrt.m_bLFPossible = true;
458 
459  rWrt.IncIndentLevel(); // indent the content of <TD>...</TD>
460 
461  if( pSttNd )
462  {
463  HTMLSaveData aSaveData( rWrt, pSttNd->GetIndex()+1,
464  pSttNd->EndOfSectionIndex() );
465  rWrt.Out_SwDoc( rWrt.m_pCurrentPam.get() );
466  }
467  else
468  {
469  sal_uInt16 nTWidth;
470  sal_uInt32 nBWidth;
471  sal_uInt16 nLSub, nRSub;
472  if( HasRelWidths() )
473  {
474  nTWidth = 100;
475  nBWidth = GetRawWidth( nCol, nColSpan );
476  nLSub = 0;
477  nRSub = 0;
478  }
479  else
480  {
481  nTWidth = GetAbsWidth( nCol, nColSpan );
482  nBWidth = nTWidth;
483  nLSub = GetLeftSpace( nCol );
484  nRSub = GetRightSpace( nCol, nColSpan );
485  }
486 
487  SwHTMLWrtTable aTableWrt( pBox->GetTabLines(), nTWidth,
488  nBWidth, HasRelWidths(), nLSub, nRSub, /*nNumOfRowsToRepeat*/0 );
489  aTableWrt.Write( rWrt );
490  }
491 
492  rWrt.DecIndentLevel(); // indent the content of <TD>...</TD>
493 
494  if( rWrt.m_bLFPossible )
495  rWrt.OutNewLine();
497  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag, false);
498  rWrt.m_bLFPossible = true;
499 }
500 
501 // output a line as lines
502 void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt,
503  const SwWriteTableCells& rCells,
504  const SvxBrushItem *pBrushItem ) const
505 {
506  // If the line contains more the one cell and all cells have the same
507  // alignment, then output the VALIGN at the line instead of the cell.
508  sal_Int16 eRowVertOri = text::VertOrientation::NONE;
509  if( rCells.size() > 1 )
510  {
511  for (SwWriteTableCells::size_type nCell = 0; nCell < rCells.size(); ++nCell)
512  {
513  sal_Int16 eCellVertOri = rCells[nCell]->GetVertOri();
514  if( 0==nCell )
515  {
516  eRowVertOri = eCellVertOri;
517  }
518  else if( eRowVertOri != eCellVertOri )
519  {
520  eRowVertOri = text::VertOrientation::NONE;
521  break;
522  }
523  }
524  }
525 
526  rWrt.OutNewLine(); // <TR> in new line
528  if( pBrushItem )
529  {
530  rWrt.OutBackground( pBrushItem, false );
531 
532  rWrt.m_bTextAttr = false;
533  rWrt.m_bOutOpts = true;
534  if( rWrt.m_bCfgOutStyles )
535  OutCSS1_TableBGStyleOpt( rWrt, *pBrushItem );
536  }
537 
538  if( text::VertOrientation::TOP==eRowVertOri || text::VertOrientation::BOTTOM==eRowVertOri )
539  {
540  OStringBuffer sOut;
541  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_valign)
542  .append("=\"").append(text::VertOrientation::TOP==eRowVertOri ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom)
543  .append("\"");
544  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
545  }
546 
547  rWrt.Strm().WriteChar( '>' );
548 
549  rWrt.IncIndentLevel(); // indent content of <TR>...</TR>
550 
551  for (const auto &rpCell : rCells)
552  {
553  OutTableCell(rWrt, rpCell.get(), text::VertOrientation::NONE == eRowVertOri);
554  }
555 
556  rWrt.DecIndentLevel(); // indent content of <TR>...</TR>
557 
558  rWrt.OutNewLine(); // </TR> in new line
560 }
561 
562 void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign,
563  bool bTHead, const SwFrameFormat *pFrameFormat,
564  const OUString *pCaption, bool bTopCaption,
565  sal_uInt16 nHSpace, sal_uInt16 nVSpace ) const
566 {
567  // determine value of RULES
568  bool bRowsHaveBorder = false;
569  bool bRowsHaveBorderOnly = true;
570  SwWriteTableRow *pRow = m_aRows[0].get();
571  for( SwWriteTableRows::size_type nRow=1; nRow < m_aRows.size(); ++nRow )
572  {
573  SwWriteTableRow *pNextRow = m_aRows[nRow].get();
574  bool bBorder = ( pRow->bBottomBorder || pNextRow->bTopBorder );
575  bRowsHaveBorder |= bBorder;
576  bRowsHaveBorderOnly &= bBorder;
577 
578  sal_uInt16 nBorder2 = pRow->bBottomBorder ? pRow->nBottomBorder : USHRT_MAX;
579  if( pNextRow->bTopBorder && pNextRow->nTopBorder < nBorder2 )
580  nBorder2 = pNextRow->nTopBorder;
581 
582  pRow->bBottomBorder = bBorder;
583  pRow->nBottomBorder = nBorder2;
584 
585  pNextRow->bTopBorder = bBorder;
586  pNextRow->nTopBorder = nBorder2;
587 
588  pRow = pNextRow;
589  }
590 
591  bool bColsHaveBorder = false;
592  bool bColsHaveBorderOnly = true;
593  SwWriteTableCol *pCol = m_aCols[0].get();
594  for( SwWriteTableCols::size_type nCol=1; nCol<m_aCols.size(); ++nCol )
595  {
596  SwWriteTableCol *pNextCol = m_aCols[nCol].get();
597  bool bBorder = ( pCol->bRightBorder || pNextCol->bLeftBorder );
598  bColsHaveBorder |= bBorder;
599  bColsHaveBorderOnly &= bBorder;
600  pCol->bRightBorder = bBorder;
601  pNextCol->bLeftBorder = bBorder;
602  pCol = pNextCol;
603  }
604 
605  // close previous numbering, etc
606  rWrt.ChangeParaToken( HtmlTokenId::NONE );
607 
608  if( rWrt.m_bLFPossible )
609  rWrt.OutNewLine(); // <TABLE> in new line
610  OStringBuffer sOut;
611  sOut.append('<').append(rWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_table);
612 
613  const SvxFrameDirection nOldDirection = rWrt.m_nDirection;
614  if( pFrameFormat )
615  rWrt.m_nDirection = rWrt.GetHTMLDirection( pFrameFormat->GetAttrSet() );
616  if( rWrt.m_bOutFlyFrame || nOldDirection != rWrt.m_nDirection )
617  {
618  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
619  rWrt.OutDirection( rWrt.m_nDirection );
620  }
621 
622  // output ALIGN=
623  if( text::HoriOrientation::RIGHT == eAlign )
624  {
625  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).
626  append("=\"").append(OOO_STRING_SVTOOLS_HTML_AL_right).append("\"");
627  }
628  else if( text::HoriOrientation::CENTER == eAlign )
629  {
630  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).
631  append("=\"").append(OOO_STRING_SVTOOLS_HTML_AL_center).append("\"");
632  }
633  else if( text::HoriOrientation::LEFT == eAlign )
634  {
635  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).
636  append("=\"").append(OOO_STRING_SVTOOLS_HTML_AL_left).append("\"");
637  }
638 
639  // output WIDTH: from layout or calculated
640  if( m_nTabWidth )
641  {
642  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
643  append("=\"");
644  if( HasRelWidths() )
645  sOut.append(static_cast<sal_Int32>(m_nTabWidth)).append('%');
646  else if( Application::GetDefaultDevice() )
647  {
648  sal_Int32 nPixWidth = Application::GetDefaultDevice()->LogicToPixel(
649  Size(m_nTabWidth,0), MapMode(MapUnit::MapTwip) ).Width();
650  if( !nPixWidth )
651  nPixWidth = 1;
652 
653  sOut.append(nPixWidth);
654  }
655  else
656  {
657  OSL_ENSURE( Application::GetDefaultDevice(), "no Application-Window!?" );
658  sOut.append("100%");
659  }
660  sOut.append("\"");
661  }
662 
663  if( (nHSpace || nVSpace) && Application::GetDefaultDevice())
664  {
665  Size aPixelSpc =
666  Application::GetDefaultDevice()->LogicToPixel( Size(nHSpace,nVSpace),
667  MapMode(MapUnit::MapTwip) );
668  if( !aPixelSpc.Width() && nHSpace )
669  aPixelSpc.setWidth( 1 );
670  if( !aPixelSpc.Height() && nVSpace )
671  aPixelSpc.setHeight( 1 );
672 
673  if( aPixelSpc.Width() )
674  {
675  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_hspace).
676  append("=\"").append(static_cast<sal_Int32>(aPixelSpc.Width())).append("\"");
677  }
678 
679  if( aPixelSpc.Height() )
680  {
681  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_vspace).
682  append("=\"").append(static_cast<sal_Int32>(aPixelSpc.Height())).append("\"");
683  }
684  }
685 
686  // output CELLPADDING: from layout or calculated
687  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_cellpadding).
688  append("=\"").append(static_cast<sal_Int32>(SwHTMLWriter::ToPixel(m_nCellPadding,false))).append("\"");
689 
690  // output CELLSPACING: from layout or calculated
691  sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_cellspacing).
692  append("=\"").append(static_cast<sal_Int32>(SwHTMLWriter::ToPixel(m_nCellSpacing,false))).append("\"");
693 
694  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
695 
696  // output background
697  if( pFrameFormat )
698  {
699  rWrt.OutBackground( pFrameFormat->GetAttrSet(), false );
700 
701  if (rWrt.m_bCfgOutStyles)
702  rWrt.OutCSS1_TableFrameFormatOptions( *pFrameFormat );
703  }
704 
705  sOut.append('>');
706  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
707 
708  rWrt.IncIndentLevel(); // indent content of table
709 
710  // output caption
711  if( pCaption && !pCaption->isEmpty() )
712  {
713  rWrt.OutNewLine(); // <CAPTION> in new line
714  OStringBuffer sOutStr(OOO_STRING_SVTOOLS_HTML_caption);
715  sOutStr.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).append("=\"")
716  .append(bTopCaption ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom)
717  .append("\"");
718  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rWrt.GetNamespace() + sOutStr.getStr() );
719  HTMLOutFuncs::Out_String( rWrt.Strm(), *pCaption, rWrt.m_eDestEnc, &rWrt.m_aNonConvertableCharacters );
721  }
722 
723  const SwWriteTableCols::size_type nCols = m_aCols.size();
724 
725  // output <COLGRP>/<COL>: If exporting via layout only when during import
726  // some were there, otherwise always.
727  bool bColGroups = (bColsHaveBorder && !bColsHaveBorderOnly);
728  if( m_bColTags )
729  {
730  if( bColGroups )
731  {
732  rWrt.OutNewLine(); // <COLGRP> in new line
734 
735  rWrt.IncIndentLevel(); // indent content of <COLGRP>
736  }
737 
738  for( SwWriteTableCols::size_type nCol=0; nCol<nCols; ++nCol )
739  {
740  rWrt.OutNewLine(); // </COL> in new line
741 
742  const SwWriteTableCol *pColumn = m_aCols[nCol].get();
743 
744  HtmlWriter html(rWrt.Strm(), rWrt.maNamespace);
745  html.start(OOO_STRING_SVTOOLS_HTML_col);
746 
747  sal_uInt32 nWidth;
748  bool bRel;
749  if( m_bLayoutExport )
750  {
751  bRel = pColumn->HasRelWidthOpt();
752  nWidth = pColumn->GetWidthOpt();
753  }
754  else
755  {
756  bRel = HasRelWidths();
757  nWidth = bRel ? GetRelWidth(nCol,1) : GetAbsWidth(nCol,1);
758  }
759 
760  if( bRel )
761  html.attribute(OOO_STRING_SVTOOLS_HTML_O_width, OString::number(nWidth) + "*");
762  else
763  html.attribute(OOO_STRING_SVTOOLS_HTML_O_width, OString::number(SwHTMLWriter::ToPixel(nWidth,false)));
764  html.end();
765 
766  if( bColGroups && pColumn->bRightBorder && nCol<nCols-1 )
767  {
768  rWrt.DecIndentLevel(); // indent content of <COLGRP>
769  rWrt.OutNewLine(); // </COLGRP> in new line
771  false );
772  rWrt.OutNewLine(); // <COLGRP> in new line
774  rWrt.IncIndentLevel(); // indent content of <COLGRP>
775  }
776  }
777  if( bColGroups )
778  {
779  rWrt.DecIndentLevel(); // indent content of <COLGRP>
780 
781  rWrt.OutNewLine(); // </COLGRP> in new line
783  false );
784  }
785  }
786 
787  // output the lines as table lines
788 
789  // Output <TBODY>?
790  bool bTSections = (bRowsHaveBorder && !bRowsHaveBorderOnly);
791  bool bTBody = bTSections;
792 
793  // If sections must be outputted, then a THEAD around the first line only
794  // can be outputted if there is a line below the cell.
795  if( bTHead &&
796  (bTSections || bColGroups) &&
797  m_nHeadEndRow<m_aRows.size()-1 && !m_aRows[m_nHeadEndRow]->bBottomBorder )
798  bTHead = false;
799 
800  // Output <TBODY> only if <THEAD> is outputted.
801  bTSections |= bTHead;
802 
803  if( bTSections )
804  {
805  rWrt.OutNewLine(); // <THEAD>/<TDATA> in new line
807  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag);
808 
809  rWrt.IncIndentLevel(); // indent content of <THEAD>/<TDATA>
810  }
811 
812  for( SwWriteTableRows::size_type nRow = 0; nRow < m_aRows.size(); ++nRow )
813  {
814  const SwWriteTableRow *pRow2 = m_aRows[nRow].get();
815 
816  OutTableCells( rWrt, pRow2->GetCells(), pRow2->GetBackground() );
817  if( !m_nCellSpacing && nRow < m_aRows.size()-1 && pRow2->bBottomBorder &&
819  {
820  for( auto nCnt = (pRow2->nBottomBorder / DEF_LINE_WIDTH_1) - 1; nCnt; --nCnt )
821  {
822  rWrt.OutNewLine();
825  false );
826  }
827  }
828  if( ( (bTHead && nRow==m_nHeadEndRow) ||
829  (bTBody && pRow2->bBottomBorder) ) &&
830  nRow < m_aRows.size()-1 )
831  {
832  rWrt.DecIndentLevel(); // indent content of <THEAD>/<TDATA>
833  rWrt.OutNewLine(); // </THEAD>/</TDATA> in new line
835  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag, false);
836  rWrt.OutNewLine(); // <THEAD>/<TDATA> in new line
837 
838  if( bTHead && nRow==m_nHeadEndRow )
839  bTHead = false;
840 
842  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag);
843  rWrt.IncIndentLevel(); // indent content of <THEAD>/<TDATA>
844  }
845  }
846 
847  if( bTSections )
848  {
849  rWrt.DecIndentLevel(); // indent content of <THEAD>/<TDATA>
850 
851  rWrt.OutNewLine(); // </THEAD>/</TDATA> in new line
853  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rWrt.GetNamespace() + aTag, false);
854  }
855 
856  rWrt.DecIndentLevel(); // indent content of <TABLE>
857 
858  rWrt.OutNewLine(); // </TABLE> in new line
860 
861  rWrt.m_nDirection = nOldDirection;
862 }
863 
865  const SwFrameFormat *pFlyFrameFormat,
866  const OUString *pCaption, bool bTopCaption )
867 {
868 
869  SwTable& rTable = rNode.GetTable();
870 
871  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
872  rHTMLWrt.m_bOutTable = true;
873 
874  // The horizontal alignment of the frame (if exists) has priority.
875  // NONE means that no horizontal alignment was outputted.
876  sal_Int16 eFlyHoriOri = text::HoriOrientation::NONE;
877  css::text::WrapTextMode eSurround = css::text::WrapTextMode_NONE;
878  sal_uInt8 nFlyPercentWidth = 0;
879  tools::Long nFlyWidth = 0;
880  sal_uInt16 nFlyHSpace = 0;
881  sal_uInt16 nFlyVSpace = 0;
882  if( pFlyFrameFormat )
883  {
884  eSurround = pFlyFrameFormat->GetSurround().GetSurround();
885  const SwFormatFrameSize& rFrameSize = pFlyFrameFormat->GetFrameSize();
886  nFlyPercentWidth = rFrameSize.GetWidthPercent();
887  nFlyWidth = rFrameSize.GetSize().Width();
888 
889  eFlyHoriOri = pFlyFrameFormat->GetHoriOrient().GetHoriOrient();
890  if( text::HoriOrientation::NONE == eFlyHoriOri )
891  eFlyHoriOri = text::HoriOrientation::LEFT;
892 
893  const SvxLRSpaceItem& rLRSpace = pFlyFrameFormat->GetLRSpace();
894  nFlyHSpace = static_cast< sal_uInt16 >((rLRSpace.GetLeft() + rLRSpace.GetRight()) / 2);
895 
896  const SvxULSpaceItem& rULSpace = pFlyFrameFormat->GetULSpace();
897  nFlyVSpace = (rULSpace.GetUpper() + rULSpace.GetLower()) / 2;
898  }
899 
900  // maybe open a FORM
901  bool bPreserveForm = false;
902  if( !rHTMLWrt.m_bPreserveForm )
903  {
904  rHTMLWrt.OutForm( true, &rNode );
905  bPreserveForm = rHTMLWrt.mxFormComps.is();
906  rHTMLWrt.m_bPreserveForm = bPreserveForm;
907  }
908 
909  SwFrameFormat *pFormat = rTable.GetFrameFormat();
910 
911  const SwFormatFrameSize& rFrameSize = pFormat->GetFrameSize();
912  tools::Long nWidth = rFrameSize.GetSize().Width();
913  sal_uInt8 nPercentWidth = rFrameSize.GetWidthPercent();
914  sal_uInt16 nBaseWidth = static_cast<sal_uInt16>(nWidth);
915 
916  sal_Int16 eTabHoriOri = pFormat->GetHoriOrient().GetHoriOrient();
917 
918  // text::HoriOrientation::NONE and text::HoriOrientation::FULL tables need relative widths
919  sal_uInt16 nNewDefListLvl = 0;
920  bool bRelWidths = false;
921  bool bCheckDefList = false;
922  switch( eTabHoriOri )
923  {
924  case text::HoriOrientation::FULL:
925  // Tables with automatic alignment become tables with 100% width.
926  bRelWidths = true;
927  nWidth = 100;
928  eTabHoriOri = text::HoriOrientation::LEFT;
929  break;
931  {
932  const SvxLRSpaceItem& aLRItem = pFormat->GetLRSpace();
933  if( aLRItem.GetRight() )
934  {
935  // The table width is defined on the basis of the left and
936  // right margin. Therefore we try to define the actual
937  // width of the table. If that's not possible we transform
938  // it to a table with width 100%.
939  nWidth = pFormat->FindLayoutRect(true).Width();
940  if( !nWidth )
941  {
942  bRelWidths = true;
943  nWidth = 100;
944  }
945 
946  }
947  else if( nPercentWidth )
948  {
949  // Without a right border the %-width is maintained.
950  nWidth = nPercentWidth;
951  bRelWidths = true;
952  }
953  else
954  {
955  // Without a right margin also an absolute width is maintained.
956  // We still try to define the actual width via the layout.
957  tools::Long nRealWidth = pFormat->FindLayoutRect(true).Width();
958  if( nRealWidth )
959  nWidth = nRealWidth;
960  }
961  bCheckDefList = true;
962  }
963  break;
964  case text::HoriOrientation::LEFT_AND_WIDTH:
965  eTabHoriOri = text::HoriOrientation::LEFT;
966  bCheckDefList = true;
967  [[fallthrough]];
968  default:
969  // In all other case it's possible to use directly an absolute
970  // or relative width.
971  if( nPercentWidth )
972  {
973  bRelWidths = true;
974  nWidth = nPercentWidth;
975  }
976  break;
977  }
978 
979  if( bCheckDefList )
980  {
981  OSL_ENSURE( !rHTMLWrt.GetNumInfo().GetNumRule() ||
982  rHTMLWrt.GetNextNumInfo(),
983  "NumInfo for next paragraph is missing!" );
984  const SvxLRSpaceItem& aLRItem = pFormat->GetLRSpace();
985  if( aLRItem.GetLeft() > 0 && rHTMLWrt.m_nDefListMargin > 0 &&
986  ( !rHTMLWrt.GetNumInfo().GetNumRule() ||
987  ( rHTMLWrt.GetNextNumInfo() &&
988  (rHTMLWrt.GetNextNumInfo()->IsRestart() ||
989  rHTMLWrt.GetNumInfo().GetNumRule() !=
990  rHTMLWrt.GetNextNumInfo()->GetNumRule()) ) ) )
991  {
992  // If the paragraph before the table is not numbered or the
993  // paragraph after the table starts with a new numbering or with
994  // a different rule, we can maintain the indentation with a DL.
995  // Otherwise we keep the indentation of the numbering.
996  nNewDefListLvl = static_cast< sal_uInt16 >(
997  (aLRItem.GetLeft() + (rHTMLWrt.m_nDefListMargin/2)) /
998  rHTMLWrt.m_nDefListMargin );
999  }
1000  }
1001 
1002  if( !pFlyFrameFormat && nNewDefListLvl != rHTMLWrt.m_nDefListLvl )
1003  rHTMLWrt.OutAndSetDefList( nNewDefListLvl );
1004 
1005  if( nNewDefListLvl )
1006  {
1007  if( rHTMLWrt.m_bLFPossible )
1008  rHTMLWrt.OutNewLine();
1010  }
1011 
1012  // eFlyHoriOri and eTabHoriOri now only contain the values of
1013  // LEFT/CENTER and RIGHT!
1014  if( eFlyHoriOri!=text::HoriOrientation::NONE )
1015  {
1016  eTabHoriOri = eFlyHoriOri;
1017  // MIB 4.7.97: If the table has a relative width, then the width is
1018  // adjusted to the width of the frame, therefore we export its width.
1019  // If fixed width, the table width is relevant. Whoever puts tables with
1020  // relative width <100% into frames is to blame when the result looks bad.
1021  if( bRelWidths )
1022  {
1023  nWidth = nFlyPercentWidth ? nFlyPercentWidth : nFlyWidth;
1024  bRelWidths = nFlyPercentWidth > 0;
1025  }
1026  }
1027 
1028  sal_Int16 eDivHoriOri = text::HoriOrientation::NONE;
1029  switch( eTabHoriOri )
1030  {
1031  case text::HoriOrientation::LEFT:
1032  // If a left-aligned table has no right sided flow, then we don't need
1033  // an ALIGN=LEFT in the table.
1034  if( eSurround==css::text::WrapTextMode_NONE || eSurround==css::text::WrapTextMode_LEFT )
1035  eTabHoriOri = text::HoriOrientation::NONE;
1036  break;
1037  case text::HoriOrientation::RIGHT:
1038  // Something like that also applies to right-aligned tables,
1039  // here we use a <DIV ALIGN=RIGHT> instead.
1040  if( eSurround==css::text::WrapTextMode_NONE || eSurround==css::text::WrapTextMode_RIGHT )
1041  {
1042  eDivHoriOri = text::HoriOrientation::RIGHT;
1043  eTabHoriOri = text::HoriOrientation::NONE;
1044  }
1045  break;
1046  case text::HoriOrientation::CENTER:
1047  // Almost nobody understands ALIGN=CENTER, therefore we abstain
1048  // from it and use a <CENTER>.
1049  eDivHoriOri = text::HoriOrientation::CENTER;
1050  eTabHoriOri = text::HoriOrientation::NONE;
1051  break;
1052  default:
1053  ;
1054  }
1055  if( text::HoriOrientation::NONE==eTabHoriOri )
1056  nFlyHSpace = nFlyVSpace = 0;
1057 
1058  if( !pFormat->GetName().isEmpty() )
1059  rHTMLWrt.OutImplicitMark( pFormat->GetName(), "table" );
1060 
1061  if( text::HoriOrientation::NONE!=eDivHoriOri )
1062  {
1063  if( rHTMLWrt.m_bLFPossible )
1064  rHTMLWrt.OutNewLine(); // <CENTER> in new line
1065  if( text::HoriOrientation::CENTER==eDivHoriOri )
1067  else
1068  {
1069  OString sOut = OOO_STRING_SVTOOLS_HTML_division
1072  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + sOut.getStr() );
1073  }
1074  rHTMLWrt.IncIndentLevel(); // indent content of <CENTER>
1075  rHTMLWrt.m_bLFPossible = true;
1076  }
1077 
1078  // If the table isn't in a frame, then you always can output a LF.
1079  if( text::HoriOrientation::NONE==eTabHoriOri )
1080  rHTMLWrt.m_bLFPossible = true;
1081 
1082  const SwHTMLTableLayout *pLayout = rTable.GetHTMLTableLayout();
1083 
1084 #ifdef DBG_UTIL
1085  {
1087  if ( pSh && pSh->GetViewOptions()->IsTest1() )
1088  pLayout = nullptr;
1089  }
1090 #endif
1091 
1092  if( pLayout && pLayout->IsExportable() )
1093  {
1094  SwHTMLWrtTable aTableWrt( pLayout );
1095  aTableWrt.Write( rHTMLWrt, eTabHoriOri, rTable.GetRowsToRepeat() > 0,
1096  pFormat, pCaption, bTopCaption,
1097  nFlyHSpace, nFlyVSpace );
1098  }
1099  else
1100  {
1101  SwHTMLWrtTable aTableWrt( rTable.GetTabLines(), nWidth,
1102  nBaseWidth, bRelWidths, 0, 0, rTable.GetRowsToRepeat() );
1103  aTableWrt.Write( rHTMLWrt, eTabHoriOri, rTable.GetRowsToRepeat() > 0,
1104  pFormat, pCaption, bTopCaption,
1105  nFlyHSpace, nFlyVSpace );
1106  }
1107 
1108  // If the table wasn't in a frame, then you always can output a LF.
1109  if( text::HoriOrientation::NONE==eTabHoriOri )
1110  rHTMLWrt.m_bLFPossible = true;
1111 
1112  if( text::HoriOrientation::NONE!=eDivHoriOri )
1113  {
1114  rHTMLWrt.DecIndentLevel(); // indent content of <CENTER>
1115  rHTMLWrt.OutNewLine(); // </CENTER> in new line
1116  OString aTag = text::HoriOrientation::CENTER == eDivHoriOri
1119  HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rHTMLWrt.GetNamespace() + aTag, false);
1120  rHTMLWrt.m_bLFPossible = true;
1121  }
1122 
1123  // move Pam behind the table
1124  rHTMLWrt.m_pCurrentPam->GetPoint()->nNode = *rNode.EndOfSectionNode();
1125 
1126  if( bPreserveForm )
1127  {
1128  rHTMLWrt.m_bPreserveForm = false;
1129  rHTMLWrt.OutForm( false );
1130  }
1131 
1132  rHTMLWrt.m_bOutTable = false;
1133 
1134  if( rHTMLWrt.GetNextNumInfo() &&
1135  !rHTMLWrt.GetNextNumInfo()->IsRestart() &&
1136  rHTMLWrt.GetNextNumInfo()->GetNumRule() ==
1137  rHTMLWrt.GetNumInfo().GetNumRule() )
1138  {
1139  // If the paragraph after the table is numbered with the same rule as the
1140  // one before, then the NumInfo of the next paragraph holds the level of
1141  // paragraph before the table. Therefore NumInfo must be fetched again
1142  // to maybe close the Num list.
1143  rHTMLWrt.ClearNextNumInfo();
1144  rHTMLWrt.FillNextNumInfo();
1145  OutHTML_NumberBulletListEnd( rHTMLWrt, *rHTMLWrt.GetNextNumInfo() );
1146  }
1147  return rWrt;
1148 }
1149 
1150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool HasPercentWidthOpt() const
Definition: wrtswtbl.hxx:91
const SwTableBoxNumFormat & GetTableBoxNumFormat(bool=true) const
TableBox attributes - implemented in cellatr.hxx.
Definition: cellatr.hxx:105
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:685
Starts a section of nodes in the document model.
Definition: node.hxx:311
bool HasRelWidthOpt() const
Definition: wrtswtbl.hxx:185
std::vector< SwTableLine * >::size_type size_type
Definition: swtable.hxx:67
void OutImplicitMark(const OUString &rMark, const char *pMarkType)
Definition: wrthtml.cxx:1222
sal_uLong GetIndex() const
Definition: node.hxx:290
SwHTMLNumRuleInfo & GetNumInfo()
Definition: wrthtml.hxx:527
virtual bool ShouldExpandSub(const SwTableBox *pBox, bool bExpandedBefore, sal_uInt16 nDepth) const
Definition: wrtswtbl.cxx:389
sal_uInt16 GetRowSpan() const
Definition: wrtswtbl.hxx:77
bool m_bPreserveForm
Definition: wrthtml.hxx:383
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:109
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:531
std::string GetValue
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1409
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(150)
#define OOO_STRING_SVTOOLS_HTML_tableheader
sal_uIntPtr sal_uLong
long Long
tools::Long GetRight() const
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: atrfrm.cxx:2686
bool IsRestart() const
Definition: htmlnum.hxx:78
#define OOO_STRING_SVTOOLS_HTML_tablerow
void DecIndentLevel()
Definition: wrthtml.hxx:500
OUString m_aNonConvertableCharacters
Definition: wrthtml.hxx:293
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:325
const editeng::SvxBorderLine * GetRight() const
#define OOO_STRING_SVTOOLS_HTML_thead
bool m_bOutTable
Definition: wrthtml.hxx:361
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:203
OString maNamespace
XML namespace, in case of XHTML.
Definition: wrthtml.hxx:396
#define DEF_LINE_WIDTH_1
sal_uInt32 GetWidthOpt() const
Definition: wrtswtbl.hxx:184
size_type size() const
Definition: swtable.hxx:75
#define OOO_STRING_SVTOOLS_HTML_tbody
void OutBackground(const SvxBrushItem *pBrushItem, bool bGraphic)
Definition: wrthtml.cxx:1269
static OutputDevice * GetDefaultDevice()
const SwTableBox * GetBox() const
Definition: wrtswtbl.hxx:72
#define SAL_MAX_UINT32
void OutNewLine(bool bCheck=false)
Definition: wrthtml.cxx:1430
css::uno::Any const & rValue
#define OOO_STRING_SVTOOLS_HTML_tabledata
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
bool m_bLFPossible
Definition: wrthtml.hxx:379
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:761
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:398
const SvxBrushItem * GetBackground() const
Definition: wrtswtbl.hxx:129
const OUString & GetName() const
Definition: format.hxx:111
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:134
void Width(tools::Long nNew)
Definition: swrect.hxx:187
const SwTable & GetTable() const
Definition: node.hxx:500
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
sal_uInt32 GetWidthOpt() const
Definition: wrtswtbl.hxx:90
#define MAX_DEPTH
Definition: htmltabw.cxx:55
tools::Long GetHeight() const
Definition: wrtswtbl.hxx:80
Writer & OutCSS1_TableBGStyleOpt(Writer &rWrt, const SfxPoolItem &rHt)
Definition: css1atr.cxx:1849
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
void OutCSS1_TableCellBorderHack(const SwFrameFormat &rFrameFormat)
Definition: css1atr.cxx:2116
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:43
#define OOO_STRING_SVTOOLS_HTML_colgroup
Table of Contents - heading.
Definition: poolfmt.hxx:341
const editeng::SvxBorderLine * GetTop() const
Style of a layout element.
Definition: frmfmt.hxx:58
rtl_TextEncoding m_eDestEnc
Definition: wrthtml.hxx:334
css::uno::Reference< css::container::XIndexContainer > mxFormComps
Definition: wrthtml.hxx:296
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:864
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
#define OOO_STRING_SVTOOLS_HTML_table
tools::Long GetLeft() const
tools::Long Width() 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:83
sal_uInt16 GetCol() const
Definition: wrtswtbl.hxx:75
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:432
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
sal_uInt16 GetRow() const
Definition: wrtswtbl.hxx:74
void Out_SwDoc(SwPaM *)
Definition: wrthtml.cxx:803
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:94
static sal_uInt32 ToPixel(sal_uInt32 nVal, const bool bVert)
Definition: htmlatr.cxx:2592
SwTableLines & GetTabLines()
Definition: swtable.hxx:425
void ClearNextNumInfo()
bool m_bOutOpts
Definition: wrthtml.hxx:359
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:108
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:680
void OutCSS1_TableFrameFormatOptions(const SwFrameFormat &rFrameFormat)
Definition: css1atr.cxx:2095
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
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:446
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
#define OOO_STRING_SVTOOLS_HTML_AL_right
void start(const OString &aElement)
bool IsTest1() const
Definition: viewopt.hxx:480
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:496
SwHTMLTableLayout * GetHTMLTableLayout()
Definition: swtable.hxx:176
#define OOO_STRING_SVTOOLS_HTML_center
sal_uInt16 GetColSpan() const
Definition: wrtswtbl.hxx:78
SwNodes & GetNodes()
Definition: doc.hxx:405
SvxFrameDirection GetHTMLDirection(SvxFrameDirection nDir) const
Definition: wrthtml.cxx:1364
tools::Long Height() const
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:393
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
Definition: wrthtml.cxx:1479
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:380
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:111
sal_uInt16 nBottomBorder
Definition: wrtswtbl.hxx:112
bool m_bTextAttr
Definition: wrthtml.hxx:357
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
bool m_bCfgOutStyles
Definition: wrthtml.hxx:339
void OutDirection(SvxFrameDirection nDir)
Definition: wrthtml.cxx:1383
void OutAndSetDefList(sal_uInt16 nNewLvl)
Definition: htmlatr.cxx:119
Subgroup table.
Definition: poolfmt.hxx:340
SvxFrameDirection m_nDirection
Definition: wrthtml.hxx:332
#define OOO_STRING_SVTOOLS_HTML_dd
bool IsTextNode() const
Definition: node.hxx:639
static void Write(const OUString &rString, SvStream &rStream)
Definition: ww8scan.cxx:6704
SwNumRule * GetNumRule()
Definition: htmlnum.hxx:69
const editeng::SvxBorderLine * GetBottom() const
sal_uInt16 m_nDefListLvl
Definition: wrthtml.hxx:324
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:364
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:79