Commit 4d5eda89 authored by Ivan.Shulga's avatar Ivan.Shulga Committed by Alexander Trofimov

gcc compilation

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58227 954022d7-b5bf-4e40-9824-e11837661b57
parent f9103204
...@@ -3,42 +3,47 @@ ...@@ -3,42 +3,47 @@
#define UTILITY_ENCODING_INCLUDE_H_ #define UTILITY_ENCODING_INCLUDE_H_
#include "../Base/Base.h" #include "../Base/Base.h"
#include "../Base/ASCString.h"
#ifndef _WIN32
#define CP_ACP 0 //
#define CP_UTF8 1
#endif
class Encoding class Encoding
{ {
public: public:
static AVSINLINE const CStringA Encoding::ansi2utf8 (const CStringA &sLine) static AVSINLINE const CStringA ansi2utf8 (const CStringA &sLine)
{ {
return wstring2string( string2wstring( sLine, CP_ACP ), CP_UTF8 ); return wstring2string( string2wstring( sLine, CP_ACP ), CP_UTF8 );
} }
static AVSINLINE const CStringW Encoding::ansi2unicode (const CStringA &sLine) static AVSINLINE const CStringW ansi2unicode (const CStringA &sLine)
{ {
return string2wstring( sLine, CP_ACP ); return string2wstring( sLine, CP_ACP );
} }
static AVSINLINE const CStringA Encoding::utf82ansi (const CStringA &sLine) static AVSINLINE const CStringA utf82ansi (const CStringA &sLine)
{ {
return wstring2string( string2wstring( sLine, CP_UTF8 ), CP_ACP ); return wstring2string( string2wstring( sLine, CP_UTF8 ), CP_ACP );
} }
static AVSINLINE const CStringW Encoding::utf82unicode (const CStringA &sLine) static AVSINLINE const CStringW utf82unicode (const CStringA &sLine)
{ {
return string2wstring( sLine, CP_UTF8 ); return string2wstring( sLine, CP_UTF8 );
} }
static AVSINLINE const CStringA Encoding::unicode2ansi (const CStringW &sLine) static AVSINLINE const CStringA unicode2ansi (const CStringW &sLine)
{ {
return wstring2string( sLine, CP_ACP ); return wstring2string( sLine, CP_ACP );
} }
static AVSINLINE const CStringA Encoding::unicode2utf8 (const CStringW &sLine) static AVSINLINE const CStringA unicode2utf8 (const CStringW &sLine)
{ {
return wstring2string( sLine, CP_UTF8 ); return wstring2string( sLine, CP_UTF8 );
} }
...@@ -47,8 +52,9 @@ public: ...@@ -47,8 +52,9 @@ public:
private: private:
static AVSINLINE const CStringA Encoding::wstring2string(const CStringW &sLine, const unsigned int unCodePage) static AVSINLINE const CStringA wstring2string(const CStringW &sLine, const unsigned int unCodePage)
{ {
#ifdef _WIN32
const int nSize = WideCharToMultiByte( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0, NULL, NULL ); const int nSize = WideCharToMultiByte( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0, NULL, NULL );
char *sTemp = new char[nSize]; char *sTemp = new char[nSize];
if ( !sTemp ) if ( !sTemp )
...@@ -60,11 +66,17 @@ private: ...@@ -60,11 +66,17 @@ private:
delete []sTemp; delete []sTemp;
return sResult; return sResult;
#else
return stringWstingToUtf8String (sLine);
#endif
} }
static AVSINLINE const CStringW Encoding::string2wstring(const CStringA &sLine, const unsigned int unCodePage) static AVSINLINE const CStringW string2wstring(const CStringA &sLine, const unsigned int unCodePage)
{ {
#ifdef _WIN32
const int nSize = MultiByteToWideChar( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0 ); const int nSize = MultiByteToWideChar( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0 );
wchar_t *sTemp = new wchar_t[nSize]; wchar_t *sTemp = new wchar_t[nSize];
...@@ -76,7 +88,9 @@ private: ...@@ -76,7 +88,9 @@ private:
CStringW sResult( sTemp ); CStringW sResult( sTemp );
delete []sTemp; delete []sTemp;
return sResult; return sResult;
#else
#endif
} }
......
#include "SimpleTypes_Word.h"
namespace SimpleTypes
{
//template<EHexColor eDefValue = hexcolorAuto>
template<>
EHexColor CHexColor<EHexColor::hexcolorAuto>::FromString (CString &sValue)
{
if ( _T("auto") == sValue || _T("none") == sValue )
this->m_eValue = hexcolorAuto;
else
{
// , , word .
//CHighlightColor<highlightcolorNone> oHighlightColor(sValue);
CHighlightColor<> oHighlightColor(sValue);
if(SimpleTypes::highlightcolorNone != oHighlightColor.GetValue())
{
this->m_eValue = hexcolorRGB;
m_unR = oHighlightColor.Get_R();
m_unG = oHighlightColor.Get_G();
m_unB = oHighlightColor.Get_B();
}
else if ( 6 <= sValue.GetLength() )
{
this->m_eValue = hexcolorRGB;
m_sValue = sValue.Mid( 0, 6 );
Parse();
}
else if ( 3 == sValue.GetLength() )// a la #339 (Compo 3AP.docx)
{
this->m_eValue = hexcolorRGB;
m_sValue = sValue;
Parse3();
}
else this->m_eValue = EHexColor::hexcolorAuto;//eDefValue;
}
return this->m_eValue;
}
} // SimpleTypes
...@@ -2574,7 +2574,10 @@ namespace SimpleTypes ...@@ -2574,7 +2574,10 @@ namespace SimpleTypes
//template<EHighlightColor> //template<EHighlightColor>
//class CHighlightColor; //class CHighlightColor;
virtual EHexColor FromString(CString &sValue) void SetColorByString ();
virtual EHexColor FromString(CString &sValue);
/*
{ {
if ( _T("auto") == sValue || _T("none") == sValue ) if ( _T("auto") == sValue || _T("none") == sValue )
this->m_eValue = hexcolorAuto; this->m_eValue = hexcolorAuto;
...@@ -2610,6 +2613,7 @@ namespace SimpleTypes ...@@ -2610,6 +2613,7 @@ namespace SimpleTypes
return this->m_eValue; return this->m_eValue;
} }
*/
virtual CString ToString () const virtual CString ToString () const
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment