update ooo310-m15
[ooovba.git] / applied_patches / 0823-svx-ppt-text-style-fix.diff
blob1727cfd7bbd846e066ad5ee6315adba50fd44dcf
1 Fix for bug n#485630 (import/export of text style when no text is present)
3 From: Thorsten Behrens <thb@openoffice.org>
6 ---
8 sd/source/filter/eppt/epptso.cxx | 47 +---
9 svx/inc/svx/svdfppt.hxx | 12 +
10 svx/source/svdraw/svdfppt.cxx | 497 +++++++++++++++++++++-----------------
11 3 files changed, 311 insertions(+), 245 deletions(-)
14 diff --git sd/source/filter/eppt/epptso.cxx sd/source/filter/eppt/epptso.cxx
15 index 84d6e3b..08c427f 100644
16 --- sd/source/filter/eppt/epptso.cxx
17 +++ sd/source/filter/eppt/epptso.cxx
18 @@ -3157,11 +3157,15 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
20 if ( mbEmptyPresObj )
21 mnTextSize = 0;
22 - if ( mnTextSize )
23 + if ( !mbEmptyPresObj )
25 ParagraphObj* pPara;
26 TextObj aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this );
27 - aTextObj.Write( &rOut );
29 + // leaving out EPP_TextCharsAtom w/o text - still write out
30 + // attribute info though
31 + if ( mnTextSize )
32 + aTextObj.Write( &rOut );
34 if ( pPropOpt )
35 ImplAdjustFirstLineLineSpacing( aTextObj, *pPropOpt );
36 @@ -5707,38 +5711,25 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc
37 ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa02, aSolverContainer ); // Flags: Connector | HasSpt | Child
38 aPropOptSp.CreateFillProperties( mXPropSet, sal_True );
39 aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
40 - if ( mnTextSize )
41 - aPropOptSp.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
42 + aPropOptSp.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
43 aPropOptSp.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapSquare );
45 - if ( mnTextSize )
46 - {
47 - SvMemoryStream aClientTextBox( 0x200, 0x200 );
48 - SvMemoryStream aExtBu( 0x200, 0x200 );
49 + SvMemoryStream aClientTextBox( 0x200, 0x200 );
50 + SvMemoryStream aExtBu( 0x200, 0x200 );
52 - ImplWriteTextStyleAtom( aClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOptSp );
53 + ImplWriteTextStyleAtom( aClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOptSp );
55 - aPropOptSp.Commit( *mpStrm );
56 - mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
57 - *mpStrm << nLeft
58 - << nTop
59 - << nRight
60 - << nBottom;
61 + aPropOptSp.Commit( *mpStrm );
62 + mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
63 + *mpStrm << nLeft
64 + << nTop
65 + << nRight
66 + << nBottom;
68 - *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
69 - << (sal_uInt32)aClientTextBox.Tell();
70 + *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
71 + << (sal_uInt32)aClientTextBox.Tell();
73 - mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
74 - }
75 - else
76 - {
77 - aPropOptSp.Commit( *mpStrm );
78 - mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
79 - *mpStrm << nLeft
80 - << nTop
81 - << nRight
82 - << nBottom;
83 - }
84 + mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
85 mpPptEscherEx->CloseContainer();
88 diff --git svx/inc/svx/svdfppt.hxx svx/inc/svx/svdfppt.hxx
89 index a9f3664..6cb1570 100644
90 --- svx/inc/svx/svdfppt.hxx
91 +++ svx/inc/svx/svdfppt.hxx
92 @@ -989,6 +989,18 @@ struct PPTStyleTextPropReader
93 PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImport&, const DffRecordHeader& rClientTextBoxHd,
94 PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, sal_uInt32 nTextInstance );
96 + void Init( SvStream& rIn, SdrPowerPointImport&, const DffRecordHeader& rClientTextBoxHd,
97 + PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, sal_uInt32 nTextInstance );
98 + void ReadParaProps( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
99 + const String& aString, PPTTextRulerInterpreter& rRuler,
100 + sal_uInt32& nCharCount, sal_Bool& bTextPropAtom );
101 + void ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const String& aString,
102 + sal_uInt32& nCharCount, sal_uInt32 nCharAnzRead,
103 + sal_Bool& bTextPropAtom, sal_uInt32 nExtParaPos,
104 + const std::vector< StyleTextProp9 >& aStyleTextProp9,
105 + sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip,
106 + sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme );
108 ~PPTStyleTextPropReader();
111 diff --git svx/source/svdraw/svdfppt.cxx svx/source/svdraw/svdfppt.cxx
112 index 9cbbe18..8caf151 100644
113 --- svx/source/svdraw/svdfppt.cxx
114 +++ svx/source/svdraw/svdfppt.cxx
115 @@ -4976,6 +4976,246 @@ void StyleTextProp9::Read( SvStream& rIn )
116 PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
117 PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance )
119 + Init(rIn, rMan, rTextHeader, rRuler, rExtParaHd, nInstance);
122 +void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
123 + const String& aString, PPTTextRulerInterpreter& rRuler,
124 + sal_uInt32& nCharCount, sal_Bool& bTextPropAtom )
126 + sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
127 + sal_uInt32 nCharAnzRead = 0;
128 + sal_uInt16 nDummy16;
130 + sal_uInt16 nStringLen = aString.Len();
132 + DffRecordHeader aTextHd2;
133 + rTextHeader.SeekToContent( rIn );
134 + if ( rMan.SeekToRec( rIn, PPT_PST_StyleTextPropAtom, rTextHeader.GetRecEndFilePos(), &aTextHd2 ) )
135 + bTextPropAtom = sal_True;
136 + while ( nCharAnzRead <= nStringLen )
138 + PPTParaPropSet aParaPropSet;
139 + ImplPPTParaPropSet& aSet = *aParaPropSet.pParaSet;
140 + if ( bTextPropAtom )
142 + rIn >> nCharCount
143 + >> aParaPropSet.pParaSet->mnDepth; // Einruecktiefe
145 + nCharCount--;
147 + rIn >> nMask;
148 + aSet.mnAttrSet = nMask & 0x207df7;
149 + sal_uInt16 nBulFlg = 0;
150 + if ( nMask & 0xF )
151 + rIn >> nBulFlg; // Bullet-HardAttr-Flags
152 + aSet.mpArry[ PPT_ParaAttr_BulletOn ] = ( nBulFlg & 1 ) ? 1 : 0;
153 + aSet.mpArry[ PPT_ParaAttr_BuHardFont ] = ( nBulFlg & 2 ) ? 1 : 0;
154 + aSet.mpArry[ PPT_ParaAttr_BuHardColor ] = ( nBulFlg & 4 ) ? 1 : 0;
156 + if ( nMask & 0x0080 ) // buChar
157 + rIn >> aSet.mpArry[ PPT_ParaAttr_BulletChar ];
158 + if ( nMask & 0x0010 ) // buTypeface
159 + rIn >> aSet.mpArry[ PPT_ParaAttr_BulletFont ];
160 + if ( nMask & 0x0040 ) // buSize
162 + rIn >> aSet.mpArry[ PPT_ParaAttr_BulletHeight ];
163 + if ( ! ( ( nMask & ( 1 << PPT_ParaAttr_BuHardHeight ) )
164 + && ( nBulFlg && ( 1 << PPT_ParaAttr_BuHardHeight ) ) ) )
165 + aSet.mnAttrSet ^= 0x40;
167 + if ( nMask & 0x0020 ) // buColor
169 + sal_uInt32 nVal32, nHiByte;
170 + rIn >> nVal32;
171 + nHiByte = nVal32 >> 24;
172 + if ( nHiByte <= 8 )
173 + nVal32 = nHiByte | PPT_COLSCHEME;
174 + aSet.mnBulletColor = nVal32;
176 + if ( nMask & 0x0800 ) // pfAlignment
178 + rIn >> nDummy16;
179 + aSet.mpArry[ PPT_ParaAttr_Adjust ] = nDummy16 & 3;
181 + if ( nMask & 0x1000 ) // pfLineSpacing
182 + rIn >> aSet.mpArry[ PPT_ParaAttr_LineFeed ];
183 + if ( nMask & 0x2000 ) // pfSpaceBefore
184 + rIn >> aSet.mpArry[ PPT_ParaAttr_UpperDist ];
185 + if ( nMask & 0x4000 ) // pfSpaceAfter
186 + rIn >> aSet.mpArry[ PPT_ParaAttr_LowerDist ];
187 + if ( nMask & 0x100 ) // pfLeftMargin
188 + rIn >> nDummy16;
189 + if ( nMask & 0x400 ) // pfIndent
190 + rIn >> nDummy16;
191 + if ( nMask & 0x8000 ) // pfDefaultTabSize
192 + rIn >> nDummy16;
193 + if ( nMask & 0x100000 ) // pfTabStops
195 + sal_uInt16 i, nDistance, nAlignment, nNumberOfTabStops = 0;
196 + rIn >> nNumberOfTabStops;
197 + for ( i = 0; i < nNumberOfTabStops; i++ )
199 + rIn >> nDistance
200 + >> nAlignment;
203 + if ( nMask & 0x10000 ) // pfBaseLine
204 + rIn >> nDummy16;
205 + if ( nMask & 0xe0000 ) // pfCharWrap, pfWordWrap, pfOverflow
207 + rIn >> nDummy16;
208 + if ( nMask & 0x20000 )
209 + aSet.mpArry[ PPT_ParaAttr_AsianLB_1 ] = nDummy16 & 1;
210 + if ( nMask & 0x40000 )
211 + aSet.mpArry[ PPT_ParaAttr_AsianLB_2 ] = ( nDummy16 >> 1 ) & 1;
212 + if ( nMask & 0x80000 )
213 + aSet.mpArry[ PPT_ParaAttr_AsianLB_3 ] = ( nDummy16 >> 2 ) & 1;
214 + aSet.mnAttrSet |= ( ( nMask >> 17 ) & 7 ) << PPT_ParaAttr_AsianLB_1;
216 + if ( nMask & 0x200000 ) // pfTextDirection
217 + rIn >> aSet.mpArry[ PPT_ParaAttr_BiDi ];
219 + else
220 + nCharCount = nStringLen;
222 + if ( rRuler.GetTextOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_TextOfs ] ) )
223 + aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs;
224 + if ( rRuler.GetBulletOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_BulletOfs ] ) )
225 + aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs;
226 + if ( rRuler.GetDefaultTab( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_DefaultTab ] ) )
227 + aSet.mnAttrSet |= 1 << PPT_ParaAttr_DefaultTab;
229 + if ( ( nCharCount > nStringLen ) || ( nStringLen < nCharAnzRead + nCharCount ) )
231 + bTextPropAtom = sal_False;
232 + nCharCount = nStringLen - nCharAnzRead;
233 + // please fix the right hand side of
234 + // PPTParaPropSet& PPTParaPropSet::operator=(PPTParaPropSet&),
235 + // it should be a const reference
236 + PPTParaPropSet aTmpPPTParaPropSet;
237 + aParaPropSet = aTmpPPTParaPropSet;
238 + DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" );
240 + PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet );
241 + pPara->mnOriginalTextPos = nCharAnzRead;
242 + aParaPropList.Insert( pPara, LIST_APPEND );
243 + if ( nCharCount )
245 + sal_uInt32 nCount;
246 + const sal_Unicode* pDat = aString.GetBuffer() + nCharAnzRead;
247 + for ( nCount = 0; nCount < nCharCount; nCount++ )
249 + if ( pDat[ nCount ] == 0xd )
251 + pPara = new PPTParaPropSet( aParaPropSet );
252 + pPara->mnOriginalTextPos = nCharAnzRead + nCount + 1;
253 + aParaPropList.Insert( pPara, LIST_APPEND );
257 + nCharAnzRead += nCharCount + 1;
261 +void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const String& aString,
262 + sal_uInt32& nCharCount, sal_uInt32 nCharAnzRead,
263 + sal_Bool& bTextPropAtom, sal_uInt32 nExtParaPos,
264 + const std::vector< StyleTextProp9 >& aStyleTextProp9,
265 + sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip,
266 + sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme )
268 + sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
269 + sal_uInt16 nDummy16;
270 + sal_Int32 nCharsToRead;
271 + sal_uInt32 nExtParaNibble = 0;
273 + sal_uInt16 nStringLen = aString.Len();
275 + rIn >> nDummy16;
276 + nCharCount = nDummy16;
277 + rIn >> nDummy16;
278 + nCharsToRead = nStringLen - ( nCharAnzRead + nCharCount );
279 + if ( nCharsToRead < 0 )
281 + nCharCount = nStringLen - nCharAnzRead;
282 + if ( nCharsToRead < -1 )
284 + bTextPropAtom = sal_False;
285 + DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" );
288 + ImplPPTCharPropSet& aSet = *aCharPropSet.pCharSet;
290 + // character attributes
291 + rIn >> nMask;
292 + if ( (sal_uInt16)nMask )
294 + aSet.mnAttrSet |= (sal_uInt16)nMask;
295 + rIn >> aSet.mnFlags;
297 + if ( nMask & 0x10000 ) // cfTypeface
299 + rIn >> aSet.mnFont;
300 + aSet.mnAttrSet |= 1 << PPT_CharAttr_Font;
302 + if ( nMask & 0x200000 ) // cfFEOldTypeface
304 + rIn >> aSet.mnAsianOrComplexFont;
305 + aSet.mnAttrSet |= 1 << PPT_CharAttr_AsianOrComplexFont;
307 + if ( nMask & 0x400000 ) // cfANSITypeface
309 + rIn >> aSet.mnANSITypeface;
310 + aSet.mnAttrSet |= 1 << PPT_CharAttr_ANSITypeface;
312 + if ( nMask & 0x800000 ) // cfSymbolTypeface
314 + rIn >> aSet.mnSymbolFont;
315 + aSet.mnAttrSet |= 1 << PPT_CharAttr_Symbol;
317 + if ( nMask & 0x20000 ) // cfSize
319 + rIn >> aSet.mnFontHeight;
320 + aSet.mnAttrSet |= 1 << PPT_CharAttr_FontHeight;
322 + if ( nMask & 0x40000 ) // cfColor
324 + sal_uInt32 nVal;
325 + rIn >> nVal;
326 + if ( !( nVal & 0xff000000 ) )
327 + nVal = PPT_COLSCHEME_HINTERGRUND;
328 + aSet.mnColor = nVal;
329 + aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor;
331 + if ( nMask & 0x80000 ) // cfPosition
333 + rIn >> aSet.mnEscapement;
334 + aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement;
336 + if ( nExtParaPos )
338 + sal_uInt32 nExtBuInd = nMask & 0x3c00;
339 + if ( nExtBuInd )
340 + nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10;
341 + if ( nExtBuInd < aStyleTextProp9.size() )
343 + if ( nExtParaNibble && ( ( nExtBuInd + nExtParaNibble ) < aStyleTextProp9.size() ) )
344 + nExtBuInd += nExtParaNibble;
346 + nExtParaFlags = aStyleTextProp9[ nExtBuInd ].mnExtParagraphMask;
347 + nBuBlip = aStyleTextProp9[ nExtBuInd ].mnBuBlip;
348 + nHasAnm = aStyleTextProp9[ nExtBuInd ].mnHasAnm;
349 + nAnmScheme = aStyleTextProp9[ nExtBuInd ].mnAnmScheme;
351 + if ( ( nExtBuInd & 0xf ) == 0xf )
352 + nExtParaNibble += 16;
356 +void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
357 + PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance )
359 sal_uInt32 nMerk = rIn.Tell();
360 sal_uInt32 nExtParaPos = ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom ) ? rExtParaHd.nFilePos + 8 : 0;
362 @@ -5035,7 +5275,7 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo
363 aString = String( pBuf, (sal_uInt16)i );
364 delete[] pBuf;
366 - else
367 + else if( aTextHd.nRecType == PPT_PST_TextBytesAtom )
369 sal_Char *pBuf = new sal_Char[ nMaxLen + 1 ];
370 pBuf[ nMaxLen ] = 0;
371 @@ -5060,148 +5300,44 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo
372 aString = String( pBuf, nLen, RTL_TEXTENCODING_MS_1252 );
373 delete[] pBuf;
375 - if ( aString.Len() )
377 - sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
378 - sal_uInt32 nCharCount, nCharAnzRead = 0;
379 - sal_Int32 nCharsToRead;
380 - sal_uInt16 nDummy16;
381 + else
383 + // no chars, but potentially char/para props?
384 + sal_uInt32 nCharCount;
385 sal_Bool bTextPropAtom = sal_False;
386 + ReadParaProps( rIn, rMan, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom );
388 - sal_uInt16 nStringLen = aString.Len();
389 + if ( bTextPropAtom )
391 + // yeah, StyleTextProp is there, read it all & push to
392 + // aParaPropList
393 + PPTCharPropSet aCharPropSet(0);
394 + aCharPropSet.mnOriginalTextPos = 0;
396 - DffRecordHeader aTextHd2;
397 - rTextHeader.SeekToContent( rIn );
398 - if ( rMan.SeekToRec( rIn, PPT_PST_StyleTextPropAtom, rTextHeader.GetRecEndFilePos(), &aTextHd2 ) )
399 - bTextPropAtom = sal_True;
400 - while ( nCharAnzRead <= nStringLen )
402 - PPTParaPropSet aParaPropSet;
403 - ImplPPTParaPropSet& aSet = *aParaPropSet.pParaSet;
404 - if ( bTextPropAtom )
406 - rIn >> nCharCount
407 - >> aParaPropSet.pParaSet->mnDepth; // Einruecktiefe
409 - nCharCount--;
411 - rIn >> nMask;
412 - aSet.mnAttrSet = nMask & 0x207df7;
413 - sal_uInt16 nBulFlg = 0;
414 - if ( nMask & 0xF )
415 - rIn >> nBulFlg; // Bullet-HardAttr-Flags
416 - aSet.mpArry[ PPT_ParaAttr_BulletOn ] = ( nBulFlg & 1 ) ? 1 : 0;
417 - aSet.mpArry[ PPT_ParaAttr_BuHardFont ] = ( nBulFlg & 2 ) ? 1 : 0;
418 - aSet.mpArry[ PPT_ParaAttr_BuHardColor ] = ( nBulFlg & 4 ) ? 1 : 0;
420 - if ( nMask & 0x0080 ) // buChar
421 - rIn >> aSet.mpArry[ PPT_ParaAttr_BulletChar ];
422 - if ( nMask & 0x0010 ) // buTypeface
423 - rIn >> aSet.mpArry[ PPT_ParaAttr_BulletFont ];
424 - if ( nMask & 0x0040 ) // buSize
426 - rIn >> aSet.mpArry[ PPT_ParaAttr_BulletHeight ];
427 - if ( ! ( ( nMask & ( 1 << PPT_ParaAttr_BuHardHeight ) )
428 - && ( nBulFlg && ( 1 << PPT_ParaAttr_BuHardHeight ) ) ) )
429 - aSet.mnAttrSet ^= 0x40;
431 - if ( nMask & 0x0020 ) // buColor
433 - sal_uInt32 nVal32, nHiByte;
434 - rIn >> nVal32;
435 - nHiByte = nVal32 >> 24;
436 - if ( nHiByte <= 8 )
437 - nVal32 = nHiByte | PPT_COLSCHEME;
438 - aSet.mnBulletColor = nVal32;
440 - if ( nMask & 0x0800 ) // pfAlignment
442 - rIn >> nDummy16;
443 - aSet.mpArry[ PPT_ParaAttr_Adjust ] = nDummy16 & 3;
445 - if ( nMask & 0x1000 ) // pfLineSpacing
446 - rIn >> aSet.mpArry[ PPT_ParaAttr_LineFeed ];
447 - if ( nMask & 0x2000 ) // pfSpaceBefore
448 - rIn >> aSet.mpArry[ PPT_ParaAttr_UpperDist ];
449 - if ( nMask & 0x4000 ) // pfSpaceAfter
450 - rIn >> aSet.mpArry[ PPT_ParaAttr_LowerDist ];
451 - if ( nMask & 0x100 ) // pfLeftMargin
452 - rIn >> nDummy16;
453 - if ( nMask & 0x400 ) // pfIndent
454 - rIn >> nDummy16;
455 - if ( nMask & 0x8000 ) // pfDefaultTabSize
456 - rIn >> nDummy16;
457 - if ( nMask & 0x100000 ) // pfTabStops
459 - sal_uInt16 i, nDistance, nAlignment, nNumberOfTabStops = 0;
460 - rIn >> nNumberOfTabStops;
461 - for ( i = 0; i < nNumberOfTabStops; i++ )
463 - rIn >> nDistance
464 - >> nAlignment;
467 - if ( nMask & 0x10000 ) // pfBaseLine
468 - rIn >> nDummy16;
469 - if ( nMask & 0xe0000 ) // pfCharWrap, pfWordWrap, pfOverflow
471 - rIn >> nDummy16;
472 - if ( nMask & 0x20000 )
473 - aSet.mpArry[ PPT_ParaAttr_AsianLB_1 ] = nDummy16 & 1;
474 - if ( nMask & 0x40000 )
475 - aSet.mpArry[ PPT_ParaAttr_AsianLB_2 ] = ( nDummy16 >> 1 ) & 1;
476 - if ( nMask & 0x80000 )
477 - aSet.mpArry[ PPT_ParaAttr_AsianLB_3 ] = ( nDummy16 >> 2 ) & 1;
478 - aSet.mnAttrSet |= ( ( nMask >> 17 ) & 7 ) << PPT_ParaAttr_AsianLB_1;
480 - if ( nMask & 0x200000 ) // pfTextDirection
481 - rIn >> aSet.mpArry[ PPT_ParaAttr_BiDi ];
483 - else
484 - nCharCount = nStringLen;
485 + sal_uInt32 nCharAnzRead = 0;
486 + sal_uInt32 nExtParaFlags = 0, nAnmScheme = 0;
487 + sal_uInt16 nBuBlip = 0xffff, nHasAnm = 0;
488 + ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharAnzRead,
489 + bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
490 + nBuBlip, nHasAnm, nAnmScheme );
492 + aCharPropList.Insert(
493 + new PPTCharPropSet( aCharPropSet, 0 ), LIST_APPEND );
497 - if ( rRuler.GetTextOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_TextOfs ] ) )
498 - aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs;
499 - if ( rRuler.GetBulletOfs( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_BulletOfs ] ) )
500 - aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs;
501 - if ( rRuler.GetDefaultTab( aParaPropSet.pParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_DefaultTab ] ) )
502 - aSet.mnAttrSet |= 1 << PPT_ParaAttr_DefaultTab;
503 + if ( aString.Len() )
505 + sal_uInt32 nCharCount;
506 + sal_Bool bTextPropAtom = sal_False;
508 - if ( ( nCharCount > nStringLen ) || ( nStringLen < nCharAnzRead + nCharCount ) )
510 - bTextPropAtom = sal_False;
511 - nCharCount = nStringLen - nCharAnzRead;
512 - // please fix the right hand side of
513 - // PPTParaPropSet& PPTParaPropSet::operator=(PPTParaPropSet&),
514 - // it should be a const reference
515 - PPTParaPropSet aTmpPPTParaPropSet;
516 - aParaPropSet = aTmpPPTParaPropSet;
517 - DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" );
519 - PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet );
520 - pPara->mnOriginalTextPos = nCharAnzRead;
521 - aParaPropList.Insert( pPara, LIST_APPEND );
522 - if ( nCharCount )
524 - sal_uInt32 nCount;
525 - const sal_Unicode* pDat = aString.GetBuffer() + nCharAnzRead;
526 - for ( nCount = 0; nCount < nCharCount; nCount++ )
528 - if ( pDat[ nCount ] == 0xd )
530 - pPara = new PPTParaPropSet( aParaPropSet );
531 - pPara->mnOriginalTextPos = nCharAnzRead + nCount + 1;
532 - aParaPropList.Insert( pPara, LIST_APPEND );
536 - nCharAnzRead += nCharCount + 1;
538 + ReadParaProps( rIn, rMan, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom );
540 sal_Bool bEmptyParaPossible = sal_True;
541 - sal_uInt32 nCurrentPara = nCharAnzRead = 0;
542 + sal_uInt32 nCharAnzRead = 0;
543 + sal_uInt32 nCurrentPara = 0;
544 sal_uInt32 nCurrentSpecMarker = (sal_uInt32)(sal_uIntPtr)aSpecMarkerList.First();
545 - sal_uInt32 nExtParaNibble = 0;
546 + sal_uInt16 nStringLen = aString.Len();
548 while ( nCharAnzRead < nStringLen )
550 @@ -5210,87 +5346,9 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo
552 PPTCharPropSet aCharPropSet( nCurrentPara );
553 if ( bTextPropAtom )
555 - rIn >> nDummy16;
556 - nCharCount = nDummy16;
557 - rIn >> nDummy16;
558 - nCharsToRead = nStringLen - ( nCharAnzRead + nCharCount );
559 - if ( nCharsToRead < 0 )
561 - nCharCount = nStringLen - nCharAnzRead;
562 - if ( nCharsToRead < -1 )
564 - bTextPropAtom = sal_False;
565 - DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" );
568 - ImplPPTCharPropSet& aSet = *aCharPropSet.pCharSet;
570 - // character attributes
571 - rIn >> nMask;
572 - if ( (sal_uInt16)nMask )
574 - aSet.mnAttrSet |= (sal_uInt16)nMask;
575 - rIn >> aSet.mnFlags;
577 - if ( nMask & 0x10000 ) // cfTypeface
579 - rIn >> aSet.mnFont;
580 - aSet.mnAttrSet |= 1 << PPT_CharAttr_Font;
582 - if ( nMask & 0x200000 ) // cfFEOldTypeface
584 - rIn >> aSet.mnAsianOrComplexFont;
585 - aSet.mnAttrSet |= 1 << PPT_CharAttr_AsianOrComplexFont;
587 - if ( nMask & 0x400000 ) // cfANSITypeface
589 - rIn >> aSet.mnANSITypeface;
590 - aSet.mnAttrSet |= 1 << PPT_CharAttr_ANSITypeface;
592 - if ( nMask & 0x800000 ) // cfSymbolTypeface
594 - rIn >> aSet.mnSymbolFont;
595 - aSet.mnAttrSet |= 1 << PPT_CharAttr_Symbol;
597 - if ( nMask & 0x20000 ) // cfSize
599 - rIn >> aSet.mnFontHeight;
600 - aSet.mnAttrSet |= 1 << PPT_CharAttr_FontHeight;
602 - if ( nMask & 0x40000 ) // cfColor
604 - sal_uInt32 nVal;
605 - rIn >> nVal;
606 - if ( !( nVal & 0xff000000 ) )
607 - nVal = PPT_COLSCHEME_HINTERGRUND;
608 - aSet.mnColor = nVal;
609 - aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor;
611 - if ( nMask & 0x80000 ) // cfPosition
613 - rIn >> aSet.mnEscapement;
614 - aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement;
616 - if ( nExtParaPos )
618 - sal_uInt32 nExtBuInd = nMask & 0x3c00;
619 - if ( nExtBuInd )
620 - nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10;
621 - if ( nExtBuInd < aStyleTextProp9.size() )
623 - if ( nExtParaNibble && ( ( nExtBuInd + nExtParaNibble ) < aStyleTextProp9.size() ) )
624 - nExtBuInd += nExtParaNibble;
626 - nExtParaFlags = aStyleTextProp9[ nExtBuInd ].mnExtParagraphMask;
627 - nBuBlip = aStyleTextProp9[ nExtBuInd ].mnBuBlip;
628 - nHasAnm = aStyleTextProp9[ nExtBuInd ].mnHasAnm;
629 - nAnmScheme = aStyleTextProp9[ nExtBuInd ].mnAnmScheme;
631 - if ( ( nExtBuInd & 0xf ) == 0xf )
632 - nExtParaNibble += 16;
635 + ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharAnzRead,
636 + bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
637 + nBuBlip, nHasAnm, nAnmScheme );
638 else
639 nCharCount = nStringLen;
641 @@ -6629,7 +6687,12 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
642 mpImplTextObj->mnInstance = nInstance;
644 UINT32 nFilePos = rIn.Tell();
645 - if ( rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom, PPT_PST_TextCharsAtom, aClientTextBoxHd.GetRecEndFilePos() ) )
646 + if ( rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom,
647 + PPT_PST_TextCharsAtom,
648 + aClientTextBoxHd.GetRecEndFilePos() )
649 + || rSdrPowerPointImport.SeekToRec( rIn,
650 + PPT_PST_StyleTextPropAtom,
651 + aClientTextBoxHd.GetRecEndFilePos() ) )
653 PPTTextRulerInterpreter aTextRulerInterpreter( nTextRulerAtomOfs, rSdrPowerPointImport,
654 aClientTextBoxHd, rIn );