msdffimp.cxx (36a46462) | msdffimp.cxx (95e2fe77) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_filter.hxx" 26/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ 27#include <com/sun/star/embed/Aspects.hpp> 28 29#include <math.h> 30#include <limits.h> 31#include <vector> 32#include <osl/endian.h> | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_filter.hxx" 26/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ 27#include <com/sun/star/embed/Aspects.hpp> 28 29#include <math.h> 30#include <limits.h> 31#include <vector> 32#include <osl/endian.h> |
33#include <tools/solar.h> // UINTXX | 33#include <tools/solar.h> // UINTXX |
34#include <rtl/math.hxx> 35 36#include <sot/clsids.hxx> 37#include <toolkit/helper/vclunohelper.hxx> 38#include <unotools/streamwrap.hxx> 39#include <comphelper/processfactory.hxx> 40#include <comphelper/seqstream.hxx> 41#include <comphelper/storagehelper.hxx> --- 112 unchanged lines hidden (view full) --- 154// static counter for OLE-Objects 155static sal_uInt32 nMSOleObjCntr = 0; 156#define MSO_OLE_Obj "MSO_OLE_Obj" 157 158/************************************************************************/ 159void Impl_OlePres::Write( SvStream & rStm ) 160{ 161 WriteClipboardFormat( rStm, FORMAT_GDIMETAFILE ); | 34#include <rtl/math.hxx> 35 36#include <sot/clsids.hxx> 37#include <toolkit/helper/vclunohelper.hxx> 38#include <unotools/streamwrap.hxx> 39#include <comphelper/processfactory.hxx> 40#include <comphelper/seqstream.hxx> 41#include <comphelper/storagehelper.hxx> --- 112 unchanged lines hidden (view full) --- 154// static counter for OLE-Objects 155static sal_uInt32 nMSOleObjCntr = 0; 156#define MSO_OLE_Obj "MSO_OLE_Obj" 157 158/************************************************************************/ 159void Impl_OlePres::Write( SvStream & rStm ) 160{ 161 WriteClipboardFormat( rStm, FORMAT_GDIMETAFILE ); |
162 rStm << (sal_Int32)(nJobLen +4); // immer leeres TargetDevice | 162 rStm << (sal_Int32)(nJobLen +4); // immer leeres TargetDevice |
163 if( nJobLen ) 164 rStm.Write( pJob, nJobLen ); 165 rStm << (sal_uInt32)nAspect; 166 rStm << (sal_Int32)-1; //L-Index immer -1 167 rStm << (sal_Int32)nAdvFlags; 168 rStm << (sal_Int32)0; //Compression 169 rStm << (sal_Int32)aSize.Width(); 170 rStm << (sal_Int32)aSize.Height(); --- 624 unchanged lines hidden (view full) --- 795 796static basegfx::B2DPolygon GetLineArrow( const sal_Int32 nLineWidth, const MSO_LineEnd eLineEnd, 797 const MSO_LineEndWidth eLineWidth, const MSO_LineEndLength eLineLenght, 798 sal_Int32& rnArrowWidth, sal_Bool& rbArrowCenter, 799 String& rsArrowName, sal_Bool bScaleArrow ) 800{ 801 basegfx::B2DPolygon aRetval; 802 // 70 100mm = 2pt = 40 twip. In MS, line width less than 2pt has the same size arrow as 2pt | 163 if( nJobLen ) 164 rStm.Write( pJob, nJobLen ); 165 rStm << (sal_uInt32)nAspect; 166 rStm << (sal_Int32)-1; //L-Index immer -1 167 rStm << (sal_Int32)nAdvFlags; 168 rStm << (sal_Int32)0; //Compression 169 rStm << (sal_Int32)aSize.Width(); 170 rStm << (sal_Int32)aSize.Height(); --- 624 unchanged lines hidden (view full) --- 795 796static basegfx::B2DPolygon GetLineArrow( const sal_Int32 nLineWidth, const MSO_LineEnd eLineEnd, 797 const MSO_LineEndWidth eLineWidth, const MSO_LineEndLength eLineLenght, 798 sal_Int32& rnArrowWidth, sal_Bool& rbArrowCenter, 799 String& rsArrowName, sal_Bool bScaleArrow ) 800{ 801 basegfx::B2DPolygon aRetval; 802 // 70 100mm = 2pt = 40 twip. In MS, line width less than 2pt has the same size arrow as 2pt |
803 //If the unit is twip. Make all use this unit especailly the critical value 70/40. | 803 //If the unit is twip. Make all use this unit especially the critical value 70/40. |
804 sal_Int32 nLineWidthCritical = bScaleArrow ? 40 : 70; 805 double fLineWidth = nLineWidth < nLineWidthCritical ? nLineWidthCritical : nLineWidth;; 806 double fLenghtMul, fWidthMul; 807 sal_Int32 nLineNumber; 808 switch( eLineLenght ) 809 { 810 default : 811 case mso_lineMediumLenArrow : fLenghtMul = 3.0; nLineNumber = 2; break; --- 285 unchanged lines hidden (view full) --- 1097 rSet.Put( XLineStyleItem( XLINE_NONE ) ); 1098} 1099 1100struct ShadeColor 1101{ 1102 Color aColor; 1103 double fDist; 1104 | 804 sal_Int32 nLineWidthCritical = bScaleArrow ? 40 : 70; 805 double fLineWidth = nLineWidth < nLineWidthCritical ? nLineWidthCritical : nLineWidth;; 806 double fLenghtMul, fWidthMul; 807 sal_Int32 nLineNumber; 808 switch( eLineLenght ) 809 { 810 default : 811 case mso_lineMediumLenArrow : fLenghtMul = 3.0; nLineNumber = 2; break; --- 285 unchanged lines hidden (view full) --- 1097 rSet.Put( XLineStyleItem( XLINE_NONE ) ); 1098} 1099 1100struct ShadeColor 1101{ 1102 Color aColor; 1103 double fDist; 1104 |
1105 ShadeColor( const Color& rC, double fR ) : aColor( rC ), fDist( fR ) {}; | 1105 ShadeColor( const Color& rC, double fR ) : aColor( rC ), fDist( fR ) {}; |
1106}; 1107 1108void GetShadeColors( const SvxMSDffManager& rManager, const DffPropertyReader& rProperties, SvStream& rIn, std::vector< ShadeColor >& rShadeColors ) 1109{ 1110 sal_uInt32 nPos = rIn.Tell(); 1111 if ( rProperties.IsProperty( DFF_Prop_fillShadeColors ) ) 1112 { 1113 if ( rProperties.SeekToContent( DFF_Prop_fillShadeColors, rIn ) ) --- 45 unchanged lines hidden (view full) --- 1159 { 1160 sal_Int32 nX, nY; 1161 for ( nY = 0; nY < aBitmapSizePixel.Height(); nY++ ) 1162 { 1163 for ( nX = 0; nX < aBitmapSizePixel.Width(); nX++ ) 1164 { 1165 double fX = static_cast< double >( nX ) / aBitmapSizePixel.Width(); 1166 double fY = static_cast< double >( nY ) / aBitmapSizePixel.Height(); | 1106}; 1107 1108void GetShadeColors( const SvxMSDffManager& rManager, const DffPropertyReader& rProperties, SvStream& rIn, std::vector< ShadeColor >& rShadeColors ) 1109{ 1110 sal_uInt32 nPos = rIn.Tell(); 1111 if ( rProperties.IsProperty( DFF_Prop_fillShadeColors ) ) 1112 { 1113 if ( rProperties.SeekToContent( DFF_Prop_fillShadeColors, rIn ) ) --- 45 unchanged lines hidden (view full) --- 1159 { 1160 sal_Int32 nX, nY; 1161 for ( nY = 0; nY < aBitmapSizePixel.Height(); nY++ ) 1162 { 1163 for ( nX = 0; nX < aBitmapSizePixel.Width(); nX++ ) 1164 { 1165 double fX = static_cast< double >( nX ) / aBitmapSizePixel.Width(); 1166 double fY = static_cast< double >( nY ) / aBitmapSizePixel.Height(); |
1167 | 1167 |
1168 double fD, fDist; 1169 if ( fX < fFocusX ) 1170 { 1171 if ( fY < fFocusY ) 1172 { 1173 if ( fX > fY ) 1174 fDist = fY, fD = fFocusY; 1175 else --- 21 unchanged lines hidden (view full) --- 1197 if ( ( 1 - fX ) > ( 1 - fY ) ) 1198 fDist = ( 1 - fY ), fD = 1 - fFocusY; 1199 else 1200 fDist = ( 1 - fX ), fD = 1 - fFocusX; 1201 } 1202 } 1203 if ( fD != 0.0 ) 1204 fDist /= fD; | 1168 double fD, fDist; 1169 if ( fX < fFocusX ) 1170 { 1171 if ( fY < fFocusY ) 1172 { 1173 if ( fX > fY ) 1174 fDist = fY, fD = fFocusY; 1175 else --- 21 unchanged lines hidden (view full) --- 1197 if ( ( 1 - fX ) > ( 1 - fY ) ) 1198 fDist = ( 1 - fY ), fD = 1 - fFocusY; 1199 else 1200 fDist = ( 1 - fX ), fD = 1 - fFocusX; 1201 } 1202 } 1203 if ( fD != 0.0 ) 1204 fDist /= fD; |
1205 | 1205 |
1206 std::vector< ShadeColor >::const_iterator aIter( rShadeColors.begin() ); 1207 double fA = 0.0; 1208 Color aColorA = aIter->aColor; 1209 double fB = 1.0; 1210 Color aColorB( aColorA ); 1211 while ( aIter != rShadeColors.end() ) 1212 { 1213 if ( aIter->fDist <= fDist ) --- 8 unchanged lines hidden (view full) --- 1222 { 1223 if ( aIter->fDist <= fB ) 1224 { 1225 fB = aIter->fDist; 1226 aColorB = aIter->aColor; 1227 } 1228 } 1229 aIter++; | 1206 std::vector< ShadeColor >::const_iterator aIter( rShadeColors.begin() ); 1207 double fA = 0.0; 1208 Color aColorA = aIter->aColor; 1209 double fB = 1.0; 1210 Color aColorB( aColorA ); 1211 while ( aIter != rShadeColors.end() ) 1212 { 1213 if ( aIter->fDist <= fDist ) --- 8 unchanged lines hidden (view full) --- 1222 { 1223 if ( aIter->fDist <= fB ) 1224 { 1225 fB = aIter->fDist; 1226 aColorB = aIter->aColor; 1227 } 1228 } 1229 aIter++; |
1230 } | 1230 } |
1231 double fRed = aColorA.GetRed(), fGreen = aColorA.GetGreen(), fBlue = aColorA.GetBlue(); 1232 double fD1 = fB - fA; 1233 if ( fD1 != 0.0 ) 1234 { 1235 fRed += ( ( ( fDist - fA ) * ( aColorB.GetRed() - aColorA.GetRed() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fRed; 1236 fGreen += ( ( ( fDist - fA ) * ( aColorB.GetGreen() - aColorA.GetGreen() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fGreen; 1237 fBlue += ( ( ( fDist - fA ) * ( aColorB.GetBlue() - aColorA.GetBlue() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fBlue; 1238 } --- 16 unchanged lines hidden (view full) --- 1255 aQuantErrNextScan[ nX + 1 ].fGreen += 1.0 * fErr / 16.0; 1256 1257 fErr = fBlue - nBlue; 1258 aQuantErrCurrScan[ nX + 1 ].fBlue += 7.0 * fErr / 16.0; 1259 if ( nX ) 1260 aQuantErrNextScan[ nX - 1 ].fBlue += 3.0 * fErr / 16.0; 1261 aQuantErrNextScan[ nX ].fBlue += 5.0 * fErr / 16.0; 1262 aQuantErrNextScan[ nX + 1 ].fBlue += 1.0 * fErr / 16.0; | 1231 double fRed = aColorA.GetRed(), fGreen = aColorA.GetGreen(), fBlue = aColorA.GetBlue(); 1232 double fD1 = fB - fA; 1233 if ( fD1 != 0.0 ) 1234 { 1235 fRed += ( ( ( fDist - fA ) * ( aColorB.GetRed() - aColorA.GetRed() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fRed; 1236 fGreen += ( ( ( fDist - fA ) * ( aColorB.GetGreen() - aColorA.GetGreen() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fGreen; 1237 fBlue += ( ( ( fDist - fA ) * ( aColorB.GetBlue() - aColorA.GetBlue() ) ) / fD1 ); // + aQuantErrCurrScan[ nX ].fBlue; 1238 } --- 16 unchanged lines hidden (view full) --- 1255 aQuantErrNextScan[ nX + 1 ].fGreen += 1.0 * fErr / 16.0; 1256 1257 fErr = fBlue - nBlue; 1258 aQuantErrCurrScan[ nX + 1 ].fBlue += 7.0 * fErr / 16.0; 1259 if ( nX ) 1260 aQuantErrNextScan[ nX - 1 ].fBlue += 3.0 * fErr / 16.0; 1261 aQuantErrNextScan[ nX ].fBlue += 5.0 * fErr / 16.0; 1262 aQuantErrNextScan[ nX + 1 ].fBlue += 1.0 * fErr / 16.0; |
1263*/ | 1263*/ |
1264 if ( nRed < 0 ) 1265 nRed = 0; 1266 if ( nRed > 255 ) 1267 nRed = 255; 1268 if ( nGreen < 0 ) 1269 nGreen = 0; 1270 if ( nGreen > 255 ) 1271 nGreen = 255; --- 27 unchanged lines hidden (view full) --- 1299 aSecPropSet.ReadPropSet( rIn, NULL ); 1300 sal_Int32 nSecFillProperties = aSecPropSet.GetPropertyValue( DFF_Prop_fNoFillHitTest, 0x200020 ); 1301 bRotateWithShape = ( nSecFillProperties & 0x0020 ); 1302 } 1303 rIn.Seek( nPos ); 1304 if ( bRotateWithShape ) 1305 { 1306 aBitmap.Rotate( nFix16Angle / 10, rShadeColors[ 0 ].aColor ); | 1264 if ( nRed < 0 ) 1265 nRed = 0; 1266 if ( nRed > 255 ) 1267 nRed = 255; 1268 if ( nGreen < 0 ) 1269 nGreen = 0; 1270 if ( nGreen > 255 ) 1271 nGreen = 255; --- 27 unchanged lines hidden (view full) --- 1299 aSecPropSet.ReadPropSet( rIn, NULL ); 1300 sal_Int32 nSecFillProperties = aSecPropSet.GetPropertyValue( DFF_Prop_fNoFillHitTest, 0x200020 ); 1301 bRotateWithShape = ( nSecFillProperties & 0x0020 ); 1302 } 1303 rIn.Seek( nPos ); 1304 if ( bRotateWithShape ) 1305 { 1306 aBitmap.Rotate( nFix16Angle / 10, rShadeColors[ 0 ].aColor ); |
1307 | 1307 |
1308 sal_uLong nMirrorFlags = BMP_MIRROR_NONE; 1309 if ( rObjData.nSpFlags & SP_FFLIPV ) 1310 nMirrorFlags |= BMP_MIRROR_VERT; 1311 if ( rObjData.nSpFlags & SP_FFLIPH ) 1312 nMirrorFlags |= BMP_MIRROR_HORZ; 1313 if ( nMirrorFlags != BMP_MIRROR_NONE ) 1314 aBitmap.Mirror( nMirrorFlags ); 1315 } --- 52 unchanged lines hidden (view full) --- 1368 default: break; 1369 } 1370 rSet.Put( XFillStyleItem( eXFill ) ); 1371 1372 double dTrans = 1.0; 1373 double dBackTrans = 1.0; 1374 if (IsProperty(DFF_Prop_fillOpacity)) 1375 { | 1308 sal_uLong nMirrorFlags = BMP_MIRROR_NONE; 1309 if ( rObjData.nSpFlags & SP_FFLIPV ) 1310 nMirrorFlags |= BMP_MIRROR_VERT; 1311 if ( rObjData.nSpFlags & SP_FFLIPH ) 1312 nMirrorFlags |= BMP_MIRROR_HORZ; 1313 if ( nMirrorFlags != BMP_MIRROR_NONE ) 1314 aBitmap.Mirror( nMirrorFlags ); 1315 } --- 52 unchanged lines hidden (view full) --- 1368 default: break; 1369 } 1370 rSet.Put( XFillStyleItem( eXFill ) ); 1371 1372 double dTrans = 1.0; 1373 double dBackTrans = 1.0; 1374 if (IsProperty(DFF_Prop_fillOpacity)) 1375 { |
1376 dTrans = GetPropertyValue(DFF_Prop_fillOpacity) / 65536.0; | 1376 dTrans = GetPropertyValue(DFF_Prop_fillOpacity) / 65536.0; |
1377 if ( eXFill != XFILL_GRADIENT ) 1378 { 1379 dTrans = dTrans * 100; 1380 rSet.Put(XFillTransparenceItem( 1381 sal_uInt16(100 - ::rtl::math::round(dTrans)))); 1382 } 1383 } 1384 --- 18 unchanged lines hidden (view full) --- 1403 // then try directly from stream (i.e. Excel chart hatches/bitmaps) 1404 if ( !bOK ) 1405 bOK = SeekToContent( DFF_Prop_fillBlip, rIn ) && rManager.GetBLIPDirect( rIn, aGraf, NULL ); 1406 if ( bOK ) 1407 { 1408 if ( eMSO_FillType == mso_fillPattern ) 1409 { 1410 Color aCol1( COL_WHITE ), aCol2( COL_WHITE ); | 1377 if ( eXFill != XFILL_GRADIENT ) 1378 { 1379 dTrans = dTrans * 100; 1380 rSet.Put(XFillTransparenceItem( 1381 sal_uInt16(100 - ::rtl::math::round(dTrans)))); 1382 } 1383 } 1384 --- 18 unchanged lines hidden (view full) --- 1403 // then try directly from stream (i.e. Excel chart hatches/bitmaps) 1404 if ( !bOK ) 1405 bOK = SeekToContent( DFF_Prop_fillBlip, rIn ) && rManager.GetBLIPDirect( rIn, aGraf, NULL ); 1406 if ( bOK ) 1407 { 1408 if ( eMSO_FillType == mso_fillPattern ) 1409 { 1410 Color aCol1( COL_WHITE ), aCol2( COL_WHITE ); |
1411 | 1411 |
1412 if ( IsProperty( DFF_Prop_fillColor ) ) 1413 aCol1 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor ); | 1412 if ( IsProperty( DFF_Prop_fillColor ) ) 1413 aCol1 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor ); |
1414 | 1414 |
1415 if ( IsProperty( DFF_Prop_fillBackColor ) ) 1416 aCol2 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor ), DFF_Prop_fillBackColor ); 1417 1418 rSet.Put(XFillBitmapItem(String(), aGraf)); 1419 } 1420 else if ( eMSO_FillType == mso_fillTexture ) 1421 { 1422 rSet.Put(XFillBmpTileItem(true)); --- 907 unchanged lines hidden (view full) --- 2330 case 0x5: 2331 case 0x6: 2332 { 2333 switch ( ( nTmp >> 8 ) & 0x1f )//5 bits next to command type is for path escape type 2334 { 2335 case 0x0: 2336 { 2337 //It is msopathEscapeExtension which is transformed into LINETO. | 1415 if ( IsProperty( DFF_Prop_fillBackColor ) ) 1416 aCol2 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor ), DFF_Prop_fillBackColor ); 1417 1418 rSet.Put(XFillBitmapItem(String(), aGraf)); 1419 } 1420 else if ( eMSO_FillType == mso_fillTexture ) 1421 { 1422 rSet.Put(XFillBmpTileItem(true)); --- 907 unchanged lines hidden (view full) --- 2330 case 0x5: 2331 case 0x6: 2332 { 2333 switch ( ( nTmp >> 8 ) & 0x1f )//5 bits next to command type is for path escape type 2334 { 2335 case 0x0: 2336 { 2337 //It is msopathEscapeExtension which is transformed into LINETO. |
2338 //If issue happens, I think this part can be comment so that it will be taken as unknow command. | 2338 //If issue happens, I think this part can be comment so that it will be taken as unknown command. |
2339 //When export, origin data will be export without any change. 2340 nCommand = EnhancedCustomShapeSegmentCommand::LINETO; 2341 if ( !nCnt ) 2342 nCnt = 1; 2343 } 2344 break; 2345 case 0x1: 2346 { --- 361 unchanged lines hidden (view full) --- 2708 } 2709 } 2710 if ( bHasShadow ) 2711 { 2712 static bool bCheckShadow(false); 2713 2714 // #124477# Found no reason not to set shadow, esp. since it is applied to evtl. existing text 2715 // and will lead to an error of in PPT someone used text and added the object shadow to the | 2339 //When export, origin data will be export without any change. 2340 nCommand = EnhancedCustomShapeSegmentCommand::LINETO; 2341 if ( !nCnt ) 2342 nCnt = 1; 2343 } 2344 break; 2345 case 0x1: 2346 { --- 361 unchanged lines hidden (view full) --- 2708 } 2709 } 2710 if ( bHasShadow ) 2711 { 2712 static bool bCheckShadow(false); 2713 2714 // #124477# Found no reason not to set shadow, esp. since it is applied to evtl. existing text 2715 // and will lead to an error of in PPT someone used text and added the object shadow to the |
2716 // object carryintg that text. I found no cases where this leads to problems (the old bugtracker | 2716 // object carrying that text. I found no cases where this leads to problems (the old bugtracker |
2717 // task #160376# from sj is unfortunately no longer available). Keeping the code for now 2718 // to allow easy fallback when this shows problems in the future 2719 if(bCheckShadow) 2720 { 2721 // #160376# sj: activating shadow only if fill and or linestyle is used 2722 // this is required because of the latest drawing layer core changes. 2723 // Issue i104085 is related to this. 2724 sal_uInt32 nLineFlags(GetPropertyValue( DFF_Prop_fNoLineDrawDash )); --- 14 unchanged lines hidden (view full) --- 2739 case mso_fillShade : 2740 case mso_fillShadeCenter : 2741 case mso_fillShadeShape : 2742 case mso_fillShadeScale : 2743 case mso_fillShadeTitle : 2744 break; 2745 // case mso_fillBackground : 2746 default: | 2717 // task #160376# from sj is unfortunately no longer available). Keeping the code for now 2718 // to allow easy fallback when this shows problems in the future 2719 if(bCheckShadow) 2720 { 2721 // #160376# sj: activating shadow only if fill and or linestyle is used 2722 // this is required because of the latest drawing layer core changes. 2723 // Issue i104085 is related to this. 2724 sal_uInt32 nLineFlags(GetPropertyValue( DFF_Prop_fNoLineDrawDash )); --- 14 unchanged lines hidden (view full) --- 2739 case mso_fillShade : 2740 case mso_fillShadeCenter : 2741 case mso_fillShadeShape : 2742 case mso_fillShadeScale : 2743 case mso_fillShadeTitle : 2744 break; 2745 // case mso_fillBackground : 2746 default: |
2747 nFillFlags &=~0x10; // no fillstyle used | 2747 nFillFlags &=~0x10; // no fillstyle used |
2748 break; 2749 } 2750 } 2751 if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) == 0 ) && ( rObjData.eShapeType != mso_sptPictureFrame )) // if there is no fillstyle and linestyle 2752 bHasShadow = sal_False; // we are turning shadow off. 2753 } 2754 2755 if ( bHasShadow ) --- 135 unchanged lines hidden (view full) --- 2891 //nAngle is a clockwise angle. If nRotateAngle is a clockwise angle, then gradient need be rotated a little less 2892 //Or it need be rotated a little more 2893 nAngle -= nRotateAngle; 2894 } 2895 while ( nAngle >= 3600 ) nAngle -= 3600; 2896 while ( nAngle < 0 ) nAngle += 3600; 2897 2898 XGradientStyle eGrad = XGRAD_LINEAR; | 2748 break; 2749 } 2750 } 2751 if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) == 0 ) && ( rObjData.eShapeType != mso_sptPictureFrame )) // if there is no fillstyle and linestyle 2752 bHasShadow = sal_False; // we are turning shadow off. 2753 } 2754 2755 if ( bHasShadow ) --- 135 unchanged lines hidden (view full) --- 2891 //nAngle is a clockwise angle. If nRotateAngle is a clockwise angle, then gradient need be rotated a little less 2892 //Or it need be rotated a little more 2893 nAngle -= nRotateAngle; 2894 } 2895 while ( nAngle >= 3600 ) nAngle -= 3600; 2896 while ( nAngle < 0 ) nAngle += 3600; 2897 2898 XGradientStyle eGrad = XGRAD_LINEAR; |
2899 2900 sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 ); | 2899 2900 sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 ); |
2901 if ( !nFocus ) 2902 nChgColors ^= 1; 2903 else if ( nFocus < 0 )//If it is a negative focus, the color will be swapped 2904 { 2905 nFocus = -nFocus; 2906 nChgColors ^= 1; 2907 } | 2901 if ( !nFocus ) 2902 nChgColors ^= 1; 2903 else if ( nFocus < 0 )//If it is a negative focus, the color will be swapped 2904 { 2905 nFocus = -nFocus; 2906 nChgColors ^= 1; 2907 } |
2908 | 2908 |
2909 if( nFocus > 40 && nFocus < 60 ) 2910 { 2911 eGrad = XGRAD_AXIAL;//A axial gradient other than linear 2912 nChgColors ^= 1; 2913 } 2914 //if the type is linear or axial, just save focus to nFocusX and nFocusY for export 2915 //Core function does no need them. They serves for rect gradient(CenterXY). 2916 sal_uInt16 nFocusX = (sal_uInt16)nFocus; 2917 sal_uInt16 nFocusY = (sal_uInt16)nFocus; | 2909 if( nFocus > 40 && nFocus < 60 ) 2910 { 2911 eGrad = XGRAD_AXIAL;//A axial gradient other than linear 2912 nChgColors ^= 1; 2913 } 2914 //if the type is linear or axial, just save focus to nFocusX and nFocusY for export 2915 //Core function does no need them. They serves for rect gradient(CenterXY). 2916 sal_uInt16 nFocusX = (sal_uInt16)nFocus; 2917 sal_uInt16 nFocusY = (sal_uInt16)nFocus; |
2918 | 2918 |
2919 switch( eMSO_FillType ) 2920 { 2921 case mso_fillShadeShape : 2922 { 2923 eGrad = XGRAD_RECT; 2924 nFocusY = nFocusX = 50; 2925 nChgColors ^= 1; 2926 } 2927 break; 2928 case mso_fillShadeCenter : 2929 { 2930 eGrad = XGRAD_RECT; | 2919 switch( eMSO_FillType ) 2920 { 2921 case mso_fillShadeShape : 2922 { 2923 eGrad = XGRAD_RECT; 2924 nFocusY = nFocusX = 50; 2925 nChgColors ^= 1; 2926 } 2927 break; 2928 case mso_fillShadeCenter : 2929 { 2930 eGrad = XGRAD_RECT; |
2931 //A MS fillTo prop specifies the relative position of the left boundary | 2931 //A MS fillTo prop specifies the relative position of the left boundary |
2932 //of the center rectangle in a concentric shaded fill. Use 100 or 0 to keep fidelity 2933 nFocusX=(GetPropertyValue( DFF_Prop_fillToRight, 0 )==0x10000) ? 100 : 0; | 2932 //of the center rectangle in a concentric shaded fill. Use 100 or 0 to keep fidelity 2933 nFocusX=(GetPropertyValue( DFF_Prop_fillToRight, 0 )==0x10000) ? 100 : 0; |
2934 nFocusY=(GetPropertyValue( DFF_Prop_fillToBottom,0 )==0x10000) ? 100 : 0; | 2934 nFocusY=(GetPropertyValue( DFF_Prop_fillToBottom,0 )==0x10000) ? 100 : 0; |
2935 nChgColors ^= 1; 2936 } 2937 break; 2938 default: break; 2939 } 2940 2941 Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) ); | 2935 nChgColors ^= 1; 2936 } 2937 break; 2938 default: break; 2939 } 2940 2941 Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) ); |
2942 Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) ); | 2942 Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) ); |
2943 if ( nChgColors ) 2944 { 2945 //Swap start and end color 2946 Color aZwi( aCol1 ); 2947 aCol1 = aCol2; 2948 aCol2 = aZwi; 2949 //Swap two colors' transparency 2950 double dTemp = dTrans; 2951 dTrans = dBackTrans; 2952 dBackTrans = dTemp; 2953 } | 2943 if ( nChgColors ) 2944 { 2945 //Swap start and end color 2946 Color aZwi( aCol1 ); 2947 aCol1 = aCol2; 2948 aCol2 = aZwi; 2949 //Swap two colors' transparency 2950 double dTemp = dTrans; 2951 dTrans = dBackTrans; 2952 dBackTrans = dTemp; 2953 } |
2954 | 2954 |
2955 //Construct gradient item 2956 XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY ); 2957 //Intensity has been merged into color. So here just set is as 100 2958 aGrad.SetStartIntens( 100 ); 2959 aGrad.SetEndIntens( 100 ); 2960 aSet.Put( XFillGradientItem( String(), aGrad ) ); | 2955 //Construct gradient item 2956 XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY ); 2957 //Intensity has been merged into color. So here just set is as 100 2958 aGrad.SetStartIntens( 100 ); 2959 aGrad.SetEndIntens( 100 ); 2960 aSet.Put( XFillGradientItem( String(), aGrad ) ); |
2961 //Construct tranparency item. This item can coodinate with both solid and gradient. | 2961 //Construct transparency item. This item can coordinate with both solid and gradient. |
2962 if ( dTrans < 1.0 || dBackTrans < 1.0 ) 2963 { 2964 sal_uInt8 nStartCol = (sal_uInt8)( (1 - dTrans )* 255 ); 2965 sal_uInt8 nEndCol = (sal_uInt8)( ( 1- dBackTrans ) * 255 ); 2966 aCol1 = Color(nStartCol, nStartCol, nStartCol); 2967 aCol2 = Color(nEndCol, nEndCol, nEndCol); | 2962 if ( dTrans < 1.0 || dBackTrans < 1.0 ) 2963 { 2964 sal_uInt8 nStartCol = (sal_uInt8)( (1 - dTrans )* 255 ); 2965 sal_uInt8 nEndCol = (sal_uInt8)( ( 1- dBackTrans ) * 255 ); 2966 aCol1 = Color(nStartCol, nStartCol, nStartCol); 2967 aCol2 = Color(nEndCol, nEndCol, nEndCol); |
2968 | 2968 |
2969 XGradient aGrad2( aCol2 , aCol1 , eGrad, nAngle, nFocusX, nFocusY ); 2970 aSet.Put( XFillFloatTransparenceItem( String(), aGrad2 ) ); 2971 } 2972} 2973 2974//--------------------------------------------------------------------------- 2975//- Record Manager ---------------------------------------------------------- 2976//--------------------------------------------------------------------------- --- 43 unchanged lines hidden (view full) --- 3020 if ( aHd.nRecVer == DFF_PSFLAG_CONTAINER ) 3021 nStOfs = aHd.GetRecEndFilePos(); 3022 } 3023 if ( nStOfs ) 3024 { 3025 pCList = (DffRecordList*)this; 3026 while ( pCList->pNext ) 3027 pCList = pCList->pNext; | 2969 XGradient aGrad2( aCol2 , aCol1 , eGrad, nAngle, nFocusX, nFocusY ); 2970 aSet.Put( XFillFloatTransparenceItem( String(), aGrad2 ) ); 2971 } 2972} 2973 2974//--------------------------------------------------------------------------- 2975//- Record Manager ---------------------------------------------------------- 2976//--------------------------------------------------------------------------- --- 43 unchanged lines hidden (view full) --- 3020 if ( aHd.nRecVer == DFF_PSFLAG_CONTAINER ) 3021 nStOfs = aHd.GetRecEndFilePos(); 3022 } 3023 if ( nStOfs ) 3024 { 3025 pCList = (DffRecordList*)this; 3026 while ( pCList->pNext ) 3027 pCList = pCList->pNext; |
3028 sal_Size nLastPosition; |
|
3028 while ( ( rIn.GetError() == 0 ) && ( ( rIn.Tell() + 8 ) <= nStOfs ) ) 3029 { | 3029 while ( ( rIn.GetError() == 0 ) && ( ( rIn.Tell() + 8 ) <= nStOfs ) ) 3030 { |
3031 nLastPosition = rIn.Tell(); |
|
3030 if ( pCList->nCount == DFF_RECORD_MANAGER_BUF_SIZE ) 3031 pCList = new DffRecordList( pCList ); 3032 rIn >> pCList->mHd[ pCList->nCount ]; 3033 pCList->mHd[ pCList->nCount++ ].SeekToEndOfRecord( rIn ); | 3032 if ( pCList->nCount == DFF_RECORD_MANAGER_BUF_SIZE ) 3033 pCList = new DffRecordList( pCList ); 3034 rIn >> pCList->mHd[ pCList->nCount ]; 3035 pCList->mHd[ pCList->nCount++ ].SeekToEndOfRecord( rIn ); |
3036 if (rIn.Tell() == nLastPosition) { 3037 // We are inside an endless loop 3038 break; 3039 } |
|
3034 } 3035 rIn.Seek( nOldPos ); 3036 } 3037} 3038 3039void DffRecordManager::Clear() 3040{ 3041 pCList = (DffRecordList*)this; --- 307 unchanged lines hidden (view full) --- 3349 FASTBOOL bRet = sal_False; 3350 sal_uLong nFPosMerk = rSt.Tell(); // store FilePos to restore it later if necessary 3351 DffRecordHeader aHd; 3352 do 3353 { 3354 rSt >> aHd; 3355 3356 // check potential error reading and if seeking to the end of record is possible at all. | 3040 } 3041 rIn.Seek( nOldPos ); 3042 } 3043} 3044 3045void DffRecordManager::Clear() 3046{ 3047 pCList = (DffRecordList*)this; --- 307 unchanged lines hidden (view full) --- 3355 FASTBOOL bRet = sal_False; 3356 sal_uLong nFPosMerk = rSt.Tell(); // store FilePos to restore it later if necessary 3357 DffRecordHeader aHd; 3358 do 3359 { 3360 rSt >> aHd; 3361 3362 // check potential error reading and if seeking to the end of record is possible at all. |
3357 // It is probably cheaper instead of doing the file seek operation | 3363 // It is probably cheaper instead of doing the file seek operation |
3358 if ( rSt.GetError() || ( aHd.GetRecEndFilePos() > nMaxFilePos ) ) 3359 { 3360 bRet= sal_False; 3361 break; 3362 } | 3364 if ( rSt.GetError() || ( aHd.GetRecEndFilePos() > nMaxFilePos ) ) 3365 { 3366 bRet= sal_False; 3367 break; 3368 } |
3363 | 3369 |
3364 if ( aHd.nRecType == nRecId ) 3365 { 3366 if ( nSkipCount ) 3367 nSkipCount--; 3368 else 3369 { 3370 bRet = sal_True; 3371 if ( pRecHd != NULL ) --- 47 unchanged lines hidden (view full) --- 3419 // diese Methode ist in der zum Excel-Import 3420 // abgeleiteten Klasse zu ueberschreiben... 3421 rColor.SetColor( COL_WHITE ); 3422 return sal_True; 3423} 3424 3425// sj: the documentation is not complete, especially in ppt the normal rgb for text 3426// color is written as 0xfeRRGGBB, this can't be explained by the documentation, nearly | 3370 if ( aHd.nRecType == nRecId ) 3371 { 3372 if ( nSkipCount ) 3373 nSkipCount--; 3374 else 3375 { 3376 bRet = sal_True; 3377 if ( pRecHd != NULL ) --- 47 unchanged lines hidden (view full) --- 3425 // diese Methode ist in der zum Excel-Import 3426 // abgeleiteten Klasse zu ueberschreiben... 3427 rColor.SetColor( COL_WHITE ); 3428 return sal_True; 3429} 3430 3431// sj: the documentation is not complete, especially in ppt the normal rgb for text 3432// color is written as 0xfeRRGGBB, this can't be explained by the documentation, nearly |
3427// every bit in the upper code is set -> so there seems to be a special handling for | 3433// every bit in the upper code is set -> so there seems to be a special handling for |
3428// ppt text colors, i decided not to fix this in MSO_CLR_ToColor because of possible | 3434// ppt text colors, i decided not to fix this in MSO_CLR_ToColor because of possible |
3429// side effects, instead MSO_TEXT_CLR_ToColor is called for PPT text colors, to map 3430// the color code to something that behaves like the other standard color codes used by | 3435// side effects, instead MSO_TEXT_CLR_ToColor is called for PPT text colors, to map 3436// the color code to something that behaves like the other standard color codes used by |
3431// fill and line color 3432Color SvxMSDffManager::MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const 3433{ 3434 // Fuer Textfarben: Header ist 0xfeRRGGBB 3435 if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) 3436 nColorCode &= 0x00ffffff; 3437 else 3438 { --- 7 unchanged lines hidden (view full) --- 3446 return MSO_CLR_ToColor( nColorCode ); 3447} 3448 3449Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContentProperty ) const 3450{ 3451 Color aColor( mnDefaultColor ); 3452 3453 // Fuer Textfarben: Header ist 0xfeRRGGBB | 3437// fill and line color 3438Color SvxMSDffManager::MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const 3439{ 3440 // Fuer Textfarben: Header ist 0xfeRRGGBB 3441 if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) 3442 nColorCode &= 0x00ffffff; 3443 else 3444 { --- 7 unchanged lines hidden (view full) --- 3452 return MSO_CLR_ToColor( nColorCode ); 3453} 3454 3455Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContentProperty ) const 3456{ 3457 Color aColor( mnDefaultColor ); 3458 3459 // Fuer Textfarben: Header ist 0xfeRRGGBB |
3454 if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) // sj: it needs to be checked if 0xfe is used in | 3460 if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) // sj: it needs to be checked if 0xfe is used in |
3455 nColorCode &= 0x00ffffff; // other cases than ppt text -> if not this code can be removed 3456 3457 sal_uInt8 nUpper = (sal_uInt8)( nColorCode >> 24 ); | 3461 nColorCode &= 0x00ffffff; // other cases than ppt text -> if not this code can be removed 3462 3463 sal_uInt8 nUpper = (sal_uInt8)( nColorCode >> 24 ); |
3458 | 3464 |
3459 // sj: below change from 0x1b to 0x19 was done because of i84812 (0x02 -> rgb color), 3460 // now I have some problems to fix i104685 (there the color value is 0x02000000 whichs requires 3461 // a 0x2 scheme color to be displayed properly), the color docu seems to be incomplete 3462 if( nUpper & 0x19 ) // if( nUpper & 0x1f ) 3463 { 3464 if( ( nUpper & 0x08 ) || ( ( nUpper & 0x10 ) == 0 ) ) 3465 { 3466 // SCHEMECOLOR --- 192 unchanged lines hidden (view full) --- 3659 if ( nAdditionalFlags & 0x40 ) // top-bit invert 3660 aColor = Color( aColor.GetRed() ^ 0x80, aColor.GetGreen() ^ 0x80, aColor.GetBlue() ^ 0x80 ); 3661 3662 if ( nAdditionalFlags & 0x20 ) // invert color 3663 aColor = Color(0xff - aColor.GetRed(), 0xff - aColor.GetGreen(), 0xff - aColor.GetBlue()); 3664 } 3665 } 3666 else if ( ( nUpper & 4 ) && ( ( nColorCode & 0xfffff8 ) == 0 ) ) | 3465 // sj: below change from 0x1b to 0x19 was done because of i84812 (0x02 -> rgb color), 3466 // now I have some problems to fix i104685 (there the color value is 0x02000000 whichs requires 3467 // a 0x2 scheme color to be displayed properly), the color docu seems to be incomplete 3468 if( nUpper & 0x19 ) // if( nUpper & 0x1f ) 3469 { 3470 if( ( nUpper & 0x08 ) || ( ( nUpper & 0x10 ) == 0 ) ) 3471 { 3472 // SCHEMECOLOR --- 192 unchanged lines hidden (view full) --- 3665 if ( nAdditionalFlags & 0x40 ) // top-bit invert 3666 aColor = Color( aColor.GetRed() ^ 0x80, aColor.GetGreen() ^ 0x80, aColor.GetBlue() ^ 0x80 ); 3667 3668 if ( nAdditionalFlags & 0x20 ) // invert color 3669 aColor = Color(0xff - aColor.GetRed(), 0xff - aColor.GetGreen(), 0xff - aColor.GetBlue()); 3670 } 3671 } 3672 else if ( ( nUpper & 4 ) && ( ( nColorCode & 0xfffff8 ) == 0 ) ) |
3667 { // case of nUpper == 4 powerpoint takes this as agrument for a colorschemecolor | 3673 { // case of nUpper == 4 powerpoint takes this as argument for a colorschemecolor |
3668 GetColorFromPalette( nUpper, aColor ); 3669 } 3670 else // hart attributiert, eventuell mit Hinweis auf SYSTEMRGB 3671 aColor = Color( (sal_uInt8)nColorCode, (sal_uInt8)( nColorCode >> 8 ), (sal_uInt8)( nColorCode >> 16 ) ); 3672 return aColor; 3673} 3674 3675// sj: I just want to set a string for a text object that may contain multiple --- 282 unchanged lines hidden (view full) --- 3958 if (0 == rSt.GetError()) 3959 bGrfRead = GetBLIPDirect( rSt, aGraf, &aVisArea ); 3960 } 3961 } 3962 } 3963 } 3964 if ( bGrfRead ) 3965 { | 3674 GetColorFromPalette( nUpper, aColor ); 3675 } 3676 else // hart attributiert, eventuell mit Hinweis auf SYSTEMRGB 3677 aColor = Color( (sal_uInt8)nColorCode, (sal_uInt8)( nColorCode >> 8 ), (sal_uInt8)( nColorCode >> 16 ) ); 3678 return aColor; 3679} 3680 3681// sj: I just want to set a string for a text object that may contain multiple --- 282 unchanged lines hidden (view full) --- 3964 if (0 == rSt.GetError()) 3965 bGrfRead = GetBLIPDirect( rSt, aGraf, &aVisArea ); 3966 } 3967 } 3968 } 3969 } 3970 if ( bGrfRead ) 3971 { |
3966 // the writer is doing it's own cropping, so this part affects only impress and calc | 3972 // the writer is doing its own cropping, so this part affects only Impress and Calc |
3967 if ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_CROP_BITMAPS ) 3968 lcl_ApplyCropping( *this, ( rObjData.nSpFlags & SP_FOLESHAPE ) == 0 ? &rSet : NULL, aGraf ); 3969 3970 if ( IsProperty( DFF_Prop_pictureTransparent ) ) 3971 { 3972 sal_uInt32 nTransColor = GetPropertyValue( DFF_Prop_pictureTransparent, 0 ); 3973 3974 if ( aGraf.GetType() == GRAPHIC_BITMAP ) --- 326 unchanged lines hidden (view full) --- 4301 sal_uInt32 nBytesLeft = maShapeRecords.Current()->nRecLen; 4302 sal_uInt32 nUDData; 4303 sal_uInt16 nPID; 4304 while( 5 < nBytesLeft ) 4305 { 4306 rSt >> nPID; 4307 if ( rSt.GetError() != 0 ) 4308 break; | 3973 if ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_CROP_BITMAPS ) 3974 lcl_ApplyCropping( *this, ( rObjData.nSpFlags & SP_FOLESHAPE ) == 0 ? &rSet : NULL, aGraf ); 3975 3976 if ( IsProperty( DFF_Prop_pictureTransparent ) ) 3977 { 3978 sal_uInt32 nTransColor = GetPropertyValue( DFF_Prop_pictureTransparent, 0 ); 3979 3980 if ( aGraf.GetType() == GRAPHIC_BITMAP ) --- 326 unchanged lines hidden (view full) --- 4307 sal_uInt32 nBytesLeft = maShapeRecords.Current()->nRecLen; 4308 sal_uInt32 nUDData; 4309 sal_uInt16 nPID; 4310 while( 5 < nBytesLeft ) 4311 { 4312 rSt >> nPID; 4313 if ( rSt.GetError() != 0 ) 4314 break; |
4309 rSt >> nUDData; | 4315 rSt >> nUDData; |
4310 if ( rSt.GetError() != 0 ) 4311 break; | 4316 if ( rSt.GetError() != 0 ) 4317 break; |
4312 if ( nPID == 447 ) // | 4318 if ( nPID == 447 ) |
4313 { 4314 mbRotateGranientFillWithAngle = nUDData & 0x20; 4315 break; 4316 } 4317 nBytesLeft -= 6; 4318 } 4319 } 4320 aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING ); --- 20 unchanged lines hidden (view full) --- 4341 if ( mbTracing ) 4342 mpTracer->AddAttribute( aObjData.nSpFlags & SP_FGROUP 4343 ? rtl::OUString::createFromAscii( "GroupShape" ) 4344 : rtl::OUString::createFromAscii( "Shape" ), 4345 rtl::OUString::valueOf( (sal_Int32)aObjData.nShapeId ) ); 4346 aObjData.bOpt = maShapeRecords.SeekToContent( rSt, DFF_msofbtOPT, SEEK_FROM_CURRENT_AND_RESTART ); 4347 if ( aObjData.bOpt ) 4348 { | 4319 { 4320 mbRotateGranientFillWithAngle = nUDData & 0x20; 4321 break; 4322 } 4323 nBytesLeft -= 6; 4324 } 4325 } 4326 aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING ); --- 20 unchanged lines hidden (view full) --- 4347 if ( mbTracing ) 4348 mpTracer->AddAttribute( aObjData.nSpFlags & SP_FGROUP 4349 ? rtl::OUString::createFromAscii( "GroupShape" ) 4350 : rtl::OUString::createFromAscii( "Shape" ), 4351 rtl::OUString::valueOf( (sal_Int32)aObjData.nShapeId ) ); 4352 aObjData.bOpt = maShapeRecords.SeekToContent( rSt, DFF_msofbtOPT, SEEK_FROM_CURRENT_AND_RESTART ); 4353 if ( aObjData.bOpt ) 4354 { |
4349 maShapeRecords.Current()->SeekToBegOfRecord( rSt ); | 4355 maShapeRecords.Current()->SeekToBegOfRecord( rSt ); |
4350#ifdef DBG_AUTOSHAPE 4351 ReadPropSet( rSt, pClientData, (sal_uInt32)aObjData.eShapeType ); 4352#else 4353 ReadPropSet( rSt, pClientData ); 4354#endif 4355 } 4356 else 4357 { --- 6 unchanged lines hidden (view full) --- 4364 maShapeRecords.Current()->SeekToBegOfRecord( rSt ); 4365 pSecPropSet = new DffPropertyReader( *this ); 4366 pSecPropSet->ReadPropSet( rSt, NULL ); 4367 } 4368 4369 aObjData.bChildAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtChildAnchor, SEEK_FROM_CURRENT_AND_RESTART ); 4370 if ( aObjData.bChildAnchor ) 4371 { | 4356#ifdef DBG_AUTOSHAPE 4357 ReadPropSet( rSt, pClientData, (sal_uInt32)aObjData.eShapeType ); 4358#else 4359 ReadPropSet( rSt, pClientData ); 4360#endif 4361 } 4362 else 4363 { --- 6 unchanged lines hidden (view full) --- 4370 maShapeRecords.Current()->SeekToBegOfRecord( rSt ); 4371 pSecPropSet = new DffPropertyReader( *this ); 4372 pSecPropSet->ReadPropSet( rSt, NULL ); 4373 } 4374 4375 aObjData.bChildAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtChildAnchor, SEEK_FROM_CURRENT_AND_RESTART ); 4376 if ( aObjData.bChildAnchor ) 4377 { |
4372 sal_Int32 l, o, r, u; 4373 rSt >> l >> o >> r >> u; 4374 Scale( l ); 4375 Scale( o ); 4376 Scale( r ); 4377 Scale( u ); 4378 aObjData.aChildAnchor = Rectangle( l, o, r, u ); | 4378 sal_Int32 l, o, r, u; 4379 rSt >> l >> o >> r >> u; 4380 Scale( l ); 4381 Scale( o ); 4382 Scale( r ); 4383 Scale( u ); 4384 aObjData.aChildAnchor = Rectangle( l, o, r, u ); |
4379 if ( !rGlobalChildRect.IsEmpty() && !rClientRect.IsEmpty() && rGlobalChildRect.GetWidth() && rGlobalChildRect.GetHeight() ) 4380 { 4381 double fl = l; 4382 double fo = o; 4383 double fWidth = r - l; 4384 double fHeight= u - o; 4385 double fXScale = (double)rClientRect.GetWidth() / (double)rGlobalChildRect.GetWidth(); 4386 double fYScale = (double)rClientRect.GetHeight() / (double)rGlobalChildRect.GetHeight(); --- 11 unchanged lines hidden (view full) --- 4398 4399 if ( aObjData.bChildAnchor ) 4400 aObjData.aBoundRect = aObjData.aChildAnchor; 4401 4402 if ( aObjData.nSpFlags & SP_FBACKGROUND ) 4403 aObjData.aBoundRect = Rectangle( Point(), Size( 1, 1 ) ); 4404 4405 Rectangle aTextRect; | 4385 if ( !rGlobalChildRect.IsEmpty() && !rClientRect.IsEmpty() && rGlobalChildRect.GetWidth() && rGlobalChildRect.GetHeight() ) 4386 { 4387 double fl = l; 4388 double fo = o; 4389 double fWidth = r - l; 4390 double fHeight= u - o; 4391 double fXScale = (double)rClientRect.GetWidth() / (double)rGlobalChildRect.GetWidth(); 4392 double fYScale = (double)rClientRect.GetHeight() / (double)rGlobalChildRect.GetHeight(); --- 11 unchanged lines hidden (view full) --- 4404 4405 if ( aObjData.bChildAnchor ) 4406 aObjData.aBoundRect = aObjData.aChildAnchor; 4407 4408 if ( aObjData.nSpFlags & SP_FBACKGROUND ) 4409 aObjData.aBoundRect = Rectangle( Point(), Size( 1, 1 ) ); 4410 4411 Rectangle aTextRect; |
4406 if ( !aObjData.aBoundRect.IsEmpty() ) | 4412 if ( !aObjData.aBoundRect.IsEmpty() ) |
4407 { // Rotation auf BoundingBox anwenden, BEVOR ien Objekt generiert wurde 4408 if( mnFix16Angle ) 4409 { 4410 long nAngle = mnFix16Angle; 4411 if ( ( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 22500 && nAngle <= 31500 ) ) 4412 { 4413 sal_Int32 nHalfWidth = ( aObjData.aBoundRect.GetWidth() + 1 ) >> 1; 4414 sal_Int32 nHalfHeight = ( aObjData.aBoundRect.GetHeight() + 1 ) >> 1; --- 122 unchanged lines hidden (view full) --- 4537 if ( IsProperty( DFF_Prop_gtextSpacing ) ) 4538 { 4539 sal_Int32 nTextWidth = GetPropertyValue( DFF_Prop_gtextSpacing, 100 < 16 ) / 655; 4540 if ( nTextWidth != 100 ) 4541 aSet.Put( SvxCharScaleWidthItem( (sal_uInt16)nTextWidth, EE_CHAR_FONTWIDTH ) ); 4542 } 4543 if ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x1000 ) // SJ: Font Kerning On ? 4544 aSet.Put( SvxKerningItem( 1, EE_CHAR_KERNING ) ); | 4413 { // Rotation auf BoundingBox anwenden, BEVOR ien Objekt generiert wurde 4414 if( mnFix16Angle ) 4415 { 4416 long nAngle = mnFix16Angle; 4417 if ( ( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 22500 && nAngle <= 31500 ) ) 4418 { 4419 sal_Int32 nHalfWidth = ( aObjData.aBoundRect.GetWidth() + 1 ) >> 1; 4420 sal_Int32 nHalfHeight = ( aObjData.aBoundRect.GetHeight() + 1 ) >> 1; --- 122 unchanged lines hidden (view full) --- 4543 if ( IsProperty( DFF_Prop_gtextSpacing ) ) 4544 { 4545 sal_Int32 nTextWidth = GetPropertyValue( DFF_Prop_gtextSpacing, 100 < 16 ) / 655; 4546 if ( nTextWidth != 100 ) 4547 aSet.Put( SvxCharScaleWidthItem( (sal_uInt16)nTextWidth, EE_CHAR_FONTWIDTH ) ); 4548 } 4549 if ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x1000 ) // SJ: Font Kerning On ? 4550 aSet.Put( SvxKerningItem( 1, EE_CHAR_KERNING ) ); |
4545 | 4551 |
4546 // #119496# the resize autoshape to fit text attr of word art in MS PPT is always false 4547 aSet.Put( SdrTextAutoGrowHeightItem( sal_False ) ); 4548 aSet.Put( SdrTextAutoGrowWidthItem( sal_False ) ); 4549 } 4550 pRet->SetMergedItemSet( aSet ); 4551 4552 // sj: taking care of rtl, ltr. In case of fontwork mso. seems not to be able to set 4553 // proper text directions, instead the text default is depending to the string. --- 37 unchanged lines hidden (view full) --- 4591 rOutliner.Clear(); 4592 rOutliner.SetUpdateMode( bOldUpdateMode ); 4593 } 4594 } 4595 4596 // mso_sptArc special treating: 4597 // sj: since we actually can't render the arc because of its weird SnapRect settings, 4598 // we will create a new CustomShape, that can be saved/loaded without problems. | 4552 // #119496# the resize autoshape to fit text attr of word art in MS PPT is always false 4553 aSet.Put( SdrTextAutoGrowHeightItem( sal_False ) ); 4554 aSet.Put( SdrTextAutoGrowWidthItem( sal_False ) ); 4555 } 4556 pRet->SetMergedItemSet( aSet ); 4557 4558 // sj: taking care of rtl, ltr. In case of fontwork mso. seems not to be able to set 4559 // proper text directions, instead the text default is depending to the string. --- 37 unchanged lines hidden (view full) --- 4597 rOutliner.Clear(); 4598 rOutliner.SetUpdateMode( bOldUpdateMode ); 4599 } 4600 } 4601 4602 // mso_sptArc special treating: 4603 // sj: since we actually can't render the arc because of its weird SnapRect settings, 4604 // we will create a new CustomShape, that can be saved/loaded without problems. |
4599 // We will change the shape type, so this code applys only if importing arcs from msoffice. | 4605 // We will change the shape type, so this code applies only if importing arcs from msoffice. |
4600 if ( aObjData.eShapeType == mso_sptArc ) 4601 { 4602 const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) ); 4603 const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) ); 4604 const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM ( "Handles" ) ); 4605 const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) ); 4606 const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) ); 4607 const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) ); --- 19 unchanged lines hidden (view full) --- 4627 seqCoordinates[ nPtNum ].Second.Value >>= nY; 4628 aP.X() = nX; 4629 aP.Y() = nY; 4630 aXP[ (sal_uInt16)nPtNum ] = aP; 4631 } 4632 aPolyBoundRect = Rectangle( aXP.GetBoundRect() ); 4633 if ( nNumElemVert >= 3 ) 4634 { // arc first command is always wr -- clockwise arc | 4606 if ( aObjData.eShapeType == mso_sptArc ) 4607 { 4608 const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) ); 4609 const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) ); 4610 const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM ( "Handles" ) ); 4611 const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) ); 4612 const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) ); 4613 const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) ); --- 19 unchanged lines hidden (view full) --- 4633 seqCoordinates[ nPtNum ].Second.Value >>= nY; 4634 aP.X() = nX; 4635 aP.Y() = nY; 4636 aXP[ (sal_uInt16)nPtNum ] = aP; 4637 } 4638 aPolyBoundRect = Rectangle( aXP.GetBoundRect() ); 4639 if ( nNumElemVert >= 3 ) 4640 { // arc first command is always wr -- clockwise arc |
4635 // the parameters are : (left,top),(right,bottom),start(x,y),end(x,y) | 4641 // the parameters are : (left,top),(right,bottom),start(x,y),end(x,y) |
4636 aStartPt = aXP[2]; 4637 } 4638 } 4639 else 4640 aPolyBoundRect = Rectangle( -21600, 0, 21600, 43200 ); // defaulting 4641 4642 // clearing items, so MergeDefaultAttributes will set the corresponding defaults from EnhancedCustomShapeGeometry 4643 aGeometryItem.ClearPropertyValue( sHandles ); --- 310 unchanged lines hidden (view full) --- 4954 : rtl::OUString::createFromAscii( "Shape" ) ); 4955 //Import alt text as description 4956 if ( pRet && SeekToContent( DFF_Prop_wzDescription, rSt ) ) 4957 { 4958 String aAltText; 4959 MSDFFReadZString( rSt, aAltText, GetPropertyValue( DFF_Prop_wzDescription ), sal_True ); 4960 pRet->SetDescription( aAltText ); 4961 } | 4642 aStartPt = aXP[2]; 4643 } 4644 } 4645 else 4646 aPolyBoundRect = Rectangle( -21600, 0, 21600, 43200 ); // defaulting 4647 4648 // clearing items, so MergeDefaultAttributes will set the corresponding defaults from EnhancedCustomShapeGeometry 4649 aGeometryItem.ClearPropertyValue( sHandles ); --- 310 unchanged lines hidden (view full) --- 4960 : rtl::OUString::createFromAscii( "Shape" ) ); 4961 //Import alt text as description 4962 if ( pRet && SeekToContent( DFF_Prop_wzDescription, rSt ) ) 4963 { 4964 String aAltText; 4965 MSDFFReadZString( rSt, aAltText, GetPropertyValue( DFF_Prop_wzDescription ), sal_True ); 4966 pRet->SetDescription( aAltText ); 4967 } |
4962 | 4968 |
4963 return pRet; 4964} 4965 4966Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, Rectangle& aClientRect ) 4967{ 4968 Rectangle aChildAnchor; 4969 rHd.SeekToContent( rSt ); 4970 sal_Bool bIsClientRectRead = sal_False; --- 26 unchanged lines hidden (view full) --- 4997 sal_Int16 ls, ts, rs, bs; 4998 rSt >> ts >> ls >> rs >> bs; // etwas seltsame Koordinatenreihenfolge ... 4999 l = ls, t = ts, r = rs, b = bs; 5000 } 5001 Scale( l ); 5002 Scale( t ); 5003 Scale( r ); 5004 Scale( b ); | 4969 return pRet; 4970} 4971 4972Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, Rectangle& aClientRect ) 4973{ 4974 Rectangle aChildAnchor; 4975 rHd.SeekToContent( rSt ); 4976 sal_Bool bIsClientRectRead = sal_False; --- 26 unchanged lines hidden (view full) --- 5003 sal_Int16 ls, ts, rs, bs; 5004 rSt >> ts >> ls >> rs >> bs; // etwas seltsame Koordinatenreihenfolge ... 5005 l = ls, t = ts, r = rs, b = bs; 5006 } 5007 Scale( l ); 5008 Scale( t ); 5009 Scale( r ); 5010 Scale( b ); |
5005 if ( bIsClientRectRead ) | 5011 if ( bIsClientRectRead ) |
5006 { 5007 Rectangle aChild( l, t, r, b ); 5008 aChildAnchor.Union( aChild ); 5009 } 5010 else 5011 { 5012 aClientRect = Rectangle( l, t, r, b ); 5013 bIsClientRectRead = sal_True; --- 1046 unchanged lines hidden (view full) --- 6060 // #125476# bool bBLIPIsDirectlyEmbedded(false); 6061 6062 if(bOk) 6063 { 6064 rSt.SeekRel(nSkipBLIPLen); 6065 rSt >> nBLIPLen; 6066 6067 // #125187# do not simply skip these four bytes, but read them. This value | 5012 { 5013 Rectangle aChild( l, t, r, b ); 5014 aChildAnchor.Union( aChild ); 5015 } 5016 else 5017 { 5018 aClientRect = Rectangle( l, t, r, b ); 5019 bIsClientRectRead = sal_True; --- 1046 unchanged lines hidden (view full) --- 6066 // #125476# bool bBLIPIsDirectlyEmbedded(false); 6067 6068 if(bOk) 6069 { 6070 rSt.SeekRel(nSkipBLIPLen); 6071 rSt >> nBLIPLen; 6072 6073 // #125187# do not simply skip these four bytes, but read them. This value |
6068 // is zero when the BLIP is embedded to the FBSE directly following in the | 6074 // is zero when the BLIP is embedded to the FBSE directly following in the |
6069 // stream, else 1. Use this as hint to be more reliable (see below) 6070 rSt >> nBLIPPos; 6071 | 6075 // stream, else 1. Use this as hint to be more reliable (see below) 6076 rSt >> nBLIPPos; 6077 |
6072 // #125476# Taking back this change - see issue. It probably was a wrong assumtion | 6078 // #125476# Taking back this change - see issue. It probably was a wrong assumption |
6073 // if(0 == nBLIPPos) 6074 // { 6075 // bBLIPIsDirectlyEmbedded = true; 6076 // } 6077 6078 rSt >> nBLIPPos; 6079 bOk = rSt.GetError() == 0; 6080 6081 nLength -= nSkipBLIPLen + 4 + nSkipBLIPPos + 4; 6082 } 6083 6084 if( bOk ) 6085 { | 6079 // if(0 == nBLIPPos) 6080 // { 6081 // bBLIPIsDirectlyEmbedded = true; 6082 // } 6083 6084 rSt >> nBLIPPos; 6085 bOk = rSt.GetError() == 0; 6086 6087 nLength -= nSkipBLIPLen + 4 + nSkipBLIPPos + 4; 6088 } 6089 6090 if( bOk ) 6091 { |
6086 // #125187# the original check to test if the BLIP is following embeded in the FBSE was | 6092 // #125187# the original check to test if the BLIP is following embedded in the FBSE was |
6087 // was (!nBLIPPos && nBLIPLen < nLenFBSE), but there are ppt documents 6088 // where this is not sufficient (what means that for BLIPs in the picture 6089 // stream the same conditions can be true sometimes). I experimented with various 6090 // ppt files and detected that the four bytes before reading the nBLIPPos 6091 // contain a flag which describes that embedding more reliable, thus I will 6092 // use it here now in the form of the bBLIPIsDirectlyEmbedded variable (see above). | 6093 // was (!nBLIPPos && nBLIPLen < nLenFBSE), but there are ppt documents 6094 // where this is not sufficient (what means that for BLIPs in the picture 6095 // stream the same conditions can be true sometimes). I experimented with various 6096 // ppt files and detected that the four bytes before reading the nBLIPPos 6097 // contain a flag which describes that embedding more reliable, thus I will 6098 // use it here now in the form of the bBLIPIsDirectlyEmbedded variable (see above). |
6093 // This modification works with all ppt files I found which use directly embedded | 6099 // This modification works with all ppt files I found which use directly embedded |
6094 // BLIPs and with the file which showed the error. More work may be needed when 6095 // exceptions to this more strict schema may show up, though. 6096 // 6097 // #125476# back to original - see task. Keeping the change in the code as hint 6098 // if this comes up again for someone who tries to fix it. This would show that | 6100 // BLIPs and with the file which showed the error. More work may be needed when 6101 // exceptions to this more strict schema may show up, though. 6102 // 6103 // #125476# back to original - see task. Keeping the change in the code as hint 6104 // if this comes up again for someone who tries to fix it. This would show that |
6099 // indeed the information that the blip is embedded needs to be extracted somwhere | 6105 // indeed the information that the blip is embedded needs to be extracted somewhere |
6100 // and would need to be re-evaluated. 6101 if(0 == nBLIPPos && nBLIPLen < nLenFBSE ) // #125476# && bBLIPIsDirectlyEmbedded) 6102 { 6103 // get BLIP file position as directly following embedded 6104 nBLIPPos = rSt.Tell() + 4; 6105 } 6106 6107 // Das hat ja fein geklappt! --- 1557 unchanged lines hidden (view full) --- 7665 if (rCopy.pWrapPolygon) 7666 pWrapPolygon = new Polygon(*rCopy.pWrapPolygon); 7667 else 7668 pWrapPolygon = 0; 7669} 7670 7671SvxMSDffImportRec::~SvxMSDffImportRec() 7672{ | 6106 // and would need to be re-evaluated. 6107 if(0 == nBLIPPos && nBLIPLen < nLenFBSE ) // #125476# && bBLIPIsDirectlyEmbedded) 6108 { 6109 // get BLIP file position as directly following embedded 6110 nBLIPPos = rSt.Tell() + 4; 6111 } 6112 6113 // Das hat ja fein geklappt! --- 1557 unchanged lines hidden (view full) --- 7671 if (rCopy.pWrapPolygon) 7672 pWrapPolygon = new Polygon(*rCopy.pWrapPolygon); 7673 else 7674 pWrapPolygon = 0; 7675} 7676 7677SvxMSDffImportRec::~SvxMSDffImportRec() 7678{ |
7673 if (pClientAnchorBuffer) 7674 delete[] pClientAnchorBuffer; 7675 if (pClientDataBuffer) 7676 delete[] pClientDataBuffer; 7677 if (pWrapPolygon) 7678 delete pWrapPolygon; | 7679 if (pClientAnchorBuffer) 7680 delete[] pClientAnchorBuffer; 7681 if (pClientDataBuffer) 7682 delete[] pClientDataBuffer; 7683 if (pWrapPolygon) 7684 delete pWrapPolygon; |
7679} 7680 7681/* vi:set tabstop=4 shiftwidth=4 expandtab: */ 7682 7683void SvxMSDffManager::insertShapeId( sal_Int32 nShapeId, SdrObject* pShape ) 7684{ 7685 maShapeIdContainer[nShapeId] = pShape; 7686} --- 13 unchanged lines hidden (view full) --- 7700 } 7701} 7702 7703SdrObject* SvxMSDffManager::getShapeForId( sal_Int32 nShapeId ) 7704{ 7705 SvxMSDffShapeIdContainer::iterator aIter( maShapeIdContainer.find(nShapeId) ); 7706 return aIter != maShapeIdContainer.end() ? (*aIter).second : 0; 7707} | 7685} 7686 7687/* vi:set tabstop=4 shiftwidth=4 expandtab: */ 7688 7689void SvxMSDffManager::insertShapeId( sal_Int32 nShapeId, SdrObject* pShape ) 7690{ 7691 maShapeIdContainer[nShapeId] = pShape; 7692} --- 13 unchanged lines hidden (view full) --- 7706 } 7707} 7708 7709SdrObject* SvxMSDffManager::getShapeForId( sal_Int32 nShapeId ) 7710{ 7711 SvxMSDffShapeIdContainer::iterator aIter( maShapeIdContainer.find(nShapeId) ); 7712 return aIter != maShapeIdContainer.end() ? (*aIter).second : 0; 7713} |
7714 7715/* vim: set noet sw=4 ts=4: */ |
|