Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
435bb02d
Commit
435bb02d
authored
Dec 12, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Metfiles StarView - fix coding text (charsets)
parent
a84425b4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
180 additions
and
35 deletions
+180
-35
ASCOfficeOdfFile/Test/ASCOfficeOdfFileTest/ASCOfficeOdfFileTest.vcproj
...ile/Test/ASCOfficeOdfFileTest/ASCOfficeOdfFileTest.vcproj
+16
-0
DesktopEditor/raster/Metafile/StarView/SvmFile.cpp
DesktopEditor/raster/Metafile/StarView/SvmFile.cpp
+6
-1
DesktopEditor/raster/Metafile/StarView/SvmFile.h
DesktopEditor/raster/Metafile/StarView/SvmFile.h
+6
-0
DesktopEditor/raster/Metafile/StarView/SvmObjects.cpp
DesktopEditor/raster/Metafile/StarView/SvmObjects.cpp
+151
-33
DesktopEditor/raster/Metafile/StarView/SvmObjects.h
DesktopEditor/raster/Metafile/StarView/SvmObjects.h
+1
-1
No files found.
ASCOfficeOdfFile/Test/ASCOfficeOdfFileTest/ASCOfficeOdfFileTest.vcproj
View file @
435bb02d
...
...
@@ -345,6 +345,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\..\..\Common\3dParty\icu\win_32\lib\icuuc.lib"
>
</File>
<File
RelativePath=
"..\..\..\Common\3dParty\pole\pole.cpp"
>
...
...
@@ -357,6 +361,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\..\..\UnicodeConverter\UnicodeConverter.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
...
...
DesktopEditor/raster/Metafile/StarView/SvmFile.cpp
View file @
435bb02d
...
...
@@ -160,7 +160,7 @@ void CSvmFile::PlayMetaFile()
case
META_TEXTFILLCOLOR_ACTION
:
Read_META_SETTEXTFILLCOLOR
();
break
;
case
META_TEXTCOLOR_ACTION
:
Read_META_SETTEXTCOLOR
();
break
;
case
META_STRETCHTEXT_ACTION
:
Read_META_STRETCHTEXT
();
break
;
case
META_TEXTLANGUAGE_ACTION
:
case
META_TEXTLANGUAGE_ACTION
:
Read_META_TEXTLANGUAGE
();
break
;
case
META_TEXTLINECOLOR_ACTION
:
case
META_TEXTLINE_ACTION
:
break
;
...
...
@@ -467,6 +467,11 @@ void CSvmFile::Read_META_SETMAPMODE()
UpdateOutputDC
();
}
void
CSvmFile
::
Read_META_TEXTLANGUAGE
()
{
m_oStream
>>
m_currentLanguage
;
}
void
CSvmFile
::
Read_META_STRETCHTEXT
()
{
std
::
wstring
sText
;
...
...
DesktopEditor/raster/Metafile/StarView/SvmFile.h
View file @
435bb02d
...
...
@@ -47,6 +47,7 @@ class CSvmFile : virtual public IMetaFileBase
m_pDC
=
m_oPlayer
.
GetDC
();
m_currentActionVersion
=
0
;
m_currentCharset
=
0
;
m_currentLanguage
=
0
;
m_currentActionType
=
0
;
m_bMainStream
=
true
;
};
...
...
@@ -57,6 +58,7 @@ class CSvmFile : virtual public IMetaFileBase
m_pDC
=
m_oPlayer
.
GetDC
();
m_currentActionVersion
=
0
;
m_currentCharset
=
0
;
m_currentLanguage
=
0
;
m_currentActionType
=
0
;
m_bMainStream
=
true
;
}
...
...
@@ -75,6 +77,7 @@ class CSvmFile : virtual public IMetaFileBase
m_currentActionVersion
=
0
;
m_currentCharset
=
0
;
m_currentLanguage
=
0
;
}
TRect
*
GetBounds
()
{
...
...
@@ -193,6 +196,7 @@ class CSvmFile : virtual public IMetaFileBase
unsigned
short
m_currentActionVersion
;
unsigned
short
m_currentCharset
;
unsigned
short
m_currentLanguage
;
unsigned
short
m_currentActionType
;
unsigned
int
m_unRecordSize
;
...
...
@@ -237,6 +241,8 @@ class CSvmFile : virtual public IMetaFileBase
void
Read_META_STRETCHTEXT
();
void
Read_META_TEXTLANGUAGE
();
void
Read_META_POLYPOLYGON
(
std
::
vector
<
TSvmPolygon
>
&
polygons
,
std
::
vector
<
TSvmPolygon
>
&
complexPolygons
);
...
...
DesktopEditor/raster/Metafile/StarView/SvmObjects.cpp
View file @
435bb02d
...
...
@@ -32,13 +32,111 @@
#include "SvmObjects.h"
#include "../../../common/String.h"
#include "../../../../UnicodeConverter/UnicodeConverter.h"
static
const
char
*
CodingCharsets
[
95
]
=
{
""
,
// 0
"windows-1252"
,
// 1 MS_1252
""
,
// 2 APPLE_ROMAN
"IBM437"
,
// 3 IBM_437
"IBM850"
,
// 4 IBM_850
"IBM860"
,
// 5 IBM_860
"IBM861"
,
// 6 IBM_861
"IBM863"
,
// 7 IBM_863
"IBM865"
,
// 8 IBM_865
""
,
// 9 Reserved
""
,
// 10 SYMBOL
""
,
// 11 ASCII_US
"ISO-8859-1"
,
// 12 ISO_8859_1
"ISO-8859-2"
,
// 13 ISO_8859_2
"ISO-8859-3"
,
// 14 ISO_8859_3
"ISO-8859-4"
,
// 15 ISO_8859_4
"ISO-8859-5"
,
// 16 ISO_8859_5
"ISO-8859-6"
,
// 17 ISO_8859_6
"ISO-8859-7"
,
// 18 ISO_8859_7
"ISO-8859-8"
,
// 19 ISO_8859_8
"ISO-8859-9"
,
// 20 ISO_8859_9
"ISO-8859-14"
,
// 21 ISO_8859_14
"ISO-8859-15"
,
// 22 ISO_8859_15
"IBM737"
,
// 23 IBM_737
"IBM775"
,
// 24 IBM_775
"IBM852"
,
// 25 IBM_852
"IBM855"
,
// 26 IBM_855
"IBM857"
,
// 27 IBM_857
"IBM862"
,
// 28 IBM_862
"IBM864"
,
// 29 IBM_864
"IBM866"
,
// 30 IBM_866
"IBM869"
,
// 31 IBM_869
"windows-874"
,
// 32 MS_874
"windows-1250"
,
// 33 MS_1250
"windows-1251"
,
// 34 MS_1251
"windows-1253"
,
// 35 MS_1253
"windows-1254"
,
// 36 MS_1254
"windows-1255"
,
// 37 MS_1255
"windows-1256"
,
// 38 MS_1256
"windows-1257"
,
// 39 MS_1257
"windows-1258"
,
// 40 MS_1258
""
,
// 41 APPLE_ARABIC
""
,
// 42 APPLE_CENTEURO
""
,
// 43 APPLE_CROATIAN
"x-mac-cyrillic"
,
// 44 APPLE_CYRILLIC
""
,
// 45 APPLE_DEVANAGARI
""
,
// 46 APPLE_FARSI
""
,
// 47 APPLE_GREEK
""
,
// 48 APPLE_GUJARATI
""
,
// 49 APPLE_GURMUKHI
""
,
// 50 APPLE_HEBREW
""
,
// 51 APPLE_ICELAND
""
,
// 52 APPLE_ROMANIAN
""
,
// 53 APPLE_THAI
""
,
// 54 APPLE_TURKISH
""
,
// 55 APPLE_UKRAINIAN
""
,
// 56 APPLE_CHINSIMP
""
,
// 57 APPLE_CHINTRAD
""
,
// 58 APPLE_JAPANESE
""
,
// 59 APPLE_KOREAN
"windows-932"
,
// 60 MS_932
"windows-936"
,
// 61 MS_936
"windows-949"
,
// 62 MS_949
"windows-950"
,
// 63 MS_950
""
,
// 64 SHIFT_JIS
"GB2312"
,
// 65 GB_2312
""
,
// 66 GBT_12345
""
,
// 67 GBK
"Big5"
,
// 68 BIG5
""
,
// 69 EUC_JP
""
,
// 70 EUC_CN
""
,
// 71 EUC_TW
""
,
// 72 ISO_2022_JP
""
,
// 73 ISO_2022_CN
""
,
// 74 KOI8_R
"UTF-7"
,
// 75 UTF7
"UTF-8"
,
// 76 UTF8
"ISO-8859-10"
,
// 77 ISO_8859_10
"ISO-8859-13"
,
// 78 ISO_8859_13
"EUC-KR"
,
// 79 EUC_KR
""
,
// 80 ISO_2022_KR
""
,
// 81 JIS_X_0201
""
,
// 82 JIS_X_0208
""
,
// 83 JIS_X_0212
"windows-1361"
,
// 84 MS_1361
""
,
// 85 GB_18030
""
,
// 86 BIG5_HKSCS
""
,
// 87 TIS_620
"KOI8-U"
,
// 88 KOI8_U
""
,
// 89 ISCII_DEVANAGARI
""
,
// 90 JAVA_UTF8
""
,
// 91 ADOBE_STANDARD
""
,
// 92 ADOBE_SYMBOL
""
,
// 93 PT154
""
// 94 ADOBE_DINGBATS
};
namespace
MetaFile
{
void
parseString
(
CDataStream
&
stream
,
std
::
wstring
&
string
,
unsigned
short
version
,
unsigned
short
charset
)
int
parseString
(
CDataStream
&
stream
,
std
::
wstring
&
string
,
unsigned
short
version
,
unsigned
short
charset
)
{
int
nRead
=
0
;
if
(
charset
==
0xffff
)
//RTL_UNICODE
{
unsigned
int
length
;
...
...
@@ -46,7 +144,8 @@ namespace MetaFile
string
=
NSStringExt
::
CConverter
::
GetUnicodeFromUTF16
((
unsigned
short
*
)
stream
.
GetCurPtr
(),
length
);
stream
.
Skip
(
length
*
2
);
stream
.
Skip
(
length
*
2
);
nRead
=
length
*
2
+
4
;
}
else
{
...
...
@@ -57,11 +156,29 @@ namespace MetaFile
{
std
::
string
ansiString
=
std
::
string
((
char
*
)
stream
.
GetCurPtr
(),
length
);
string
=
std
::
wstring
(
ansiString
.
begin
(),
ansiString
.
end
());
}
else
}
else
{
std
::
string
coding_name
;
if
(
charset
<
95
)
coding_name
=
std
::
string
(
CodingCharsets
[
charset
]);
if
(
!
coding_name
.
empty
())
{
NSUnicodeConverter
::
CUnicodeConverter
converter
;
string
=
converter
.
toUnicode
((
char
*
)
stream
.
GetCurPtr
(),
length
,
coding_name
.
c_str
());
}
else
{
string
=
NSStringExt
::
CConverter
::
GetUnicodeFromSingleByteString
((
unsigned
char
*
)
stream
.
GetCurPtr
(),
length
,
(
NSStringExt
::
CConverter
::
ESingleByteEncoding
)
charset
);
(
NSStringExt
::
CConverter
::
ESingleByteEncoding
)
charset
);
//не все
}
}
stream
.
Skip
(
length
);
nRead
=
length
+
2
;
}
return
nRead
;
}
VersionCompat
::
VersionCompat
()
...
...
@@ -326,31 +443,32 @@ CDataStream& operator>>(CDataStream &stream, CSvmFont *font)
{
unsigned
short
version
;
unsigned
int
totalSize
;
unsigned
int
totalRead
=
0
;
stream
>>
version
;
stream
>>
totalSize
;
parseString
(
stream
,
font
->
sFamilyName
,
version
);
parseString
(
stream
,
font
->
sStyle
,
version
);
totalRead
+=
parseString
(
stream
,
font
->
sFamilyName
,
version
);
totalRead
+=
parseString
(
stream
,
font
->
sStyle
,
version
);
stream
>>
font
->
SizeWidth
;
stream
>>
font
->
SizeHeight
;
stream
>>
font
->
SizeWidth
;
totalRead
+=
4
;
stream
>>
font
->
SizeHeight
;
totalRead
+=
4
;
stream
>>
font
->
CharSet
;
stream
>>
font
->
Family
;
stream
>>
font
->
Pitch
;
stream
>>
font
->
Weight
;
stream
>>
font
->
Underline
;
stream
>>
font
->
StrikeOut
;
stream
>>
font
->
Italic
;
stream
>>
font
->
Language
;
stream
>>
font
->
Width
;
stream
>>
font
->
CharSet
;
totalRead
+=
2
;
stream
>>
font
->
Family
;
totalRead
+=
2
;
stream
>>
font
->
Pitch
;
totalRead
+=
2
;
stream
>>
font
->
Weight
;
totalRead
+=
2
;
stream
>>
font
->
Underline
;
totalRead
+=
2
;
stream
>>
font
->
StrikeOut
;
totalRead
+=
2
;
stream
>>
font
->
Italic
;
totalRead
+=
2
;
stream
>>
font
->
Language
;
totalRead
+=
2
;
stream
>>
font
->
Width
;
totalRead
+=
2
;
stream
>>
font
->
Orientation
;
stream
>>
font
->
bWordline
;
stream
>>
font
->
bOutline
;
stream
>>
font
->
bShadow
;
stream
>>
font
->
Kerning
;
stream
>>
font
->
Orientation
;
totalRead
+=
2
;
stream
>>
font
->
bWordline
;
totalRead
+=
1
;
stream
>>
font
->
bOutline
;
totalRead
+=
1
;
stream
>>
font
->
bShadow
;
totalRead
+=
1
;
stream
>>
font
->
Kerning
;
totalRead
+=
1
;
char
temp8
;
bool
tempbool
;
...
...
@@ -358,17 +476,17 @@ CDataStream& operator>>(CDataStream &stream, CSvmFont *font)
if
(
version
>
1
)
{
stream
>>
temp8
;
// relief
stream
>>
tempu16
;
// language
stream
>>
tempbool
;
// vertical
stream
>>
temp8
;
totalRead
+=
1
;
// relief
stream
>>
tempu16
;
totalRead
+=
2
;
// language
stream
>>
tempbool
;
totalRead
+=
1
;
// vertical
if
(
tempbool
)
font
->
Orientation
=
2
;
stream
>>
tempu16
;
// emphasis
stream
>>
tempu16
;
totalRead
+=
2
;
// emphasis
}
if
(
version
>
2
)
{
stream
>>
tempu16
;
// overline
stream
>>
tempu16
;
totalRead
+=
2
;
// overline
}
return
stream
;
}
...
...
DesktopEditor/raster/Metafile/StarView/SvmObjects.h
View file @
435bb02d
...
...
@@ -428,7 +428,7 @@ public:
TSvmColor
Color
;
};
void
parseString
(
CDataStream
&
stream
,
std
::
wstring
&
string
,
unsigned
short
version
=
0
,
unsigned
short
charset
=
0
);
int
parseString
(
CDataStream
&
stream
,
std
::
wstring
&
string
,
unsigned
short
version
=
0
,
unsigned
short
charset
=
0
);
CDataStream
&
operator
>>
(
CDataStream
&
stream
,
VersionCompat
&
compat
);
CDataStream
&
operator
>>
(
CDataStream
&
stream
,
Fraction
&
fract
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment