merge the formfield patch from ooo-build
[ooovba.git] / lotuswordpro / source / filter / lwpcelllayout.cxx
blob5e40fbb1824ed76a5564eeb98624f8f220f77a3c
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /**
56 * @file
57 * For LWP filter architecture prototype - cell layouts
59 /*************************************************************************
60 * Change History
61 April 2005 Created
62 ************************************************************************/
63 #include "lwpcelllayout.hxx"
64 #include "lwpfoundry.hxx"
65 #include "lwpobjfactory.hxx"
66 #include "lwptblcell.hxx"
67 #include "lwptblformula.hxx"
68 #include "lwpholder.hxx"
69 #include "lwpnumericfmt.hxx"
70 #include "lwptable.hxx"
71 #include "lwpglobalmgr.hxx"
73 #include "xfilter/xfstylemanager.hxx"
74 #include "xfilter/xfcell.hxx"
75 #include "xfilter/xfcellstyle.hxx"
76 #include "xfilter/xfcolstyle.hxx"
78 LwpCellLayout::LwpCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
79 : LwpMiddleLayout(objHdr, pStrm)
82 LwpCellLayout::~LwpCellLayout()
85 /**
86 * @short Get table layout pointer, if default cell layout, return NULL
87 * @param LwpTableLayout *
88 * @return
90 LwpTableLayout * LwpCellLayout::GetTableLayout()
92 LwpRowLayout * pRow = static_cast<LwpRowLayout *>(GetParent()->obj());
93 if(!pRow)
95 return NULL;
97 LwpTableLayout * pTableLayout = pRow->GetParentTableLayout();
98 return pTableLayout;
101 * @short Get table pointer, if default cell layout, return NULL
102 * @param LwpTable *
103 * @return
105 LwpTable * LwpCellLayout::GetTable()
107 LwpTableLayout * pTableLayout = GetTableLayout();
108 if(!pTableLayout)
110 return NULL;
112 LwpTable *pTable = pTableLayout->GetTable();
113 return pTable;
116 * @short Set current cell layout to cell layout map
117 * @param
118 * @return
120 void LwpCellLayout::SetCellMap()
122 // this function is called from LwpTableLayout, so it can't be NULL
123 GetTableLayout()->SetWordProCellMap(crowid, ccolid, this);
126 * @short Get actual width of this cell layout
127 * @param
128 * @return width (cm)
130 double LwpCellLayout::GetActualWidth()
132 //Get table layout
133 LwpTableLayout * pTableLayout = GetTableLayout();
135 if (pTableLayout == NULL)
137 return GetGeometryWidth();
140 OUString strColStyle = pTableLayout->GetColumnWidth(ccolid);
142 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
143 XFColStyle *pStyle = static_cast<XFColStyle *>(pXFStyleManager->FindStyle(strColStyle));
144 if(pStyle)
146 return pStyle->GetWidth();
149 return GetGeometryWidth();
153 * @short Apply padding to cell style
154 * @param pCellStyle - pointer of XFCellStyle
155 * @return
157 void LwpCellLayout::ApplyPadding(XFCellStyle *pCellStyle)
159 double fLeft = GetMarginsValue(MARGIN_LEFT);
160 double fRight = GetMarginsValue(MARGIN_RIGHT);
161 double fTop = GetMarginsValue(MARGIN_TOP);
162 double fBottom = GetMarginsValue(MARGIN_BOTTOM);
163 pCellStyle->SetPadding((float)fLeft,(float)fRight,(float)fTop,(float)fBottom);
166 * @short Apply border to cell style according to cell position, default cell layout won't use this function
167 * @param
168 * @return pCellStyle - pointer of XFCellStyle
170 void LwpCellLayout::ApplyBorders(XFCellStyle *pCellStyle)
172 // judge cell border type
173 LwpCellBorderType eType = GetCellBorderType(crowid, ccolid, GetTableLayout());
175 // get left cell and judge if neighbour border is different
176 XFBorders * pBorders = GetXFBorders();
177 if(!pBorders)
179 return;
182 switch (eType)
184 case enumNoBottomBorder:
185 pBorders->SetWidth(enumXFBorderBottom, 0);
186 break;
187 case enumNoLeftBorder:
188 pBorders->SetWidth(enumXFBorderLeft, 0);
189 break;
190 case enumNoLeftNoBottomBorder:
191 pBorders->SetWidth(enumXFBorderBottom, 0);
192 pBorders->SetWidth(enumXFBorderLeft, 0);
193 break;
194 case enumWholeBorder:
195 break;
196 default:
197 assert(sal_False);
199 pCellStyle->SetBorders(pBorders);
202 * @short Apply watermark to cell style
203 * @param pCellStyle - pointer of XFCellStyle
204 * @return
206 void LwpCellLayout::ApplyWatermark(XFCellStyle *pCellStyle)
208 XFBGImage* pBGImage = GetXFBGImage();
209 if(pBGImage)
211 pCellStyle->SetBackImage(pBGImage);
216 * @short Apply pattern fill to cell style
217 * @param pCellStyle - pointer of XFCellStyle
218 * @return
220 void LwpCellLayout::ApplyPatternFill(XFCellStyle* pCellStyle)
222 XFBGImage* pXFBGImage = this->GetFillPattern();
223 if (pXFBGImage)
225 pCellStyle->SetBackImage(pXFBGImage);
230 * @short Apply background to cell style
231 * @param pCellStyle - pointer of XFCellStyle
232 * @return
234 void LwpCellLayout::ApplyBackGround(XFCellStyle* pCellStyle)
236 if (this->IsPatternFill())
238 ApplyPatternFill(pCellStyle);
240 else
242 ApplyBackColor(pCellStyle);
246 * @short Apply back color to cell style
247 * @param pCellStyle - pointer of XFCellStyle
248 * @return
250 void LwpCellLayout::ApplyBackColor(XFCellStyle *pCellStyle)
252 LwpColor* pColor = GetBackColor();
253 if(pColor && pColor->IsValidColor())
255 XFColor aXFColor(pColor->To24Color());
256 pCellStyle->SetBackColor(aXFColor);
260 * @short register style of cell layout
261 * @param pCellStyle The style of the cell, which would be applied to the cell.
262 * @return
264 void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle)
266 LwpLayoutNumerics* pLayoutNumerics =(LwpLayoutNumerics*)cLayNumerics.obj();
267 if (!pLayoutNumerics)
269 // if current layout doesn't have format, go to based on layout
270 LwpCellLayout* pCellLayout = (LwpCellLayout*)m_BasedOnStyle.obj();
271 if (pCellLayout)
273 pLayoutNumerics = (LwpLayoutNumerics*)pCellLayout->GetNumericsObject()->obj();
277 // apply format style
278 if (pLayoutNumerics)
280 XFStyle* pStyle = pLayoutNumerics->Convert();
281 if (pStyle)
283 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
284 m_NumfmtName = pXFStyleManager->AddStyle(pStyle)->GetStyleName();
285 pCellStyle->SetDataStyle(m_NumfmtName);//modified by ,2005/11/30
289 return;
292 * @short get style name according to cell position, only table default cells use this function
293 * @param nRow - default cell position row number
294 * @param nCol - default cell position col number
295 * @return OUString - registered cell style name
297 OUString LwpCellLayout::GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
299 // judge cell border type
300 LwpCellBorderType eType = GetCellBorderType(nRow, nCol, pTableLayout);
301 return m_CellStyleNames[eType];
304 * Make the XFCell
305 * @date 03/26/2005
306 * @param aTableID - ID of the table which this cell belongs to
307 * @param bIsTopRow - whether current cell is top row
308 * @param bIsRightCol - whether current cell is the rightest column
309 * @return XFCell*
311 XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
313 // if cell layout is aTableID's default cell layout
314 // it can't have any content, bypass these code
315 LwpTable * pTable = static_cast<LwpTable *>(aTableID.obj());
316 if (!pTable)
318 assert(sal_False);
319 return NULL;
321 XFCell * pXFCell = new XFCell();
322 OUString aStyleName = m_StyleName;
324 // if cell layout is aTableID's default cell layout
325 // we should judt its style by current positon
326 if (*pTable->GetDefaultCellStyle() == *GetObjectID())
328 aStyleName = GetCellStyleName(nRow, nCol, pTable->GetTableLayout());
331 // content of cell
332 LwpStory* pStory =(LwpStory*) m_Content.obj();
333 if (pStory)
335 pStory->XFConvert(pXFCell);
338 ApplyProtect(pXFCell, aTableID);
339 pXFCell->SetStyleName(aStyleName);
340 return pXFCell;
343 LwpPara* LwpCellLayout::GetLastParaOfPreviousStory()
345 LwpObjectID* pPreStoryID = this->GetPreviousCellStory();
346 if (pPreStoryID && !(pPreStoryID->IsNull()))
348 LwpStory* pPreStory = static_cast<LwpStory*>(pPreStoryID->obj(VO_STORY));
349 return static_cast<LwpPara*>(pPreStory->GetLastPara()->obj(VO_PARA));
351 else
353 return NULL;
358 * @short Get previous cell which used for bullet inside cell
359 * @param
360 * @return LwpObjectID * - object ID of cell content story
362 LwpObjectID * LwpCellLayout::GetPreviousCellStory()
364 LwpTable *pTable = GetTable();
365 if (!pTable)
367 assert(sal_False);
368 return NULL;
370 sal_uInt16 nRow = crowid;
371 sal_uInt16 nCol = ccolid;
373 // if table is reset paragraph in columns, get cell on the top side of current cell
374 if (pTable->IsNumberDown())
376 if (nRow == 0)
378 return NULL;
380 nRow -=1;
382 else
384 // if not, get cell on the left side of current cell
385 if (nCol == 0)
387 if (nRow == 0)
389 return NULL;
391 else
393 nRow--;
394 nCol = pTable->GetColumn() - 1;
397 else
399 nCol -=1;
403 // get the object id pointer of previous cell story
404 LwpTableLayout * pTableLayout = GetTableLayout();
405 if (!pTableLayout)
407 assert(sal_False);
408 return NULL;
410 return pTableLayout->SearchCellStoryMap(nRow, nCol);
414 * @short judge border type by cell neighbour
415 * @param nRow
416 * @param nCol
417 * @param pTableLayout
418 * @return LwpCellBorderType
420 LwpCellBorderType LwpCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
422 if (!pTableLayout)
424 assert(sal_False);
425 return enumWholeBorder;
428 // get left cell and judge if neighbour border is different
429 XFBorders * pBorders = GetXFBorders();
430 if(!pBorders)
432 return enumWholeBorder;
434 XFBorder *pLeftBorder = pBorders->GetLeft();
435 XFBorder *pBottomBorder = pBorders->GetBottom();
436 sal_Bool bNoLeftBorder = sal_False;
437 sal_Bool bNoBottomBorder = sal_False;
439 LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow, GetLeftColID(nCol), pTableLayout);
440 if (pLeftNeighbour)
442 XFBorders * pNeighbourBorders = pLeftNeighbour->GetXFBorders();
443 if (pNeighbourBorders)
445 XFBorder * pRightBorder = pNeighbourBorders->GetRight();
446 if (*pLeftBorder == *pRightBorder)
448 // for these 2 types cell, left border should be ignored for sake of avoiding duplication border
449 // but if left border is different with right border of left cell
450 // we should not ignored it
451 bNoLeftBorder = sal_True;
453 delete pNeighbourBorders;
458 LwpCellLayout * pBelowNeighbour = GetCellByRowCol(GetBelowRowID(nRow), nCol, pTableLayout);
459 if (pBelowNeighbour) //&& (eType == enumRightNotLastCellBorder || eType == enumLeftNotLastCellBorder) )
461 XFBorders * pBelowBorders = pBelowNeighbour->GetXFBorders();
462 if (pBelowBorders)
464 XFBorder * pTopBorder = pBelowBorders->GetTop();
465 if (*pTopBorder == *pBottomBorder)
467 // for these 2 types cell, bottom border should be ignored for sake of avoiding duplication border
468 // but if bottom border is different with right border of left cell
469 // we should not ignored it
470 bNoBottomBorder = sal_True;
472 delete pBelowBorders;
476 delete pBorders;
478 if (bNoBottomBorder)
480 if (bNoLeftBorder)
482 return enumNoLeftNoBottomBorder;
484 return enumNoBottomBorder;
486 if (bNoLeftBorder)
488 return enumNoLeftBorder;
490 return enumWholeBorder;
494 * @short Get neighbour cell by specifying ROW+COL
495 * @param nRow
496 * @param nCol
497 * @return LwpCellLayout *
499 LwpCellLayout * LwpCellLayout::GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
501 return pTableLayout->GetCellByRowCol(nRow, nCol);
504 * @short Register table's default cell layout
505 * @param
506 * @return
508 void LwpCellLayout::RegisterDefaultCell()
510 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
511 for (sal_uInt16 eLoop = enumWholeBorder; eLoop < enumCellBorderTopLimit; eLoop++)
513 // register cell style
514 XFCellStyle *pCellStyle = new XFCellStyle();
516 ApplyPadding(pCellStyle);
517 ApplyBackColor(pCellStyle);
518 ApplyWatermark(pCellStyle);
519 ApplyFmtStyle(pCellStyle);
520 pCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
522 XFBorders * pBorders = GetXFBorders();
523 if (pBorders)
525 switch(eLoop)
527 case enumNoBottomBorder:
528 // _
529 //| |
531 // remove bottom line
532 pBorders->SetWidth(enumXFBorderBottom, 0);
533 break;
534 case enumNoLeftNoBottomBorder:
535 // _
536 // |
538 // remove left and bottom
539 pBorders->SetWidth(enumXFBorderLeft, 0);
540 pBorders->SetWidth(enumXFBorderBottom, 0);
541 break;
542 case enumWholeBorder:
543 //--
544 //||
545 //--
546 // nothing to remove
547 break;
548 case enumNoLeftBorder:
550 //| |
551 //--
552 // remove left line
553 pBorders->SetWidth(enumXFBorderLeft, 0);
554 break;
555 default:
556 assert(sal_False);
558 pCellStyle->SetBorders(pBorders);
560 m_CellStyleNames[eLoop] = pXFStyleManager->AddStyle(pCellStyle)->GetStyleName();
564 * @short Register 4 types of cell style and register content styles
565 * @param
566 * @param
567 * @param
568 * @return
570 void LwpCellLayout::RegisterStyle()
572 LwpVirtualLayout * pParent = static_cast<LwpVirtualLayout *>(GetParent()->obj());
573 if (!pParent || pParent->GetLayoutType() != LWP_ROW_LAYOUT)
575 // default cell layout, we must register 4 styles for it
576 RegisterDefaultCell();
577 return;
580 // register cell style
581 XFCellStyle *pCellStyle = new XFCellStyle();
583 ApplyPadding(pCellStyle);
584 // ApplyBackColor(pCellStyle);
585 ApplyBackGround(pCellStyle);
586 ApplyWatermark(pCellStyle);
587 ApplyFmtStyle(pCellStyle);
588 ApplyBorders(pCellStyle);
590 pCellStyle->SetAlignType(enumXFAlignNone, GetVerticalAlignmentType());
592 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
593 m_StyleName = pXFStyleManager->AddStyle(pCellStyle)->GetStyleName();
595 // content object register styles
596 LwpObject * pObj = m_Content.obj();
597 if (pObj)
599 pObj->SetFoundry(m_pFoundry);
600 pObj->RegisterStyle();
603 //register child layout style
604 RegisterChildStyle();
606 LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
607 while(pLayout)
609 pLayout->SetFoundry(m_pFoundry);
610 pLayout->RegisterStyle();
611 pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
616 * @short Read cell layout
617 * @param
618 * @return
620 void LwpCellLayout::Read()
622 LwpObjectStream* pStrm = m_pObjStrm;
624 LwpMiddleLayout::Read();
626 // before the layout hierarchy rework
627 if (LwpFileHeader::m_nFileRevision < 0x000b)
629 assert(sal_False);
631 else
633 crowid = pStrm->QuickReaduInt16();
634 ccolid = (sal_uInt8) pStrm->QuickReaduInt16(); // written as a lushort
636 sal_uInt16 type;
638 type = pStrm->QuickReaduInt16();
639 pStrm->SkipExtra();
640 cType = (LeaderDotType)type;
642 cLayNumerics.ReadIndexed(pStrm);
643 cLayDiagonalLine.ReadIndexed(pStrm);
645 pStrm->SkipExtra();
649 * @short Get leader char
650 * @param none
651 * @return char ascii, if none, return 0
653 sal_uInt8 LwpCellLayout::GetLeaderChar()
655 switch(cType)
657 case LDT_NONE:
658 return 0;
659 case LDT_DOTS:
660 return '.';
661 case LDT_DASHES:
662 return '-';
663 case LDT_UNDERSCORES:
664 return '_';
665 default:
666 assert(sal_False);
668 return 0;
671 * Apply protect attribute to cell of table
672 * @date 04/04/2005
673 * @param aTableID - ID of the table which the cell belongs to
674 * @param
675 * @return XFCell*
677 void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
679 sal_Bool bProtected = sal_False;
680 // judge current cell
681 if (IsProtected())
683 bProtected = sal_True;
685 else
687 // judge base on
688 LwpCellLayout * pBase = static_cast<LwpCellLayout *>(m_BasedOnStyle.obj());
689 if (pBase && pBase->IsProtected())
691 bProtected = sal_True;
693 else
695 // judge whole table
696 LwpTable * pTable = static_cast<LwpTable *>(aTableID.obj());
697 LwpTableLayout * pTableLayout = static_cast<LwpTableLayout *>(pTable->GetTableLayout());
698 LwpSuperTableLayout * pSuper = pTableLayout->GetSuperTableLayout();
699 if (pSuper && pSuper->IsProtected())
701 bProtected = sal_True;
706 pCell->SetProtect(bProtected);
710 LwpConnectedCellLayout::LwpConnectedCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
711 : LwpCellLayout(objHdr, pStrm)
714 LwpConnectedCellLayout::~LwpConnectedCellLayout()
717 * @short Set current connected cell layout to cell layout map
718 * @param pCellLayoutMap - cell layout map reference
719 * @return
721 void LwpConnectedCellLayout::SetCellMap()
723 // this function is called from LwpTableLayout, so it can't be NULL
724 LwpTableLayout * pTableLayout = GetTableLayout();
725 sal_uInt16 nRowSpan = m_nRealrowspan;
727 for (sal_uInt16 iLoop = 0; iLoop < nRowSpan; iLoop ++)
729 for (sal_uInt16 jLoop = 0; jLoop < cnumcols; jLoop ++)
730 pTableLayout->SetWordProCellMap(iLoop + crowid, jLoop + ccolid, this);
735 * @short judge border type by cell neighbour
736 * @param nRow
737 * @param nCol
738 * @param pTableLayout
739 * @return LwpCellBorderType
741 LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
743 if (!pTableLayout)
745 assert(sal_False);
746 return enumWholeBorder;
749 sal_uInt16 nRowSpan = m_nRealrowspan;
751 // get left cell and judge if neighbour border is different
752 XFBorders * pBorders = GetXFBorders();
753 if(!pBorders)
755 return enumWholeBorder;
757 XFBorder *pLeftBorder = pBorders->GetLeft();
758 XFBorder *pBottomBorder = pBorders->GetBottom();
759 sal_Bool bNoLeftBorder = sal_True;
760 sal_Bool bNoBottomBorder = sal_True;
762 if (nCol == 0)
764 bNoLeftBorder = sal_False;
766 else
768 for (sal_uInt16 iLoop=0; iLoop < nRowSpan; iLoop++)
770 LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow+iLoop, GetLeftColID(nCol), pTableLayout);
771 if (pLeftNeighbour)
773 XFBorders * pNeighbourBorders = pLeftNeighbour->GetXFBorders();
774 if (pNeighbourBorders)
776 XFBorder * pRightBorder = pNeighbourBorders->GetRight();
777 if (*pLeftBorder != *pRightBorder)
779 // if left border is different with right border of left cell
780 // we should not ignored it
781 bNoLeftBorder = sal_False;
782 break;
784 delete pNeighbourBorders;
790 if ( (nRow + nRowSpan) == pTableLayout->GetTable()->GetRow() )
792 bNoBottomBorder = sal_False;
794 else
796 for (sal_uInt16 iLoop = 0; iLoop < cnumcols; iLoop ++)
798 LwpCellLayout * pBelowNeighbour = GetCellByRowCol(nRow + nRowSpan, nCol+iLoop, pTableLayout);
799 if (pBelowNeighbour)
801 XFBorders * pBelowBorders = pBelowNeighbour->GetXFBorders();
802 if (pBelowBorders)
804 XFBorder * pTopBorder = pBelowBorders->GetTop();
805 if (*pTopBorder != *pBottomBorder)
807 // if bottom border is different with right border of left cell
808 // we should not ignored it
809 bNoBottomBorder = sal_False;
810 break;
812 delete pBelowBorders;
817 delete pBorders;
819 if (bNoBottomBorder)
821 if (bNoLeftBorder)
823 return enumNoLeftNoBottomBorder;
825 return enumNoBottomBorder;
827 if (bNoLeftBorder)
829 return enumNoLeftBorder;
831 return enumWholeBorder;
834 * @short Read connected cell layout
835 * @param
836 * @return
838 void LwpConnectedCellLayout::Read()
840 LwpCellLayout::Read();
841 sal_uInt16 numcols;
843 cnumrows = m_pObjStrm->QuickReaduInt16();
844 numcols = m_pObjStrm->QuickReaduInt16(); // written as a lushort
845 cnumcols = (sal_uInt8)numcols;
847 m_nRealrowspan = cnumrows;
848 m_nRealcolspan = cnumcols;
850 m_pObjStrm->SkipExtra();
852 XFCell* LwpConnectedCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
854 XFCell * pXFCell = LwpCellLayout::ConvertCell(aTableID, nRow, nCol);
855 pXFCell->SetColumnSpaned(cnumcols);
856 // if(!m_bSplitFlag)
857 // {
858 // }
859 return pXFCell;
862 * @short parse connected cell layout
863 * @param pOutputStream - output stream
864 * @return
866 void LwpConnectedCellLayout::Parse(IXFStream* pOutputStream)
870 LwpHiddenCellLayout::LwpHiddenCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
871 : LwpCellLayout(objHdr, pStrm)
874 LwpHiddenCellLayout::~LwpHiddenCellLayout()
877 * @short Set current hidden cell layout to cell layout map
878 * @param
879 * @return
881 void LwpHiddenCellLayout::SetCellMap()
883 return;
886 * @short Read hidden cell layout
887 * @param
888 * @return
890 void LwpHiddenCellLayout::Read()
892 LwpCellLayout::Read();
894 cconnectedlayout.ReadIndexed(m_pObjStrm);
895 m_pObjStrm->SkipExtra();
899 * @short Convert hidden cell layout
900 * @param aTableID - Object ID of table
901 * @return XFCell * - pointer to converted cell
904 XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
906 if (!cconnectedlayout.obj())
907 return NULL;
908 LwpConnectedCellLayout* pConnCell = static_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj());
910 if (nRow < (pConnCell->GetNumrows()+pConnCell->GetRowID()))
911 return NULL;
912 // if the hidden cell should be displayed for limit of SODC
913 // use the default cell layout
914 XFCell* pXFCell = NULL;
915 LwpTable *pTable = static_cast<LwpTable *>(aTableID.obj());
916 if (pTable)
918 LwpCellLayout *pDefault = static_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle()->obj());
919 if (pDefault)
921 pXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
923 else
925 pXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol);
927 pXFCell->SetColumnSpaned(pConnCell->GetNumcols());
929 else
931 assert(sal_False);
933 return pXFCell;
936 * @short parse hidden cell layout
937 * @param pOutputStream - output stream
938 * @return
940 void LwpHiddenCellLayout::Parse(IXFStream* pOutputStream)
945 LwpParallelColumnsBlock::LwpParallelColumnsBlock(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpCellLayout(objHdr, pStrm)
948 LwpParallelColumnsBlock::~LwpParallelColumnsBlock()
951 void LwpParallelColumnsBlock::Read()
953 LwpCellLayout::Read();
954 m_pObjStrm->SkipExtra();