Kaydet (Commit) 5fe1a59c authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Scope reduction in GetBLIP() & remove non-ASCII character (degree symbol).

Change-Id: I306a22b087aceed5dbb6cb2e8b67e2501589ee61
üst d87cf30f
...@@ -4288,8 +4288,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ...@@ -4288,8 +4288,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( IsHardAttribute( DFF_Prop_gtextFBold ) ) if ( IsHardAttribute( DFF_Prop_gtextFBold ) )
aSet.Put( SvxWeightItem( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x0020 ) != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) ); aSet.Put( SvxWeightItem( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x0020 ) != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
// SJ TODO: Vertical Writing is not correct, instead this should be // SJ TODO: Vertical Writing is not correct, instead
// replaced through "CharacterRotation" by 90°, therefore a new Item has to be // this should be replaced through "CharacterRotation"
// by 90 degrees, therefore a new Item has to be
// supported by svx core, api and xml file format // supported by svx core, api and xml file format
((SdrObjCustomShape*)pRet)->SetVerticalWriting( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 ); ((SdrObjCustomShape*)pRet)->SetVerticalWriting( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 );
...@@ -6184,81 +6185,85 @@ bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape, ...@@ -6184,81 +6185,85 @@ bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape,
******************************************************************************/ ******************************************************************************/
bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, Rectangle* pVisArea ) bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, Rectangle* pVisArea )
{ {
if (!pStData)
return false;
bool bOk = false; // initialize result variable bool bOk = false; // initialize result variable
if ( pStData )
// check if a graphic for this blipId is already imported
if ( nIdx_)
{ {
// check if a graphic for this blipId is already imported std::map<sal_uInt32,OString>::iterator iter = aEscherBlipCache.find(nIdx_);
if ( nIdx_)
{
std::map<sal_uInt32,OString>::iterator iter = aEscherBlipCache.find(nIdx_);
if (iter != aEscherBlipCache.end()) if (iter != aEscherBlipCache.end())
{ {
/* if this entry is available, then it should be possible /* if this entry is available, then it should be possible
to get the Graphic via GraphicObject */ to get the Graphic via GraphicObject */
GraphicObject aGraphicObject( iter->second ); GraphicObject aGraphicObject( iter->second );
rData = aGraphicObject.GetGraphic(); rData = aGraphicObject.GetGraphic();
if ( rData.GetType() != GRAPHIC_NONE ) if ( rData.GetType() != GRAPHIC_NONE )
bOk = true; bOk = true;
else else
aEscherBlipCache.erase(iter); aEscherBlipCache.erase(iter);
}
} }
if ( !bOk ) }
{
sal_uInt16 nIdx = sal_uInt16( nIdx_ ); if ( !bOk )
if( !nIdx || (pBLIPInfos->size() < nIdx) ) return false; {
sal_uInt16 nIdx = sal_uInt16( nIdx_ );
// possibly delete old error flag(s) if( !nIdx || (pBLIPInfos->size() < nIdx) )
if( rStCtrl.GetError() ) return false;
rStCtrl.ResetError();
if( ( &rStCtrl != pStData ) // possibly delete old error flag(s)
&& pStData->GetError() ) if( rStCtrl.GetError() )
pStData->ResetError(); rStCtrl.ResetError();
if( ( &rStCtrl != pStData )
// remember FilePos of the stream(s) && pStData->GetError() )
sal_uLong nOldPosCtrl = rStCtrl.Tell(); pStData->ResetError();
sal_uLong nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
// remember FilePos of the stream(s)
// fetch matching info struct out of the pointer array sal_uLong nOldPosCtrl = rStCtrl.Tell();
SvxMSDffBLIPInfo& rInfo = (*pBLIPInfos)[ nIdx-1 ]; sal_uLong nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
// jump to the BLIP atom in the data stream
pStData->Seek( rInfo.nFilePos ); // fetch matching info struct out of the pointer array
// possibly reset error status SvxMSDffBLIPInfo& rInfo = (*pBLIPInfos)[ nIdx-1 ];
if( pStData->GetError() ) // jump to the BLIP atom in the data stream
pStData->ResetError(); pStData->Seek( rInfo.nFilePos );
// possibly reset error status
if( pStData->GetError() )
pStData->ResetError();
else
bOk = GetBLIPDirect( *pStData, rData, pVisArea );
if( pStData2 && !bOk )
{
// Error, but the is a second chance: There is a second
// data stream in which the graphic could be stored!
if( pStData2->GetError() )
pStData2->ResetError();
sal_uLong nOldPosData2 = pStData2->Tell();
// jump to the BLIP atom in the second data stream
pStData2->Seek( rInfo.nFilePos );
// reset error status if necessary
if( pStData2->GetError() )
pStData2->ResetError();
else else
bOk = GetBLIPDirect( *pStData, rData, pVisArea ); bOk = GetBLIPDirect( *pStData2, rData, pVisArea );
if( pStData2 && !bOk ) // restore olf FilePos of the second data stream
{ pStData2->Seek( nOldPosData2 );
// Error, but the is a second chance: There is a second }
// data stream in which the graphic could be stored! // restore old FilePos of the stream(s)
if( pStData2->GetError() ) rStCtrl.Seek( nOldPosCtrl );
pStData2->ResetError(); if( &rStCtrl != pStData )
sal_uLong nOldPosData2 = pStData2->Tell(); pStData->Seek( nOldPosData );
// jump to the BLIP atom in the second data stream
pStData2->Seek( rInfo.nFilePos );
// reset error status if necessary
if( pStData2->GetError() )
pStData2->ResetError();
else
bOk = GetBLIPDirect( *pStData2, rData, pVisArea );
// restore olf FilePos of the second data stream
pStData2->Seek( nOldPosData2 );
}
// restore old FilePos of the stream(s)
rStCtrl.Seek( nOldPosCtrl );
if( &rStCtrl != pStData )
pStData->Seek( nOldPosData );
if ( bOk ) if ( bOk )
{ {
// create new BlipCacheEntry for this graphic // create new BlipCacheEntry for this graphic
GraphicObject aGraphicObject( rData ); GraphicObject aGraphicObject( rData );
aEscherBlipCache.insert(std::make_pair(nIdx_,aGraphicObject.GetUniqueID())); aEscherBlipCache.insert(std::make_pair(nIdx_,aGraphicObject.GetUniqueID()));
}
} }
} }
return bOk; return bOk;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment