From 8731d1ddcf24403d7186914f58038844756fa858 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Mon, 25 Jun 2007 08:09:14 +0000 Subject: [PATCH] row and cell properties of docx --- .../dmapper/DomainMapperTableManager.cxx | 51 +++++++++++++------ .../source/dmapper/MeasureHandler.cxx | 23 +++++++-- .../source/dmapper/MeasureHandler.hxx | 10 ++-- 3 files changed, 62 insertions(+), 22 deletions(-) diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 6cc6ccd6c2ab..705194229877 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -4,9 +4,9 @@ * * $RCSfile: DomainMapperTableManager.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: os $ $Date: 2007-06-19 05:27:41 $ + * last change: $Author: os $ $Date: 2007-06-25 09:09:14 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -34,28 +34,16 @@ ************************************************************************/ #include #include -#ifndef INCLUDED_BORDERHANDLER_HXX #include -#endif -#ifndef INCLUDED_CELLCOLORHANDLER_HXX #include -#endif -#ifndef INCLUDED_DMAPPER_CONVERSIONHELPER_HXX #include -#endif -#ifndef INCLUDED_MEASUREHANDLER_HXX #include -#endif -#ifndef INCLUDED_TDEFTABLEHANDLER_HXX #include -#endif -#ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HDL_ #include -#endif -#ifndef _COM_SUN_STAR_TEXT_SIZETYPE_HDL_ #include -#endif +#include #include +#include using namespace ::writerfilter; namespace dmapper { @@ -169,7 +157,23 @@ bool DomainMapperTableManager::sprm(doctok::Sprm & rSprm) } } break; + case NS_ooxml::LN_CT_TrPrBase_trHeight: //90703 + { + //contains unit and value + doctok::Reference::Pointer_t pProperties = rSprm.getProps(); + if( pProperties.get()) + { //contains attributes x2902 (LN_unit) and x17e2 (LN_trleft) + MeasureHandlerPtr pMeasureHandler( new MeasureHandler ); + pProperties->resolve(*pMeasureHandler); + PropertyMapPtr pPropMap( new PropertyMap ); + pPropMap->Insert( PROP_SIZE_TYPE, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() )); + pPropMap->Insert( PROP_HEIGHT, uno::makeAny(pMeasureHandler->getMeasureValue() )); + insertRowProps(pPropMap); + } + } + break; case 0x3403: // sprmTFCantSplit + case NS_sprm::LN_TCantSplit: // 0x3644 { /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0.5 */ //row can't break across pages if nIntValue == 1 @@ -179,6 +183,7 @@ bool DomainMapperTableManager::sprm(doctok::Sprm & rSprm) } break; case 0x3404:// sprmTTableHeader + case NS_ooxml::LN_CT_TrPrBase_tblHeader: //90704 /* WRITERFILTERSTATUS: done: 0, 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 @@ -233,6 +238,20 @@ bool DomainMapperTableManager::sprm(doctok::Sprm & rSprm) } } break; + case NS_ooxml::LN_CT_TcPrBase_vAlign://90694 + { + sal_Int16 nVertOrient = text::VertOrientation::NONE; + switch( nIntValue ) //0 - top 1 - center 2 - bottom + { + case 1: nVertOrient = text::VertOrientation::CENTER; break; + case 2: nVertOrient = text::VertOrientation::BOTTOM; break; + default:; + }; + PropertyMapPtr pPropMap( new PropertyMap ); + pPropMap->Insert( PROP_VERT_ORIENT, uno::makeAny( nVertOrient ) ); + //todo: in ooxml import the value of m_ncell is wrong + cellPropsByCell( 0/*m_nCell*/, pPropMap ); + } case 0xD605: // sprmTTableBorders { /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */ diff --git a/writerfilter/source/dmapper/MeasureHandler.cxx b/writerfilter/source/dmapper/MeasureHandler.cxx index 26afb5706fd5..97e00a257ca9 100644 --- a/writerfilter/source/dmapper/MeasureHandler.cxx +++ b/writerfilter/source/dmapper/MeasureHandler.cxx @@ -1,12 +1,13 @@ + /************************************************************************* * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MeasureHandler.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2007-06-18 12:31:12 $ + * last change: $Author: os $ $Date: 2007-06-25 09:09:14 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +38,7 @@ #include #include #include +#include using namespace ::writerfilter; namespace dmapper { @@ -48,7 +50,8 @@ using namespace ::com::sun::star; -----------------------------------------------------------------------*/ MeasureHandler::MeasureHandler() : m_nMeasureValue( 0 ), - m_nUnit( -1 ) + m_nUnit( -1 ), + m_nRowHeightSizeType( text::SizeType::MIN ) { } /*-- 24.04.2007 09:06:35--------------------------------------------------- @@ -72,11 +75,25 @@ void MeasureHandler::attribute(doctok::Id rName, doctok::Value & rVal) // NS_ooxml::LN_Value_ST_TblWidth_dxa, NS_ooxml::LN_Value_ST_TblWidth_auto; m_nUnit = nIntValue; break; + case NS_ooxml::LN_CT_Height_hRule: // 90666; + { + ::rtl::OUString sHeightType = rVal.getString(); + if( sHeightType.equalsAscii( "exact" ) ) + m_nRowHeightSizeType = text::SizeType::FIX; + } + break; case NS_rtf::LN_trleft: case NS_rtf::LN_preferredWidth: case NS_ooxml::LN_CT_TblWidth_w:// = 90667; m_nMeasureValue = nIntValue; break; + case NS_ooxml::LN_CT_Height_val: // 90665 -- a string value + { + m_nUnit = NS_ooxml::LN_Value_ST_TblWidth_dxa; + ::rtl::OUString sHeight = rVal.getString(); + m_nMeasureValue = sHeight.toInt32(); + } + break; default: OSL_ASSERT("unknown attribute"); } diff --git a/writerfilter/source/dmapper/MeasureHandler.hxx b/writerfilter/source/dmapper/MeasureHandler.hxx index a05261bdfad1..86f32f62848f 100644 --- a/writerfilter/source/dmapper/MeasureHandler.hxx +++ b/writerfilter/source/dmapper/MeasureHandler.hxx @@ -4,9 +4,9 @@ * * $RCSfile: MeasureHandler.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2007-06-18 12:31:12 $ + * last change: $Author: os $ $Date: 2007-06-25 09:09:14 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,6 +52,7 @@ class WRITERFILTER_DLLPRIVATE MeasureHandler : public doctok::Properties { sal_Int32 m_nMeasureValue; sal_Int32 m_nUnit; + sal_Int16 m_nRowHeightSizeType; //table row height type public: MeasureHandler(); @@ -64,8 +65,11 @@ public: sal_Int32 getMeasureValue() const; //at least tables can have automatic width bool isAutoWidth() const; + + sal_Int16 GetRowHeightSizeType() const { return m_nRowHeightSizeType;} }; -typedef boost::shared_ptr< MeasureHandler > MeasureHandlerPtr; +typedef boost::shared_ptr + < MeasureHandler > MeasureHandlerPtr; } #endif //