File size: 4,055 Bytes
d94b56e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# -*- coding: utf-8 -*-
#
#   pyhwp : hwp file format parser in python
#   Copyright (C) 2010-2023 mete0r <https://github.com/mete0r>
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals

from hwp5.binmodel.controlchar import CHID
from hwp5.dataio import Flags
from hwp5.dataio import UINT32
from hwp5.dataio import BSTR
from hwp5.dataio import BYTE
from hwp5.binmodel.tagid71_ctrl_data import ControlData
from hwp5.binmodel.controls._shared import Control


class Field(Control):
    ''' 4.2.10.15 필드 시작 '''

    Flags = Flags(UINT32,
                  0, 'editableInReadOnly',
                  11, 14, 'visitedType',
                  15, 'modified')

    def attributes(cls):
        yield cls.Flags, 'flags',
        yield BYTE, 'extra_attr',
        yield BSTR, 'command',
        yield UINT32, 'id',
    attributes = classmethod(attributes)


class FieldUnknown(Field):
    chid = CHID.FIELD_UNK


class FieldDate(Field):
    chid = CHID.FIELD_DTE


class FieldDocDate(Field):
    chid = CHID.FIELD_DDT


class FieldPath(Field):
    chid = CHID.FIELD_PAT


class FieldBookmark(Field):
    chid = CHID.FIELD_BMK


class FieldMailMerge(Field):
    chid = CHID.FIELD_MMG


class FieldCrossRef(Field):
    chid = CHID.FIELD_XRF


class FieldFormula(Field):
    chid = CHID.FIELD_FMU


class FieldClickHere(Field):
    chid = CHID.FIELD_CLK


class FieldClickHereData(ControlData):
    parent_model_type = FieldClickHere


class FieldSummary(Field):
    chid = CHID.FIELD_SMR


class FieldUserInfo(Field):
    chid = CHID.FIELD_USR


class FieldHyperLink(Field):
    chid = CHID.FIELD_HLK

    def geturl(self):
        s = self.command.split(';')
        return s[0].replace('\\:', ':')


class FieldRevisionSign(Field):
    chid = CHID.FIELD_REVISION_SIGN


class FieldRevisionDelete(Field):
    chid = CHID.FIELD_REVISION_DELETE


class FieldRevisionAttach(Field):
    chid = CHID.FIELD_REVISION_ATTACH


class FieldRevisionClipping(Field):
    chid = CHID.FIELD_REVISION_CLIPPING


class FieldRevisionSawtooth(Field):
    chid = CHID.FIELD_REVISION_SAWTOOTH


class FieldRevisionThinking(Field):
    chid = CHID.FIELD_REVISION_THINKING


class FieldRevisionPraise(Field):
    chid = CHID.FIELD_REVISION_PRAISE


class FieldRevisionLine(Field):
    chid = CHID.FIELD_REVISION_LINE


class FieldRevisionSimpleChange(Field):
    chid = CHID.FIELD_REVISION_SIMPLECHANGE


class FieldRevisionHyperlink(Field):
    chid = CHID.FIELD_REVISION_HYPERLINK


class FieldRevisionLineAttach(Field):
    chid = CHID.FIELD_REVISION_LINEATTACH


class FieldRevisionLineLink(Field):
    chid = CHID.FIELD_REVISION_LINELINK


class FieldRevisionLineTransfer(Field):
    chid = CHID.FIELD_REVISION_LINETRANSFER


class FieldRevisionRightMove(Field):
    chid = CHID.FIELD_REVISION_RIGHTMOVE


class FieldRevisionLeftMove(Field):
    chid = CHID.FIELD_REVISION_LEFTMOVE


class FieldRevisionTransfer(Field):
    chid = CHID.FIELD_REVISION_TRANSFER


class FieldRevisionSimpleInsert(Field):
    chid = CHID.FIELD_REVISION_SIMPLEINSERT


class FieldRevisionSplit(Field):
    chid = CHID.FIELD_REVISION_SPLIT


class FieldRevisionChange(Field):
    chid = CHID.FIELD_REVISION_CHANGE


class FieldMemo(Field):
    chid = CHID.FIELD_MEMO


class FieldPrivateInfoSecurity(Field):
    chid = CHID.FIELD_PRIVATE_INFO_SECURITY