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)
92 : : LwpContent(objHdr, pStrm)
93 : , m_nRow(0)
94 : , m_nColumn(0)
95 : , m_nHeight(0)
96 : , m_nWidth(0)
97 : , m_nDefaultAutoGrowRowHeight(0)
98 2 : , m_nAttributes(0)
99 2 : {}
100 :
101 3 : LwpTable::~LwpTable()
102 3 : {}
103 :
104 2 : void LwpTable::Read()
105 : {
106 2 : LwpContent::Read();
107 : //m_RowCache.Read(m_pObjStrm);
108 : //m_ColumnCache.Read(m_pObjStrm);
109 :
110 : //m_CPNotifyList.Read(m_pObjStrm);
111 : //m_CPTempVersionedNotifyList.Read(m_pObjStrm);
112 :
113 2 : m_nRow = m_pObjStrm->QuickReaduInt16();
114 2 : m_nColumn = m_pObjStrm->QuickReaduInt16();
115 :
116 2 : m_nHeight = m_pObjStrm->QuickReadInt32();
117 2 : m_nWidth = m_pObjStrm->QuickReadInt32();
118 :
119 2 : m_nDefaultAutoGrowRowHeight = m_pObjStrm->QuickReadInt32();
120 :
121 2 : m_nAttributes = m_pObjStrm->QuickReaduInt16();
122 :
123 2 : m_Layout.ReadIndexed(m_pObjStrm);
124 :
125 2 : m_DefaultCellStyle.ReadIndexed(m_pObjStrm);
126 2 : if (LwpFileHeader::m_nFileRevision >= 0x0007)
127 2 : m_CPNotifyList.Read(m_pObjStrm);
128 :
129 2 : m_pObjStrm->SkipExtra();
130 2 : }
131 :
132 1 : bool LwpTable::IsNumberDown()
133 : {
134 1 : if (m_nAttributes & NUMBER_DOWN)
135 0 : return true;
136 1 : return false;
137 : }
138 :
139 0 : void LwpTable::Parse(IXFStream* /*pOutputStream*/)
140 : {
141 0 : }
142 :
143 0 : LwpSuperTableLayout* LwpTable::GetSuperTableLayout()
144 : {
145 0 : LwpTableLayout* pLayout = dynamic_cast<LwpTableLayout*>(m_Layout.obj().get());
146 0 : if(pLayout)
147 0 : return dynamic_cast<LwpSuperTableLayout*>(pLayout->GetParent().obj().get());
148 :
149 0 : return NULL;
150 : }
151 :
152 : /*****************************************************************************/
153 0 : LwpTableHeading::LwpTableHeading(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpTable(objHdr, pStrm)
154 0 : {}
155 :
156 0 : LwpTableHeading::~LwpTableHeading()
157 0 : {}
158 :
159 0 : void LwpTableHeading::Read()
160 : {
161 0 : m_pObjStrm->SkipExtra();
162 0 : }
163 :
164 0 : void LwpTableHeading::Parse(IXFStream* /*pOutputStream*/)
165 : {
166 0 : }
167 :
168 : /*****************************************************************************/
169 0 : LwpParallelColumns::LwpParallelColumns(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpTable(objHdr, pStrm)
170 : {
171 0 : }
172 :
173 0 : LwpParallelColumns::~LwpParallelColumns()
174 : {
175 0 : }
176 :
177 0 : void LwpParallelColumns::Read()
178 : {
179 0 : LwpTable::Read();
180 0 : cDefaultLeftColumnStyle.ReadIndexed(m_pObjStrm);
181 0 : cDefaultRightColumnStyle.ReadIndexed(m_pObjStrm);
182 :
183 0 : m_pObjStrm->SkipExtra();
184 0 : }
185 : /*****************************************************************************/
186 0 : LwpGlossary::LwpGlossary(LwpObjectHeader &objHdr, LwpSvStream* pStrm):LwpParallelColumns(objHdr, pStrm)
187 : {
188 0 : }
189 :
190 0 : LwpGlossary::~LwpGlossary()
191 : {
192 0 : }
193 0 : sal_uInt16 LwpGlossary::GetNumIndexRows()
194 : {
195 0 : if (GetRow() > 0 && GetRow() <= MAX_NUM_ROWS)
196 0 : return GetRow() - 1; // Minus one row for repeated heading.
197 0 : return 0;
198 : }
199 :
200 0 : void LwpGlossary::Read()
201 : {
202 0 : LwpParallelColumns::Read();
203 :
204 0 : sal_uInt16 FiledEntries = m_pObjStrm->QuickReaduInt16();
205 0 : sal_uInt16 NumIndexRows = GetNumIndexRows();
206 :
207 0 : if (FiledEntries < NumIndexRows)
208 : {
209 : /* We'll have to do sequential (slow) searches. */
210 0 : m_pObjStrm->SeekRel( FiledEntries * sizeof(sal_uInt16));
211 : }
212 : else
213 : {
214 0 : if (NumIndexRows)
215 : {
216 0 : sal_uInt16 EntriesRead = (FiledEntries > NumIndexRows)? NumIndexRows:FiledEntries;
217 :
218 0 : for (sal_uInt16 EntryCount = 1; EntryCount <= EntriesRead; EntryCount++)
219 0 : m_pObjStrm->QuickReaduInt16();
220 :
221 0 : if (FiledEntries > EntriesRead)
222 0 : m_pObjStrm->SeekRel((FiledEntries - EntriesRead)* sizeof(sal_uInt16));
223 : }
224 : else
225 0 : m_pObjStrm->SeekRel(FiledEntries * sizeof(sal_uInt16));
226 : }
227 :
228 0 : m_pObjStrm->SkipExtra();
229 0 : }
230 :
231 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|