fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / lotuswordpro / source / filter / lwpcelllayout.cxx
blob39717cd1d45c1f56c655dddd150ad787c9e44b34
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 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().get());
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().get());
273 if (pCellLayout)
275 pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject().obj().get());
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).m_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().get());
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().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 = this->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 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& rLeftBorder = pBorders->GetLeft();
437 XFBorder& rBottomBorder = 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& rRightBorder = pNeighbourBorders->GetRight();
448 if (rLeftBorder == rRightBorder)
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& rTopBorder = pBelowBorders->GetTop();
467 if (rTopBorder == rBottomBorder)
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)).m_pStyle->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().get());
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 ApplyBackGround(pCellStyle);
587 ApplyWatermark(pCellStyle);
588 ApplyFmtStyle(pCellStyle);
589 ApplyBorders(pCellStyle);
591 pCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
593 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
594 m_StyleName = (pXFStyleManager->AddStyle(pCellStyle)).m_pStyle->GetStyleName();
596 // content object register styles
597 rtl::Reference<LwpObject> pObj = m_Content.obj();
598 if (pObj.is())
600 pObj->SetFoundry(m_pFoundry);
601 pObj->RegisterStyle();
604 //register child layout style
605 RegisterChildStyle();
608 * @short Read cell layout
609 * @param
610 * @return
612 void LwpCellLayout::Read()
614 LwpObjectStream* pStrm = m_pObjStrm;
616 LwpMiddleLayout::Read();
618 // before the layout hierarchy rework
619 if (LwpFileHeader::m_nFileRevision < 0x000b)
621 assert(false);
623 else
625 crowid = pStrm->QuickReaduInt16();
626 ccolid = (sal_uInt8) pStrm->QuickReaduInt16(); // written as a lushort
628 sal_uInt16 type;
630 type = pStrm->QuickReaduInt16();
631 pStrm->SkipExtra();
632 cType = (LeaderDotType)type;
634 cLayNumerics.ReadIndexed(pStrm);
635 cLayDiagonalLine.ReadIndexed(pStrm);
637 pStrm->SkipExtra();
642 * Apply protect attribute to cell of table
643 * @date 04/04/2005
644 * @param aTableID - ID of the table which the cell belongs to
645 * @param
646 * @return XFCell*
648 void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
650 bool bProtected = false;
651 // judge current cell
652 if (IsProtected())
654 bProtected = true;
656 else
658 // judge base on
659 LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(m_BasedOnStyle.obj().get());
660 if (pBase && pBase->IsProtected())
662 bProtected = true;
664 else
666 // judge whole table
667 LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
668 LwpTableLayout * pTableLayout = pTable ? static_cast<LwpTableLayout *>(pTable->GetTableLayout()) : NULL;
669 LwpSuperTableLayout * pSuper = pTableLayout ? pTableLayout->GetSuperTableLayout() : NULL;
670 if (pSuper && pSuper->IsProtected())
672 bProtected = true;
677 pCell->SetProtect(bProtected);
680 LwpConnectedCellLayout::LwpConnectedCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
681 : LwpCellLayout(objHdr, pStrm)
682 , cnumrows(0)
683 , cnumcols(0)
684 , m_nRealrowspan(0)
685 , m_nRealcolspan(0)
689 LwpConnectedCellLayout::~LwpConnectedCellLayout()
692 * @short Set current connected cell layout to cell layout map
693 * @param pCellLayoutMap - cell layout map reference
694 * @return
696 void LwpConnectedCellLayout::SetCellMap()
698 // this function is called from LwpTableLayout, so it can't be NULL
699 LwpTableLayout * pTableLayout = GetTableLayout();
700 sal_uInt16 nRowSpan = m_nRealrowspan;
702 for (sal_uInt16 iLoop = 0; iLoop < nRowSpan; iLoop ++)
704 for (sal_uInt16 jLoop = 0; jLoop < cnumcols; jLoop ++)
705 pTableLayout->SetWordProCellMap(iLoop + crowid, jLoop + ccolid, this);
710 * @short judge border type by cell neighbour
711 * @param nRow
712 * @param nCol
713 * @param pTableLayout
714 * @return LwpCellBorderType
716 LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
718 if (!pTableLayout)
720 assert(false);
721 return enumWholeBorder;
724 sal_uInt16 nRowSpan = m_nRealrowspan;
726 // get left cell and judge if neighbour border is different
727 XFBorders * pBorders = GetXFBorders();
728 if(!pBorders)
730 return enumWholeBorder;
732 XFBorder& rLeftBorder = pBorders->GetLeft();
733 XFBorder& rBottomBorder = pBorders->GetBottom();
734 bool bNoLeftBorder = true;
735 bool bNoBottomBorder = true;
737 if (nCol == 0)
739 bNoLeftBorder = false;
741 else
743 for (sal_uInt16 iLoop=0; iLoop < nRowSpan; iLoop++)
745 LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow+iLoop, GetLeftColID(nCol), pTableLayout);
746 if (pLeftNeighbour)
748 boost::scoped_ptr<XFBorders> pNeighbourBorders(pLeftNeighbour->GetXFBorders());
749 if (pNeighbourBorders)
751 XFBorder& rRightBorder = pNeighbourBorders->GetRight();
752 if (rLeftBorder != rRightBorder)
754 // if left border is different with right border of left cell
755 // we should not ignored it
756 bNoLeftBorder = false;
757 break;
764 if ( (nRow + nRowSpan) == pTableLayout->GetTable()->GetRow() )
766 bNoBottomBorder = false;
768 else
770 for (sal_uInt16 iLoop = 0; iLoop < cnumcols; iLoop ++)
772 LwpCellLayout * pBelowNeighbour = GetCellByRowCol(nRow + nRowSpan, nCol+iLoop, pTableLayout);
773 if (pBelowNeighbour)
775 boost::scoped_ptr<XFBorders> pBelowBorders(pBelowNeighbour->GetXFBorders());
776 if (pBelowBorders)
778 XFBorder& rTopBorder = pBelowBorders->GetTop();
779 if (rTopBorder != rBottomBorder)
781 // if bottom border is different with right border of left cell
782 // we should not ignored it
783 bNoBottomBorder = false;
784 break;
790 delete pBorders;
792 if (bNoBottomBorder)
794 if (bNoLeftBorder)
796 return enumNoLeftNoBottomBorder;
798 return enumNoBottomBorder;
800 if (bNoLeftBorder)
802 return enumNoLeftBorder;
804 return enumWholeBorder;
807 * @short Read connected cell layout
808 * @param
809 * @return
811 void LwpConnectedCellLayout::Read()
813 LwpCellLayout::Read();
814 sal_uInt16 numcols;
816 cnumrows = m_pObjStrm->QuickReaduInt16();
817 numcols = m_pObjStrm->QuickReaduInt16(); // written as a lushort
818 cnumcols = (sal_uInt8)numcols;
820 m_nRealrowspan = cnumrows;
821 m_nRealcolspan = cnumcols;
823 m_pObjStrm->SkipExtra();
825 XFCell* LwpConnectedCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
827 XFCell * pXFCell = LwpCellLayout::ConvertCell(aTableID, nRow, nCol);
828 pXFCell->SetColumnSpaned(cnumcols);
829 // if(!m_bSplitFlag)
830 // {
831 // }
832 return pXFCell;
835 * @short parse connected cell layout
836 * @param pOutputStream - output stream
837 * @return
839 void LwpConnectedCellLayout::Parse(IXFStream* /*pOutputStream*/)
843 LwpHiddenCellLayout::LwpHiddenCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
844 : LwpCellLayout(objHdr, pStrm)
847 LwpHiddenCellLayout::~LwpHiddenCellLayout()
850 * @short Set current hidden cell layout to cell layout map
851 * @param
852 * @return
854 void LwpHiddenCellLayout::SetCellMap()
856 return;
859 * @short Read hidden cell layout
860 * @param
861 * @return
863 void LwpHiddenCellLayout::Read()
865 LwpCellLayout::Read();
867 cconnectedlayout.ReadIndexed(m_pObjStrm);
868 m_pObjStrm->SkipExtra();
872 * @short Convert hidden cell layout
873 * @param aTableID - Object ID of table
874 * @return XFCell * - pointer to converted cell
877 XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
879 if (!cconnectedlayout.obj().is())
880 return NULL;
881 LwpConnectedCellLayout* pConnCell = dynamic_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj().get());
883 if (!pConnCell || nRow < (pConnCell->GetNumrows()+pConnCell->GetRowID()))
884 return NULL;
885 // if the hidden cell should be displayed for limit of SODC
886 // use the default cell layout
887 XFCell* pXFCell = NULL;
888 LwpTable *pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
889 if (pTable)
891 LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle().obj().get());
892 if (pDefault)
894 pXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
896 else
898 pXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol);
900 pXFCell->SetColumnSpaned(pConnCell->GetNumcols());
902 else
904 assert(false);
906 return pXFCell;
909 * @short parse hidden cell layout
910 * @param pOutputStream - output stream
911 * @return
913 void LwpHiddenCellLayout::Parse(IXFStream* /*pOutputStream*/)
917 LwpParallelColumnsBlock::LwpParallelColumnsBlock(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpCellLayout(objHdr, pStrm)
920 LwpParallelColumnsBlock::~LwpParallelColumnsBlock()
923 void LwpParallelColumnsBlock::Read()
925 LwpCellLayout::Read();
926 m_pObjStrm->SkipExtra();
929 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */