diff options
author | Henning Brinkmann[hbrinkm] <hbrinkm@openoffice.org> | 2009-12-08 14:48:12 +0100 |
---|---|---|
committer | Henning Brinkmann[hbrinkm] <hbrinkm@openoffice.org> | 2009-12-08 14:48:12 +0100 |
commit | 09a845b6b6be65d27671f59a6444779c480bcd08 (patch) | |
tree | 996e5b0e60c7acbe5d0defb52a4a5cc96f68dd6f /writerfilter/inc | |
parent | writerfilter07: model_preprocessed needs to be generated from only one play w... (diff) | |
parent | #i10000# fix for wrong merge (diff) | |
download | core-09a845b6b6be65d27671f59a6444779c480bcd08.tar.gz core-09a845b6b6be65d27671f59a6444779c480bcd08.zip |
writerfilter07: merged DEV300_m66
Diffstat (limited to 'writerfilter/inc')
-rw-r--r-- | writerfilter/inc/dmapper/DomainMapper.hxx | 8 | ||||
-rw-r--r-- | writerfilter/inc/resourcemodel/Protocol.hxx | 2 | ||||
-rw-r--r-- | writerfilter/inc/resourcemodel/TableData.hxx | 21 | ||||
-rw-r--r-- | writerfilter/inc/resourcemodel/TableManager.hxx | 96 | ||||
-rw-r--r-- | writerfilter/inc/resourcemodel/WW8ResourceModel.hxx | 8 |
5 files changed, 101 insertions, 34 deletions
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx index 71c22822affb..d543c0157874 100644 --- a/writerfilter/inc/dmapper/DomainMapper.hxx +++ b/writerfilter/inc/dmapper/DomainMapper.hxx @@ -62,7 +62,6 @@ typedef std::vector< com::sun::star::beans::PropertyValue > PropertyValueVector_ namespace writerfilter { namespace dmapper { -using namespace std; class PropertyMap; class DomainMapper_Impl; @@ -109,6 +108,9 @@ public: virtual void endParagraphGroup(); virtual void startCharacterGroup(); virtual void endCharacterGroup(); + virtual void startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); + virtual void endShape( ); + virtual void text(const sal_uInt8 * data, size_t len); virtual void utext(const sal_uInt8 * data, size_t len); virtual void props(writerfilter::Reference<Properties>::Pointer_t ref); @@ -120,8 +122,8 @@ public: void sprm( Sprm& sprm, ::boost::shared_ptr<PropertyMap> pContext, SprmType = SPRM_DEFAULT ); - void PushStyleSheetProperties( ::boost::shared_ptr<PropertyMap> pStyleProperties ); - void PopStyleSheetProperties(); + void PushStyleSheetProperties( ::boost::shared_ptr<PropertyMap> pStyleProperties, bool bAffectTableMngr = false ); + void PopStyleSheetProperties( bool bAffectTableMngr = false ); void PushListProperties( ::boost::shared_ptr<PropertyMap> pListProperties ); void PopListProperties(); diff --git a/writerfilter/inc/resourcemodel/Protocol.hxx b/writerfilter/inc/resourcemodel/Protocol.hxx index debdcc655fd7..e45245c3919d 100644 --- a/writerfilter/inc/resourcemodel/Protocol.hxx +++ b/writerfilter/inc/resourcemodel/Protocol.hxx @@ -58,6 +58,8 @@ public: virtual void substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref); virtual void info(const string & rInfo); + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual void endShape(); }; class PropertiesProtocol : public Properties diff --git a/writerfilter/inc/resourcemodel/TableData.hxx b/writerfilter/inc/resourcemodel/TableData.hxx index 407395a46de1..c86826feed01 100644 --- a/writerfilter/inc/resourcemodel/TableData.hxx +++ b/writerfilter/inc/resourcemodel/TableData.hxx @@ -276,6 +276,11 @@ class WRITERFILTER_DLLPUBLIC TableData typedef ::std::vector<RowPointer_t> Rows; /** + the table properties + */ + PropertiesPointer mpTableProps; + + /** the data of the rows of the table */ Rows mRows; @@ -349,6 +354,22 @@ public: mpRow->insertCellProperties(i, pProps); } + void insertTableProperties( PropertiesPointer pProps ) + { + if ( mpTableProps.get( ) ) + mpTableProps->insert( pProps ); + else + mpTableProps = pProps; + } + + /** + Return the table properties. + */ + PropertiesPointer getTableProperties( ) + { + return mpTableProps; + } + /** Return number of rows in the table. */ diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx index a9cc7f57cc52..cc267273fdf0 100644 --- a/writerfilter/inc/resourcemodel/TableManager.hxx +++ b/writerfilter/inc/resourcemodel/TableManager.hxx @@ -103,6 +103,11 @@ public: @param rT end handle of cell */ virtual void endCell(const T & rT) = 0; + + virtual T* getTable( ) + { + return NULL; + }; }; template <typename T, typename PropertiesPointer> @@ -151,16 +156,16 @@ class TableManager /** properties of the current cell */ - PropertiesPointer mpCellProps; + vector< PropertiesPointer > mpCellProps; /** properties of the current row */ - PropertiesPointer mpRowProps; + vector< PropertiesPointer > mpRowProps; /** - properties of the current table - */ + properties of the current table: don't use them directly. + */ PropertiesPointer mpTableProps; /** @@ -168,6 +173,7 @@ class TableManager */ T mCurHandle; + T* mpInnerTable; /** stack of table data @@ -231,7 +237,6 @@ protected: */ virtual void clearData(); - public: TableManager(); virtual ~TableManager(){} @@ -351,7 +356,7 @@ public: template <typename T, typename PropertiesPointer> TableManager<T, PropertiesPointer>::TableManager() : mbRowEnd(false), mbInCell(false), mbCellEnd(false), mnTableDepthNew(0), - mnTableDepth(0) + mnTableDepth(0), mpInnerTable( NULL ) { } @@ -398,19 +403,30 @@ void TableManager<T, PropertiesPointer>::handle(const T & rHandle) template <typename T, typename PropertiesPointer> void TableManager<T, PropertiesPointer>::startLevel() { +#if DEBUG + std::clog << "TableManager::startLevel()" << std::endl; +#endif typename TableData<T, PropertiesPointer>::Pointer_t pTableData (new TableData<T, PropertiesPointer>(mTableDataStack.size())); mTableDataStack.push(pTableData); + + PropertiesPointer pEmptyProps; + cellProps( pEmptyProps ); } template <typename T, typename PropertiesPointer> void TableManager<T, PropertiesPointer>::endLevel() { +#if DEBUG + std::clog << "TableManager::endLevel()" << std::endl; +#endif if (mpTableDataHandler.get() != NULL) resolveCurrentTable(); - mTableDataStack.pop(); + + if ( mpCellProps.size( ) > 0 ) + mpCellProps.pop_back( ); } template <typename T, typename PropertiesPointer> @@ -426,12 +442,6 @@ template <typename T, typename PropertiesPointer> void TableManager<T, PropertiesPointer>::endParagraphGroup() { sal_Int32 nTableDepthDifference = mnTableDepthNew - mnTableDepth; - while (nTableDepthDifference > 0) - { - startLevel(); - - --nTableDepthDifference; - } while (nTableDepthDifference < 0) { endLevel(); @@ -447,14 +457,23 @@ void TableManager<T, PropertiesPointer>::endParagraphGroup() if (mbRowEnd) { endOfRowAction(); - pTableData->endRow(mpRowProps); - mpRowProps.reset(); + pTableData->endRow( mpRowProps.back( ) ); + mpRowProps.back( ).reset(); } - - else if (mbInCell) + else if ( mbInCell ) { if (! pTableData->isCellOpen()) - pTableData->addCell(mCurHandle, mpCellProps); + { + if ( mpInnerTable ) + { + pTableData->addCell( *mpInnerTable, mpCellProps.back( ) ); + mpInnerTable = NULL; + } + else + { + pTableData->addCell( mCurHandle, mpCellProps.back( ) ); + } + } if (mbCellEnd) { @@ -462,7 +481,8 @@ void TableManager<T, PropertiesPointer>::endParagraphGroup() pTableData->endCell(mCurHandle); } } - mpCellProps.reset(); + if ( mpCellProps.size( ) > 0 ) + mpCellProps.back().reset( ); } template <typename T, typename PropertiesPointer> @@ -538,10 +558,15 @@ void TableManager<T, PropertiesPointer>::utext(const sal_uInt8 * data, size_t le template <typename T, typename PropertiesPointer> void TableManager<T, PropertiesPointer>::cellProps(PropertiesPointer pProps) { - if(mpCellProps.get()) - mpCellProps->insert( pProps ); + if ( mpCellProps.size( ) == mTableDataStack.size( ) ) + { + if ( mpCellProps.back( ).get( ) ) + mpCellProps.back()->insert( pProps ); + else + mpCellProps.back( ) = pProps; + } else - mpCellProps = pProps; + mpCellProps.push_back( pProps ); } template <typename T, typename PropertiesPointer> @@ -554,19 +579,24 @@ void TableManager<T, PropertiesPointer>::cellPropsByCell template <typename T, typename PropertiesPointer> void TableManager<T, PropertiesPointer>::insertRowProps(PropertiesPointer pProps) { - if( mpRowProps.get() ) - mpRowProps->insert( pProps ); + if ( mpRowProps.size( ) == ( mTableDataStack.size( ) - 1 ) ) + { + if( mpRowProps.back( ).get( ) ) + mpRowProps.back( )->insert( pProps ); + else + mpRowProps.back( ) = pProps; + } else - mpRowProps = pProps; + mpRowProps.push_back( pProps ); } template <typename T, typename PropertiesPointer> void TableManager<T, PropertiesPointer>::insertTableProps(PropertiesPointer pProps) { - if( mpTableProps.get() ) - mpTableProps->insert( pProps ); - else - mpTableProps = pProps; + typename TableData<T, PropertiesPointer>::Pointer_t + pTableData = mTableDataStack.top(); + + pTableData->insertTableProperties( pProps ); } template <typename T, typename PropertiesPointer> @@ -579,7 +609,7 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable() unsigned int nRows = pTableData->getRowCount(); - mpTableDataHandler->startTable(nRows, pTableData->getDepth(), mpTableProps); + mpTableDataHandler->startTable(nRows, pTableData->getDepth(), pTableData->getTableProperties( ) ); for (unsigned int nRow = 0; nRow < nRows; ++nRow) { @@ -602,8 +632,12 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable() } mpTableDataHandler->endTable(); + + // The inner table has to be stored only if there is something in the stack + // The 0 depth is the dummy table for the whole stream + if ( pTableData->getDepth( ) > 1 ) + mpInnerTable = mpTableDataHandler->getTable( ); } - mpTableProps.reset(); clearData(); } diff --git a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx index 05725e08be90..c7c072fefc4d 100644 --- a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx +++ b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx @@ -35,6 +35,7 @@ #include <memory> #include <boost/shared_ptr.hpp> #include <sal/types.h> +#include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/uno/Any.hxx> #include <WriterFilterDllApi.hxx> #include <resourcemodel/OutputWithDepth.hxx> @@ -220,6 +221,13 @@ public: virtual void endCharacterGroup() = 0; /** + Receives a shape. + */ + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) = 0; + + virtual void endShape( ) = 0; + + /** Receives 8-bit per character text. @param data buffer containing the text |