LibreOffice Module hwpfilter (master) 1
Macros | Functions | Variables
hcode.cxx File Reference
#include <sal/config.h>
#include "precompile.h"
#include <comphelper/base64.hxx>
#include <comphelper/sequence.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <o3tl/safeint.hxx>
#include <o3tl/sprintf.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/types.h>
#include <sal/macros.h>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include "hcode.h"
#include "ksc5601.h"
Include dependency graph for hcode.cxx:

Go to the source code of this file.

Macros

#define HCA_KSS   0x3400
 
#define HCA_TG   0x37C0
 
#define noneks   0xA1A1
 
#define UNI_HANGUL_FIRST   0xac00
 
#define NUM_JOONGSEONG   21
 
#define NUM_JONGSEONG   28
 
#define LINEBASE   0x3013
 
#define IsHangul(c)   ((c) & 0x8000)
 
#define IsHanja(c)   (((c) & 0x4000)==0x4000)
 

Functions

static hchar jaso2ks (hchar hh)
 Rule : Hangule johap code => unicode Hanja johap code => ks code => unicode Special johap code => ks code => unicode. More...
 
static char LineCharDir (hchar ch)
 
static hchar s_hh2ks (hchar hh)
 Convert hwp's special character to ks. More...
 
static hchar s_hh2kssm (hchar hh)
 Convert hwp's special character to kssm. More...
 
static hchar lineCharConv (hchar ch)
 
static int KsSearch (hchar c)
 
static hchar cdkssm2ks_han (hchar kssm)
 
int hcharconv (hchar ch, hchar *dest, int codeType)
 Transfer combination-code for internal using of hwp to ascii. More...
 
int kssm_hangul_to_ucs2 (hchar ch, hchar *dest)
 
hchar ksc5601_sym_to_ucs2 (hchar input)
 
hchar ksc5601_han_to_ucs2 (hchar input)
 
OUString hstr2OUString (hchar const *hstr)
 
::std::string hstr2ksstr (hchar const *hstr)
 Convert 'Hangul and Computer' strings to the completion code(KSC5601-87) More...
 
hchar_string kstr2hstr (uchar const *src)
 한글을 포함할 수 있는 char형스트링을 한컴스트링으로 변환한다. More...
 
OUString hcolor2str (uchar color, uchar shade, bool bIsChar)
 hwp의 경로를 windows형태로 바꾼다. More...
 
OUString rgb2str (unsigned char red, unsigned char green, unsigned char blue)
 
OUString rgb2str (int32_t rgb)
 
::std::string urltounix (const char *src)
 hwp의 경로를 unix형태로 바꾼다. More...
 
OUString base64_encode_string (const uchar *buf, unsigned int len)
 
double calcAngle (double x1, double y1, double x2, double y2)
 

Variables

const hchar ksTbl [2350]
 kssm code table matching with ks index More...
 
const unsigned tblhhtg_ks []
 ks symbols More...
 
const unsigned hhtg_tg []
 kssm symbols More...
 
const hchar jaso_hh_code []
 
const hchar choseong_to_unicode []
 
const hchar joongseong_to_unicode []
 
const hchar jongseong_to_unicode []
 
const hchar jamo_to_unicode []
 
const JamoComp jamocomp1_to_unicode []
 

Macro Definition Documentation

◆ HCA_KSS

#define HCA_KSS   0x3400

Definition at line 50 of file hcode.cxx.

◆ HCA_TG

#define HCA_TG   0x37C0

Definition at line 51 of file hcode.cxx.

◆ IsHangul

#define IsHangul (   c)    ((c) & 0x8000)

Definition at line 542 of file hcode.cxx.

◆ IsHanja

#define IsHanja (   c)    (((c) & 0x4000)==0x4000)

Definition at line 543 of file hcode.cxx.

◆ LINEBASE

#define LINEBASE   0x3013

Definition at line 390 of file hcode.cxx.

◆ noneks

#define noneks   0xA1A1

Definition at line 52 of file hcode.cxx.

◆ NUM_JONGSEONG

#define NUM_JONGSEONG   28

Definition at line 57 of file hcode.cxx.

◆ NUM_JOONGSEONG

#define NUM_JOONGSEONG   21

Definition at line 56 of file hcode.cxx.

◆ UNI_HANGUL_FIRST

#define UNI_HANGUL_FIRST   0xac00

Definition at line 54 of file hcode.cxx.

Function Documentation

◆ base64_encode_string()

OUString base64_encode_string ( const uchar buf,
unsigned int  len 
)

◆ calcAngle()

double calcAngle ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 1402 of file hcode.cxx.

References basegfx::rad2deg().

Referenced by HwpReader::makePictureDRAW().

◆ cdkssm2ks_han()

static hchar cdkssm2ks_han ( hchar  kssm)
static

Definition at line 524 of file hcode.cxx.

References index, jaso2ks(), KsSearch(), and ksTbl.

Referenced by hcharconv().

◆ hcharconv()

int hcharconv ( hchar  ch,
hchar dest,
int  codeType 
)

◆ hcolor2str()

