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