[Libreoffice-commits] .: 23 commits - sc/source sd/source sfx2/inc sfx2/source sw/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Jul 25 12:01:41 PDT 2012
sc/source/ui/docshell/externalrefmgr.cxx | 5
sc/source/ui/docshell/tablink.cxx | 2
sd/source/core/sdpage2.cxx | 2
sd/source/ui/dlg/navigatr.cxx | 2
sd/source/ui/view/sdview2.cxx | 6
sfx2/inc/sfx2/docfile.hxx | 42 -
sfx2/source/dialog/dinfdlg.cxx | 2
sfx2/source/doc/docfile.cxx | 975 +++++++++++++++----------------
sfx2/source/doc/objserv.cxx | 10
sfx2/source/doc/objstor.cxx | 12
sfx2/source/view/frame.cxx | 2
sfx2/source/view/viewfrm.cxx | 7
sw/source/core/doc/visiturl.cxx | 2
sw/source/ui/uiview/srcview.cxx | 8
14 files changed, 543 insertions(+), 534 deletions(-)
New commits:
commit 11f2a588ed48a21e7f7c1a110cbc43a65380bd8a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 14:25:34 2012 -0400
Move StorOpenMode to Impl. Now all the data members are in Impl.
Change-Id: Ib281dac33cdce4e44b68956b23884e5c56878a29
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index f3f189b..deaa077 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -67,8 +67,7 @@ class DateTime;
class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
{
- StreamMode nStorOpenMode;
- SfxMedium_Impl* pImp;
+ SfxMedium_Impl* pImp;
#if _SOLAR__PRIVATE
SAL_DLLPRIVATE void SetIsRemote_Impl();
@@ -164,7 +163,7 @@ public:
sal_Bool IsRoot() const;
void CloseStorage();
- StreamMode GetOpenMode() const { return nStorOpenMode; }
+ StreamMode GetOpenMode() const;
void SetOpenMode( StreamMode nStorOpen, sal_Bool bDontClose = sal_False );
SvStream* GetInStream();
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index c6cf4d1..5e6851b 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -242,6 +242,7 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Referenc
class SfxMedium_Impl
{
public:
+ StreamMode m_nStorOpenMode;
sal_uInt32 m_eError;
::ucbhelper::Content aContent;
@@ -327,6 +328,7 @@ public:
//------------------------------------------------------------------
SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
+ m_nStorOpenMode(SFX_STREAM_READWRITE),
m_eError(SVSTREAM_OK),
bUpdatePickList(true),
bIsTemp( false ),
@@ -572,11 +574,11 @@ SvStream* SfxMedium::GetInStream()
if ( pImp->pTempFile )
{
- pImp->m_pInStream = new SvFileStream( pImp->m_aName, nStorOpenMode );
+ pImp->m_pInStream = new SvFileStream(pImp->m_aName, pImp->m_nStorOpenMode);
pImp->m_eError = pImp->m_pInStream->GetError();
- if( !pImp->m_eError && (nStorOpenMode & STREAM_WRITE)
+ if (!pImp->m_eError && (pImp->m_nStorOpenMode & STREAM_WRITE)
&& ! pImp->m_pInStream->IsWritable() )
{
pImp->m_eError = ERRCODE_IO_ACCESSDENIED;
@@ -736,7 +738,7 @@ sal_Bool SfxMedium::Commit()
GetInitFileDate( true );
// remove truncation mode from the flags
- nStorOpenMode &= (~STREAM_TRUNC);
+ pImp->m_nStorOpenMode &= (~STREAM_TRUNC);
return bResult;
}
@@ -1371,7 +1373,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf
aTmpStream.Close();
// Open data as Storage
- nStorOpenMode = SFX_STREAM_READONLY;
+ pImp->m_nStorOpenMode = SFX_STREAM_READONLY;
pImp->xStorage = comphelper::OStorageHelper::GetStorageFromURL( aTmpName, embed::ElementModes::READ );
pImp->bStorageBasedOnInStream = false;
rtl::OUString aTemp;
@@ -1487,13 +1489,17 @@ sal_Bool SfxMedium::WillDisposeStorageOnClose_Impl()
return pImp->bDisposeStorage;
}
-//------------------------------------------------------------------
+StreamMode SfxMedium::GetOpenMode() const
+{
+ return pImp->m_nStorOpenMode;
+}
+
void SfxMedium::SetOpenMode( StreamMode nStorOpen,
sal_Bool bDontClose )
{
- if ( nStorOpenMode != nStorOpen )
+ if ( pImp->m_nStorOpenMode != nStorOpen )
{
- nStorOpenMode = nStorOpen;
+ pImp->m_nStorOpenMode = nStorOpen;
if( !bDontClose )
{
@@ -2295,7 +2301,7 @@ void SfxMedium::GetMedium_Impl()
if ( !bFromTempFile )
{
GetItemSet()->Put( SfxStringItem( SID_FILE_NAME, aFileName ) );
- if( !(nStorOpenMode & STREAM_WRITE ) )
+ if( !(pImp->m_nStorOpenMode & STREAM_WRITE) )
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
if (xInteractionHandler.is())
GetItemSet()->Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, makeAny(xInteractionHandler) ) );
@@ -2513,9 +2519,7 @@ void SfxMedium::Init_Impl()
}
//------------------------------------------------------------------
-SfxMedium::SfxMedium() :
- nStorOpenMode( SFX_STREAM_READWRITE ),
- pImp(new SfxMedium_Impl( this ))
+SfxMedium::SfxMedium() : pImp(new SfxMedium_Impl(this))
{
Init_Impl();
}
@@ -2767,7 +2771,7 @@ void SfxMedium::SetIsRemote_Impl()
// As files that are written to the remote transmission must also be able
// to be read.
if (pImp->m_bRemote)
- nStorOpenMode |= STREAM_READ;
+ pImp->m_nStorOpenMode |= STREAM_READ;
}
@@ -2861,20 +2865,18 @@ void SfxMedium::CompleteReOpen()
}
SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter *pFlt, SfxItemSet *pInSet) :
- nStorOpenMode( SFX_STREAM_READWRITE ),
- pImp(new SfxMedium_Impl( this ))
+ pImp(new SfxMedium_Impl(this))
{
pImp->m_pSet = pInSet;
pImp->m_pFilter = pFlt;
pImp->m_aLogicName = rName;
- nStorOpenMode = nOpenMode;
+ pImp->m_nStorOpenMode = nOpenMode;
Init_Impl();
}
SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) :
- nStorOpenMode( SFX_STREAM_READWRITE ),
- pImp(new SfxMedium_Impl( this ))
+ pImp(new SfxMedium_Impl(this))
{
SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() );
pImp->m_pSet = pParams;
@@ -2919,7 +2921,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
SFX_ITEMSET_ARG( pImp->m_pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
if (!pFileNameItem) throw uno::RuntimeException();
pImp->m_aLogicName = pFileNameItem->GetValue();
- nStorOpenMode = pImp->m_bOriginallyReadOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE;
+ pImp->m_nStorOpenMode = pImp->m_bOriginallyReadOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE;
Init_Impl();
}
@@ -2927,8 +2929,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
//------------------------------------------------------------------
SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const String& rBaseURL, const SfxItemSet* p, sal_Bool bRootP ) :
- nStorOpenMode( SFX_STREAM_READWRITE ),
- pImp( new SfxMedium_Impl( this ))
+ pImp(new SfxMedium_Impl(this))
{
pImp->m_bRoot = bRootP;
@@ -2947,8 +2948,7 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
}
SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const String& rBaseURL, const String& rTypeName, const SfxItemSet* p, sal_Bool bRootP ) :
- nStorOpenMode( SFX_STREAM_READWRITE ),
- pImp( new SfxMedium_Impl( this ))
+ pImp(new SfxMedium_Impl(this))
{
pImp->m_bRoot = bRootP;
@@ -3324,7 +3324,7 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
return;
}
- if ( !( nStorOpenMode & STREAM_TRUNC ) )
+ if ( !(pImp->m_nStorOpenMode & STREAM_TRUNC) )
{
bool bTransferSuccess = false;
@@ -3671,7 +3671,7 @@ sal_Bool SfxMedium::CallApproveHandler( const uno::Reference< task::XInteraction
// remove the readonly state
bool bWasReadonly = false;
- nStorOpenMode = SFX_STREAM_READWRITE;
+ pImp->m_nStorOpenMode = SFX_STREAM_READWRITE;
SFX_ITEMSET_ARG( pImp->m_pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, false );
if ( pReadOnlyItem && pReadOnlyItem->GetValue() )
bWasReadonly = true;
@@ -3702,7 +3702,7 @@ sal_Bool SfxMedium::CallApproveHandler( const uno::Reference< task::XInteraction
if ( bWasReadonly )
{
// set the readonly state back
- nStorOpenMode = SFX_STREAM_READONLY;
+ pImp->m_nStorOpenMode = SFX_STREAM_READONLY;
GetItemSet()->Put( SfxBoolItem(SID_DOC_READONLY, true));
}
GetMedium_Impl();
commit ff16ce35dd5e8816d08ff02fae4b3197aa0336fb
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 14:18:23 2012 -0400
Calling delete on NULL pointer is no-op; no need to check it.
Change-Id: I4ad09a91b3a2f4b4cc8f389174872224646e5b54
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index ccdb665..c6cf4d1 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -367,13 +367,10 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
//------------------------------------------------------------------
SfxMedium_Impl::~SfxMedium_Impl()
{
-
aDoneLink.ClearPendingCall();
aAvailableLink.ClearPendingCall();
- if ( pTempFile )
- delete pTempFile;
-
+ delete pTempFile;
delete m_pSet;
delete m_pURLObj;
}
commit 5f43d9025688a550580024af626ef84ddec30f0f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 14:17:20 2012 -0400
Move pURLObj to Impl.
Change-Id: Ia5585ee93e5cb034e4781c8e12bacd434c109bcf
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index a27114c..f3f189b 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -68,7 +68,6 @@ class DateTime;
class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
{
StreamMode nStorOpenMode;
- INetURLObject* pURLObj;
SfxMedium_Impl* pImp;
#if _SOLAR__PRIVATE
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 5447fe7..ccdb665 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -275,6 +275,8 @@ public:
uno::Reference<io::XInputStream> m_xInputStreamToLoadFrom;
mutable SfxItemSet* m_pSet;
+ mutable INetURLObject* m_pURLObj;
+
const SfxFilter* m_pFilter;
SfxMedium* pAntiImpl;
SvStream* m_pInStream;
@@ -347,6 +349,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
m_bRemote(false),
m_bInputStreamIsReadOnly(false),
m_pSet(NULL),
+ m_pURLObj(NULL),
m_pFilter(NULL),
pAntiImpl( pAntiImplP ),
m_pInStream(NULL),
@@ -372,6 +375,7 @@ SfxMedium_Impl::~SfxMedium_Impl()
delete pTempFile;
delete m_pSet;
+ delete m_pURLObj;
}
void SfxMedium::ResetError()
@@ -2480,7 +2484,7 @@ void SfxMedium::Init_Impl()
if ( pSalvageItem && pSalvageItem->GetValue().Len() )
{
pImp->m_aLogicName = pSalvageItem->GetValue();
- DELETEZ( pURLObj );
+ DELETEZ( pImp->m_pURLObj );
pImp->m_bSalvageMode = true;
}
@@ -2514,7 +2518,6 @@ void SfxMedium::Init_Impl()
//------------------------------------------------------------------
SfxMedium::SfxMedium() :
nStorOpenMode( SFX_STREAM_READWRITE ),
- pURLObj(0),
pImp(new SfxMedium_Impl( this ))
{
Init_Impl();
@@ -2779,7 +2782,7 @@ void SfxMedium::SetName( const String& aNameP, sal_Bool bSetOrigURL )
if( bSetOrigURL )
pImp->aOrigURL = aNameP;
pImp->m_aLogicName = aNameP;
- DELETEZ( pURLObj );
+ DELETEZ( pImp->m_pURLObj );
pImp->aContent = ::ucbhelper::Content();
Init_Impl();
}
@@ -2862,7 +2865,6 @@ void SfxMedium::CompleteReOpen()
SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter *pFlt, SfxItemSet *pInSet) :
nStorOpenMode( SFX_STREAM_READWRITE ),
- pURLObj(0),
pImp(new SfxMedium_Impl( this ))
{
pImp->m_pSet = pInSet;
@@ -2875,7 +2877,6 @@ SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter
SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) :
nStorOpenMode( SFX_STREAM_READWRITE ),
- pURLObj(0),
pImp(new SfxMedium_Impl( this ))
{
SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() );
@@ -2930,7 +2931,6 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const String& rBaseURL, const SfxItemSet* p, sal_Bool bRootP ) :
nStorOpenMode( SFX_STREAM_READWRITE ),
- pURLObj(0),
pImp( new SfxMedium_Impl( this ))
{
pImp->m_bRoot = bRootP;
@@ -2951,7 +2951,6 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const String& rBaseURL, const String& rTypeName, const SfxItemSet* p, sal_Bool bRootP ) :
nStorOpenMode( SFX_STREAM_READWRITE ),
- pURLObj(0),
pImp( new SfxMedium_Impl( this ))
{
pImp->m_bRoot = bRootP;
@@ -2992,7 +2991,6 @@ SfxMedium::~SfxMedium()
}
}
- delete pURLObj;
delete pImp;
}
@@ -3003,15 +3001,14 @@ const OUString& SfxMedium::GetName() const
const INetURLObject& SfxMedium::GetURLObject() const
{
- if( !pURLObj )
+ if (!pImp->m_pURLObj)
{
- SfxMedium* pThis = const_cast < SfxMedium* > (this);
- pThis->pURLObj = new INetURLObject( pImp->m_aLogicName );
- if ( pThis->pURLObj->HasMark() )
- (*pThis->pURLObj) = INetURLObject( pImp->m_aLogicName ).GetURLNoMark();
+ pImp->m_pURLObj = new INetURLObject( pImp->m_aLogicName );
+ if (pImp->m_pURLObj->HasMark())
+ *pImp->m_pURLObj = INetURLObject( pImp->m_aLogicName ).GetURLNoMark();
}
- return *pURLObj;
+ return *pImp->m_pURLObj;
}
//----------------------------------------------------------------
commit cab945670dbda8c069b2f387b32674374775325c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 12:43:06 2012 -0400
Nobody uses this.
Change-Id: Ief09afa3c711869eff01344e8748a1010d96738f
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index a092a83..a27114c 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -40,7 +40,6 @@
#include <tools/string.hxx>
#include <svl/lstner.hxx>
-#include <tools/globname.hxx>
#include <cppuhelper/weak.hxx>
#include <ucbhelper/content.hxx>
@@ -70,7 +69,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
{
StreamMode nStorOpenMode;
INetURLObject* pURLObj;
- SvGlobalName aFilterClass;
SfxMedium_Impl* pImp;
#if _SOLAR__PRIVATE
commit 954d55a402e9a92e352c555e691dacbbb6305d06
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 12:36:29 2012 -0400
And pInStream too.
Change-Id: I14f6bd82a083a4d6eff1928ed94fc3e918b97767
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 35077f4..a092a83 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -71,7 +71,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
StreamMode nStorOpenMode;
INetURLObject* pURLObj;
SvGlobalName aFilterClass;
- SvStream* pInStream;
SfxMedium_Impl* pImp;
#if _SOLAR__PRIVATE
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index d73d8d6..5447fe7 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -277,6 +277,7 @@ public:
mutable SfxItemSet* m_pSet;
const SfxFilter* m_pFilter;
SfxMedium* pAntiImpl;
+ SvStream* m_pInStream;
SvStream* m_pOutStream;
long nFileVersion;
@@ -348,6 +349,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
m_pSet(NULL),
m_pFilter(NULL),
pAntiImpl( pAntiImplP ),
+ m_pInStream(NULL),
m_pOutStream(NULL),
nFileVersion( 0 ),
pOrigFilter( 0 ),
@@ -375,8 +377,8 @@ SfxMedium_Impl::~SfxMedium_Impl()
void SfxMedium::ResetError()
{
pImp->m_eError = SVSTREAM_OK;
- if( pInStream )
- pInStream->ResetError();
+ if( pImp->m_pInStream )
+ pImp->m_pInStream->ResetError();
if( pImp->m_pOutStream )
pImp->m_pOutStream->ResetError();
}
@@ -418,8 +420,8 @@ void SfxMedium::SetError( sal_uInt32 nError, const ::rtl::OUString& aLogMessage
sal_uInt32 SfxMedium::GetErrorCode() const
{
sal_uInt32 lError = pImp->m_eError;
- if(!lError && pInStream)
- lError=pInStream->GetErrorCode();
+ if(!lError && pImp->m_pInStream)
+ lError = pImp->m_pInStream->GetErrorCode();
if(!lError && pImp->m_pOutStream)
lError = pImp->m_pOutStream->GetErrorCode();
return lError;
@@ -564,24 +566,24 @@ Reference < XContent > SfxMedium::GetContent() const
//------------------------------------------------------------------
SvStream* SfxMedium::GetInStream()
{
- if ( pInStream )
- return pInStream;
+ if ( pImp->m_pInStream )
+ return pImp->m_pInStream;
if ( pImp->pTempFile )
{
- pInStream = new SvFileStream( pImp->m_aName, nStorOpenMode );
+ pImp->m_pInStream = new SvFileStream( pImp->m_aName, nStorOpenMode );
- pImp->m_eError = pInStream->GetError();
+ pImp->m_eError = pImp->m_pInStream->GetError();
if( !pImp->m_eError && (nStorOpenMode & STREAM_WRITE)
- && ! pInStream->IsWritable() )
+ && ! pImp->m_pInStream->IsWritable() )
{
pImp->m_eError = ERRCODE_IO_ACCESSDENIED;
- delete pInStream;
- pInStream = NULL;
+ delete pImp->m_pInStream;
+ pImp->m_pInStream = NULL;
}
else
- return pInStream;
+ return pImp->m_pInStream;
}
GetMedium_Impl();
@@ -589,7 +591,7 @@ SvStream* SfxMedium::GetInStream()
if ( GetError() )
return NULL;
- return pInStream;
+ return pImp->m_pInStream;
}
//------------------------------------------------------------------
@@ -603,19 +605,19 @@ void SfxMedium::CloseInStream_Impl()
// if there is a storage based on the InStream, we have to
// close the storage, too, because otherwise the storage
// would use an invalid ( deleted ) stream.
- if ( pInStream && pImp->xStorage.is() )
+ if ( pImp->m_pInStream && pImp->xStorage.is() )
{
if ( pImp->bStorageBasedOnInStream )
CloseStorage();
}
- if ( pInStream && !GetContent().is() )
+ if ( pImp->m_pInStream && !GetContent().is() )
{
CreateTempFile( true );
return;
}
- DELETEZ( pInStream );
+ DELETEZ( pImp->m_pInStream );
if ( pImp->m_pSet )
pImp->m_pSet->ClearItem( SID_INPUTSTREAM );
@@ -676,7 +678,7 @@ sal_Bool SfxMedium::CloseOutStream_Impl()
pImp->m_pOutStream = NULL;
}
- if ( !pInStream )
+ if ( !pImp->m_pInStream )
{
// input part of the stream is not used so the whole stream can be closed
// TODO/LATER: is it correct?
@@ -703,7 +705,7 @@ void SfxMedium::CreateFileStream()
{
ForceSynchronStream_Impl( true );
GetInStream();
- if( pInStream )
+ if( pImp->m_pInStream )
{
CreateTempFile( false );
pImp->bIsTemp = true;
@@ -718,8 +720,8 @@ sal_Bool SfxMedium::Commit()
StorageCommit_Impl();
else if( pImp->m_pOutStream )
pImp->m_pOutStream->Flush();
- else if( pInStream )
- pInStream->Flush();
+ else if( pImp->m_pInStream )
+ pImp->m_pInStream->Flush();
if ( GetError() == SVSTREAM_OK )
{
@@ -759,8 +761,8 @@ sal_Bool SfxMedium::IsStorage()
}
else if ( GetInStream() )
{
- pImp->bIsStorage = SotStorage::IsStorageFile( pInStream ) && !SotStorage::IsOLEStorage( pInStream );
- if ( !pInStream->GetError() && !pImp->bIsStorage )
+ pImp->bIsStorage = SotStorage::IsStorageFile( pImp->m_pInStream ) && !SotStorage::IsOLEStorage( pImp->m_pInStream );
+ if ( !pImp->m_pInStream->GetError() && !pImp->bIsStorage )
pImp->m_bTriedStorage = true;
}
@@ -830,7 +832,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetOutputStorage()
return pImp->xStorage;
// if necessary close stream that was used for reading
- if ( pInStream && !pInStream->IsWritable() )
+ if ( pImp->m_pInStream && !pImp->m_pInStream->IsWritable() )
CloseInStream();
DBG_ASSERT( !pImp->m_pOutStream, "OutStream in a readonly Medium?!" );
@@ -1314,8 +1316,8 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf
if( ( pImp->nLastStorageError = GetError() ) != SVSTREAM_OK )
{
pImp->xStorage = 0;
- if ( pInStream )
- pInStream->Seek(0);
+ if ( pImp->m_pInStream )
+ pImp->m_pInStream->Seek(0);
return uno::Reference< embed::XStorage >();
}
@@ -1391,8 +1393,8 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf
if ( bResetStorage )
{
pImp->xStorage = 0;
- if ( pInStream )
- pInStream->Seek( 0L );
+ if ( pImp->m_pInStream )
+ pImp->m_pInStream->Seek( 0L );
}
pImp->bIsStorage = pImp->xStorage.is();
@@ -2249,7 +2251,7 @@ void SfxMedium::GetLockingStream_Impl()
//----------------------------------------------------------------
void SfxMedium::GetMedium_Impl()
{
- if ( !pInStream )
+ if ( !pImp->m_pInStream )
{
pImp->bDownloadDone = false;
Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler();
@@ -2361,9 +2363,9 @@ void SfxMedium::GetMedium_Impl()
if ( !GetError() )
{
if ( pImp->xStream.is() )
- pInStream = utl::UcbStreamHelper::CreateStream( pImp->xStream );
+ pImp->m_pInStream = utl::UcbStreamHelper::CreateStream( pImp->xStream );
else if ( pImp->xInputStream.is() )
- pInStream = utl::UcbStreamHelper::CreateStream( pImp->xInputStream );
+ pImp->m_pInStream = utl::UcbStreamHelper::CreateStream( pImp->xInputStream );
}
pImp->bDownloadDone = true;
@@ -2420,7 +2422,7 @@ void SfxMedium::DownLoad( const Link& aLink )
{
SetDoneLink( aLink );
GetInStream();
- if ( pInStream && !aLink.IsSet() )
+ if ( pImp->m_pInStream && !aLink.IsSet() )
{
while( !pImp->bDownloadDone )
Application::Yield();
@@ -2513,7 +2515,6 @@ void SfxMedium::Init_Impl()
SfxMedium::SfxMedium() :
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
- pInStream(0),
pImp(new SfxMedium_Impl( this ))
{
Init_Impl();
@@ -2862,7 +2863,6 @@ void SfxMedium::CompleteReOpen()
SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter *pFlt, SfxItemSet *pInSet) :
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
- pInStream(0),
pImp(new SfxMedium_Impl( this ))
{
pImp->m_pSet = pInSet;
@@ -2876,7 +2876,6 @@ SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter
SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) :
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
- pInStream(0),
pImp(new SfxMedium_Impl( this ))
{
SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() );
@@ -2932,7 +2931,6 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const String& rBaseURL, const SfxItemSet* p, sal_Bool bRootP ) :
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
- pInStream(0),
pImp( new SfxMedium_Impl( this ))
{
pImp->m_bRoot = bRootP;
@@ -2954,7 +2952,6 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const String& rBaseURL, const String& rTypeName, const SfxItemSet* p, sal_Bool bRootP ) :
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
- pInStream(0),
pImp( new SfxMedium_Impl( this ))
{
pImp->m_bRoot = bRootP;
@@ -3040,9 +3037,9 @@ sal_Bool SfxMedium::IsExpired() const
void SfxMedium::ForceSynchronStream_Impl( sal_Bool bForce )
{
- if( pInStream )
+ if( pImp->m_pInStream )
{
- SvLockBytes* pBytes = pInStream->GetLockBytes();
+ SvLockBytes* pBytes = pImp->m_pInStream->GetLockBytes();
if( pBytes )
pBytes->SetSynchronMode( bForce );
}
@@ -3370,7 +3367,7 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
}
}
- if ( !bTransferSuccess && pInStream )
+ if ( !bTransferSuccess && pImp->m_pInStream )
{
// the case when there is no URL-access available or this is a remote protocoll
// but there is an input stream
@@ -3380,13 +3377,13 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
char *pBuf = new char [8192];
sal_uInt32 nErr = ERRCODE_NONE;
- pInStream->Seek(0);
+ pImp->m_pInStream->Seek(0);
pImp->m_pOutStream->Seek(0);
- while( !pInStream->IsEof() && nErr == ERRCODE_NONE )
+ while( !pImp->m_pInStream->IsEof() && nErr == ERRCODE_NONE )
{
- sal_uInt32 nRead = pInStream->Read( pBuf, 8192 );
- nErr = pInStream->GetError();
+ sal_uInt32 nRead = pImp->m_pInStream->Read( pBuf, 8192 );
+ nErr = pImp->m_pInStream->GetError();
pImp->m_pOutStream->Write( pBuf, nRead );
}
@@ -3576,7 +3573,7 @@ sal_Bool SfxMedium::HasStorage_Impl() const
sal_Bool SfxMedium::IsOpen() const
{
- return pInStream || pImp->m_pOutStream || pImp->xStorage.is();
+ return pImp->m_pInStream || pImp->m_pOutStream || pImp->xStorage.is();
}
::rtl::OUString SfxMedium::CreateTempCopyWithExt( const ::rtl::OUString& aURL )
commit 0f7d309206dede28692f6e99b00579ebf3240351
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 12:28:35 2012 -0400
Move pOutStream to Impl.
Change-Id: Ifc0d7a1f2002de590a2efc6b4b6a61c257ab0181
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 2121bbc..35077f4 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -72,7 +72,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
INetURLObject* pURLObj;
SvGlobalName aFilterClass;
SvStream* pInStream;
- SvStream* pOutStream;
SfxMedium_Impl* pImp;
#if _SOLAR__PRIVATE
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index ae788ac..d73d8d6 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -277,6 +277,7 @@ public:
mutable SfxItemSet* m_pSet;
const SfxFilter* m_pFilter;
SfxMedium* pAntiImpl;
+ SvStream* m_pOutStream;
long nFileVersion;
@@ -347,6 +348,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
m_pSet(NULL),
m_pFilter(NULL),
pAntiImpl( pAntiImplP ),
+ m_pOutStream(NULL),
nFileVersion( 0 ),
pOrigFilter( 0 ),
aExpireTime( Date( Date::SYSTEM ) + 10, Time( Time::SYSTEM ) ),
@@ -375,8 +377,8 @@ void SfxMedium::ResetError()
pImp->m_eError = SVSTREAM_OK;
if( pInStream )
pInStream->ResetError();
- if( pOutStream )
- pOutStream->ResetError();
+ if( pImp->m_pOutStream )
+ pImp->m_pOutStream->ResetError();
}
//------------------------------------------------------------------
@@ -418,8 +420,8 @@ sal_uInt32 SfxMedium::GetErrorCode() const
sal_uInt32 lError = pImp->m_eError;
if(!lError && pInStream)
lError=pInStream->GetErrorCode();
- if(!lError && pOutStream)
- lError=pOutStream->GetErrorCode();
+ if(!lError && pImp->m_pOutStream)
+ lError = pImp->m_pOutStream->GetErrorCode();
return lError;
}
@@ -620,7 +622,7 @@ void SfxMedium::CloseInStream_Impl()
CloseZipStorage_Impl();
pImp->xInputStream = uno::Reference< io::XInputStream >();
- if ( !pOutStream )
+ if ( !pImp->m_pOutStream )
{
// output part of the stream is not used so the whole stream can be closed
// TODO/LATER: is it correct?
@@ -633,7 +635,7 @@ void SfxMedium::CloseInStream_Impl()
//------------------------------------------------------------------
SvStream* SfxMedium::GetOutStream()
{
- if ( !pOutStream )
+ if ( !pImp->m_pOutStream )
{
// Create a temp. file if there is none because we always
// need one.
@@ -641,12 +643,12 @@ SvStream* SfxMedium::GetOutStream()
if ( pImp->pTempFile )
{
- pOutStream = new SvFileStream( pImp->m_aName, STREAM_STD_READWRITE );
+ pImp->m_pOutStream = new SvFileStream( pImp->m_aName, STREAM_STD_READWRITE );
CloseStorage();
}
}
- return pOutStream;
+ return pImp->m_pOutStream;
}
//------------------------------------------------------------------
@@ -658,7 +660,7 @@ sal_Bool SfxMedium::CloseOutStream()
sal_Bool SfxMedium::CloseOutStream_Impl()
{
- if ( pOutStream )
+ if ( pImp->m_pOutStream )
{
// if there is a storage based on the OutStream, we have to
// close the storage, too, because otherwise the storage
@@ -670,8 +672,8 @@ sal_Bool SfxMedium::CloseOutStream_Impl()
CloseStorage();
}
- delete pOutStream;
- pOutStream = NULL;
+ delete pImp->m_pOutStream;
+ pImp->m_pOutStream = NULL;
}
if ( !pInStream )
@@ -714,8 +716,8 @@ sal_Bool SfxMedium::Commit()
{
if( pImp->xStorage.is() )
StorageCommit_Impl();
- else if( pOutStream )
- pOutStream->Flush();
+ else if( pImp->m_pOutStream )
+ pImp->m_pOutStream->Flush();
else if( pInStream )
pInStream->Flush();
@@ -831,7 +833,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetOutputStorage()
if ( pInStream && !pInStream->IsWritable() )
CloseInStream();
- DBG_ASSERT( !pOutStream, "OutStream in a readonly Medium?!" );
+ DBG_ASSERT( !pImp->m_pOutStream, "OutStream in a readonly Medium?!" );
// TODO/LATER: The current solution is to store the document temporary and then copy it to the target location;
// in future it should be stored directly and then copied to the temporary location, since in this case no
@@ -1081,7 +1083,7 @@ bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
// TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem
// if system lock is used the writeable stream should be available
- bool bHandleSysLocked = ( bLoading && bUseSystemLock && !pImp->xStream.is() && !pOutStream );
+ bool bHandleSysLocked = ( bLoading && bUseSystemLock && !pImp->xStream.is() && !pImp->m_pOutStream );
do
{
@@ -2512,7 +2514,6 @@ SfxMedium::SfxMedium() :
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
pInStream(0),
- pOutStream(0),
pImp(new SfxMedium_Impl( this ))
{
Init_Impl();
@@ -2862,7 +2863,6 @@ SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
pInStream(0),
- pOutStream(0),
pImp(new SfxMedium_Impl( this ))
{
pImp->m_pSet = pInSet;
@@ -2877,7 +2877,6 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
pInStream(0),
- pOutStream(0),
pImp(new SfxMedium_Impl( this ))
{
SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() );
@@ -2934,7 +2933,6 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
pInStream(0),
- pOutStream(0),
pImp( new SfxMedium_Impl( this ))
{
pImp->m_bRoot = bRootP;
@@ -2957,7 +2955,6 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
pInStream(0),
- pOutStream(0),
pImp( new SfxMedium_Impl( this ))
{
pImp->m_bRoot = bRootP;
@@ -3378,19 +3375,19 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
// the case when there is no URL-access available or this is a remote protocoll
// but there is an input stream
GetOutStream();
- if ( pOutStream )
+ if ( pImp->m_pOutStream )
{
char *pBuf = new char [8192];
sal_uInt32 nErr = ERRCODE_NONE;
pInStream->Seek(0);
- pOutStream->Seek(0);
+ pImp->m_pOutStream->Seek(0);
while( !pInStream->IsEof() && nErr == ERRCODE_NONE )
{
sal_uInt32 nRead = pInStream->Read( pBuf, 8192 );
nErr = pInStream->GetError();
- pOutStream->Write( pBuf, nRead );
+ pImp->m_pOutStream->Write( pBuf, nRead );
}
bTransferSuccess = true;
@@ -3579,7 +3576,7 @@ sal_Bool SfxMedium::HasStorage_Impl() const
sal_Bool SfxMedium::IsOpen() const
{
- return pInStream || pOutStream || pImp->xStorage.is();
+ return pInStream || pImp->m_pOutStream || pImp->xStorage.is();
}
::rtl::OUString SfxMedium::CreateTempCopyWithExt( const ::rtl::OUString& aURL )
commit ead20e683c11cbc028de34bc475e8fa056cb7431
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 12:23:29 2012 -0400
Move m_xInputStreamToLoadFrom to Impl.
Change-Id: I5d4c3976386570cc2688951178b42f7f3fae06b7
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index aca768c..2121bbc 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -75,9 +75,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
SvStream* pOutStream;
SfxMedium_Impl* pImp;
- com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
- m_xInputStreamToLoadFrom;
-
#if _SOLAR__PRIVATE
SAL_DLLPRIVATE void SetIsRemote_Impl();
SAL_DLLPRIVATE void CloseInStream_Impl();
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index e3969c9..ae788ac 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -272,6 +272,7 @@ public:
OUString m_aLongName;
uno::Reference < embed::XStorage > xStorage;
+ uno::Reference<io::XInputStream> m_xInputStreamToLoadFrom;
mutable SfxItemSet* m_pSet;
const SfxFilter* m_pFilter;
@@ -2295,9 +2296,9 @@ void SfxMedium::GetMedium_Impl()
GetItemSet()->Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, makeAny(xInteractionHandler) ) );
}
- if ( m_xInputStreamToLoadFrom.is() )
+ if ( pImp->m_xInputStreamToLoadFrom.is() )
{
- pImp->xInputStream = m_xInputStreamToLoadFrom;
+ pImp->xInputStream = pImp->m_xInputStreamToLoadFrom;
pImp->xInputStream->skipBytes(0);
if (pImp->m_bInputStreamIsReadOnly)
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
@@ -3059,7 +3060,7 @@ SfxFrame* SfxMedium::GetLoadTargetFrame() const
void SfxMedium::setStreamToLoadFrom(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly )
{
- m_xInputStreamToLoadFrom = xInputStream;
+ pImp->m_xInputStreamToLoadFrom = xInputStream;
pImp->m_bInputStreamIsReadOnly = bIsReadOnly;
}
commit e8853ab77b0a3b57848f0b0283d3c3ccef0837d5
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 12:17:43 2012 -0400
Move pFilter to Impl.
Change-Id: Ie01649da353a170de67be43d2111a0cc3b3039a2
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index bd2a28d..aca768c 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -73,7 +73,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
SvGlobalName aFilterClass;
SvStream* pInStream;
SvStream* pOutStream;
- const SfxFilter* pFilter;
SfxMedium_Impl* pImp;
com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
@@ -134,7 +133,7 @@ public:
void SetReferer( const String& rRefer );
void SetFilter(const SfxFilter *pFlt, sal_Bool bResetOrig = sal_False);
- const SfxFilter * GetFilter() const { return pFilter; }
+ const SfxFilter* GetFilter() const;
const SfxFilter * GetOrigFilter( sal_Bool bNotCurrent = sal_False ) const;
const rtl::OUString& GetOrigURL() const;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index b5eed5d..e3969c9 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -274,6 +274,7 @@ public:
uno::Reference < embed::XStorage > xStorage;
mutable SfxItemSet* m_pSet;
+ const SfxFilter* m_pFilter;
SfxMedium* pAntiImpl;
long nFileVersion;
@@ -343,6 +344,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
m_bRemote(false),
m_bInputStreamIsReadOnly(false),
m_pSet(NULL),
+ m_pFilter(NULL),
pAntiImpl( pAntiImplP ),
nFileVersion( 0 ),
pOrigFilter( 0 ),
@@ -2510,7 +2512,6 @@ SfxMedium::SfxMedium() :
pURLObj(0),
pInStream(0),
pOutStream(0),
- pFilter(0),
pImp(new SfxMedium_Impl( this ))
{
Init_Impl();
@@ -2564,15 +2565,20 @@ SfxMedium::GetInteractionHandler()
void SfxMedium::SetFilter( const SfxFilter* pFilterP, sal_Bool /*bResetOrig*/ )
{
- pFilter = pFilterP;
+ pImp->m_pFilter = pFilterP;
pImp->nFileVersion = 0;
}
+const SfxFilter* SfxMedium::GetFilter() const
+{
+ return pImp->m_pFilter;
+}
+
//----------------------------------------------------------------
const SfxFilter* SfxMedium::GetOrigFilter( sal_Bool bNotCurrent ) const
{
- return ( pImp->pOrigFilter || bNotCurrent ) ? pImp->pOrigFilter : pFilter;
+ return ( pImp->pOrigFilter || bNotCurrent ) ? pImp->pOrigFilter : pImp->m_pFilter;
}
//----------------------------------------------------------------
@@ -2856,10 +2862,10 @@ SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter
pURLObj(0),
pInStream(0),
pOutStream(0),
- pFilter(pFlt),
pImp(new SfxMedium_Impl( this ))
{
pImp->m_pSet = pInSet;
+ pImp->m_pFilter = pFlt;
pImp->m_aLogicName = rName;
nStorOpenMode = nOpenMode;
Init_Impl();
@@ -2871,7 +2877,6 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
pURLObj(0),
pInStream(0),
pOutStream(0),
- pFilter(0),
pImp(new SfxMedium_Impl( this ))
{
SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() );
@@ -2882,7 +2887,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
SFX_ITEMSET_ARG( pImp->m_pSet, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, false );
if( pFilterNameItem )
aFilterName = pFilterNameItem->GetValue();
- pFilter = SFX_APP()->GetFilterMatcher().GetFilter4FilterName( aFilterName );
+ pImp->m_pFilter = SFX_APP()->GetFilterMatcher().GetFilter4FilterName( aFilterName );
SFX_ITEMSET_ARG( pImp->m_pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, false );
if( pSalvageItem )
@@ -2934,8 +2939,8 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
pImp->m_bRoot = bRootP;
String aType = SfxFilter::GetTypeFromStorage( rStor );
- pFilter = SFX_APP()->GetFilterMatcher().GetFilter4EA( aType );
- DBG_ASSERT( pFilter, "No Filter for storage found!" );
+ pImp->m_pFilter = SFX_APP()->GetFilterMatcher().GetFilter4EA( aType );
+ DBG_ASSERT( pImp->m_pFilter, "No Filter for storage found!" );
Init_Impl();
pImp->xStorage = rStor;
@@ -2956,8 +2961,8 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
{
pImp->m_bRoot = bRootP;
- pFilter = SFX_APP()->GetFilterMatcher().GetFilter4EA( rTypeName );
- DBG_ASSERT( pFilter, "No Filter for storage found!" );
+ pImp->m_pFilter = SFX_APP()->GetFilterMatcher().GetFilter4EA( rTypeName );
+ DBG_ASSERT( pImp->m_pFilter, "No Filter for storage found!" );
Init_Impl();
pImp->xStorage = rStor;
@@ -2992,8 +2997,6 @@ SfxMedium::~SfxMedium()
}
}
- pFilter = 0;
-
delete pURLObj;
delete pImp;
}
@@ -3256,8 +3259,8 @@ sal_Bool SfxMedium::IsReadOnly()
// a) ReadOnly filter cant produce read/write contents!
bReadOnly = (
- (pFilter ) &&
- ((pFilter->GetFilterFlags() & SFX_FILTER_OPENREADONLY) == SFX_FILTER_OPENREADONLY)
+ (pImp->m_pFilter ) &&
+ ((pImp->m_pFilter->GetFilterFlags() & SFX_FILTER_OPENREADONLY) == SFX_FILTER_OPENREADONLY)
);
// b) if filter allow read/write contents .. check open mode of the storage
commit c598be10c637d93d23c65b369261b88bc4e1429e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 12:04:51 2012 -0400
Move pSet to Impl.
Change-Id: Ibd7149fd643a747b09d14a003bdfcfa4077e8fe0
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index b0a116c..bd2a28d 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -74,7 +74,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
SvStream* pInStream;
SvStream* pOutStream;
const SfxFilter* pFilter;
- SfxItemSet* pSet;
SfxMedium_Impl* pImp;
com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index c28c80a..b5eed5d 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -273,6 +273,7 @@ public:
uno::Reference < embed::XStorage > xStorage;
+ mutable SfxItemSet* m_pSet;
SfxMedium* pAntiImpl;
long nFileVersion;
@@ -341,6 +342,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
m_bTriedStorage(false),
m_bRemote(false),
m_bInputStreamIsReadOnly(false),
+ m_pSet(NULL),
pAntiImpl( pAntiImplP ),
nFileVersion( 0 ),
pOrigFilter( 0 ),
@@ -361,6 +363,8 @@ SfxMedium_Impl::~SfxMedium_Impl()
if ( pTempFile )
delete pTempFile;
+
+ delete m_pSet;
}
void SfxMedium::ResetError()
@@ -489,7 +493,7 @@ Reference < XContent > SfxMedium::GetContent() const
Reference < ::com::sun::star::ucb::XContent > xContent;
Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- SFX_ITEMSET_ARG( pSet, pItem, SfxUnoAnyItem, SID_CONTENT, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pItem, SfxUnoAnyItem, SID_CONTENT, false);
if ( pItem )
pItem->GetValue() >>= xContent;
@@ -607,8 +611,8 @@ void SfxMedium::CloseInStream_Impl()
}
DELETEZ( pInStream );
- if ( pSet )
- pSet->ClearItem( SID_INPUTSTREAM );
+ if ( pImp->m_pSet )
+ pImp->m_pSet->ClearItem( SID_INPUTSTREAM );
CloseZipStorage_Impl();
pImp->xInputStream = uno::Reference< io::XInputStream >();
@@ -618,8 +622,8 @@ void SfxMedium::CloseInStream_Impl()
// output part of the stream is not used so the whole stream can be closed
// TODO/LATER: is it correct?
pImp->xStream = uno::Reference< io::XStream >();
- if ( pSet )
- pSet->ClearItem( SID_STREAM );
+ if ( pImp->m_pSet )
+ pImp->m_pSet->ClearItem( SID_STREAM );
}
}
@@ -672,8 +676,8 @@ sal_Bool SfxMedium::CloseOutStream_Impl()
// input part of the stream is not used so the whole stream can be closed
// TODO/LATER: is it correct?
pImp->xStream = uno::Reference< io::XStream >();
- if ( pSet )
- pSet->ClearItem( SID_STREAM );
+ if ( pImp->m_pSet )
+ pImp->m_pSet->ClearItem( SID_STREAM );
}
return true;
@@ -838,14 +842,14 @@ uno::Reference < embed::XStorage > SfxMedium::GetOutputStorage()
void SfxMedium::SetEncryptionDataToStorage_Impl()
{
// in case media-descriptor contains password it should be used on opening
- if ( pImp->xStorage.is() && pSet )
+ if ( pImp->xStorage.is() && pImp->m_pSet )
{
uno::Sequence< beans::NamedValue > aEncryptionData;
- if ( GetEncryptionData_Impl( pSet, aEncryptionData ) )
+ if ( GetEncryptionData_Impl( pImp->m_pSet, aEncryptionData ) )
{
// replace the password with encryption data
- pSet->ClearItem( SID_PASSWORD );
- pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) );
+ pImp->m_pSet->ClearItem( SID_PASSWORD );
+ pImp->m_pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) );
try
{
@@ -1204,7 +1208,7 @@ bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
{
// the error should be set in case it is storing process
// or the document has been opened for editing explicitly
- SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, false );
+ SFX_ITEMSET_ARG( pImp->m_pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, false );
if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) )
SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( OSL_LOG_PREFIX ) );
@@ -1319,7 +1323,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf
GetVersionList();
}
- SFX_ITEMSET_ARG( pSet, pVersion, SfxInt16Item, SID_VERSION, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pVersion, SfxInt16Item, SID_VERSION, false);
bool bResetStorage = false;
if ( pVersion && pVersion->GetValue() )
@@ -1797,7 +1801,7 @@ void SfxMedium::Transfer_Impl()
if (pImp->m_aLogicName.compareToAscii("private:stream", 14) == 0)
{
// TODO/LATER: support storing to SID_STREAM
- SFX_ITEMSET_ARG( pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
if( pOutStreamItem && ( pOutStreamItem->GetValue() >>= rOutStream ) )
{
if ( pImp->xStorage.is() )
@@ -1848,8 +1852,8 @@ void SfxMedium::Transfer_Impl()
}
// free the reference
- if ( pSet )
- pSet->ClearItem( SID_OUTPUTSTREAM );
+ if ( pImp->m_pSet )
+ pImp->m_pSet->ClearItem( SID_OUTPUTSTREAM );
return;
}
@@ -2204,7 +2208,7 @@ void SfxMedium::GetLockingStream_Impl()
if ( ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
&& !pImp->m_xLockingStream.is() )
{
- SFX_ITEMSET_ARG( pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, false);
if ( pWriteStreamItem )
pWriteStreamItem->GetValue() >>= pImp->m_xLockingStream;
@@ -2246,8 +2250,8 @@ void SfxMedium::GetMedium_Impl()
Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler();
//TODO/MBA: need support for SID_STREAM
- SFX_ITEMSET_ARG( pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, false);
- SFX_ITEMSET_ARG( pSet, pInStreamItem, SfxUnoAnyItem, SID_INPUTSTREAM, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pInStreamItem, SfxUnoAnyItem, SID_INPUTSTREAM, false);
if ( pWriteStreamItem )
{
pWriteStreamItem->GetValue() >>= pImp->xStream;
@@ -2432,11 +2436,11 @@ void SfxMedium::Init_Impl()
// TODO/LATER: handle lifetime of storages
pImp->bDisposeStorage = false;
- SFX_ITEMSET_ARG( pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, false);
if ( pSalvageItem && !pSalvageItem->GetValue().Len() )
{
pSalvageItem = NULL;
- pSet->ClearItem( SID_DOC_SALVAGE );
+ pImp->m_pSet->ClearItem( SID_DOC_SALVAGE );
}
if (!pImp->m_aLogicName.isEmpty())
@@ -2475,19 +2479,19 @@ void SfxMedium::Init_Impl()
// in case output stream is by mistake here
// clear the reference
- SFX_ITEMSET_ARG( pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
if( pOutStreamItem
&& ( !( pOutStreamItem->GetValue() >>= rOutStream )
|| (pImp->m_aLogicName.compareToAscii("private:stream", 14) == 0)) )
{
- pSet->ClearItem( SID_OUTPUTSTREAM );
+ pImp->m_pSet->ClearItem( SID_OUTPUTSTREAM );
OSL_FAIL( "Unexpected Output stream parameter!\n" );
}
if (!pImp->m_aLogicName.isEmpty())
{
// if the logic name is set it should be set in MediaDescriptor as well
- SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
+ SFX_ITEMSET_ARG( pImp->m_pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
if ( !pFileNameItem )
{
// let the ItemSet be created if necessary
@@ -2507,7 +2511,6 @@ SfxMedium::SfxMedium() :
pInStream(0),
pOutStream(0),
pFilter(0),
- pSet(0),
pImp(new SfxMedium_Impl( this ))
{
Init_Impl();
@@ -2530,10 +2533,10 @@ SfxMedium::GetInteractionHandler()
return ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >();
// search a possible existing handler inside cached item set
- if ( pSet )
+ if ( pImp->m_pSet )
{
::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > xHandler;
- SFX_ITEMSET_ARG( pSet, pHandler, SfxUnoAnyItem, SID_INTERACTIONHANDLER, false);
+ SFX_ITEMSET_ARG( pImp->m_pSet, pHandler, SfxUnoAnyItem, SID_INTERACTIONHANDLER, false);
if ( pHandler && (pHandler->GetValue() >>= xHandler) && xHandler.is() )
return xHandler;
}
@@ -2725,8 +2728,8 @@ void SfxMedium::CloseStreams_Impl()
CloseInStream_Impl();
CloseOutStream_Impl();
- if ( pSet )
- pSet->ClearItem( SID_CONTENT );
+ if ( pImp->m_pSet )
+ pImp->m_pSet->ClearItem( SID_CONTENT );
pImp->aContent = ::ucbhelper::Content();
}
@@ -2854,9 +2857,9 @@ SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter
pInStream(0),
pOutStream(0),
pFilter(pFlt),
- pSet( pInSet ),
pImp(new SfxMedium_Impl( this ))
{
+ pImp->m_pSet = pInSet;
pImp->m_aLogicName = rName;
nStorOpenMode = nOpenMode;
Init_Impl();
@@ -2869,20 +2872,19 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
pInStream(0),
pOutStream(0),
pFilter(0),
- pSet(0),
pImp(new SfxMedium_Impl( this ))
{
SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() );
- pSet = pParams;
+ pImp->m_pSet = pParams;
TransformParameters( SID_OPENDOC, aArgs, *pParams );
String aFilterName;
- SFX_ITEMSET_ARG( pSet, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, false );
+ SFX_ITEMSET_ARG( pImp->m_pSet, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, false );
if( pFilterNameItem )
aFilterName = pFilterNameItem->GetValue();
pFilter = SFX_APP()->GetFilterMatcher().GetFilter4FilterName( aFilterName );
- SFX_ITEMSET_ARG( pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, false );
+ SFX_ITEMSET_ARG( pImp->m_pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, false );
if( pSalvageItem )
{
// QUESTION: there is some treatment of Salvage in Init_Impl; align!
@@ -2891,15 +2893,15 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
// if an URL is provided in SalvageItem that means that the FileName refers to a temporary file
// that must be copied here
- SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
+ SFX_ITEMSET_ARG( pImp->m_pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
if (!pFileNameItem) throw uno::RuntimeException();
::rtl::OUString aNewTempFileURL = SfxMedium::CreateTempCopyWithExt( pFileNameItem->GetValue() );
if ( !aNewTempFileURL.isEmpty() )
{
- pSet->Put( SfxStringItem( SID_FILE_NAME, aNewTempFileURL ) );
- pSet->ClearItem( SID_INPUTSTREAM );
- pSet->ClearItem( SID_STREAM );
- pSet->ClearItem( SID_CONTENT );
+ pImp->m_pSet->Put( SfxStringItem( SID_FILE_NAME, aNewTempFileURL ) );
+ pImp->m_pSet->ClearItem( SID_INPUTSTREAM );
+ pImp->m_pSet->ClearItem( SID_STREAM );
+ pImp->m_pSet->ClearItem( SID_CONTENT );
}
else
{
@@ -2908,11 +2910,11 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
}
}
- SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, false );
+ SFX_ITEMSET_ARG( pImp->m_pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, false );
if ( pReadOnlyItem && pReadOnlyItem->GetValue() )
pImp->m_bOriginallyReadOnly = true;
- SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
+ SFX_ITEMSET_ARG( pImp->m_pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
if (!pFileNameItem) throw uno::RuntimeException();
pImp->m_aLogicName = pFileNameItem->GetValue();
nStorOpenMode = pImp->m_bOriginallyReadOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE;
@@ -2927,7 +2929,6 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
pURLObj(0),
pInStream(0),
pOutStream(0),
- pSet(0),
pImp( new SfxMedium_Impl( this ))
{
pImp->m_bRoot = bRootP;
@@ -2951,7 +2952,6 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str
pURLObj(0),
pInStream(0),
pOutStream(0),
- pSet(0),
pImp( new SfxMedium_Impl( this ))
{
pImp->m_bRoot = bRootP;
@@ -2978,8 +2978,6 @@ SfxMedium::~SfxMedium()
Close();
- delete pSet;
-
if( pImp->bIsTemp && !pImp->m_aName.isEmpty() )
{
rtl::OUString aTemp;
@@ -3077,9 +3075,9 @@ void SfxMedium::SetStorage_Impl( const uno::Reference < embed::XStorage >& rStor
SfxItemSet* SfxMedium::GetItemSet() const
{
// this method *must* return an ItemSet, returning NULL can cause crashes
- if( !pSet )
- ((SfxMedium*)this)->pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
- return pSet;
+ if (!pImp->m_pSet)
+ pImp->m_pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
+ return pImp->m_pSet;
}
//----------------------------------------------------------------
@@ -3682,7 +3680,7 @@ sal_Bool SfxMedium::CallApproveHandler( const uno::Reference< task::XInteraction
// remove the readonly state
bool bWasReadonly = false;
nStorOpenMode = SFX_STREAM_READWRITE;
- SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, false );
+ SFX_ITEMSET_ARG( pImp->m_pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, false );
if ( pReadOnlyItem && pReadOnlyItem->GetValue() )
bWasReadonly = true;
GetItemSet()->ClearItem( SID_DOC_READONLY );
commit f9ac1ab1e95055cd07ee4b9d47b0795469bf67a8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 11:46:53 2012 -0400
Move error code and long name to Impl.
Change-Id: I81e519469063376c842d0c4becc30fb4fc52f80f
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 9deeb32..b0a116c 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -68,7 +68,6 @@ class DateTime;
class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
{
- sal_uInt32 eError;
StreamMode nStorOpenMode;
INetURLObject* pURLObj;
SvGlobalName aFilterClass;
@@ -77,7 +76,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
const SfxFilter* pFilter;
SfxItemSet* pSet;
SfxMedium_Impl* pImp;
- rtl::OUString aLongName;
com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
m_xInputStreamToLoadFrom;
@@ -254,9 +252,8 @@ public:
SAL_DLLPRIVATE void SetUpdatePickList(sal_Bool);
SAL_DLLPRIVATE sal_Bool IsUpdatePickList() const;
- SAL_DLLPRIVATE void SetLongName(const rtl::OUString &rName)
- { aLongName = rName; }
- SAL_DLLPRIVATE const rtl::OUString & GetLongName() const { return aLongName; }
+ SAL_DLLPRIVATE void SetLongName(const rtl::OUString &rName);
+ SAL_DLLPRIVATE const rtl::OUString & GetLongName() const;
SAL_DLLPRIVATE ErrCode CheckOpenMode_Impl( sal_Bool bSilent, sal_Bool bAllowRO = sal_True );
SAL_DLLPRIVATE sal_Bool IsPreview_Impl();
SAL_DLLPRIVATE void ClearBackup_Impl();
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 1341de8..c28c80a 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -242,6 +242,8 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Referenc
class SfxMedium_Impl
{
public:
+ sal_uInt32 m_eError;
+
::ucbhelper::Content aContent;
bool bUpdatePickList:1;
bool bIsTemp:1;
@@ -267,6 +269,7 @@ public:
OUString m_aName;
OUString m_aLogicName;
+ OUString m_aLongName;
uno::Reference < embed::XStorage > xStorage;
@@ -316,8 +319,9 @@ public:
};
//------------------------------------------------------------------
-SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP )
- : bUpdatePickList(true),
+SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
+ m_eError(SVSTREAM_OK),
+ bUpdatePickList(true),
bIsTemp( false ),
bForceSynchron( false ),
bDownloadDone( true ),
@@ -361,7 +365,7 @@ SfxMedium_Impl::~SfxMedium_Impl()
void SfxMedium::ResetError()
{
- eError = SVSTREAM_OK;
+ pImp->m_eError = SVSTREAM_OK;
if( pInStream )
pInStream->ResetError();
if( pOutStream )
@@ -396,15 +400,15 @@ void SfxMedium::AddLog( const ::rtl::OUString& aMessage )
//------------------------------------------------------------------
void SfxMedium::SetError( sal_uInt32 nError, const ::rtl::OUString& aLogMessage )
{
- eError = nError;
- if ( eError != ERRCODE_NONE && !aLogMessage.isEmpty() )
+ pImp->m_eError = nError;
+ if ( pImp->m_eError != ERRCODE_NONE && !aLogMessage.isEmpty() )
AddLog( aLogMessage );
}
//------------------------------------------------------------------
sal_uInt32 SfxMedium::GetErrorCode() const
{
- sal_uInt32 lError=eError;
+ sal_uInt32 lError = pImp->m_eError;
if(!lError && pInStream)
lError=pInStream->GetErrorCode();
if(!lError && pOutStream)
@@ -558,12 +562,12 @@ SvStream* SfxMedium::GetInStream()
{
pInStream = new SvFileStream( pImp->m_aName, nStorOpenMode );
- eError = pInStream->GetError();
+ pImp->m_eError = pInStream->GetError();
- if( !eError && (nStorOpenMode & STREAM_WRITE)
+ if( !pImp->m_eError && (nStorOpenMode & STREAM_WRITE)
&& ! pInStream->IsWritable() )
{
- eError = ERRCODE_IO_ACCESSDENIED;
+ pImp->m_eError = ERRCODE_IO_ACCESSDENIED;
delete pInStream;
pInStream = NULL;
}
@@ -1507,7 +1511,7 @@ sal_Bool SfxMedium::UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalCont
// TODO/LATER: a message should be used to let user know about the backup
pImp->m_bRemoveBackup = false;
// TODO/LATER: needs a specific error code
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
}
return false;
@@ -1588,29 +1592,29 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
}
catch ( const ::com::sun::star::ucb::CommandAbortedException& )
{
- eError = ERRCODE_ABORT;
+ pImp->m_eError = ERRCODE_ABORT;
}
catch ( const ::com::sun::star::ucb::CommandFailedException& )
{
- eError = ERRCODE_ABORT;
+ pImp->m_eError = ERRCODE_ABORT;
}
catch (const ::com::sun::star::ucb::ContentCreationException& ex)
{
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
if (
(ex.eError == ::com::sun::star::ucb::ContentCreationError_NO_CONTENT_PROVIDER ) ||
(ex.eError == ::com::sun::star::ucb::ContentCreationError_CONTENT_CREATION_FAILED)
)
{
- eError = ERRCODE_IO_NOTEXISTSPATH;
+ pImp->m_eError = ERRCODE_IO_NOTEXISTSPATH;
}
}
catch (const ::com::sun::star::uno::Exception&)
{
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
}
- if( !eError || (eError & ERRCODE_WARNING_MASK) )
+ if( !pImp->m_eError || (pImp->m_eError & ERRCODE_WARNING_MASK) )
{
if ( pImp->xStorage.is() )
CloseStorage();
@@ -1644,7 +1648,7 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
}
else
{
- eError = ERRCODE_SFX_CANTCREATEBACKUP;
+ pImp->m_eError = ERRCODE_SFX_CANTCREATEBACKUP;
}
}
else
@@ -1656,26 +1660,26 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
}
catch ( const ::com::sun::star::ucb::CommandAbortedException& )
{
- eError = ERRCODE_ABORT;
+ pImp->m_eError = ERRCODE_ABORT;
}
catch ( const ::com::sun::star::ucb::CommandFailedException& )
{
- eError = ERRCODE_ABORT;
+ pImp->m_eError = ERRCODE_ABORT;
}
catch ( const ::com::sun::star::ucb::InteractiveIOException& r )
{
if ( r.Code == IOErrorCode_ACCESS_DENIED )
- eError = ERRCODE_IO_ACCESSDENIED;
+ pImp->m_eError = ERRCODE_IO_ACCESSDENIED;
else if ( r.Code == IOErrorCode_NOT_EXISTING )
- eError = ERRCODE_IO_NOTEXISTS;
+ pImp->m_eError = ERRCODE_IO_NOTEXISTS;
else if ( r.Code == IOErrorCode_CANT_READ )
- eError = ERRCODE_IO_CANTREAD;
+ pImp->m_eError = ERRCODE_IO_CANTREAD;
else
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
}
catch ( const ::com::sun::star::uno::Exception& )
{
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
}
if ( bResult )
@@ -1693,7 +1697,7 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
}
}
else
- eError = ERRCODE_IO_CANTREAD;
+ pImp->m_eError = ERRCODE_IO_CANTREAD;
}
return bResult;
@@ -1781,7 +1785,7 @@ void SfxMedium::Transfer_Impl()
OSL_FAIL( "The medium name is not convertable!\n" );
}
- if ( !aNameURL.isEmpty() && ( !eError || (eError & ERRCODE_WARNING_MASK) ) )
+ if ( !aNameURL.isEmpty() && ( !pImp->m_eError || (pImp->m_eError & ERRCODE_WARNING_MASK) ) )
{
RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mv76033) SfxMedium::Transfer_Impl, copying to target" );
@@ -1853,7 +1857,7 @@ void SfxMedium::Transfer_Impl()
GetContent();
if ( !pImp->aContent.get().is() )
{
- eError = ERRCODE_IO_NOTEXISTS;
+ pImp->m_eError = ERRCODE_IO_NOTEXISTS;
return;
}
@@ -1956,21 +1960,21 @@ void SfxMedium::Transfer_Impl()
}
catch (const ::com::sun::star::ucb::ContentCreationException& ex)
{
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
if (
(ex.eError == ::com::sun::star::ucb::ContentCreationError_NO_CONTENT_PROVIDER ) ||
(ex.eError == ::com::sun::star::ucb::ContentCreationError_CONTENT_CREATION_FAILED)
)
{
- eError = ERRCODE_IO_NOTEXISTSPATH;
+ pImp->m_eError = ERRCODE_IO_NOTEXISTSPATH;
}
}
catch (const ::com::sun::star::uno::Exception&)
{
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
}
- if ( !eError || (eError & ERRCODE_WARNING_MASK) )
+ if ( !pImp->m_eError || (pImp->m_eError & ERRCODE_WARNING_MASK) )
{
// free resources, otherwise the transfer may fail
if ( pImp->xStorage.is() )
@@ -1997,37 +2001,37 @@ void SfxMedium::Transfer_Impl()
try
{
if (!aTransferContent.transferContent( aSourceContent, ::ucbhelper::InsertOperation_COPY, aFileName, nNameClash ))
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
}
catch ( const ::com::sun::star::ucb::CommandAbortedException& )
{
- eError = ERRCODE_ABORT;
+ pImp->m_eError = ERRCODE_ABORT;
}
catch ( const ::com::sun::star::ucb::CommandFailedException& )
{
- eError = ERRCODE_ABORT;
+ pImp->m_eError = ERRCODE_ABORT;
}
catch ( const ::com::sun::star::ucb::InteractiveIOException& r )
{
if ( r.Code == IOErrorCode_ACCESS_DENIED )
- eError = ERRCODE_IO_ACCESSDENIED;
+ pImp->m_eError = ERRCODE_IO_ACCESSDENIED;
else if ( r.Code == IOErrorCode_NOT_EXISTING )
- eError = ERRCODE_IO_NOTEXISTS;
+ pImp->m_eError = ERRCODE_IO_NOTEXISTS;
else if ( r.Code == IOErrorCode_CANT_READ )
- eError = ERRCODE_IO_CANTREAD;
+ pImp->m_eError = ERRCODE_IO_CANTREAD;
else
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
}
catch ( const ::com::sun::star::uno::Exception& )
{
- eError = ERRCODE_IO_GENERAL;
+ pImp->m_eError = ERRCODE_IO_GENERAL;
}
// do not switch from temporary file in case of nonfile protocol
}
}
- if ( ( !eError || (eError & ERRCODE_WARNING_MASK) ) && !pImp->pTempFile )
+ if ( ( !pImp->m_eError || (pImp->m_eError & ERRCODE_WARNING_MASK) ) && !pImp->pTempFile )
{
// without a TempFile the physical and logical name should be the same after successful transfer
::utl::LocalFileHelper::ConvertURLToPhysicalName(
@@ -2165,7 +2169,7 @@ void SfxMedium::DoBackup_Impl()
if ( !bSuccess )
{
- eError = ERRCODE_SFX_CANTCREATEBACKUP;
+ pImp->m_eError = ERRCODE_SFX_CANTCREATEBACKUP;
}
}
@@ -2380,7 +2384,16 @@ sal_Bool SfxMedium::IsUpdatePickList() const
{
return pImp? pImp->bUpdatePickList: true;
}
-//----------------------------------------------------------------
+
+void SfxMedium::SetLongName(const OUString &rName)
+{
+ pImp->m_aLongName = rName;
+}
+
+const OUString& SfxMedium::GetLongName() const
+{
+ return pImp->m_aLongName;
+}
void SfxMedium::SetDoneLink( const Link& rLink )
{
@@ -2489,7 +2502,6 @@ void SfxMedium::Init_Impl()
//------------------------------------------------------------------
SfxMedium::SfxMedium() :
- eError( SVSTREAM_OK ),
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
pInStream(0),
@@ -2837,7 +2849,6 @@ void SfxMedium::CompleteReOpen()
}
SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter *pFlt, SfxItemSet *pInSet) :
- eError( SVSTREAM_OK ),
nStorOpenMode( SFX_STREAM_READWRITE ),
pURLObj(0),
pInStream(0),
commit c44f1e7e5a9effef9281f012d2b3c42974768dd8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 11:31:35 2012 -0400
Move aLogicName into Impl.
Change-Id: Ie11f07aca75a515a2484927ac05ef91d46203640
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index f99d8df..9deeb32 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -77,7 +77,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
const SfxFilter* pFilter;
SfxItemSet* pSet;
SfxMedium_Impl* pImp;
- rtl::OUString aLogicName;
rtl::OUString aLongName;
com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index b0044d5..1341de8 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -266,6 +266,7 @@ public:
bool m_bInputStreamIsReadOnly:1;
OUString m_aName;
+ OUString m_aLogicName;
uno::Reference < embed::XStorage > xStorage;
@@ -458,7 +459,7 @@ sal_Bool SfxMedium::DocNeedsFileDateCheck()
//------------------------------------------------------------------
util::DateTime SfxMedium::GetInitFileDate( sal_Bool bIgnoreOldValue )
{
- if ( ( bIgnoreOldValue || !pImp->m_bGotDateTime ) && !aLogicName.isEmpty() )
+ if ( ( bIgnoreOldValue || !pImp->m_bGotDateTime ) && !pImp->m_aLogicName.isEmpty() )
{
try
{
@@ -504,7 +505,7 @@ Reference < XContent > SfxMedium::GetContent() const
rtl::OUString aURL;
if ( !pImp->m_aName.isEmpty() )
::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aURL );
- else if ( !aLogicName.isEmpty() )
+ else if ( !pImp->m_aLogicName.isEmpty() )
aURL = GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
if (!aURL.isEmpty() )
::ucbhelper::Content::create( aURL, xEnv, pImp->aContent );
@@ -677,7 +678,7 @@ sal_Bool SfxMedium::CloseOutStream_Impl()
//------------------------------------------------------------------
const rtl::OUString& SfxMedium::GetPhysicalName() const
{
- if ( pImp->m_aName.isEmpty() && !aLogicName.isEmpty() )
+ if ( pImp->m_aName.isEmpty() && !pImp->m_aLogicName.isEmpty() )
(( SfxMedium*)this)->CreateFileStream();
// return the name then
@@ -781,7 +782,7 @@ void SfxMedium::StorageBackup_Impl()
::ucbhelper::Content aOriginalContent;
Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv;
- bool bBasedOnOriginalFile = ( !pImp->pTempFile && !( !aLogicName.isEmpty() && pImp->m_bSalvageMode )
+ bool bBasedOnOriginalFile = ( !pImp->pTempFile && !( !pImp->m_aLogicName.isEmpty() && pImp->m_bSalvageMode )
&& !GetURLObject().GetMainURL( INetURLObject::NO_DECODE ).isEmpty()
&& ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
&& ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) );
@@ -812,7 +813,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetOutputStorage()
// if the medium was constructed with a Storage: use this one, not a temp. storage
// if a temporary storage already exists: use it
- if ( pImp->xStorage.is() && ( aLogicName.isEmpty() || pImp->pTempFile ) )
+ if ( pImp->xStorage.is() && ( pImp->m_aLogicName.isEmpty() || pImp->pTempFile ) )
return pImp->xStorage;
// if necessary close stream that was used for reading
@@ -1052,7 +1053,7 @@ bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
if ( !bContentReadonly )
{
// the special file locking should be used only for suitable URLs
- if ( isSuitableProtocolForLocking( aLogicName ) )
+ if ( isSuitableProtocolForLocking( pImp->m_aLogicName ) )
{
// in case of storing the document should request the output before locking
@@ -1065,7 +1066,7 @@ bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
sal_Int8 bUIStatus = LOCK_UI_NOLOCK;
// check whether system file locking has been used, the default value is false
- bool bUseSystemLock = ::utl::LocalFileHelper::IsLocalFile( aLogicName ) && IsSystemFileLockingUsed();
+ bool bUseSystemLock = ::utl::LocalFileHelper::IsLocalFile( pImp->m_aLogicName ) && IsSystemFileLockingUsed();
// TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem
// if system lock is used the writeable stream should be available
@@ -1075,7 +1076,7 @@ bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
{
try
{
- ::svt::DocumentLockFile aLockFile( aLogicName );
+ ::svt::DocumentLockFile aLockFile( pImp->m_aLogicName );
if ( !bHandleSysLocked )
{
try
@@ -1773,7 +1774,7 @@ void SfxMedium::Transfer_Impl()
rtl::OUString aNameURL;
if ( pImp->pTempFile )
aNameURL = pImp->pTempFile->GetURL();
- else if ( !aLogicName.isEmpty() && pImp->m_bSalvageMode )
+ else if ( !pImp->m_aLogicName.isEmpty() && pImp->m_bSalvageMode )
{
// makes sence only in case logic name is set
if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aNameURL ) )
@@ -1789,7 +1790,7 @@ void SfxMedium::Transfer_Impl()
// in case an output stream is provided from outside and the URL is correct
// commit to the stream
- if (aLogicName.compareToAscii("private:stream", 14) == 0)
+ if (pImp->m_aLogicName.compareToAscii("private:stream", 14) == 0)
{
// TODO/LATER: support storing to SID_STREAM
SFX_ITEMSET_ARG( pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
@@ -2425,9 +2426,9 @@ void SfxMedium::Init_Impl()
pSet->ClearItem( SID_DOC_SALVAGE );
}
- if (!aLogicName.isEmpty())
+ if (!pImp->m_aLogicName.isEmpty())
{
- INetURLObject aUrl( aLogicName );
+ INetURLObject aUrl( pImp->m_aLogicName );
INetProtocol eProt = aUrl.GetProtocol();
if ( eProt == INET_PROT_NOT_VALID )
{
@@ -2437,7 +2438,7 @@ void SfxMedium::Init_Impl()
{
if ( aUrl.HasMark() )
{
- aLogicName = aUrl.GetURLNoMark( INetURLObject::NO_DECODE );
+ pImp->m_aLogicName = aUrl.GetURLNoMark( INetURLObject::NO_DECODE );
GetItemSet()->Put( SfxStringItem( SID_JUMPMARK, aUrl.GetMark() ) );
}
@@ -2454,7 +2455,7 @@ void SfxMedium::Init_Impl()
if ( pSalvageItem && pSalvageItem->GetValue().Len() )
{
- aLogicName = pSalvageItem->GetValue();
+ pImp->m_aLogicName = pSalvageItem->GetValue();
DELETEZ( pURLObj );
pImp->m_bSalvageMode = true;
}
@@ -2464,20 +2465,22 @@ void SfxMedium::Init_Impl()
SFX_ITEMSET_ARG( pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
if( pOutStreamItem
&& ( !( pOutStreamItem->GetValue() >>= rOutStream )
- || (aLogicName.compareToAscii("private:stream", 14) == 0)) )
+ || (pImp->m_aLogicName.compareToAscii("private:stream", 14) == 0)) )
{
pSet->ClearItem( SID_OUTPUTSTREAM );
OSL_FAIL( "Unexpected Output stream parameter!\n" );
}
- if (!aLogicName.isEmpty())
+ if (!pImp->m_aLogicName.isEmpty())
{
// if the logic name is set it should be set in MediaDescriptor as well
SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
if ( !pFileNameItem )
{
// let the ItemSet be created if necessary
- GetItemSet()->Put( SfxStringItem( SID_FILE_NAME, INetURLObject( aLogicName ).GetMainURL( INetURLObject::NO_DECODE ) ) );
+ GetItemSet()->Put(
+ SfxStringItem(
+ SID_FILE_NAME, INetURLObject( pImp->m_aLogicName ).GetMainURL( INetURLObject::NO_DECODE ) ) );
}
}
@@ -2661,7 +2664,7 @@ void SfxMedium::UnlockFile( sal_Bool bReleaseLockStream )
try
{
pImp->m_bLocked = false;
- ::svt::DocumentLockFile aLockFile( aLogicName );
+ ::svt::DocumentLockFile aLockFile( pImp->m_aLogicName );
// TODO/LATER: A warning could be shown in case the file is not the own one
aLockFile.RemoveFile();
}
@@ -2748,10 +2751,10 @@ void SfxMedium::SetIsRemote_Impl()
void SfxMedium::SetName( const String& aNameP, sal_Bool bSetOrigURL )
{
if (pImp->aOrigURL.isEmpty())
- pImp->aOrigURL = aLogicName;
+ pImp->aOrigURL = pImp->m_aLogicName;
if( bSetOrigURL )
pImp->aOrigURL = aNameP;
- aLogicName = aNameP;
+ pImp->m_aLogicName = aNameP;
DELETEZ( pURLObj );
pImp->aContent = ::ucbhelper::Content();
Init_Impl();
@@ -2760,7 +2763,7 @@ void SfxMedium::SetName( const String& aNameP, sal_Bool bSetOrigURL )
//----------------------------------------------------------------
const OUString& SfxMedium::GetOrigURL() const
{
- return pImp->aOrigURL.isEmpty() ? aLogicName : pImp->aOrigURL;
+ return pImp->aOrigURL.isEmpty() ? pImp->m_aLogicName : pImp->aOrigURL;
}
//----------------------------------------------------------------
@@ -2843,7 +2846,7 @@ SfxMedium::SfxMedium(const String &rName, StreamMode nOpenMode, const SfxFilter
pSet( pInSet ),
pImp(new SfxMedium_Impl( this ))
{
- aLogicName = rName;
+ pImp->m_aLogicName = rName;
nStorOpenMode = nOpenMode;
Init_Impl();
}
@@ -2900,7 +2903,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false );
if (!pFileNameItem) throw uno::RuntimeException();
- aLogicName = pFileNameItem->GetValue();
+ pImp->m_aLogicName = pFileNameItem->GetValue();
nStorOpenMode = pImp->m_bOriginallyReadOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE;
Init_Impl();
}
@@ -2988,7 +2991,7 @@ SfxMedium::~SfxMedium()
const OUString& SfxMedium::GetName() const
{
- return aLogicName;
+ return pImp->m_aLogicName;
}
const INetURLObject& SfxMedium::GetURLObject() const
@@ -2996,9 +2999,9 @@ const INetURLObject& SfxMedium::GetURLObject() const
if( !pURLObj )
{
SfxMedium* pThis = const_cast < SfxMedium* > (this);
- pThis->pURLObj = new INetURLObject( aLogicName );
+ pThis->pURLObj = new INetURLObject( pImp->m_aLogicName );
if ( pThis->pURLObj->HasMark() )
- (*pThis->pURLObj) = INetURLObject( aLogicName ).GetURLNoMark();
+ (*pThis->pURLObj) = INetURLObject( pImp->m_aLogicName ).GetURLNoMark();
}
return *pURLObj;
@@ -3107,7 +3110,7 @@ const uno::Sequence < util::RevisionTag >& SfxMedium::GetVersionList( bool _bNoR
{
// if the medium has no name, then this medium should represent a new document and can have no version info
if ( ( !_bNoReload || !pImp->m_bVersionsAlreadyLoaded ) && !pImp->aVersions.getLength() &&
- ( !pImp->m_aName.isEmpty() || !aLogicName.isEmpty() ) && GetStorage().is() )
+ ( !pImp->m_aName.isEmpty() || !pImp->m_aLogicName.isEmpty() ) && GetStorage().is() )
{
uno::Reference < document::XDocumentRevisionListPersistence > xReader( comphelper::getProcessServiceFactory()->createInstance(
::rtl::OUString("com.sun.star.document.DocumentRevisionListPersistence") ), uno::UNO_QUERY );
@@ -3642,7 +3645,7 @@ sal_Bool SfxMedium::CallApproveHandler( const uno::Reference< task::XInteraction
{
// the method returns empty string in case of failure
::rtl::OUString aResult;
- ::rtl::OUString aOrigURL = aLogicName;
+ ::rtl::OUString aOrigURL = pImp->m_aLogicName;
if ( !aOrigURL.isEmpty() )
{
@@ -3715,7 +3718,7 @@ sal_Bool SfxMedium::SwitchDocumentToFile( ::rtl::OUString aURL )
{
// the method is only for storage based documents
bool bResult = false;
- ::rtl::OUString aOrigURL = aLogicName;
+ ::rtl::OUString aOrigURL = pImp->m_aLogicName;
if ( !aURL.isEmpty() && !aOrigURL.isEmpty() )
{
commit d7f5f26b2123475266c4b6adbe5449c1c21c43f8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 11:27:23 2012 -0400
More members to move to Impl.
Change-Id: I634b9bbd7229b78bb20a661195a71c688e2a082a
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index b11c4d7..f99d8df 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -71,7 +71,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
sal_uInt32 eError;
StreamMode nStorOpenMode;
INetURLObject* pURLObj;
- rtl::OUString aName;
SvGlobalName aFilterClass;
SvStream* pInStream;
SvStream* pOutStream;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 309e94d..b0044d5 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -265,6 +265,8 @@ public:
bool m_bRemote:1;
bool m_bInputStreamIsReadOnly:1;
+ OUString m_aName;
+
uno::Reference < embed::XStorage > xStorage;
SfxMedium* pAntiImpl;
@@ -500,8 +502,8 @@ Reference < XContent > SfxMedium::GetContent() const
{
// TODO: OSL_FAIL("SfxMedium::GetContent()\nCreate Content? This code exists as fallback only. Please clarify, why its used.");
rtl::OUString aURL;
- if ( !aName.isEmpty() )
- ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL );
+ if ( !pImp->m_aName.isEmpty() )
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aURL );
else if ( !aLogicName.isEmpty() )
aURL = GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
if (!aURL.isEmpty() )
@@ -553,7 +555,7 @@ SvStream* SfxMedium::GetInStream()
if ( pImp->pTempFile )
{
- pInStream = new SvFileStream( aName, nStorOpenMode );
+ pInStream = new SvFileStream( pImp->m_aName, nStorOpenMode );
eError = pInStream->GetError();
@@ -627,7 +629,7 @@ SvStream* SfxMedium::GetOutStream()
if ( pImp->pTempFile )
{
- pOutStream = new SvFileStream( aName, STREAM_STD_READWRITE );
+ pOutStream = new SvFileStream( pImp->m_aName, STREAM_STD_READWRITE );
CloseStorage();
}
}
@@ -675,11 +677,11 @@ sal_Bool SfxMedium::CloseOutStream_Impl()
//------------------------------------------------------------------
const rtl::OUString& SfxMedium::GetPhysicalName() const
{
- if ( aName.isEmpty() && !aLogicName.isEmpty() )
+ if ( pImp->m_aName.isEmpty() && !aLogicName.isEmpty() )
(( SfxMedium*)this)->CreateFileStream();
// return the name then
- return aName;
+ return pImp->m_aName;
}
//------------------------------------------------------------------
@@ -733,7 +735,7 @@ sal_Bool SfxMedium::IsStorage()
if ( pImp->pTempFile )
{
rtl::OUString aURL;
- if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL ) )
+ if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aURL ) )
{
OSL_FAIL("Physical name not convertable!");
}
@@ -1279,7 +1281,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf
else
{
CloseStreams_Impl();
- aArgs[0] <<= ::rtl::OUString( aName );
+ aArgs[0] <<= pImp->m_aName;
aArgs[1] <<= embed::ElementModes::READ;
pImp->bStorageBasedOnInStream = false;
}
@@ -1548,8 +1550,8 @@ sal_Bool SfxMedium::StorageCommit_Impl()
{
// connect the medium to the temporary file of the storage
pImp->aContent = ::ucbhelper::Content();
- aName = aBackupExc.TemporaryFileURL;
- OSL_ENSURE( !aName.isEmpty(), "The exception _must_ contain the temporary URL!\n" );
+ pImp->m_aName = aBackupExc.TemporaryFileURL;
+ OSL_ENSURE( !pImp->m_aName.isEmpty(), "The exception _must_ contain the temporary URL!\n" );
}
}
@@ -1774,7 +1776,7 @@ void SfxMedium::Transfer_Impl()
else if ( !aLogicName.isEmpty() && pImp->m_bSalvageMode )
{
// makes sence only in case logic name is set
- if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aNameURL ) )
+ if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aNameURL ) )
OSL_FAIL( "The medium name is not convertable!\n" );
}
@@ -2027,8 +2029,8 @@ void SfxMedium::Transfer_Impl()
if ( ( !eError || (eError & ERRCODE_WARNING_MASK) ) && !pImp->pTempFile )
{
// without a TempFile the physical and logical name should be the same after successful transfer
- ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ),
- aName );
+ ::utl::LocalFileHelper::ConvertURLToPhysicalName(
+ GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), pImp->m_aName );
pImp->m_bSalvageMode = false;
}
}
@@ -2214,7 +2216,7 @@ void SfxMedium::GetLockingStream_Impl()
aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= pImp->m_xLockingStream;
aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
- if ( !pImp->pTempFile && aName.isEmpty() )
+ if ( !pImp->pTempFile && pImp->m_aName.isEmpty() )
{
// the medium is still based on the original file, it makes sence to initialize the streams
if ( pImp->m_xLockingStream.is() )
@@ -2259,9 +2261,9 @@ void SfxMedium::GetMedium_Impl()
{
uno::Sequence < beans::PropertyValue > xProps;
rtl::OUString aFileName;
- if (!aName.isEmpty())
+ if (!pImp->m_aName.isEmpty())
{
- if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aFileName ) )
+ if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aFileName ) )
{
OSL_FAIL("Physical name not convertable!");
}
@@ -2286,7 +2288,7 @@ void SfxMedium::GetMedium_Impl()
{
pImp->xInputStream = m_xInputStreamToLoadFrom;
pImp->xInputStream->skipBytes(0);
- if (pImp->m_m_bInputStreamIsReadOnly)
+ if (pImp->m_bInputStreamIsReadOnly)
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
}
else
@@ -2441,8 +2443,8 @@ void SfxMedium::Init_Impl()
// try to convert the URL into a physical name - but never change a physical name
// physical name may be set if the logical name is changed after construction
- if ( aName.isEmpty() )
- ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aName );
+ if ( pImp->m_aName.isEmpty() )
+ ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), pImp->m_aName );
else
{
DBG_ASSERT( pSalvageItem, "Suspicious change of logical name!" );
@@ -2765,7 +2767,7 @@ const OUString& SfxMedium::GetOrigURL() const
void SfxMedium::SetPhysicalName_Impl( const rtl::OUString& rNameP )
{
- if ( rNameP != aName )
+ if ( rNameP != pImp->m_aName )
{
if( pImp->pTempFile )
{
@@ -2773,10 +2775,10 @@ void SfxMedium::SetPhysicalName_Impl( const rtl::OUString& rNameP )
pImp->pTempFile = NULL;
}
- if ( !aName.isEmpty() || !rNameP.isEmpty() )
+ if ( !pImp->m_aName.isEmpty() || !rNameP.isEmpty() )
pImp->aContent = ::ucbhelper::Content();
- aName = rNameP;
+ pImp->m_aName = rNameP;
pImp->m_bTriedStorage = false;
pImp->bIsStorage = false;
}
@@ -2805,7 +2807,7 @@ void SfxMedium::CompleteReOpen()
{
pTmpFile = pImp->pTempFile;
pImp->pTempFile = NULL;
- aName = String();
+ pImp->m_aName = OUString();
}
GetMedium_Impl();
@@ -2819,7 +2821,7 @@ void SfxMedium::CompleteReOpen()
}
pImp->pTempFile = pTmpFile;
if ( pImp->pTempFile )
- aName = pImp->pTempFile->GetFileName();
+ pImp->m_aName = pImp->pTempFile->GetFileName();
}
else
{
@@ -2964,10 +2966,10 @@ SfxMedium::~SfxMedium()
delete pSet;
- if( pImp->bIsTemp && !aName.isEmpty() )
+ if( pImp->bIsTemp && !pImp->m_aName.isEmpty() )
{
rtl::OUString aTemp;
- if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aTemp ))
+ if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aTemp ))
{
OSL_FAIL("Physical name not convertable!");
}
@@ -3105,7 +3107,7 @@ const uno::Sequence < util::RevisionTag >& SfxMedium::GetVersionList( bool _bNoR
{
// if the medium has no name, then this medium should represent a new document and can have no version info
if ( ( !_bNoReload || !pImp->m_bVersionsAlreadyLoaded ) && !pImp->aVersions.getLength() &&
- ( !aName.isEmpty() || !aLogicName.isEmpty() ) && GetStorage().is() )
+ ( !pImp->m_aName.isEmpty() || !aLogicName.isEmpty() ) && GetStorage().is() )
{
uno::Reference < document::XDocumentRevisionListPersistence > xReader( comphelper::getProcessServiceFactory()->createInstance(
::rtl::OUString("com.sun.star.document.DocumentRevisionListPersistence") ), uno::UNO_QUERY );
@@ -3305,14 +3307,14 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
return;
DELETEZ( pImp->pTempFile );
- aName = String();
+ pImp->m_aName = OUString();
}
pImp->pTempFile = new ::utl::TempFile();
pImp->pTempFile->EnableKillingFile( true );
- aName = pImp->pTempFile->GetFileName();
+ pImp->m_aName = pImp->pTempFile->GetFileName();
::rtl::OUString aTmpURL = pImp->pTempFile->GetURL();
- if ( aName.isEmpty() || aTmpURL.isEmpty() )
+ if ( pImp->m_aName.isEmpty() || aTmpURL.isEmpty() )
{
SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( OSL_LOG_PREFIX ) );
return;
@@ -3408,8 +3410,8 @@ void SfxMedium::CreateTempFileNoCopy()
pImp->pTempFile = new ::utl::TempFile();
pImp->pTempFile->EnableKillingFile( true );
- aName = pImp->pTempFile->GetFileName();
- if ( aName.isEmpty() )
+ pImp->m_aName = pImp->pTempFile->GetFileName();
+ if ( pImp->m_aName.isEmpty() )
{
SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( OSL_LOG_PREFIX ) );
return;
commit 1e355662242a73406547625dd1f0aa3ca5968118
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 10:48:15 2012 -0400
Move bInputStreamIsReadOnly flag to Impl & properly initialize it.
Change-Id: I8243aa8a98a636cf8afadcf070e4c83477126660
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 577226d..b11c4d7 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -83,7 +83,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
m_xInputStreamToLoadFrom;
- bool m_bInputStreamIsReadOnly;
#if _SOLAR__PRIVATE
SAL_DLLPRIVATE void SetIsRemote_Impl();
@@ -131,8 +130,9 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >
GetInteractionHandler();
- void setStreamToLoadFrom(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly )
- { m_xInputStreamToLoadFrom = xInputStream; m_bInputStreamIsReadOnly = bIsReadOnly; }
+ void setStreamToLoadFrom(
+ const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,
+ sal_Bool bIsReadOnly);
void SetLoadTargetFrame(SfxFrame* pFrame );
SfxFrame* GetLoadTargetFrame() const;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 4139bf0..309e94d 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -263,6 +263,7 @@ public:
bool m_bRoot:1;
bool m_bTriedStorage:1;
bool m_bRemote:1;
+ bool m_bInputStreamIsReadOnly:1;
uno::Reference < embed::XStorage > xStorage;
@@ -332,6 +333,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP )
m_bRoot(false),
m_bTriedStorage(false),
m_bRemote(false),
+ m_bInputStreamIsReadOnly(false),
pAntiImpl( pAntiImplP ),
nFileVersion( 0 ),
pOrigFilter( 0 ),
@@ -2284,7 +2286,7 @@ void SfxMedium::GetMedium_Impl()
{
pImp->xInputStream = m_xInputStreamToLoadFrom;
pImp->xInputStream->skipBytes(0);
- if(m_bInputStreamIsReadOnly)
+ if (pImp->m_m_bInputStreamIsReadOnly)
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
}
else
@@ -3037,7 +3039,12 @@ SfxFrame* SfxMedium::GetLoadTargetFrame() const
{
return pImp->wLoadTargetFrame;
}
-//----------------------------------------------------------------
+
+void SfxMedium::setStreamToLoadFrom(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly )
+{
+ m_xInputStreamToLoadFrom = xInputStream;
+ pImp->m_bInputStreamIsReadOnly = bIsReadOnly;
+}
void SfxMedium::SetLoadTargetFrame(SfxFrame* pFrame )
{
commit 3faf775c4808a552f00f7ae61544b61340bcc8de
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 10:44:08 2012 -0400
Move bRemote to Impl. BTW this never was properly initialized.
Change-Id: I3e94c0f567b1ccaf07c46c9cbcca7ba6fea1671d
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index eec96fd..577226d 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -69,7 +69,6 @@ class DateTime;
class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
{
sal_uInt32 eError;
- bool bRemote:1;
StreamMode nStorOpenMode;
INetURLObject* pURLObj;
rtl::OUString aName;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index c6517ac..4139bf0 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -262,6 +262,7 @@ public:
bool m_bOriginallyReadOnly:1;
bool m_bRoot:1;
bool m_bTriedStorage:1;
+ bool m_bRemote:1;
uno::Reference < embed::XStorage > xStorage;
@@ -330,6 +331,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP )
m_bOriginallyReadOnly(false),
m_bRoot(false),
m_bTriedStorage(false),
+ m_bRemote(false),
pAntiImpl( pAntiImplP ),
nFileVersion( 0 ),
pOrigFilter( 0 ),
@@ -534,7 +536,7 @@ Reference < XContent > SfxMedium::GetContent() const
{
SvtSaveOptions aOpt;
bool bIsRemote = IsRemote();
- if( (bIsRemote && !aOpt.IsSaveRelINet()) || (!bRemote && !aOpt.IsSaveRelFSys()) )
+ if( (bIsRemote && !aOpt.IsSaveRelINet()) || (!pImp->m_bRemote && !aOpt.IsSaveRelFSys()) )
return ::rtl::OUString();
}
@@ -2356,7 +2358,7 @@ void SfxMedium::GetMedium_Impl()
//----------------------------------------------------------------
sal_Bool SfxMedium::IsRemote()
{
- return bRemote;
+ return pImp->m_bRemote;
}
//------------------------------------------------------------------
@@ -2724,15 +2726,16 @@ void SfxMedium::SetIsRemote_Impl()
case INET_PROT_NEWS:
case INET_PROT_IMAP:
case INET_PROT_VIM:
- bRemote = true; break;
+ pImp->m_bRemote = true;
+ break;
default:
- bRemote = GetName().compareToAscii("private:msgid", 13) == 0;
+ pImp->m_bRemote = GetName().compareToAscii("private:msgid", 13) == 0;
break;
}
// As files that are written to the remote transmission must also be able
// to be read.
- if( bRemote )
+ if (pImp->m_bRemote)
nStorOpenMode |= STREAM_READ;
}
commit ed4ee6af8d1aee073b345099bb0f238fea63d996
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jul 25 10:27:31 2012 -0400
Moved bTriedStorage to Impl.
Change-Id: I2587b17d204ae8c9045f0059e816da74cb1d1273
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 7a5104f..eec96fd 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -69,7 +69,6 @@ class DateTime;
class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
{
sal_uInt32 eError;
- bool bTriedStorage:1;
bool bRemote:1;
StreamMode nStorOpenMode;
INetURLObject* pURLObj;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 5daeac4..c6517ac 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -261,6 +261,7 @@ public:
bool m_bRemoveBackup:1;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list