DomainMapperTableManager.cxx (b4a4f18c) DomainMapperTableManager.cxx (14ac695d)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 31 unchanged lines hidden (view full) ---

40namespace dmapper {
41
42using namespace ::com::sun::star;
43using namespace ::std;
44/*-- 23.04.2007 14:57:49---------------------------------------------------
45
46 -----------------------------------------------------------------------*/
47DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) :
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 31 unchanged lines hidden (view full) ---

40namespace dmapper {
41
42using namespace ::com::sun::star;
43using namespace ::std;
44/*-- 23.04.2007 14:57:49---------------------------------------------------
45
46 -----------------------------------------------------------------------*/
47DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) :
48 m_nRow(0),
49 m_nCell(0),
50 m_nGridSpan(1),
51 m_nCellBorderIndex(0),
52 m_nHeaderRepeat(0),
53 m_nTableWidth(0),
48 m_nCellCounterForCurrentRow(),
49 m_nGridSpanOfCurrentCell( 1 ),
50 m_nCurrentCellBorderIndex(),
51 m_nCurrentHeaderRepeatCount(),
52 m_nTableWidthOfCurrentTable(),
54 m_bOOXML( bOOXML ),
55 m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) )
56{
57 m_pTablePropsHandler->SetTableManager( this );
58
59#ifdef DEBUG_DOMAINMAPPER
60#ifdef DEBUG_TABLE
61 setTagLogger(dmapper_logger);

--- 50 unchanged lines hidden (view full) ---

112 pProperties->resolve(*pMeasureHandler);
113 TablePropertyMapPtr pPropMap( new TablePropertyMap );
114 if( nSprmId == 0xf661 || nSprmId == sal_uInt32(NS_ooxml::LN_CT_TblPrBase_tblInd ))
115 {
116 pPropMap->setValue( TablePropertyMap::LEFT_MARGIN, pMeasureHandler->getMeasureValue() );
117 }
118 else
119 {
53 m_bOOXML( bOOXML ),
54 m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) )
55{
56 m_pTablePropsHandler->SetTableManager( this );
57
58#ifdef DEBUG_DOMAINMAPPER
59#ifdef DEBUG_TABLE
60 setTagLogger(dmapper_logger);

--- 50 unchanged lines hidden (view full) ---

111 pProperties->resolve(*pMeasureHandler);
112 TablePropertyMapPtr pPropMap( new TablePropertyMap );
113 if( nSprmId == 0xf661 || nSprmId == sal_uInt32(NS_ooxml::LN_CT_TblPrBase_tblInd ))
114 {
115 pPropMap->setValue( TablePropertyMap::LEFT_MARGIN, pMeasureHandler->getMeasureValue() );
116 }
117 else
118 {
120 m_nTableWidth = pMeasureHandler->getMeasureValue();
121 if( m_nTableWidth )
122 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
119 m_nTableWidthOfCurrentTable.top() = pMeasureHandler->getMeasureValue();
120 if( m_nTableWidthOfCurrentTable.top() > 0 )
121 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidthOfCurrentTable.top() );
123 }
124#ifdef DEBUG_DOMAINMAPPER
125 dmapper_logger->addTag(pPropMap->toTag());
126#endif
127 insertTableProps(pPropMap);
128 }
129 }
130 break;
131 case 0x3404:// sprmTTableHeader
132 case NS_ooxml::LN_CT_TrPrBase_tblHeader: //90704
133 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
134 // if nIntValue == 1 then the row is a repeated header line
135 // to prevent later rows from increasing the repeating m_nHeaderRepeat is set to NULL when repeating stops
122 }
123#ifdef DEBUG_DOMAINMAPPER
124 dmapper_logger->addTag(pPropMap->toTag());
125#endif
126 insertTableProps(pPropMap);
127 }
128 }
129 break;
130 case 0x3404:// sprmTTableHeader
131 case NS_ooxml::LN_CT_TrPrBase_tblHeader: //90704
132 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
133 // if nIntValue == 1 then the row is a repeated header line
134 // to prevent later rows from increasing the repeating m_nHeaderRepeat is set to NULL when repeating stops
136 if( nIntValue > 0 && m_nHeaderRepeat >= 0 )
135 if( nIntValue > 0 && m_nCurrentHeaderRepeatCount.top() >= 0 )
137 {
136 {
138 ++m_nHeaderRepeat;
137 ++(m_nCurrentHeaderRepeatCount.top());
139 TablePropertyMapPtr pPropMap( new TablePropertyMap );
138 TablePropertyMapPtr pPropMap( new TablePropertyMap );
140 pPropMap->Insert( PROP_HEADER_ROW_COUNT, false, uno::makeAny( m_nHeaderRepeat ));
139 pPropMap->Insert( PROP_HEADER_ROW_COUNT, false, uno::makeAny( m_nCurrentHeaderRepeatCount.top() ));
141 insertTableProps(pPropMap);
142 }
143 else
140 insertTableProps(pPropMap);
141 }
142 else
144 m_nHeaderRepeat = -1;
143 m_nCurrentHeaderRepeatCount.top() = -1;
145 break;
146 case 0xd608: // TDefTable
147 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
148 {
149 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
150 if( pProperties.get())
151 {
152 TDefTableHandlerPtr pTDefTableHandler( new TDefTableHandler(m_bOOXML) );
153 pProperties->resolve( *pTDefTableHandler );
154
155 TablePropertyMapPtr pRowPropMap( new TablePropertyMap );
156 pRowPropMap->insert( pTDefTableHandler->getRowProperties() );
157 insertRowProps( pRowPropMap );
144 break;
145 case 0xd608: // TDefTable
146 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
147 {
148 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
149 if( pProperties.get())
150 {
151 TDefTableHandlerPtr pTDefTableHandler( new TDefTableHandler(m_bOOXML) );
152 pProperties->resolve( *pTDefTableHandler );
153
154 TablePropertyMapPtr pRowPropMap( new TablePropertyMap );
155 pRowPropMap->insert( pTDefTableHandler->getRowProperties() );
156 insertRowProps( pRowPropMap );
158 if( !m_nTableWidth )
157 if( m_nTableWidthOfCurrentTable.top() == 0 )
159 {
158 {
160 m_nTableWidth= pTDefTableHandler->getTableWidth();
161 if( m_nTableWidth )
159 m_nTableWidthOfCurrentTable.top() = pTDefTableHandler->getTableWidth();
160 if( m_nTableWidthOfCurrentTable.top() > 0 )
162 {
163 TablePropertyMapPtr pPropMap( new TablePropertyMap );
161 {
162 TablePropertyMapPtr pPropMap( new TablePropertyMap );
164 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
163 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidthOfCurrentTable.top() );
165 insertTableProps(pPropMap);
166 }
167 }
168 for( size_t nCell = 0; nCell < pTDefTableHandler->getCellCount(); ++nCell )
169 {
170 TablePropertyMapPtr pCellPropMap( new TablePropertyMap );
171 pTDefTableHandler->fillCellProperties( nCell, pCellPropMap );
172 cellPropsByCell( nCell, pCellPropMap );

--- 6 unchanged lines hidden (view full) ---

179 {
180 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
181 if( pProperties.get())
182 {
183 BorderHandlerPtr pBorderHandler( new BorderHandler(m_bOOXML) );
184 pProperties->resolve(*pBorderHandler);
185 TablePropertyMapPtr pCellPropMap( new TablePropertyMap() );
186 pCellPropMap->insert( pBorderHandler->getProperties() );
164 insertTableProps(pPropMap);
165 }
166 }
167 for( size_t nCell = 0; nCell < pTDefTableHandler->getCellCount(); ++nCell )
168 {
169 TablePropertyMapPtr pCellPropMap( new TablePropertyMap );
170 pTDefTableHandler->fillCellProperties( nCell, pCellPropMap );
171 cellPropsByCell( nCell, pCellPropMap );

--- 6 unchanged lines hidden (view full) ---

178 {
179 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
180 if( pProperties.get())
181 {
182 BorderHandlerPtr pBorderHandler( new BorderHandler(m_bOOXML) );
183 pProperties->resolve(*pBorderHandler);
184 TablePropertyMapPtr pCellPropMap( new TablePropertyMap() );
185 pCellPropMap->insert( pBorderHandler->getProperties() );
187 cellPropsByCell( m_nCellBorderIndex, pCellPropMap );
188 ++m_nCellBorderIndex;
186 cellPropsByCell( m_nCurrentCellBorderIndex.top(), pCellPropMap );
187 ++(m_nCurrentCellBorderIndex.top());
189 }
190 }
191 break;
192 case 0xd632 : //sprmTNewSpacing
193 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
194 case 0xd634 : //sprmTNewSpacing
195 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
196 //TODO: sprms contain default (TNew) and actual border spacing of cells - not resolvable yet

--- 27 unchanged lines hidden (view full) ---

224 case 0xf617 : //unknown
225 case 0xf618 : //unknown
226 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
227 bRet = false;
228 break;
229 case NS_ooxml::LN_CT_TblPrBase_tblStyle: //table style name
230 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
231 {
188 }
189 }
190 break;
191 case 0xd632 : //sprmTNewSpacing
192 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
193 case 0xd634 : //sprmTNewSpacing
194 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
195 //TODO: sprms contain default (TNew) and actual border spacing of cells - not resolvable yet

--- 27 unchanged lines hidden (view full) ---

223 case 0xf617 : //unknown
224 case 0xf618 : //unknown
225 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
226 bRet = false;
227 break;
228 case NS_ooxml::LN_CT_TblPrBase_tblStyle: //table style name
229 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
230 {
232 m_sTableStyleName = pValue->getString();
233 TablePropertyMapPtr pPropMap( new TablePropertyMap );
231 TablePropertyMapPtr pPropMap( new TablePropertyMap );
234 pPropMap->Insert( META_PROP_TABLE_STYLE_NAME, false, uno::makeAny( m_sTableStyleName ));
232 pPropMap->Insert( META_PROP_TABLE_STYLE_NAME, false, uno::makeAny( pValue->getString() ));
235 insertTableProps(pPropMap);
236 }
237 break;
238 case NS_ooxml::LN_CT_TblGridBase_gridCol:
239 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
240 {
241 getCurrentGrid()->push_back( ConversionHelper::convertTwipToMM100( nIntValue ) );
242 }

--- 10 unchanged lines hidden (view full) ---

253 case NS_ooxml::LN_CT_TcPrBase_gridSpan: //number of grid positions spanned by this cell
254 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
255 {
256#if DEBUG_DOMAINMAPPER
257 dmapper_logger->startElement("tablemanager.GridSpan");
258 dmapper_logger->attribute("gridSpan", nIntValue);
259 dmapper_logger->endElement("tablemanager.GridSpan");
260#endif
233 insertTableProps(pPropMap);
234 }
235 break;
236 case NS_ooxml::LN_CT_TblGridBase_gridCol:
237 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
238 {
239 getCurrentGrid()->push_back( ConversionHelper::convertTwipToMM100( nIntValue ) );
240 }

--- 10 unchanged lines hidden (view full) ---

251 case NS_ooxml::LN_CT_TcPrBase_gridSpan: //number of grid positions spanned by this cell
252 /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */
253 {
254#if DEBUG_DOMAINMAPPER
255 dmapper_logger->startElement("tablemanager.GridSpan");
256 dmapper_logger->attribute("gridSpan", nIntValue);
257 dmapper_logger->endElement("tablemanager.GridSpan");
258#endif
261 m_nGridSpan = nIntValue;
259 m_nGridSpanOfCurrentCell = nIntValue;
262 }
263 break;
264 case NS_ooxml::LN_CT_TblPrBase_tblLook:
265 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
266 break; //todo: table look specifier
267 case NS_ooxml::LN_CT_TcPrBase_tcW:
268 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
269 break; //fixed column width is not supported

--- 23 unchanged lines hidden (view full) ---

293#ifdef DEBUG_DOMAINMAPPER
294 dmapper_logger->element("unhandled");
295#endif
296 }
297 }
298 return bRet;
299}
300
260 }
261 break;
262 case NS_ooxml::LN_CT_TblPrBase_tblLook:
263 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
264 break; //todo: table look specifier
265 case NS_ooxml::LN_CT_TcPrBase_tcW:
266 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
267 break; //fixed column width is not supported

--- 23 unchanged lines hidden (view full) ---

291#ifdef DEBUG_DOMAINMAPPER
292 dmapper_logger->element("unhandled");
293#endif
294 }
295 }
296 return bRet;
297}
298
301boost::shared_ptr< vector<sal_Int32> > DomainMapperTableManager::getCurrentGrid( )
299boost::shared_ptr< vector<sal_Int32> > DomainMapperTableManager::getCurrentGrid()
302{
300{
303 return m_aTableGrid.back( );
301 return m_aTableGrid.top();
304}
305
302}
303
306boost::shared_ptr< vector< sal_Int32 > > DomainMapperTableManager::getCurrentSpans( )
304boost::shared_ptr< vector< sal_Int32 > > DomainMapperTableManager::getCurrentSpans()
307{
305{
308 return m_aGridSpans.back( );
306 return m_aGridSpans.top();
309}
310
307}
308
311void DomainMapperTableManager::startLevel( )
309void DomainMapperTableManager::startLevel()
312{
310{
313 DomainMapperTableManager_Base_t::startLevel( );
311 DomainMapperTableManager_Base_t::startLevel();
314
312
313 m_nCellCounterForCurrentRow.push( 0 );
314 m_nCurrentCellBorderIndex.push( 0 );
315 m_nCurrentHeaderRepeatCount.push( 0 );
316 m_nTableWidthOfCurrentTable.push( 0 );
317
315 IntVectorPtr pNewGrid( new vector<sal_Int32> );
316 IntVectorPtr pNewSpans( new vector<sal_Int32> );
318 IntVectorPtr pNewGrid( new vector<sal_Int32> );
319 IntVectorPtr pNewSpans( new vector<sal_Int32> );
317 m_aTableGrid.push_back( pNewGrid );
318 m_aGridSpans.push_back( pNewSpans );
319 m_nTableWidth = 0;
320 m_aTableGrid.push( pNewGrid );
321 m_aGridSpans.push( pNewSpans );
320}
321
322}
323
322void DomainMapperTableManager::endLevel( )
324void DomainMapperTableManager::endLevel()
323{
325{
324 m_aTableGrid.pop_back( );
325 m_aGridSpans.pop_back( );
326 m_nTableWidth = 0;
326 m_nCellCounterForCurrentRow.pop();
327 m_nCurrentCellBorderIndex.pop();
328 m_nCurrentHeaderRepeatCount.pop();
329 m_nTableWidthOfCurrentTable.pop();
330
331 m_aTableGrid.pop();
332 m_aGridSpans.pop();
327
333
328 DomainMapperTableManager_Base_t::endLevel( );
334 DomainMapperTableManager_Base_t::endLevel();
329#ifdef DEBUG_DOMAINMAPPER
330 dmapper_logger->startElement("dmappertablemanager.endLevel");
331 PropertyMapPtr pProps = getTableProps();
332 if (pProps.get() != NULL)
333 dmapper_logger->addTag(getTableProps()->toTag());
334
335 dmapper_logger->endElement("dmappertablemanager.endLevel");
336#endif
337}
338
339/*-- 02.05.2007 14:36:26---------------------------------------------------
340
341 -----------------------------------------------------------------------*/
342void DomainMapperTableManager::endOfCellAction()
343{
344#ifdef DEBUG_DOMAINMAPPER
345 dmapper_logger->element("endOFCellAction");
346#endif
347
335#ifdef DEBUG_DOMAINMAPPER
336 dmapper_logger->startElement("dmappertablemanager.endLevel");
337 PropertyMapPtr pProps = getTableProps();
338 if (pProps.get() != NULL)
339 dmapper_logger->addTag(getTableProps()->toTag());
340
341 dmapper_logger->endElement("dmappertablemanager.endLevel");
342#endif
343}
344
345/*-- 02.05.2007 14:36:26---------------------------------------------------
346
347 -----------------------------------------------------------------------*/
348void DomainMapperTableManager::endOfCellAction()
349{
350#ifdef DEBUG_DOMAINMAPPER
351 dmapper_logger->element("endOFCellAction");
352#endif
353
348 getCurrentSpans()->push_back(m_nGridSpan);
349 m_nGridSpan = 1;
350 ++m_nCell;
354 getCurrentSpans()->push_back( m_nGridSpanOfCurrentCell );
355 m_nGridSpanOfCurrentCell = 1;
356 ++(m_nCellCounterForCurrentRow.top());
351}
352/*-- 02.05.2007 14:36:26---------------------------------------------------
353
354 -----------------------------------------------------------------------*/
355void DomainMapperTableManager::endOfRowAction()
356{
357#ifdef DEBUG_DOMAINMAPPER
358 dmapper_logger->startElement("endOfRowAction");
359#endif
360
361 IntVectorPtr pTableGrid = getCurrentGrid( );
357}
358/*-- 02.05.2007 14:36:26---------------------------------------------------
359
360 -----------------------------------------------------------------------*/
361void DomainMapperTableManager::endOfRowAction()
362{
363#ifdef DEBUG_DOMAINMAPPER
364 dmapper_logger->startElement("endOfRowAction");
365#endif
366
367 IntVectorPtr pTableGrid = getCurrentGrid( );
362 if(!m_nTableWidth && pTableGrid->size())
368 if( m_nTableWidthOfCurrentTable.top() == 0
369 && pTableGrid->size() > 0 )
363 {
364 ::std::vector<sal_Int32>::const_iterator aCellIter = pTableGrid->begin();
365
366#ifdef DEBUG_DOMAINMAPPER
367 dmapper_logger->startElement("tableWidth");
368#endif
369
370 while( aCellIter != pTableGrid->end() )
371 {
372#ifdef DEBUG_DOMAINMAPPER
373 dmapper_logger->startElement("col");
374 dmapper_logger->attribute("width", *aCellIter);
375 dmapper_logger->endElement("col");
376#endif
377
370 {
371 ::std::vector<sal_Int32>::const_iterator aCellIter = pTableGrid->begin();
372
373#ifdef DEBUG_DOMAINMAPPER
374 dmapper_logger->startElement("tableWidth");
375#endif
376
377 while( aCellIter != pTableGrid->end() )
378 {
379#ifdef DEBUG_DOMAINMAPPER
380 dmapper_logger->startElement("col");
381 dmapper_logger->attribute("width", *aCellIter);
382 dmapper_logger->endElement("col");
383#endif
384
378 m_nTableWidth += *aCellIter++;
385 m_nTableWidthOfCurrentTable.top() += *aCellIter++;
379 }
380
386 }
387
381 if( m_nTableWidth > 0)
388 if( m_nTableWidthOfCurrentTable.top() > 0)
382 {
383 TablePropertyMapPtr pPropMap( new TablePropertyMap );
384// pPropMap->Insert( PROP_WIDTH, false, uno::makeAny( m_nTableWidth ));
389 {
390 TablePropertyMapPtr pPropMap( new TablePropertyMap );
391// pPropMap->Insert( PROP_WIDTH, false, uno::makeAny( m_nTableWidth ));
385 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
392 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidthOfCurrentTable.top() );
386 insertTableProps(pPropMap);
387 }
388
389#ifdef DEBUG_DOMAINMAPPER
390 dmapper_logger->endElement("tableWidth");
391#endif
392 }
393
394 IntVectorPtr pCurrentSpans = getCurrentSpans( );
393 insertTableProps(pPropMap);
394 }
395
396#ifdef DEBUG_DOMAINMAPPER
397 dmapper_logger->endElement("tableWidth");
398#endif
399 }
400
401 IntVectorPtr pCurrentSpans = getCurrentSpans( );
395 if( pCurrentSpans->size() < m_nCell)
402 if( pCurrentSpans->size() < m_nCellCounterForCurrentRow.top() )
396 {
397 //fill missing elements with '1'
403 {
404 //fill missing elements with '1'
398 pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell - pCurrentSpans->size(), 1 );
405 pCurrentSpans->insert( pCurrentSpans->end( ), m_nCellCounterForCurrentRow.top() - pCurrentSpans->size(), 1 );
399 }
400
401#ifdef DEBUG_DOMAINMAPPER
402 dmapper_logger->startElement("gridSpans");
403 {
404 ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin();
405 ::std::vector<sal_Int32>::const_iterator aGridSpanIterEnd = pCurrentSpans->end();
406

--- 13 unchanged lines hidden (view full) ---

420 size_t nGrids = 0;
421 ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin();
422 for( ; aGridSpanIter != pCurrentSpans->end(); ++aGridSpanIter)
423 nGrids += *aGridSpanIter;
424
425 if( pTableGrid->size() == nGrids )
426 {
427 //determine table width
406 }
407
408#ifdef DEBUG_DOMAINMAPPER
409 dmapper_logger->startElement("gridSpans");
410 {
411 ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin();
412 ::std::vector<sal_Int32>::const_iterator aGridSpanIterEnd = pCurrentSpans->end();
413

--- 13 unchanged lines hidden (view full) ---

427 size_t nGrids = 0;
428 ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin();
429 for( ; aGridSpanIter != pCurrentSpans->end(); ++aGridSpanIter)
430 nGrids += *aGridSpanIter;
431
432 if( pTableGrid->size() == nGrids )
433 {
434 //determine table width
428 double nFullWidth = m_nTableWidth;
435 double nFullWidth = m_nTableWidthOfCurrentTable.top();
429 //the positions have to be distibuted in a range of 10000
430 const double nFullWidthRelative = 10000.;
436 //the positions have to be distibuted in a range of 10000
437 const double nFullWidthRelative = 10000.;
431 uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 );
438 uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCellCounterForCurrentRow.top() - 1 );
432 text::TableColumnSeparator* pSeparators = aSeparators.getArray();
433 sal_Int16 nLastRelPos = 0;
434 sal_uInt32 nBorderGridIndex = 0;
435
436 ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
439 text::TableColumnSeparator* pSeparators = aSeparators.getArray();
440 sal_Int16 nLastRelPos = 0;
441 sal_uInt32 nBorderGridIndex = 0;
442
443 ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
437 for( sal_uInt32 nBorder = 0; nBorder < m_nCell - 1; ++nBorder )
444 for( sal_uInt32 nBorder = 0; nBorder < m_nCellCounterForCurrentRow.top() - 1; ++nBorder )
438 {
439 sal_Int32 nGridCount = *aSpansIter;
440 double fGridWidth = 0.;
441 do
442 {
443 fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
444 }while( --nGridCount );
445

--- 11 unchanged lines hidden (view full) ---

457#ifdef DEBUG_DOMAINMAPPER
458 dmapper_logger->startElement("rowProperties");
459 dmapper_logger->addTag(pPropMap->toTag());
460 dmapper_logger->endElement("rowProperties");
461#endif
462 insertRowProps(pPropMap);
463 }
464
445 {
446 sal_Int32 nGridCount = *aSpansIter;
447 double fGridWidth = 0.;
448 do
449 {
450 fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
451 }while( --nGridCount );
452

--- 11 unchanged lines hidden (view full) ---

464#ifdef DEBUG_DOMAINMAPPER
465 dmapper_logger->startElement("rowProperties");
466 dmapper_logger->addTag(pPropMap->toTag());
467 dmapper_logger->endElement("rowProperties");
468#endif
469 insertRowProps(pPropMap);
470 }
471
465 ++m_nRow;
466 m_nCell = 0;
467 m_nCellBorderIndex = 0;
472 m_nCellCounterForCurrentRow.top() = 0;
473 m_nCurrentCellBorderIndex.top() = 0;
468 pCurrentSpans->clear();
469
470#ifdef DEBUG_DOMAINMAPPER
471 dmapper_logger->endElement("endOfRowAction");
472#endif
473}
474 pCurrentSpans->clear();
475
476#ifdef DEBUG_DOMAINMAPPER
477 dmapper_logger->endElement("endOfRowAction");
478#endif
479}
474/*-- 18.06.2007 10:34:37---------------------------------------------------
475
480
476 -----------------------------------------------------------------------*/
477void DomainMapperTableManager::clearData()
478{
479 m_nRow = m_nCell = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0;
480 m_sTableStyleName = ::rtl::OUString();
481 m_pTableStyleTextProperies.reset();
482}
483/*-- 27.06.2007 14:19:50---------------------------------------------------
484
481
485 -----------------------------------------------------------------------*/
486void lcl_CopyTextProperties(PropertyMapPtr pToFill,
487 const StyleSheetEntry* pStyleSheetEntry, StyleSheetTablePtr pStyleSheetTable)
488{
489 if( !pStyleSheetEntry )
490 return;
491 //fill base style properties first, recursively
492 if( pStyleSheetEntry->sBaseStyleIdentifier.getLength())
493 {
494 const StyleSheetEntryPtr pParentStyleSheet =
495 pStyleSheetTable->FindStyleSheetByISTD(pStyleSheetEntry->sBaseStyleIdentifier);
496 OSL_ENSURE( pParentStyleSheet, "table style not found" );
497 lcl_CopyTextProperties( pToFill, pParentStyleSheet.get( ), pStyleSheetTable);
498 }
499
500 PropertyMap::const_iterator aPropIter = pStyleSheetEntry->pProperties->begin();
501 while(aPropIter != pStyleSheetEntry->pProperties->end())
502 {
503 //copy all text properties form the table style to the current run attributes
504 if( aPropIter->first.bIsTextProperty )
505 pToFill->insert(*aPropIter);
506 ++aPropIter;
507 }
508}
509void DomainMapperTableManager::CopyTextProperties(PropertyMapPtr pContext, StyleSheetTablePtr pStyleSheetTable)
510{
511 if( !m_pTableStyleTextProperies.get())
512 {
513 m_pTableStyleTextProperies.reset( new PropertyMap );
514 const StyleSheetEntryPtr pStyleSheetEntry = pStyleSheetTable->FindStyleSheetByISTD(
515 m_sTableStyleName);
516 OSL_ENSURE( pStyleSheetEntry, "table style not found" );
517 lcl_CopyTextProperties(m_pTableStyleTextProperies, pStyleSheetEntry.get( ), pStyleSheetTable);
518 }
519 pContext->insert( m_pTableStyleTextProperies );
520}
521
522
523}}
482}}