Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "InternalData.hxx"
21 : #include "ResId.hxx"
22 : #include "Strings.hrc"
23 :
24 : #include <rtl/math.hxx>
25 : #if OSL_DEBUG_LEVEL > 1
26 : #define DEBUG_INTERNAL_DATA 1
27 : #endif
28 :
29 : #ifdef DEBUG_INTERNAL_DATA
30 : #include <svl/gridprinter.hxx>
31 : #endif
32 :
33 : #include <algorithm>
34 : #include <iterator>
35 :
36 : using ::com::sun::star::uno::Sequence;
37 :
38 : using namespace ::com::sun::star;
39 : using namespace ::std;
40 :
41 : namespace chart
42 : {
43 :
44 : namespace
45 : {
46 28 : struct lcl_NumberedStringGenerator
47 : {
48 28 : lcl_NumberedStringGenerator( const OUString & rStub, const OUString & rWildcard ) :
49 : m_aStub( rStub ),
50 : m_nCounter( 0 ),
51 28 : m_nStubStartIndex( rStub.indexOf( rWildcard )),
52 56 : m_nWildcardLength( rWildcard.getLength())
53 : {
54 28 : }
55 98 : vector< uno::Any > operator()()
56 : {
57 98 : vector< uno::Any > aRet(1);
58 98 : aRet[0] = uno::makeAny( m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::number( ++m_nCounter )) );
59 98 : return aRet;
60 : }
61 : private:
62 : OUString m_aStub;
63 : sal_Int32 m_nCounter;
64 : const sal_Int32 m_nStubStartIndex;
65 : const sal_Int32 m_nWildcardLength;
66 : };
67 :
68 : template< typename T >
69 119982 : Sequence< T > lcl_ValarrayToSequence( const ::std::valarray< T > & rValarray )
70 : {
71 : // is there a more elegant way of conversion?
72 119982 : Sequence< T > aResult( rValarray.size());
73 1318231 : for( size_t i = 0; i < rValarray.size(); ++i )
74 1198249 : aResult[i] = rValarray[i];
75 119982 : return aResult;
76 : }
77 :
78 : } // anonymous namespace
79 :
80 190 : InternalData::InternalData()
81 : : m_nColumnCount( 0 )
82 : , m_nRowCount( 0 )
83 : , m_aRowLabels( 0 )
84 190 : , m_aColumnLabels( 0 )
85 190 : {}
86 :
87 : static const double fDefaultData[] = {
88 : 9.10, 3.20, 4.54,
89 : 2.40, 8.80, 9.65,
90 : 3.10, 1.50, 3.70,
91 : 4.30, 9.02, 6.20
92 : };
93 :
94 14 : void InternalData::createDefaultData()
95 : {
96 14 : const sal_Int32 nRowCount = 4;
97 14 : const sal_Int32 nColumnCount = 3;
98 :
99 14 : m_nRowCount = nRowCount;
100 14 : m_nColumnCount = nColumnCount;
101 14 : const sal_Int32 nSize = nColumnCount * nRowCount;
102 : // @todo: localize this!
103 14 : const OUString aRowName(SCH_RESSTR(STR_ROW_LABEL));
104 28 : const OUString aColName(SCH_RESSTR(STR_COLUMN_LABEL));
105 :
106 14 : m_aData.resize( nSize );
107 182 : for( sal_Int32 i=0; i<nSize; ++i )
108 168 : m_aData[i] = fDefaultData[i];
109 :
110 14 : m_aRowLabels.clear();
111 14 : m_aRowLabels.reserve( m_nRowCount );
112 : generate_n( back_inserter( m_aRowLabels ), m_nRowCount,
113 14 : lcl_NumberedStringGenerator( aRowName, "%ROWNUMBER" ));
114 :
115 14 : m_aColumnLabels.clear();
116 14 : m_aColumnLabels.reserve( m_nColumnCount );
117 : generate_n( back_inserter( m_aColumnLabels ), m_nColumnCount,
118 28 : lcl_NumberedStringGenerator( aColName, "%COLUMNNUMBER" ));
119 14 : }
120 :
121 55 : void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
122 : {
123 55 : m_nRowCount = rDataInRows.getLength();
124 55 : m_nColumnCount = (m_nRowCount ? rDataInRows[0].getLength() : 0);
125 :
126 55 : if( m_aRowLabels.size() != static_cast< sal_uInt32 >( m_nRowCount ))
127 50 : m_aRowLabels.resize( m_nRowCount );
128 55 : if( m_aColumnLabels.size() != static_cast< sal_uInt32 >( m_nColumnCount ))
129 50 : m_aColumnLabels.resize( m_nColumnCount );
130 :
131 55 : m_aData.resize( m_nRowCount * m_nColumnCount );
132 : double fNan;
133 55 : ::rtl::math::setNan( & fNan );
134 : // set all values to Nan
135 55 : m_aData = fNan;
136 :
137 303 : for( sal_Int32 nRow=0; nRow<m_nRowCount; ++nRow )
138 : {
139 248 : int nDataIdx = nRow*m_nColumnCount;
140 248 : const sal_Int32 nMax = ::std::min( rDataInRows[nRow].getLength(), m_nColumnCount );
141 865 : for( sal_Int32 nCol=0; nCol < nMax; ++nCol )
142 : {
143 617 : m_aData[nDataIdx] = rDataInRows[nRow][nCol];
144 617 : nDataIdx += 1;
145 : }
146 : }
147 55 : }
148 :
149 6 : Sequence< Sequence< double > > InternalData::getData() const
150 : {
151 6 : Sequence< Sequence< double > > aResult( m_nRowCount );
152 :
153 30 : for( sal_Int32 i=0; i<m_nRowCount; ++i )
154 48 : aResult[i] = lcl_ValarrayToSequence< tDataType::value_type >(
155 72 : m_aData[ ::std::slice( i*m_nColumnCount, m_nColumnCount, 1 ) ] );
156 :
157 6 : return aResult;
158 : }
159 :
160 119952 : Sequence< double > InternalData::getColumnValues( sal_Int32 nColumnIndex ) const
161 : {
162 119952 : if( nColumnIndex >= 0 && nColumnIndex < m_nColumnCount )
163 : return lcl_ValarrayToSequence< tDataType::value_type >(
164 119952 : m_aData[ ::std::slice( nColumnIndex, m_nRowCount, m_nColumnCount ) ] );
165 0 : return Sequence< double >();
166 : }
167 6 : Sequence< double > InternalData::getRowValues( sal_Int32 nRowIndex ) const
168 : {
169 6 : if( nRowIndex >= 0 && nRowIndex < m_nRowCount )
170 : return lcl_ValarrayToSequence< tDataType::value_type >(
171 6 : m_aData[ ::std::slice( nRowIndex*m_nColumnCount, m_nColumnCount, 1 ) ] );
172 0 : return Sequence< double >();
173 : }
174 :
175 382 : void InternalData::setColumnValues( sal_Int32 nColumnIndex, const vector< double > & rNewData )
176 : {
177 382 : if( nColumnIndex < 0 )
178 382 : return;
179 382 : enlargeData( nColumnIndex + 1, rNewData.size() );
180 :
181 382 : tDataType aSlice = m_aData[ ::std::slice( nColumnIndex, m_nRowCount, m_nColumnCount ) ];
182 1983 : for( vector< double >::size_type i = 0; i < rNewData.size(); ++i )
183 1601 : aSlice[i] = rNewData[i];
184 382 : m_aData[ ::std::slice( nColumnIndex, m_nRowCount, m_nColumnCount ) ] = aSlice;
185 : }
186 :
187 0 : void InternalData::setRowValues( sal_Int32 nRowIndex, const vector< double > & rNewData )
188 : {
189 0 : if( nRowIndex < 0 )
190 0 : return;
191 0 : enlargeData( rNewData.size(), nRowIndex+1 );
192 :
193 0 : tDataType aSlice = m_aData[ ::std::slice( nRowIndex*m_nColumnCount, m_nColumnCount, 1 ) ];
194 0 : for( vector< double >::size_type i = 0; i < rNewData.size(); ++i )
195 0 : aSlice[i] = rNewData[i];
196 0 : m_aData[ ::std::slice( nRowIndex*m_nColumnCount, m_nColumnCount, 1 ) ]= aSlice;
197 : }
198 :
199 353 : void InternalData::setComplexColumnLabel( sal_Int32 nColumnIndex, const vector< uno::Any >& rComplexLabel )
200 : {
201 353 : if( nColumnIndex < 0 )
202 353 : return;
203 353 : if( nColumnIndex >= static_cast< sal_Int32 >( m_aColumnLabels.size() ) )
204 : {
205 0 : m_aColumnLabels.resize(nColumnIndex+1);
206 0 : enlargeData( nColumnIndex+1, 0 );
207 : }
208 353 : m_aColumnLabels[nColumnIndex]=rComplexLabel;
209 :
210 353 : dump();
211 : }
212 :
213 476 : void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, const vector< uno::Any >& rComplexLabel )
214 : {
215 476 : if( nRowIndex < 0 )
216 476 : return;
217 476 : if( nRowIndex >= static_cast< sal_Int32 >( m_aRowLabels.size() ) )
218 : {
219 425 : m_aRowLabels.resize(nRowIndex+1);
220 425 : enlargeData( 0, nRowIndex+1 );
221 : }
222 476 : m_aRowLabels[nRowIndex] = rComplexLabel;
223 : }
224 :
225 5521 : vector< uno::Any > InternalData::getComplexColumnLabel( sal_Int32 nColumnIndex ) const
226 : {
227 5521 : if( nColumnIndex < static_cast< sal_Int32 >( m_aColumnLabels.size() ) )
228 5521 : return m_aColumnLabels[nColumnIndex];
229 : else
230 0 : return vector< uno::Any >();
231 : }
232 0 : vector< uno::Any > InternalData::getComplexRowLabel( sal_Int32 nRowIndex ) const
233 : {
234 0 : if( nRowIndex < static_cast< sal_Int32 >( m_aRowLabels.size() ) )
235 0 : return m_aRowLabels[nRowIndex];
236 : else
237 0 : return vector< uno::Any >();
238 : }
239 :
240 0 : void InternalData::swapRowWithNext( sal_Int32 nRowIndex )
241 : {
242 0 : if( nRowIndex < m_nRowCount - 1 )
243 : {
244 0 : const sal_Int32 nMax = m_nColumnCount;
245 0 : for( sal_Int32 nColIdx=0; nColIdx<nMax; ++nColIdx )
246 : {
247 0 : size_t nIndex1 = nColIdx + nRowIndex*m_nColumnCount;
248 0 : size_t nIndex2 = nIndex1 + m_nColumnCount;
249 0 : double fTemp = m_aData[nIndex1];
250 0 : m_aData[nIndex1] = m_aData[nIndex2];
251 0 : m_aData[nIndex2] = fTemp;
252 : }
253 :
254 0 : vector< uno::Any > aTemp( m_aRowLabels[nRowIndex] );
255 0 : m_aRowLabels[nRowIndex] = m_aRowLabels[nRowIndex + 1];
256 0 : m_aRowLabels[nRowIndex + 1] = aTemp;
257 : }
258 0 : }
259 :
260 0 : void InternalData::swapColumnWithNext( sal_Int32 nColumnIndex )
261 : {
262 0 : if( nColumnIndex < m_nColumnCount - 1 )
263 : {
264 0 : const sal_Int32 nMax = m_nRowCount;
265 0 : for( sal_Int32 nRowIdx=0; nRowIdx<nMax; ++nRowIdx )
266 : {
267 0 : size_t nIndex1 = nColumnIndex + nRowIdx*m_nColumnCount;
268 0 : size_t nIndex2 = nIndex1 + 1;
269 0 : double fTemp = m_aData[nIndex1];
270 0 : m_aData[nIndex1] = m_aData[nIndex2];
271 0 : m_aData[nIndex2] = fTemp;
272 : }
273 :
274 0 : vector< uno::Any > aTemp( m_aColumnLabels[nColumnIndex] );
275 0 : m_aColumnLabels[nColumnIndex] = m_aColumnLabels[nColumnIndex + 1];
276 0 : m_aColumnLabels[nColumnIndex + 1] = aTemp;
277 : }
278 0 : }
279 :
280 936 : bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount )
281 : {
282 936 : sal_Int32 nNewColumnCount( ::std::max<sal_Int32>( m_nColumnCount, nColumnCount ) );
283 936 : sal_Int32 nNewRowCount( ::std::max<sal_Int32>( m_nRowCount, nRowCount ) );
284 936 : sal_Int32 nNewSize( nNewColumnCount*nNewRowCount );
285 :
286 936 : bool bGrow = (nNewSize > m_nColumnCount*m_nRowCount);
287 :
288 936 : if( bGrow )
289 : {
290 : double fNan;
291 8 : ::rtl::math::setNan( &fNan );
292 8 : tDataType aNewData( fNan, nNewSize );
293 : // copy old data
294 18 : for( int nCol=0; nCol<m_nColumnCount; ++nCol )
295 : static_cast< tDataType >(
296 20 : aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] ) =
297 10 : m_aData[ ::std::slice( nCol, m_nRowCount, m_nColumnCount ) ];
298 :
299 8 : m_aData.resize( nNewSize );
300 8 : m_aData = aNewData;
301 : }
302 936 : m_nColumnCount = nNewColumnCount;
303 936 : m_nRowCount = nNewRowCount;
304 936 : return bGrow;
305 : }
306 :
307 382 : void InternalData::insertColumn( sal_Int32 nAfterIndex )
308 : {
309 : // note: -1 is allowed, as we insert after the given index
310 : OSL_ASSERT( nAfterIndex < m_nColumnCount && nAfterIndex >= -1 );
311 382 : if( nAfterIndex >= m_nColumnCount || nAfterIndex < -1 )
312 382 : return;
313 382 : sal_Int32 nNewColumnCount = m_nColumnCount + 1;
314 382 : sal_Int32 nNewSize( nNewColumnCount * m_nRowCount );
315 :
316 : double fNan;
317 382 : ::rtl::math::setNan( &fNan );
318 382 : tDataType aNewData( fNan, nNewSize );
319 :
320 : // copy old data
321 382 : int nCol=0;
322 1352 : for( ; nCol<=nAfterIndex; ++nCol )
323 1940 : aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] =
324 : static_cast< tDataType >(
325 970 : m_aData[ ::std::slice( nCol, m_nRowCount, m_nColumnCount ) ] );
326 382 : for( ++nCol; nCol<nNewColumnCount; ++nCol )
327 0 : aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] =
328 : static_cast< tDataType >(
329 0 : m_aData[ ::std::slice( nCol - 1, m_nRowCount, m_nColumnCount ) ] );
330 :
331 382 : m_nColumnCount = nNewColumnCount;
332 382 : m_aData.resize( nNewSize );
333 382 : m_aData = aNewData;
334 :
335 : // labels
336 382 : if( nAfterIndex < static_cast< sal_Int32 >( m_aColumnLabels.size()))
337 382 : m_aColumnLabels.insert( m_aColumnLabels.begin() + (nAfterIndex + 1), vector< uno::Any >(1) );
338 :
339 382 : dump();
340 : }
341 :
342 382 : sal_Int32 InternalData::appendColumn()
343 : {
344 382 : insertColumn( getColumnCount() - 1 );
345 382 : return getColumnCount() - 1;
346 : }
347 :
348 0 : sal_Int32 InternalData::appendRow()
349 : {
350 0 : insertRow( getRowCount() - 1 );
351 0 : return getRowCount() - 1;
352 : }
353 :
354 5074 : sal_Int32 InternalData::getRowCount() const
355 : {
356 5074 : return m_nRowCount;
357 : }
358 :
359 1825 : sal_Int32 InternalData::getColumnCount() const
360 : {
361 1825 : return m_nColumnCount;
362 : }
363 :
364 0 : void InternalData::insertRow( sal_Int32 nAfterIndex )
365 : {
366 : // note: -1 is allowed, as we insert after the given index
367 : OSL_ASSERT( nAfterIndex < m_nRowCount && nAfterIndex >= -1 );
368 0 : if( nAfterIndex >= m_nRowCount || nAfterIndex < -1 )
369 0 : return;
370 0 : sal_Int32 nNewRowCount = m_nRowCount + 1;
371 0 : sal_Int32 nNewSize( m_nColumnCount * nNewRowCount );
372 :
373 : double fNan;
374 0 : ::rtl::math::setNan( &fNan );
375 0 : tDataType aNewData( fNan, nNewSize );
376 :
377 : // copy old data
378 0 : sal_Int32 nIndex = nAfterIndex + 1;
379 0 : aNewData[ ::std::slice( 0, nIndex * m_nColumnCount, 1 ) ] =
380 : static_cast< tDataType >(
381 0 : m_aData[ ::std::slice( 0, nIndex * m_nColumnCount, 1 ) ] );
382 :
383 0 : if( nIndex < m_nRowCount )
384 : {
385 0 : sal_Int32 nRemainingCount = m_nColumnCount * (m_nRowCount - nIndex);
386 0 : aNewData[ ::std::slice( (nIndex + 1) * m_nColumnCount, nRemainingCount, 1 ) ] =
387 : static_cast< tDataType >(
388 0 : m_aData[ ::std::slice( nIndex * m_nColumnCount, nRemainingCount, 1 ) ] );
389 : }
390 :
391 0 : m_nRowCount = nNewRowCount;
392 0 : m_aData.resize( nNewSize );
393 0 : m_aData = aNewData;
394 :
395 : // labels
396 0 : if( nAfterIndex < static_cast< sal_Int32 >( m_aRowLabels.size()))
397 0 : m_aRowLabels.insert( m_aRowLabels.begin() + nIndex, vector< uno::Any > (1));
398 :
399 0 : dump();
400 : }
401 :
402 0 : void InternalData::deleteColumn( sal_Int32 nAtIndex )
403 : {
404 : OSL_ASSERT( nAtIndex < m_nColumnCount && nAtIndex >= 0 );
405 0 : if( nAtIndex >= m_nColumnCount || m_nColumnCount < 1 || nAtIndex < 0 )
406 0 : return;
407 0 : sal_Int32 nNewColumnCount = m_nColumnCount - 1;
408 0 : sal_Int32 nNewSize( nNewColumnCount * m_nRowCount );
409 :
410 : double fNan;
411 0 : ::rtl::math::setNan( &fNan );
412 0 : tDataType aNewData( fNan, nNewSize );
413 :
414 : // copy old data
415 0 : int nCol=0;
416 0 : for( ; nCol<nAtIndex; ++nCol )
417 0 : aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] =
418 : static_cast< tDataType >(
419 0 : m_aData[ ::std::slice( nCol, m_nRowCount, m_nColumnCount ) ] );
420 0 : for( ; nCol<nNewColumnCount; ++nCol )
421 0 : aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] =
422 : static_cast< tDataType >(
423 0 : m_aData[ ::std::slice( nCol + 1, m_nRowCount, m_nColumnCount ) ] );
424 :
425 0 : m_nColumnCount = nNewColumnCount;
426 0 : m_aData.resize( nNewSize );
427 0 : m_aData = aNewData;
428 :
429 : // labels
430 0 : if( nAtIndex < static_cast< sal_Int32 >( m_aColumnLabels.size()))
431 0 : m_aColumnLabels.erase( m_aColumnLabels.begin() + nAtIndex );
432 :
433 0 : dump();
434 : }
435 :
436 0 : void InternalData::deleteRow( sal_Int32 nAtIndex )
437 : {
438 : OSL_ASSERT( nAtIndex < m_nRowCount && nAtIndex >= 0 );
439 0 : if( nAtIndex >= m_nRowCount || m_nRowCount < 1 || nAtIndex < 0 )
440 0 : return;
441 0 : sal_Int32 nNewRowCount = m_nRowCount - 1;
442 0 : sal_Int32 nNewSize( m_nColumnCount * nNewRowCount );
443 :
444 : double fNan;
445 0 : ::rtl::math::setNan( &fNan );
446 0 : tDataType aNewData( fNan, nNewSize );
447 :
448 : // copy old data
449 0 : sal_Int32 nIndex = nAtIndex;
450 0 : if( nIndex )
451 0 : aNewData[ ::std::slice( 0, nIndex * m_nColumnCount, 1 ) ] =
452 : static_cast< tDataType >(
453 0 : m_aData[ ::std::slice( 0, nIndex * m_nColumnCount, 1 ) ] );
454 :
455 0 : if( nIndex < nNewRowCount )
456 : {
457 0 : sal_Int32 nRemainingCount = m_nColumnCount * (nNewRowCount - nIndex);
458 0 : aNewData[ ::std::slice( nIndex * m_nColumnCount, nRemainingCount, 1 ) ] =
459 : static_cast< tDataType >(
460 0 : m_aData[ ::std::slice( (nIndex + 1) * m_nColumnCount, nRemainingCount, 1 ) ] );
461 : }
462 :
463 0 : m_nRowCount = nNewRowCount;
464 0 : m_aData.resize( nNewSize );
465 0 : m_aData = aNewData;
466 :
467 : // labels
468 0 : if( nAtIndex < static_cast< sal_Int32 >( m_aRowLabels.size()))
469 0 : m_aRowLabels.erase( m_aRowLabels.begin() + nAtIndex );
470 :
471 0 : dump();
472 : }
473 :
474 78 : void InternalData::setComplexRowLabels( const vector< vector< uno::Any > >& rNewRowLabels )
475 : {
476 78 : m_aRowLabels = rNewRowLabels;
477 78 : sal_Int32 nNewRowCount = static_cast< sal_Int32 >( m_aRowLabels.size() );
478 78 : if( nNewRowCount < m_nRowCount )
479 0 : m_aRowLabels.resize( m_nRowCount );
480 : else
481 78 : enlargeData( 0, nNewRowCount );
482 78 : }
483 :
484 12679 : InternalData::tVecVecAny InternalData::getComplexRowLabels() const
485 : {
486 12679 : return m_aRowLabels;
487 : }
488 :
489 51 : void InternalData::setComplexColumnLabels( const vector< vector< uno::Any > >& rNewColumnLabels )
490 : {
491 51 : m_aColumnLabels = rNewColumnLabels;
492 51 : sal_Int32 nNewColumnCount = static_cast< sal_Int32 >( m_aColumnLabels.size() );
493 51 : if( nNewColumnCount < m_nColumnCount )
494 0 : m_aColumnLabels.resize( m_nColumnCount );
495 : else
496 51 : enlargeData( nNewColumnCount, 0 );
497 51 : }
498 :
499 12 : InternalData::tVecVecAny InternalData::getComplexColumnLabels() const
500 : {
501 12 : return m_aColumnLabels;
502 : }
503 :
504 : #ifdef DEBUG_INTERNAL_DATA
505 : void InternalData::dump() const
506 : {
507 : // Header
508 : if (!m_aColumnLabels.empty())
509 : {
510 : svl::GridPrinter aPrinter(1, m_aColumnLabels.size(), true);
511 : for (size_t nCol = 0; nCol < m_aColumnLabels.size(); ++nCol)
512 : {
513 : if (m_aColumnLabels[nCol].empty())
514 : continue;
515 :
516 : OUString aStr;
517 : if (m_aColumnLabels[nCol][0] >>= aStr)
518 : aPrinter.set(0, nCol, aStr);
519 : }
520 : aPrinter.print("Header");
521 : }
522 :
523 : if (!m_aRowLabels.empty())
524 : {
525 : svl::GridPrinter aPrinter(m_aRowLabels.size(), m_aRowLabels[0].size());
526 : for (size_t nRow = 0; nRow < m_aRowLabels.size(); ++nRow)
527 : {
528 : for (size_t nCol = 0; nCol < m_aRowLabels[nRow].size(); ++nCol)
529 : {
530 : OUString aStr;
531 : if (m_aRowLabels[nRow].at(nCol) >>= aStr)
532 : aPrinter.set(nRow, nCol, aStr);
533 : }
534 : }
535 : aPrinter.print("Row labels");
536 : }
537 :
538 : svl::GridPrinter aPrinter(m_nRowCount, m_nColumnCount);
539 :
540 : for (sal_Int32 nRow = 0; nRow < m_nRowCount; ++nRow)
541 : {
542 : tDataType aSlice( m_aData[ ::std::slice( nRow*m_nColumnCount, m_nColumnCount, 1 ) ] );
543 : for (sal_Int32 nCol = 0; nCol < m_nColumnCount; ++nCol)
544 : aPrinter.set(nRow, nCol, OUString::number(aSlice[nCol]));
545 : }
546 :
547 : aPrinter.print("Column data");
548 : }
549 : #else
550 735 : void InternalData::dump() const {}
551 : #endif
552 :
553 : } // namespace chart
554 :
555 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|