Bump version to 4.3-4
[LibreOffice.git] / lotuswordpro / source / filter / lwpcelllayout.cxx
blob59d3a08d83ce9605fa5285e90fdf79a546af55a5
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());
95 if(!pRow)
97 return NULL;
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 NULL;
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 // this function is called from LwpTableLayout, so it can't be NULL
125 GetTableLayout()->SetWordProCellMap(crowid, ccolid, this);
128 * @short Get actual width of this cell layout
129 * @param
130 * @return width (cm)
132 double LwpCellLayout::GetActualWidth()
134 //Get table layout
135 LwpTableLayout * pTableLayout = GetTableLayout();
137 if (pTableLayout == NULL)
139 return GetGeometryWidth();
142 OUString strColStyle = pTableLayout->GetColumnWidth(ccolid);
144 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
145 XFColStyle *pStyle = static_cast<XFColStyle *>(pXFStyleManager->FindStyle(strColStyle));
146 if(pStyle)
148 return pStyle->GetWidth();
151 return GetGeometryWidth();
155 * @short Apply padding to cell style
156 * @param pCellStyle - pointer of XFCellStyle
157 * @return
159 void LwpCellLayout::ApplyPadding(XFCellStyle *pCellStyle)
161 double fLeft = GetMarginsValue(MARGIN_LEFT);
162 double fRight = GetMarginsValue(MARGIN_RIGHT);
163 double fTop = GetMarginsValue(MARGIN_TOP);
164 double fBottom = GetMarginsValue(MARGIN_BOTTOM);
165 pCellStyle->SetPadding((float)fLeft,(float)fRight,(float)fTop,(float)fBottom);
168 * @short Apply border to cell style according to cell position, default cell layout won't use this function
169 * @param
170 * @return pCellStyle - pointer of XFCellStyle
172 void LwpCellLayout::ApplyBorders(XFCellStyle *pCellStyle)
174 // judge cell border type
175 LwpCellBorderType eType = GetCellBorderType(crowid, ccolid, GetTableLayout());
177 // get left cell and judge if neighbour border is different
178 XFBorders * pBorders = GetXFBorders();
179 if(!pBorders)
181 return;
184 switch (eType)
186 case enumNoBottomBorder:
187 pBorders->SetWidth(enumXFBorderBottom, 0);
188 break;
189 case enumNoLeftBorder:
190 pBorders->SetWidth(enumXFBorderLeft, 0);
191 break;
192 case enumNoLeftNoBottomBorder:
193 pBorders->SetWidth(enumXFBorderBottom, 0);
194 pBorders->SetWidth(enumXFBorderLeft, 0);
195 break;
196 case enumWholeBorder:
197 break;
198 default:
199 assert(false);
201 pCellStyle->SetBorders(pBorders);
204 * @short Apply watermark to cell style
205 * @param pCellStyle - pointer of XFCellStyle
206 * @return
208 void LwpCellLayout::ApplyWatermark(XFCellStyle *pCellStyle)
210 XFBGImage* pBGImage = GetXFBGImage();
211 if(pBGImage)
213 pCellStyle->SetBackImage(pBGImage);
218 * @short Apply pattern fill to cell style
219 * @param pCellStyle - pointer of XFCellStyle
220 * @return
222 void LwpCellLayout::ApplyPatternFill(XFCellStyle* pCellStyle)
224 XFBGImage* pXFBGImage = this->GetFillPattern();
225 if (pXFBGImage)
227 pCellStyle->SetBackImage(pXFBGImage);
232 * @short Apply background to cell style
233 * @param pCellStyle - pointer of XFCellStyle
234 * @return
236 void LwpCellLayout::ApplyBackGround(XFCellStyle* pCellStyle)
238 if (this->IsPatternFill())
240 ApplyPatternFill(pCellStyle);
242 else
244 ApplyBackColor(pCellStyle);
248 * @short Apply back color to cell style
249 * @param pCellStyle - pointer of XFCellStyle
250 * @return
252 void LwpCellLayout::ApplyBackColor(XFCellStyle *pCellStyle)
254 LwpColor* pColor = GetBackColor();
255 if(pColor && pColor->IsValidColor())
257 XFColor aXFColor(pColor->To24Color());
258 pCellStyle->SetBackColor(aXFColor);
262 * @short register style of cell layout
263 * @param pCellStyle The style of the cell, which would be applied to the cell.
264 * @return
266 void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle)
268 LwpLayoutNumerics* pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(cLayNumerics.obj());
269 if (!pLayoutNumerics)
271 // if current layout doesn't have format, go to based on layout
272 LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(m_BasedOnStyle.obj());
273 if (pCellLayout)
275 pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject()->obj());
279 // apply format style
280 if (pLayoutNumerics)
282 XFStyle* pStyle = pLayoutNumerics->Convert();
283 if (pStyle)
285 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
286 m_NumfmtName = pXFStyleManager->AddStyle(pStyle)->GetStyleName();
287 pCellStyle->SetDataStyle(m_NumfmtName);
291 return;
294 * @short get style name according to cell position, only table default cells use this function
295 * @param nRow - default cell position row number
296 * @param nCol - default cell position col number
297 * @return OUString - registered cell style name
299 OUString LwpCellLayout::GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
301 // judge cell border type
302 LwpCellBorderType eType = GetCellBorderType(nRow, nCol, pTableLayout);
303 return m_CellStyleNames[eType];
306 * Make the XFCell
307 * @date 03/26/2005
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());
318 if (!pTable)
320 assert(false);
321 return NULL;
323 XFCell * pXFCell = new XFCell();
324 OUString aStyleName = m_StyleName;
326 // if cell layout is aTableID's default cell layout
327 // we should judt its style by current position
328 if (*pTable->GetDefaultCellStyle() == *GetObjectID())
330 aStyleName = GetCellStyleName(nRow, nCol, pTable->GetTableLayout());
333 // content of cell
334 LwpStory* pStory = dynamic_cast<LwpStory*>(m_Content.obj());
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 = this->GetPreviousCellStory();
348 if (pPreStoryID && !(pPreStoryID->IsNull()))
350 LwpStory* pPreStory = dynamic_cast<LwpStory*>(pPreStoryID->obj(VO_STORY));
351 return dynamic_cast<LwpPara*>(pPreStory->GetLastPara()->obj(VO_PARA));
353 else
355 return NULL;
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 NULL;
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 NULL;
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 NULL;
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 NULL;
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)
426 assert(false);
427 return enumWholeBorder;
430 // get left cell and judge if neighbour border is different
431 XFBorders * pBorders = GetXFBorders();
432 if(!pBorders)
434 return enumWholeBorder;
436 XFBorder *pLeftBorder = pBorders->GetLeft();
437 XFBorder *pBottomBorder = pBorders->GetBottom();
438 bool bNoLeftBorder = false;
439 bool bNoBottomBorder = false;
441 LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow, GetLeftColID(nCol), pTableLayout);
442 if (pLeftNeighbour)
444 XFBorders * pNeighbourBorders = pLeftNeighbour->GetXFBorders();
445 if (pNeighbourBorders)
447 XFBorder * pRightBorder = pNeighbourBorders->GetRight();
448 if (*pLeftBorder == *pRightBorder)
450 // for these 2 types cell, left border should be ignored for sake of avoiding duplication border
451 // but if left border is different with right border of left cell
452 // we should not ignored it
453 bNoLeftBorder = true;
455 delete pNeighbourBorders;
460 LwpCellLayout * pBelowNeighbour = GetCellByRowCol(GetBelowRowID(nRow), nCol, pTableLayout);
461 if (pBelowNeighbour) //&& (eType == enumRightNotLastCellBorder || eType == enumLeftNotLastCellBorder) )
463 XFBorders * pBelowBorders = pBelowNeighbour->GetXFBorders();
464 if (pBelowBorders)
466 XFBorder * pTopBorder = pBelowBorders->GetTop();
467 if (*pTopBorder == *pBottomBorder)
469 // for these 2 types cell, bottom border should be ignored for sake of avoiding duplication border
470 // but if bottom border is different with right border of left cell
471 // we should not ignored it
472 bNoBottomBorder = true;
474 delete pBelowBorders;
478 delete pBorders;
480 if (bNoBottomBorder)
482 if (bNoLeftBorder)
484 return enumNoLeftNoBottomBorder;
486 return enumNoBottomBorder;
488 if (bNoLeftBorder)
490 return enumNoLeftBorder;
492 return enumWholeBorder;
496 * @short Get neighbour cell by specifying ROW+COL
497 * @param nRow
498 * @param nCol
499 * @return LwpCellLayout *
501 LwpCellLayout * LwpCellLayout::GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
503 return pTableLayout->GetCellByRowCol(nRow, nCol);
506 * @short Register table's default cell layout
507 * @param
508 * @return
510 void LwpCellLayout::RegisterDefaultCell()
512 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
513 for (sal_uInt16 eLoop = enumWholeBorder; eLoop < enumCellBorderTopLimit; eLoop++)
515 // register cell style
516 XFCellStyle *pCellStyle = new XFCellStyle();
518 ApplyPadding(pCellStyle);
519 ApplyBackColor(pCellStyle);
520 ApplyWatermark(pCellStyle);
521 ApplyFmtStyle(pCellStyle);
522 pCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
524 XFBorders * pBorders = GetXFBorders();
525 if (pBorders)
527 switch(eLoop)
529 case enumNoBottomBorder:
531 //| |
533 // remove bottom line
534 pBorders->SetWidth(enumXFBorderBottom, 0);
535 break;
536 case enumNoLeftNoBottomBorder:
538 // |
540 // remove left and bottom
541 pBorders->SetWidth(enumXFBorderLeft, 0);
542 pBorders->SetWidth(enumXFBorderBottom, 0);
543 break;
544 case enumWholeBorder:
546 //||
548 // nothing to remove
549 break;
550 case enumNoLeftBorder:
552 //| |
554 // remove left line
555 pBorders->SetWidth(enumXFBorderLeft, 0);
556 break;
557 default:
558 assert(false);
560 pCellStyle->SetBorders(pBorders);
562 m_CellStyleNames[eLoop] = pXFStyleManager->AddStyle(pCellStyle)->GetStyleName();
566 * @short Register 4 types of cell style and register content styles
567 * @param
568 * @param
569 * @param
570 * @return
572 void LwpCellLayout::RegisterStyle()
574 LwpVirtualLayout * pParent = dynamic_cast<LwpVirtualLayout *>(GetParent()->obj());
575 if (!pParent || pParent->GetLayoutType() != LWP_ROW_LAYOUT)
577 // default cell layout, we must register 4 styles for it
578 RegisterDefaultCell();
579 return;
582 // register cell style
583 XFCellStyle *pCellStyle = new XFCellStyle();
585 ApplyPadding(pCellStyle);
586 // ApplyBackColor(pCellStyle);
587 ApplyBackGround(pCellStyle);
588 ApplyWatermark(pCellStyle);
589 ApplyFmtStyle(pCellStyle);
590 ApplyBorders(pCellStyle);
592 pCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
594 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
595 m_StyleName = pXFStyleManager->AddStyle(pCellStyle)->GetStyleName();
597 // content object register styles
598 LwpObject * pObj = m_Content.obj();
599 if (pObj)
601 pObj->SetFoundry(m_pFoundry);
602 pObj->RegisterStyle();
605 //register child layout style
606 RegisterChildStyle();
609 * @short Read cell layout
610 * @param
611 * @return
613 void LwpCellLayout::Read()
615 LwpObjectStream* pStrm = m_pObjStrm;
617 LwpMiddleLayout::Read();
619 // before the layout hierarchy rework
620 if (LwpFileHeader::m_nFileRevision < 0x000b)
622 assert(false);
624 else
626 crowid = pStrm->QuickReaduInt16();
627 ccolid = (sal_uInt8) pStrm->QuickReaduInt16(); // written as a lushort
629 sal_uInt16 type;
631 type = pStrm->QuickReaduInt16();
632 pStrm->SkipExtra();
633 cType = (LeaderDotType)type;
635 cLayNumerics.ReadIndexed(pStrm);
636 cLayDiagonalLine.ReadIndexed(pStrm);
638 pStrm->SkipExtra();
643 * Apply protect attribute to cell of table
644 * @date 04/04/2005
645 * @param aTableID - ID of the table which the cell belongs to
646 * @param
647 * @return XFCell*
649 void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
651 bool bProtected = false;
652 // judge current cell
653 if (IsProtected())
655 bProtected = true;
657 else
659 // judge base on
660 LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(m_BasedOnStyle.obj());
661 if (pBase && pBase->IsProtected())
663 bProtected = true;
665 else
667 // judge whole table
668 LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj());
669 LwpTableLayout * pTableLayout = pTable ? static_cast<LwpTableLayout *>(pTable->GetTableLayout()) : NULL;
670 LwpSuperTableLayout * pSuper = pTableLayout ? pTableLayout->GetSuperTableLayout() : NULL;
671 if (pSuper && pSuper->IsProtected())
673 bProtected = true;
678 pCell->SetProtect(bProtected);
681 LwpConnectedCellLayout::LwpConnectedCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
682 : LwpCellLayout(objHdr, pStrm)
683 , cnumrows(0)
684 , cnumcols(0)
685 , m_nRealrowspan(0)
686 , m_nRealcolspan(0)
690 LwpConnectedCellLayout::~LwpConnectedCellLayout()
693 * @short Set current connected cell layout to cell layout map
694 * @param pCellLayoutMap - cell layout map reference
695 * @return
697 void LwpConnectedCellLayout::SetCellMap()
699 // this function is called from LwpTableLayout, so it can't be NULL
700 LwpTableLayout * pTableLayout = GetTableLayout();
701 sal_uInt16 nRowSpan = m_nRealrowspan;
703 for (sal_uInt16 iLoop = 0; iLoop < nRowSpan; iLoop ++)
705 for (sal_uInt16 jLoop = 0; jLoop < cnumcols; jLoop ++)
706 pTableLayout->SetWordProCellMap(iLoop + crowid, jLoop + ccolid, this);
711 * @short judge border type by cell neighbour
712 * @param nRow
713 * @param nCol
714 * @param pTableLayout
715 * @return LwpCellBorderType
717 LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
719 if (!pTableLayout)
721 assert(false);
722 return enumWholeBorder;
725 sal_uInt16 nRowSpan = m_nRealrowspan;
727 // get left cell and judge if neighbour border is different
728 XFBorders * pBorders = GetXFBorders();
729 if(!pBorders)
731 return enumWholeBorder;
733 XFBorder *pLeftBorder = pBorders->GetLeft();
734 XFBorder *pBottomBorder = pBorders->GetBottom();
735 bool bNoLeftBorder = true;
736 bool bNoBottomBorder = true;
738 if (nCol == 0)
740 bNoLeftBorder = false;
742 else
744 for (sal_uInt16 iLoop=0; iLoop < nRowSpan; iLoop++)
746 LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow+iLoop, GetLeftColID(nCol), pTableLayout);
747 if (pLeftNeighbour)
749 boost::scoped_ptr<XFBorders> pNeighbourBorders(pLeftNeighbour->GetXFBorders());
750 if (pNeighbourBorders)
752 XFBorder * pRightBorder = pNeighbourBorders->GetRight();
753 if (*pLeftBorder != *pRightBorder)
755 // if left border is different with right border of left cell
756 // we should not ignored it
757 bNoLeftBorder = false;
758 break;
765 if ( (nRow + nRowSpan) == pTableLayout->GetTable()->GetRow() )
767 bNoBottomBorder = false;
769 else
771 for (sal_uInt16 iLoop = 0; iLoop < cnumcols; iLoop ++)
773 LwpCellLayout * pBelowNeighbour = GetCellByRowCol(nRow + nRowSpan, nCol+iLoop, pTableLayout);
774 if (pBelowNeighbour)
776 boost::scoped_ptr<XFBorders> pBelowBorders(pBelowNeighbour->GetXFBorders());
777 if (pBelowBorders)
779 XFBorder * pTopBorder = pBelowBorders->GetTop();
780 if (*pTopBorder != *pBottomBorder)
782 // if bottom border is different with right border of left cell
783 // we should not ignored it
784 bNoBottomBorder = false;
785 break;
791 delete pBorders;
793 if (bNoBottomBorder)
795 if (bNoLeftBorder)
797 return enumNoLeftNoBottomBorder;
799 return enumNoBottomBorder;
801 if (bNoLeftBorder)
803 return enumNoLeftBorder;
805 return enumWholeBorder;
808 * @short Read connected cell layout
809 * @param
810 * @return
812 void LwpConnectedCellLayout::Read()
814 LwpCellLayout::Read();
815 sal_uInt16 numcols;
817 cnumrows = m_pObjStrm->QuickReaduInt16();
818 numcols = m_pObjStrm->QuickReaduInt16(); // written as a lushort
819 cnumcols = (sal_uInt8)numcols;
821 m_nRealrowspan = cnumrows;
822 m_nRealcolspan = cnumcols;
824 m_pObjStrm->SkipExtra();
826 XFCell* LwpConnectedCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
828 XFCell * pXFCell = LwpCellLayout::ConvertCell(aTableID, nRow, nCol);
829 pXFCell->SetColumnSpaned(cnumcols);
830 // if(!m_bSplitFlag)
831 // {
832 // }
833 return pXFCell;
836 * @short parse connected cell layout
837 * @param pOutputStream - output stream
838 * @return
840 void LwpConnectedCellLayout::Parse(IXFStream* /*pOutputStream*/)
844 LwpHiddenCellLayout::LwpHiddenCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
845 : LwpCellLayout(objHdr, pStrm)
848 LwpHiddenCellLayout::~LwpHiddenCellLayout()
851 * @short Set current hidden cell layout to cell layout map
852 * @param
853 * @return
855 void LwpHiddenCellLayout::SetCellMap()
857 return;
860 * @short Read hidden cell layout
861 * @param
862 * @return
864 void LwpHiddenCellLayout::Read()
866 LwpCellLayout::Read();
868 cconnectedlayout.ReadIndexed(m_pObjStrm);
869 m_pObjStrm->SkipExtra();
873 * @short Convert hidden cell layout
874 * @param aTableID - Object ID of table
875 * @return XFCell * - pointer to converted cell
878 XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
880 if (!cconnectedlayout.obj())
881 return NULL;
882 LwpConnectedCellLayout* pConnCell = dynamic_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj());
884 if (!pConnCell || nRow < (pConnCell->GetNumrows()+pConnCell->GetRowID()))
885 return NULL;
886 // if the hidden cell should be displayed for limit of SODC
887 // use the default cell layout
888 XFCell* pXFCell = NULL;
889 LwpTable *pTable = dynamic_cast<LwpTable *>(aTableID.obj());
890 if (pTable)
892 LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle()->obj());
893 if (pDefault)
895 pXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
897 else
899 pXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol);
901 pXFCell->SetColumnSpaned(pConnCell->GetNumcols());
903 else
905 assert(false);
907 return pXFCell;
910 * @short parse hidden cell layout
911 * @param pOutputStream - output stream
912 * @return
914 void LwpHiddenCellLayout::Parse(IXFStream* /*pOutputStream*/)
918 LwpParallelColumnsBlock::LwpParallelColumnsBlock(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpCellLayout(objHdr, pStrm)
921 LwpParallelColumnsBlock::~LwpParallelColumnsBlock()
924 void LwpParallelColumnsBlock::Read()
926 LwpCellLayout::Read();
927 m_pObjStrm->SkipExtra();
930 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */