diff options
author | jp <jp@openoffice.org> | 2001-03-15 12:34:15 +0000 |
---|---|---|
committer | jp <jp@openoffice.org> | 2001-03-15 12:34:15 +0000 |
commit | 9d35d6b9fc74f44d9d684c84320be2dfef055266 (patch) | |
tree | c206365b3eb468595161cdff63a79d179daa8246 /sot/source | |
parent | 0915eaab5622849dfdff1d61ad44a808895ed8cc (diff) |
GetFormatStringId must ask for the mimetype and not for the name
Diffstat (limited to 'sot/source')
-rw-r--r-- | sot/source/base/exchange.cxx | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 9c6a9ef4f297..0687ed2fbcc2 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -2,9 +2,9 @@ * * $RCSfile: exchange.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: bm $ $Date: 2001-03-15 13:08:29 $ + * last change: $Author: jp $ $Date: 2001-03-15 13:34:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -285,6 +285,40 @@ ULONG SotExchange::RegisterFormatName( const String& rName ) return nMax + SOT_FORMATSTR_ID_USER_END + 1; } +ULONG SotExchange::RegisterFormatMimeType( const String& rMimeType ) +{ + // teste zuerst die Standard - Name + ULONG i, nMax = SOT_FORMAT_FILE_LIST; + for( i = SOT_FORMAT_STRING; i <= nMax; ++i ) + if( rMimeType.EqualsAscii( aFormatArray_Impl[ i ].pMimeType ) ) + return i; + + nMax = SOT_FORMATSTR_ID_USER_END; + for( i = SOT_FORMAT_RTF; i <= nMax; ++i ) + if( rMimeType.EqualsAscii( aFormatArray_Impl[ i ].pMimeType ) ) + return i; + + // dann in der dynamischen Liste + List& rL = InitFormats_Impl(); + for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + { + DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + if( pFlavor && rMimeType == String( pFlavor->MimeType ) ) + return i + SOT_FORMATSTR_ID_USER_END + 1; + } + + // nMax ist der neue Platz + DataFlavor* pNewFlavor = new DataFlavor; + + pNewFlavor->MimeType = rMimeType; + pNewFlavor->HumanPresentableName = rMimeType; + pNewFlavor->DataType = ::getCppuType( (const ::rtl::OUString*) 0 ); + + rL.Insert( pNewFlavor, LIST_APPEND ); + + return nMax + SOT_FORMATSTR_ID_USER_END + 1; +} + /************************************************************************* |* |* SotExchange::RegisterFormatName() |