// this function converts all DataFlavors of the given FlavorList into // an appropriate FORMATETC structure, for some formats like unicodetext, // text and text/html we will offer an accompany format e.g.: // // DataFlavor | Registered Clipformat | Registered accompany clipformat // -------------------------|---------------------------|----------------------------------- // text/plain;charset=ansi | CF_TEXT | CF_UNICODETEXT // | | CF_LOCALE (if charset != GetACP() // | | // text/plain;charset=oem | CF_OEMTEXT | CF_UNICODETEXT // | | CF_LOCALE (if charset != GetOEMCP() // | | // text/plain;charset=utf-16| CF_UNICODETEXT | CF_TEXT // | | // text/html | HTML (Hypertext ...) | HTML Format // | | // // if some tries to register different text formats with different charsets the last // registered wins and the others are ignored
for( sal_Int32 i = 0; i < nFlavors; i++ )
{
aFlavor = aFlavorList[i];
CFormatEtc fetc = m_DataFormatTranslator.getFormatEtcFromDataFlavor( aFlavor );
// maybe an internal format so we ignore it if ( CF_INVALID == fetc.getClipformat( ) ) continue;
if ( !needsToSynthesizeAccompanyFormats( fetc ) )
aFormatEtcContainer.addFormatEtc( fetc ); else
{ // if we haven't registered any text format up to now if ( CDataFormatTranslator::isTextFormat( fetc.getClipformat() ) && !bUnicodeRegistered )
{ // if the transferable supports unicode text we ignore // any further text format the transferable offers // because we can create it from Unicode text in addition // we register CF_TEXT for non unicode clients if ( CDataFormatTranslator::isUnicodeTextFormat( fetc.getClipformat() ) )
{
aFormatEtcContainer.addFormatEtc( fetc ); // add CF_UNICODE
aFormatEtcContainer.addFormatEtc(
CDataFormatTranslator::getFormatEtcForClipformat( CF_TEXT ) ); // add CF_TEXT
bUnicodeRegistered = true;
} elseif ( !hasUnicodeFlavor( aXTransferable ) )
{ // we try to investigate the charset and make a valid // windows codepage from this charset the default // return value is the result of GetACP( )
OUString charset = getCharsetFromDataFlavor( aFlavor );
sal_uInt32 txtCP = getWinCPFromMimeCharset( charset );
// we try to get a Locale appropriate for this codepage if ( findLocaleForTextCodePage( ) )
{
m_TxtCodePage = txtCP;
// we save the flavor so it's easier when // queried for it in XTDataObject::GetData(...)
m_RegisteredTextFlavor = aFlavor;
m_bHasSynthesizedLocale = true;
}
}
} elseif ( CDataFormatTranslator::isTextHtmlFormat( fetc.getClipformat( ) ) ) // Html (Hyper Text...)
{ // we add text/html ( HTML (HyperText Markup Language) )
aFormatEtcContainer.addFormatEtc( fetc );
// and HTML Format
aFormatEtcContainer.addFormatEtc(
CDataFormatTranslator::getFormatEtcForClipformatName( "HTML Format" ) );
}
}
}
}
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.