OUString hcolor2str ( uchar  color,
uchar  shade,
bool  bIsChar = false 
)

hwp의 경로를 windows형태로 바꾼다.

color인덱스 값과 음영값을 조합하여 스타오피스의 color로 변환

Definition at line 1241 of file hcode.cxx.

References rgb2str().

Referenced by HwpReader::makeCaptionStyle(), HwpReader::makeFStyle(), HwpReader::makeTableStyle(), HwpReader::parseCharShape(), and HwpReader::parseParaShape().

◆ hstr2ksstr()

::std::string hstr2ksstr ( hchar const *  hstr)

Convert 'Hangul and Computer' strings to the completion code(KSC5601-87)

한컴스트링을 완성형스트링으로 변환한다.

Definition at line 1186 of file hcode.cxx.

References hcharconv(), and KS.

Referenced by HwpReader::makeHyperText(), and HwpReader::parseCharShape().

◆ hstr2OUString()

OUString hstr2OUString ( hchar const *  hstr)

◆ jaso2ks()

static hchar jaso2ks ( hchar  hh)
static

Rule : Hangule johap code => unicode Hanja johap code => ks code => unicode Special johap code => ks code => unicode.

Definition at line 570 of file hcode.cxx.

References i, jaso_hh_code, and SAL_N_ELEMENTS.

Referenced by cdkssm2ks_han().

◆ ksc5601_han_to_ucs2()

hchar ksc5601_han_to_ucs2 ( hchar  input)

Definition at line 1158 of file hcode.cxx.

References ch, idx, ksc5601_2uni_page21, o3tl::make_unsigned(), SAL_N_ELEMENTS, and value.

Referenced by hcharconv().

◆ ksc5601_sym_to_ucs2()

hchar ksc5601_sym_to_ucs2 ( hchar  input)

Definition at line 1146 of file hcode.cxx.

References ch, idx, ksc5601_2uni_page21, o3tl::make_unsigned(), SAL_N_ELEMENTS, and value.

Referenced by hcharconv().

◆ KsSearch()

static int KsSearch ( hchar  c)
static

Definition at line 502 of file hcode.cxx.

References ksTbl.

Referenced by cdkssm2ks_han().

◆ kssm_hangul_to_ucs2()

int kssm_hangul_to_ucs2 ( hchar  ch,
hchar dest 
)

◆ kstr2hstr()

hchar_string kstr2hstr ( uchar const *  src)

한글을 포함할 수 있는 char형스트링을 한컴스트링으로 변환한다.

Definition at line 1217 of file hcode.cxx.

References i.

Referenced by HwpReader::makeDrawMiscStyle(), HwpReader::makeHyperText(), HwpReader::makePageStyle(), HwpReader::makePicture(), HwpReader::makeStyles(), and HwpReader::parseCharShape().

◆ lineCharConv()

static hchar lineCharConv ( hchar  ch)
static

Definition at line 471 of file hcode.cxx.

References ch, and LineCharDir().

Referenced by hcharconv().

◆ LineCharDir()

static char LineCharDir ( hchar  ch)
static

Definition at line 393 of file hcode.cxx.

References ch, and LINEBASE.

Referenced by hcharconv(), and lineCharConv().

◆ rgb2str() [1/2]

OUString rgb2str ( int32_t  rgb)

Definition at line 1304 of file hcode.cxx.

References rgb2str().

◆ rgb2str() [2/2]

OUString rgb2str ( unsigned char  red,
unsigned char  green,
unsigned char  blue 
)

◆ s_hh2ks()

static hchar s_hh2ks ( hchar  hh)
static

Convert hwp's special character to ks.

Definition at line 405 of file hcode.cxx.

References HCA_KSS, HCA_TG, i, idx, and tblhhtg_ks.

Referenced by hcharconv().

◆ s_hh2kssm()

static hchar s_hh2kssm ( hchar  hh)
static

Convert hwp's special character to kssm.

Definition at line 444 of file hcode.cxx.

References HCA_KSS, HCA_TG, hhtg_tg, i, and idx.

Referenced by hcharconv().

◆ urltounix()

::std::string urltounix ( const char *  src)

hwp의 경로를 unix형태로 바꾼다.

Definition at line 1307 of file hcode.cxx.

References i.

Referenced by HwpReader::makeDrawMiscStyle(), HwpReader::makeHyperText(), HwpReader::makePageStyle(), and HwpReader::makePicture().

Variable Documentation

◆ choseong_to_unicode

const hchar choseong_to_unicode[]
Initial value:
=
{
0x111e, 0, 0x1100, 0x1101, 0x1102, 0x1103, 0x1104, 0x1105,
0x1106, 0x1107, 0x1108, 0x1109, 0x110a, 0x110b, 0x110c, 0x110d,
0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1120, 0x1121, 0x1127,
0x112b, 0x112d, 0x112f, 0x1132, 0x1136, 0x1140, 0x114c, 0x1158
}

Definition at line 582 of file hcode.cxx.

Referenced by kssm_hangul_to_ucs2().

◆ hhtg_tg

