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