bump product version to 4.1.6.2
[LibreOffice.git] / lotuswordpro / source / filter / lwptable.cxx
bloba8d328cfa53a286e9282c6bbbdcfb81ed2656987
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 - table object
60 /*************************************************************************
61 * Change History
62 Mar 2005 Created
63 ************************************************************************/
65 #include "lwptable.hxx"
67 LwpSuperTable::LwpSuperTable(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpContent(objHdr, pStrm)
70 LwpSuperTable::~LwpSuperTable()
73 void LwpSuperTable::Read()
75 LwpContent::Read();
76 m_pObjStrm->SkipExtra();
80 void LwpSuperTable::Parse(IXFStream* /*pOutputStream*/)
84 //Added by for XFConvert refactor, 03/31/2005
85 void LwpSuperTable::XFConvert(XFContentContainer* /*pCont*/)
89 //End of Add
90 /*****************************************************************************/
91 LwpTable::LwpTable(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpContent(objHdr, pStrm)
94 LwpTable::~LwpTable()
97 void LwpTable::Read()
99 LwpContent::Read();
100 //m_RowCache.Read(m_pObjStrm);
101 //m_ColumnCache.Read(m_pObjStrm);
103 //m_CPNotifyList.Read(m_pObjStrm);
104 //m_CPTempVersionedNotifyList.Read(m_pObjStrm);
106 m_nRow = m_pObjStrm->QuickReaduInt16();
107 m_nColumn = m_pObjStrm->QuickReaduInt16();
109 m_nHeight = m_pObjStrm->QuickReadInt32();
110 m_nWidth = m_pObjStrm->QuickReadInt32();
112 m_nDefaultAutoGrowRowHeight = m_pObjStrm->QuickReadInt32();
114 m_nAttributes = m_pObjStrm->QuickReaduInt16();
116 m_Layout.ReadIndexed(m_pObjStrm);
118 m_DefaultCellStyle.ReadIndexed(m_pObjStrm);
119 if (LwpFileHeader::m_nFileRevision >= 0x0007)
120 m_CPNotifyList.Read(m_pObjStrm);
122 m_pObjStrm->SkipExtra();
125 sal_Bool LwpTable::IsNumberDown()
127 if (m_nAttributes & NUMBER_DOWN)
128 return sal_True;
129 return sal_False;
132 void LwpTable::Parse(IXFStream* /*pOutputStream*/)
136 LwpSuperTableLayout* LwpTable::GetSuperTableLayout()
138 LwpTableLayout* pLayout = dynamic_cast<LwpTableLayout*>(m_Layout.obj());
139 if(pLayout)
140 return dynamic_cast<LwpSuperTableLayout*>(pLayout->GetParent()->obj());
142 return NULL;
145 /*****************************************************************************/
146 LwpTableHeading::LwpTableHeading(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpTable(objHdr, pStrm)
149 LwpTableHeading::~LwpTableHeading()
152 void LwpTableHeading::Read()
154 m_pObjStrm->SkipExtra();
157 void LwpTableHeading::Parse(IXFStream* /*pOutputStream*/)
161 /*****************************************************************************/
162 LwpParallelColumns::LwpParallelColumns(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpTable(objHdr, pStrm)
166 LwpParallelColumns::~LwpParallelColumns()
170 void LwpParallelColumns::Read()
172 LwpTable::Read();
173 cDefaultLeftColumnStyle.ReadIndexed(m_pObjStrm);
174 cDefaultRightColumnStyle.ReadIndexed(m_pObjStrm);
176 m_pObjStrm->SkipExtra();
178 /*****************************************************************************/
179 LwpGlossary::LwpGlossary(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpParallelColumns(objHdr, pStrm)
183 LwpGlossary::~LwpGlossary()
186 sal_uInt16 LwpGlossary::GetNumIndexRows(void)
188 if (GetRow() > 0 && GetRow() <= MAX_NUM_ROWS)
189 return GetRow() - 1; // Minus one row for repeated heading.
190 return 0;
193 void LwpGlossary::Read()
195 LwpParallelColumns::Read();
197 sal_uInt16 FiledEntries = m_pObjStrm->QuickReaduInt16();
198 sal_uInt16 NumIndexRows = GetNumIndexRows();
200 sal_uInt16 * cpIndex = NULL;
201 if (FiledEntries < NumIndexRows)
203 /* We'll have to do sequential (slow) searches. */
204 m_pObjStrm->SeekRel( FiledEntries * sizeof(sal_uInt16));
206 else
208 if (NumIndexRows)
210 sal_uInt16 EntriesRead, EntryCount;
211 sal_uInt16 *pRowID;
213 cpIndex = new sal_uInt16[NumIndexRows];
215 if (cpIndex)
217 pRowID = cpIndex;
219 EntriesRead = (FiledEntries > NumIndexRows)? NumIndexRows:FiledEntries;
221 for (EntryCount = 1; EntryCount <= EntriesRead; EntryCount++)
222 *pRowID++ = m_pObjStrm->QuickReaduInt16();
224 if (FiledEntries > EntriesRead)
225 m_pObjStrm->SeekRel((FiledEntries - EntriesRead)* sizeof(sal_uInt16));
228 else
229 m_pObjStrm->SeekRel(FiledEntries * sizeof(sal_uInt16));
232 m_pObjStrm->SkipExtra();
235 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */