From 5880b5f7605d386fe76be4a845161bfcc92f0e20 Mon Sep 17 00:00:00 2001 From: Sven Jacobi Date: Fri, 17 Nov 2000 10:22:02 +0000 Subject: [PATCH] added tabulator export (left, right, decimal, centered) --- sd/source/filter/eppt/eppt.cxx | 12 +++--- sd/source/filter/eppt/eppt.hxx | 10 +++-- sd/source/filter/eppt/epptso.cxx | 67 +++++++++++++------------------- 3 files changed, 41 insertions(+), 48 deletions(-) diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 3e1a6145f6b3..93099c6d08c7 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: eppt.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: sj $ $Date: 2000-11-14 17:05:52 $ + * last change: $Author: sj $ $Date: 2000-11-17 11:21:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -266,7 +266,7 @@ PPTWriter::PPTWriter( SvStorageRef& rSvStorage, SvStorageRef& xOleSource, return; } maTextRuleList.First(); // rewind list, so we can get the current or next entry without - // searching, all entrys are sorted + // searching, all entrys are sorted# for ( i = 0; i < mnPages; i++ ) { if ( !ImplCreateSlide( i ) ) @@ -734,7 +734,7 @@ sal_Bool PPTWriter::ImplCreateDocument() SvMemoryStream aExtBu( 0x200, 0x200 ); ImplWriteTextStyleAtom( *mpStrm, nTextType, nPObjects, pRule, aExtBu ); ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, i + 0x100 ); - maTextRuleList.Insert( (void*)pRule ); + maTextRuleList.Insert( (void*)pRule, LIST_APPEND ); if ( rLayout.bSecOutlinerPossible ) { if ( ( nIndex + 1 ) < nShapes ) @@ -746,7 +746,7 @@ sal_Bool PPTWriter::ImplCreateDocument() SvMemoryStream aExtBu( 0x200, 0x200 ); ImplWriteTextStyleAtom( *mpStrm, nTextType, nPObjects, pRule, aExtBu ); ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, i + 0x100 ); - maTextRuleList.Insert( (void*)pRule ); + maTextRuleList.Insert( (void*)pRule, LIST_APPEND ); } } } @@ -765,7 +765,7 @@ sal_Bool PPTWriter::ImplCreateDocument() SvMemoryStream aExtBu( 0x200, 0x200 ); ImplWriteTextStyleAtom( *mpStrm, EPP_TEXTTYPE_Title, nPObjects, pRule, aExtBu ); ImplWriteExtParaHeader( aExtBu, nPObjects++, EPP_TEXTTYPE_Title, i + 0x100 ); - maTextRuleList.Insert( (void*)pRule ); + maTextRuleList.Insert( (void*)pRule, LIST_APPEND ); } } } diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx index 3a6798c05a80..9ac8aa82b22f 100644 --- a/sd/source/filter/eppt/eppt.hxx +++ b/sd/source/filter/eppt/eppt.hxx @@ -2,9 +2,9 @@ * * $RCSfile: eppt.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: sj $ $Date: 2000-11-10 08:21:15 $ + * last change: $Author: sj $ $Date: 2000-11-17 11:21:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -206,6 +206,9 @@ #ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_ #include #endif +#ifndef _COM_SUN_STAR_STYLE_TABSTOP_HPP_ +#include +#endif #ifndef _MSOCXIMEX_HXX #include #endif @@ -754,7 +757,8 @@ class ParagraphObj : public List, public PropStateValue, public SOParagraph public : - sal_Int32* mpTab; + ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop; + sal_uInt32 mnTextSize; sal_Bool mbIsBullet; diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index e6b09d5ac1c6..1b261427b58b 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -2,9 +2,9 @@ * * $RCSfile: epptso.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: sj $ $Date: 2000-11-15 10:22:43 $ + * last change: $Author: sj $ $Date: 2000-11-17 11:22:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -116,9 +116,6 @@ #ifndef _COM_SUN_STAR_AWT_XFONTUNDERLINE_HPP_ #include #endif -#ifndef _COM_SUN_STAR_STYLE_TABSTOP_HPP_ -#include -#endif #ifndef _COM_SUN_STAR_STYLE_PARAGRAPHADJUST_HPP_ #include #endif @@ -2463,8 +2460,7 @@ PortionObj& PortionObj::operator=( PortionObj& rPortionObj ) ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, PPTExBulletProvider& rProv ) : maMapModeSrc ( MAP_100TH_MM ), - maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ), - mpTab ( NULL ) + maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ) { mXPropSet = rXPropSet; @@ -2482,8 +2478,7 @@ ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun:: maMapModeSrc ( MAP_100TH_MM ), maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ), mbFirstParagraph ( aParaFlags.bFirstParagraph ), - mbLastParagraph ( aParaFlags.bLastParagraph ), - mpTab ( NULL ) + mbLastParagraph ( aParaFlags.bLastParagraph ) { bDepth = bExtendedParameters = FALSE; @@ -2543,7 +2538,6 @@ void ParagraphObj::ImplClear() { for ( void* pPtr = First(); pPtr; pPtr = Next() ) delete (PortionObj*)pPtr; - delete mpTab; } void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, sal_Bool bGetPropStateValue ) @@ -2969,19 +2963,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Boo ImplGetNumberingLevel( rBuProv, nDepth, bGetPropStateValue ); } if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTabstops" ) ), bGetPropStateValue ) ) - { - ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>& rSeq = - *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue(); - sal_Int32 nCount = rSeq.getLength(); - ::com::sun::star::style::TabStop* pTabStop = (::com::sun::star::style::TabStop*)rSeq.getConstArray(); - if ( nCount && pTabStop ) - { - mpTab = new sal_Int32[ nCount + 1 ]; - mpTab[ 0 ] = nCount; - for ( sal_uInt32 i = 0; i < nCount; i++ ) - mpTab[ i + 1 ] = ( pTabStop[ i ].Position / 4.40972 ) + nTextOfs; - } - } + maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue(); ::com::sun::star::drawing::TextAdjust eTextAdjust( ::com::sun::star::drawing::TextAdjust_LEFT ); if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) ), bGetPropStateValue ) ) eTextAdjust = (::com::sun::star::drawing::TextAdjust)EncodeAnyTosal_Int16( mAny ); @@ -3048,15 +3030,7 @@ void ParagraphObj::ImplConstruct( ParagraphObj& rParagraphObj ) for ( void* pPtr = rParagraphObj.First(); pPtr; pPtr = rParagraphObj.Next() ) Insert( new PortionObj( *(PortionObj*)pPtr ), LIST_APPEND ); - if ( rParagraphObj.mpTab && rParagraphObj.mpTab[ 0 ] ) - { - sal_uInt32 nCount = rParagraphObj.mpTab[ 0 ] + 1; - mpTab = new sal_Int32[ nCount ]; - memcpy( mpTab, rParagraphObj.mpTab, nCount << 2 ); - } - else - mpTab = NULL; - + maTabStop = rParagraphObj.maTabStop; bDepth = rParagraphObj.bDepth; bExtendedParameters = rParagraphObj.bExtendedParameters; nParaFlags = rParagraphObj.nParaFlags; @@ -3300,7 +3274,9 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, { sal_uInt32 nParaFlags = 0x1f; sal_Int16 nDepth, nMask, nNumberingRule[ 10 ]; - const sal_Int32* pTab = pPara->mpTab; + sal_uInt32 nTextOfs = pPara->nTextOfs; + sal_uInt32 nTabs = pPara->maTabStop.getLength(); + const ::com::sun::star::style::TabStop* pTabStop = ( const ::com::sun::star::style::TabStop* )pPara->maTabStop.getConstArray(); for ( ; pPara; pPara = aTextObj.Next() ) { @@ -3327,10 +3303,9 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, nParaFlags >>= 16; sal_uInt32 nDefaultTabSize = ImplMapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width; - sal_uInt32 nTabs = ( pTab ) ? pTab[ 0 ] : 0; sal_Int32 nDefaultTabs = abs( maRect.GetWidth() ) / nDefaultTabSize; if ( nTabs ) - nDefaultTabs -= pTab[ nTabs ] / nDefaultTabSize; + nDefaultTabs -= ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize; if ( nDefaultTabs < 0 ) nDefaultTabs = 0; @@ -3354,12 +3329,26 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, if ( nTextRulerAtomFlags & 4 ) { *pRuleOut << (sal_uInt16)nTabCount; - for ( sal_uInt32 i = 1; i <= nTabs; i++ ) - *pRuleOut << (sal_uInt32)pTab[ i ]; + for ( sal_uInt32 i = 0; i < nTabs; i++ ) + { + sal_uInt16 nPosition = (sal_uInt16)( ( pTabStop[ i ].Position / 4.40972 ) + nTextOfs ); + sal_uInt16 nType; + switch ( pTabStop[ i ].Alignment ) + { + case ::com::sun::star::style::TabAlign_DECIMAL : nType = 3; break; + case ::com::sun::star::style::TabAlign_RIGHT : nType = 2; break; + case ::com::sun::star::style::TabAlign_CENTER : nType = 1; break; + + case ::com::sun::star::style::TabAlign_LEFT : + default: nType = 0; + }; + *pRuleOut << nPosition + << nType; + } sal_uInt32 nWidth = 1; - if ( pTab ) - nWidth += ( pTab[ nTabs ] / nDefaultTabSize ); + if ( nTabs ) + nWidth += ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 + nTextOfs ) / nDefaultTabSize ); nWidth *= nDefaultTabSize; for ( i = 0; i < nDefaultTabs; i++, nWidth += nDefaultTabSize ) *pRuleOut << nWidth;