lok: re-load UNO bootstrap pieces and set UserInstallation on second init.
[LibreOffice.git] / lotuswordpro / source / filter / lwpcelllayout.cxx
blob087566c698c4e3ea028bb2c9eb87d506a7375cd1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
12 * GNU Lesser General Public License Version 2.1
13 * =============================================
14 * Copyright 2000 by Sun Microsystems, Inc.
15 * 901 San Antonio Road, Palo Alto, CA 94303, USA
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License version 2.1, as published by the Free Software Foundation.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
32 * Sun Industry Standards Source License Version 1.1
33 * =================================================
34 * The contents of this file are subject to the Sun Industry Standards
35 * Source License Version 1.1 (the "License"); You may not use this file
36 * except in compliance with the License. You may obtain a copy of the
37 * License at http://www.openoffice.org/license.html.
39 * Software provided under this License is provided on an "AS IS" basis,
40 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 * See the License for the specific provisions governing your rights and
44 * obligations concerning the Software.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /**
57 * @file
58 * For LWP filter architecture prototype - cell layouts
61 #include "lwpcelllayout.hxx"
62 #include "lwpfoundry.hxx"
63 #include "lwpobjfactory.hxx"
64 #include "lwptblcell.hxx"
65 #include "lwptblformula.hxx"
66 #include "lwpholder.hxx"
67 #include "lwpnumericfmt.hxx"
68 #include "lwptable.hxx"
69 #include "lwpglobalmgr.hxx"
71 #include "xfilter/xfstylemanager.hxx"
72 #include "xfilter/xfcell.hxx"
73 #include "xfilter/xfcellstyle.hxx"
74 #include "xfilter/xfcolstyle.hxx"
76 LwpCellLayout::LwpCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
77 : LwpMiddleLayout(objHdr, pStrm)
78 , crowid(0)
79 , ccolid(0)
80 , cType(LDT_NONE)
84 LwpCellLayout::~LwpCellLayout()
87 /**
88 * @short Get table layout pointer, if default cell layout, return NULL
89 * @param LwpTableLayout *
90 * @return
92 LwpTableLayout * LwpCellLayout::GetTableLayout()
94 LwpRowLayout * pRow = dynamic_cast<LwpRowLayout *>(GetParent().obj().get());
95 if(!pRow)
97 return nullptr;
99 LwpTableLayout * pTableLayout = pRow->GetParentTableLayout();
100 return pTableLayout;
103 * @short Get table pointer, if default cell layout, return NULL
104 * @param LwpTable *
105 * @return
107 LwpTable * LwpCellLayout::GetTable()
109 LwpTableLayout * pTableLayout = GetTableLayout();
110 if(!pTableLayout)
112 return nullptr;
114 LwpTable *pTable = pTableLayout->GetTable();
115 return pTable;
118 * @short Set current cell layout to cell layout map
119 * @param
120 * @return
122 void LwpCellLayout::SetCellMap()
124 LwpTableLayout * pTableLayout = GetTableLayout();
125 if (pTableLayout)
126 pTableLayout->SetWordProCellMap(crowid, ccolid, this);
129 * @short Get actual width of this cell layout
130 * @param
131 * @return width (cm)
133 double LwpCellLayout::GetActualWidth()
135 //Get table layout
136 LwpTableLayout * pTableLayout = GetTableLayout();
138 if (pTableLayout == nullptr)
140 return GetGeometryWidth();
143 OUString strColStyle = pTableLayout->GetColumnWidth(ccolid);
145 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
146 XFColStyle *pStyle = static_cast<XFColStyle *>(pXFStyleManager->FindStyle(strColStyle));
147 if(pStyle)
149 return pStyle->GetWidth();
152 return GetGeometryWidth();
156 * @short Apply padding to cell style
157 * @param pCellStyle - pointer of XFCellStyle
158 * @return
160 void LwpCellLayout::ApplyPadding(XFCellStyle *pCellStyle)
162 double fLeft = GetMarginsValue(MARGIN_LEFT);
163 double fRight = GetMarginsValue(MARGIN_RIGHT);
164 double fTop = GetMarginsValue(MARGIN_TOP);
165 double fBottom = GetMarginsValue(MARGIN_BOTTOM);
166 pCellStyle->SetPadding((float)fLeft,(float)fRight,(float)fTop,(float)fBottom);
169 * @short Apply border to cell style according to cell position, default cell layout won't use this function
170 * @param
171 * @return pCellStyle - pointer of XFCellStyle
173 void LwpCellLayout::ApplyBorders(XFCellStyle *pCellStyle)
175 // judge cell border type
176 LwpCellBorderType eType = GetCellBorderType(crowid, ccolid, GetTableLayout());
178 // get left cell and judge if neighbour border is different
179 XFBorders * pBorders = GetXFBorders();
180 if(!pBorders)
182 return;
185 switch (eType)
187 case enumNoBottomBorder:
188 pBorders->SetWidth(enumXFBorderBottom, 0);
189 break;
190 case enumNoLeftBorder:
191 pBorders->SetWidth(enumXFBorderLeft, 0);
192 break;
193 case enumNoLeftNoBottomBorder:
194 pBorders->SetWidth(enumXFBorderBottom, 0);
195 pBorders->SetWidth(enumXFBorderLeft, 0);
196 break;
197 case enumWholeBorder:
198 break;
199 default:
200 assert(false);
202 pCellStyle->SetBorders(pBorders);
205 * @short Apply watermark to cell style
206 * @param pCellStyle - pointer of XFCellStyle
207 * @return
209 void LwpCellLayout::ApplyWatermark(XFCellStyle *pCellStyle)
211 XFBGImage* pBGImage = GetXFBGImage();
212 if(pBGImage)
214 pCellStyle->SetBackImage(pBGImage);
219 * @short Apply pattern fill to cell style
220 * @param pCellStyle - pointer of XFCellStyle
221 * @return
223 void LwpCellLayout::ApplyPatternFill(XFCellStyle* pCellStyle)
225 XFBGImage* pXFBGImage = GetFillPattern();
226 if (pXFBGImage)
228 pCellStyle->SetBackImage(pXFBGImage);
233 * @short Apply background to cell style
234 * @param pCellStyle - pointer of XFCellStyle
235 * @return
237 void LwpCellLayout::ApplyBackGround(XFCellStyle* pCellStyle)
239 if (IsPatternFill())
241 ApplyPatternFill(pCellStyle);
243 else
245 ApplyBackColor(pCellStyle);
249 * @short Apply back color to cell style
250 * @param pCellStyle - pointer of XFCellStyle
251 * @return
253 void LwpCellLayout::ApplyBackColor(XFCellStyle *pCellStyle)
255 LwpColor* pColor = GetBackColor();
256 if(pColor && pColor->IsValidColor())
258 XFColor aXFColor(pColor->To24Color());
259 pCellStyle->SetBackColor(aXFColor);
263 * @short register style of cell layout
264 * @param pCellStyle The style of the cell, which would be applied to the cell.
265 * @return
267 void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle)
269 LwpLayoutNumerics* pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(cLayNumerics.obj().get());
270 if (!pLayoutNumerics)
272 // if current layout doesn't have format, go to based on layout
273 LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(GetBasedOnStyle().get());
274 if (pCellLayout)
276 pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject().obj().get());
280 // apply format style
281 if (pLayoutNumerics)
283 XFStyle* pStyle = pLayoutNumerics->Convert();
284 if (pStyle)
286 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
287 m_NumfmtName = pXFStyleManager->AddStyle(pStyle).m_pStyle->GetStyleName();
288 pCellStyle->SetDataStyle(m_NumfmtName);
292 return;
295 * @short get style name according to cell position, only table default cells use this function
296 * @param nRow - default cell position row number
297 * @param nCol - default cell position col number
298 * @return OUString - registered cell style name
300 OUString const & LwpCellLayout::GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
302 // judge cell border type
303 LwpCellBorderType eType = GetCellBorderType(nRow, nCol, pTableLayout);
304 return m_CellStyleNames[eType];
307 * Make the XFCell
308 * @param aTableID - ID of the table which this cell belongs to
309 * @param bIsTopRow - whether current cell is top row
310 * @param bIsRightCol - whether current cell is the rightest column
311 * @return XFCell*
313 XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
315 // if cell layout is aTableID's default cell layout
316 // it can't have any content, bypass these code
317 LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
318 if (!pTable)
320 assert(false);
321 return nullptr;
323 XFCell * pXFCell = new XFCell();
324 OUString aStyleName = m_StyleName;
326 // if cell layout is aTableID's default cell layout
327 // we should adjust its style by current position
328 if (pTable->GetDefaultCellStyle() == GetObjectID())
330 aStyleName = GetCellStyleName(nRow, nCol, pTable->GetTableLayout().get());
333 // content of cell
334 LwpStory* pStory = dynamic_cast<LwpStory*>(m_Content.obj().get());
335 if (pStory)
337 pStory->XFConvert(pXFCell);
340 ApplyProtect(pXFCell, aTableID);
341 pXFCell->SetStyleName(aStyleName);
342 return pXFCell;
345 LwpPara* LwpCellLayout::GetLastParaOfPreviousStory()
347 LwpObjectID* pPreStoryID = GetPreviousCellStory();
348 if (pPreStoryID && !(pPreStoryID->IsNull()))
350 LwpStory* pPreStory = dynamic_cast<LwpStory*>(pPreStoryID->obj(VO_STORY).get());
351 return dynamic_cast<LwpPara*>(pPreStory->GetLastPara().obj(VO_PARA).get());
353 else
355 return nullptr;
360 * @short Get previous cell which used for bullet inside cell
361 * @param
362 * @return LwpObjectID * - object ID of cell content story
364 LwpObjectID * LwpCellLayout::GetPreviousCellStory()
366 LwpTable *pTable = GetTable();
367 if (!pTable)
369 assert(false);
370 return nullptr;
372 sal_uInt16 nRow = crowid;
373 sal_uInt16 nCol = ccolid;
375 // if table is reset paragraph in columns, get cell on the top side of current cell
376 if (pTable->IsNumberDown())
378 if (nRow == 0)
380 return nullptr;
382 nRow -=1;
384 else
386 // if not, get cell on the left side of current cell
387 if (nCol == 0)
389 if (nRow == 0)
391 return nullptr;
393 else
395 nRow--;
396 nCol = pTable->GetColumn() - 1;
399 else
401 nCol -=1;
405 // get the object id pointer of previous cell story
406 LwpTableLayout * pTableLayout = GetTableLayout();
407 if (!pTableLayout)
409 assert(false);
410 return nullptr;
412 return pTableLayout->SearchCellStoryMap(nRow, nCol);
416 * @short judge border type by cell neighbour
417 * @param nRow
418 * @param nCol
419 * @param pTableLayout
420 * @return LwpCellBorderType
422 LwpCellBorderType LwpCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
424 if (!pTableLayout)
425 return enumWholeBorder;
427 // get left cell and judge if neighbour border is different
428 XFBorders * pBorders = GetXFBorders();
429 if(!pBorders)
431 return enumWholeBorder;
433 XFBorder& rLeftBorder = pBorders->GetLeft();
434 XFBorder& rBottomBorder = pBorders->GetBottom();
435 bool bNoLeftBorder = false;
436 bool bNoBottomBorder = false;
438 LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow, GetLeftColID(nCol), pTableLayout);
439 if (pLeftNeighbour)
441 XFBorders * pNeighbourBorders = pLeftNeighbour->GetXFBorders();
442 if (pNeighbourBorders)
444 XFBorder& rRightBorder = pNeighbourBorders->GetRight();
445 if (rLeftBorder == rRightBorder)
447 // for these 2 types cell, left border should be ignored for sake of avoiding duplication border
448 // but if left border is different with right border of left cell
449 // we should not ignored it
450 bNoLeftBorder = true;
452 delete pNeighbourBorders;
457 LwpCellLayout * pBelowNeighbour = GetCellByRowCol(GetBelowRowID(nRow), nCol, pTableLayout);
458 if (pBelowNeighbour) //&& (eType == enumRightNotLastCellBorder || eType == enumLeftNotLastCellBorder) )
460 XFBorders * pBelowBorders = pBelowNeighbour->GetXFBorders();
461 if (pBelowBorders)
463 XFBorder& rTopBorder = pBelowBorders->GetTop();
464 if (rTopBorder == rBottomBorder)
466 // for these 2 types cell, bottom border should be ignored for sake of avoiding duplication border
467 // but if bottom border is different with right border of left cell
468 // we should not ignored it
469 bNoBottomBorder = true;
471 delete pBelowBorders;
475 delete pBorders;
477 if (bNoBottomBorder)
479 if (bNoLeftBorder)
481 return enumNoLeftNoBottomBorder;
483 return enumNoBottomBorder;
485 if (bNoLeftBorder)
487 return enumNoLeftBorder;
489 return enumWholeBorder;
493 * @short Get neighbour cell by specifying ROW+COL
494 * @param nRow
495 * @param nCol
496 * @return LwpCellLayout *
498 LwpCellLayout * LwpCellLayout::GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
500 return pTableLayout->GetCellByRowCol(nRow, nCol);
503 * @short Register table's default cell layout
504 * @param
505 * @return
507 void LwpCellLayout::RegisterDefaultCell()
509 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
510 for (sal_uInt16 eLoop = enumWholeBorder; eLoop < enumCellBorderTopLimit; eLoop++)
512 // register cell style
513 XFCellStyle *pCellStyle = new XFCellStyle();
515 ApplyPadding(pCellStyle);
516 ApplyBackColor(pCellStyle);
517 ApplyWatermark(pCellStyle);
518 ApplyFmtStyle(pCellStyle);
519 pCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
521 XFBorders * pBorders = GetXFBorders();
522 if (pBorders)
524 switch(eLoop)
526 case enumNoBottomBorder:
528 //| |
530 // remove bottom line
531 pBorders->SetWidth(enumXFBorderBottom, 0);
532 break;
533 case enumNoLeftNoBottomBorder:
535 // |
537 // remove left and bottom
538 pBorders->SetWidth(enumXFBorderLeft, 0);
539 pBorders->SetWidth(enumXFBorderBottom, 0);
540 break;
541 case enumWholeBorder:
543 //||
545 // nothing to remove
546 break;
547 case enumNoLeftBorder:
549 //| |
551 // remove left line
552 pBorders->SetWidth(enumXFBorderLeft, 0);
553 break;
554 default:
555 assert(false);
557 pCellStyle->SetBorders(pBorders);
559 m_CellStyleNames[eLoop] = (pXFStyleManager->AddStyle(pCellStyle)).m_pStyle->GetStyleName();
563 * @short Register 4 types of cell style and register content styles
564 * @param
565 * @param
566 * @param
567 * @return
569 void LwpCellLayout::RegisterStyle()
571 rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout *>(GetParent().obj().get()));
572 if (!xParent.is() || xParent->GetLayoutType() != LWP_ROW_LAYOUT)
574 // default cell layout, we must register 4 styles for it
575 RegisterDefaultCell();
576 return;
579 // register cell style
580 XFCellStyle *pCellStyle = new XFCellStyle();
582 ApplyPadding(pCellStyle);
583 ApplyBackGround(pCellStyle);
584 ApplyWatermark(pCellStyle);
585 ApplyFmtStyle(pCellStyle);
586 ApplyBorders(pCellStyle);
588 pCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
590 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
591 m_StyleName = (pXFStyleManager->AddStyle(pCellStyle)).m_pStyle->GetStyleName();
593 // content object register styles
594 rtl::Reference<LwpObject> pObj = m_Content.obj();
595 if (pObj.is())
597 pObj->SetFoundry(m_pFoundry);
598 pObj->DoRegisterStyle();
601 //register child layout style
602 RegisterChildStyle();
605 * @short Read cell layout
606 * @param
607 * @return
609 void LwpCellLayout::Read()
611 LwpObjectStream* pStrm = m_pObjStrm;
613 LwpMiddleLayout::Read();
615 // before the layout hierarchy rework
616 if (LwpFileHeader::m_nFileRevision < 0x000b)
618 assert(false);
620 else
622 crowid = pStrm->QuickReaduInt16();
623 ccolid = (sal_uInt8) pStrm->QuickReaduInt16(); // written as a lushort
625 sal_uInt16 type;
627 type = pStrm->QuickReaduInt16();
628 pStrm->SkipExtra();
629 cType = (LeaderDotType)type;
631 cLayNumerics.ReadIndexed(pStrm);
632 cLayDiagonalLine.ReadIndexed(pStrm);
634 pStrm->SkipExtra();
639 * Apply protect attribute to cell of table
640 * @param aTableID - ID of the table which the cell belongs to
641 * @param
642 * @return XFCell*
644 void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
646 bool bProtected = false;
647 // judge current cell
648 if (GetIsProtected())
650 bProtected = true;
652 else
654 // judge base on
655 LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(GetBasedOnStyle().get());
656 if (pBase && pBase->GetIsProtected())
658 bProtected = true;
660 else
662 // judge whole table
663 LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
664 rtl::Reference<LwpTableLayout> xTableLayout(pTable ? pTable->GetTableLayout() : nullptr);
665 LwpSuperTableLayout * pSuper = xTableLayout.is() ? xTableLayout->GetSuperTableLayout() : nullptr;
666 if (pSuper && pSuper->GetIsProtected())
668 bProtected = true;
673 pCell->SetProtect(bProtected);
676 LwpConnectedCellLayout::LwpConnectedCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
677 : LwpCellLayout(objHdr, pStrm)
678 , cnumrows(0)
679 , cnumcols(0)
680 , m_nRealrowspan(0)
681 , m_nRealcolspan(0)
685 LwpConnectedCellLayout::~LwpConnectedCellLayout()
688 * @short Set current connected cell layout to cell layout map
689 * @param pCellLayoutMap - cell layout map reference
690 * @return
692 void LwpConnectedCellLayout::SetCellMap()
694 LwpTableLayout * pTableLayout = GetTableLayout();
695 if (!pTableLayout)
696 return;
698 sal_uInt16 nRowSpan = m_nRealrowspan;
700 for (sal_uInt16 iLoop = 0; iLoop < nRowSpan; iLoop ++)
702 for (sal_uInt16 jLoop = 0; jLoop < cnumcols; jLoop ++)
703 pTableLayout->SetWordProCellMap(iLoop + crowid, jLoop + ccolid, this);
708 * @short judge border type by cell neighbour
709 * @param nRow
710 * @param nCol
711 * @param pTableLayout
712 * @return LwpCellBorderType
714 LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
716 if (!pTableLayout)
718 assert(false);
719 return enumWholeBorder;
722 sal_uInt16 nRowSpan = m_nRealrowspan;
724 // get left cell and judge if neighbour border is different
725 XFBorders * pBorders = GetXFBorders();
726 if(!pBorders)
728 return enumWholeBorder;
730 XFBorder& rLeftBorder = pBorders->GetLeft();
731 XFBorder& rBottomBorder = pBorders->GetBottom();
732 bool bNoLeftBorder = true;
733 bool bNoBottomBorder = true;
735 if (nCol == 0)
737 bNoLeftBorder = false;
739 else
741 for (sal_uInt16 iLoop=0; iLoop < nRowSpan; iLoop++)
743 LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow+iLoop, GetLeftColID(nCol), pTableLayout);
744 if (pLeftNeighbour)
746 std::unique_ptr<XFBorders> pNeighbourBorders(pLeftNeighbour->GetXFBorders());
747 if (pNeighbourBorders)
749 XFBorder& rRightBorder = pNeighbourBorders->GetRight();
750 if (rLeftBorder != rRightBorder)
752 // if left border is different with right border of left cell
753 // we should not ignored it
754 bNoLeftBorder = false;
755 break;
762 LwpTable* pTable = pTableLayout->GetTable();
763 if (!pTable)
764 throw std::runtime_error("missing table");
766 if ( (nRow + nRowSpan) == pTable->GetRow())
768 bNoBottomBorder = false;
770 else
772 for (sal_uInt16 iLoop = 0; iLoop < cnumcols; iLoop ++)
774 LwpCellLayout * pBelowNeighbour = GetCellByRowCol(nRow + nRowSpan, nCol+iLoop, pTableLayout);
775 if (pBelowNeighbour)
777 std::unique_ptr<XFBorders> pBelowBorders(pBelowNeighbour->GetXFBorders());
778 if (pBelowBorders)
780 XFBorder& rTopBorder = pBelowBorders->GetTop();
781 if (rTopBorder != rBottomBorder)
783 // if bottom border is different with right border of left cell
784 // we should not ignored it
785 bNoBottomBorder = false;
786 break;
792 delete pBorders;
794 if (bNoBottomBorder)
796 if (bNoLeftBorder)
798 return enumNoLeftNoBottomBorder;
800 return enumNoBottomBorder;
802 if (bNoLeftBorder)
804 return enumNoLeftBorder;
806 return enumWholeBorder;
809 * @short Read connected cell layout
810 * @param
811 * @return
813 void LwpConnectedCellLayout::Read()
815 LwpCellLayout::Read();
816 sal_uInt16 numcols;
818 cnumrows = m_pObjStrm->QuickReaduInt16();
819 numcols = m_pObjStrm->QuickReaduInt16(); // written as a lushort
820 cnumcols = (sal_uInt8)numcols;
822 m_nRealrowspan = cnumrows;
823 m_nRealcolspan = cnumcols;
825 m_pObjStrm->SkipExtra();
827 XFCell* LwpConnectedCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
829 XFCell * pXFCell = LwpCellLayout::ConvertCell(aTableID, nRow, nCol);
830 pXFCell->SetColumnSpaned(cnumcols);
831 // if(!m_bSplitFlag)
832 // {
833 // }
834 return pXFCell;
837 * @short parse connected cell layout
838 * @param pOutputStream - output stream
839 * @return
841 void LwpConnectedCellLayout::Parse(IXFStream* /*pOutputStream*/)
845 LwpHiddenCellLayout::LwpHiddenCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
846 : LwpCellLayout(objHdr, pStrm)
849 LwpHiddenCellLayout::~LwpHiddenCellLayout()
852 * @short Set current hidden cell layout to cell layout map
853 * @param
854 * @return
856 void LwpHiddenCellLayout::SetCellMap()
858 return;
861 * @short Read hidden cell layout
862 * @param
863 * @return
865 void LwpHiddenCellLayout::Read()
867 LwpCellLayout::Read();
869 cconnectedlayout.ReadIndexed(m_pObjStrm);
870 m_pObjStrm->SkipExtra();
874 * @short Convert hidden cell layout
875 * @param aTableID - Object ID of table
876 * @return XFCell * - pointer to converted cell
879 XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
881 if (!cconnectedlayout.obj().is())
882 return nullptr;
883 LwpConnectedCellLayout* pConnCell = dynamic_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj().get());
885 if (!pConnCell || nRow < (pConnCell->GetNumrows()+pConnCell->GetRowID()))
886 return nullptr;
887 // if the hidden cell should be displayed for limit of SODC
888 // use the default cell layout
889 XFCell* pXFCell = nullptr;
890 LwpTable *pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
891 if (pTable)
893 LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle().obj().get());
894 if (pDefault)
896 pXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
898 else
900 pXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol);
902 pXFCell->SetColumnSpaned(pConnCell->GetNumcols());
904 else
906 assert(false);
908 return pXFCell;
911 * @short parse hidden cell layout
912 * @param pOutputStream - output stream
913 * @return
915 void LwpHiddenCellLayout::Parse(IXFStream* /*pOutputStream*/)
919 LwpParallelColumnsBlock::LwpParallelColumnsBlock(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpCellLayout(objHdr, pStrm)
922 LwpParallelColumnsBlock::~LwpParallelColumnsBlock()
925 void LwpParallelColumnsBlock::Read()
927 LwpCellLayout::Read();
928 m_pObjStrm->SkipExtra();
931 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */