// Unnamed Documents and embedded-Documents not in Picklist if ( !pDocSh->HasName() ||
SfxObjectCreateMode::STANDARD != pDocSh->GetCreateMode() ) return;
// Help not in History
INetURLObject aURL( pDocSh->IsDocShared() ? pDocSh->GetSharedFileURL() : pMed->GetOrigURL() ); if ( aURL.GetProtocol() == INetProtocol::VndSunStarHelp ) return;
// add no document that forbids this if ( !pMed->IsUpdatePickList() ) return;
// generate the thumbnail //fdo#74834: only generate thumbnail for history if the corresponding option is not disabled in the configuration if (!bNoThumbnail && !pDocSh->IsModified() && !Application::IsHeadlessModeEnabled() &&
officecfg::Office::Common::History::RecentDocsThumbnail::get())
{ // not modified => the document matches what is in the shell const SfxUnoAnyItem* pEncryptionDataItem = pMed->GetItemSet().GetItem(SID_ENCRYPTIONDATA, false); if ( pEncryptionDataItem )
{ // encrypted document, will show a generic document icon instead
aThumbnail = OUString();
} else
{
BitmapEx aResultBitmap = pDocSh->GetPreviewBitmap(); if (!aResultBitmap.IsEmpty())
{
SvMemoryStream aStream(65535, 65535);
vcl::PngImageWriter aWriter(aStream); if (aWriter.write(aResultBitmap))
{
Sequence<sal_Int8> aSequence(static_cast<const sal_Int8*>(aStream.GetData()), aStream.Tell());
OUStringBuffer aBuffer;
::comphelper::Base64::encode(aBuffer, aSequence);
aThumbnail = aBuffer.makeStringAndClear();
}
}
}
}
::std::optional<bool> const oIsReadOnly(pMed->IsOriginallyLoadedReadOnly());
// add to svtool history options
SvtHistoryOptions::AppendItem( EHistoryType::PickList,
aURL.GetURLNoPass( INetURLObject::DecodeMechanism::NONE ),
aFilter,
aTitle,
aThumbnail,
oIsReadOnly);
if ( bAllowModif )
pDocSh->EnableSetModified( bAllowModif );
} break;
case SfxEventHintId::OpenDoc: case SfxEventHintId::SaveDocDone: case SfxEventHintId::SaveAsDocDone: case SfxEventHintId::SaveToDocDone: case SfxEventHintId::CloseDoc:
{ constbool bNoThumbnail = rEventHint.GetEventId() == SfxEventHintId::CloseDoc;
AddDocumentToPickList(pDocSh.get(), bNoThumbnail);
} break;
case SfxEventHintId::SaveAsDoc:
{
SfxMedium *pMedium = pDocSh->GetMedium(); if (!pMedium) return;
// We're starting a "Save As". Add the current document (if it's // not a "new" document) to the "Recent Documents" list before we // switch to the new path. // If the current document is new, path will be empty.
OUString path = pMedium->GetOrigURL(); if (!path.isEmpty())
{
AddDocumentToPickList(pDocSh.get());
}
} break; default: break;
}
}
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.