forked from JanX2/JXLS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JXLSCell.mm
171 lines (153 loc) · 3.09 KB
/
JXLSCell.mm
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
//
// JXLSCell.mm
// JXLS
//
// Created by David Hoerl on 10/26/08.
// Copyright (c) 2008-2013 David Hoerl. Some rights reserved: <http://opensource.org/licenses/BSD-3-Clause>
// Copyright (c) 2013 Jan Weiß. Some rights reserved: <http://opensource.org/licenses/BSD-3-Clause>
//
#include <stdint.h>
#include <string>
#include "xlslib.h"
#if 0
#import "cell.h"
#import "format.h"
#import "extformat.h"
#endif
using namespace xlslib_core;
using namespace xlslib_strings;
#import "JXLSCell.h"
#import "JXLSFont.h"
#import "JXLSFormat.h"
#import "JXLSExtendedFormat.h"
#define CELL(a) ((xlslib_core::cell_t *)(a))
@implementation JXLSCell
{
xlslib_core::cell_t *_cell;
}
-(instancetype)initWithCell:(void *)cl
{
self = [super init];
_cell = CELL(cl);
return self;
}
-(void *)cell
{
return _cell;
}
// xf_i interface
-(void)setFont:(JXLSFont *)aFont
{
_cell->font((font_t *)[aFont font]);
}
-(void)setHorizontalAlignment:(halign_option_t)ha_option
{
_cell->halign(ha_option);
}
-(void)setVerticalAlignment:(valign_option_t)va_option
{
_cell->valign(va_option);
}
-(void)setIndentation:(indent_option_t)indent_option
{
_cell->indent(indent_option);
}
-(void)setOrientation:(txtori_option_t)ori_option
{
_cell->orientation(ori_option);
}
-(void)setForegroundFillColor:(color_name_t)color
{
_cell->fillfgcolor(color);
}
-(void)setBackgroundFillColor:(color_name_t)color
{
_cell->fillbgcolor(color);
}
-(void)setFillStyle:(fill_option_t)fill
{
_cell->fillstyle(fill);
}
-(void)setLocked:(BOOL)locked_opt
{
_cell->locked((bool)locked_opt);
}
-(void)setHidden:(BOOL)hidden_opt
{
_cell->hidden((bool)hidden_opt);
}
-(void)setWraps:(BOOL)wrap_opt
{
_cell->wrap((bool)wrap_opt);
}
-(void)setBorderStyle:(border_style_t)style forSide:(border_side_t)side
{
_cell->borderstyle(side, style);
}
-(void)setBorderColor:(color_name_t)color forSide:(border_side_t)side
{
_cell->bordercolor(side, color);
}
//font_i interface
-(void)setFontName:(NSString *)name
{
_cell->fontname([name cStringUsingEncoding:NSASCIIStringEncoding]);
}
-(void)setFontHeight:(uint16_t)fntheight
{
_cell->fontheight((unsigned16_t)fntheight);
}
-(void)setFontBold:(boldness_option_t)fntboldness
{
_cell->fontbold(fntboldness);
}
-(void)setFontUnderline:(underline_option_t)fntunderline
{
_cell->fontunderline(fntunderline);
}
-(void)setFontScript:(script_option_t)fntscript
{
_cell->fontscript(fntscript);
}
-(void)setFontColor:(color_name_t)fntcolor
{
_cell->fontcolor(fntcolor);
}
-(void)setFontItalic:(BOOL)italic
{
_cell->fontitalic((bool)italic);
}
-(void)setFontStrikeout:(BOOL)so
{
_cell->fontstrikeout((bool)so);
}
-(void)setFontOutline:(BOOL)ol
{
_cell->fontoutline((bool)ol);
}
-(void)setFontShadow:(BOOL)sh
{
_cell->fontshadow((bool)sh);
}
// Other
-(uint32_t)row
{
return _cell->GetRow();
}
-(uint32_t)column
{
return _cell->GetCol();
}
-(void)setExtendedFormat:(JXLSExtendedFormat *)extFmt
{
_cell->SetXF((xf_t *)[extFmt extendedFormat]);
}
-(JXLSExtendedFormat *)extendedFormat
{
JXLSExtendedFormat *extFmt;
xf_t *fmt;
fmt = _cell->GetXF();
extFmt = [[JXLSExtendedFormat alloc] initWithExtendedFormat:fmt];
return extFmt;
}
@end