Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "XMLDDELinksContext.hxx"
30 : : #include "xmlimprt.hxx"
31 : : #include "document.hxx"
32 : : #include "scmatrix.hxx"
33 : : #include <xmloff/xmltoken.hxx>
34 : : #include <xmloff/xmlnmspe.hxx>
35 : : #include <xmloff/nmspmap.hxx>
36 : : #include <sax/tools/converter.hxx>
37 : :
38 : : using namespace com::sun::star;
39 : : using namespace xmloff::token;
40 : : using ::rtl::OUString;
41 : :
42 : : using rtl::OUString;
43 : :
44 : : //------------------------------------------------------------------
45 : :
46 : 0 : ScXMLDDELinksContext::ScXMLDDELinksContext( ScXMLImport& rImport,
47 : : sal_uInt16 nPrfx,
48 : : const ::rtl::OUString& rLName,
49 : : const ::com::sun::star::uno::Reference<
50 : : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ ) :
51 : 0 : SvXMLImportContext( rImport, nPrfx, rLName )
52 : : {
53 : : // here are no attributes
54 [ # # ]: 0 : rImport.LockSolarMutex();
55 : 0 : }
56 : :
57 : 0 : ScXMLDDELinksContext::~ScXMLDDELinksContext()
58 : : {
59 [ # # ]: 0 : GetScImport().UnlockSolarMutex();
60 [ # # ]: 0 : }
61 : :
62 : 0 : SvXMLImportContext *ScXMLDDELinksContext::CreateChildContext( sal_uInt16 nPrefix,
63 : : const ::rtl::OUString& rLName,
64 : : const ::com::sun::star::uno::Reference<
65 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
66 : : {
67 : 0 : SvXMLImportContext *pContext = 0;
68 : :
69 [ # # ][ # # ]: 0 : if ((nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken(rLName, XML_DDE_LINK))
[ # # ]
70 [ # # ]: 0 : pContext = new ScXMLDDELinkContext(GetScImport(), nPrefix, rLName, xAttrList);
71 : :
72 [ # # ]: 0 : if( !pContext )
73 [ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
74 : :
75 : 0 : return pContext;
76 : : }
77 : :
78 : 0 : void ScXMLDDELinksContext::EndElement()
79 : : {
80 : 0 : }
81 : :
82 : 0 : ScXMLDDELinkContext::ScXMLDDELinkContext( ScXMLImport& rImport,
83 : : sal_uInt16 nPrfx,
84 : : const ::rtl::OUString& rLName,
85 : : const ::com::sun::star::uno::Reference<
86 : : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ ) :
87 : : SvXMLImportContext( rImport, nPrfx, rLName ),
88 : : aDDELinkTable(),
89 : : aDDELinkRow(),
90 : : sApplication(),
91 : : sTopic(),
92 : : sItem(),
93 : : nPosition(-1),
94 : : nColumns(0),
95 : : nRows(0),
96 [ # # ][ # # ]: 0 : nMode(SC_DDE_DEFAULT)
97 : : {
98 : : // here are no attributes
99 : 0 : }
100 : :
101 : 0 : ScXMLDDELinkContext::~ScXMLDDELinkContext()
102 : : {
103 [ # # ]: 0 : }
104 : :
105 : 0 : SvXMLImportContext *ScXMLDDELinkContext::CreateChildContext( sal_uInt16 nPrefix,
106 : : const ::rtl::OUString& rLName,
107 : : const ::com::sun::star::uno::Reference<
108 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
109 : : {
110 : 0 : SvXMLImportContext *pContext = 0;
111 : :
112 [ # # ][ # # ]: 0 : if ((nPrefix == XML_NAMESPACE_OFFICE) && IsXMLToken(rLName, XML_DDE_SOURCE))
[ # # ]
113 [ # # ]: 0 : pContext = new ScXMLDDESourceContext(GetScImport(), nPrefix, rLName, xAttrList, this);
114 [ # # ][ # # ]: 0 : else if ((nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken(rLName, XML_TABLE))
[ # # ]
115 [ # # ]: 0 : pContext = new ScXMLDDETableContext(GetScImport(), nPrefix, rLName, xAttrList, this);
116 : :
117 [ # # ]: 0 : if( !pContext )
118 [ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
119 : :
120 : 0 : return pContext;
121 : : }
122 : :
123 : 0 : void ScXMLDDELinkContext::CreateDDELink()
124 : : {
125 [ # # # # : 0 : if (GetScImport().GetDocument() &&
# # # # ]
[ # # ]
126 : 0 : !sApplication.isEmpty() &&
127 : 0 : !sTopic.isEmpty() &&
128 : 0 : !sItem.isEmpty())
129 : : {
130 [ # # ]: 0 : String sAppl(sApplication);
131 [ # # ]: 0 : String sTop(sTopic);
132 [ # # ]: 0 : String sIt(sItem);
133 [ # # ][ # # ]: 0 : GetScImport().GetDocument()->CreateDdeLink(sAppl, sTop, sIt, nMode, ScMatrixRef());
[ # # ][ # # ]
[ # # ]
134 : : sal_uInt16 nPos;
135 [ # # ][ # # ]: 0 : if(GetScImport().GetDocument()->FindDdeLink(sAppl, sTop, sIt, nMode, nPos))
[ # # ][ # # ]
[ # # ]
136 : 0 : nPosition = nPos;
137 : : else
138 : 0 : nPosition = -1;
139 [ # # ][ # # ]: 0 : OSL_ENSURE(nPosition > -1, "DDE Link not inserted");
[ # # ]
140 : : }
141 : 0 : }
142 : :
143 : 0 : void ScXMLDDELinkContext::AddCellToRow(const ScDDELinkCell& aCell)
144 : : {
145 : 0 : aDDELinkRow.push_back(aCell);
146 : 0 : }
147 : :
148 : 0 : void ScXMLDDELinkContext::AddRowsToTable(const sal_Int32 nRowsP)
149 : : {
150 [ # # ]: 0 : for (sal_Int32 i = 0; i < nRowsP; ++i)
151 : 0 : aDDELinkTable.insert(aDDELinkTable.end(), aDDELinkRow.begin(), aDDELinkRow.end());
152 : 0 : aDDELinkRow.clear();
153 : 0 : }
154 : :
155 : 0 : void ScXMLDDELinkContext::EndElement()
156 : : {
157 [ # # ][ # # ]: 0 : if (nPosition > -1 && nColumns && nRows && GetScImport().GetDocument())
[ # # ][ # # ]
[ # # ]
158 : : {
159 : 0 : bool bSizeMatch = (static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size());
160 : : OSL_ENSURE( bSizeMatch, "ScXMLDDELinkContext::EndElement: matrix dimension doesn't match cells count");
161 : : // Excel writes bad ODF in that it does not write the
162 : : // table:number-columns-repeated attribute of the
163 : : // <table:table-column> element, but apparently uses the number of
164 : : // <table:table-cell> elements within a <table:table-row> element to
165 : : // determine the column count instead. Be lenient ...
166 [ # # ][ # # ]: 0 : if (!bSizeMatch && nColumns == 1)
167 : : {
168 : 0 : nColumns = aDDELinkTable.size() / nRows;
169 : : OSL_ENSURE( static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size(),
170 : : "ScXMLDDELinkContext::EndElement: adapted matrix dimension doesn't match either");
171 : : }
172 [ # # ][ # # ]: 0 : ScMatrixRef pMatrix = new ScMatrix(static_cast<SCSIZE>(nColumns), static_cast<SCSIZE>(nRows), 0.0);
173 : 0 : sal_Int32 nCol(0);
174 : 0 : sal_Int32 nRow(-1);
175 : 0 : sal_Int32 nIndex(0);
176 : 0 : ScDDELinkCells::iterator aItr(aDDELinkTable.begin());
177 : 0 : ScDDELinkCells::iterator aEndItr(aDDELinkTable.end());
178 [ # # ]: 0 : while (aItr != aEndItr)
179 : : {
180 [ # # ]: 0 : if (nIndex % nColumns == 0)
181 : : {
182 : 0 : ++nRow;
183 : 0 : nCol = 0;
184 : : }
185 : : else
186 : 0 : ++nCol;
187 : :
188 : 0 : SCSIZE nScCol( static_cast< SCSIZE >( nCol ) );
189 : 0 : SCSIZE nScRow( static_cast< SCSIZE >( nRow ) );
190 [ # # ]: 0 : if( aItr->bEmpty )
191 [ # # ]: 0 : pMatrix->PutEmpty( nScCol, nScRow );
192 [ # # ]: 0 : else if( aItr->bString )
193 [ # # ]: 0 : pMatrix->PutString( aItr->sValue, nScCol, nScRow );
194 : : else
195 [ # # ]: 0 : pMatrix->PutDouble( aItr->fValue, nScCol, nScRow );
196 : :
197 : 0 : ++nIndex;
198 : 0 : ++aItr;
199 : : }
200 : :
201 [ # # ][ # # ]: 0 : GetScImport().GetDocument()->SetDdeLinkResultMatrix( static_cast< sal_uInt16 >( nPosition ), pMatrix );
[ # # ]
202 : : }
203 : 0 : }
204 : :
205 : 0 : ScXMLDDESourceContext::ScXMLDDESourceContext( ScXMLImport& rImport,
206 : : sal_uInt16 nPrfx,
207 : : const ::rtl::OUString& rLName,
208 : : const ::com::sun::star::uno::Reference<
209 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
210 : : ScXMLDDELinkContext* pTempDDELink) :
211 : : SvXMLImportContext( rImport, nPrfx, rLName ),
212 : 0 : pDDELink(pTempDDELink)
213 : : {
214 [ # # ]: 0 : if( !xAttrList.is() ) return;
215 : :
216 [ # # ][ # # ]: 0 : sal_Int16 nAttrCount = xAttrList->getLength();
217 : :
218 [ # # ]: 0 : for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
219 : : {
220 [ # # ][ # # ]: 0 : const rtl::OUString& sAttrName (xAttrList->getNameByIndex( nIndex ));
221 [ # # ][ # # ]: 0 : const rtl::OUString& sValue (xAttrList->getValueByIndex( nIndex ));
222 : 0 : OUString aLocalName;
223 [ # # ]: 0 : sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
224 : :
225 [ # # ]: 0 : if (nPrefix == XML_NAMESPACE_OFFICE)
226 : : {
227 [ # # ][ # # ]: 0 : if (IsXMLToken(aLocalName, XML_DDE_APPLICATION))
228 : 0 : pDDELink->SetApplication(sValue);
229 [ # # ][ # # ]: 0 : else if (IsXMLToken(aLocalName, XML_DDE_TOPIC))
230 : 0 : pDDELink->SetTopic(sValue);
231 [ # # ][ # # ]: 0 : else if (IsXMLToken(aLocalName, XML_DDE_ITEM))
232 : 0 : pDDELink->SetItem(sValue);
233 : : }
234 [ # # ][ # # ]: 0 : else if ((nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken(aLocalName, XML_CONVERSION_MODE))
[ # # ][ # # ]
235 : : {
236 [ # # ][ # # ]: 0 : if (IsXMLToken(sValue, XML_INTO_ENGLISH_NUMBER))
237 : 0 : pDDELink->SetMode(SC_DDE_ENGLISH);
238 [ # # ][ # # ]: 0 : else if (IsXMLToken(sValue, XML_KEEP_TEXT))
239 : 0 : pDDELink->SetMode(SC_DDE_TEXT);
240 : : else
241 : 0 : pDDELink->SetMode(SC_DDE_DEFAULT);
242 : : }
243 : 0 : }
244 : : }
245 : :
246 : 0 : ScXMLDDESourceContext::~ScXMLDDESourceContext()
247 : : {
248 [ # # ]: 0 : }
249 : :
250 : 0 : SvXMLImportContext *ScXMLDDESourceContext::CreateChildContext( sal_uInt16 nPrefix,
251 : : const ::rtl::OUString& rLName,
252 : : const ::com::sun::star::uno::Reference<
253 : : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
254 : : {
255 [ # # ]: 0 : SvXMLImportContext *pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
256 : :
257 : 0 : return pContext;
258 : : }
259 : :
260 : 0 : void ScXMLDDESourceContext::EndElement()
261 : : {
262 : 0 : pDDELink->CreateDDELink();
263 : 0 : }
264 : :
265 : 0 : ScXMLDDETableContext::ScXMLDDETableContext( ScXMLImport& rImport,
266 : : sal_uInt16 nPrfx,
267 : : const ::rtl::OUString& rLName,
268 : : const ::com::sun::star::uno::Reference<
269 : : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */,
270 : : ScXMLDDELinkContext* pTempDDELink) :
271 : : SvXMLImportContext( rImport, nPrfx, rLName ),
272 : 0 : pDDELink(pTempDDELink)
273 : : {
274 : : // here are no attributes
275 : 0 : }
276 : :
277 : 0 : ScXMLDDETableContext::~ScXMLDDETableContext()
278 : : {
279 [ # # ]: 0 : }
280 : :
281 : 0 : SvXMLImportContext *ScXMLDDETableContext::CreateChildContext( sal_uInt16 nPrefix,
282 : : const ::rtl::OUString& rLName,
283 : : const ::com::sun::star::uno::Reference<
284 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
285 : : {
286 : 0 : SvXMLImportContext *pContext = NULL;
287 : :
288 [ # # ]: 0 : if (nPrefix == XML_NAMESPACE_TABLE)
289 : : {
290 [ # # ]: 0 : if (IsXMLToken(rLName, XML_TABLE_COLUMN))
291 [ # # ]: 0 : pContext = new ScXMLDDEColumnContext(GetScImport(), nPrefix, rLName, xAttrList, pDDELink);
292 [ # # ]: 0 : else if (IsXMLToken(rLName, XML_TABLE_ROW))
293 [ # # ]: 0 : pContext = new ScXMLDDERowContext(GetScImport(), nPrefix, rLName, xAttrList, pDDELink);
294 : : }
295 : :
296 [ # # ]: 0 : if (!pContext)
297 [ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
298 : :
299 : 0 : return pContext;
300 : : }
301 : :
302 : 0 : void ScXMLDDETableContext::EndElement()
303 : : {
304 : 0 : }
305 : :
306 : 0 : ScXMLDDEColumnContext::ScXMLDDEColumnContext( ScXMLImport& rImport,
307 : : sal_uInt16 nPrfx,
308 : : const ::rtl::OUString& rLName,
309 : : const ::com::sun::star::uno::Reference<
310 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
311 : : ScXMLDDELinkContext* pTempDDELink) :
312 : : SvXMLImportContext( rImport, nPrfx, rLName ),
313 : 0 : pDDELink(pTempDDELink)
314 : : {
315 [ # # ]: 0 : if( !xAttrList.is() ) return;
316 : 0 : sal_Int32 nCols(1);
317 : :
318 [ # # ][ # # ]: 0 : sal_Int16 nAttrCount = xAttrList->getLength();
319 : :
320 [ # # ]: 0 : for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
321 : : {
322 [ # # ][ # # ]: 0 : const rtl::OUString& sAttrName (xAttrList->getNameByIndex( nIndex ));
323 [ # # ][ # # ]: 0 : const rtl::OUString& sValue (xAttrList->getValueByIndex( nIndex ));
324 : 0 : OUString aLocalName;
325 [ # # ]: 0 : sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
326 : :
327 [ # # ]: 0 : if (nPrefix == XML_NAMESPACE_TABLE)
328 [ # # ][ # # ]: 0 : if (IsXMLToken(aLocalName, XML_NUMBER_COLUMNS_REPEATED))
329 : : {
330 [ # # ]: 0 : ::sax::Converter::convertNumber(nCols, sValue);
331 : : }
332 : 0 : }
333 : 0 : pDDELink->AddColumns(nCols);
334 : : }
335 : :
336 : 0 : ScXMLDDEColumnContext::~ScXMLDDEColumnContext()
337 : : {
338 [ # # ]: 0 : }
339 : :
340 : 0 : SvXMLImportContext *ScXMLDDEColumnContext::CreateChildContext( sal_uInt16 nPrefix,
341 : : const ::rtl::OUString& rLName,
342 : : const ::com::sun::star::uno::Reference<
343 : : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
344 : : {
345 [ # # ]: 0 : SvXMLImportContext *pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
346 : :
347 : 0 : return pContext;
348 : : }
349 : :
350 : 0 : void ScXMLDDEColumnContext::EndElement()
351 : : {
352 : 0 : }
353 : :
354 : 0 : ScXMLDDERowContext::ScXMLDDERowContext( ScXMLImport& rImport,
355 : : sal_uInt16 nPrfx,
356 : : const ::rtl::OUString& rLName,
357 : : const ::com::sun::star::uno::Reference<
358 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
359 : : ScXMLDDELinkContext* pTempDDELink) :
360 : : SvXMLImportContext( rImport, nPrfx, rLName ),
361 : : pDDELink(pTempDDELink),
362 : 0 : nRows(1)
363 : : {
364 [ # # ]: 0 : if( !xAttrList.is() ) return;
365 : :
366 [ # # ][ # # ]: 0 : sal_Int16 nAttrCount = xAttrList->getLength();
367 : :
368 [ # # ]: 0 : for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
369 : : {
370 [ # # ][ # # ]: 0 : const rtl::OUString& sAttrName (xAttrList->getNameByIndex( nIndex ));
371 [ # # ][ # # ]: 0 : const rtl::OUString& sValue (xAttrList->getValueByIndex( nIndex ));
372 : 0 : OUString aLocalName;
373 [ # # ]: 0 : sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
374 : :
375 [ # # ]: 0 : if (nPrefix == XML_NAMESPACE_TABLE)
376 [ # # ][ # # ]: 0 : if (IsXMLToken(aLocalName, XML_NUMBER_ROWS_REPEATED))
377 : : {
378 [ # # ]: 0 : ::sax::Converter::convertNumber(nRows, sValue);
379 : : }
380 : 0 : }
381 : 0 : pDDELink->AddRows(nRows);
382 : : }
383 : :
384 : 0 : ScXMLDDERowContext::~ScXMLDDERowContext()
385 : : {
386 [ # # ]: 0 : }
387 : :
388 : 0 : SvXMLImportContext *ScXMLDDERowContext::CreateChildContext( sal_uInt16 nPrefix,
389 : : const ::rtl::OUString& rLName,
390 : : const ::com::sun::star::uno::Reference<
391 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
392 : : {
393 : 0 : SvXMLImportContext *pContext = NULL;
394 : :
395 [ # # ]: 0 : if (nPrefix == XML_NAMESPACE_TABLE)
396 [ # # ]: 0 : if (IsXMLToken(rLName, XML_TABLE_CELL))
397 [ # # ]: 0 : pContext = new ScXMLDDECellContext(GetScImport(), nPrefix, rLName, xAttrList, pDDELink);
398 : :
399 [ # # ]: 0 : if (!pContext)
400 [ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
401 : :
402 : 0 : return pContext;
403 : : }
404 : :
405 : 0 : void ScXMLDDERowContext::EndElement()
406 : : {
407 : 0 : pDDELink->AddRowsToTable(nRows);
408 : 0 : }
409 : :
410 : 0 : ScXMLDDECellContext::ScXMLDDECellContext( ScXMLImport& rImport,
411 : : sal_uInt16 nPrfx,
412 : : const ::rtl::OUString& rLName,
413 : : const ::com::sun::star::uno::Reference<
414 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
415 : : ScXMLDDELinkContext* pTempDDELink) :
416 : : SvXMLImportContext( rImport, nPrfx, rLName ),
417 : : sValue(),
418 : : fValue(),
419 : : nCells(1),
420 : : bString(true),
421 : : bString2(true),
422 : : bEmpty(true),
423 : 0 : pDDELink(pTempDDELink)
424 : : {
425 [ # # ]: 0 : if( !xAttrList.is() ) return;
426 : :
427 [ # # ][ # # ]: 0 : sal_Int16 nAttrCount = xAttrList->getLength();
428 : :
429 [ # # ]: 0 : for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
430 : : {
431 [ # # ][ # # ]: 0 : const rtl::OUString& sAttrName (xAttrList->getNameByIndex( nIndex ));
432 [ # # ][ # # ]: 0 : const rtl::OUString& sTempValue (xAttrList->getValueByIndex( nIndex ));
433 : 0 : OUString aLocalName;
434 [ # # ]: 0 : sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
435 : :
436 [ # # ]: 0 : if (nPrefix == XML_NAMESPACE_OFFICE)
437 : : {
438 [ # # ][ # # ]: 0 : if (IsXMLToken(aLocalName, XML_VALUE_TYPE))
439 : : {
440 [ # # ][ # # ]: 0 : if (IsXMLToken(sTempValue, XML_STRING))
441 : 0 : bString = true;
442 : : else
443 : 0 : bString = false;
444 : : }
445 [ # # ][ # # ]: 0 : else if (IsXMLToken(aLocalName, XML_STRING_VALUE))
446 : : {
447 : 0 : sValue = sTempValue;
448 : 0 : bEmpty = false;
449 : 0 : bString2 = true;
450 : : }
451 [ # # ][ # # ]: 0 : else if (IsXMLToken(aLocalName, XML_VALUE))
452 : : {
453 [ # # ]: 0 : ::sax::Converter::convertDouble(fValue, sTempValue);
454 : 0 : bEmpty = false;
455 : 0 : bString2 = false;
456 : : }
457 : : }
458 [ # # ]: 0 : else if (nPrefix == XML_NAMESPACE_TABLE)
459 : : {
460 [ # # ][ # # ]: 0 : if (IsXMLToken(aLocalName, XML_NUMBER_COLUMNS_REPEATED))
461 : : {
462 [ # # ]: 0 : ::sax::Converter::convertNumber(nCells, sTempValue);
463 : : }
464 : : }
465 : 0 : }
466 : : }
467 : :
468 : 0 : ScXMLDDECellContext::~ScXMLDDECellContext()
469 : : {
470 [ # # ]: 0 : }
471 : :
472 : 0 : SvXMLImportContext *ScXMLDDECellContext::CreateChildContext( sal_uInt16 nPrefix,
473 : : const ::rtl::OUString& rLName,
474 : : const ::com::sun::star::uno::Reference<
475 : : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
476 : : {
477 [ # # ]: 0 : SvXMLImportContext *pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
478 : :
479 : 0 : return pContext;
480 : : }
481 : :
482 : 0 : void ScXMLDDECellContext::EndElement()
483 : : {
484 : : OSL_ENSURE(bString == bString2, "something wrong with this type");
485 : 0 : ScDDELinkCell aCell;
486 : 0 : aCell.sValue = sValue;
487 : 0 : aCell.fValue = fValue;
488 : 0 : aCell.bEmpty = bEmpty;
489 : 0 : aCell.bString = bString2;
490 [ # # ]: 0 : for(sal_Int32 i = 0; i < nCells; ++i)
491 [ # # ]: 0 : pDDELink->AddCellToRow(aCell);
492 : 0 : }
493 : :
494 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|