LibreOffice Module sw (master)  1
WW8TableInfo.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 <iostream>
21 #include <set>
22 #include <stdio.h>
23 #include "WW8TableInfo.hxx"
24 #include <fmtfsize.hxx>
25 #include "attributeoutputbase.hxx"
26 #include <swtable.hxx>
27 #include <frmfmt.hxx>
28 #include <pam.hxx>
29 #include <ndtxt.hxx>
30 #include <dbgoutsw.hxx>
31 #include <sal/log.hxx>
32 
33 namespace ww8
34 {
35 
37 : mpParent(pParent)
38 , mnDepth(0)
39 , mnCell(0)
40 , mnRow(0)
41 , mnShadowsBefore(0)
42 , mnShadowsAfter(0)
43 , mbEndOfLine(false)
44 , mbFinalEndOfLine(false)
45 , mbEndOfCell(false)
46 , mbFirstInTable(false)
47 , mbVertMerge(false)
48 , mpTableBox(nullptr)
49 , mpTable(nullptr)
50 {
51 }
52 
54 {
55 }
56 
57 void WW8TableNodeInfoInner::setDepth(sal_uInt32 nDepth)
58 {
59  mnDepth = nDepth;
60 }
61 
62 void WW8TableNodeInfoInner::setCell(sal_uInt32 nCell)
63 {
64  mnCell = nCell;
65 }
66 
67 void WW8TableNodeInfoInner::setRow(sal_uInt32 nRow)
68 {
69  mnRow = nRow;
70 }
71 
72 void WW8TableNodeInfoInner::setShadowsBefore(sal_uInt32 nShadowsBefore)
73 {
74  mnShadowsBefore = nShadowsBefore;
75 }
76 
77 void WW8TableNodeInfoInner::setShadowsAfter(sal_uInt32 nShadowsAfter)
78 {
79  mnShadowsAfter = nShadowsAfter;
80 }
81 
83 {
84  mbEndOfLine = bEndOfLine;
85 }
86 
87 void WW8TableNodeInfoInner::setFinalEndOfLine(bool bFinalEndOfLine)
88 {
89  mbFinalEndOfLine = bFinalEndOfLine;
90 }
91 
93 {
94  mbEndOfCell = bEndOfCell;
95 }
96 
98 {
99  mbFirstInTable = bFirstInTable;
100 }
101 
103 
104 {
105  mbVertMerge = bVertMerge;
106 }
107 
109 {
110  mpTableBox = pTableBox;
111 }
112 
114 {
115  mpTable = pTable;
116 }
117 
119 {
120  maRect = rRect;
121 }
122 
124 {
125  const SwNode * pResult = nullptr;
126 
127  if (mpParent != nullptr)
128  pResult = mpParent->getNode();
129 
130  return pResult;
131 }
132 
134 {
135  TableBoxVectorPtr pResult(new TableBoxVector);
136 
137  WW8TableCellGrid::Pointer_t pCellGrid =
139 
140  if (pCellGrid.get() == nullptr)
141  {
142  const SwTableLine * pTabLine = getTableBox()->GetUpper();
143  const SwTableBoxes & rTableBoxes = pTabLine->GetTabBoxes();
144 
145  sal_uInt8 nBoxes = rTableBoxes.size();
146  if (nBoxes > MAXTABLECELLS)
147  nBoxes = MAXTABLECELLS;
148  for ( sal_uInt8 n = 0; n < nBoxes; n++ )
149  {
150  pResult->push_back(rTableBoxes[n]);
151  }
152  }
153  else
154  pResult = pCellGrid->getTableBoxesOfRow(this);
155 
156  return pResult;
157 }
158 
160 {
161  GridColsPtr pResult(new GridCols);
162  WidthsPtr pWidths;
163 
164  // Check which columns should be checked - only the current row,
165  // or all the rows together
166  if (calculateColumnsFromAllRows)
167  {
168  // Calculate the width of all the columns based on ALL the rows.
169  // The difference is that this kind of draws vertical lines,
170  // so that if the rows look like this:
171  //
172  // ------------------------
173  // | | |
174  // ------------------------
175  // | | |
176  // ------------------------
177  // | | |
178  // ------------------------
179 
180  // then the actual column widths will be broken down like this:
181  //
182  // ------------------------
183  // | | | | |
184  // ------------------------
185 
186  // See the example at
187  // http://officeopenxml.com/WPtableGrid.php
188  // Under "Word 2007 Example"
189  pWidths = getColumnWidthsBasedOnAllRows();
190  }
191  else
192  {
193  // Calculate the width of all the columns based on the current row
194  pWidths = getWidthsOfRow();
195  }
196 
197  const SwFrameFormat *pFormat = getTable()->GetFrameFormat();
198  OSL_ENSURE(pFormat,"Impossible");
199  if (!pFormat)
200  return pResult;
201 
202  const SwFormatFrameSize &rSize = pFormat->GetFrameSize();
203  unsigned long nTableSz = static_cast<unsigned long>(rSize.GetWidth());
204 
205  long nPageSize = 0;
206  bool bRelBoxSize = false;
207 
208  rBase.GetTablePageSize( this, nPageSize, bRelBoxSize );
209 
210  SwTwips nSz = 0;
211  for (const auto& rWidth : *pWidths)
212  {
213  nSz += rWidth;
214  SwTwips nCalc = nSz;
215  if ( bRelBoxSize )
216  nCalc = ( nCalc * nPageSize ) / nTableSz;
217 
218  pResult->push_back( nCalc );
219  }
220 
221  return pResult;
222 }
223 
225 {
226  WidthsPtr pWidths;
227 
228  WW8TableCellGrid::Pointer_t pCellGrid =
230 
231  if (pCellGrid.get() == nullptr)
232  {
233  const SwTable * pTable = getTable();
234  const SwTableLines& rTableLines = pTable->GetTabLines();
235  const size_t nNumOfLines = rTableLines.size();
236 
237  // Go over all the rows - and for each row - calculate where
238  // there is a separator between columns
239  WidthsPtr pSeparators(new Widths);
240  for ( size_t nLineIndex = 0; nLineIndex < nNumOfLines; ++nLineIndex )
241  {
242  const SwTableLine *pCurrentLine = rTableLines[nLineIndex];
243  const SwTableBoxes & rTabBoxes = pCurrentLine->GetTabBoxes();
244  size_t nBoxes = rTabBoxes.size();
245  if (nBoxes > MAXTABLECELLS)
246  nBoxes = MAXTABLECELLS;
247 
248  sal_uInt32 nSeparatorPosition = 0;
249  for (size_t nBoxIndex = 0; nBoxIndex < nBoxes; ++nBoxIndex)
250  {
251  const SwFrameFormat* pBoxFormat = rTabBoxes[ nBoxIndex ]->GetFrameFormat();
252  const SwFormatFrameSize& rLSz = pBoxFormat->GetFrameSize();
253  nSeparatorPosition += rLSz.GetWidth();
254  pSeparators->push_back(nSeparatorPosition);
255  }
256  }
257 
258  // Sort the separator positions and remove any duplicates
259  std::sort(pSeparators->begin(), pSeparators->end());
260  std::vector<sal_uInt32>::iterator it = std::unique(pSeparators->begin(), pSeparators->end());
261  pSeparators->erase(it, pSeparators->end());
262 
263  // Calculate the widths based on the position of the unique & sorted
264  // column separators
265  pWidths = std::make_shared<Widths>();
266  sal_uInt32 nPreviousWidth = 0;
267  for (const sal_uInt32 nCurrentWidth : *pSeparators)
268  {
269  pWidths->push_back(nCurrentWidth - nPreviousWidth);
270  nPreviousWidth = nCurrentWidth;
271  }
272  }
273  else
274  {
275  pWidths = pCellGrid->getWidthsOfRow(this);
276  }
277 
278  return pWidths;
279 }
280 
282 {
283  WidthsPtr pWidths;
284 
285  WW8TableCellGrid::Pointer_t pCellGrid =
287 
288  if (pCellGrid.get() == nullptr)
289  {
290  const SwTableBox * pTabBox = getTableBox();
291  const SwTableLine * pTabLine = pTabBox->GetUpper();
292  const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes();
293 
294  pWidths = std::make_shared<Widths>();
295  // number of cell written
296  sal_uInt32 nBoxes = rTabBoxes.size();
297  if (nBoxes > MAXTABLECELLS)
298  nBoxes = MAXTABLECELLS;
299 
300  for (sal_uInt32 n = 0; n < nBoxes; n++)
301  {
302  const SwFrameFormat* pBoxFormat = rTabBoxes[ n ]->GetFrameFormat();
303  const SwFormatFrameSize& rLSz = pBoxFormat->GetFrameSize();
304 
305  pWidths->push_back(rLSz.GetWidth());
306  }
307  }
308  else
309  pWidths = pCellGrid->getWidthsOfRow(this);
310 
311  return pWidths;
312 }
313 
315 {
316  RowSpansPtr pResult(new RowSpans);
317 
318  WW8TableCellGrid::Pointer_t pCellGrid =
320 
321  if (pCellGrid.get() == nullptr)
322  {
323  const SwTableBox * pTabBox = getTableBox();
324  const SwTableLine * pTabLine = pTabBox->GetUpper();
325  const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes();
326 
327  sal_uInt32 nBoxes = rTabBoxes.size();
328  if (nBoxes > MAXTABLECELLS)
329  nBoxes = MAXTABLECELLS;
330 
331  for (sal_uInt32 n = 0; n < nBoxes; ++n)
332  {
333  pResult->push_back(rTabBoxes[n]->getRowSpan());
334  }
335  }
336  else
337  pResult = pCellGrid->getRowSpansOfRow(this);
338 
339  return pResult;
340  }
341 
342 
343 #ifdef DBG_UTIL
345 {
346  static char buffer[256];
347  snprintf(buffer, sizeof(buffer),
348  "<tableinner depth=\"%" SAL_PRIuUINT32 "\""
349  " cell=\"%" SAL_PRIuUINT32 "\""
350  " row=\"%" SAL_PRIuUINT32 "\""
351  " endOfCell=\"%s\""
352  " endOfLine=\"%s\""
353  " shadowsBefore=\"%" SAL_PRIuUINT32 "\""
354  " shadowsAfter=\"%" SAL_PRIuUINT32 "\""
355  " vertMerge=\"%s\"/>",
356  mnDepth, mnCell, mnRow,
357  mbEndOfCell ? "yes" : "no",
358  mbEndOfLine ? "yes" : "no",
361  mbVertMerge ? "yes" : "no");
362 
363  return std::string(buffer);
364 }
365 #endif
366 
368  const SwNode * pNode)
369 : mpParent(pParent),
370  mnDepth(0),
371  mpNode(pNode),
372  mpNext(nullptr),
373  mpNextNode(nullptr)
374 {
375 }
376 
378 {
379 }
380 
381 #ifdef DBG_UTIL
382 std::string WW8TableNodeInfo::toString() const
383 {
384  static char buffer[1024];
385  snprintf(buffer, sizeof(buffer),
386  "<tableNodeInfo p=\"%p\" depth=\"%" SAL_PRIuUINT32 "\">"
387  ,this, getDepth());
388 
389  std::string sResult(buffer);
390 
391  for (const auto& rInner : mInners)
392  {
393  WW8TableNodeInfoInner::Pointer_t pInner = rInner.second;
394  sResult += pInner->toString();
395  }
396  sResult += dbg_out(*mpNode);
397  sResult += "</tableNodeInfo>";
398 
399  return sResult;
400 }
401 #endif
402 
403 void WW8TableNodeInfo::setDepth(sal_uInt32 nDepth)
404 {
405  mnDepth = nDepth;
406 
407  Inners_t::iterator aIt = mInners.find(mnDepth);
408 
409  if (aIt == mInners.end())
410  mInners[mnDepth] = std::make_shared<ww8::WW8TableNodeInfoInner>(this);
411 
412  mInners[mnDepth]->setDepth(mnDepth);
413 }
414 
415 void WW8TableNodeInfo::setEndOfLine(bool bEndOfLine)
416 {
418  pInner->setEndOfLine(bEndOfLine);
419 
420 #ifdef DBG_UTIL
421  SAL_INFO( "sw.ww8", "<endOfLine depth=\"" << mnDepth << "\">" << toString() << "</endOfLine>" );
422 #endif
423 }
424 
425 void WW8TableNodeInfo::setEndOfCell(bool bEndOfCell)
426 {
428  pInner->setEndOfCell(bEndOfCell);
429 
430 #ifdef DBG_UTIL
431  SAL_INFO( "sw.ww8", "<endOfCell depth=\"" << mnDepth << "\">" << toString() << "</endOfCell>" );
432 #endif
433 }
434 
435 void WW8TableNodeInfo::setFirstInTable(bool bFirstInTable)
436 {
438 
439  pInner->setFirstInTable(bFirstInTable);
440 
441 #ifdef DBG_UTIL
442  SAL_INFO( "sw.ww8", "<firstInTable depth=\"" << mnDepth << "\">" << toString() << "</firstInTable>" );
443 #endif
444 }
445 
446 void WW8TableNodeInfo::setVertMerge(bool bVertMerge)
447 {
449 
450  pInner->setVertMerge(bVertMerge);
451 
452 #ifdef DBG_UTIL
453  SAL_INFO( "sw.ww8", "<vertMerge depth=\"" << mnDepth << "\">" << toString() << "</vertMerge>" );
454 #endif
455 }
456 
458 {
459  getInnerForDepth(mnDepth)->setTableBox(pTableBox);
460 }
461 
463 {
464  getInnerForDepth(mnDepth)->setTable(pTable);
465 }
466 
468 {
469  mpNext = pNext;
470 
471 #ifdef DBG_UTIL
472  SAL_INFO( "sw.ww8", "<setnext><from>" << toString() << "</from><to>" << pNext->toString() << "</to></setnext>" );
473 #endif
474 }
475 
477 {
478  mpNextNode = pNode;
479 }
480 
482 {
483  getInnerForDepth(mnDepth)->setRect(rRect);
484 }
485 
486 void WW8TableNodeInfo::setCell(sal_uInt32 nCell)
487 {
488  getInnerForDepth(mnDepth)->setCell(nCell);
489 }
490 
491 void WW8TableNodeInfo::setRow(sal_uInt32 nRow)
492 {
493  getInnerForDepth(mnDepth)->setRow(nRow);
494 }
495 
496 void WW8TableNodeInfo::setShadowsBefore(sal_uInt32 nShadowsBefore)
497 {
498  getInnerForDepth(mnDepth)->setShadowsBefore(nShadowsBefore);
499 }
500 
501 void WW8TableNodeInfo::setShadowsAfter(sal_uInt32 nShadowsAfter)
502 {
503  getInnerForDepth(mnDepth)->setShadowsAfter(nShadowsAfter);
504 }
505 
506 
507 sal_uInt32 WW8TableNodeInfo::getDepth() const
508 {
509  if (!mInners.empty())
510  return mInners.begin()->second->getDepth();
511 
512  return mnDepth;
513 }
514 
515 
517 {
518  return getInnerForDepth(mnDepth)->getTableBox();
519 }
520 
521 sal_uInt32 WW8TableNodeInfo::getCell() const
522 {
523  return getInnerForDepth(mnDepth)->getCell();
524 }
525 
526 sal_uInt32 WW8TableNodeInfo::getRow() const
527 {
528  return getInnerForDepth(mnDepth)->getRow();
529 }
530 
532 {
534 
535  if (!mInners.empty())
536  pResult = mInners.begin()->second;
537 
538  return pResult;
539 }
540 
542 {
544 
545  Inners_t::const_iterator aIt = mInners.find(nDepth);
546  if (aIt != mInners.end())
547  {
548  pResult = aIt->second;
549  }
550 
551  return pResult;
552 }
553 
555 {
556 }
557 
559 {
560 }
561 
564 {
565  SwTableCellInfo aTableCellInfo(pTable);
566 
567  while (aTableCellInfo.getNext())
568  {
569  SwRect aRect = aTableCellInfo.getRect();
570 
571  SAL_INFO( "sw.ww8", "<CellFrame>" );
572  SAL_INFO( "sw.ww8", "<rect top=\"" << aRect.Top() << "\" bottom=\"" << aRect.Bottom()
573  << "\" left=\"" << aRect.Left() << "\" right=\"" << aRect.Right() << "\"/>" );
574  const SwTableBox * pTableBox = aTableCellInfo.getTableBox();
575  const SwStartNode * pSttNd = pTableBox->GetSttNd();
576 
577  if (pSttNd != nullptr)
578  {
579  SwPaM aPam(*pSttNd, 0);
580 
581  bool bDone = false;
582  do
583  {
584  SwNode & rNode = aPam.GetPoint()->nNode.GetNode();
585 
586  insertTableNodeInfo(&rNode, pTable, pTableBox, 0, 0, 1, & aRect);
587 
588  if (rNode.IsEndNode())
589  {
590  SwEndNode * pEndNode = rNode.GetEndNode();
591  SwStartNode * pTmpSttNd = pEndNode->StartOfSectionNode();
592 
593  if (pTmpSttNd == pSttNd)
594  bDone = true;
595  }
596 
597  aPam.GetPoint()->nNode++;
598  }
599  while (!bDone);
600  }
601 
602  SAL_INFO( "sw.ww8", "</CellFrame>" );
603  }
604 
605  return reorderByLayout(pTable, rLastRowEnds);
606 }
607 
609 {
610  SAL_INFO( "sw.ww8", "<processSwTable>" );
611 
612  WW8TableNodeInfo * pPrev = nullptr;
613  RowEndInners_t aLastRowEnds;
614 
615  if (pTable->IsTableComplex() && pTable->HasLayout())
616  {
617  pPrev = processSwTableByLayout(pTable, aLastRowEnds);
618 #ifdef DBG_UTIL
619  SAL_INFO( "sw.ww8", getCellGridForTable(pTable)->toString());
620 #endif
621  }
622  else
623  {
624  const SwTableLines & rLines = pTable->GetTabLines();
625 
626  for (size_t n = 0; n < rLines.size(); ++n)
627  {
628  const SwTableLine * pLine = rLines[n];
629 
630  pPrev = processTableLine(pTable, pLine, static_cast<sal_uInt32>(n), 1, pPrev, aLastRowEnds);
631  }
632 
633  }
634 
635  if (pPrev)
636  {
637  SwTableNode * pTableNode = pTable->GetTableNode();
638  SwEndNode * pEndNode = pTableNode->EndOfSectionNode();
639  pPrev->setNextNode(pEndNode);
640  assert(!aLastRowEnds.empty());
641  for (auto &a : aLastRowEnds)
642  {
643  assert(a.second->isEndOfLine());
644  a.second->setFinalEndOfLine(true);
645  }
646  }
647  SAL_INFO( "sw.ww8", "</processSwTable>" );
648 }
649 
652  const SwTableLine * pTableLine,
653  sal_uInt32 nRow,
654  sal_uInt32 nDepth,
655  WW8TableNodeInfo * pPrev,
656  RowEndInners_t &rLastRowEnds)
657 {
658  SAL_INFO( "sw.ww8", "<processTableLine row=\"" << nRow << "\" depth=\"" << nDepth << "\">" );
659 
660  const SwTableBoxes & rBoxes = pTableLine->GetTabBoxes();
661 
662  WW8TableNodeInfo::Pointer_t pTextNodeInfo;
663 
664  for (size_t n = 0; n < rBoxes.size(); ++n)
665  {
666  const SwTableBox * pBox = rBoxes[n];
667 
668  pPrev = processTableBox(pTable, pBox, nRow, static_cast<sal_uInt32>(n), nDepth, n == rBoxes.size() - 1, pPrev, rLastRowEnds);
669  }
670 
671  SAL_INFO( "sw.ww8", "</processTableLine>" );
672 
673  return pPrev;
674 }
675 
678  const SwTable * pTable,
679  const SwTableBox * pBoxToSet,
680  sal_uInt32 nRow,
681  sal_uInt32 nCell,
682  sal_uInt32 nDepth)
683 {
684  SAL_INFO( "sw.ww8", "<processTableBoxLines depth=\"" << nDepth << "\" row=\"" << nRow
685  << "\" cell=\"" << nCell << "\">" );
686 
687  const SwTableLines & rLines = pBox->GetTabLines();
688  WW8TableNodeInfo::Pointer_t pNodeInfo;
689 
690  if (!rLines.empty())
691  {
692  for (size_t n = 0; n < rLines.size(); ++n)
693  {
694  const SwTableLine * pLine = rLines[n];
695  const SwTableBoxes & rBoxes = pLine->GetTabBoxes();
696 
697  for (size_t nBox = 0; nBox < rBoxes.size(); ++nBox)
698  pNodeInfo = processTableBoxLines(rBoxes[nBox], pTable, pBoxToSet, nRow, nCell, nDepth);
699  }
700  }
701  else
702  {
703  const SwStartNode * pSttNd = pBox->GetSttNd();
704  const SwEndNode * pEndNd = pSttNd->EndOfSectionNode();
705  SwPaM aPaM(*pSttNd, 0);
706  SwPaM aEndPaM(*pEndNd, 0);
707 
708  bool bDone = false;
709  while (!bDone)
710  {
711  SwNode & rNode = aPaM.GetPoint()->nNode.GetNode();
712 
713  pNodeInfo = insertTableNodeInfo(&rNode, pTable, pBoxToSet, nRow, nCell, nDepth);
714 
715  if (aPaM.GetPoint()->nNode == aEndPaM.GetPoint()->nNode)
716  bDone = true;
717  else
718  aPaM.GetPoint()->nNode++;
719  }
720  }
721 
722  SAL_INFO( "sw.ww8", "</processTableBoxLines>" );
723 
724  return pNodeInfo;
725 }
726 
727 static void updateFinalEndOfLine(RowEndInners_t &rLastRowEnds, WW8TableNodeInfo const * pEndOfCellInfo)
728 {
729  sal_Int32 nDepth = pEndOfCellInfo->getDepth();
730  WW8TableNodeInfoInner::Pointer_t pInner = pEndOfCellInfo->getInnerForDepth(nDepth);
731 
732  auto aIt = rLastRowEnds.find(nDepth);
733  if (aIt == rLastRowEnds.end() || (pInner->getRow() > aIt->second->getRow()))
734  rLastRowEnds[nDepth] = pInner.get();
735 }
736 
737 WW8TableNodeInfo *
739  const SwTableBox * pBox,
740  sal_uInt32 nRow,
741  sal_uInt32 nCell,
742  sal_uInt32 nDepth,
743  bool bEndOfLine,
744  WW8TableNodeInfo * pPrev,
745  RowEndInners_t &rLastRowEnds)
746 {
747  SAL_INFO( "sw.ww8", "<processTableBox row=\"" << nRow << "\" cell=\"" << nCell
748  << "\" depth=\"" << nDepth << "\">" );
749 
750  WW8TableNodeInfo::Pointer_t pNodeInfo;
751  const SwTableLines & rLines = pBox->GetTabLines();
752  const SwStartNode * pSttNd = pBox->GetSttNd();
753  WW8TableNodeInfo::Pointer_t pEndOfCellInfo;
754 
755  if (!rLines.empty())
756  {
757  pNodeInfo = processTableBoxLines(pBox, pTable, pBox, nRow, nCell, nDepth);
758  pNodeInfo->setEndOfCell(true);
759  if (bEndOfLine)
760  {
761  pNodeInfo->setEndOfLine(true);
762  updateFinalEndOfLine(rLastRowEnds, pNodeInfo.get());
763  }
764 
765  for (size_t n = 0; n < rLines.size(); n++)
766  {
767  const SwTableLine * pLine = rLines[n];
768 
769  pPrev = processTableLine(pTable, pLine, n, 1, pPrev, rLastRowEnds);
770  }
771  }
772  else
773  {
774  SwPaM aPaM(*pSttNd, 0);
775 
776  bool bDone = false;
777  sal_uInt32 nDepthInsideCell = 0;
778 
779  do
780  {
781  SwNode & rNode = aPaM.GetPoint()->nNode.GetNode();
782 
783  if (rNode.IsStartNode())
784  {
785  if (nDepthInsideCell > 0)
786  pEndOfCellInfo.reset();
787 
788  nDepthInsideCell++;
789  }
790 
791  pNodeInfo = insertTableNodeInfo(&rNode, pTable, pBox, nRow, nCell, nDepth);
792 
793  if (pPrev)
794  pPrev->setNext(pNodeInfo.get());
795 
796  pPrev = pNodeInfo.get();
797 
798  if (nDepthInsideCell == 1 && rNode.IsTextNode())
799  pEndOfCellInfo = pNodeInfo;
800 
801  if (rNode.IsEndNode())
802  {
803  nDepthInsideCell--;
804 
805  if (nDepthInsideCell == 0 && !pEndOfCellInfo)
806  pEndOfCellInfo = pNodeInfo;
807 
808  SwEndNode * pEndNode = rNode.GetEndNode( );
809  SwStartNode * pTmpSttNd = pEndNode->StartOfSectionNode();
810  if (pTmpSttNd == pSttNd)
811  bDone = true;
812  }
813 
814  aPaM.GetPoint()->nNode++;
815  }
816  while (!bDone);
817 
818  if (pEndOfCellInfo.get() != nullptr)
819  {
820  pEndOfCellInfo->setEndOfCell(true);
821 
822  if (bEndOfLine)
823  {
824  pEndOfCellInfo->setEndOfLine(true);
825  updateFinalEndOfLine(rLastRowEnds, pEndOfCellInfo.get());
826  }
827  }
828  }
829 
830  SAL_INFO( "sw.ww8", "</processTableBox>" );
831 
832  return pPrev;
833 }
834 
836 (const SwNode * pNode,
837  const SwTable * pTable,
838  const SwTableBox * pTableBox,
839  sal_uInt32 nRow,
840  sal_uInt32 nCell,
841  sal_uInt32 nDepth,
842  SwRect const * pRect)
843 {
844  WW8TableNodeInfo::Pointer_t pNodeInfo = getTableNodeInfo(pNode);
845 
846  if (pNodeInfo.get() == nullptr)
847  {
848  pNodeInfo =
849  std::make_shared<ww8::WW8TableNodeInfo>(this, pNode);
850  mMap.emplace(pNode, pNodeInfo);
851  }
852 
853  pNodeInfo->setDepth(nDepth + pNodeInfo->getDepth());
854 
855  pNodeInfo->setTable(pTable);
856  pNodeInfo->setTableBox(pTableBox);
857 
858  pNodeInfo->setCell(nCell);
859  pNodeInfo->setRow(nRow);
860 
861  if (pNode->IsTextNode())
862  {
863  FirstInTableMap_t::const_iterator aIt = mFirstInTableMap.find(pTable);
864  if (aIt == mFirstInTableMap.end())
865  {
866  mFirstInTableMap[pTable] = pNode;
867  pNodeInfo->setFirstInTable(true);
868  }
869  }
870 
871  if (pRect)
872  {
873  WW8TableCellGrid::Pointer_t pCellGrid = getCellGridForTable(pTable);
874 
875  pCellGrid->insert(*pRect, pNodeInfo.get());
876  pNodeInfo->setRect(*pRect);
877  }
878 
879 #ifdef DBG_UTIL
880  SAL_INFO( "sw.ww8", pNodeInfo->toString());
881 #endif
882  return pNodeInfo;
883 }
884 
886 (const SwTable * pTable, bool bCreate)
887 {
889  CellGridMap_t::iterator aIt = mCellGridMap.find(pTable);
890 
891  if (aIt == mCellGridMap.end())
892  {
893  if (bCreate)
894  {
895  pResult = std::make_shared<ww8::WW8TableCellGrid>();
896  mCellGridMap[pTable] = pResult;
897  }
898  }
899  else
900  pResult = mCellGridMap[pTable];
901 
902  return pResult;
903 }
904 
906 (const SwNode * pNode)
907 {
909  Map_t::iterator aIt = mMap.find(pNode);
910 
911  if (aIt != mMap.end())
912  pResult = (*aIt).second;
913 
914  return pResult;
915 }
916 
918 {
919  const SwNode * pResult = nullptr;
920 
922 
923  if (pNodeInfo.get() != nullptr)
924  {
925  WW8TableNodeInfo * pNextInfo = pNodeInfo->getNext();
926 
927  if (pNextInfo != nullptr)
928  pResult = pNextInfo->getNode();
929  else
930  {
931  const SwNode * pNextNode = pNodeInfo->getNextNode();
932 
933  if (pNextNode != nullptr)
934  pResult = pNextNode;
935  }
936  }
937 
938  return pResult;
939 }
940 
942 {
943  bool bRet = false;
944 
945  if (rInfo.mpNode != nullptr)
946  {
947  if (mpNode == nullptr)
948  {
949  bRet = true;
950  }
951  else
952  {
953  if (mpNode->GetIndex() < rInfo.mpNode->GetIndex())
954  bRet = true;
955  }
956  }
957 
958  return bRet;
959 }
960 
961 bool CellInfo::operator < (const CellInfo & aCellInfo) const
962 {
963  bool aRet = false;
964 
965  if (top() < aCellInfo.top())
966  aRet = true;
967  else if (top() == aCellInfo.top())
968  {
969  if (left() < aCellInfo.left())
970  aRet = true;
971  else if (left() == aCellInfo.left())
972  {
973  if (width() < aCellInfo.width())
974  aRet = true;
975  else if (width() == aCellInfo.width())
976  {
977  if (height() < aCellInfo.height())
978  aRet = true;
979  else if (height() == aCellInfo.height())
980  {
981  if (aCellInfo.getTableNodeInfo())
982  {
983  if (m_pNodeInfo == nullptr)
984  aRet = true;
985  else
986  {
987  aRet = *m_pNodeInfo < *aCellInfo.getTableNodeInfo();
988  }
989  }
990  }
991  }
992  }
993  }
994 
995  return aRet;
996 }
997 
998 #ifdef DBG_UTIL
999 std::string CellInfo::toString() const
1000 {
1001  static char sBuffer[256];
1002 
1003  snprintf(sBuffer, sizeof(sBuffer),
1004  "<cellinfo left=\"%ld\""
1005  " right=\"%ld\""
1006  " top=\"%ld\""
1007  " bottom=\"%ld\""
1008  " node=\"%p\"/>",
1009  left(),
1010  right(),
1011  top(),
1012  bottom(),
1013  m_pNodeInfo);
1014 
1015  return sBuffer;
1016 }
1017 #endif
1018 
1020 {
1022 
1023 #ifdef DBG_UTIL
1024  SAL_INFO( "sw.ww8", pCellGrid->toString());
1025 #endif
1026 
1027  pCellGrid->addShadowCells();
1028  return pCellGrid->connectCells(rLastRowEnds);
1029 }
1030 
1032 {
1033 }
1034 
1036 {
1037 }
1038 
1040 {
1042 
1043  RowTops_t::iterator aIt = m_aRowTops.find(nTop);
1044 
1045  if (aIt == m_aRowTops.end())
1046  {
1047  if (bCreate)
1048  {
1049  pResult = std::make_shared<ww8::WW8TableCellGridRow>();
1050  m_aRows[nTop] = pResult;
1051  m_aRowTops.insert(nTop);
1052  }
1053  }
1054  else
1055  pResult = m_aRows[nTop];
1056 
1057  return pResult;
1058 }
1059 
1060 WW8TableCellGrid::RowTops_t::const_iterator WW8TableCellGrid::getRowTopsBegin() const
1061 {
1062  return m_aRowTops.begin();
1063 }
1064 
1065 WW8TableCellGrid::RowTops_t::const_iterator WW8TableCellGrid::getRowTopsEnd() const
1066 {
1067  return m_aRowTops.end();
1068 }
1069 
1070 CellInfoMultiSet::const_iterator WW8TableCellGrid::getCellsBegin(long nTop)
1071 {
1072  return getRow(nTop)->begin();
1073 }
1074 
1075 CellInfoMultiSet::const_iterator WW8TableCellGrid::getCellsEnd(long nTop)
1076 {
1077  return getRow(nTop)->end();
1078 }
1079 
1081  WW8TableNodeInfo * pNodeInfo,
1082  const unsigned long * pFormatFrameWidth)
1083 {
1084  CellInfo aCellInfo(rRect, pNodeInfo);
1085 
1086  if (pFormatFrameWidth != nullptr)
1087  aCellInfo.setFormatFrameWidth(*pFormatFrameWidth);
1088 
1089  WW8TableCellGridRow::Pointer_t pRow = getRow(rRect.Top());
1090  pRow->insert(aCellInfo);
1091 }
1092 
1094 {
1095  SAL_INFO( "sw.ww8", "<addShadowCells>" );
1096 
1097  RowTops_t::const_iterator aTopsIt = getRowTopsBegin();
1098 
1099  while (aTopsIt != getRowTopsEnd())
1100  {
1101  CellInfoMultiSet::const_iterator aCellIt = getCellsBegin(*aTopsIt);
1102  CellInfoMultiSet::const_iterator aCellEndIt = getCellsEnd(*aTopsIt);
1103 
1104  RowSpansPtr pRowSpans(new RowSpans);
1105 
1106  bool bBeginningOfCell = true;
1107  bool bVertMerge = false;
1108  SwRect aRect = aCellIt->getRect();
1109  long nRowSpan = 1;
1110  while (aCellIt != aCellEndIt)
1111  {
1112  WW8TableNodeInfo * pNodeInfo = aCellIt->getTableNodeInfo();
1113 
1114  if (bBeginningOfCell)
1115  {
1116  RowTops_t::const_iterator aRowSpanIt(aTopsIt);
1117  ++aRowSpanIt;
1118 
1119  if (aRowSpanIt != getRowTopsEnd() &&
1120  *aRowSpanIt < aCellIt->bottom())
1121  {
1122  aRect.Top(*aRowSpanIt);
1123  unsigned long nFormatFrameWidth = aCellIt->getFormatFrameWidth();
1124  insert(aRect, nullptr, &nFormatFrameWidth);
1125 
1126  bVertMerge = true;
1127  }
1128  else
1129  bVertMerge = false;
1130 
1131  nRowSpan = 1;
1132  while (aRowSpanIt != getRowTopsEnd() &&
1133  *aRowSpanIt < aCellIt->bottom())
1134  {
1135  ++aRowSpanIt;
1136  nRowSpan++;
1137  }
1138 
1139  if (pNodeInfo)
1140  pRowSpans->push_back(nRowSpan);
1141  else
1142  pRowSpans->push_back(-nRowSpan);
1143  }
1144 
1145  if (pNodeInfo)
1146  {
1147  pNodeInfo->setVertMerge(bVertMerge);
1148  }
1149 
1150  ++aCellIt;
1151  if (aCellIt != aCellEndIt)
1152  {
1153  bBeginningOfCell = (aRect.Left() != aCellIt->left());
1154  aRect = aCellIt->getRect();
1155  }
1156  }
1157 
1158  WW8TableCellGridRow::Pointer_t pRow = getRow(*aTopsIt);
1159  if (pRow.get() != nullptr)
1160  pRow->setRowSpans(pRowSpans);
1161 
1162  ++aTopsIt;
1163  }
1164  SAL_INFO( "sw.ww8", "</addShadowCells>" );
1165 }
1166 
1168 {
1169  RowTops_t::const_iterator aTopsIt = getRowTopsBegin();
1170  sal_uInt32 nRow = 0;
1171  WW8TableNodeInfo * pLastNodeInfo = nullptr;
1172 
1173  while (aTopsIt != getRowTopsEnd())
1174  {
1175  CellInfoMultiSet::const_iterator aCellIt = getCellsBegin(*aTopsIt);
1176  CellInfoMultiSet::const_iterator aCellEndIt = getCellsEnd(*aTopsIt);
1177  GridColsPtr pWidths(new Widths);
1178  TableBoxVectorPtr pTableBoxes(new TableBoxVector);
1179 
1180  sal_uInt32 nShadows = 0;
1181  sal_uInt32 nCell = 0;
1182  bool bBeginningOfCell = true;
1183  WW8TableNodeInfo * pEndOfCellInfo = nullptr;
1184  sal_uInt32 nDepthInCell = 0;
1185  while (aCellIt != aCellEndIt)
1186  {
1187  long nCellX = aCellIt->left();
1188  WW8TableNodeInfo * pNodeInfo = aCellIt->getTableNodeInfo();
1189  if (pNodeInfo)
1190  {
1191  const SwNode * pNode = pNodeInfo->getNode();
1192 
1193  if (pNode->IsStartNode())
1194  {
1195  nDepthInCell++;
1196  pEndOfCellInfo = nullptr;
1197  }
1198 
1199  if (nDepthInCell == 1 && pNode->IsTextNode())
1200  pEndOfCellInfo = pNodeInfo;
1201 
1202  pNodeInfo->setShadowsBefore(nShadows);
1203  pNodeInfo->setCell(nCell);
1204  pNodeInfo->setRow(nRow);
1205  if (pLastNodeInfo)
1206  {
1207  pLastNodeInfo->setNext(pNodeInfo);
1208  pLastNodeInfo->setNextNode(pNode);
1209  }
1210  pLastNodeInfo = pNodeInfo;
1211  nShadows = 0;
1212 
1213  if (pNode->IsEndNode())
1214  {
1215  nDepthInCell--;
1216 
1217  if (nDepthInCell == 0 && !pEndOfCellInfo)
1218  pEndOfCellInfo = pNodeInfo;
1219  }
1220  }
1221  else
1222  {
1223  nShadows++;
1224  }
1225 
1226  if (bBeginningOfCell)
1227  {
1228  pWidths->push_back(aCellIt->getFormatFrameWidth());
1229 
1230  if (pNodeInfo)
1231  pTableBoxes->push_back(pNodeInfo->getTableBox());
1232  else
1233  pTableBoxes->push_back(nullptr);
1234  }
1235 
1236  ++aCellIt;
1237  bBeginningOfCell = false;
1238 
1239  if (aCellIt != aCellEndIt && aCellIt->left() != nCellX)
1240  {
1241  nCell++;
1242  bBeginningOfCell = true;
1243 
1244  if (pEndOfCellInfo)
1245  {
1246  pEndOfCellInfo->setEndOfCell(true);
1247  }
1248 
1249  pEndOfCellInfo = nullptr;
1250  }
1251  }
1252 
1253  pLastNodeInfo->setShadowsAfter(nShadows);
1254 
1255  if (!pEndOfCellInfo)
1256  {
1257  pEndOfCellInfo = pLastNodeInfo;
1258  }
1259 
1260  pEndOfCellInfo->setEndOfCell(true);
1261  pLastNodeInfo->setEndOfLine(true);
1262  updateFinalEndOfLine(rLastRowEnds, pLastNodeInfo);
1263 
1264  WW8TableCellGridRow::Pointer_t pRow(getRow(*aTopsIt));
1265  pRow->setTableBoxVector(pTableBoxes);
1266  pRow->setWidths(pWidths);
1267 
1268  ++aTopsIt;
1269  nRow++;
1270  }
1271 
1272  return pLastNodeInfo;
1273 }
1274 
1275 #ifdef DBG_UTIL
1277 {
1278  std::string sResult = "<WW8TableCellGrid>";
1279 
1280  RowTops_t::const_iterator aTopsIt = getRowTopsBegin();
1281  static char sBuffer[1024];
1282  while (aTopsIt != getRowTopsEnd())
1283  {
1284  sprintf(sBuffer, "<row y=\"%ld\">", *aTopsIt);
1285  sResult += sBuffer;
1286 
1287  CellInfoMultiSet::const_iterator aCellIt = getCellsBegin(*aTopsIt);
1288  CellInfoMultiSet::const_iterator aCellsEnd = getCellsEnd(*aTopsIt);
1289 
1290  while (aCellIt != aCellsEnd)
1291  {
1292  snprintf(sBuffer, sizeof(sBuffer), "<cellInfo top=\"%ld\" bottom=\"%ld\" left=\"%ld\" right=\"%ld\">",
1293  aCellIt->top(), aCellIt->bottom(), aCellIt->left(), aCellIt->right());
1294  sResult += sBuffer;
1295 
1296  WW8TableNodeInfo * pInfo = aCellIt->getTableNodeInfo();
1297  if (pInfo)
1298  sResult += pInfo->toString();
1299  else
1300  sResult += "<shadow/>\n";
1301 
1302  sResult += "</cellInfo>\n";
1303  ++aCellIt;
1304  }
1305 
1306  WW8TableCellGridRow::Pointer_t pRow = getRow(*aTopsIt);
1307  WidthsPtr pWidths = pRow->getWidths();
1308  if (pWidths != nullptr)
1309  {
1310  sResult += "<widths>";
1311 
1312  Widths::const_iterator aItEnd = pWidths->end();
1313  for (Widths::const_iterator aIt = pWidths->begin();
1314  aIt != aItEnd;
1315  ++aIt)
1316  {
1317  if (aIt != pWidths->begin())
1318  sResult += ", ";
1319 
1320  snprintf(sBuffer, sizeof(sBuffer), "%" SAL_PRIxUINT32 "", *aIt);
1321  sResult += sBuffer;
1322  }
1323 
1324  sResult += "</widths>";
1325  }
1326 
1327  RowSpansPtr pRowSpans = pRow->getRowSpans();
1328  if (pRowSpans.get() != nullptr)
1329  {
1330  sResult += "<rowspans>";
1331 
1332  RowSpans::const_iterator aItEnd = pRowSpans->end();
1333  for (RowSpans::const_iterator aIt = pRowSpans->begin();
1334  aIt != aItEnd;
1335  ++aIt)
1336  {
1337  if (aIt != pRowSpans->begin())
1338  sResult += ", ";
1339 
1340  snprintf(sBuffer, sizeof(sBuffer), "%" SAL_PRIxUINT32 "", *aIt);
1341  sResult += sBuffer;
1342  }
1343 
1344  sResult += "</rowspans>";
1345  }
1346 
1347  sResult += "</row>\n";
1348  ++aTopsIt;
1349  }
1350 
1351  sResult += "</WW8TableCellGrid>\n";
1352 
1353  return sResult;
1354 }
1355 #endif
1356 
1358 (WW8TableNodeInfoInner const * pNodeInfoInner)
1359 {
1360  TableBoxVectorPtr pResult;
1362  getRow(pNodeInfoInner->getRect().Top(), false);
1363 
1364  if (pRow.get() != nullptr)
1365  {
1366  pResult = pRow->getTableBoxVector();
1367  }
1368 
1369  return pResult;
1370 }
1371 
1373 (WW8TableNodeInfoInner const * pNodeInfoInner)
1374 {
1375  GridColsPtr pResult;
1376 
1378  getRow(pNodeInfoInner->getRect().Top(), false);
1379 
1380  if (pRow.get() != nullptr)
1381  {
1382  pResult = pRow->getWidths();
1383  }
1384 
1385  return pResult;
1386 }
1387 
1389 (WW8TableNodeInfoInner const * pNodeInfoInner)
1390 {
1391  RowSpansPtr pResult;
1392 
1394  getRow(pNodeInfoInner->getRect().Top(), false);
1395 
1396  if (pRow.get() != nullptr)
1397  {
1398  pResult = pRow->getRowSpans();
1399  }
1400 
1401  return pResult;
1402 }
1403 
1405 : m_pCellInfos(new CellInfoMultiSet)
1406 {
1407 }
1408 
1410 {
1411 }
1412 
1413 void WW8TableCellGridRow::insert(const CellInfo & rCellInfo)
1414 {
1415  m_pCellInfos->insert(rCellInfo);
1416 
1417 #ifdef DBG_UTIL
1418  SAL_INFO( "sw.ww8", "<gridRowInsert>" << rCellInfo.toString() << "</gridRowInsert>" );
1419 #endif
1420 }
1421 
1422 CellInfoMultiSet::const_iterator WW8TableCellGridRow::begin() const
1423 {
1424  return m_pCellInfos->begin();
1425 }
1426 
1427 CellInfoMultiSet::const_iterator WW8TableCellGridRow::end() const
1428 {
1429  return m_pCellInfos->end();
1430 }
1431 
1433 {
1434  if (pTableBoxVector->size() > MAXTABLECELLS)
1435  pTableBoxVector->resize(MAXTABLECELLS);
1436  m_pTableBoxVector = pTableBoxVector;
1437 }
1438 
1440 {
1441  m_pWidths = pWidths;
1442 }
1443 
1445 {
1446  m_pRowSpans = pRowSpans;
1447 }
1448 
1449 
1450 CellInfo::CellInfo(const SwRect & aRect, WW8TableNodeInfo * pNodeInfo)
1451 : m_aRect(aRect), m_pNodeInfo(pNodeInfo), m_nFormatFrameWidth(0)
1452 {
1453  if (pNodeInfo != nullptr)
1454  {
1455  const SwTableBox * pBox = pNodeInfo->getTableBox();
1456  const SwFrameFormat * pFrameFormat = pBox->GetFrameFormat();
1457  const SwFormatFrameSize & rSize = pFrameFormat->GetFrameSize();
1458 
1459  m_nFormatFrameWidth = rSize.GetWidth();
1460  }
1461 }
1462 
1463 }
1464 
1465 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long width() const
void setNext(WW8TableNodeInfo *pNext)
bool IsTableComplex() const
Definition: swtable.cxx:1445
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
Starts a section of nodes in the document model.
Definition: node.hxx:303
WW8TableNodeInfo::Pointer_t processTableBoxLines(const SwTableBox *pBox, const SwTable *pTable, const SwTableBox *pBoxToSet, sal_uInt32 nRow, sal_uInt32 nCell, sal_uInt32 nDepth)
void setTableBox(const SwTableBox *pTableBox)
std::map< sal_uInt32, WW8TableNodeInfoInner *, std::greater< sal_uInt32 > > RowEndInners_t
sal_uLong GetIndex() const
Definition: node.hxx:282
std::vector< const SwTableBox * > TableBoxVector
long right() const
void setEndOfLine(bool bEndOfLine)
const SwNode * getNode() const
bool HasLayout() const
Definition: swtable.cxx:2748
WW8TableNodeInfo * connectCells(RowEndInners_t &rLastRowEnds)
void setRect(const SwRect &rRect)
long height() const
SwNodeIndex nNode
Definition: pam.hxx:37
void setEndOfCell(bool bEndOfCell)
long GetWidth() const
bool operator<(const WW8TableNodeInfo &rInfo) const
const SwNode * mpNode
sal_uInt32 getDepth() const
TableBoxVectorPtr getTableBoxesOfRow()
WW8TableCellGridRow::Pointer_t getRow(long nTop, bool bCreate=true)
std::vector< sal_Int32 > RowSpans
sal_Int32 const mnRow
void setCell(sal_uInt32 nCell)
const WW8TableNodeInfoInner::Pointer_t getInnerForDepth(sal_uInt32 nDepth) const
void setRect(const SwRect &rRect)
SwTableLine is one table row in the document model.
Definition: swtable.hxx:344
SwNode & GetNode() const
Definition: ndindex.hxx:118
long SwTwips
Definition: swtypes.hxx:49
TableBoxVectorPtr getTableBoxesOfRow(WW8TableNodeInfoInner const *pNodeInfo)
void setTable(const SwTable *pTable)
sal_uInt32 getCell() const
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
WW8TableNodeInfo(WW8TableInfo *pParent, const SwNode *pTextNode)
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
std::shared_ptr< Widths > WidthsPtr
long bottom() const
size_type size() const
Definition: swtable.hxx:74
void Top(const long nTop)
Definition: swrect.hxx:202
WW8TableNodeInfo::Pointer_t insertTableNodeInfo(const SwNode *pNode, const SwTable *pTable, const SwTableBox *pTableBox, sal_uInt32 nRow, sal_uInt32 nCell, sal_uInt32 nDepth, SwRect const *pRect=nullptr)
CellInfoMultiSet::const_iterator getCellsBegin(long nTop)
EdgeEntry * mpNext
const SwTableBox * mpTableBox
void GetTablePageSize(ww8::WW8TableNodeInfoInner const *pTableTextNodeInfoInner, long &rPageSize, bool &rRelBoxSize)
Definition: wrtww8.cxx:2461
bool IsStartNode() const
Definition: node.hxx:624
const SwNode * getNextNode(const SwNode *pNode)
void setTableBoxVector(TableBoxVectorPtr const &pTableBoxVector)
WW8TableNodeInfo * processTableLine(const SwTable *pTable, const SwTableLine *pTableLine, sal_uInt32 nRow, sal_uInt32 nDepth, WW8TableNodeInfo *pPrev, RowEndInners_t &rLastRowEnds)
void setFormatFrameWidth(unsigned long nFormatFrameWidth)
void setShadowsAfter(sal_uInt32 nShadowsAfter)
void Right(const long nRight)
Definition: swrect.hxx:198
void setFirstInTable(bool bFirstInTable)
static void updateFinalEndOfLine(RowEndInners_t &rLastRowEnds, WW8TableNodeInfo const *pEndOfCellInfo)
std::vector< sal_uInt32 > GridCols
void setRow(sal_uInt32 nRow)
WW8TableNodeInfo * reorderByLayout(const SwTable *pTable, RowEndInners_t &rLastRowEnds)
void setWidths(WidthsPtr const &pGridCols)
WW8TableNodeInfoInner(WW8TableNodeInfo *pParent)
void setRowSpans(RowSpansPtr const &pRowSpans)
const SwTableBox * getTableBox() const
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
sal_Int32 mnDepth
Style of a layout element.
Definition: frmfmt.hxx:57
WW8TableNodeInfo * processSwTableByLayout(const SwTable *pTable, RowEndInners_t &rLastRowEnds)
std::vector< sal_uInt32 > Widths
WW8TableInfo * getParent() const
const SwTableBox * getTableBox() const
std::shared_ptr< TableBoxVector > TableBoxVectorPtr
SwEndNode * GetEndNode()
Definition: node.hxx:583
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
void setEndOfCell(bool bEndOfCell)
const SwPosition * GetPoint() const
Definition: pam.hxx:207
const WW8TableNodeInfoInner::Pointer_t getFirstInner() const
bool empty() const
Definition: swtable.hxx:73
const SwNode * getNode() const
WW8TableNodeInfo * mpNext
CellInfoMultiSet::const_iterator begin() const
WidthsPtr getColumnWidthsBasedOnAllRows()
RowSpansPtr getRowSpansOfRow(WW8TableNodeInfoInner const *pNodeInfo)
WW8TableNodeInfo * getNext() const
std::multiset< CellInfo > CellInfoMultiSet
void setFirstInTable(bool bFirstInTable)
std::shared_ptr< GridCols > GridColsPtr
const char * dbg_out(const void *pVoid)
Definition: dbgoutsw.cxx:75
long left() const
WW8TableNodeInfo * processTableBox(const SwTable *pTable, const SwTableBox *pTableBox, sal_uInt32 nRow, sal_uInt32 nCell, sal_uInt32 nDepth, bool bEndOfLine, WW8TableNodeInfo *pPrev, RowEndInners_t &rLastRowEnds)
void processSwTable(const SwTable *pTable)
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:425
bool IsEndNode() const
Definition: node.hxx:632
const SwNode * mpNextNode
std::string toString() const
void setShadowsAfter(sal_uInt32 nShadowsAfter)
void setFinalEndOfLine(bool bEndOfLine)
const SwTableBox * getTableBox() const
Definition: swtable.cxx:2733
void insert(const CellInfo &rCellInfo)
RowTops_t::const_iterator getRowTopsBegin() const
SwTableLines & GetTabLines()
Definition: swtable.hxx:198
void setNextNode(const SwNode *pNode)
RowTops_t::const_iterator getRowTopsEnd() const
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:110
void setDepth(sal_uInt32 nDepth)
SwTableLines & GetTabLines()
Definition: swtable.hxx:418
GridColsPtr getGridColsOfRow(AttributeOutputBase &rBase, bool calculateColumnsFromAllRows=false)
void setCell(sal_uInt32 nCell)
CellInfoMultiSet::const_iterator end() const
void setDepth(sal_uInt32 nDepth)
void Left(const long nLeft)
Definition: swrect.hxx:193
void Bottom(const long nBottom)
Definition: swrect.hxx:207
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:354
std::vector< SwTableBox * > SwTableBoxes
Definition: swtable.hxx:103
WW8TableNodeInfo * getTableNodeInfo() const
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:439
std::string toString() const
std::string toString() const
CellInfo(const SwRect &aRect, WW8TableNodeInfo *pNodeInfo)
void setVertMerge(bool bVertMerge)
WW8TableCellGrid::Pointer_t getCellGridForTable(const SwTable *pTable, bool bCreate=true)
long top() const
unsigned char sal_uInt8
unsigned long m_nFormatFrameWidth
std::shared_ptr< WW8TableCellGrid > Pointer_t
SwRect getRect() const
Definition: swtable.cxx:2723
#define SAL_INFO(area, stream)
void setShadowsBefore(sal_uInt32 nShadowsBefore)
void setRow(sal_uInt32 nRow)
WW8TableNodeInfo::Pointer_t getTableNodeInfo(const SwNode *pNode)
void setEndOfLine(bool bEndOfLine)
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
void setShadowsBefore(sal_uInt32 nShadowsBefore)
std::shared_ptr< WW8TableNodeInfoInner > Pointer_t
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
void insert(const SwRect &rRect, WW8TableNodeInfo *pNodeInfo, unsigned long const *pFormatFrameWidth=nullptr)
const SwTable * getTable() const
WW8TableNodeInfo * mpParent
std::shared_ptr< CellInfoMultiSet > m_pCellInfos
CellInfoMultiSet::const_iterator getCellsEnd(long nTop)
TableBoxVectorPtr m_pTableBoxVector
Ends a section of nodes in the document model.
Definition: node.hxx:333
std::shared_ptr< WW8TableCellGridRow > Pointer_t
std::shared_ptr< RowSpans > RowSpansPtr
void setTableBox(const SwTableBox *pTableBox)
SwTableLine * GetUpper()
Definition: swtable.hxx:421
const SwRect & getRect() const
bool IsTextNode() const
Definition: node.hxx:636
std::shared_ptr< WW8TableNodeInfo > Pointer_t
void setTable(const SwTable *pTable)
WidthsPtr getWidthsOfRow(WW8TableNodeInfoInner const *pNodeInfo)
sal_uInt32 getRow() const
void setVertMerge(bool bVertMerge)
bool operator<(const CellInfo &aCellInfo) const
WW8TableNodeInfo *const m_pNodeInfo
const unsigned int MAXTABLECELLS
OUString toString(OptionInfo const *info)
SwTableNode * GetTableNode() const
Definition: swtable.cxx:1927
Base class of the Writer document model elements.
Definition: node.hxx:79