diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-06-17 10:58:14 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-06-17 10:58:14 +0000 |
commit | 09616816855320394fe9d2bf4dc2a949296dc80f (patch) | |
tree | dce11dca85d86c03f0a64be0fcab3e1c5ee091ee /svx/source/svdraw | |
parent | b49ac08f3b5f9474f606bb76f9256d2a9aa1a522 (diff) |
CWS-TOOLING: integrate CWS impress171
2009-06-02 16:32:02 +0200 cl r272511 : fixed build error
2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49)
2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given)
2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given)
2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given)
2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar
2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document
2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes
2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem
2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes
2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature
2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature
2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature
2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes
2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons
2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit
2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug
2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object)
2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells
2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state
2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone
2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal
2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles
2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path
2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility
2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj
2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r-- | svx/source/svdraw/svdfppt.cxx | 493 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 119 |
2 files changed, 380 insertions, 232 deletions
diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx index aa51f524444a..e12ed76d52ce 100644 --- a/svx/source/svdraw/svdfppt.cxx +++ b/svx/source/svdraw/svdfppt.cxx @@ -4973,6 +4973,246 @@ void StyleTextProp9::Read( SvStream& rIn ) PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader, PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance ) { + Init(rIn, rMan, rTextHeader, rRuler, rExtParaHd, nInstance); +} + +void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader, + const String& aString, PPTTextRulerInterpreter& rRuler, + sal_uInt32& nCharCount, sal_Bool& bTextPropAtom ) +{ + sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below + sal_uInt32 nCharAnzRead = 0; + sal_uInt16 nDummy16; + + sal_uInt16 nStringLen = aString.Len(); + + DffRecordHeader aTextHd2; + rTextHeader.SeekToContent( rIn ); + if ( rMan.SeekToRec( rIn, PPT_PST_StyleTextPropAtom, rTextHeader.GetRecEndFilePos(), &aTextHd2 ) ) + bTextPropAtom = sal_True; + while ( nCharAnzRead <= nStringLen ) + { + PPTParaPropSet aParaPropSet; + ImplPPTParaPropSet& aSet = *aParaPropSet.pParaSet; + if ( bTextPropAtom ) + { + rIn >> nCharCount + >> aParaPropSet.pParaSet->mnDepth; // Einruecktiefe + + nCharCount--; + + rIn >> nMask; + aSet.mnAttrSet = nMask & 0x207df7; + sal_uInt16 nBulFlg = 0; + if ( nMask & 0xF ) + rIn >> nBulFlg; // Bullet-HardAttr-Flags + aSet.mpArry[ PPT_ParaAttr_BulletOn ] = ( nBulFlg & 1 ) ? 1 : 0; + aSet.mpArry[ PPT_ParaAttr_BuHardFont ] = ( nBulFlg & 2 ) ? 1 : 0; + aSet.mpArry[ PPT_ParaAttr_BuHardColor ] = ( nBulFlg & 4 ) ? 1 : 0; + + if ( nMask & 0x0080 ) // buChar + rIn >> aSet.mpArry[ PPT_ParaAttr_BulletChar ]; + if ( nMask & 0x0010 ) // buTypeface + rIn >> aSet.mpArry[ PPT_ParaAttr_BulletFont ]; + if ( nMask & 0x0040 ) // buSize + { + rIn >> aSet.mpArry[ PPT_ParaAttr_BulletHeight ]; + if ( ! ( ( nMask & ( 1 << PPT_ParaAttr_BuHardHeight ) ) + && ( nBulFlg && ( 1 << PPT_ParaAttr_BuHardHeight ) ) ) ) + aSet.mnAttrSet ^= 0x40; + } + if ( nMask & 0x0020 ) // buColor + { + sal_uInt32 nVal32, nHiByte; + rIn >> nVal32; + nHiByte = nVal32 >> 24; + if ( nHiByte <= 8 ) + nVal32 = nHiByte | PPT_COLSCHEME; + aSet.mnBulletColor = nVal32; + } + if ( nMask & 0x0800 ) // pfAlignment + { + rIn >> nDummy16; + aSet.mpArry[ PPT_ParaAttr_Adjust ] = nDummy16 & 3; + } + if ( nMask & 0x1000 ) // pfLineSpacing + rIn >> aSet.mpArry[ PPT_ParaAttr_LineFeed ]; + if ( nMask & 0x2000 ) // pfSpaceBefore + rIn >> aSet.mpArry[ PPT_ParaAttr_UpperDist ]; + if ( nMask & 0x4000 ) // pfSpaceAfter + rIn >> aSet.mpArry[ PPT_ParaAttr_LowerDist ]; + if ( nMask & 0x100 ) // pfLeftMargin + rIn >> nDummy16; + if ( nMask & 0x400 ) // pfIndent + rIn >> nDummy16; + if ( nMask & 0x8000 ) // pfDefaultTabSize + rIn >> nDummy16; + if ( nMask & 0x100000 ) // pfTabStops + { + sal_uInt16 i, nDistance, nAlignment, nNumberOfTabStops = 0; + rIn >> nNumberOfTabStops; + for ( i = 0; i < nNumberOfTabStops; i++ ) + { + rIn >> nDistance + >> nAlignment; + } + } + if ( nMask & 0x10000 ) // pfBaseLine + rIn >> nDummy16; + if ( nMask & 0xe0000 ) // pfCharWrap, pfWordWrap, pfOverflow + { + rIn >> nDummy16; + if ( nMask & 0x20000 ) + aSet.mpArry[ PPT_ParaAttr_AsianLB_1 ] = nDummy16 & 1; + if ( nMask & 0x40000 ) + aSet.mpArry[ PPT_ParaAttr_AsianLB_2 ] = ( nDummy16 >> 1 ) & 1; + if ( nMask & 0x80000 ) + aSet.mpArry[ PPT_ParaAttr_AsianLB_3 ] = ( nDummy16 >> 2 ) & 1; + aSet.mnAttrSet |= ( ( nMask >> 17 ) & 7 ) << PPT_ParaAttr_AsianLB_1; + } + if ( nMask & 0x200000 ) // pfTextDirection + rIn >> aSet.mpArry[ PPT_ParaAttr_BiDi ]; + } + else + nCharCount = nStringLen; + + if ( rRuler.GetTextOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_TextOfs ] ) ) + aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs; + if ( rRuler.GetBulletOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_BulletOfs ] ) ) + aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs; + if ( rRuler.GetDefaultTab( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_DefaultTab ] ) ) + aSet.mnAttrSet |= 1 << PPT_ParaAttr_DefaultTab; + + if ( ( nCharCount > nStringLen ) || ( nStringLen < nCharAnzRead + nCharCount ) ) + { + bTextPropAtom = sal_False; + nCharCount = nStringLen - nCharAnzRead; + // please fix the right hand side of + // PPTParaPropSet& PPTParaPropSet::operator=(PPTParaPropSet&), + // it should be a const reference + PPTParaPropSet aTmpPPTParaPropSet; + aParaPropSet = aTmpPPTParaPropSet; + DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" ); + } + PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet ); + pPara->mnOriginalTextPos = nCharAnzRead; + aParaPropList.Insert( pPara, LIST_APPEND ); + if ( nCharCount ) + { + sal_uInt32 nCount; + const sal_Unicode* pDat = aString.GetBuffer() + nCharAnzRead; + for ( nCount = 0; nCount < nCharCount; nCount++ ) + { + if ( pDat[ nCount ] == 0xd ) + { + pPara = new PPTParaPropSet( aParaPropSet ); + pPara->mnOriginalTextPos = nCharAnzRead + nCount + 1; + aParaPropList.Insert( pPara, LIST_APPEND ); + } + } + } + nCharAnzRead += nCharCount + 1; + } +} + +void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const String& aString, + sal_uInt32& nCharCount, sal_uInt32 nCharAnzRead, + sal_Bool& bTextPropAtom, sal_uInt32 nExtParaPos, + const std::vector< StyleTextProp9 >& aStyleTextProp9, + sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip, + sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme ) +{ + sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below + sal_uInt16 nDummy16; + sal_Int32 nCharsToRead; + sal_uInt32 nExtParaNibble = 0; + + sal_uInt16 nStringLen = aString.Len(); + + rIn >> nDummy16; + nCharCount = nDummy16; + rIn >> nDummy16; + nCharsToRead = nStringLen - ( nCharAnzRead + nCharCount ); + if ( nCharsToRead < 0 ) + { + nCharCount = nStringLen - nCharAnzRead; + if ( nCharsToRead < -1 ) + { + bTextPropAtom = sal_False; + DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" ); + } + } + ImplPPTCharPropSet& aSet = *aCharPropSet.pCharSet; + + // character attributes + rIn >> nMask; + if ( (sal_uInt16)nMask ) + { + aSet.mnAttrSet |= (sal_uInt16)nMask; + rIn >> aSet.mnFlags; + } + if ( nMask & 0x10000 ) // cfTypeface + { + rIn >> aSet.mnFont; + aSet.mnAttrSet |= 1 << PPT_CharAttr_Font; + } + if ( nMask & 0x200000 ) // cfFEOldTypeface + { + rIn >> aSet.mnAsianOrComplexFont; + aSet.mnAttrSet |= 1 << PPT_CharAttr_AsianOrComplexFont; + } + if ( nMask & 0x400000 ) // cfANSITypeface + { + rIn >> aSet.mnANSITypeface; + aSet.mnAttrSet |= 1 << PPT_CharAttr_ANSITypeface; + } + if ( nMask & 0x800000 ) // cfSymbolTypeface + { + rIn >> aSet.mnSymbolFont; + aSet.mnAttrSet |= 1 << PPT_CharAttr_Symbol; + } + if ( nMask & 0x20000 ) // cfSize + { + rIn >> aSet.mnFontHeight; + aSet.mnAttrSet |= 1 << PPT_CharAttr_FontHeight; + } + if ( nMask & 0x40000 ) // cfColor + { + sal_uInt32 nVal; + rIn >> nVal; + if ( !( nVal & 0xff000000 ) ) + nVal = PPT_COLSCHEME_HINTERGRUND; + aSet.mnColor = nVal; + aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor; + } + if ( nMask & 0x80000 ) // cfPosition + { + rIn >> aSet.mnEscapement; + aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement; + } + if ( nExtParaPos ) + { + sal_uInt32 nExtBuInd = nMask & 0x3c00; + if ( nExtBuInd ) + nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10; + if ( nExtBuInd < aStyleTextProp9.size() ) + { + if ( nExtParaNibble && ( ( nExtBuInd + nExtParaNibble ) < aStyleTextProp9.size() ) ) + nExtBuInd += nExtParaNibble; + + nExtParaFlags = aStyleTextProp9[ nExtBuInd ].mnExtParagraphMask; + nBuBlip = aStyleTextProp9[ nExtBuInd ].mnBuBlip; + nHasAnm = aStyleTextProp9[ nExtBuInd ].mnHasAnm; + nAnmScheme = aStyleTextProp9[ nExtBuInd ].mnAnmScheme; + } + if ( ( nExtBuInd & 0xf ) == 0xf ) + nExtParaNibble += 16; + } +} + +void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader, + PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance ) +{ sal_uInt32 nMerk = rIn.Tell(); sal_uInt32 nExtParaPos = ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom ) ? rExtParaHd.nFilePos + 8 : 0; @@ -5032,7 +5272,7 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo aString = String( pBuf, (sal_uInt16)i ); delete[] pBuf; } - else + else if( aTextHd.nRecType == PPT_PST_TextBytesAtom ) { sal_Char *pBuf = new sal_Char[ nMaxLen + 1 ]; pBuf[ nMaxLen ] = 0; @@ -5057,148 +5297,44 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo aString = String( pBuf, nLen, RTL_TEXTENCODING_MS_1252 ); delete[] pBuf; } - if ( aString.Len() ) + else { - sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below - sal_uInt32 nCharCount, nCharAnzRead = 0; - sal_Int32 nCharsToRead; - sal_uInt16 nDummy16; + // no chars, but potentially char/para props? + sal_uInt32 nCharCount; sal_Bool bTextPropAtom = sal_False; + ReadParaProps( rIn, rMan, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom ); - sal_uInt16 nStringLen = aString.Len(); - - DffRecordHeader aTextHd2; - rTextHeader.SeekToContent( rIn ); - if ( rMan.SeekToRec( rIn, PPT_PST_StyleTextPropAtom, rTextHeader.GetRecEndFilePos(), &aTextHd2 ) ) - bTextPropAtom = sal_True; - while ( nCharAnzRead <= nStringLen ) + if ( bTextPropAtom ) { - PPTParaPropSet aParaPropSet; - ImplPPTParaPropSet& aSet = *aParaPropSet.pParaSet; - if ( bTextPropAtom ) - { - rIn >> nCharCount - >> aParaPropSet.pParaSet->mnDepth; // Einruecktiefe - - nCharCount--; - - rIn >> nMask; - aSet.mnAttrSet = nMask & 0x207df7; - sal_uInt16 nBulFlg = 0; - if ( nMask & 0xF ) - rIn >> nBulFlg; // Bullet-HardAttr-Flags - aSet.mpArry[ PPT_ParaAttr_BulletOn ] = ( nBulFlg & 1 ) ? 1 : 0; - aSet.mpArry[ PPT_ParaAttr_BuHardFont ] = ( nBulFlg & 2 ) ? 1 : 0; - aSet.mpArry[ PPT_ParaAttr_BuHardColor ] = ( nBulFlg & 4 ) ? 1 : 0; - - if ( nMask & 0x0080 ) // buChar - rIn >> aSet.mpArry[ PPT_ParaAttr_BulletChar ]; - if ( nMask & 0x0010 ) // buTypeface - rIn >> aSet.mpArry[ PPT_ParaAttr_BulletFont ]; - if ( nMask & 0x0040 ) // buSize - { - rIn >> aSet.mpArry[ PPT_ParaAttr_BulletHeight ]; - if ( ! ( ( nMask & ( 1 << PPT_ParaAttr_BuHardHeight ) ) - && ( nBulFlg && ( 1 << PPT_ParaAttr_BuHardHeight ) ) ) ) - aSet.mnAttrSet ^= 0x40; - } - if ( nMask & 0x0020 ) // buColor - { - sal_uInt32 nVal32, nHiByte; - rIn >> nVal32; - nHiByte = nVal32 >> 24; - if ( nHiByte <= 8 ) - nVal32 = nHiByte | PPT_COLSCHEME; - aSet.mnBulletColor = nVal32; - } - if ( nMask & 0x0800 ) // pfAlignment - { - rIn >> nDummy16; - aSet.mpArry[ PPT_ParaAttr_Adjust ] = nDummy16 & 3; - } - if ( nMask & 0x1000 ) // pfLineSpacing - rIn >> aSet.mpArry[ PPT_ParaAttr_LineFeed ]; - if ( nMask & 0x2000 ) // pfSpaceBefore - rIn >> aSet.mpArry[ PPT_ParaAttr_UpperDist ]; - if ( nMask & 0x4000 ) // pfSpaceAfter - rIn >> aSet.mpArry[ PPT_ParaAttr_LowerDist ]; - if ( nMask & 0x100 ) // pfLeftMargin - rIn >> nDummy16; - if ( nMask & 0x400 ) // pfIndent - rIn >> nDummy16; - if ( nMask & 0x8000 ) // pfDefaultTabSize - rIn >> nDummy16; - if ( nMask & 0x100000 ) // pfTabStops - { - sal_uInt16 i, nDistance, nAlignment, nNumberOfTabStops = 0; - rIn >> nNumberOfTabStops; - for ( i = 0; i < nNumberOfTabStops; i++ ) - { - rIn >> nDistance - >> nAlignment; - } - } - if ( nMask & 0x10000 ) // pfBaseLine - rIn >> nDummy16; - if ( nMask & 0xe0000 ) // pfCharWrap, pfWordWrap, pfOverflow - { - rIn >> nDummy16; - if ( nMask & 0x20000 ) - aSet.mpArry[ PPT_ParaAttr_AsianLB_1 ] = nDummy16 & 1; - if ( nMask & 0x40000 ) - aSet.mpArry[ PPT_ParaAttr_AsianLB_2 ] = ( nDummy16 >> 1 ) & 1; - if ( nMask & 0x80000 ) - aSet.mpArry[ PPT_ParaAttr_AsianLB_3 ] = ( nDummy16 >> 2 ) & 1; - aSet.mnAttrSet |= ( ( nMask >> 17 ) & 7 ) << PPT_ParaAttr_AsianLB_1; - } - if ( nMask & 0x200000 ) // pfTextDirection - rIn >> aSet.mpArry[ PPT_ParaAttr_BiDi ]; - } - else - nCharCount = nStringLen; + // yeah, StyleTextProp is there, read it all & push to + // aParaPropList + PPTCharPropSet aCharPropSet(0); + aCharPropSet.mnOriginalTextPos = 0; - if ( rRuler.GetTextOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_TextOfs ] ) ) - aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs; - if ( rRuler.GetBulletOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_BulletOfs ] ) ) - aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs; - if ( rRuler.GetDefaultTab( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_DefaultTab ] ) ) - aSet.mnAttrSet |= 1 << PPT_ParaAttr_DefaultTab; + sal_uInt32 nCharAnzRead = 0; + sal_uInt32 nExtParaFlags = 0, nAnmScheme = 0; + sal_uInt16 nBuBlip = 0xffff, nHasAnm = 0; + ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharAnzRead, + bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags, + nBuBlip, nHasAnm, nAnmScheme ); - if ( ( nCharCount > nStringLen ) || ( nStringLen < nCharAnzRead + nCharCount ) ) - { - bTextPropAtom = sal_False; - nCharCount = nStringLen - nCharAnzRead; - // please fix the right hand side of - // PPTParaPropSet& PPTParaPropSet::operator=(PPTParaPropSet&), - // it should be a const reference - PPTParaPropSet aTmpPPTParaPropSet; - aParaPropSet = aTmpPPTParaPropSet; - DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" ); - } - PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet ); - pPara->mnOriginalTextPos = nCharAnzRead; - aParaPropList.Insert( pPara, LIST_APPEND ); - if ( nCharCount ) - { - sal_uInt32 nCount; - const sal_Unicode* pDat = aString.GetBuffer() + nCharAnzRead; - for ( nCount = 0; nCount < nCharCount; nCount++ ) - { - if ( pDat[ nCount ] == 0xd ) - { - pPara = new PPTParaPropSet( aParaPropSet ); - pPara->mnOriginalTextPos = nCharAnzRead + nCount + 1; - aParaPropList.Insert( pPara, LIST_APPEND ); - } - } - } - nCharAnzRead += nCharCount + 1; + aCharPropList.Insert( + new PPTCharPropSet( aCharPropSet, 0 ), LIST_APPEND ); } + } + + if ( aString.Len() ) + { + sal_uInt32 nCharCount; + sal_Bool bTextPropAtom = sal_False; + + ReadParaProps( rIn, rMan, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom ); sal_Bool bEmptyParaPossible = sal_True; - sal_uInt32 nCurrentPara = nCharAnzRead = 0; + sal_uInt32 nCharAnzRead = 0; + sal_uInt32 nCurrentPara = 0; sal_uInt32 nCurrentSpecMarker = (sal_uInt32)(sal_uIntPtr)aSpecMarkerList.First(); - sal_uInt32 nExtParaNibble = 0; + sal_uInt16 nStringLen = aString.Len(); while ( nCharAnzRead < nStringLen ) { @@ -5207,87 +5343,9 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo PPTCharPropSet aCharPropSet( nCurrentPara ); if ( bTextPropAtom ) - { - rIn >> nDummy16; - nCharCount = nDummy16; - rIn >> nDummy16; - nCharsToRead = nStringLen - ( nCharAnzRead + nCharCount ); - if ( nCharsToRead < 0 ) - { - nCharCount = nStringLen - nCharAnzRead; - if ( nCharsToRead < -1 ) - { - bTextPropAtom = sal_False; - DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" ); - } - } - ImplPPTCharPropSet& aSet = *aCharPropSet.pCharSet; - - // character attributes - rIn >> nMask; - if ( (sal_uInt16)nMask ) - { - aSet.mnAttrSet |= (sal_uInt16)nMask; - rIn >> aSet.mnFlags; - } - if ( nMask & 0x10000 ) // cfTypeface - { - rIn >> aSet.mnFont; - aSet.mnAttrSet |= 1 << PPT_CharAttr_Font; - } - if ( nMask & 0x200000 ) // cfFEOldTypeface - { - rIn >> aSet.mnAsianOrComplexFont; - aSet.mnAttrSet |= 1 << PPT_CharAttr_AsianOrComplexFont; - } - if ( nMask & 0x400000 ) // cfANSITypeface - { - rIn >> aSet.mnANSITypeface; - aSet.mnAttrSet |= 1 << PPT_CharAttr_ANSITypeface; - } - if ( nMask & 0x800000 ) // cfSymbolTypeface - { - rIn >> aSet.mnSymbolFont; - aSet.mnAttrSet |= 1 << PPT_CharAttr_Symbol; - } - if ( nMask & 0x20000 ) // cfSize - { - rIn >> aSet.mnFontHeight; - aSet.mnAttrSet |= 1 << PPT_CharAttr_FontHeight; - } - if ( nMask & 0x40000 ) // cfColor - { - sal_uInt32 nVal; - rIn >> nVal; - if ( !( nVal & 0xff000000 ) ) - nVal = PPT_COLSCHEME_HINTERGRUND; - aSet.mnColor = nVal; - aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor; - } - if ( nMask & 0x80000 ) // cfPosition - { - rIn >> aSet.mnEscapement; - aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement; - } - if ( nExtParaPos ) - { - sal_uInt32 nExtBuInd = nMask & 0x3c00; - if ( nExtBuInd ) - nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10; - if ( nExtBuInd < aStyleTextProp9.size() ) - { - if ( nExtParaNibble && ( ( nExtBuInd + nExtParaNibble ) < aStyleTextProp9.size() ) ) - nExtBuInd += nExtParaNibble; - - nExtParaFlags = aStyleTextProp9[ nExtBuInd ].mnExtParagraphMask; - nBuBlip = aStyleTextProp9[ nExtBuInd ].mnBuBlip; - nHasAnm = aStyleTextProp9[ nExtBuInd ].mnHasAnm; - nAnmScheme = aStyleTextProp9[ nExtBuInd ].mnAnmScheme; - } - if ( ( nExtBuInd & 0xf ) == 0xf ) - nExtParaNibble += 16; - } - } + ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharAnzRead, + bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags, + nBuBlip, nHasAnm, nAnmScheme ); else nCharCount = nStringLen; @@ -6632,7 +6690,12 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport mpImplTextObj->mnInstance = nInstance; UINT32 nFilePos = rIn.Tell(); - if ( rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom, PPT_PST_TextCharsAtom, aClientTextBoxHd.GetRecEndFilePos() ) ) + if ( rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom, + PPT_PST_TextCharsAtom, + aClientTextBoxHd.GetRecEndFilePos() ) + || rSdrPowerPointImport.SeekToRec( rIn, + PPT_PST_StyleTextPropAtom, + aClientTextBoxHd.GetRecEndFilePos() ) ) { PPTTextRulerInterpreter aTextRulerInterpreter( nTextRulerAtomOfs, rSdrPowerPointImport, aClientTextBoxHd, rIn ); diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 70dda490a540..0f9e2e168721 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1630,7 +1630,7 @@ void SdrObjCustomShape::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const rInfo.bMirror90Allowed =TRUE; rInfo.bTransparenceAllowed = FALSE; rInfo.bGradientAllowed = FALSE; - rInfo.bShearAllowed =FALSE; + rInfo.bShearAllowed =TRUE; rInfo.bEdgeRadiusAllowed=FALSE; rInfo.bNoContortion =TRUE; @@ -1965,19 +1965,56 @@ void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 ) InvalidateRenderGeometry(); } -void SdrObjCustomShape::Shear( const Point& /*rRef*/, long /*nWink*/, double /*tn*/, FASTBOOL /*bVShear*/) +void SdrObjCustomShape::Shear( const Point& rRef, long nWink, double tn, FASTBOOL bVShear ) { -/* SdrTextObj::Shear( rRef, nWink, tn, bVShear ); InvalidateRenderGeometry(); -*/ } -void SdrObjCustomShape::NbcShear( const Point& /*rRef*/, long /*nWink*/, double /*tn*/, FASTBOOL /*bVShear*/) +void SdrObjCustomShape::NbcShear( const Point& rRef, long nWink, double tn, FASTBOOL bVShear ) { -/* + long nDrehWink = aGeo.nDrehWink; + if ( nDrehWink ) + { + aGeo.nDrehWink = -nDrehWink; + aGeo.RecalcSinCos(); + NbcRotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos ); + } SdrTextObj::NbcShear(rRef,nWink,tn,bVShear); + if ( nDrehWink ) + { + aGeo.nDrehWink = nDrehWink; + aGeo.RecalcSinCos(); + Rotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos ); + } InvalidateRenderGeometry(); -*/ +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +SdrGluePoint SdrObjCustomShape::GetVertexGluePoint(USHORT nPosNum) const +{ + INT32 nWdt = ImpGetLineWdt(); // #i25616# ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue(); + + // #i25616# + if(!LineIsOutsideGeometry()) + { + nWdt++; + nWdt /= 2; + } + + Point aPt; + switch (nPosNum) { + case 0: aPt=aRect.TopCenter(); aPt.Y()-=nWdt; break; + case 1: aPt=aRect.RightCenter(); aPt.X()+=nWdt; break; + case 2: aPt=aRect.BottomCenter(); aPt.Y()+=nWdt; break; + case 3: aPt=aRect.LeftCenter(); aPt.X()-=nWdt; break; + } + if (aGeo.nShearWink!=0) ShearPoint(aPt,aRect.TopLeft(),aGeo.nTan); + if (aGeo.nDrehWink!=0) RotatePoint(aPt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); + aPt-=GetSnapRect().Center(); + SdrGluePoint aGP(aPt); + aGP.SetPercent(FALSE); + return aGP; } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -2012,6 +2049,53 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded() aNewList.Insert(aCopy); } + sal_Bool bMirroredX = IsMirroredX(); + sal_Bool bMirroredY = IsMirroredY(); + + long nShearWink = aGeo.nShearWink; + double fTan = aGeo.nTan; + + if ( aGeo.nDrehWink || nShearWink || bMirroredX || bMirroredY ) + { + Polygon aPoly( aRect ); + if( nShearWink ) + { + USHORT nPointCount=aPoly.GetSize(); + for (USHORT i=0; i<nPointCount; i++) + ShearPoint(aPoly[i],aRect.Center(), fTan, FALSE ); + } + if ( aGeo.nDrehWink ) + aPoly.Rotate( aRect.Center(), aGeo.nDrehWink / 10 ); + + Rectangle aBoundRect( aPoly.GetBoundRect() ); + sal_Int32 nXDiff = aBoundRect.Left() - aRect.Left(); + sal_Int32 nYDiff = aBoundRect.Top() - aRect.Top(); + + if (nShearWink&&(bMirroredX&&!bMirroredY)||(bMirroredY&&!bMirroredX)) + { + nShearWink = -nShearWink; + fTan = -fTan; + } + + Point aRef( aRect.GetWidth() / 2, aRect.GetHeight() / 2 ); + for ( a = 0; a < aNewList.GetCount(); a++ ) + { + SdrGluePoint& rPoint = aNewList[ a ]; + Point aGlue( rPoint.GetPos() ); + if ( nShearWink ) + ShearPoint( aGlue, aRef, fTan ); + + RotatePoint( aGlue, aRef, sin( fObjectRotation * F_PI180 ), cos( fObjectRotation * F_PI180 ) ); + if ( bMirroredX ) + aGlue.X() = aRect.GetWidth() - aGlue.X(); + if ( bMirroredY ) + aGlue.Y() = aRect.GetHeight() - aGlue.Y(); + aGlue.X() -= nXDiff; + aGlue.Y() -= nYDiff; + rPoint.SetPos( aGlue ); + } + } + for(a = 0; a < pList->GetCount(); a++) { const SdrGluePoint& rCandidate = (*pList)[a]; @@ -2162,12 +2246,13 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObj std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( pObj ) ); + GeoStat aGeoStat( pObj->GetGeoStat() ); if ( aNewRect.TopLeft()!= pObj->aRect.TopLeft() && ( pObj->aGeo.nDrehWink || pObj->aGeo.nShearWink ) ) { Point aNewPos( aNewRect.TopLeft() ); - if ( pObj->aGeo.nShearWink ) ShearPoint( aNewPos, aOld.TopLeft(), pObj->aGeo.nTan ); - if ( pObj->aGeo.nDrehWink ) RotatePoint(aNewPos, aOld.TopLeft(), pObj->aGeo.nSin, pObj->aGeo.nCos ); + if ( pObj->aGeo.nShearWink ) ShearPoint( aNewPos, aOld.TopLeft(), aGeoStat.nTan ); + if ( pObj->aGeo.nDrehWink ) RotatePoint(aNewPos, aOld.TopLeft(), aGeoStat.nSin, aGeoStat.nCos ); aNewRect.SetPos( aNewPos ); } if ( aNewRect != pObj->aRect ) @@ -2180,7 +2265,6 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObj Point aTop( ( pObj->GetSnapRect().Left() + pObj->GetSnapRect().Right() ) >> 1, pObj->GetSnapRect().Top() ); Point aBottom( aTop.X(), aTop.Y() + 1000 ); pObj->NbcMirror( aTop, aBottom ); - } if ( rNewRect.Top() > rNewRect.Bottom() ) { @@ -2188,6 +2272,7 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObj Point aRight( aLeft.X() + 1000, aLeft.Y() ); pObj->NbcMirror( aLeft, aRight ); } + std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() ); while ( aIter != aInteractionHandles.end() ) { @@ -3301,13 +3386,13 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, SetSnapRect(aBaseRect); // shear? -// if(!basegfx::fTools::equalZero(fShearX)) -// { -// GeoStat aGeoStat; -// aGeoStat.nShearWink = FRound((atan(fShearX) / F_PI180) * 100.0); -// aGeoStat.RecalcTan(); -// Shear(Point(), aGeoStat.nShearWink, aGeoStat.nTan, FALSE); -// } + if(!basegfx::fTools::equalZero(fShearX)) + { + GeoStat aGeoStat; + aGeoStat.nShearWink = FRound((atan(fShearX) / F_PI180) * 100.0); + aGeoStat.RecalcTan(); + Shear(Point(), aGeoStat.nShearWink, aGeoStat.nTan, FALSE); + } // rotation? if(!basegfx::fTools::equalZero(fRotate)) |