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
dcec7447
Commit
dcec7447
authored
Dec 04, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XlsFormat - apply theme style from format office 2010 and later
parent
5f12552f
Changes
27
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
437 additions
and
320 deletions
+437
-320
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.cpp
...ficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.cpp
+8
-84
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/TxO.cpp
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/TxO.cpp
+1
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.cpp
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.cpp
+3
-4
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.h
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.h
+3
-6
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h
...2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h
+19
-20
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.cpp
...lsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.cpp
+90
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.h
...eXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.h
+8
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/List12TableStyleClientInfo.cpp
...rmat/Logic/Biff_structures/List12TableStyleClientInfo.cpp
+5
-5
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/List12TableStyleClientInfo.h
...Format/Logic/Biff_structures/List12TableStyleClientInfo.h
+5
-5
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/LongRGB.cpp
...sFile2/source/XlsFormat/Logic/Biff_structures/LongRGB.cpp
+8
-7
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/LongRGB.h
...XlsFile2/source/XlsFormat/Logic/Biff_structures/LongRGB.h
+2
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.cpp
...sFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.cpp
+131
-52
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.h
...XlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.h
+12
-9
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProp.cpp
...lsFile2/source/XlsFormat/Logic/Biff_structures/XFProp.cpp
+4
-6
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProp.h
...eXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProp.h
+2
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropBorder.h
...le2/source/XlsFormat/Logic/Biff_structures/XFPropBorder.h
+0
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropColor.cpp
...e2/source/XlsFormat/Logic/Biff_structures/XFPropColor.cpp
+6
-8
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropColor.h
...ile2/source/XlsFormat/Logic/Biff_structures/XFPropColor.h
+1
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradientStop.cpp
...ce/XlsFormat/Logic/Biff_structures/XFPropGradientStop.cpp
+1
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProps.cpp
...sFile2/source/XlsFormat/Logic/Biff_structures/XFProps.cpp
+59
-42
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProps.h
...XlsFile2/source/XlsFormat/Logic/Biff_structures/XFProps.h
+19
-13
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FEAT11.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_unions/FEAT11.cpp
+8
-5
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.cpp
...lsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.cpp
+34
-33
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.cpp
...iceXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.cpp
+2
-4
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.h
...fficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.h
+1
-0
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
+4
-4
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
...XlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
+1
-0
No files found.
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.cpp
View file @
dcec7447
...
...
@@ -138,30 +138,13 @@ int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr, std::wstr
}
else
CP_XML_ATTR
(
L"i"
,
false
);
//if (bCharSet.value())
//{
// CP_XML_NODE(L"charset")
// {
// CP_XML_ATTR(L"val", bCharSet);
// }
//}
switch
(
sss
)
{
case
1
:
CP_XML_ATTR
(
L"cap"
,
L"all"
);
break
;
case
2
:
CP_XML_ATTR
(
L"cap"
,
L"small"
);
break
;
}
//if ((fCondense.value()) && (*fCondense.value()))
//{
// CP_XML_NODE(L"condense")
// {
// CP_XML_ATTR(L"val", (int)(*fCondense.value()));
// }
//}
//if ((fExtend.value()) && (fExtend))
// {
// CP_XML_NODE(L"extend")
// {
// CP_XML_ATTR(L"val", fExtend);
// }
// }
if
(
(
icv
<
0x7fff
)
||
color_ext
.
enabled
)
{
if
(
color_ext
.
enabled
)
...
...
@@ -236,66 +219,7 @@ int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr, std::wstr
{
CP_XML_NODE
(
namespace_
+
L"rtl"
);
}
//if ((fOutline.value()) && (fOutline))
// {
// CP_XML_NODE(L"outline")
// {
// CP_XML_ATTR(L"val", fOutline);
// }
// }
//if (font.scheme)
//{
// CP_XML_NODE(L"scheme")
// {
// CP_XML_ATTR(L"val", *font.scheme);
// }
//}
//if ((fShadow.value()) && (fShadow))
// {
// CP_XML_NODE(L"shadow")
// {
// CP_XML_ATTR(L"val", fShadow);
// }
// }
//if ((fStrikeOut.value()) && (fStrikeOut))
//{
// CP_XML_NODE(L"strike")
// {
// CP_XML_ATTR(L"val", fStrikeOut);
// }
//}
// if ((uls.value()) && (*uls.value() > 0))
// {
// CP_XML_NODE(L"u")
// {
//switch(uls)
//{
// case 1: CP_XML_ATTR(L"val", "single");break;
// case 2: CP_XML_ATTR(L"val", "double");break;
// case 33: CP_XML_ATTR(L"val", "singleAccounting");break;
// case 34: CP_XML_ATTR(L"val", "doubleAccounting");break;
//}
// }
// }
// if ((sss.value()) && (*sss.value() > 0))
// {
// CP_XML_NODE(L"vertAlign")
// {
//switch(*sss.value())
//{
// case 1: CP_XML_ATTR(L"val", L"superscript");break;
// case 2: CP_XML_ATTR(L"val", L"subscript");break;
//}
//
// }
// }
}
}
return
0
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/TxO.cpp
View file @
dcec7447
...
...
@@ -32,7 +32,7 @@
#include "TxO.h"
#include
<Logic/Biff_records/Font.h>
#include
"Font.h"
#include <utils.h>
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.cpp
View file @
dcec7447
...
...
@@ -35,11 +35,10 @@
namespace
XLS
{
XF
::
XF
(
size_t
&
cell_xf_current_id
,
size_t
&
style_xf_current_id
)
:
cell
(
cell_xf_current_id
,
style_xf_current_id
),
style
(
cell_xf_current_id
,
style_xf_current_id
),
ixfParent
(
0
)
XF
::
XF
(
size_t
&
cell_xf_current_id
,
size_t
&
style_xf_current_id
)
:
cell
(
cell_xf_current_id
,
style_xf_current_id
),
style
(
cell_xf_current_id
,
style_xf_current_id
)
{
ixfParent
=
0
;
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.h
View file @
dcec7447
...
...
@@ -32,15 +32,12 @@
#pragma once
#include "BiffRecord.h"
#include
<Logic/Biff_structures/FontIndex.h>
#include
<Logic/Biff_structures/CellXF.h>
#include
<Logic/Biff_structures/StyleXF.h>
#include
"../Biff_structures/FontIndex.h"
#include
"../Biff_structures/CellXF.h"
#include
"../Biff_structures/StyleXF.h"
namespace
XLS
{
// Logical representation of XF record in BIFF8
class
XF
:
public
BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO
(
XF
)
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h
View file @
dcec7447
...
...
@@ -38,13 +38,12 @@ namespace XLS
struct
FillInfoExt
{
FillInfoExt
()
{
enabled
=
false
;
xclrType
=
icv
=
0
;
nTintShade
=
0
;
xclrValue
=
0
;}
bool
enabled
;
bool
enabled
=
false
;
unsigned
char
xclrType
;
unsigned
char
icv
;
short
nTintShade
;
unsigned
int
xclrValue
;
unsigned
char
xclrType
=
0
;
unsigned
char
icv
=
0
;
short
nTintShade
=
0
;
unsigned
int
xclrValue
=
0
;
};
struct
FillInfo
...
...
@@ -56,9 +55,9 @@ struct FillInfo
{
}
unsigned
char
fls
;
unsigned
char
icvFore
;
unsigned
char
icvBack
;
unsigned
char
fls
=
0
;
unsigned
char
icvFore
=
0
;
unsigned
char
icvBack
=
0
;
bool
operator
<
(
const
FillInfo
&
right
)
const
{
...
...
@@ -84,17 +83,17 @@ struct FillInfo
struct
BorderInfo
{
unsigned
char
dgLeft
;
unsigned
char
dgRight
;
unsigned
char
dgTop
;
unsigned
char
dgBottom
;
unsigned
char
dgDiag
;
unsigned
char
grbitDiag
;
unsigned
char
icvLeft
;
unsigned
char
icvRight
;
unsigned
char
icvTop
;
unsigned
char
icvBottom
;
unsigned
char
icvDiag
;
unsigned
char
dgLeft
=
0
;
unsigned
char
dgRight
=
0
;
unsigned
char
dgTop
=
0
;
unsigned
char
dgBottom
=
0
;
unsigned
char
dgDiag
=
0
;
unsigned
char
grbitDiag
=
0
;
unsigned
char
icvLeft
=
0
;
unsigned
char
icvRight
=
0
;
unsigned
char
icvTop
=
0
;
unsigned
char
icvBottom
=
0
;
unsigned
char
icvDiag
=
0
;
FillInfoExt
leftFillInfo_
;
FillInfoExt
rightFillInfo_
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.cpp
View file @
dcec7447
...
...
@@ -38,10 +38,11 @@ namespace XLS
{
CellXF
::
CellXF
(
size_t
&
cell_xf_current_id
,
size_t
&
style_xf_current_id
)
:
cell_xf_current_id_
(
cell_xf_current_id
),
style_xf_current_id_
(
style_xf_current_id
),
font_id
(
0xFFFF
)
CellXF
::
CellXF
(
size_t
&
cell_xf_current_id
,
size_t
&
style_xf_current_id
)
:
cell_xf_current_id_
(
cell_xf_current_id
),
style_xf_current_id_
(
style_xf_current_id
)
{
alc
=
alcV
=
0
;
font_id
=
0xFFFF
;
}
...
...
@@ -152,6 +153,91 @@ void CellXF::load(CFRecord& record)
}
}
void
CellXF
::
Update
(
ExtProp
*
ext_prop
)
{
if
(
!
ext_prop
)
return
;
switch
(
ext_prop
->
extType
)
{
case
0x0004
:
{
fill
.
foreFillInfo_
.
enabled
=
true
;
fill
.
foreFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
fill
.
foreFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
fill
.
foreFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
fill
.
foreFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
}
break
;
case
0x0005
:
{
fill
.
backFillInfo_
.
enabled
=
true
;
fill
.
backFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
fill
.
backFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
fill
.
backFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
fill
.
backFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
}
break
;
case
0x0007
:
{
border
.
topFillInfo_
.
enabled
=
true
;
border
.
topFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
border
.
topFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
border
.
topFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
border
.
topFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
}
break
;
case
0x0008
:
{
border
.
bottomFillInfo_
.
enabled
=
true
;
border
.
bottomFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
border
.
bottomFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
border
.
bottomFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
border
.
bottomFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
}
break
;
case
0x0009
:
{
border
.
leftFillInfo_
.
enabled
=
true
;
border
.
leftFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
border
.
leftFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
border
.
leftFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
border
.
leftFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
}
break
;
case
0x000A
:
{
border
.
rightFillInfo_
.
enabled
=
true
;
border
.
rightFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
border
.
rightFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
border
.
rightFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
border
.
rightFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
}
break
;
//case 0x000B: //diag color
//case 0x000C: //diag color
case
0x000D
:
{
font_color
.
enabled
=
true
;
font_color
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
font_color
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
font_color
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
font_color
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
}
break
;
//case 0x0006:
// extPropData.gradient_fill.toXML(own_tag);
// break;
case
0x000E
:
{
font_id
=
ext_prop
->
extPropData
.
font_scheme
;
}
break
;
case
0x000F
:
{
cIndent
=
ext_prop
->
extPropData
.
indent_level
;
}
break
;
}
}
void
CellXF
::
Update
(
XFProps
*
xfProps
)
{
if
(
!
xfProps
)
return
;
//
// std::wstringstream strm;
// xfProps->serialize_fill(strm);
// fill.ext = strm.str();
}
void
CellXF
::
RegisterFillBorder
()
{
for
(
size_t
i
=
0
;
i
<
ext_props
.
size
();
i
++
)
...
...
@@ -231,6 +317,8 @@ void CellXF::RegisterFillBorder()
border_x_id
=
m_GlobalWorkbookInfo
->
RegisterBorderId
(
border
);
fill_x_id
=
m_GlobalWorkbookInfo
->
RegisterFillId
(
fill
);
m_GlobalWorkbookInfo
->
RegisterFontColorId
(
font_id
,
font_color
);
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.h
View file @
dcec7447
...
...
@@ -36,6 +36,8 @@
namespace
XLS
{
class
XFProps
;
class
ExtProp
;
class
CFRecord
;
class
GlobalWorkbookInfo
;
...
...
@@ -74,13 +76,14 @@ public:
BorderInfo
border
;
FillInfo
fill
;
BiffStructurePtrVector
ext_props
;
FillInfoExt
font_color
;
size_t
font_id
;
bool
fHasXFExt
;
bool
fsxButton
;
//------------------------------------------------------------------
BiffStructurePtrVector
ext_props
;
BiffStructurePtrVector
xf_props
;
size_t
border_x_id
;
size_t
fill_x_id
;
...
...
@@ -88,6 +91,9 @@ public:
size_t
&
cell_xf_current_id_
;
size_t
&
style_xf_current_id_
;
void
Update
(
ExtProp
*
extProp
);
// xls style
void
Update
(
XFProps
*
xfProps
);
//xlsx style
void
RegisterFillBorder
();
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/List12TableStyleClientInfo.cpp
View file @
dcec7447
...
...
@@ -57,11 +57,11 @@ void List12TableStyleClientInfo::load(CFRecord& record)
unsigned
short
flags
;
record
>>
flags
;
nFirstColumn
=
GETBITS
(
flags
,
0
,
1
);
nLastColumn
=
GETBITS
(
flags
,
1
,
2
);
nRowStripes
=
GETBITS
(
flags
,
3
,
4
);
nColumnStripes
=
GETBITS
(
flags
,
5
,
6
);
nDefaultStyle
=
GETBITS
(
flags
,
9
,
10
);
fFirstColumn
=
GETBIT
(
flags
,
0
);
fLastColumn
=
GETBIT
(
flags
,
1
);
fRowStripes
=
GETBIT
(
flags
,
2
);
fColumnStripes
=
GETBIT
(
flags
,
3
);
fDefaultStyle
=
GETBIT
(
flags
,
6
);
record
>>
stListStyleName
;
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/List12TableStyleClientInfo.h
View file @
dcec7447
...
...
@@ -51,11 +51,11 @@ public:
virtual
void
load
(
CFRecord
&
record
);
unsigned
char
n
FirstColumn
;
unsigned
char
n
LastColumn
;
unsigned
char
n
RowStripes
;
unsigned
char
n
ColumnStripes
;
unsigned
char
n
DefaultStyle
;
bool
f
FirstColumn
;
bool
f
LastColumn
;
bool
f
RowStripes
;
bool
f
ColumnStripes
;
bool
f
DefaultStyle
;
XLUnicodeString
stListStyleName
;
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/LongRGB.cpp
View file @
dcec7447
...
...
@@ -37,24 +37,20 @@ namespace XLS
{
LongRGBA
::
LongRGBA
()
:
is_alpha
(
true
)
LongRGBA
::
LongRGBA
()
:
is_alpha
(
true
)
{
}
LongRGBA
::
LongRGBA
(
const
bool
alpha_present
)
:
is_alpha
(
alpha_present
)
LongRGBA
::
LongRGBA
(
const
bool
alpha_present
)
:
is_alpha
(
alpha_present
)
{
}
LongRGB
::
LongRGB
()
:
LongRGBA
(
false
)
LongRGB
::
LongRGB
()
:
LongRGBA
(
false
)
{
}
BiffStructurePtr
LongRGBA
::
clone
()
{
return
BiffStructurePtr
(
new
LongRGBA
(
*
this
));
...
...
@@ -78,9 +74,14 @@ void LongRGBA::load(CFRecord& record)
alpha
=
0
;
record
.
skipNunBytes
(
1
);
// reserved
}
strRGB
=
STR
::
toRGB
(
red
,
green
,
blue
);
strARGB
=
STR
::
toARGB
(
red
,
green
,
blue
,
alpha
);
}
_UINT32
LongRGBA
::
ToRGBA
()
{
return
((
unsigned
int
)(
(
(
unsigned
char
)(
red
)
)
|
(
(
(
unsigned
char
)(
green
)
)
<<
8
)
|
(
(
(
unsigned
char
)(
blue
)
)
<<
16
)
|
(
(
unsigned
char
)(
alpha
)
<<
24
)
)
);
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/LongRGB.h
View file @
dcec7447
...
...
@@ -50,7 +50,6 @@ public:
virtual
void
load
(
CFRecord
&
record
);
unsigned
char
red
;
unsigned
char
green
;
unsigned
char
blue
;
...
...
@@ -59,6 +58,8 @@ public:
std
::
wstring
strARGB
;
std
::
wstring
strRGB
;
_UINT32
ToRGBA
();
bool
is_alpha
;
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.cpp
View file @
dcec7447
...
...
@@ -29,23 +29,29 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <Binary/CFRecord.h>
#include "StyleXF.h"
#include "XFProps.h"
#include "XFProp.h"
#include "ExtProp.h"
#include "XFPropColor.h"
#include "BitMarkedStructs.h"
#include "XFPropBorder.h"
#include "../Biff_records/Font.h"
#include <Binary/CFRecord.h>
namespace
XLS
{
StyleXF
::
StyleXF
(
size_t
&
cell_xf_current_id
,
size_t
&
style_xf_current_id
)
:
cell_xf_current_id_
(
cell_xf_current_id
),
style_xf_current_id_
(
style_xf_current_id
),
font_id
(
0xFFFF
)
StyleXF
::
StyleXF
(
size_t
&
cell_xf_current_id
,
size_t
&
style_xf_current_id
)
:
cell_xf_current_id_
(
cell_xf_current_id
),
style_xf_current_id_
(
style_xf_current_id
)
{
font_id
=
-
1
;
font_id
=
0xFFFF
;
border_x_id
=
-
1
;
fill_x_id
=
-
1
;
font
=
NULL
;
fill
.
fls
=
0
;
}
...
...
@@ -58,9 +64,9 @@ BiffStructurePtr StyleXF::clone()
void
StyleXF
::
load
(
CFRecord
&
record
)
{
m_GlobalWorkbookI
nfo
=
record
.
getGlobalWorkbookInfo
();
global_i
nfo
=
record
.
getGlobalWorkbookInfo
();
if
(
m_GlobalWorkbookI
nfo
->
Version
<
0x0600
)
if
(
global_i
nfo
->
Version
<
0x0600
)
{
_UINT16
flags1
;
_UINT32
flags2
;
...
...
@@ -146,65 +152,46 @@ void StyleXF::Update(ExtProp* ext_prop)
{
if
(
!
ext_prop
)
return
;
FillInfoExt
color_out
;
{
color_out
.
enabled
=
true
;
color_out
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
color_out
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
color_out
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
color_out
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
}
switch
(
ext_prop
->
extType
)
{
case
0x0004
:
{
fill
.
foreFillInfo_
.
enabled
=
true
;
fill
.
foreFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
fill
.
foreFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
fill
.
foreFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
fill
.
foreFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
fill
.
foreFillInfo_
=
color_out
;
}
break
;
case
0x0005
:
{
fill
.
backFillInfo_
.
enabled
=
true
;
fill
.
backFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
fill
.
backFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
fill
.
backFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
fill
.
backFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
fill
.
backFillInfo_
=
color_out
;
}
break
;
case
0x0007
:
{
border
.
topFillInfo_
.
enabled
=
true
;
border
.
topFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
border
.
topFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
border
.
topFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
border
.
topFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
border
.
topFillInfo_
=
color_out
;
}
break
;
case
0x0008
:
{
border
.
bottomFillInfo_
.
enabled
=
true
;
border
.
bottomFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
border
.
bottomFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
border
.
bottomFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
border
.
bottomFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
border
.
bottomFillInfo_
=
color_out
;
}
break
;
case
0x0009
:
{
border
.
leftFillInfo_
.
enabled
=
true
;
border
.
leftFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
border
.
leftFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
border
.
leftFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
border
.
leftFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
border
.
leftFillInfo_
=
color_out
;
}
break
;
case
0x000A
:
{
border
.
rightFillInfo_
.
enabled
=
true
;
border
.
rightFillInfo_
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
border
.
rightFillInfo_
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
border
.
rightFillInfo_
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
border
.
rightFillInfo_
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
border
.
rightFillInfo_
=
color_out
;
}
break
;
//case 0x000B: //diag color
//case 0x000C: //diag color
case
0x000D
:
{
font_color
.
enabled
=
true
;
font_color
.
icv
=
ext_prop
->
extPropData
.
color
.
icv
;
font_color
.
xclrType
=
ext_prop
->
extPropData
.
color
.
xclrType
;
font_color
.
nTintShade
=
ext_prop
->
extPropData
.
color
.
nTintShade
;
font_color
.
xclrValue
=
ext_prop
->
extPropData
.
color
.
xclrValue
;
font_color
=
color_out
;
}
break
;
//case 0x0006:
// extPropData.gradient_fill.toXML(own_tag);
...
...
@@ -219,13 +206,99 @@ void StyleXF::Update(ExtProp* ext_prop)
}
break
;
}
}
void
StyleXF
::
Update
(
XFProp
s
*
xfProps
)
void
StyleXF
::
Update
(
XFProp
*
xfProp
)
{
if
(
!
xfProps
)
return
;
if
(
!
xfProp
)
return
;
XFPropColor
*
color
=
dynamic_cast
<
XFPropColor
*>
(
xfProp
->
xfPropDataBlob
.
get
());
if
(
color
)
{
FillInfoExt
color_out
;
color_out
.
enabled
=
true
;
color_out
.
icv
=
color
->
icv
;
color_out
.
xclrType
=
color
->
xclrType
;
color_out
.
nTintShade
=
color
->
nTintShade
;
if
(
color
->
xclrType
==
3
)
color_out
.
xclrValue
=
color
->
icv
;
else
color_out
.
xclrValue
=
color
->
dwRgba
.
ToRGBA
();
switch
(
xfProp
->
xfPropType
)
{
case
0x0001
:
fill
.
foreFillInfo_
=
color_out
;
break
;
case
0x0002
:
fill
.
backFillInfo_
=
color_out
;
break
;
case
0x0005
:
font_color
=
color_out
;
break
;
}
return
;
}
BIFF_BYTE
*
byte_
=
dynamic_cast
<
BIFF_BYTE
*>
(
xfProp
->
xfPropDataBlob
.
get
());
if
(
byte_
)
{
switch
(
xfProp
->
xfPropType
)
{
case
0x0025
:
{
font_id
=
*
byte_
->
value
();
if
((
global_info
->
m_arFonts
)
&&
(
font_id
>=
0
&&
font_id
<
global_info
->
m_arFonts
->
size
()))
{
font
=
dynamic_cast
<
Font
*>
(
global_info
->
m_arFonts
->
at
(
font_id
).
get
());
}
}
break
;
case
0x001C
:
if
(
font
)
font
->
fItalic
=
*
byte_
->
value
();
break
;
case
0x001D
:
if
(
font
)
font
->
fStrikeOut
=
*
byte_
->
value
();
break
;
case
0x001E
:
if
(
font
)
font
->
fOutline
=
*
byte_
->
value
();
break
;
case
0x001F
:
if
(
font
)
font
->
fShadow
=
*
byte_
->
value
();
break
;
case
0x0022
:
if
(
font
)
font
->
bCharSet
=
*
byte_
->
value
();
break
;
}
return
;
}
BIFF_WORD
*
word
=
dynamic_cast
<
BIFF_WORD
*>
(
xfProp
->
xfPropDataBlob
.
get
());
std
::
wstringstream
strm
;
xfProps
->
serialize_fill
(
strm
);
fill
.
ext
=
strm
.
str
();
if
(
word
)
{
switch
(
xfProp
->
xfPropType
)
{
case
0x0019
:
if
(
font
)
font
->
bls
=
*
word
->
value
();
break
;
case
0x001A
:
if
(
font
)
font
->
uls
=
*
word
->
value
();
break
;
case
0x001B
:
if
(
font
)
font
->
sss
=
*
word
->
value
();
break
;
}
return
;
}
BIFF_DWORD
*
dword
=
dynamic_cast
<
BIFF_DWORD
*>
(
xfProp
->
xfPropDataBlob
.
get
());
if
(
dword
)
{
switch
(
xfProp
->
xfPropType
)
{
case
0x0024
:
if
(
font
)
font
->
dyHeight
=
*
dword
->
value
();
break
;
}
return
;
}
XFPropBorder
*
brdr
=
dynamic_cast
<
XFPropBorder
*>
(
xfProp
->
xfPropDataBlob
.
get
());
if
(
brdr
)
{
FillInfoExt
color_out
;
color_out
.
enabled
=
true
;
color_out
.
icv
=
brdr
->
color
.
icv
;
color_out
.
xclrType
=
brdr
->
color
.
xclrType
;
color_out
.
nTintShade
=
brdr
->
color
.
nTintShade
;
if
(
brdr
->
color
.
xclrType
==
3
)
color_out
.
xclrValue
=
brdr
->
color
.
icv
;
else
color_out
.
xclrValue
=
brdr
->
color
.
dwRgba
.
ToRGBA
();
switch
(
xfProp
->
xfPropType
)
{
case
0x0006
:
border
.
topFillInfo_
=
color_out
;
break
;
case
0x0007
:
border
.
bottomFillInfo_
=
color_out
;
break
;
case
0x0008
:
border
.
leftFillInfo_
=
color_out
;
break
;
case
0x0009
:
border
.
rightFillInfo_
=
color_out
;
break
;
//horiz, vert, diag
}
return
;
}
}
void
StyleXF
::
RegisterFillBorder
()
{
...
...
@@ -234,9 +307,15 @@ void StyleXF::RegisterFillBorder()
ExtProp
*
ext_prop
=
dynamic_cast
<
ExtProp
*>
(
ext_props
[
i
].
get
());
Update
(
ext_prop
);
}
for
(
size_t
i
=
0
;
i
<
xf_props
.
size
();
i
++
)
{
XFProp
*
xf_prop
=
dynamic_cast
<
XFProp
*>
(
xf_props
[
i
].
get
());
Update
(
xf_prop
);
}
border_x_id
=
global_info
->
RegisterBorderId
(
border
);
fill_x_id
=
global_info
->
RegisterFillId
(
fill
);
border_x_id
=
m_GlobalWorkbookInfo
->
RegisterBorderId
(
border
);
fill_x_id
=
m_GlobalWorkbookInfo
->
RegisterFillId
(
fill
);
global_info
->
RegisterFontColorId
(
font_id
,
font_color
);
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.h
View file @
dcec7447
...
...
@@ -36,9 +36,10 @@
namespace
XLS
{
class
XFProp
s
;
class
XFProp
;
class
ExtProp
;
class
CFRecord
;
class
Font
;
class
GlobalWorkbookInfo
;
typedef
boost
::
shared_ptr
<
GlobalWorkbookInfo
>
GlobalWorkbookInfoPtr
;
...
...
@@ -52,17 +53,10 @@ public:
virtual
void
load
(
CFRecord
&
record
);
GlobalWorkbookInfoPtr
m_GlobalWorkbookInfo
;
static
const
ElementType
type
=
typeStyleXF
;
int
serialize
(
std
::
wostream
&
stream
);
void
Update
(
ExtProp
*
extProp
);
// xls style
void
Update
(
XFProps
*
xfProps
);
//xlsx style
void
RegisterFillBorder
();
unsigned
char
alc
;
bool
fWrap
;
unsigned
char
alcV
;
...
...
@@ -72,13 +66,22 @@ public:
bool
fShrinkToFit
;
unsigned
char
iReadOrder
;
//------------------------------------------------------------------
GlobalWorkbookInfoPtr
global_info
;
BorderInfo
border
;
FillInfo
fill
;
FillInfoExt
font_color
;
size_t
font_id
;
Font
*
font
;
BiffStructurePtrVector
ext_props
;
BiffStructurePtrVector
xf_props
;
void
Update
(
ExtProp
*
extProp
);
// xls style
void
Update
(
XFProp
*
xfProp
);
//xlsx style
void
RegisterFillBorder
();
size_t
border_x_id
;
size_t
fill_x_id
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProp.cpp
View file @
dcec7447
...
...
@@ -29,16 +29,15 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <Binary/CFRecord.h>
#include "XFProp.h"
#include <Binary/CFRecord.h>
#include "XFPropColor.h"
#include "XFPropGradient.h"
#include "XFPropGradientStop.h"
#include "XFPropBorder.h"
#include "BiffString.h"
#include <Logic/Biff_structures/BitMarkedStructs.h>
#include "BitMarkedStructs.h"
#include <utils.h>
...
...
@@ -145,8 +144,7 @@ static void serialize_color_prop(std::wostream & stream, const std::wstring & na
XFPropColor
*
color
=
dynamic_cast
<
XFPropColor
*>
(
val
.
get
());
if
(
!
color
)
return
;
color
->
node_name
=
name
;
color
->
serialize
(
stream
);
color
->
serialize
(
stream
,
name
);
}
static
void
serialize_val_prop
(
std
::
wostream
&
stream
,
const
std
::
wstring
&
name
,
BiffStructurePtr
&
val
)
...
...
@@ -218,7 +216,7 @@ static void serialize_border_prop(std::wostream & stream, const std::wstring & n
}
if
(
border
->
dgBorder
!=
0
)
{
border
->
color
.
serialize
(
CP_XML_STREAM
());
border
->
color
.
serialize
(
CP_XML_STREAM
()
,
L"color"
);
}
}
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProp.h
View file @
dcec7447
...
...
@@ -32,8 +32,7 @@
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/FullColorExt.h>
#include <Logic/Biff_structures/XFExtGradient.h>
#include "FullColorExt.h"
#include <simple_xml_writer.h>
...
...
@@ -59,5 +58,6 @@ public:
unsigned
short
cb
;
BiffStructurePtr
xfPropDataBlob
;
};
typedef
boost
::
shared_ptr
<
XFProp
>
XFPropPtr
;
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropBorder.h
View file @
dcec7447
...
...
@@ -49,7 +49,6 @@ public:
virtual
void
load
(
CFRecord
&
record
);
XFPropColor
color
;
unsigned
short
dgBorder
;
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropColor.cpp
View file @
dcec7447
...
...
@@ -47,8 +47,6 @@ BiffStructurePtr XFPropColor::clone()
void
XFPropColor
::
load
(
CFRecord
&
record
)
{
node_name
=
L"color"
;
unsigned
char
flags
;
record
>>
flags
;
...
...
@@ -58,7 +56,7 @@ void XFPropColor::load(CFRecord& record)
record
>>
icv
>>
nTintShade
>>
dwRgba
;
}
int
XFPropColor
::
serialize
(
std
::
wostream
&
stream
)
int
XFPropColor
::
serialize
(
std
::
wostream
&
stream
,
const
std
::
wstring
&
node_name
)
{
if
(
xclrType
>
3
)
return
0
;
//not set
...
...
@@ -70,9 +68,9 @@ int XFPropColor::serialize(std::wostream & stream)
{
case
0
:
CP_XML_ATTR
(
L"auto"
,
1
);
break
;
case
1
:
CP_XML_ATTR
(
L"indexed"
,
icv
);
break
;
case
2
:
case
3
:
CP_XML_ATTR
(
L"rgb"
,
dwRgba
.
strRGB
);
break
;
//CP_XML_ATTR(L"theme", icv);
break;
case
3
:
CP_XML_ATTR
(
L"theme"
,
icv
);
break
;
default:
CP_XML_ATTR
(
L"rgb"
,
dwRgba
.
strRGB
);
break
;
}
if
(
nTintShade
!=
0
)
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropColor.h
View file @
dcec7447
...
...
@@ -47,10 +47,9 @@ public:
virtual
void
load
(
CFRecord
&
record
);
static
const
ElementType
type
=
typeXFPropColor
;
int
serialize
(
std
::
wostream
&
stream
);
int
serialize
(
std
::
wostream
&
stream
,
const
std
::
wstring
&
sNode
);
bool
fValidRGBA
;
unsigned
char
xclrType
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradientStop.cpp
View file @
dcec7447
...
...
@@ -32,7 +32,6 @@
#include "XFPropGradientStop.h"
#include <Binary/CFRecord.h>
#include <simple_xml_writer.h>
namespace
XLS
...
...
@@ -59,7 +58,7 @@ int XFPropGradientStop::serialize(std::wostream & stream)
CP_XML_NODE
(
L"stop"
)
{
CP_XML_ATTR
(
L"position"
,
numPosition
);
color
.
serialize
(
CP_XML_STREAM
());
color
.
serialize
(
CP_XML_STREAM
()
,
L"color"
);
}
}
return
0
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProps.cpp
View file @
dcec7447
...
...
@@ -29,10 +29,15 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <Binary/CFRecord.h>
#include "XFProps.h"
#include <Binary/CFRecord.h>
#include <Logic/Biff_structures/BitMarkedStructs.h>
#include "XFProp.h"
#include "XFPropColor.h"
#include "XFPropGradient.h"
#include "XFPropGradientStop.h"
#include "BitMarkedStructs.h"
namespace
XLS
{
...
...
@@ -43,8 +48,6 @@ BiffStructurePtr XFProps::clone()
return
BiffStructurePtr
(
new
XFProps
(
*
this
));
}
void
XFProps
::
load
(
CFRecord
&
record
)
{
arXFPropBorder
.
is_present
=
false
;
...
...
@@ -54,21 +57,24 @@ void XFProps::load(CFRecord& record)
for
(
int
i
=
0
;
i
<
cprops
;
++
i
)
{
XFProp
prop
;
record
>>
prop
;
XFProp
Ptr
prop
(
new
XFProp
)
;
if
(
!
prop
)
continue
;
if
(
prop
.
xfPropType
>=
0
&&
prop
.
xfPropType
<=
3
)
prop
->
load
(
record
);
rgExt
.
push_back
(
prop
);
if
(
prop
->
xfPropType
>=
0
&&
prop
->
xfPropType
<=
3
)
{
arXFPropFill
.
push_back
(
prop
);
}
else
if
(
prop
.
xfPropType
==
4
)
else
if
(
prop
->
xfPropType
==
4
)
{
arXFPropGradient
.
push_back
(
prop
);
}
else
if
(
prop
.
xfPropType
>=
6
&&
prop
.
xfPropType
<=
14
)
else
if
(
prop
->
xfPropType
>=
6
&&
prop
->
xfPropType
<=
14
)
{
arXFPropBorder
.
is_present
=
true
;
switch
(
prop
.
xfPropType
)
switch
(
prop
->
xfPropType
)
{
case
6
:
arXFPropBorder
.
top
=
prop
;
break
;
case
7
:
arXFPropBorder
.
bottom
=
prop
;
break
;
...
...
@@ -78,20 +84,20 @@ void XFProps::load(CFRecord& record)
arXFPropBorder
.
other
.
push_back
(
prop
);
}
}
else
if
(
prop
.
xfPropType
>=
15
&&
prop
.
xfPropType
<=
22
||
prop
.
xfPropType
==
42
)
else
if
(
prop
->
xfPropType
>=
15
&&
prop
->
xfPropType
<=
22
||
prop
->
xfPropType
==
42
)
{
arXFPropAlignment
.
push_back
(
prop
);
}
else
if
(
prop
.
xfPropType
>=
24
&&
prop
.
xfPropType
<=
37
||
prop
.
xfPropType
==
5
)
else
if
(
prop
->
xfPropType
>=
24
&&
prop
->
xfPropType
<=
37
||
prop
->
xfPropType
==
5
)
{
arXFPropFont
.
push_back
(
prop
);
}
else
if
(
prop
.
xfPropType
>=
38
&&
prop
.
xfPropType
<=
41
)
else
if
(
prop
->
xfPropType
>=
38
&&
prop
->
xfPropType
<=
41
)
{
bool
skip_codes
=
false
;
if
(
prop
.
xfPropType
==
0x0029
)
if
(
prop
->
xfPropType
==
0x0029
)
{
BIFF_WORD
*
word
=
dynamic_cast
<
BIFF_WORD
*>
(
prop
.
xfPropDataBlob
.
get
());
BIFF_WORD
*
word
=
dynamic_cast
<
BIFF_WORD
*>
(
prop
->
xfPropDataBlob
.
get
());
if
((
word
)
&&
(
word
->
value
()
==
(
_UINT16
)
30
))
{
skip_codes
=
true
;
...
...
@@ -101,7 +107,7 @@ void XFProps::load(CFRecord& record)
if
(
!
skip_codes
)
arXFPropNumFmt
.
push_back
(
prop
);
}
else
if
(
prop
.
xfPropType
>=
43
&&
prop
.
xfPropType
<=
44
)
else
if
(
prop
->
xfPropType
>=
43
&&
prop
->
xfPropType
<=
44
)
{
arXFPropProtection
.
push_back
(
prop
);
}
...
...
@@ -115,20 +121,20 @@ int XFProps::serialize_fill(std::wostream & stream)
{
if
(
arXFPropFill
.
empty
())
return
0
;
CP_XML_WRITER
(
stream
)
{
XFProp
*
pPatternType
=
NULL
;
XFPropGradient
*
pGradient
=
NULL
;
for
(
size_t
i
=
0
;
i
<
arXFPropFill
.
size
();
i
++
)
{
switch
(
arXFPropFill
[
i
].
xfPropType
)
switch
(
arXFPropFill
[
i
]
->
xfPropType
)
{
case
1
:
case
0
:
pPatternType
=
&
arXFPropFill
[
i
];
break
;
case
3
:
pGradient
=
dynamic_cast
<
XFPropGradient
*>
(
arXFPropFill
[
i
].
xfPropDataBlob
.
get
());
break
;
case
0
:
pPatternType
=
arXFPropFill
[
i
].
get
();
break
;
case
3
:
pGradient
=
dynamic_cast
<
XFPropGradient
*>
(
arXFPropFill
[
i
]
->
xfPropDataBlob
.
get
());
break
;
}
}
CP_XML_WRITER
(
stream
)
{
CP_XML_NODE
(
L"fill"
)
{
if
(
pGradient
||
arXFPropGradient
.
size
()
>
0
)
...
...
@@ -140,26 +146,37 @@ int XFProps::serialize_fill(std::wostream & stream)
for
(
size_t
i
=
0
;
i
<
arXFPropGradient
.
size
();
i
++
)
{
if
(
arXFPropGradient
[
i
]
.
xfPropDataBlob
==
NULL
)
continue
;
arXFPropGradient
[
i
]
.
xfPropDataBlob
->
serialize
(
CP_XML_STREAM
());
if
(
arXFPropGradient
[
i
]
->
xfPropDataBlob
==
NULL
)
continue
;
arXFPropGradient
[
i
]
->
xfPropDataBlob
->
serialize
(
CP_XML_STREAM
());
}
}
}
else
if
(
pPatternType
)
else
{
CP_XML_NODE
(
L"patternFill"
)
{
if
(
pPatternType
)
{
pPatternType
->
serialize_attr
(
CP_GET_XML_NODE
());
}
for
(
size_t
i
=
0
;
i
<
arXFPropFill
.
size
();
i
++
)
{
arXFPropFill
[
i
].
serialize
(
CP_XML_STREAM
());
XFPropColor
*
pColor
=
dynamic_cast
<
XFPropColor
*>
(
arXFPropFill
[
i
]
->
xfPropDataBlob
.
get
());
if
(
!
pColor
)
continue
;
std
::
wstring
sNode
=
L"color"
;
switch
(
arXFPropFill
[
i
]
->
xfPropType
)
{
case
1
:
sNode
=
L"fgColor"
;
break
;
case
2
:
sNode
=
L"bgColor"
;
break
;
}
pColor
->
serialize
(
CP_XML_STREAM
(),
sNode
);
}
}
}
}
}
return
0
;
}
...
...
@@ -173,7 +190,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
{
for
(
size_t
i
=
0
;
i
<
arXFPropFont
.
size
();
i
++
)
{
arXFPropFont
[
i
]
.
serialize
(
CP_XML_STREAM
());
arXFPropFont
[
i
]
->
serialize
(
CP_XML_STREAM
());
}
}
}
...
...
@@ -185,11 +202,11 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
{
if
(
dxf
)
{
arXFPropNumFmt
[
i
]
.
serialize_attr
(
CP_GET_XML_NODE
());
arXFPropNumFmt
[
i
]
->
serialize_attr
(
CP_GET_XML_NODE
());
}
else
{
arXFPropNumFmt
[
i
]
.
serialize
(
CP_XML_STREAM
());
arXFPropNumFmt
[
i
]
->
serialize
(
CP_XML_STREAM
());
}
}
}
...
...
@@ -202,7 +219,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
{
for
(
size_t
i
=
0
;
i
<
arXFPropAlignment
.
size
();
i
++
)
{
arXFPropAlignment
[
i
]
.
serialize
(
CP_XML_STREAM
());
arXFPropAlignment
[
i
]
->
serialize
(
CP_XML_STREAM
());
}
}
}
...
...
@@ -219,7 +236,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
//----------------------------------------
for
(
size_t
i
=
0
;
i
<
arXFPropBorder
.
other
.
size
();
i
++
)
{
arXFPropBorder
.
other
[
i
]
.
serialize
(
CP_XML_STREAM
());
arXFPropBorder
.
other
[
i
]
->
serialize
(
CP_XML_STREAM
());
}
}
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFProps.h
View file @
dcec7447
...
...
@@ -32,11 +32,13 @@
#pragma once
#include "BiffStructure.h"
#include "XFProp.h"
namespace
XLS
{
class
XFProp
;
typedef
boost
::
shared_ptr
<
XFProp
>
XFPropPtr
;
class
CFRecord
;
class
XFProps
:
public
BiffStructure
...
...
@@ -56,27 +58,31 @@ public:
int
serialize_fill
(
std
::
wostream
&
stream
);
std
::
vector
<
XFProp
>
arXFPropFont
;
std
::
vector
<
XFProp
>
arXFPropNumFmt
;
std
::
vector
<
XFProp
>
arXFPropFill
;
std
::
vector
<
XFProp
>
arXFPropAlignment
;
std
::
vector
<
XFProp
Ptr
>
arXFPropFont
;
std
::
vector
<
XFProp
Ptr
>
arXFPropNumFmt
;
std
::
vector
<
XFProp
Ptr
>
arXFPropFill
;
std
::
vector
<
XFProp
Ptr
>
arXFPropAlignment
;
struct
_b
{
bool
is_present
;
bool
is_present
=
false
;
XFPropPtr
left
;
XFPropPtr
right
;
XFPropPtr
top
;
XFPropPtr
bottom
;
_CP_OPT
(
XFProp
)
left
;
_CP_OPT
(
XFProp
)
right
;
_CP_OPT
(
XFProp
)
top
;
_CP_OPT
(
XFProp
)
bottom
;
std
::
vector
<
XFProp
>
other
;
std
::
vector
<
XFPropPtr
>
other
;
}
arXFPropBorder
;
std
::
vector
<
XFProp
>
arXFPropProtection
;
std
::
vector
<
XFProp
>
arXFPropGradient
;
std
::
vector
<
XFProp
Ptr
>
arXFPropProtection
;
std
::
vector
<
XFProp
Ptr
>
arXFPropGradient
;
//-----------------------------------------------------
BiffStructurePtrVector
rgExt
;
bool
fNewBorder
;
bool
bPresent
;
};
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FEAT11.cpp
View file @
dcec7447
...
...
@@ -276,6 +276,9 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
CP_XML_ATTR
(
L"id"
,
field
->
idField
);
CP_XML_ATTR
(
L"name"
,
field
->
strCaption
.
value
());
if
(
!
field
->
strTotal
.
value
().
empty
())
CP_XML_ATTR
(
L"totalsRowLabel"
,
field
->
strTotal
.
value
());
if
(
field
->
dxfFmtAgg
.
bExist
||
field
->
dxfFmtInsertRow
.
bExist
)
{
...
...
@@ -295,10 +298,10 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
CP_XML_NODE
(
L"tableStyleInfo"
)
{
CP_XML_ATTR
(
L"name"
,
table_style
->
stListStyleName
.
value
());
CP_XML_ATTR
(
L"showFirstColumn"
,
table_style
->
n
FirstColumn
);
CP_XML_ATTR
(
L"showLastColumn"
,
table_style
->
n
LastColumn
);
CP_XML_ATTR
(
L"showRowStripes"
,
table_style
->
n
RowStripes
);
CP_XML_ATTR
(
L"showColumnStripes"
,
table_style
->
n
ColumnStripes
);
CP_XML_ATTR
(
L"showFirstColumn"
,
table_style
->
f
FirstColumn
);
CP_XML_ATTR
(
L"showLastColumn"
,
table_style
->
f
LastColumn
);
CP_XML_ATTR
(
L"showRowStripes"
,
table_style
->
f
RowStripes
);
CP_XML_ATTR
(
L"showColumnStripes"
,
table_style
->
f
ColumnStripes
);
}
}
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.cpp
View file @
dcec7447
...
...
@@ -71,6 +71,7 @@ BaseObjectPtr FORMATTING::clone()
const
bool
FORMATTING
::
loadContent
(
BinProcessor
&
proc
)
{
global_info
=
proc
.
getGlobalWorkbookInfo
();
global_info
->
m_arFonts
=
&
m_arFonts
;
int
count
=
0
;
count
=
proc
.
repeated
<
Font
>
(
0
,
510
);
// Wrong records sequence workaround (originally at least one Font is mandatory)
...
...
@@ -156,40 +157,40 @@ void FORMATTING::update_xfs()
if
(
!
xfs
)
return
;
//for (size_t i = 0; (st) && (i < st->m_arStyles.size()); i++)
//{
// XLS::Style * style = dynamic_cast<Style*>(st->m_arStyles[i].first.get());
// XLS::StyleExt * styleExt = dynamic_cast<StyleExt*>(st->m_arStyles[i].second.get());
//
// if (styleExt && style)
// {
// if (styleExt->fBuiltIn && styleExt->xfProps.cprops > 0)
// {
// bool bFound = false;
// for (size_t i = 0; i < xfs->m_arCellStyles.size(); i++)
// {
// XF* xf = dynamic_cast<XF*>(xfs->m_arCellStyles[i].get());
for
(
size_t
i
=
0
;
(
st
)
&&
(
i
<
st
->
m_arStyles
.
size
());
i
++
)
{
XLS
::
Style
*
style
=
dynamic_cast
<
Style
*>
(
st
->
m_arStyles
[
i
].
first
.
get
());
XLS
::
StyleExt
*
styleExt
=
dynamic_cast
<
StyleExt
*>
(
st
->
m_arStyles
[
i
].
second
.
get
());
if
(
styleExt
&&
style
)
{
if
(
styleExt
->
fBuiltIn
&&
styleExt
->
xfProps
.
cprops
>
0
)
{
bool
bFound
=
false
;
for
(
size_t
i
=
0
;
i
<
xfs
->
m_arCellStyles
.
size
();
i
++
)
{
XF
*
xf
=
dynamic_cast
<
XF
*>
(
xfs
->
m_arCellStyles
[
i
].
get
());
if
(
xf
->
ind_xf
==
style
->
ixfe
)
{
xf
->
style
.
xf_props
=
styleExt
->
xfProps
.
rgExt
;
bFound
=
true
;
break
;
}
}
//for (size_t i = 0; !bFound && i < xfs->m_arCellXFs.size(); i++) небывает совпадений
//{
// XF* xf = dynamic_cast<XF*>(xfs->m_arCellXFs[i].get());
// if (xf->ind_xf == style->ixfe)
// {
// xf->style.Update(&styleExt->xfProps)
;
// xf->cell.xf_props = styleExt->xfProps.rgExt
;
// bFound = true;
// break;
// }
// }
// //for (size_t i = 0; !bFound && i < xfs->m_arCellXFs.size(); i++)
// //{
// // XF* xf = dynamic_cast<XF*>(xfs->m_arCellXFs[i].get());
// // if (xf->ind_xf == style->ixfe)
// // {
// // xf->cell.Update(&styleExt->xfProps);
// // bFound = true;
// // break;
// // }
// //}
// }
// }
//}
}
}
}
xfs
->
RegisterFillBorder
();
}
void
FORMATTING
::
concatinate
(
FORMATTING
*
ext
)
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.cpp
View file @
dcec7447
...
...
@@ -94,8 +94,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
return
std
::
pair
<
float
,
float
>
(
width
,
maxHeight
);
}
GlobalWorkbookInfo
::
GlobalWorkbookInfo
(
const
unsigned
short
code_page
,
XlsConverter
*
xls_converter_
)
:
CodePage
(
code_page
)
GlobalWorkbookInfo
::
GlobalWorkbookInfo
(
const
unsigned
short
code_page
,
XlsConverter
*
converter
)
:
CodePage
(
code_page
),
xls_converter
(
converter
)
{
fill_x_ids
[
FillInfo
(
0
,
0
,
0
)]
=
0
;
fill_x_ids
[
FillInfo
(
17
,
64
,
65
)]
=
1
;
...
...
@@ -105,8 +104,6 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
Version
=
0x0600
;
xls_converter
=
xls_converter_
;
startAddedSharedStrings
=
0
;
current_sheet
=
0
;
cmt_rules
=
0
;
...
...
@@ -122,6 +119,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
bVbaProjectExist
=
false
;
bMacrosExist
=
false
;
bThemePresent
=
false
;
idPivotCache
=
0
;
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.h
View file @
dcec7447
...
...
@@ -84,6 +84,7 @@ public:
//-----------------------------------------------------------------------------
bool
bVbaProjectExist
;
bool
bMacrosExist
;
bool
bThemePresent
;
unsigned
short
CodePage
;
CRYPT
::
DecryptorPtr
decryptor
;
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
View file @
dcec7447
...
...
@@ -689,10 +689,10 @@ void XlsConverter::convert(XLS::GlobalsSubstream* globals)
{
if
(
globals
==
NULL
)
return
;
convert
((
XLS
::
FORMATTING
*
)
globals
->
m_Formating
.
get
());
convert
((
XLS
::
THEME
*
)
globals
->
m_THEME
.
get
());
convert
((
XLS
::
FORMATTING
*
)
globals
->
m_Formating
.
get
());
convert
((
XLS
::
SHAREDSTRINGS
*
)
globals
->
m_SHAREDSTRINGS
.
get
());
for
(
size_t
i
=
0
;
i
<
globals
->
m_arLBL
.
size
();
i
++
)
...
...
@@ -1117,16 +1117,16 @@ void XlsConverter::convert(XLS::THEME* THEME_)
if
(
hresult
!=
S_OK
||
pBuffer
==
NULL
)
hresult
=
OfficeUtils
.
LoadFileFromArchive
(
tempThemePath
,
L"theme/theme/theme1.xml"
,
&
pBuffer
,
nBufferSize
);
//??? переписать по нормальному
if
(
hresult
==
S_OK
&&
pBuffer
!=
NULL
)
{
xls_global_info
->
bThemePresent
=
true
;
oox
::
package
::
theme_content_ptr
content
=
oox
::
package
::
theme_content
::
create
((
char
*
)
pBuffer
,
nBufferSize
);
output_document
->
get_xl_files
().
add_theme
(
content
);
delete
[]
pBuffer
;
pBuffer
=
NULL
;
}
}
struct
_group_object
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
View file @
dcec7447
...
...
@@ -2146,6 +2146,7 @@ void xlsx_drawing_context::serialize_text(std::wostream & stream, _drawing_state
if
(
drawing_state
->
wordart
.
italic
)
CP_XML_ATTR
(
L"i"
,
1
);
if
(
drawing_state
->
wordart
.
underline
)
CP_XML_ATTR
(
L"u"
,
L"sng"
);
if
(
drawing_state
->
wordart
.
strike
)
CP_XML_ATTR
(
L"strike"
,
L"sngStrike"
);
//if (drawing_state->wordart.cap) CP_XML_ATTR(L"cap", *cap);
CP_XML_ATTR
(
L"kern"
,
10
);
...
...
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