Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * The Contents of this file are made available subject to the terms of
5 : * either of the following licenses
6 : *
7 : * - GNU Lesser General Public License Version 2.1
8 : * - Sun Industry Standards Source License Version 1.1
9 : *
10 : * Sun Microsystems Inc., October, 2000
11 : *
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
16 : *
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.
20 : *
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.
25 : *
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
30 : *
31 : *
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.
38 : *
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.
45 : *
46 : * The Initial Developer of the Original Code is: IBM Corporation
47 : *
48 : * Copyright: 2008 by IBM Corporation
49 : *
50 : * All Rights Reserved.
51 : *
52 : * Contributor(s): _______________________________________
53 : *
54 : *
55 : ************************************************************************/
56 : /**
57 : * @file
58 : * For LWP filter architecture prototype - table object
59 : */
60 : /*************************************************************************
61 : * Change History
62 : Mar 2005 Created
63 : ************************************************************************/
64 :
65 : #include "lwptable.hxx"
66 :
67 1 : LwpSuperTable::LwpSuperTable(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpContent(objHdr, pStrm)
68 1 : {}
69 :
70 2 : LwpSuperTable::~LwpSuperTable()
71 2 : {}
72 :
73 1 : void LwpSuperTable::Read()
74 : {
75 1 : LwpContent::Read();
76 1 : m_pObjStrm->SkipExtra();
77 :
78 1 : }
79 :
80 0 : void LwpSuperTable::Parse(IXFStream* /*pOutputStream*/)
81 : {
82 0 : }
83 :
84 : //Added by for XFConvert refactor, 03/31/2005
85 0 : void LwpSuperTable::XFConvert(XFContentContainer* /*pCont*/)
86 : {
87 0 : }
88 :
89 : //End of Add
90 : /*****************************************************************************/
91 2 : LwpTable::LwpTable(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpContent(objHdr, pStrm)
92 2 : {}
93 :
94 3 : LwpTable::~LwpTable()
95 3 : {}
96 :
97 2 : void LwpTable::Read()
98 : {
99 2 : LwpContent::Read();
100 : //m_RowCache.Read(m_pObjStrm);
101 : //m_ColumnCache.Read(m_pObjStrm);
102 :
103 : //m_CPNotifyList.Read(m_pObjStrm);
104 : //m_CPTempVersionedNotifyList.Read(m_pObjStrm);
105 :
106 2 : m_nRow = m_pObjStrm->QuickReaduInt16();
107 2 : m_nColumn = m_pObjStrm->QuickReaduInt16();
108 :
109 2 : m_nHeight = m_pObjStrm->QuickReadInt32();
110 2 : m_nWidth = m_pObjStrm->QuickReadInt32();
111 :
112 2 : m_nDefaultAutoGrowRowHeight = m_pObjStrm->QuickReadInt32();
113 :
114 2 : m_nAttributes = m_pObjStrm->QuickReaduInt16();
115 :
116 2 : m_Layout.ReadIndexed(m_pObjStrm);
117 :
118 2 : m_DefaultCellStyle.ReadIndexed(m_pObjStrm);
119 2 : if (LwpFileHeader::m_nFileRevision >= 0x0007)
120 2 : m_CPNotifyList.Read(m_pObjStrm);
121 :
122 2 : m_pObjStrm->SkipExtra();
123 2 : }
124 :
125 1 : sal_Bool LwpTable::IsNumberDown()
126 : {
127 1 : if (m_nAttributes & NUMBER_DOWN)
128 0 : return sal_True;
129 1 : return sal_False;
130 : }
131 :
132 0 : void LwpTable::Parse(IXFStream* /*pOutputStream*/)
133 : {
134 0 : }
135 :
136 0 : LwpSuperTableLayout* LwpTable::GetSuperTableLayout()
137 : {
138 0 : LwpTableLayout* pLayout = dynamic_cast<LwpTableLayout*>(m_Layout.obj());
139 0 : if(pLayout)
140 0 : return dynamic_cast<LwpSuperTableLayout*>(pLayout->GetParent()->obj());
141 :
142 0 : return NULL;
143 : }
144 :
145 : /*****************************************************************************/
146 0 : LwpTableHeading::LwpTableHeading(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpTable(objHdr, pStrm)
147 0 : {}
148 :
149 0 : LwpTableHeading::~LwpTableHeading()
150 0 : {}
151 :
152 0 : void LwpTableHeading::Read()
153 : {
154 0 : m_pObjStrm->SkipExtra();
155 0 : }
156 :
157 0 : void LwpTableHeading::Parse(IXFStream* /*pOutputStream*/)
158 : {
159 0 : }
160 :
161 : /*****************************************************************************/
162 0 : LwpParallelColumns::LwpParallelColumns(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpTable(objHdr, pStrm)
163 : {
164 0 : }
165 :
166 0 : LwpParallelColumns::~LwpParallelColumns()
167 : {
168 0 : }
169 :
170 0 : void LwpParallelColumns::Read()
171 : {
172 0 : LwpTable::Read();
173 0 : cDefaultLeftColumnStyle.ReadIndexed(m_pObjStrm);
174 0 : cDefaultRightColumnStyle.ReadIndexed(m_pObjStrm);
175 :
176 0 : m_pObjStrm->SkipExtra();
177 0 : }
178 : /*****************************************************************************/
179 0 : LwpGlossary::LwpGlossary(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpParallelColumns(objHdr, pStrm)
180 : {
181 0 : }
182 :
183 0 : LwpGlossary::~LwpGlossary()
184 : {
185 0 : }
186 0 : sal_uInt16 LwpGlossary::GetNumIndexRows(void)
187 : {
188 0 : if (GetRow() > 0 && GetRow() <= MAX_NUM_ROWS)
189 0 : return GetRow() - 1; // Minus one row for repeated heading.
190 0 : return 0;
191 : }
192 :
193 0 : void LwpGlossary::Read()
194 : {
195 0 : LwpParallelColumns::Read();
196 :
197 0 : sal_uInt16 FiledEntries = m_pObjStrm->QuickReaduInt16();
198 0 : sal_uInt16 NumIndexRows = GetNumIndexRows();
199 :
200 0 : sal_uInt16 * cpIndex = NULL;
201 0 : if (FiledEntries < NumIndexRows)
202 : {
203 : /* We'll have to do sequential (slow) searches. */
204 0 : m_pObjStrm->SeekRel( FiledEntries * sizeof(sal_uInt16));
205 : }
206 : else
207 : {
208 0 : if (NumIndexRows)
209 : {
210 : sal_uInt16 EntriesRead, EntryCount;
211 : sal_uInt16 *pRowID;
212 :
213 0 : cpIndex = new sal_uInt16[NumIndexRows];
214 :
215 0 : if (cpIndex)
216 : {
217 0 : pRowID = cpIndex;
218 :
219 0 : EntriesRead = (FiledEntries > NumIndexRows)? NumIndexRows:FiledEntries;
220 :
221 0 : for (EntryCount = 1; EntryCount <= EntriesRead; EntryCount++)
222 0 : *pRowID++ = m_pObjStrm->QuickReaduInt16();
223 :
224 0 : if (FiledEntries > EntriesRead)
225 0 : m_pObjStrm->SeekRel((FiledEntries - EntriesRead)* sizeof(sal_uInt16));
226 : }
227 : }
228 : else
229 0 : m_pObjStrm->SeekRel(FiledEntries * sizeof(sal_uInt16));
230 : }
231 :
232 0 : m_pObjStrm->SkipExtra();
233 0 : }
234 :
235 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|