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