row and cell properties of docx

This commit is contained in:
Oliver Specht 2007-06-25 08:09:14 +00:00
parent 3119e49338
commit 8731d1ddcf
3 changed files with 62 additions and 22 deletions

View file

@ -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 <DomainMapperTableManager.hxx>
#include <doctok/WW8ResourceModel.hxx>
#ifndef INCLUDED_BORDERHANDLER_HXX
#include <BorderHandler.hxx>
#endif
#ifndef INCLUDED_CELLCOLORHANDLER_HXX
#include <CellColorHandler.hxx>
#endif
#ifndef INCLUDED_DMAPPER_CONVERSIONHELPER_HXX
#include <ConversionHelper.hxx>
#endif
#ifndef INCLUDED_MEASUREHANDLER_HXX
#include <MeasureHandler.hxx>
#endif
#ifndef INCLUDED_TDEFTABLEHANDLER_HXX
#include <TDefTableHandler.hxx>
#endif
#ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HDL_
#include <com/sun/star/text/HoriOrientation.hpp>
#endif
#ifndef _COM_SUN_STAR_TEXT_SIZETYPE_HDL_
#include <com/sun/star/text/SizeType.hpp>
#endif
#include <com/sun/star/text/VertOrientation.hpp>
#include <ooxml/resourceids.hxx>
#include <resourcemodel/sprmids.hxx>
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<doctok::Properties>::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 */

View file

@ -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 <doctok/resourceids.hxx>
#include <ConversionHelper.hxx>
#include <ooxml/resourceids.hxx>
#include <com/sun/star/text/SizeType.hpp>
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");
}

View file

@ -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 //