summaryrefslogtreecommitdiff
path: root/dtrans/source/win32
diff options
context:
space:
mode:
authorTino Rachui <tra@openoffice.org>2001-03-09 07:48:02 +0000
committerTino Rachui <tra@openoffice.org>2001-03-09 07:48:02 +0000
commitd31f1064a5c100c650202fd994bcb70d0ecde67e (patch)
treec02bb92a40fa6e983e008486701376bcc551ac00 /dtrans/source/win32
parent1803f5ab54a309fbea9004bfe0d3944e3ddbf854 (diff)
now accepting text/plain contentype without charset
Diffstat (limited to 'dtrans/source/win32')
-rw-r--r--dtrans/source/win32/dtobj/DataFmtTransl.cxx37
-rw-r--r--dtrans/source/win32/dtobj/DataFmtTransl.hxx6
-rw-r--r--dtrans/source/win32/ftransl/ftransl.cxx19
3 files changed, 17 insertions, 45 deletions
diff --git a/dtrans/source/win32/dtobj/DataFmtTransl.cxx b/dtrans/source/win32/dtobj/DataFmtTransl.cxx
index 311dce54d182..44fa7004f7c6 100644
--- a/dtrans/source/win32/dtobj/DataFmtTransl.cxx
+++ b/dtrans/source/win32/dtobj/DataFmtTransl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DataFmtTransl.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: tra $ $Date: 2001-03-08 11:39:12 $
+ * last change: $Author: tra $ $Date: 2001-03-09 08:46:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -284,23 +284,6 @@ sal_Bool SAL_CALL CDataFormatTranslator::isOemOrAnsiTextClipformat( CLIPFORMAT a
}
//------------------------------------------------------------------------
-// helper function
-//------------------------------------------------------------------------
-
-OUString SAL_CALL CDataFormatTranslator::getCodePageFromLocaleId( LCID locale, LCTYPE lcType ) const
-{
- OSL_ASSERT( IsValidLocale( locale, LCID_SUPPORTED ) );
-
- // we use the GetLocaleInfoA because don't want to provide
- // a unicode wrapper function for Win9x in sal/systools
- char buff[6];
- GetLocaleInfoA( locale, lcType, buff, sizeof( buff ) );
- rtl_TextEncoding tenc = rtl_getTextEncodingFromPCCodePage( CP_ACP );
-
- return OUString( buff, rtl_str_getLength( buff ), tenc );
-}
-
-//------------------------------------------------------------------------
// should be called only if there is realy text on the clipboard
//------------------------------------------------------------------------
@@ -346,18 +329,6 @@ LCID SAL_CALL CDataFormatTranslator::getCurrentLocaleFromClipboard(
//
//------------------------------------------------------------------------
-inline
-OUString SAL_CALL CDataFormatTranslator::makeMimeCharsetFromLocaleId(
- LCID lcid, LCTYPE lcType, const OUString& aCharsetValuePrefix ) const
-{
- OUString charset = getCodePageFromLocaleId( lcid, lcType );
- return aCharsetValuePrefix + charset;
-}
-
-//------------------------------------------------------------------------
-//
-//------------------------------------------------------------------------
-
OUString SAL_CALL CDataFormatTranslator::getTextCharsetFromClipboard(
const Reference< XTransferable >& refXTransferable, CLIPFORMAT aClipformat ) const
{
@@ -367,7 +338,7 @@ OUString SAL_CALL CDataFormatTranslator::getTextCharsetFromClipboard(
if ( CF_TEXT == aClipformat )
{
LCID lcid = getCurrentLocaleFromClipboard( refXTransferable );
- charset = makeMimeCharsetFromLocaleId(
+ charset = getMimeCharsetFromLocaleId(
lcid,
LOCALE_IDEFAULTANSICODEPAGE,
PRE_WINDOWS_CODEPAGE );
@@ -375,7 +346,7 @@ OUString SAL_CALL CDataFormatTranslator::getTextCharsetFromClipboard(
else if ( CF_OEMTEXT == aClipformat )
{
LCID lcid = getCurrentLocaleFromClipboard( refXTransferable );
- charset = makeMimeCharsetFromLocaleId(
+ charset = getMimeCharsetFromLocaleId(
lcid,
LOCALE_IDEFAULTCODEPAGE,
PRE_OEM_CODEPAGE );
diff --git a/dtrans/source/win32/dtobj/DataFmtTransl.hxx b/dtrans/source/win32/dtobj/DataFmtTransl.hxx
index 50cc5cafbed2..ca03da95268f 100644
--- a/dtrans/source/win32/dtobj/DataFmtTransl.hxx
+++ b/dtrans/source/win32/dtobj/DataFmtTransl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DataFmtTransl.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: tra $ $Date: 2001-03-02 15:45:42 $
+ * last change: $Author: tra $ $Date: 2001-03-09 08:46:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,9 +110,7 @@ private:
rtl::OUString SAL_CALL getClipboardFormatName( CLIPFORMAT aClipformat ) const;
sal_Bool SAL_CALL isOemOrAnsiTextClipformat( CLIPFORMAT aClipformat ) const;
- rtl::OUString SAL_CALL getCodePageFromLocaleId( LCID locale, LCTYPE lcType ) const;
LCID SAL_CALL getCurrentLocaleFromClipboard( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& refXTransferable ) const;
- rtl::OUString SAL_CALL makeMimeCharsetFromLocaleId( LCID lcid, LCTYPE lcType, const rtl::OUString& aCharsetValuePrefix ) const;
rtl::OUString SAL_CALL getTextCharsetFromClipboard(
const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& refXTransferable, CLIPFORMAT aClipformat ) const;
diff --git a/dtrans/source/win32/ftransl/ftransl.cxx b/dtrans/source/win32/ftransl/ftransl.cxx
index 482ee744fd0a..67abd9183492 100644
--- a/dtrans/source/win32/ftransl/ftransl.cxx
+++ b/dtrans/source/win32/ftransl/ftransl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftransl.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: tra $ $Date: 2001-03-01 15:39:41 $
+ * last change: $Author: tra $ $Date: 2001-03-09 08:48:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -162,9 +162,12 @@ Any SAL_CALL CDataFormatTranslator::getSystemDataTypeFromDataFlavor( const DataF
// default is CF_TEXT
aAny <<= static_cast< sal_Int32 >( CF_TEXT );
- // but maybe it is unicode text or oem text
- OUString charset = refXMimeCntType->getParameterValue( OUSTR( charset ) );
- findStandardFormatIdForCharset( charset, aAny );
+ if ( refXMimeCntType->hasParameter( OUSTR( charset ) ) )
+ {
+ // but maybe it is unicode text or oem text
+ OUString charset = refXMimeCntType->getParameterValue( OUSTR( charset ) );
+ findStandardFormatIdForCharset( charset, aAny );
+ }
}
else
{
@@ -181,11 +184,11 @@ Any SAL_CALL CDataFormatTranslator::getSystemDataTypeFromDataFlavor( const DataF
}
catch( IllegalArgumentException& )
{
- OSL_ENSURE( sal_False, "Invalid content type detected!" );
+ OSL_ENSURE( sal_False, "Invalid content-type detected!" );
}
catch( NoSuchElementException& )
{
- OSL_ENSURE( sal_False, "text/plain Contenttype without charset parameter detected" );
+ OSL_ENSURE( sal_False, "Illegal content-type parameter" );
}
catch( ... )
{
@@ -447,7 +450,7 @@ void SAL_CALL CDataFormatTranslator::findStandardFormatIdForCharset( const OUStr
aAny <<= static_cast< sal_Int32 >( CF_UNICODETEXT );
else
{
- sal_Int32 wincp = getWinCodePageFromMimeCharset( aCharset );
+ sal_Int32 wincp = getWinCPFromMimeCharset( aCharset );
if ( IsOEMCP ( wincp ) )
aAny <<= static_cast< sal_Int32 >( CF_OEMTEXT );
}