apple_remote/RemoteControl.m | 2 vcl/aqua/source/app/salinst.cxx | 9 writerfilter/inc/resourcemodel/TableManager.hxx | 97 ++++----- writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 31 ++- writerfilter/source/dmapper/DomainMapperTableHandler.hxx | 57 +++-- writerfilter/source/dmapper/DomainMapperTableManager.cxx | 155 +++++---------- writerfilter/source/dmapper/DomainMapperTableManager.hxx | 30 +- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 writerfilter/source/dmapper/TablePropertiesHandler.cxx | 1 writerfilter/source/doctok/WW8ResourceModelImpl.cxx | 12 - writerfilter/source/resourcemodel/resourcemodel.cxx | 6 12 files changed, 195 insertions(+), 216 deletions(-)
New commits: commit f8eebff890810dc4cc507db875c3402ce073765d Author: Herbert Dürr <[email protected]> Date: Fri Feb 7 14:35:43 2014 +0000 #i124201# re-enable the AppleRemote again now that its nasty stability problems on 64bit AOO for OSX are fixed diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 42afa6e..46e367d 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -191,9 +191,7 @@ static void initNSApp() NSLog(@"Unable to obtain system version: %ld", (long)err); // Initialize Apple Remote -#if 0 // disabled for now for stability problems - GetSalData()->mpMainController = [[MainController alloc] init]; -#endif + GetSalData()->mpMainController = [[MainController alloc] init]; // TODO: rename MainController to AppleRemoteController [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp selector: @selector(applicationWillBecomeActive:) commit 77a3b588293e8c86131158c21aede3cbebf0ff2d Author: Herbert Dürr <[email protected]> Date: Fri Feb 7 14:34:14 2014 +0000 #i124201# prevent a NSException in AppleRemote's sendDistributedNotification method the RemoteControl is already initialized anyway diff --git a/apple_remote/RemoteControl.m b/apple_remote/RemoteControl.m index d0812d3..b74decb 100644 --- a/apple_remote/RemoteControl.m +++ b/apple_remote/RemoteControl.m @@ -97,7 +97,6 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier"; + (void) sendDistributedNotification: (NSString*) notificationName targetBundleIdentifier: (NSString*) targetIdentifier { - if ( (self = [super init]) ) { NSDictionary* userInfo = [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithCString:[self remoteControlDeviceName] encoding:NSASCIIStringEncoding], kRemoteControlDeviceName /* key = RemoteControlDeviceName -> OK */, [[NSBundle mainBundle] bundleIdentifier] /* value = org.openoffice.script -> OK */, @@ -123,7 +122,6 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier"; object:nil userInfo:userInfo deliverImmediately:YES]; - } } + (void) sendFinishedNotifcationForAppIdentifier: (NSString*) identifier { commit 2d6f7c351fd53de62af5262778173538942aa4b1 Author: Herbert Dürr <[email protected]> Date: Fri Feb 7 14:29:20 2014 +0000 #i124201# fix frame-list handling with AppleRemote events iterating beyond the end of a frame-list must be avoided diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 26cccd4..42afa6e 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -622,11 +622,10 @@ void AquaSalInstance::handleAppDefinedEvent( NSEvent* pEvent ) bool bIsFullScreenMode = false; std::list<AquaSalFrame*>::iterator it = pSalData->maFrames.begin(); - while( (*it) && ( (it != pSalData->maFrames.end() ) || ( (*it)->mbFullScreen == false ) ) ) + for(; it != pSalData->maFrames.end(); ++it ) { if( (*it)->mbFullScreen ) bIsFullScreenMode = true; - it++; } switch ([pEvent data1]) @@ -663,7 +662,7 @@ void AquaSalInstance::handleAppDefinedEvent( NSEvent* pEvent ) break; } AquaSalFrame* pFrame = pSalData->maFrames.front(); - Window * pWindow = pFrame->GetWindow() ? pSalData->maFrames.front()->GetWindow() : NULL; + Window* pWindow = pFrame ? pFrame->GetWindow() : NULL; if( pWindow ) { commit f60d1e36194e2fe6d479b6f747e158efd4ba9e2b Author: Oliver-Rainer Wittmann <[email protected]> Date: Fri Feb 7 14:22:16 2014 +0000 123345: import - correct handling of sub tables import - import table's left margin import - set table's bottom margin explicitly diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx index 06af670..b013ed9 100644 --- a/writerfilter/inc/resourcemodel/TableManager.hxx +++ b/writerfilter/inc/resourcemodel/TableManager.hxx @@ -24,17 +24,9 @@ #ifndef INCLUDED_TABLE_MANAGER_HXX #define INCLUDED_TABLE_MANAGER_HXX -#ifndef INCLUDED_TABLE_DATA_HXX #include <resourcemodel/TableData.hxx> -#endif - -#ifndef INCLUDED_WW8_RESOURCE_MODEL_HXX #include <resourcemodel/WW8ResourceModel.hxx> -#endif - -#ifndef INCLUDED_SPRMIDS_HXX #include <doctok/sprmids.hxx> -#endif #include <boost/shared_ptr.hpp> #include <stack> @@ -62,13 +54,16 @@ public: @param nDepth depth of the table in surrounding table hierarchy @param pProps properties of the table */ - virtual void startTable(unsigned int nRows, unsigned int nDepth, - PropertiesPointer pProps) = 0; + virtual void startTable( + unsigned int nRows, + unsigned int nDepth, + PropertiesPointer pProps ) = 0; /** Handle end of table. */ - virtual void endTable() = 0; + virtual void endTable( + const unsigned int nDepth ) = 0; /** Handle start of row. @@ -76,8 +71,9 @@ public: @param nCols number of columns in the table @param pProps properties of the row */ - virtual void startRow(unsigned int nCols, - PropertiesPointer pProps) = 0; + virtual void startRow( + unsigned int nCols, + PropertiesPointer pProps ) = 0; /** Handle end of row. @@ -90,14 +86,17 @@ public: @param rT start handle of the cell @param pProps properties of the cell */ - virtual void startCell(const T & rT, PropertiesPointer pProps) = 0; + virtual void startCell( + const T & rT, + PropertiesPointer pProps ) = 0; /** Handle end of cell. @param rT end handle of cell */ - virtual void endCell(const T & rT) = 0; + virtual void endCell( + const T & rT ) = 0; }; template <typename T, typename PropertiesPointer> @@ -297,9 +296,10 @@ protected: return mState.getProps(); } - void setProps(PropertiesPointer pProps) + void setProps( + PropertiesPointer pProps ) { - mState.setProps(pProps); + mState.setProps( pProps ); } void resetProps() @@ -312,9 +312,10 @@ protected: return mState.getCellProps(); } - void setCellProps(PropertiesPointer pProps) + void setCellProps( + PropertiesPointer pProps ) { - mState.setCellProps(pProps); + mState.setCellProps( pProps ); } void resetCellProps() @@ -327,9 +328,10 @@ protected: return mState.getRowProps(); } - void setRowProps(PropertiesPointer pProps) + void setRowProps( + PropertiesPointer pProps ) { - mState.setRowProps(pProps); + mState.setRowProps( pProps ); } void resetRowProps() @@ -337,9 +339,10 @@ protected: mState.resetRowProps(); } - void setInCell(bool bInCell) + void setInCell( + bool bInCell ) { - mState.setInCell(bInCell); + mState.setInCell( bInCell ); } bool isInCell() const @@ -347,9 +350,10 @@ protected: return mState.isInCell(); } - void setCellEnd(bool bCellEnd) + void setCellEnd( + bool bCellEnd ) { - mState.setCellEnd(bCellEnd); + mState.setCellEnd( bCellEnd ); } bool isCellEnd() const @@ -357,9 +361,10 @@ protected: return mState.isCellEnd(); } - void setRowEnd(bool bRowEnd) + void setRowEnd( + bool bRowEnd ) { - mState.setRowEnd(bRowEnd); + mState.setRowEnd( bRowEnd ); } bool isRowEnd() const @@ -372,9 +377,10 @@ protected: return mState.getTableProps(); } - void setTableProps(PropertiesPointer pProps) + void setTableProps( + PropertiesPointer pProps ) { - mState.setTableProps(pProps); + mState.setTableProps( pProps ); } void resetTableProps() @@ -387,7 +393,8 @@ protected: return mCurHandle; } - void setHandle(const T & rHandle) + void setHandle( + const T & rHandle ) { mCurHandle = rHandle; } @@ -480,9 +487,6 @@ protected: paragraph. */ virtual void endOfRowAction(); - /** let the derived class clear their table related data - */ - virtual void clearData(); public: @@ -778,26 +782,25 @@ void TableManager<T, PropertiesPointer>::endParagraphGroup() mnTableDepth = mnTableDepthNew; - if (mnTableDepth > 0) + if ( mnTableDepth > 0 ) { - typename TableData<T, PropertiesPointer>::Pointer_t pTableData = - mTableDataStack.top(); + typename TableData< T, PropertiesPointer >::Pointer_t pTableData = mTableDataStack.top(); - if (isRowEnd()) + if ( isRowEnd() ) { endOfRowAction(); - pTableData->endRow(getRowProps()); + pTableData->endRow( getRowProps() ); resetRowProps(); } - else if (isInCell()) + else if ( isInCell() ) { - ensureOpenCell(getCellProps()); + ensureOpenCell( getCellProps() ); - if (isCellEnd()) + if ( isCellEnd() ) { endOfCellAction(); - closeCell(getHandle()); + closeCell( getHandle() ); } } resetCellProps(); @@ -971,7 +974,7 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable() typename TableData<T, PropertiesPointer>::Pointer_t pTableData = mTableDataStack.top(); - unsigned int nRows = pTableData->getRowCount(); + const unsigned int nRows = pTableData->getRowCount(); mpTableDataHandler->startTable(nRows, pTableData->getDepth(), getTableProps()); @@ -995,10 +998,9 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable() mpTableDataHandler->endRow(); } - mpTableDataHandler->endTable(); + mpTableDataHandler->endTable( pTableData->getDepth() ); } resetTableProps(); - clearData(); #ifdef DEBUG_TABLE if (mpTableLogger.get() != NULL) @@ -1023,11 +1025,6 @@ bool TableManager<T, PropertiesPointer>::isIgnore() const } template <typename T, typename PropertiesPointer> -void TableManager<T, PropertiesPointer>::clearData() -{ -} - -template <typename T, typename PropertiesPointer> void TableManager<T, PropertiesPointer>::openCell (const T & rHandle, PropertiesPointer pProps) { diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index cf480f8..15b49a8 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -285,7 +285,9 @@ struct WRITERFILTER_DLLPRIVATE TableInfo }; -TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo & rInfo) +TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle( + TableInfo & rInfo, + const bool bAdjustLeftMarginByDefaultValue ) { // will receive the table style if any TableStyleSheetEntry* pTableStyle = NULL; @@ -463,7 +465,14 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo lcl_debug_TableBorder(aTableBorder); #endif - m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( nLeftMargin - nGapHalf - rInfo.nLeftBorderDistance)); + m_aTableProperties->Insert( + PROP_LEFT_MARGIN, + false, + uno::makeAny( nLeftMargin - nGapHalf - ( bAdjustLeftMarginByDefaultValue ? rInfo.nLeftBorderDistance : 0 ) ) ); + + // no bottom margin - set it explicitly to avoid inheritance from a set dynamic pool default + // which might be provided via document default paragraph properties. + m_aTableProperties->Insert( PROP_BOTTOM_MARGIN, false, uno::makeAny( (sal_Int32)0 ) ); m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth ); if( nTableWidth > 0 ) @@ -702,14 +711,18 @@ RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties() return aRowProperties; } -void DomainMapperTableHandler::endTable() +void DomainMapperTableHandler::endTable( + const unsigned int nDepth ) { #ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("tablehandler.endTable"); #endif TableInfo aTableInfo; - aTableInfo.pTableStyle = endTableGetTableStyle(aTableInfo); + // adjust left margin only for tables in the body text, not for sub tables. + const bool bAdjustLeftMarginByDefaultValue = (nDepth == 0); + aTableInfo.pTableStyle = + endTableGetTableStyle( aTableInfo, bAdjustLeftMarginByDefaultValue ); // expands to uno::Sequence< Sequence< beans::PropertyValues > > CellPropertyValuesSeq_t aCellProperties = endTableGetCellProperties(aTableInfo); @@ -724,10 +737,12 @@ void DomainMapperTableHandler::endTable() { try { - uno::Reference<text::XTextTable> xTable = m_xText->convertToTable(*m_pTableSeq, - aCellProperties, - aRowProperties, - aTableInfo.aTableProperties); + uno::Reference< text::XTextTable > xTable = + m_xText->convertToTable( + *m_pTableSeq, + aCellProperties, + aRowProperties, + aTableInfo.aTableProperties ); m_xTableRange = xTable->getAnchor( ); } diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx index 8a13782..b82e748 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx @@ -54,6 +54,38 @@ class TableStyleSheetEntry; struct TableInfo; class DomainMapperTableHandler : public TableDataHandler<Handle_t , TablePropertyMapPtr > { +public: + typedef boost::shared_ptr<DomainMapperTableHandler> Pointer_t; + + DomainMapperTableHandler(TextReference_t xText, DomainMapper_Impl& rDMapper_Impl); + virtual ~DomainMapperTableHandler(); + + virtual void startTable( + unsigned int nRows, + unsigned int nDepth, + TablePropertyMapPtr pProps ); + + virtual void endTable( + const unsigned int nDepth ); + + virtual void startRow( + unsigned int nCells, + TablePropertyMapPtr pProps ); + + virtual void endRow(); + + virtual void startCell( + const Handle_t & start, + TablePropertyMapPtr pProps ); + + virtual void endCell( const Handle_t & end ); + + virtual Handle_t* getTable( ) + { + return &m_xTableRange; + }; + +private: TextReference_t m_xText; DomainMapper_Impl& m_rDMapper_Impl; CellSequencePointer_t m_pCellSeq; @@ -70,28 +102,13 @@ class DomainMapperTableHandler : public TableDataHandler<Handle_t , TablePropert sal_Int32 m_nCellIndex; sal_Int32 m_nRowIndex; - TableStyleSheetEntry * endTableGetTableStyle(TableInfo & rInfo); - CellPropertyValuesSeq_t endTableGetCellProperties(TableInfo & rInfo); - RowPropertyValuesSeq_t endTableGetRowProperties(); - -public: - typedef boost::shared_ptr<DomainMapperTableHandler> Pointer_t; - - DomainMapperTableHandler(TextReference_t xText, DomainMapper_Impl& rDMapper_Impl); - virtual ~DomainMapperTableHandler(); + TableStyleSheetEntry * endTableGetTableStyle( + TableInfo & rInfo, + const bool bAdjustLeftMarginByDefaultValue ); - virtual void startTable(unsigned int nRows, unsigned int nDepth, - TablePropertyMapPtr pProps); - virtual void endTable(); - virtual void startRow(unsigned int nCells, TablePropertyMapPtr pProps); - virtual void endRow(); - virtual void startCell(const Handle_t & start, TablePropertyMapPtr pProps); - virtual void endCell(const Handle_t & end); + CellPropertyValuesSeq_t endTableGetCellProperties(TableInfo & rInfo); - virtual Handle_t* getTable( ) - { - return &m_xTableRange; - }; + RowPropertyValuesSeq_t endTableGetRowProperties(); }; }} diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index ee10b17..bc23e69 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -45,12 +45,11 @@ using namespace ::std; -----------------------------------------------------------------------*/ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) : - m_nRow(0), - m_nCell(0), - m_nGridSpan(1), - m_nCellBorderIndex(0), - m_nHeaderRepeat(0), - m_nTableWidth(0), + m_nCellCounterForCurrentRow(), + m_nGridSpanOfCurrentCell( 1 ), + m_nCurrentCellBorderIndex(), + m_nCurrentHeaderRepeatCount(), + m_nTableWidthOfCurrentTable(), m_bOOXML( bOOXML ), m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) ) { @@ -117,9 +116,9 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) } else { - m_nTableWidth = pMeasureHandler->getMeasureValue(); - if( m_nTableWidth ) - pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth ); + m_nTableWidthOfCurrentTable.top() = pMeasureHandler->getMeasureValue(); + if( m_nTableWidthOfCurrentTable.top() > 0 ) + pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidthOfCurrentTable.top() ); } #ifdef DEBUG_DOMAINMAPPER dmapper_logger->addTag(pPropMap->toTag()); @@ -133,15 +132,15 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */ // if nIntValue == 1 then the row is a repeated header line // to prevent later rows from increasing the repeating m_nHeaderRepeat is set to NULL when repeating stops - if( nIntValue > 0 && m_nHeaderRepeat >= 0 ) + if( nIntValue > 0 && m_nCurrentHeaderRepeatCount.top() >= 0 ) { - ++m_nHeaderRepeat; + ++(m_nCurrentHeaderRepeatCount.top()); TablePropertyMapPtr pPropMap( new TablePropertyMap ); - pPropMap->Insert( PROP_HEADER_ROW_COUNT, false, uno::makeAny( m_nHeaderRepeat )); + pPropMap->Insert( PROP_HEADER_ROW_COUNT, false, uno::makeAny( m_nCurrentHeaderRepeatCount.top() )); insertTableProps(pPropMap); } else - m_nHeaderRepeat = -1; + m_nCurrentHeaderRepeatCount.top() = -1; break; case 0xd608: // TDefTable /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */ @@ -155,13 +154,13 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) TablePropertyMapPtr pRowPropMap( new TablePropertyMap ); pRowPropMap->insert( pTDefTableHandler->getRowProperties() ); insertRowProps( pRowPropMap ); - if( !m_nTableWidth ) + if( m_nTableWidthOfCurrentTable.top() == 0 ) { - m_nTableWidth= pTDefTableHandler->getTableWidth(); - if( m_nTableWidth ) + m_nTableWidthOfCurrentTable.top() = pTDefTableHandler->getTableWidth(); + if( m_nTableWidthOfCurrentTable.top() > 0 ) { TablePropertyMapPtr pPropMap( new TablePropertyMap ); - pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth ); + pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidthOfCurrentTable.top() ); insertTableProps(pPropMap); } } @@ -184,8 +183,8 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) pProperties->resolve(*pBorderHandler); TablePropertyMapPtr pCellPropMap( new TablePropertyMap() ); pCellPropMap->insert( pBorderHandler->getProperties() ); - cellPropsByCell( m_nCellBorderIndex, pCellPropMap ); - ++m_nCellBorderIndex; + cellPropsByCell( m_nCurrentCellBorderIndex.top(), pCellPropMap ); + ++(m_nCurrentCellBorderIndex.top()); } } break; @@ -229,9 +228,8 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) case NS_ooxml::LN_CT_TblPrBase_tblStyle: //table style name /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */ { - m_sTableStyleName = pValue->getString(); TablePropertyMapPtr pPropMap( new TablePropertyMap ); - pPropMap->Insert( META_PROP_TABLE_STYLE_NAME, false, uno::makeAny( m_sTableStyleName )); + pPropMap->Insert( META_PROP_TABLE_STYLE_NAME, false, uno::makeAny( pValue->getString() )); insertTableProps(pPropMap); } break; @@ -258,7 +256,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) dmapper_logger->attribute("gridSpan", nIntValue); dmapper_logger->endElement("tablemanager.GridSpan"); #endif - m_nGridSpan = nIntValue; + m_nGridSpanOfCurrentCell = nIntValue; } break; case NS_ooxml::LN_CT_TblPrBase_tblLook: @@ -298,34 +296,42 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) return bRet; } -boost::shared_ptr< vector<sal_Int32> > DomainMapperTableManager::getCurrentGrid( ) +boost::shared_ptr< vector<sal_Int32> > DomainMapperTableManager::getCurrentGrid() { - return m_aTableGrid.back( ); + return m_aTableGrid.top(); } -boost::shared_ptr< vector< sal_Int32 > > DomainMapperTableManager::getCurrentSpans( ) +boost::shared_ptr< vector< sal_Int32 > > DomainMapperTableManager::getCurrentSpans() { - return m_aGridSpans.back( ); + return m_aGridSpans.top(); } -void DomainMapperTableManager::startLevel( ) +void DomainMapperTableManager::startLevel() { - DomainMapperTableManager_Base_t::startLevel( ); + DomainMapperTableManager_Base_t::startLevel(); + + m_nCellCounterForCurrentRow.push( 0 ); + m_nCurrentCellBorderIndex.push( 0 ); + m_nCurrentHeaderRepeatCount.push( 0 ); + m_nTableWidthOfCurrentTable.push( 0 ); IntVectorPtr pNewGrid( new vector<sal_Int32> ); IntVectorPtr pNewSpans( new vector<sal_Int32> ); - m_aTableGrid.push_back( pNewGrid ); - m_aGridSpans.push_back( pNewSpans ); - m_nTableWidth = 0; + m_aTableGrid.push( pNewGrid ); + m_aGridSpans.push( pNewSpans ); } -void DomainMapperTableManager::endLevel( ) +void DomainMapperTableManager::endLevel() { - m_aTableGrid.pop_back( ); - m_aGridSpans.pop_back( ); - m_nTableWidth = 0; + m_nCellCounterForCurrentRow.pop(); + m_nCurrentCellBorderIndex.pop(); + m_nCurrentHeaderRepeatCount.pop(); + m_nTableWidthOfCurrentTable.pop(); + + m_aTableGrid.pop(); + m_aGridSpans.pop(); - DomainMapperTableManager_Base_t::endLevel( ); + DomainMapperTableManager_Base_t::endLevel(); #ifdef DEBUG_DOMAINMAPPER dmapper_logger->startElement("dmappertablemanager.endLevel"); PropertyMapPtr pProps = getTableProps(); @@ -345,9 +351,9 @@ void DomainMapperTableManager::endOfCellAction() dmapper_logger->element("endOFCellAction"); #endif - getCurrentSpans()->push_back(m_nGridSpan); - m_nGridSpan = 1; - ++m_nCell; + getCurrentSpans()->push_back( m_nGridSpanOfCurrentCell ); + m_nGridSpanOfCurrentCell = 1; + ++(m_nCellCounterForCurrentRow.top()); } /*-- 02.05.2007 14:36:26--------------------------------------------------- @@ -359,7 +365,8 @@ void DomainMapperTableManager::endOfRowAction() #endif IntVectorPtr pTableGrid = getCurrentGrid( ); - if(!m_nTableWidth && pTableGrid->size()) + if( m_nTableWidthOfCurrentTable.top() == 0 + && pTableGrid->size() > 0 ) { ::std::vector<sal_Int32>::const_iterator aCellIter = pTableGrid->begin(); @@ -375,14 +382,14 @@ void DomainMapperTableManager::endOfRowAction() dmapper_logger->endElement("col"); #endif - m_nTableWidth += *aCellIter++; + m_nTableWidthOfCurrentTable.top() += *aCellIter++; } - if( m_nTableWidth > 0) + if( m_nTableWidthOfCurrentTable.top() > 0) { TablePropertyMapPtr pPropMap( new TablePropertyMap ); // pPropMap->Insert( PROP_WIDTH, false, uno::makeAny( m_nTableWidth )); - pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth ); + pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidthOfCurrentTable.top() ); insertTableProps(pPropMap); } @@ -392,10 +399,10 @@ void DomainMapperTableManager::endOfRowAction() } IntVectorPtr pCurrentSpans = getCurrentSpans( ); - if( pCurrentSpans->size() < m_nCell) + if( pCurrentSpans->size() < m_nCellCounterForCurrentRow.top() ) { //fill missing elements with '1' - pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell - pCurrentSpans->size(), 1 ); + pCurrentSpans->insert( pCurrentSpans->end( ), m_nCellCounterForCurrentRow.top() - pCurrentSpans->size(), 1 ); } #ifdef DEBUG_DOMAINMAPPER @@ -425,16 +432,16 @@ void DomainMapperTableManager::endOfRowAction() if( pTableGrid->size() == nGrids ) { //determine table width - double nFullWidth = m_nTableWidth; + double nFullWidth = m_nTableWidthOfCurrentTable.top(); //the positions have to be distibuted in a range of 10000 const double nFullWidthRelative = 10000.; - uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 ); + uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCellCounterForCurrentRow.top() - 1 ); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); sal_Int16 nLastRelPos = 0; sal_uInt32 nBorderGridIndex = 0; ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( ); - for( sal_uInt32 nBorder = 0; nBorder < m_nCell - 1; ++nBorder ) + for( sal_uInt32 nBorder = 0; nBorder < m_nCellCounterForCurrentRow.top() - 1; ++nBorder ) { sal_Int32 nGridCount = *aSpansIter; double fGridWidth = 0.; @@ -462,62 +469,14 @@ void DomainMapperTableManager::endOfRowAction() insertRowProps(pPropMap); } - ++m_nRow; - m_nCell = 0; - m_nCellBorderIndex = 0; + m_nCellCounterForCurrentRow.top() = 0; + m_nCurrentCellBorderIndex.top() = 0; pCurrentSpans->clear(); #ifdef DEBUG_DOMAINMAPPER dmapper_logger->endElement("endOfRowAction"); #endif } -/*-- 18.06.2007 10:34:37--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void DomainMapperTableManager::clearData() -{ - m_nRow = m_nCell = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0; - m_sTableStyleName = ::rtl::OUString(); - m_pTableStyleTextProperies.reset(); -} -/*-- 27.06.2007 14:19:50--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void lcl_CopyTextProperties(PropertyMapPtr pToFill, - const StyleSheetEntry* pStyleSheetEntry, StyleSheetTablePtr pStyleSheetTable) -{ - if( !pStyleSheetEntry ) - return; - //fill base style properties first, recursively - if( pStyleSheetEntry->sBaseStyleIdentifier.getLength()) - { - const StyleSheetEntryPtr pParentStyleSheet = - pStyleSheetTable->FindStyleSheetByISTD(pStyleSheetEntry->sBaseStyleIdentifier); - OSL_ENSURE( pParentStyleSheet, "table style not found" ); - lcl_CopyTextProperties( pToFill, pParentStyleSheet.get( ), pStyleSheetTable); - } - - PropertyMap::const_iterator aPropIter = pStyleSheetEntry->pProperties->begin(); - while(aPropIter != pStyleSheetEntry->pProperties->end()) - { - //copy all text properties form the table style to the current run attributes - if( aPropIter->first.bIsTextProperty ) - pToFill->insert(*aPropIter); - ++aPropIter; - } -} -void DomainMapperTableManager::CopyTextProperties(PropertyMapPtr pContext, StyleSheetTablePtr pStyleSheetTable) -{ - if( !m_pTableStyleTextProperies.get()) - { - m_pTableStyleTextProperies.reset( new PropertyMap ); - const StyleSheetEntryPtr pStyleSheetEntry = pStyleSheetTable->FindStyleSheetByISTD( - m_sTableStyleName); - OSL_ENSURE( pStyleSheetEntry, "table style not found" ); - lcl_CopyTextProperties(m_pTableStyleTextProperies, pStyleSheetEntry.get( ), pStyleSheetTable); - } - pContext->insert( m_pTableStyleTextProperies ); -} }} diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx index ecefdfc..520fb60 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx @@ -30,6 +30,7 @@ #include <StyleSheetTable.hxx> #include <com/sun/star/text/XTextRange.hpp> #include <vector> +#include <stack> namespace writerfilter { namespace dmapper { @@ -38,24 +39,19 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t { typedef boost::shared_ptr< std::vector<sal_Int32> > IntVectorPtr; - sal_uInt32 m_nRow; - sal_uInt32 m_nCell; - sal_uInt32 m_nGridSpan; - sal_uInt32 m_nCellBorderIndex; //borders are provided for all cells and need counting - sal_Int32 m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops - sal_Int32 m_nTableWidth; //might be set directly or has to be calculated from the column positions + ::std::stack< sal_uInt32 > m_nCellCounterForCurrentRow; + sal_uInt32 m_nGridSpanOfCurrentCell; + ::std::stack< sal_uInt32 > m_nCurrentCellBorderIndex; //borders are provided for all cells and need counting + ::std::stack< sal_Int32 > m_nCurrentHeaderRepeatCount; //counter of repeated headers - if == -1 then the repeating stops + ::std::stack< sal_Int32 > m_nTableWidthOfCurrentTable; //might be set directly or has to be calculated from the column positions bool m_bOOXML; - ::rtl::OUString m_sTableStyleName; - PropertyMapPtr m_pTableStyleTextProperies; - ::std::vector< IntVectorPtr > m_aTableGrid; - ::std::vector< IntVectorPtr > m_aGridSpans; + ::std::stack< IntVectorPtr > m_aTableGrid; + ::std::stack< IntVectorPtr > m_aGridSpans; TablePropertiesHandler *m_pTablePropsHandler; PropertyMapPtr m_pStyleProps; - virtual void clearData(); - public: DomainMapperTableManager(bool bOOXML); @@ -67,19 +63,15 @@ public: virtual bool sprm(Sprm & rSprm); - virtual void startLevel( ); - virtual void endLevel( ); + virtual void startLevel(); + virtual void endLevel(); virtual void endOfCellAction(); virtual void endOfRowAction(); - IntVectorPtr getCurrentGrid( ); + IntVectorPtr getCurrentGrid(); IntVectorPtr getCurrentSpans( ); - const ::rtl::OUString& getTableStyleName() const { return m_sTableStyleName; } - /// copy the text properties of the table style and its parent into pContext - void CopyTextProperties(PropertyMapPtr pContext, StyleSheetTablePtr pStyleSheetTable); - inline virtual void cellProps(TablePropertyMapPtr pProps) { if ( m_pStyleProps.get( ) ) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index eab3b0b..95ebf70 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -161,18 +161,15 @@ DomainMapper_Impl::DomainMapper_Impl( uno::Reference< text::XTextAppendAndConvert > xBodyTextAppendAndConvert( m_xBodyText, uno::UNO_QUERY ); TableDataHandler_t::Pointer_t pTableHandler (new DomainMapperTableHandler(xBodyTextAppendAndConvert, *this)); - getTableManager( ).setHandler(pTableHandler); - - getTableManager( ).startLevel(); + getTableManager().setHandler(pTableHandler); } /*-- 01.09.2006 10:22:28--------------------------------------------------- -----------------------------------------------------------------------*/ DomainMapper_Impl::~DomainMapper_Impl() { - RemoveLastParagraph( ); - getTableManager( ).endLevel(); - popTableManager( ); + RemoveLastParagraph(); + popTableManager(); } /*------------------------------------------------------------------------- diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 9e3774f..314d772 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -566,7 +566,7 @@ public: return *pMngr.get( ); } - void appendTableManager( ) + void appendTableManager() { boost::shared_ptr< DomainMapperTableManager > pMngr( new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML ) ); diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index fa88db5..eae1def 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -247,6 +247,7 @@ namespace dmapper { if (pProperties.get()) { MeasureHandlerPtr pHandler(new MeasureHandler); + pProperties->resolve(*pHandler); TablePropertyMapPtr pTblIndMap(new TablePropertyMap); sal_uInt32 nTblInd = pHandler->getMeasureValue(); pTblIndMap->setValue( TablePropertyMap::LEFT_MARGIN, nTblInd); diff --git a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx index 4fc94f0..2e8a126 100644 --- a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx +++ b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx @@ -44,9 +44,12 @@ class WW8TableDataHandler : public TableDataHandler<string, { public: typedef boost::shared_ptr<WW8TableDataHandler> Pointer_t; - virtual void startTable(unsigned int nRows, unsigned int nDepth, - TablePropsPointer_t pProps); - virtual void endTable(); + virtual void startTable( + unsigned int nRows, + unsigned int nDepth, + TablePropsPointer_t pProps ); + virtual void endTable( + const unsigned int nDepth ); virtual void startRow(unsigned int nCols, TablePropsPointer_t pProps); virtual void endRow(); @@ -70,7 +73,8 @@ void WW8TableDataHandler::startTable(unsigned int nRows, unsigned int nDepth, output.addItem(tmpStr); } -void WW8TableDataHandler::endTable() +void WW8TableDataHandler::endTable( + const unsigned int /*nTableDepth*/ ) { output.addItem("</tabledata.table>"); } diff --git a/writerfilter/source/resourcemodel/resourcemodel.cxx b/writerfilter/source/resourcemodel/resourcemodel.cxx index a2f1664..4e56bdc 100644 --- a/writerfilter/source/resourcemodel/resourcemodel.cxx +++ b/writerfilter/source/resourcemodel/resourcemodel.cxx @@ -103,7 +103,8 @@ public: typedef boost::shared_ptr<WW8TableDataHandler> Pointer_t; virtual void startTable(unsigned int nRows, unsigned int nDepth, TablePropsRef_t pProps); - virtual void endTable(); + virtual void endTable( + const unsigned int nDepth ); virtual void startRow(unsigned int nCols, TablePropsRef_t pProps); virtual void endRow(); @@ -127,7 +128,8 @@ void WW8TableDataHandler::startTable(unsigned int nRows, unsigned int nDepth, output.addItem(tmpStr); } -void WW8TableDataHandler::endTable() +void WW8TableDataHandler::endTable( + const unsigned int /*nDepth*/ ) { output.addItem("</tabledata.table>"); }
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
