Kaydet (Commit) 577bfd16 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

maDocFileURLStr is always empty

Change-Id: I34c4a44d4fbe8d721a3a0bda5dbe35c68fe15c13
üst d2e7105f
...@@ -170,12 +170,6 @@ public: ...@@ -170,12 +170,6 @@ public:
GraphicReader* GetContext(); GraphicReader* GetContext();
void SetContext( GraphicReader* pReader ); void SetContext( GraphicReader* pReader );
public:
void SetDocFileName( const OUString& rName, sal_uLong nFilePos );
const OUString& GetDocFileName() const;
sal_uLong GetDocFilePos() const;
private: private:
friend class GraphicObject; friend class GraphicObject;
bool SwapOut(); bool SwapOut();
......
...@@ -265,8 +265,6 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) ...@@ -265,8 +265,6 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute )
const Size aPrefSize( rSubstitute.GetPrefSize() ); const Size aPrefSize( rSubstitute.GetPrefSize() );
const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() ); const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() );
const Link aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() ); const Link aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() );
const OUString aDocFileName( rSubstitute.GetDocFileName() );
const sal_uLong nDocFilePos = rSubstitute.GetDocFilePos();
const GraphicType eOldType = rSubstitute.GetType(); const GraphicType eOldType = rSubstitute.GetType();
const bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); const bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT );
...@@ -299,7 +297,6 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) ...@@ -299,7 +297,6 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute )
rSubstitute.SetPrefSize( aPrefSize ); rSubstitute.SetPrefSize( aPrefSize );
rSubstitute.SetPrefMapMode( aPrefMapMode ); rSubstitute.SetPrefMapMode( aPrefMapMode );
rSubstitute.SetAnimationNotifyHdl( aAnimationNotifyHdl ); rSubstitute.SetAnimationNotifyHdl( aAnimationNotifyHdl );
rSubstitute.SetDocFileName( aDocFileName, nDocFilePos );
} }
if( GFX_LINK_TYPE_NONE != maGfxLink.GetType() ) if( GFX_LINK_TYPE_NONE != maGfxLink.GetType() )
......
...@@ -56,8 +56,6 @@ private: ...@@ -56,8 +56,6 @@ private:
ImpSwapFile* mpSwapFile; ImpSwapFile* mpSwapFile;
GfxLink* mpGfxLink; GfxLink* mpGfxLink;
GraphicType meType; GraphicType meType;
OUString maDocFileURLStr;
sal_uLong mnDocFilePos;
mutable sal_uLong mnSizeBytes; mutable sal_uLong mnSizeBytes;
sal_uLong mnRefCount; sal_uLong mnRefCount;
bool mbSwapOut; bool mbSwapOut;
...@@ -131,11 +129,6 @@ private: ...@@ -131,11 +129,6 @@ private:
void ImplSetContext( GraphicReader* pReader ); void ImplSetContext( GraphicReader* pReader );
private: private:
void ImplSetDocFileName( const OUString& rName, sal_uLong nFilePos );
const OUString& ImplGetDocFileName() const;
sal_uLong ImplGetDocFilePos() const { return mnDocFilePos;}
bool ImplReadEmbedded( SvStream& rIStream ); bool ImplReadEmbedded( SvStream& rIStream );
bool ImplWriteEmbedded( SvStream& rOStream ); bool ImplWriteEmbedded( SvStream& rOStream );
......
...@@ -501,21 +501,6 @@ void Graphic::SetContext( GraphicReader* pReader ) ...@@ -501,21 +501,6 @@ void Graphic::SetContext( GraphicReader* pReader )
mpImpGraphic->ImplSetContext( pReader ); mpImpGraphic->ImplSetContext( pReader );
} }
void Graphic::SetDocFileName( const OUString& rName, sal_uLong nFilePos )
{
mpImpGraphic->ImplSetDocFileName( rName, nFilePos );
}
const OUString& Graphic::GetDocFileName() const
{
return mpImpGraphic->ImplGetDocFileName();
}
sal_uLong Graphic::GetDocFilePos() const
{
return mpImpGraphic->ImplGetDocFilePos();
}
bool Graphic::SwapOut() bool Graphic::SwapOut()
{ {
ImplTestRefCount(); ImplTestRefCount();
......
...@@ -95,7 +95,6 @@ ImpGraphic::ImpGraphic() : ...@@ -95,7 +95,6 @@ ImpGraphic::ImpGraphic() :
mpSwapFile ( NULL ), mpSwapFile ( NULL ),
mpGfxLink ( NULL ), mpGfxLink ( NULL ),
meType ( GRAPHIC_NONE ), meType ( GRAPHIC_NONE ),
mnDocFilePos ( 0UL ),
mnSizeBytes ( 0UL ), mnSizeBytes ( 0UL ),
mnRefCount ( 1UL ), mnRefCount ( 1UL ),
mbSwapOut ( false ), mbSwapOut ( false ),
...@@ -109,8 +108,6 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) : ...@@ -109,8 +108,6 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) :
mpContext ( NULL ), mpContext ( NULL ),
mpSwapFile ( rImpGraphic.mpSwapFile ), mpSwapFile ( rImpGraphic.mpSwapFile ),
meType ( rImpGraphic.meType ), meType ( rImpGraphic.meType ),
maDocFileURLStr ( rImpGraphic.maDocFileURLStr ),
mnDocFilePos ( rImpGraphic.mnDocFilePos ),
mnSizeBytes ( rImpGraphic.mnSizeBytes ), mnSizeBytes ( rImpGraphic.mnSizeBytes ),
mnRefCount ( 1UL ), mnRefCount ( 1UL ),
mbSwapOut ( rImpGraphic.mbSwapOut ), mbSwapOut ( rImpGraphic.mbSwapOut ),
...@@ -142,7 +139,6 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) : ...@@ -142,7 +139,6 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
mpSwapFile ( NULL ), mpSwapFile ( NULL ),
mpGfxLink ( NULL ), mpGfxLink ( NULL ),
meType ( GRAPHIC_BITMAP ), meType ( GRAPHIC_BITMAP ),
mnDocFilePos ( 0UL ),
mnSizeBytes ( 0UL ), mnSizeBytes ( 0UL ),
mnRefCount ( 1UL ), mnRefCount ( 1UL ),
mbSwapOut ( false ), mbSwapOut ( false ),
...@@ -157,7 +153,6 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) : ...@@ -157,7 +153,6 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
mpSwapFile ( NULL ), mpSwapFile ( NULL ),
mpGfxLink ( NULL ), mpGfxLink ( NULL ),
meType ( GRAPHIC_BITMAP ), meType ( GRAPHIC_BITMAP ),
mnDocFilePos ( 0UL ),
mnSizeBytes ( 0UL ), mnSizeBytes ( 0UL ),
mnRefCount ( 1UL ), mnRefCount ( 1UL ),
mbSwapOut ( false ), mbSwapOut ( false ),
...@@ -171,7 +166,6 @@ ImpGraphic::ImpGraphic(const SvgDataPtr& rSvgDataPtr) ...@@ -171,7 +166,6 @@ ImpGraphic::ImpGraphic(const SvgDataPtr& rSvgDataPtr)
mpSwapFile( NULL ), mpSwapFile( NULL ),
mpGfxLink( NULL ), mpGfxLink( NULL ),
meType( rSvgDataPtr.get() ? GRAPHIC_BITMAP : GRAPHIC_NONE ), meType( rSvgDataPtr.get() ? GRAPHIC_BITMAP : GRAPHIC_NONE ),
mnDocFilePos( 0UL ),
mnSizeBytes( 0UL ), mnSizeBytes( 0UL ),
mnRefCount( 1UL ), mnRefCount( 1UL ),
mbSwapOut( false ), mbSwapOut( false ),
...@@ -187,7 +181,6 @@ ImpGraphic::ImpGraphic( const Animation& rAnimation ) : ...@@ -187,7 +181,6 @@ ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
mpSwapFile ( NULL ), mpSwapFile ( NULL ),
mpGfxLink ( NULL ), mpGfxLink ( NULL ),
meType ( GRAPHIC_BITMAP ), meType ( GRAPHIC_BITMAP ),
mnDocFilePos ( 0UL ),
mnSizeBytes ( 0UL ), mnSizeBytes ( 0UL ),
mnRefCount ( 1UL ), mnRefCount ( 1UL ),
mbSwapOut ( false ), mbSwapOut ( false ),
...@@ -202,7 +195,6 @@ ImpGraphic::ImpGraphic( const GDIMetaFile& rMtf ) : ...@@ -202,7 +195,6 @@ ImpGraphic::ImpGraphic( const GDIMetaFile& rMtf ) :
mpSwapFile ( NULL ), mpSwapFile ( NULL ),
mpGfxLink ( NULL ), mpGfxLink ( NULL ),
meType ( GRAPHIC_GDIMETAFILE ), meType ( GRAPHIC_GDIMETAFILE ),
mnDocFilePos ( 0UL ),
mnSizeBytes ( 0UL ), mnSizeBytes ( 0UL ),
mnRefCount ( 1UL ), mnRefCount ( 1UL ),
mbSwapOut ( false ), mbSwapOut ( false ),
...@@ -244,8 +236,6 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic ) ...@@ -244,8 +236,6 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic )
if( !mbSwapUnderway ) if( !mbSwapUnderway )
{ {
maDocFileURLStr = rImpGraphic.maDocFileURLStr;
mnDocFilePos = rImpGraphic.mnDocFilePos;
mbSwapOut = rImpGraphic.mbSwapOut; mbSwapOut = rImpGraphic.mbSwapOut;
mpSwapFile = rImpGraphic.mpSwapFile; mpSwapFile = rImpGraphic.mpSwapFile;
...@@ -393,8 +383,6 @@ void ImpGraphic::ImplClear() ...@@ -393,8 +383,6 @@ void ImpGraphic::ImplClear()
} }
mbSwapOut = false; mbSwapOut = false;
mnDocFilePos = 0UL;
maDocFileURLStr.clear();
// cleanup // cleanup
ImplClearGraphics( false ); ImplClearGraphics( false );
...@@ -953,22 +941,6 @@ void ImpGraphic::ImplSetContext( GraphicReader* pReader ) ...@@ -953,22 +941,6 @@ void ImpGraphic::ImplSetContext( GraphicReader* pReader )
mpContext = pReader; mpContext = pReader;
} }
void ImpGraphic::ImplSetDocFileName( const OUString& rName, sal_uLong nFilePos )
{
const INetURLObject aURL( rName );
DBG_ASSERT( rName.isEmpty() || ( aURL.GetProtocol() != INET_PROT_NOT_VALID ), "Graphic::SetDocFileName(...): invalid URL" );
maDocFileURLStr = aURL.GetMainURL( INetURLObject::NO_DECODE );
mnDocFilePos = nFilePos;
}
const OUString& ImpGraphic::ImplGetDocFileName() const
{
return maDocFileURLStr;
}
bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm ) bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
{ {
MapMode aMapMode; MapMode aMapMode;
...@@ -1184,66 +1156,58 @@ bool ImpGraphic::ImplSwapOut() ...@@ -1184,66 +1156,58 @@ bool ImpGraphic::ImplSwapOut()
if( !ImplIsSwapOut() ) if( !ImplIsSwapOut() )
{ {
if (maDocFileURLStr.isEmpty()) ::utl::TempFile aTempFile;
{ const INetURLObject aTmpURL( aTempFile.GetURL() );
::utl::TempFile aTempFile;
const INetURLObject aTmpURL( aTempFile.GetURL() );
if( !aTmpURL.GetMainURL( INetURLObject::NO_DECODE ).isEmpty() ) if( !aTmpURL.GetMainURL( INetURLObject::NO_DECODE ).isEmpty() )
{
boost::scoped_ptr<SvStream> pOStm;
try
{ {
boost::scoped_ptr<SvStream> pOStm; pOStm.reset(::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE | STREAM_SHARE_DENYWRITE ));
try }
{ catch( const ::com::sun::star::uno::Exception& )
pOStm.reset(::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE | STREAM_SHARE_DENYWRITE )); {
} }
catch( const ::com::sun::star::uno::Exception& ) if( pOStm )
{
pOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
pOStm->SetCompressMode( COMPRESSMODE_NATIVE );
if( ( bRet = ImplSwapOut( pOStm.get() ) ) )
{ {
mpSwapFile = new ImpSwapFile;
mpSwapFile->nRefCount = 1;
mpSwapFile->aSwapURL = aTmpURL;
} }
if( pOStm ) else
{ {
pOStm->SetVersion( SOFFICE_FILEFORMAT_50 ); pOStm.reset();
pOStm->SetCompressMode( COMPRESSMODE_NATIVE );
if( ( bRet = ImplSwapOut( pOStm.get() ) ) ) try
{ {
mpSwapFile = new ImpSwapFile; ::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ),
mpSwapFile->nRefCount = 1; ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
mpSwapFile->aSwapURL = aTmpURL; comphelper::getProcessComponentContext() );
aCnt.executeCommand( OUString("delete"),
::com::sun::star::uno::makeAny( true ) );
} }
else catch( const ::com::sun::star::ucb::ContentCreationException& )
{
}
catch( const ::com::sun::star::uno::RuntimeException& )
{
}
catch( const ::com::sun::star::ucb::CommandAbortedException& )
{
}
catch( const ::com::sun::star::uno::Exception& )
{ {
pOStm.reset();
try
{
::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ),
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
comphelper::getProcessComponentContext() );
aCnt.executeCommand( OUString("delete"),
::com::sun::star::uno::makeAny( true ) );
}
catch( const ::com::sun::star::ucb::ContentCreationException& )
{
}
catch( const ::com::sun::star::uno::RuntimeException& )
{
}
catch( const ::com::sun::star::ucb::CommandAbortedException& )
{
}
catch( const ::com::sun::star::uno::Exception& )
{
}
} }
} }
} }
} }
else
{
ImplClearGraphics( true );
bRet = mbSwapOut = true;
}
} }
return bRet; return bRet;
...@@ -1292,8 +1256,6 @@ bool ImpGraphic::ImplSwapIn() ...@@ -1292,8 +1256,6 @@ bool ImpGraphic::ImplSwapIn()
if( mpSwapFile ) if( mpSwapFile )
aSwapURL = mpSwapFile->aSwapURL.GetMainURL( INetURLObject::NO_DECODE ); aSwapURL = mpSwapFile->aSwapURL.GetMainURL( INetURLObject::NO_DECODE );
else
aSwapURL = maDocFileURLStr;
if( !aSwapURL.isEmpty() ) if( !aSwapURL.isEmpty() )
{ {
...@@ -1311,9 +1273,6 @@ bool ImpGraphic::ImplSwapIn() ...@@ -1311,9 +1273,6 @@ bool ImpGraphic::ImplSwapIn()
pIStm->SetVersion( SOFFICE_FILEFORMAT_50 ); pIStm->SetVersion( SOFFICE_FILEFORMAT_50 );
pIStm->SetCompressMode( COMPRESSMODE_NATIVE ); pIStm->SetCompressMode( COMPRESSMODE_NATIVE );
if( !mpSwapFile )
pIStm->Seek( mnDocFilePos );
bRet = ImplSwapIn( pIStm.get() ); bRet = ImplSwapIn( pIStm.get() );
pIStm.reset(); pIStm.reset();
......
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