SvFileObject::~SvFileObject()
{ if (xMed.is())
{
xMed->SetDoneLink( Link<void*,void>() );
xMed.clear();
} if (nPostUserEventId)
Application::RemoveUserEvent(nPostUserEventId);
}
bool SvFileObject::GetData( css::uno::Any & rData, const OUString & rMimeType, bool/*bGetSynchron*/ )
{
SotClipboardFormatId nFmt = SotExchange::RegisterFormatMimeType( rMimeType ); switch( nType )
{ case SvFileObjectType::Text: if( SotClipboardFormatId::SIMPLE_FILE == nFmt )
{ // The media in the application must be opened to lookup the // relative file links!! This is done through the link manager // of the Storage.
rData <<= sFileNm;
} break;
case SvFileObjectType::Graphic: if (SotClipboardFormatId::GDIMETAFILE == nFmt
|| SotClipboardFormatId::BITMAP == nFmt
|| SotClipboardFormatId::SVXB == nFmt)
{
rData <<= sFileNm;
} break; case SvFileObjectType::Object: // TODO/LATER: possibility to insert a new object
rData <<= sFileNm; break;
} returntrue/*0 != aTypeList.Count()*/;
}
case sfx2::SvBaseLinkObjectType::ClientFile:
nType = SvFileObjectType::Text; break;
case sfx2::SvBaseLinkObjectType::ClientOle:
nType = SvFileObjectType::Object; // TODO/LATER: introduce own type to be used for exchanging break;
default: returnfalse;
}
SetUpdateTimeout( 0 );
// and now register by this or other found Pseudo-Object
AddDataAdvise( pLink, SotExchange::GetFormatMimeType( pLink->GetContentType()), 0 ); returntrue;
}
bool SvFileObject::LoadFile_Impl()
{ // We are still at Loading!! if( bWaitForData || !bLoadAgain || xMed.is() ) returnfalse;
// at the moment on the current DocShell
xMed = new SfxMedium( sFileNm, sReferer, StreamMode::STD_READ );
SvLinkSource::StreamToLoadFrom aStreamToLoadFrom =
getStreamToLoadFrom();
xMed->setStreamToLoadFrom(
aStreamToLoadFrom.m_xInputStreamToLoadFrom,
aStreamToLoadFrom.m_bIsReadOnly);
// Graphic is finished, also send DataChanged of the Status change:
SendStateChg_Impl( xMed->GetInStream() && xMed->GetInStream()->GetError()
? sfx2::LinkManager::STATE_LOAD_ERROR : sfx2::LinkManager::STATE_LOAD_OK ); returntrue;
}
IMPL_LINK_NOARG( SvFileObject, LoadGrfReady_Impl, void*, void )
{ // When we come from here there it can not be an error no more.
bLoadError = false;
bWaitForData = false;
if( !bDataReady )
{ // Graphic is finished, also send DataChanged from Status change
bDataReady = true;
SendStateChg_Impl( sfx2::LinkManager::STATE_LOAD_OK );
// and then send the data again
NotifyDataChanged();
}
void SvFileObject::CancelTransfers()
{ // unsubscribe from the cache if in the middle of loading if( !bDataReady )
{ // Do not set-up again
bLoadAgain = false;
bDataReady = bLoadError = bWaitForData = true;
SendStateChg_Impl( sfx2::LinkManager::STATE_LOAD_ABORT );
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.