const unsigned hhtg_tg[]
Initial value:
=
{
0xD065, 0x8B69, 0x89C1, 0xC4F1, 0xCF41, 0xC8E1, 0xD3C5, 0xD931,
0xD931, 0xD481, 0xD482, 0xD488, 0xD48A, 0xD48F, 0xD493, 0xD494,
0xD4B0, 0xD4B1, 0xD4B2, 0xD931, 0xD931, 0xD4B5, 0xD4B6, 0xD4B7,
0xD4B8, 0xD4B9, 0xD4BA, 0xD4BB, 0xD4BC, 0xD4BD, 0xD4BE, 0xD496,
0xD497, 0xD49C, 0xD4A9, 0xD4AF, 0xD4F4, 0xD4F5, 0xD4C6, 0xD4C7,
0xD4C8, 0xD4C9, 0xD4CA, 0xD4CB, 0xD4CC, 0xD4CD, 0xD4CE, 0xD4CF,
0xD4D0, 0xD4D1, 0xD4D2, 0xD4D3, 0xD4D4, 0xD4D5, 0xD4D6, 0xD4D7,
0xD4D8, 0xD4F7, 0xD4FA, 0xD4FE, 0xD4DC, 0xD4DD, 0xD4DE, 0xD4DF
}

kssm symbols

Definition at line 378 of file hcode.cxx.

Referenced by s_hh2kssm().

◆ jamo_to_unicode

const hchar jamo_to_unicode[]

Definition at line 612 of file hcode.cxx.

Referenced by kssm_hangul_to_ucs2().

◆ jamocomp1_to_unicode

const JamoComp jamocomp1_to_unicode[]

Definition at line 676 of file hcode.cxx.

Referenced by kssm_hangul_to_ucs2().

◆ jaso_hh_code

const hchar jaso_hh_code[]
Initial value:
=
{
34881, 35905, 33860, 36929, 33862, 33863, 37953, 38977, 40001, 33866,
33867,
33868, 33869, 33870, 33871, 33872, 41025, 42049, 43073, 33876, 44097,
45121,
46145, 47169, 48193, 49217, 50241, 51265, 52289, 53313, 33889, 33921,
33953,
33985, 34017, 34113, 34145, 34177, 34209, 34241, 34273, 34369, 34401,
34433,
34465, 34497, 34529, 34625, 34657, 34689, 34721
}

Definition at line 545 of file hcode.cxx.

Referenced by jaso2ks().

◆ jongseong_to_unicode

const hchar jongseong_to_unicode[]
Initial value:
=
{
0x11d9, 0 , 0x11a8, 0x11a9, 0x11aa, 0x11ab, 0x11ac, 0x11ad,
0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5,
0x11b6, 0x11b7, 0x11e6, 0x11b8, 0x11b9, 0x11ba, 0x11bb, 0x11bc,
0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x11eb, 0x11f0
}

Definition at line 598 of file hcode.cxx.

Referenced by kssm_hangul_to_ucs2().

◆ joongseong_to_unicode

const hchar joongseong_to_unicode[]
Initial value:
=
{
0, 0, 0, 0x1161, 0x1162, 0x1163, 0x1164, 0x1165,
0, 0, 0x1166, 0x1167, 0x1168, 0x1169, 0x116a, 0x116b,
0, 0x1188, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171,
0x1191, 0x1194, 0x1172, 0x1173, 0x1174, 0x1175, 0x119e, 0x11a1
}

Definition at line 590 of file hcode.cxx.

Referenced by kssm_hangul_to_ucs2().

◆ ksTbl

const hchar ksTbl[2350]

kssm code table matching with ks index

Definition at line 62 of file hcode.cxx.

Referenced by cdkssm2ks_han(), and KsSearch().

◆ tblhhtg_ks

const unsigned tblhhtg_ks[]
Initial value:
=
{
0xC7D1, 0xB1DB, 0xB0FA, 0xC4C4, 0xC7BB, 0xC5CD, noneks, noneks,
0xA2B1, 0xA3DF, 0xA2D5, 0xA6B1, 0xA1B8, 0xA1B9, 0xA3DF, 0xA1DA,
0xA2C6, 0xA2CC, 0xA2CB, noneks, noneks, 0xA6BE, 0xA6B9, 0xA6C1,
0xA6C2, 0xA6B4, 0xA6AD, 0xA6AF, 0xA6B0, 0xA6C3, 0xA6C4, noneks,
0xA6AE, 0xA6B0, 0xA2D7, 0xA1E1, 0xA1D6, noneks, 0xA6BC, 0xA6B7,
0xA6B1, 0xA6AE, 0xA6B5, 0xA6B3, 0xA6B2, 0xA6AC, 0xA6B6, 0xA6BA,
0xA6BF, 0xA6B8, 0xA6BD, 0xA6C5, 0xA6C6, 0xA6C8, 0xA6C7, 0xA6C0,
0xA6BB, noneks, noneks, noneks, 0xA1E1, 0xA1E1, 0xA1E1, 0xA1E1
}
#define noneks
Definition: hcode.cxx:52

ks symbols

Definition at line 363 of file hcode.cxx.

Referenced by s_hh2ks().