You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2014/02/07 15:22:17 UTC
svn commit: r1565662 - in /openoffice/trunk/main/writerfilter:
inc/resourcemodel/ source/dmapper/ source/doctok/ source/resourcemodel/
Author: orw
Date: Fri Feb 7 14:22:16 2014
New Revision: 1565662
URL: http://svn.apache.org/r1565662
Log:
123345: import - correct handling of sub tables
import - import table's left margin
import - set table's bottom margin explicitly
Modified:
openoffice/trunk/main/writerfilter/inc/resourcemodel/TableManager.hxx
openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx
openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.hxx
openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx
openoffice/trunk/main/writerfilter/source/dmapper/TablePropertiesHandler.cxx
openoffice/trunk/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx
openoffice/trunk/main/writerfilter/source/resourcemodel/resourcemodel.cxx
Modified: openoffice/trunk/main/writerfilter/inc/resourcemodel/TableManager.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/inc/resourcemodel/TableManager.hxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/inc/resourcemodel/TableManager.hxx (original)
+++ openoffice/trunk/main/writerfilter/inc/resourcemodel/TableManager.hxx Fri Feb 7 14:22:16 2014
@@ -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>
@@ -175,74 +174,74 @@ class TableManager
{
mTableProps.pop();
}
-
- /**
- Reset to initial state at beginning of row.
- */
- void resetCellSpecifics()
- {
- mbRowEnd = false;
- mbInCell = false;
- mbCellEnd = false;
- }
-
+
+ /**
+ Reset to initial state at beginning of row.
+ */
+ void resetCellSpecifics()
+ {
+ mbRowEnd = false;
+ mbInCell = false;
+ mbCellEnd = false;
+ }
+
void resetProps()
{
mpProps.reset();
}
-
+
void setProps(PropertiesPointer pProps)
{
- mpProps = pProps;
+ mpProps = pProps;
}
-
+
PropertiesPointer getProps()
{
return mpProps;
}
-
+
void resetCellProps()
{
mpCellProps.reset();
}
-
+
void setCellProps(PropertiesPointer pProps)
{
mpCellProps = pProps;
}
-
+
PropertiesPointer getCellProps()
{
return mpCellProps;
}
-
+
void resetRowProps()
{
mpRowProps.reset();
}
-
+
void setRowProps(PropertiesPointer pProps)
{
mpRowProps = pProps;
}
-
+
PropertiesPointer getRowProps()
{
return mpRowProps;
}
-
+
void resetTableProps()
{
if (mTableProps.size() > 0)
mTableProps.top().reset();
}
-
+
void setTableProps(PropertiesPointer pProps)
{
if (mTableProps.size() > 0)
mTableProps.top() = pProps;
}
-
+
PropertiesPointer getTableProps()
{
PropertiesPointer pResult;
@@ -252,32 +251,32 @@ class TableManager
return pResult;
}
-
+
void setInCell(bool bInCell)
{
mbInCell = bInCell;
}
-
+
bool isInCell() const
{
return mbInCell;
}
-
+
void setCellEnd(bool bCellEnd)
{
mbCellEnd = bCellEnd;
}
-
+
bool isCellEnd() const
{
return mbCellEnd;
}
-
+
void setRowEnd(bool bRowEnd)
{
mbRowEnd = bRowEnd;
}
-
+
bool isRowEnd() const
{
return mbRowEnd;
@@ -288,110 +287,118 @@ class TableManager
handle for the current position in document
*/
T mCurHandle;
-
+
TableManagerState mState;
-
+
protected:
PropertiesPointer getProps()
{
return mState.getProps();
}
-
- void setProps(PropertiesPointer pProps)
+
+ void setProps(
+ PropertiesPointer pProps )
{
- mState.setProps(pProps);
+ mState.setProps( pProps );
}
-
+
void resetProps()
{
mState.resetProps();
}
-
+
PropertiesPointer getCellProps()
{
return mState.getCellProps();
}
-
- void setCellProps(PropertiesPointer pProps)
+
+ void setCellProps(
+ PropertiesPointer pProps )
{
- mState.setCellProps(pProps);
+ mState.setCellProps( pProps );
}
-
+
void resetCellProps()
{
mState.resetCellProps();
}
-
+
PropertiesPointer getRowProps()
{
return mState.getRowProps();
}
-
- void setRowProps(PropertiesPointer pProps)
+
+ void setRowProps(
+ PropertiesPointer pProps )
{
- mState.setRowProps(pProps);
+ mState.setRowProps( pProps );
}
-
+
void resetRowProps()
{
mState.resetRowProps();
}
-
- void setInCell(bool bInCell)
+
+ void setInCell(
+ bool bInCell )
{
- mState.setInCell(bInCell);
+ mState.setInCell( bInCell );
}
-
+
bool isInCell() const
{
return mState.isInCell();
}
-
- void setCellEnd(bool bCellEnd)
+
+ void setCellEnd(
+ bool bCellEnd )
{
- mState.setCellEnd(bCellEnd);
+ mState.setCellEnd( bCellEnd );
}
-
+
bool isCellEnd() const
{
return mState.isCellEnd();
}
-
- void setRowEnd(bool bRowEnd)
+
+ void setRowEnd(
+ bool bRowEnd )
{
- mState.setRowEnd(bRowEnd);
+ mState.setRowEnd( bRowEnd );
}
-
+
bool isRowEnd() const
{
return mState.isRowEnd();
}
-
+
PropertiesPointer getTableProps()
{
return mState.getTableProps();
}
-
- void setTableProps(PropertiesPointer pProps)
+
+ void setTableProps(
+ PropertiesPointer pProps )
{
- mState.setTableProps(pProps);
+ mState.setTableProps( pProps );
}
-
+
void resetTableProps()
{
mState.resetTableProps();
}
-
+
T getHandle()
{
return mCurHandle;
}
-
- void setHandle(const T & rHandle)
+
+ void setHandle(
+ const T & rHandle )
{
mCurHandle = rHandle;
}
-
+
private:
typedef boost::shared_ptr<T> T_p;
@@ -480,9 +487,6 @@ protected:
paragraph.
*/
virtual void endOfRowAction();
- /** let the derived class clear their table related data
- */
- virtual void clearData();
public:
@@ -777,27 +781,26 @@ void TableManager<T, PropertiesPointer>:
}
mnTableDepth = mnTableDepthNew;
-
- if (mnTableDepth > 0)
+
+ if ( mnTableDepth > 0 )
{
- typename TableData<T, PropertiesPointer>::Pointer_t pTableData =
- mTableDataStack.top();
-
- if (isRowEnd())
+ typename TableData< T, PropertiesPointer >::Pointer_t pTableData = mTableDataStack.top();
+
+ if ( isRowEnd() )
{
endOfRowAction();
- pTableData->endRow(getRowProps());
+ pTableData->endRow( getRowProps() );
resetRowProps();
}
-
- else if (isInCell())
+
+ else if ( isInCell() )
{
- ensureOpenCell(getCellProps());
-
- if (isCellEnd())
+ ensureOpenCell( getCellProps() );
+
+ if ( isCellEnd() )
{
endOfCellAction();
- closeCell(getHandle());
+ closeCell( getHandle() );
}
}
resetCellProps();
@@ -971,7 +974,7 @@ void TableManager<T, PropertiesPointer>:
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>:
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>:
}
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)
{
Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.cxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.cxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.cxx Fri Feb 7 14:22:16 2014
@@ -271,7 +271,7 @@ struct WRITERFILTER_DLLPRIVATE TableInfo
PropertyMapPtr pTableBorders;
TableStyleSheetEntry* pTableStyle;
TablePropertyValues_t aTableProperties;
-
+
TableInfo()
: nLeftBorderDistance(DEF_BORDER_DIST)
, nRightBorderDistance(DEF_BORDER_DIST)
@@ -282,10 +282,12 @@ struct WRITERFILTER_DLLPRIVATE TableInfo
, pTableStyle(NULL)
{
}
-
+
};
-
-TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo & rInfo)
+
+TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(
+ TableInfo & rInfo,
+ const bool bAdjustLeftMarginByDefaultValue )
{
// will receive the table style if any
TableStyleSheetEntry* pTableStyle = NULL;
@@ -310,17 +312,17 @@ TableStyleSheetEntry * DomainMapperTable
const StyleSheetEntryPtr pStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( sTableStyleName );
pTableStyle = dynamic_cast<TableStyleSheetEntry*>( pStyleSheet.get( ) );
m_aTableProperties->erase( aTableStyleIter );
-
+
if( pStyleSheet )
{
// First get the style properties, then the table ones
PropertyMapPtr pTableProps( m_aTableProperties );
TablePropertyMapPtr pEmptyProps( new TablePropertyMap );
-
+
m_aTableProperties = pEmptyProps;
-
+
PropertyMapPtr pMergedProperties = lcl_SearchParentStyleSheetAndMergeProperties(pStyleSheet, pStyleSheetTable);
-
+
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
dmapper_logger->startElement("mergedProps");
dmapper_logger->addTag(pMergedProperties->toTag());
@@ -335,12 +337,12 @@ TableStyleSheetEntry * DomainMapperTable
dmapper_logger->addTag(m_aTableProperties->toTag());
dmapper_logger->endElement("TableProperties");
#endif
- }
+ }
}
-
+
// Set the table default attributes for the cells
rInfo.pTableDefaults->insert( m_aTableProperties );
-
+
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
dmapper_logger->startElement("TableDefaults");
dmapper_logger->addTag(rInfo.pTableDefaults->toTag());
@@ -463,12 +465,19 @@ TableStyleSheetEntry * DomainMapperTable
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 )
m_aTableProperties->Insert( PROP_WIDTH, false, uno::makeAny( nTableWidth ));
-
+
sal_Int32 nHoriOrient = text::HoriOrientation::LEFT_AND_WIDTH;
m_aTableProperties->getValue( TablePropertyMap::HORI_ORIENT, nHoriOrient ) ;
m_aTableProperties->Insert( PROP_HORI_ORIENT, false, uno::makeAny( sal_Int16(nHoriOrient) ) );
@@ -478,22 +487,22 @@ TableStyleSheetEntry * DomainMapperTable
m_aTableProperties->find( PropertyDefinition( PROP_HEADER_ROW_COUNT, false ) );
if( aRepeatIter == m_aTableProperties->end() )
m_aTableProperties->Insert( PROP_HEADER_ROW_COUNT, false, uno::makeAny( (sal_Int32)0 ));
-
+
// Remove the PROP_HEADER_ROW_COUNT from the table default to avoid
// propagating it to the cells
PropertyMap::iterator aDefaultRepeatIt =
rInfo.pTableDefaults->find( PropertyDefinition( PROP_HEADER_ROW_COUNT, false ) );
if ( aDefaultRepeatIt != rInfo.pTableDefaults->end( ) )
rInfo.pTableDefaults->erase( aDefaultRepeatIt );
-
+
rInfo.aTableProperties = m_aTableProperties->GetPropertyValues();
-
+
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
dmapper_logger->startElement("debug.tableprops");
dmapper_logger->addTag(m_aTableProperties->toTag());
dmapper_logger->endElement("debug.tableprops");
#endif
-
+
}
return pTableStyle;
@@ -702,14 +711,18 @@ RowPropertyValuesSeq_t DomainMapperTable
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( );
}
Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.hxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.hxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableHandler.hxx Fri Feb 7 14:22:16 2014
@@ -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
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();
};
}}
Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx Fri Feb 7 14:22:16 2014
@@ -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
}
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
/* 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
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
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
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
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
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::endOfCell
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::endOfRowA
#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::endOfRowA
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::endOfRowA
}
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::endOfRowA
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::endOfRowA
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 );
-}
}}
Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.hxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.hxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapperTableManager.hxx Fri Feb 7 14:22:16 2014
@@ -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
{
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( ) )
Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx Fri Feb 7 14:22:16 2014
@@ -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();
}
/*-------------------------------------------------------------------------
Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx Fri Feb 7 14:22:16 2014
@@ -566,7 +566,7 @@ public:
return *pMngr.get( );
}
- void appendTableManager( )
+ void appendTableManager()
{
boost::shared_ptr< DomainMapperTableManager > pMngr(
new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML ) );
Modified: openoffice/trunk/main/writerfilter/source/dmapper/TablePropertiesHandler.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/TablePropertiesHandler.cxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/TablePropertiesHandler.cxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/TablePropertiesHandler.cxx Fri Feb 7 14:22:16 2014
@@ -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);
Modified: openoffice/trunk/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx (original)
+++ openoffice/trunk/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx Fri Feb 7 14:22:16 2014
@@ -44,9 +44,12 @@ class WW8TableDataHandler : public Table
{
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(uns
output.addItem(tmpStr);
}
-void WW8TableDataHandler::endTable()
+void WW8TableDataHandler::endTable(
+ const unsigned int /*nTableDepth*/ )
{
output.addItem("</tabledata.table>");
}
Modified: openoffice/trunk/main/writerfilter/source/resourcemodel/resourcemodel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/resourcemodel/resourcemodel.cxx?rev=1565662&r1=1565661&r2=1565662&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/resourcemodel/resourcemodel.cxx (original)
+++ openoffice/trunk/main/writerfilter/source/resourcemodel/resourcemodel.cxx Fri Feb 7 14:22:16 2014
@@ -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(uns
output.addItem(tmpStr);
}
-void WW8TableDataHandler::endTable()
+void WW8TableDataHandler::endTable(
+ const unsigned int /*nDepth*/ )
{
output.addItem("</tabledata.table>");
}