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
bff7e2cd
Commit
bff7e2cd
authored
Jun 03, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - условное форматирование, стили условного форматирования
parent
342c2aed
Changes
54
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
54 changed files
with
1262 additions
and
685 deletions
+1262
-685
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
+1
-1
ASCOfficeOdfFile/src/docx/oox_chart_context.cpp
ASCOfficeOdfFile/src/docx/oox_chart_context.cpp
+1
-1
ASCOfficeOdfFile/src/docx/oox_chart_context.h
ASCOfficeOdfFile/src/docx/oox_chart_context.h
+1
-1
ASCOfficeOdfFile/src/docx/pptx_comments_context.cpp
ASCOfficeOdfFile/src/docx/pptx_comments_context.cpp
+3
-3
ASCOfficeOdfFile/src/docx/pptx_comments_context.h
ASCOfficeOdfFile/src/docx/pptx_comments_context.h
+1
-1
ASCOfficeOdfFile/src/docx/pptx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/pptx_conversion_context.cpp
+2
-2
ASCOfficeOdfFile/src/docx/xlsx_borders.cpp
ASCOfficeOdfFile/src/docx/xlsx_borders.cpp
+3
-8
ASCOfficeOdfFile/src/docx/xlsx_borders.h
ASCOfficeOdfFile/src/docx/xlsx_borders.h
+2
-7
ASCOfficeOdfFile/src/docx/xlsx_cell_styles.cpp
ASCOfficeOdfFile/src/docx/xlsx_cell_styles.cpp
+5
-4
ASCOfficeOdfFile/src/docx/xlsx_cell_styles.h
ASCOfficeOdfFile/src/docx/xlsx_cell_styles.h
+3
-6
ASCOfficeOdfFile/src/docx/xlsx_color.h
ASCOfficeOdfFile/src/docx/xlsx_color.h
+5
-6
ASCOfficeOdfFile/src/docx/xlsx_comments.cpp
ASCOfficeOdfFile/src/docx/xlsx_comments.cpp
+7
-4
ASCOfficeOdfFile/src/docx/xlsx_comments.h
ASCOfficeOdfFile/src/docx/xlsx_comments.h
+2
-2
ASCOfficeOdfFile/src/docx/xlsx_comments_context.cpp
ASCOfficeOdfFile/src/docx/xlsx_comments_context.cpp
+6
-6
ASCOfficeOdfFile/src/docx/xlsx_comments_context.h
ASCOfficeOdfFile/src/docx/xlsx_comments_context.h
+2
-2
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp
+264
-0
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.h
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.h
+36
-0
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
+3
-3
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.h
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.h
+1
-1
ASCOfficeOdfFile/src/docx/xlsx_dxfs.cpp
ASCOfficeOdfFile/src/docx/xlsx_dxfs.cpp
+75
-0
ASCOfficeOdfFile/src/docx/xlsx_dxfs.h
ASCOfficeOdfFile/src/docx/xlsx_dxfs.h
+37
-0
ASCOfficeOdfFile/src/docx/xlsx_fill.cpp
ASCOfficeOdfFile/src/docx/xlsx_fill.cpp
+39
-20
ASCOfficeOdfFile/src/docx/xlsx_fill.h
ASCOfficeOdfFile/src/docx/xlsx_fill.h
+22
-6
ASCOfficeOdfFile/src/docx/xlsx_fills.cpp
ASCOfficeOdfFile/src/docx/xlsx_fills.cpp
+46
-68
ASCOfficeOdfFile/src/docx/xlsx_fills.h
ASCOfficeOdfFile/src/docx/xlsx_fills.h
+8
-10
ASCOfficeOdfFile/src/docx/xlsx_font.cpp
ASCOfficeOdfFile/src/docx/xlsx_font.cpp
+114
-53
ASCOfficeOdfFile/src/docx/xlsx_font.h
ASCOfficeOdfFile/src/docx/xlsx_font.h
+29
-17
ASCOfficeOdfFile/src/docx/xlsx_fonts.cpp
ASCOfficeOdfFile/src/docx/xlsx_fonts.cpp
+31
-156
ASCOfficeOdfFile/src/docx/xlsx_fonts.h
ASCOfficeOdfFile/src/docx/xlsx_fonts.h
+6
-8
ASCOfficeOdfFile/src/docx/xlsx_merge_cells.cpp
ASCOfficeOdfFile/src/docx/xlsx_merge_cells.cpp
+4
-3
ASCOfficeOdfFile/src/docx/xlsx_merge_cells.h
ASCOfficeOdfFile/src/docx/xlsx_merge_cells.h
+4
-4
ASCOfficeOdfFile/src/docx/xlsx_numFmts.cpp
ASCOfficeOdfFile/src/docx/xlsx_numFmts.cpp
+2
-5
ASCOfficeOdfFile/src/docx/xlsx_numFmts.h
ASCOfficeOdfFile/src/docx/xlsx_numFmts.h
+1
-4
ASCOfficeOdfFile/src/docx/xlsx_output_xml.cpp
ASCOfficeOdfFile/src/docx/xlsx_output_xml.cpp
+6
-1
ASCOfficeOdfFile/src/docx/xlsx_output_xml.h
ASCOfficeOdfFile/src/docx/xlsx_output_xml.h
+1
-1
ASCOfficeOdfFile/src/docx/xlsx_sharedstrings.cpp
ASCOfficeOdfFile/src/docx/xlsx_sharedstrings.cpp
+4
-4
ASCOfficeOdfFile/src/docx/xlsx_sharedstrings.h
ASCOfficeOdfFile/src/docx/xlsx_sharedstrings.h
+2
-2
ASCOfficeOdfFile/src/docx/xlsx_styles.cpp
ASCOfficeOdfFile/src/docx/xlsx_styles.cpp
+66
-43
ASCOfficeOdfFile/src/docx/xlsx_styles.h
ASCOfficeOdfFile/src/docx/xlsx_styles.h
+10
-6
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
+6
-3
ASCOfficeOdfFile/src/docx/xlsx_table_state.h
ASCOfficeOdfFile/src/docx/xlsx_table_state.h
+53
-45
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp
+4
-0
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
+5
-4
ASCOfficeOdfFile/src/docx/xlsx_textcontext.cpp
ASCOfficeOdfFile/src/docx/xlsx_textcontext.cpp
+5
-5
ASCOfficeOdfFile/src/docx/xlsx_textcontext.h
ASCOfficeOdfFile/src/docx/xlsx_textcontext.h
+1
-1
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
+46
-12
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.h
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.h
+16
-0
ASCOfficeOdfFile/src/odf/calcext_elements.cpp
ASCOfficeOdfFile/src/odf/calcext_elements.cpp
+83
-2
ASCOfficeOdfFile/src/odf/calcext_elements.h
ASCOfficeOdfFile/src/odf/calcext_elements.h
+15
-19
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
+13
-8
ASCOfficeOdfFile/src/odf/odfcontext.cpp
ASCOfficeOdfFile/src/odf/odfcontext.cpp
+33
-11
ASCOfficeOdfFile/src/odf/odfcontext.h
ASCOfficeOdfFile/src/odf/odfcontext.h
+19
-12
ASCOfficeOdfFile/src/odf/style_paragraph_properties.h
ASCOfficeOdfFile/src/odf/style_paragraph_properties.h
+0
-6
ASCOfficeOdfFile/win32/cpodf.vcproj
ASCOfficeOdfFile/win32/cpodf.vcproj
+108
-88
No files found.
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
View file @
bff7e2cd
...
...
@@ -292,7 +292,7 @@ void docx_conversion_context::end_document()
count
++
;
package
::
chart_content_ptr
content
=
package
::
chart_content
::
create
();
chart
->
write_to
(
content
->
content
());
chart
->
serialize
(
content
->
content
());
output_document_
->
get_word_files
().
add_charts
(
content
);
...
...
ASCOfficeOdfFile/src/docx/oox_chart_context.cpp
View file @
bff7e2cd
...
...
@@ -44,7 +44,7 @@ std::wostream & oox_chart_context::chartData()
return
impl_
->
chartData_
;
}
void
oox_chart_context
::
write_to
(
std
::
wostream
&
strm
)
void
oox_chart_context
::
serialize
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
...
...
ASCOfficeOdfFile/src/docx/oox_chart_context.h
View file @
bff7e2cd
...
...
@@ -29,7 +29,7 @@ public:
bool
empty
()
const
;
void
write_to
(
std
::
wostream
&
strm
);
void
serialize
(
std
::
wostream
&
strm
);
static
oox_chart_context_ptr
create
(
std
::
wstring
const
&
name
);
static
oox_chart_context_ptr
create
();
...
...
ASCOfficeOdfFile/src/docx/pptx_comments_context.cpp
View file @
bff7e2cd
...
...
@@ -81,7 +81,7 @@ public:
pptx_comments_
->
add
(
d
);
}
void
write_comments
(
std
::
wostream
&
strm
)
void
serialize
(
std
::
wostream
&
strm
)
{
pptx_serialize
(
strm
,
*
pptx_comments_
);
}
...
...
@@ -146,9 +146,9 @@ bool pptx_comments_context::empty() const
return
impl_
->
empty
();
}
void
pptx_comments_context
::
write_comments
(
std
::
wostream
&
strm
)
void
pptx_comments_context
::
serialize
(
std
::
wostream
&
strm
)
{
impl_
->
write_comments
(
strm
);
impl_
->
serialize
(
strm
);
impl_
->
clear
();
}
pptx_comments_ptr
pptx_comments_context
::
get_comments
()
...
...
ASCOfficeOdfFile/src/docx/pptx_comments_context.h
View file @
bff7e2cd
...
...
@@ -52,7 +52,7 @@ public:
bool
empty
()
const
;
void
write_comments
(
std
::
wostream
&
strm
);
void
serialize
(
std
::
wostream
&
strm
);
pptx_comments_ptr
get_comments
();
...
...
ASCOfficeOdfFile/src/docx/pptx_conversion_context.cpp
View file @
bff7e2cd
...
...
@@ -267,7 +267,7 @@ void pptx_conversion_context::end_document()
count
++
;
package
::
chart_content_ptr
content
=
package
::
chart_content
::
create
();
chart
->
write_to
(
content
->
content
());
chart
->
serialize
(
content
->
content
());
output_document_
->
get_ppt_files
().
add_charts
(
content
);
...
...
@@ -487,7 +487,7 @@ void pptx_conversion_context::end_page()
if
(
!
get_comments_context
().
empty
())
{
std
::
wstringstream
strm
;
get_comments_context
().
write_comments
(
strm
);
get_comments_context
().
serialize
(
strm
);
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
commentsName
=
comments_context_handle_
.
add_comments_xml
(
strm
.
str
(),
get_comments_context
().
get_comments
()
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_borders.cpp
View file @
bff7e2cd
...
...
@@ -168,7 +168,7 @@ public:
}
};
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
void
serialize
(
std
::
wostream
&
_Wostream
)
{
std
::
vector
<
xlsx_border
>
inst_array
;
...
...
@@ -212,9 +212,9 @@ size_t xlsx_borders::borderId(const odf_reader::style_table_cell_properties_attl
return
impl_
->
borderId
(
cellProp
,
is_default
);
}
void
xlsx_borders
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
void
xlsx_borders
::
serialize
(
std
::
wostream
&
_Wostream
)
{
return
impl_
->
xlsx_
serialize
(
_Wostream
);
return
impl_
->
serialize
(
_Wostream
);
}
xlsx_borders
::
xlsx_borders
()
:
impl_
(
new
Impl
())
...
...
@@ -225,11 +225,6 @@ xlsx_borders::~xlsx_borders()
{
}
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
xlsx_borders
&
borders
)
{
return
borders
.
xlsx_serialize
(
_Wostream
);
}
}
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_borders.h
View file @
bff7e2cd
#ifndef _CPDOCCORE_XLSX_BORDERS_H_INCLUDED_da8e414a
#define _CPDOCCORE_XLSX_BORDERS_H_INCLUDED_da8e414a
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
...
...
@@ -24,17 +23,13 @@ namespace oox {
size_t
borderId
(
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
);
size_t
borderId
(
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
,
bool
&
is_default
);
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
);
void
serialize
(
std
::
wostream
&
_Wostream
);
private:
class
Impl
;
_CP_SCOPED_PTR
(
Impl
)
impl_
;
};
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
xlsx_borders
&
borders
);
}
}
#endif
ASCOfficeOdfFile/src/docx/xlsx_cell_styles.cpp
View file @
bff7e2cd
...
...
@@ -19,6 +19,7 @@ public:
xlsx_cell_styles
::
xlsx_cell_styles
()
:
impl_
(
new
xlsx_cell_styles
::
Impl
())
{
xlsx_cell_style
default_style
;
default_style
.
xfId
=
0
;
default_style
.
builtinId
=
0
;
default_style
.
name
=
L"Default"
;
...
...
@@ -29,7 +30,7 @@ xlsx_cell_styles::xlsx_cell_styles() : impl_(new xlsx_cell_styles::Impl())
xlsx_cell_styles
::~
xlsx_cell_styles
()
{}
void
xlsx_cell_styles
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
void
xlsx_cell_styles
::
serialize
(
std
::
wostream
&
_Wostream
)
const
{
CP_XML_WRITER
(
_Wostream
)
{
...
...
@@ -39,7 +40,7 @@ void xlsx_cell_styles::xlsx_serialize(std::wostream & _Wostream) const
BOOST_FOREACH
(
const
xlsx_cell_style
&
s
,
impl_
->
cell_styles_
)
{
::
cpdoccore
::
oox
::
xlsx_serialize
(
CP_XML_STREAM
(),
s
);
oox
::
xlsx_serialize
(
CP_XML_STREAM
(),
s
);
}
}
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_cell_styles.h
View file @
bff7e2cd
#ifndef _CPDOCCORE_XLSX_CELL_STYLES_
#define _CPDOCCORE_XLSX_CELL_STYLES_
#pragma once
#include <cpdoccore/CPScopedPtr.h>
...
...
@@ -13,7 +12,7 @@ public:
~
xlsx_cell_styles
();
public:
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
;
void
serialize
(
std
::
wostream
&
_Wostream
)
const
;
private:
class
Impl
;
...
...
@@ -22,5 +21,3 @@ private:
}
}
\ No newline at end of file
#endif
ASCOfficeOdfFile/src/docx/xlsx_color.h
View file @
bff7e2cd
#pragma once
#include <iosfwd>
...
...
ASCOfficeOdfFile/src/docx/xlsx_comments.cpp
View file @
bff7e2cd
#include "xlsx_comments.h"
#include <boost/foreach.hpp>
#include "docx_rels.h"
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "docx_rels.h"
namespace
cpdoccore
{
namespace
oox
{
...
...
@@ -31,8 +31,9 @@ public:
CP_XML_NODE
(
L"authors"
)
{
BOOST_FOREACH
(
std
::
wstring
const
&
a
,
author_list_
)
for
(
int
i
=
0
;
i
<
author_list_
.
size
();
i
++
)
{
const
std
::
wstring
&
a
=
author_list_
[
i
];
CP_XML_NODE
(
L"author"
)
{
CP_XML_STREAM
()
<<
a
;
...
...
@@ -42,8 +43,10 @@ public:
CP_XML_NODE
(
L"commentList"
)
{
BOOST_FOREACH
(
_xlsx_comment
const
&
c
,
xlsx_comment_
)
for
(
int
i
=
0
;
i
<
xlsx_comment_
.
size
();
i
++
)
{
const
_xlsx_comment
&
c
=
xlsx_comment_
[
i
];
CP_XML_NODE
(
L"comment"
)
{
CP_XML_ATTR
(
L"ref"
,
c
.
ref_
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_comments.h
View file @
bff7e2cd
...
...
@@ -50,9 +50,9 @@ class xlsx_comments
public:
xlsx_comments
();
~
xlsx_comments
();
static
xlsx_comments_ptr
create
();
public:
void
add
(
_xlsx_comment
&
d
);
bool
empty
()
const
;
...
...
ASCOfficeOdfFile/src/docx/xlsx_comments_context.cpp
View file @
bff7e2cd
...
...
@@ -93,11 +93,11 @@ public:
xlsx_comments_
->
add
(
d
);
}
void
write_comments
(
std
::
wostream
&
strm
)
void
serialize
(
std
::
wostream
&
strm
)
{
xlsx_serialize
(
strm
,
*
xlsx_comments_
);
}
void
write_comments
_vml
(
std
::
wostream
&
strm
)
void
serialize
_vml
(
std
::
wostream
&
strm
)
{
xlsx_serialize_vml
(
strm
,
*
xlsx_comments_
);
}
...
...
@@ -166,13 +166,13 @@ bool xlsx_comments_context::empty() const
return
impl_
->
empty
();
}
void
xlsx_comments_context
::
write_comments
(
std
::
wostream
&
strm
)
void
xlsx_comments_context
::
serialize
(
std
::
wostream
&
strm
)
{
impl_
->
write_comments
(
strm
);
impl_
->
serialize
(
strm
);
}
void
xlsx_comments_context
::
write_comments
_vml
(
std
::
wostream
&
strm
)
void
xlsx_comments_context
::
serialize
_vml
(
std
::
wostream
&
strm
)
{
impl_
->
write_comments
_vml
(
strm
);
impl_
->
serialize
_vml
(
strm
);
}
xlsx_comments_ptr
xlsx_comments_context
::
get_comments
()
...
...
ASCOfficeOdfFile/src/docx/xlsx_comments_context.h
View file @
bff7e2cd
...
...
@@ -54,8 +54,8 @@ public:
bool
empty
()
const
;
void
write_comments
(
std
::
wostream
&
strm
);
void
write_comments_vml
(
std
::
wostream
&
strm
);
void
serialize
(
std
::
wostream
&
strm
);
void
serialize_vml
(
std
::
wostream
&
strm
);
xlsx_comments_ptr
get_comments
();
private:
...
...
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp
0 → 100644
View file @
bff7e2cd
#include "xlsx_conditionalFormatting.h"
#include "xlsx_utils.h"
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../formulasconvert/formulasconvert.h"
namespace
cpdoccore
{
namespace
oox
{
struct
_cfvo
{
int
type
;
_CP_OPT
(
bool
)
gte
;
_CP_OPT
(
std
::
wstring
)
val
;
void
serialize
(
std
::
wostream
&
_Wostream
)
{
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE
(
L"cfvo"
)
{
switch
(
type
)
{
case
0
:
CP_XML_ATTR
(
L"type"
,
L"percent"
);
break
;
case
1
:
CP_XML_ATTR
(
L"type"
,
L"num"
);
break
;
case
2
:
CP_XML_ATTR
(
L"type"
,
L"max"
);
break
;
case
3
:
CP_XML_ATTR
(
L"type"
,
L"min"
);
break
;
case
4
:
CP_XML_ATTR
(
L"type"
,
L"max"
);
break
;
//todooo ext - autoMax
case
5
:
CP_XML_ATTR
(
L"type"
,
L"min"
);
break
;
}
if
(
val
)
CP_XML_ATTR
(
L"val"
,
*
val
);
}
}
}
};
struct
rule
{
int
type
;
_CP_OPT
(
int
)
dxfId
;
_CP_OPT
(
bool
)
percent
;
_CP_OPT
(
bool
)
stopIfTrue
;
_CP_OPT
(
std
::
wstring
)
operator_
;
//expr
_CP_OPT
(
std
::
wstring
)
formula
;
//color scale icon set data_bar
std
::
vector
<
_cfvo
>
cfvo
;
//color scale data_bar(1 element)
std
::
vector
<
std
::
wstring
>
color
;
//data_bar icon_set
_CP_OPT
(
bool
)
showValue
;
//data_bar
_CP_OPT
(
int
)
minLength
;
_CP_OPT
(
int
)
maxLength
;
//icon set
_CP_OPT
(
bool
)
reverse
;
_CP_OPT
(
bool
)
iconset_percent
;
_CP_OPT
(
int
)
iconset_type
;
};
struct
conditionalFormatting
{
std
::
wstring
ref
;
std
::
vector
<
rule
>
rules
;
};
class
xlsx_conditionalFormatting_context
::
Impl
{
public:
void
serialize
(
std
::
wostream
&
_Wostream
)
{
if
(
!
conditionalFormattings_
.
empty
())
{
int
priority
=
1
;
CP_XML_WRITER
(
_Wostream
)
{
for
(
int
i
=
0
;
i
<
conditionalFormattings_
.
size
();
i
++
)
{
conditionalFormatting
&
c
=
conditionalFormattings_
[
i
];
CP_XML_NODE
(
L"conditionalFormatting"
)
{
CP_XML_ATTR
(
L"sqref"
,
c
.
ref
);
for
(
int
j
=
0
;
j
<
c
.
rules
.
size
();
j
++
)
{
if
(
c
.
rules
[
j
].
type
<
1
||
c
.
rules
[
j
].
type
>
4
)
continue
;
CP_XML_NODE
(
L"cfRule"
)
{
CP_XML_ATTR
(
L"priority"
,
priority
++
);
if
(
c
.
rules
[
j
].
dxfId
)
CP_XML_ATTR
(
L"dxfId"
,
*
c
.
rules
[
j
].
dxfId
);
if
(
c
.
rules
[
j
].
percent
)
CP_XML_ATTR
(
L"percent"
,
*
c
.
rules
[
j
].
percent
);
if
(
c
.
rules
[
j
].
operator_
)
CP_XML_ATTR
(
L"operator"
,
*
c
.
rules
[
j
].
operator_
);
if
(
c
.
rules
[
j
].
stopIfTrue
)
CP_XML_ATTR
(
L"stopIfTrue"
,
*
c
.
rules
[
j
].
stopIfTrue
);
//CP_XML_ATTR(L"text" , L"");
//CP_XML_ATTR(L"rank" , 0);
//CP_XML_ATTR(L"bottom" , 0);
//CP_XML_ATTR(L"equalAverage" , 0);
//CP_XML_ATTR(L"aboveAverage" , 0);
if
(
c
.
rules
[
j
].
type
==
1
)
{
CP_XML_ATTR
(
L"type"
,
L"expression"
);
if
(
c
.
rules
[
j
].
formula
)
{
CP_XML_NODE
(
L"formula"
)
{
CP_XML_CONTENT
(
*
c
.
rules
[
j
].
formula
);
}
}
}
else
if
(
c
.
rules
[
j
].
type
==
2
)
{
CP_XML_ATTR
(
L"type"
,
L"dataBar"
);
CP_XML_NODE
(
L"dataBar"
)
{
if
(
c
.
rules
[
j
].
showValue
)
CP_XML_ATTR
(
L"showValue"
,
*
c
.
rules
[
j
].
showValue
);
if
(
c
.
rules
[
j
].
minLength
)
CP_XML_ATTR
(
L"minLength"
,
*
c
.
rules
[
j
].
minLength
);
if
(
c
.
rules
[
j
].
maxLength
)
CP_XML_ATTR
(
L"maxLength"
,
*
c
.
rules
[
j
].
maxLength
);
for
(
int
k
=
0
;
k
<
c
.
rules
[
j
].
cfvo
.
size
();
k
++
)
{
c
.
rules
[
j
].
cfvo
[
k
].
serialize
(
CP_XML_STREAM
());
}
if
(
c
.
rules
[
j
].
color
.
size
()
>
0
)
{
CP_XML_NODE
(
L"color"
)
{
CP_XML_ATTR
(
L"rgb"
,
c
.
rules
[
j
].
color
[
0
]);
}
}
}
}
else
if
(
c
.
rules
[
j
].
type
==
3
)
{
CP_XML_ATTR
(
L"type"
,
L"colorScale"
);
CP_XML_NODE
(
L"colorScale"
)
{
for
(
int
k
=
0
;
k
<
c
.
rules
[
j
].
cfvo
.
size
();
k
++
)
{
c
.
rules
[
j
].
cfvo
[
k
].
serialize
(
CP_XML_STREAM
());
}
for
(
int
k
=
0
;
k
<
c
.
rules
[
j
].
color
.
size
();
k
++
)
{
CP_XML_NODE
(
L"color"
)
{
CP_XML_ATTR
(
L"rgb"
,
c
.
rules
[
j
].
color
[
k
]);
}
}
}
}
else
if
(
c
.
rules
[
j
].
type
==
4
)
{
CP_XML_ATTR
(
L"type"
,
L"iconSet"
);
CP_XML_NODE
(
L"iconSet"
)
{
if
(
c
.
rules
[
j
].
showValue
)
CP_XML_ATTR
(
L"showValue"
,
*
c
.
rules
[
j
].
showValue
);
for
(
int
k
=
0
;
k
<
c
.
rules
[
j
].
cfvo
.
size
();
k
++
)
{
c
.
rules
[
j
].
cfvo
[
k
].
serialize
(
CP_XML_STREAM
());
}
}
}
}
}
}
}
}
}
}
std
::
vector
<
conditionalFormatting
>
conditionalFormattings_
;
};
xlsx_conditionalFormatting_context
::
xlsx_conditionalFormatting_context
()
:
impl_
(
new
xlsx_conditionalFormatting_context
::
Impl
())
{}
xlsx_conditionalFormatting_context
::~
xlsx_conditionalFormatting_context
()
{
}
void
xlsx_conditionalFormatting_context
::
serialize
(
std
::
wostream
&
_Wostream
)
{
return
impl_
->
serialize
(
_Wostream
);
}
void
xlsx_conditionalFormatting_context
::
add
(
std
::
wstring
ref
)
{
formulasconvert
::
odf2oox_converter
converter
;
impl_
->
conditionalFormattings_
.
push_back
(
conditionalFormatting
());
ref
=
converter
.
convert_named_ref
(
ref
);
//'Fitness Plan'!N20:'Fitness Plan'!P22; K25 -> N20:P22
int
pos_cells
=
ref
.
find
(
L":"
);
std
::
wstring
ref2
;
if
(
pos_cells
>
0
)
{
ref2
=
ref
.
substr
(
pos_cells
+
1
);
ref
=
ref
.
substr
(
0
,
pos_cells
);
pos_cells
=
ref2
.
find
(
L"!"
);
if
(
pos_cells
>
0
)
ref2
=
ref2
.
substr
(
pos_cells
+
1
);
}
pos_cells
=
ref
.
find
(
L"!"
);
if
(
pos_cells
>
0
)
ref
=
ref
.
substr
(
pos_cells
+
1
);
if
(
!
ref2
.
empty
())
ref
+=
L":"
+
ref2
;
impl_
->
conditionalFormattings_
.
back
().
ref
=
ref
;
}
void
xlsx_conditionalFormatting_context
::
add_rule
(
int
type
)
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
push_back
(
rule
());
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
type
=
type
;
}
void
xlsx_conditionalFormatting_context
::
set_formula
(
std
::
wstring
f
)
{
int
pos
=
f
.
find
(
L"formula-is("
);
if
(
pos
>=
0
)
{
f
=
f
.
substr
(
11
,
f
.
size
()
-
12
);
}
formulasconvert
::
odf2oox_converter
converter
;
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula
=
converter
.
convert_named_expr
(
f
);
}
void
xlsx_conditionalFormatting_context
::
set_dataBar
(
_CP_OPT
(
int
)
min
,
_CP_OPT
(
int
)
max
)
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
minLength
=
min
;
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
maxLength
=
max
;
}
void
xlsx_conditionalFormatting_context
::
set_dxf
(
int
dxfId
)
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
dxfId
=
dxfId
;
}
void
xlsx_conditionalFormatting_context
::
add_sfv
(
int
type
,
std
::
wstring
value
)
{
_cfvo
cfvo
;
cfvo
.
type
=
type
;
if
(
!
value
.
empty
())
cfvo
.
val
=
value
;
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
cfvo
.
push_back
(
cfvo
);
}
void
xlsx_conditionalFormatting_context
::
add_color
(
std
::
wstring
col
)
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
color
.
push_back
(
col
);
}
void
xlsx_conditionalFormatting_context
::
set_showVal
(
bool
val
)
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
showValue
=
val
;
}
}
}
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.h
0 → 100644
View file @
bff7e2cd
#pragma once
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPScopedPtr.h>
#include <string>
namespace
cpdoccore
{
namespace
oox
{
class
xlsx_conditionalFormatting_context
{
public:
xlsx_conditionalFormatting_context
();
~
xlsx_conditionalFormatting_context
();
void
add
(
std
::
wstring
ref
);
void
add_rule
(
int
type
);
void
set_formula
(
std
::
wstring
f
);
void
set_dataBar
(
_CP_OPT
(
int
)
min
,
_CP_OPT
(
int
)
max
);
void
set_dxf
(
int
dxf_id
);
void
set_showVal
(
bool
val
);
void
add_sfv
(
int
type
,
std
::
wstring
value
);
void
add_color
(
std
::
wstring
col
);
void
serialize
(
std
::
wostream
&
_Wostream
);
private:
class
Impl
;
_CP_SCOPED_PTR
(
Impl
)
impl_
;
};
}
}
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
View file @
bff7e2cd
...
...
@@ -94,7 +94,7 @@ public:
mediaitems
&
get_mediaitems
()
{
return
handle_
.
impl_
->
get_mediaitems
();
}
void
write_drawing
(
std
::
wostream
&
strm
)
void
serialize
(
std
::
wostream
&
strm
)
{
xlsx_serialize
(
strm
,
*
xlsx_drawings_
);
}
...
...
@@ -581,9 +581,9 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio
}
}
void
xlsx_drawing_context
::
write_drawing
(
std
::
wostream
&
strm
)
void
xlsx_drawing_context
::
serialize
(
std
::
wostream
&
strm
)
{
impl_
->
write_drawing
(
strm
);
impl_
->
serialize
(
strm
);
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.h
View file @
bff7e2cd
...
...
@@ -88,7 +88,7 @@ public:
bool
empty
()
const
;
void
clear
();
void
write_drawing
(
std
::
wostream
&
strm
);
void
serialize
(
std
::
wostream
&
strm
);
std
::
wstring
dump_path
(
std
::
vector
<
svg_path
::
_polyline
>
&
path
,
double
w
,
double
h
);
xlsx_drawings_ptr
get_drawings
();
...
...
ASCOfficeOdfFile/src/docx/xlsx_dxfs.cpp
0 → 100644
View file @
bff7e2cd
#include "xlsx_dxfs.h"
#include "xlsx_fill.h"
#include "xlsx_font.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <ostream>
#include <vector>
namespace
cpdoccore
{
namespace
oox
{
struct
xlsx_dxf
{
xlsx_fill
fill
;
xlsx_font
font
;
};
class
xlsx_dxfs
::
Impl
{
public:
Impl
(){}
std
::
vector
<
xlsx_dxf
>
dxf_array
;
};
xlsx_dxfs
::
xlsx_dxfs
()
:
impl_
(
new
xlsx_dxfs
::
Impl
()
)
{
}
xlsx_dxfs
::~
xlsx_dxfs
()
{
}
size_t
xlsx_dxfs
::
dxfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
graphic_format_properties
*
graphProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
)
{
xlsx_dxf
dxf
;
dxf
.
fill
=
xlsx_fill
(
graphProp
,
cellProp
);
dxf
.
font
=
xlsx_font
(
textProp
,
NULL
,
cellProp
);
impl_
->
dxf_array
.
push_back
(
dxf
);
return
impl_
->
dxf_array
.
size
()
-
1
;
}
void
xlsx_dxfs
::
serialize
(
std
::
wostream
&
_Wostream
)
const
{
if
(
impl_
->
dxf_array
.
size
()
<
1
)
return
;
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE
(
L"dxfs"
)
{
CP_XML_ATTR
(
L"count"
,
impl_
->
dxf_array
.
size
());
for
(
int
i
=
0
;
i
<
impl_
->
dxf_array
.
size
();
i
++
)
{
CP_XML_NODE
(
L"dxf"
)
{
xlsx_serialize
(
CP_XML_STREAM
(),
impl_
->
dxf_array
[
i
].
fill
);
xlsx_serialize
(
CP_XML_STREAM
(),
impl_
->
dxf_array
[
i
].
font
);
}
}
}
}
}
}
}
ASCOfficeOdfFile/src/docx/xlsx_dxfs.h
0 → 100644
View file @
bff7e2cd
#pragma once
#include <iosfwd>
#include <string>
#include <cpdoccore/CPScopedPtr.h>
namespace
cpdoccore
{
namespace
odf_reader
{
class
text_format_properties_content
;
class
graphic_format_properties
;
class
paragraph_format_properties
;
class
style_table_cell_properties_attlist
;
}
namespace
oox
{
class
xlsx_dxfs
{
public:
xlsx_dxfs
();
~
xlsx_dxfs
();
size_t
dxfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
graphic_format_properties
*
graphProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
);
void
serialize
(
std
::
wostream
&
_Wostream
)
const
;
private:
class
Impl
;
_CP_SCOPED_PTR
(
Impl
)
impl_
;
};
}
}
ASCOfficeOdfFile/src/docx/xlsx_fill.cpp
View file @
bff7e2cd
#include "xlsx_fill.h"
#include "../odf/style_table_properties.h"
#include "../odf/style_graphic_properties.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <boost/foreach.hpp>
#include <boost/functional/hash/hash.hpp>
namespace
cpdoccore
{
...
...
@@ -50,7 +51,7 @@ std::size_t hash_value(xlsx_patternFill const & val)
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
const
xlsx_gradientFill
&
gradientFill
)
{
//
TODO
//
todooo
}
std
::
size_t
hash_value
(
xlsx_gradientFill
const
&
val
)
...
...
@@ -70,27 +71,19 @@ bool xlsx_gradientFill::operator != (const xlsx_gradientFill & rVal) const
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
const
xlsx_fill
&
fill
)
{
if
(
!
fill
.
patternFill
&&
!
fill
.
gradientFill
)
return
;
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE
(
L"fill"
)
{
if
(
fill
.
patternFill
)
xlsx_serialize
(
CP_XML_STREAM
(),
fill
.
patternFill
.
get
()
);
xlsx_serialize
(
CP_XML_STREAM
(),
*
fill
.
patternFill
);
if
(
fill
.
gradientFill
)
xlsx_serialize
(
CP_XML_STREAM
(),
fill
.
gradientFill
.
get
()
);
xlsx_serialize
(
CP_XML_STREAM
(),
*
fill
.
gradientFill
);
}
}
//_Wostream << L"<fill>";
//if (fill.patternFill)
// xlsx_serialize(_Wostream, fill.patternFill.get());
//if (fill.gradientFill)
// xlsx_serialize(_Wostream, fill.gradientFill.get());
//
//_Wostream << L"</fill>";
}
std
::
size_t
hash_value
(
xlsx_fill
const
&
val
)
...
...
@@ -112,5 +105,31 @@ bool xlsx_fill::operator != (const xlsx_fill & rVal) const
return
!
(
this
->
operator
==
(
rVal
));
}
xlsx_fill
::
xlsx_fill
(
const
odf_reader
::
graphic_format_properties
*
graphProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
)
{
bEnabled
=
false
;
bDefault
=
false
;
if
(
cellProp
)
{
if
(
_CP_OPT
(
odf_types
::
background_color
)
bgClr
=
cellProp
->
common_background_color_attlist_
.
fo_background_color_
)
{
if
(
bgClr
->
get_type
()
!=
odf_types
::
background_color
::
Transparent
)
{
bEnabled
=
true
;
xlsx_color
color
;
// alfa + rgb
color
.
rgb
=
L"ff"
+
bgClr
->
get_color
().
get_hex_value
();
patternFill
=
xlsx_patternFill
();
patternFill
->
bgColor
=
color
;
patternFill
->
fgColor
=
color
;
patternFill
->
patternType
=
L"solid"
;
}
}
}
}
}
}
ASCOfficeOdfFile/src/docx/xlsx_fill.h
View file @
bff7e2cd
...
...
@@ -4,6 +4,15 @@
#include <cpdoccore/CPOptional.h>
#include "xlsx_color.h"
namespace
cpdoccore
{
namespace
odf_reader
{
class
paragraph_format_properties
;
class
style_table_cell_properties_attlist
;
class
graphic_format_properties
;
}
}
namespace
cpdoccore
{
namespace
oox
{
...
...
@@ -27,14 +36,21 @@ namespace oox {
struct
xlsx_fill
{
xlsx_fill
()
{}
xlsx_fill
(
const
odf_reader
::
graphic_format_properties
*
graphProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
);
_CP_OPT
(
xlsx_patternFill
)
patternFill
;
_CP_OPT
(
xlsx_gradientFill
)
gradientFill
;
std
::
size_t
index
;
bool
bDefault
;
bool
bEnabled
;
bool
operator
==
(
const
xlsx_fill
&
rVal
)
const
;
bool
operator
!=
(
const
xlsx_fill
&
rVal
)
const
;
friend
std
::
size_t
hash_value
(
xlsx_fill
const
&
val
);
};
...
...
ASCOfficeOdfFile/src/docx/xlsx_fills.cpp
View file @
bff7e2cd
#include "xlsx_fill.h"
#include "xlsx_fills.h"
#include "../odf/style_table_properties.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <boost/unordered_set.hpp>
...
...
@@ -18,12 +16,12 @@ public:
typedef
boost
::
unordered_set
<
xlsx_fill
,
boost
::
hash
<
xlsx_fill
>
>
xlsx_fill_array
;
// typedef std::vector<xlsx_fill> xlsx_fill_array;
xlsx_fill_array
fills_
;
};
xlsx_fills
::
xlsx_fills
()
:
impl_
(
new
xlsx_fills
::
Impl
()
)
{
//defaults fill
{
xlsx_patternFill
patternFill
;
patternFill
.
patternType
=
L"none"
;
...
...
@@ -59,7 +57,7 @@ size_t xlsx_fills::size() const
return
impl_
->
fills_
.
size
();
}
size_t
xlsx_fills
::
fillId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
size_t
xlsx_fills
::
fillId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
,
bool
default_set
)
{
...
...
@@ -67,36 +65,22 @@ size_t xlsx_fills::fillId(const odf_reader::text_format_properties_content * tex
return
fillId
(
textProp
,
parProp
,
cellProp
,
default_set
,
is_default
);
}
size_t
xlsx_fills
::
fillId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
size_t
xlsx_fills
::
fillId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
,
bool
default_set
,
bool
&
is_default
)
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
,
bool
default_set
,
bool
&
is_default
)
{
is_default
=
true
;
if
(
cellProp
)
{
if
(
_CP_OPT
(
odf_types
::
background_color
)
bgClr
=
cellProp
->
common_background_color_attlist_
.
fo_background_color_
)
{
if
(
bgClr
->
get_type
()
!=
odf_types
::
background_color
::
Transparent
)
{
xlsx_color
color
;
// alfa + rgb
color
.
rgb
=
L"ff"
+
bgClr
->
get_color
().
get_hex_value
();
xlsx_patternFill
patternFill
;
patternFill
.
bgColor
=
color
;
patternFill
.
fgColor
=
color
;
patternFill
.
patternType
=
L"solid"
;
xlsx_fill
fill
(
NULL
,
cellProp
);
xlsx_fill
fill
;
fill
.
patternFill
=
patternFill
;
if
(
fill
.
bEnabled
)
{
fill
.
bDefault
=
default_set
;
Impl
::
xlsx_fill_array
::
const_iterator
i
=
impl_
->
fills_
.
find
(
fill
);
if
(
i
!=
impl_
->
fills_
.
end
())
{
//const unsigned int dbgId = i - impl_->fills_.begin();
const
std
::
size_t
dbgId
=
i
->
index
;
if
(
default_set
&&
i
->
bDefault
!=
default_set
)
{
...
...
@@ -120,9 +104,7 @@ size_t xlsx_fills::fillId(const odf_reader::text_format_properties_content * tex
return
fill
.
index
;
}
}
}
}
// TODO
return
0
;
}
...
...
@@ -139,7 +121,7 @@ struct compare_xlsx_fills
}
void
xlsx_fills
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
void
xlsx_fills
::
serialize
(
std
::
wostream
&
_Wostream
)
const
{
std
::
vector
<
xlsx_fill
>
inst_array
;
...
...
@@ -155,9 +137,10 @@ void xlsx_fills::xlsx_serialize(std::wostream & _Wostream) const
CP_XML_NODE
(
L"fills"
)
{
CP_XML_ATTR
(
L"count"
,
inst_array
.
size
());
BOOST_FOREACH
(
const
xlsx_fill
&
f
,
inst_array
)
for
(
int
i
=
0
;
i
<
inst_array
.
size
();
i
++
)
{
cpdoccore
::
oox
::
xlsx_serialize
(
CP_XML_STREAM
(),
f
);
xlsx_serialize
(
CP_XML_STREAM
(),
inst_array
[
i
]
);
}
}
}
...
...
@@ -170,10 +153,5 @@ void xlsx_fills::xlsx_serialize(std::wostream & _Wostream) const
//_Wostream << L"</fills>";
}
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
const
xlsx_fills
&
fills
)
{
fills
.
xlsx_serialize
(
_Wostream
);
}
}
}
ASCOfficeOdfFile/src/docx/xlsx_fills.h
View file @
bff7e2cd
...
...
@@ -12,7 +12,6 @@ namespace odf_reader {
class
text_format_properties_content
;
class
paragraph_format_properties
;
class
style_table_cell_properties_attlist
;
}
}
...
...
@@ -26,22 +25,21 @@ namespace oox {
~
xlsx_fills
();
public:
size_t
size
()
const
;
size_t
fillId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
size_t
fillId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
,
bool
default_set
);
size_t
fillId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
size_t
fillId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
,
bool
default_set
,
bool
&
is_default
);
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
;
void
serialize
(
std
::
wostream
&
_Wostream
)
const
;
private:
class
Impl
;
_CP_SCOPED_PTR
(
Impl
)
impl_
;
};
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
const
xlsx_fills
&
fills
);
}
}
ASCOfficeOdfFile/src/docx/xlsx_font.cpp
View file @
bff7e2cd
#include "xlsx_font.h"
#include <boost/foreach.hpp>
#include "../odf/style_text_properties.h"
#include "../odf/style_table_properties.h"
#include "../odf/style_paragraph_properties.h"
#include <boost/functional.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"
namespace
cpdoccore
{
namespace
oox
{
...
...
@@ -177,56 +180,6 @@ void xlsx_serialize(std::wostream & _Wostream, const xlsx_font & font)
}
}
/*
_Wostream << L"<font>";
if (font.bold)
_Wostream << L"<b val=\"" << (int)(*font.bold) << "\" />";
if (font.charset)
_Wostream << L"<charset val=\"" << *font.charset << "\" />";
if (font.color)
xlsx_serialize(_Wostream, *font.color);
if (font.condense)
_Wostream << L"<condense val=\"" << (int)(*font.condense) << "\" />";
if (font.extend)
_Wostream << L"<extend val=\"" << (int)(*font.extend) << "\" />";
if (font.family)
_Wostream << L"<family val=\"" << (int)(*font.family) << "\" />";
if (font.i)
_Wostream << L"<i val=\"" << (int)(*font.i) << "\" />";
if (font.name)
_Wostream << L"<name val=\"" << *font.name << "\" />";
if (font.outline)
_Wostream << L"<outline val=\"" << (int)(*font.outline) << "\" />";
if (font.scheme)
_Wostream << L"<scheme val=\"" << *font.scheme << "\" />";
if (font.shadow)
_Wostream << L"<shadow val=\"" << (int)(*font.shadow) << "\" />";
if (font.strike)
_Wostream << L"<strike val=\"" << (int)(*font.strike) << "\" />";
if (font.sz)
_Wostream << L"<sz val=\"" << *font.sz << "\" />";
if (font.u)
_Wostream << L"<u val=\"" << *font.u << "\" />";
if (font.vertAlign)
_Wostream << L"<vertAlign val=\"" << *font.vertAlign << "\" />";
_Wostream << L"</font>";
*/
}
bool
xlsx_font
::
operator
==
(
const
xlsx_font
&
rVal
)
const
...
...
@@ -276,5 +229,113 @@ std::size_t hash_value(xlsx_font const & val)
boost
::
hash_combine
(
seed
,
val
.
vertAlign
.
get_value_or
(
vertAlignBaseline
));
return
seed
;
}
//----------------------------------------------------------------------------------
XlsxFontCharset
GetXlsxFontCharset
(
const
odf_reader
::
text_format_properties_content
*
textProp
)
{
// TODO
return
XCHARSET_EMPTY
;
}
XlsxFontFamily
GetXlsxFontFamily
(
const
odf_reader
::
text_format_properties_content
*
textProp
)
{
// TODO
return
XFAMILY_EMPTY
;
}
xlsx_font
::
xlsx_font
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
)
{
bEnabled
=
false
;
if
(
!
textProp
)
return
;
bEnabled
=
true
;
if
(
textProp
->
fo_font_weight_
)
{
if
(
textProp
->
fo_font_weight_
.
get
().
get_type
()
==
odf_types
::
font_weight
::
WBold
)
bold
=
true
;
else
bold
=
false
;
}
if
(
textProp
->
fo_font_style_
)
{
if
(
textProp
->
fo_font_style_
.
get
().
get_type
()
==
odf_types
::
font_style
::
Italic
)
i
=
true
;
else
i
=
false
;
}
XlsxFontCharset
charset_
=
GetXlsxFontCharset
(
textProp
);
if
(
charset_
!=
XCHARSET_EMPTY
)
{
charset
=
(
unsigned
int
)
charset_
;
}
XlsxFontFamily
family_
=
GetXlsxFontFamily
(
textProp
);
if
(
family_
!=
XFAMILY_EMPTY
)
{
family
=
family_
;
}
if
(
textProp
->
style_font_name_
)
{
name
=
textProp
->
style_font_name_
.
get
();
}
if
(
textProp
->
fo_font_size_
)
{
sz
=
textProp
->
fo_font_size_
->
get_length
().
get_value_unit
(
odf_types
::
length
::
pt
);
}
//else
//{
// sz = 10.;//kDefaultFontSize; //todooo ... math
//}
if
(
textProp
->
style_text_underline_type_
&&
textProp
->
style_text_underline_type_
->
get_type
()
!=
odf_types
::
line_type
::
Non
||
textProp
->
style_text_underline_style_
&&
textProp
->
style_text_underline_style_
->
get_type
()
!=
odf_types
::
line_style
::
None
)
{
if
(
textProp
->
style_text_underline_type_
&&
textProp
->
style_text_underline_type_
->
get_type
()
==
odf_types
::
line_type
::
Double
)
u
=
XUNDERLINE_DOUBLE
;
else
u
=
XUNDERLINE_SINGLE
;
}
if
(
textProp
->
style_text_line_through_type_
&&
textProp
->
style_text_line_through_type_
->
get_type
()
!=
odf_types
::
line_type
::
Non
||
textProp
->
style_text_line_through_style_
&&
textProp
->
style_text_line_through_style_
->
get_type
()
!=
odf_types
::
line_style
::
None
)
{
strike
=
true
;
}
if
(
textProp
->
fo_text_shadow_
)
{
if
(
textProp
->
fo_text_shadow_
->
get_type
()
==
odf_types
::
shadow_type
::
Enable
)
shadow
=
true
;
else
shadow
=
false
;
}
bool
default_color
=
false
;
if
(
textProp
->
style_use_window_font_color_
)
default_color
=
true
;
if
(
textProp
->
fo_color_
&&
!
default_color
)
{
color
=
xlsx_color
();
color
->
rgb
=
L"ff"
+
textProp
->
fo_color_
->
get_hex_value
();
}
}
}
}
ASCOfficeOdfFile/src/docx/xlsx_font.h
View file @
bff7e2cd
#ifndef _CPDOCCORE_XLSX_FONT_H_INCLUDED
#define _CPDOCCORE_XLSX_FONT_H_INCLUDED
#pragma once
#include <iosfwd>
...
...
@@ -9,6 +7,15 @@
#include "xlsx_color.h"
namespace
cpdoccore
{
namespace
odf_reader
{
class
text_format_properties_content
;
class
paragraph_format_properties
;
class
style_table_cell_properties_attlist
;
}
}
namespace
cpdoccore
{
namespace
oox
{
...
...
@@ -65,6 +72,13 @@ namespace oox {
struct
xlsx_font
{
xlsx_font
()
{};
xlsx_font
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
);
bool
bEnabled
;
_CP_OPT
(
bool
)
bold
;
_CP_OPT
(
unsigned
int
)
charset
;
_CP_OPT
(
xlsx_color
)
color
;
...
...
@@ -90,8 +104,6 @@ namespace oox {
};
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
const
xlsx_font
&
font
);
}
}
#endif
ASCOfficeOdfFile/src/docx/xlsx_fonts.cpp
View file @
bff7e2cd
#include "xlsx_font.h"
#include "xlsx_fonts.h"
#include "xlsx_font.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <boost/unordered_set.hpp>
#include "../odf/style_text_properties.h"
namespace
cpdoccore
{
namespace
oox
{
namespace
{
const
double
kDefaultFontSize
=
10.0
;
}
namespace
{
XlsxFontCharset
GetXlsxFontCharset
(
const
odf_reader
::
text_format_properties_content
*
textProp
)
{
// TODO
return
XCHARSET_EMPTY
;
}
XlsxFontFamily
GetXlsxFontFamily
(
const
odf_reader
::
text_format_properties_content
*
textProp
)
{
// TODO
return
XFAMILY_EMPTY
;
}
xlsx_font
OdfFont2XlsxFont
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
)
{
xlsx_font
font
;
if
(
!
textProp
)
return
font
;
if
(
textProp
->
fo_font_weight_
)
{
if
(
textProp
->
fo_font_weight_
.
get
().
get_type
()
==
odf_types
::
font_weight
::
WBold
)
font
.
bold
=
true
;
else
font
.
bold
=
false
;
}
if
(
textProp
->
fo_font_style_
)
{
if
(
textProp
->
fo_font_style_
.
get
().
get_type
()
==
odf_types
::
font_style
::
Italic
)
font
.
i
=
true
;
else
font
.
i
=
false
;
}
XlsxFontCharset
charset
=
GetXlsxFontCharset
(
textProp
);
if
(
charset
!=
XCHARSET_EMPTY
)
{
font
.
charset
=
(
unsigned
int
)
charset
;
}
XlsxFontFamily
family
=
GetXlsxFontFamily
(
textProp
);
if
(
family
!=
XFAMILY_EMPTY
)
{
font
.
family
=
family
;
}
if
(
textProp
->
style_font_name_
)
{
font
.
name
=
textProp
->
style_font_name_
.
get
();
}
if
(
textProp
->
fo_font_size_
)
{
font
.
sz
=
textProp
->
fo_font_size_
->
get_length
().
get_value_unit
(
odf_types
::
length
::
pt
);
}
else
{
font
.
sz
=
kDefaultFontSize
;
}
if
(
textProp
->
style_text_underline_type_
&&
textProp
->
style_text_underline_type_
->
get_type
()
!=
odf_types
::
line_type
::
Non
||
textProp
->
style_text_underline_style_
&&
textProp
->
style_text_underline_style_
->
get_type
()
!=
odf_types
::
line_style
::
None
)
{
if
(
textProp
->
style_text_underline_type_
&&
textProp
->
style_text_underline_type_
->
get_type
()
==
odf_types
::
line_type
::
Double
)
font
.
u
=
XUNDERLINE_DOUBLE
;
else
font
.
u
=
XUNDERLINE_SINGLE
;
}
if
(
textProp
->
style_text_line_through_type_
&&
textProp
->
style_text_line_through_type_
->
get_type
()
!=
odf_types
::
line_type
::
Non
||
textProp
->
style_text_line_through_style_
&&
textProp
->
style_text_line_through_style_
->
get_type
()
!=
odf_types
::
line_style
::
None
)
{
font
.
strike
=
true
;
}
if
(
textProp
->
fo_text_shadow_
)
{
if
(
textProp
->
fo_text_shadow_
->
get_type
()
==
odf_types
::
shadow_type
::
Enable
)
font
.
shadow
=
true
;
else
font
.
shadow
=
false
;
}
bool
default_color
=
false
;
if
(
textProp
->
style_use_window_font_color_
)
default_color
=
true
;
if
(
textProp
->
fo_color_
&&
!
default_color
)
{
xlsx_color
color
;
// alfa + rgb
color
.
rgb
=
L"ff"
+
textProp
->
fo_color_
->
get_hex_value
();
std
::
wstring
test
=
color
.
rgb
.
get
();
font
.
color
=
color
;
}
return
font
;
}
}
// namespace
class
xlsx_fonts
::
Impl
{
public:
Impl
()
{
}
Impl
(){}
size_t
size
()
const
;
size_t
fontId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
size_t
fontId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
);
//const xlsx_font & getFont(size_t id) const;
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
)
const
;
private:
/*int getIndex(const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp) const;*/
void
serialize
(
std
::
wostream
&
_Wostream
)
const
;
private:
typedef
boost
::
unordered_set
<
xlsx_font
,
boost
::
hash
<
xlsx_font
>
>
fonts_array_t
;
...
...
@@ -169,7 +44,7 @@ struct compare_xlsx_fonts
}
void
xlsx_fonts
::
Impl
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
void
xlsx_fonts
::
Impl
::
serialize
(
std
::
wostream
&
_Wostream
)
const
{
std
::
vector
<
xlsx_font
>
fonts
;
...
...
@@ -180,19 +55,25 @@ void xlsx_fonts::Impl::xlsx_serialize(std::wostream & _Wostream) const
std
::
sort
(
fonts
.
begin
(),
fonts
.
end
(),
compare_xlsx_fonts
());
_Wostream
<<
L"<fonts count=
\"
"
<<
fonts
.
size
()
<<
"
\"
>"
;
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE
(
L"fonts"
)
{
CP_XML_ATTR
(
L"count"
,
fonts
.
size
());
for
(
size_t
i
=
0
;
i
<
fonts
.
size
();
++
i
)
::
cpdoccore
::
oox
::
xlsx_serialize
(
_Wostream
,
fonts
[
i
]);
_Wostream
<<
L"</fonts>"
;
{
xlsx_serialize
(
CP_XML_STREAM
(),
fonts
[
i
]);
}
}
}
}
size_t
xlsx_fonts
::
Impl
::
fontId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
)
{
xlsx_font
fnt
=
OdfFont2XlsxFont
(
textProp
,
parProp
,
cellProp
);
xlsx_font
fnt
=
xlsx_font
(
textProp
,
parProp
,
cellProp
);
fonts_array_t
::
const_iterator
i
=
fonts_
.
find
(
fnt
);
if
(
i
!=
fonts_
.
end
())
return
i
->
index
;
...
...
@@ -228,12 +109,6 @@ int xlsx_fonts::Impl::getIndex(const odf_reader::text_format_properties_content
size_t
xlsx_fonts
::
Impl
::
size
()
const
{
return
fonts_
.
size
();
}
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
const
xlsx_fonts
&
fonts
)
{
fonts
.
xlsx_serialize
(
_Wostream
);
}
////////////////////////////////////////////////////////////////////////////////////////////////
xlsx_fonts
::
xlsx_fonts
()
:
impl_
(
new
xlsx_fonts
::
Impl
())
...
...
@@ -249,9 +124,9 @@ size_t xlsx_fonts::size() const
return
impl_
->
size
();
}
void
xlsx_fonts
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
void
xlsx_fonts
::
serialize
(
std
::
wostream
&
_Wostream
)
const
{
return
impl_
->
xlsx_
serialize
(
_Wostream
);
return
impl_
->
serialize
(
_Wostream
);
}
size_t
xlsx_fonts
::
fontId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
...
...
ASCOfficeOdfFile/src/docx/xlsx_fonts.h
View file @
bff7e2cd
...
...
@@ -9,7 +9,6 @@ namespace odf_reader {
class
text_format_properties_content
;
class
paragraph_format_properties
;
class
style_table_cell_properties_attlist
;
}
}
...
...
@@ -26,20 +25,19 @@ namespace oox {
public:
size_t
size
()
const
;
size_t
fontId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
size_t
fontId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
);
const
xlsx_font
&
getFont
(
size_t
id
)
const
;
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
;
void
serialize
(
std
::
wostream
&
_Wostream
)
const
;
private:
class
Impl
;
_CP_SCOPED_PTR
(
Impl
)
impl_
;
};
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
xlsx_fonts
const
&
fonts
);
}
}
ASCOfficeOdfFile/src/docx/xlsx_merge_cells.cpp
View file @
bff7e2cd
#include "xlsx_merge_cells.h"
#include "xlsx_utils.h"
#include <ostream>
#include <vector>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
namespace
cpdoccore
{
...
...
@@ -35,8 +34,10 @@ public:
{
CP_XML_ATTR
(
L"count"
,
merges_
.
size
());
BOOST_FOREACH
(
const
merge
&
m
,
merges_
)
for
(
int
i
=
0
;
i
<
merges_
.
size
();
i
++
)
{
merge
&
m
=
merges_
[
i
];
CP_XML_NODE
(
L"mergeCell"
)
{
CP_XML_ATTR
(
L"ref"
,
getCellAddress
(
m
.
c
,
m
.
r
)
+
L":"
+
getCellAddress
(
m
.
c
+
m
.
cols
,
m
.
r
+
m
.
rows
));
...
...
ASCOfficeOdfFile/src/docx/xlsx_merge_cells.h
View file @
bff7e2cd
#pragma once
#include <boost/noncopyable.hpp>
#include <cpdoccore/CPScopedPtr.h>
namespace
cpdoccore
{
...
...
@@ -11,9 +10,10 @@ class xlsx_merge_cells
public:
xlsx_merge_cells
();
xlsx_merge_cells
(
const
xlsx_merge_cells
&
m
);
const
xlsx_merge_cells
&
operator
=
(
const
xlsx_merge_cells
&
m
);
~
xlsx_merge_cells
();
public:
void
add_merge
(
size_t
column
,
size_t
row
,
size_t
colsMerged
,
size_t
rowsMerged
);
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
);
private:
...
...
ASCOfficeOdfFile/src/docx/xlsx_numFmts.cpp
View file @
bff7e2cd
...
...
@@ -41,7 +41,7 @@ size_t xlsx_num_fmts::num_format_id(const std::wstring & format_code)
return
impl_
->
num_format_id
(
format_code
);
}
void
xlsx_num_fmts
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
void
xlsx_num_fmts
::
serialize
(
std
::
wostream
&
_Wostream
)
const
{
_Wostream
<<
L"<numFmts count=
\"
"
<<
impl_
->
formats_
.
size
()
<<
L"
\"
>"
;
for
(
size_t
i
=
0
;
i
<
impl_
->
formats_
.
size
();
++
i
)
...
...
@@ -53,10 +53,7 @@ void xlsx_num_fmts::xlsx_serialize(std::wostream & _Wostream) const
_Wostream
<<
L"</numFmts>"
;
}
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
const
xlsx_num_fmts
&
numFmts
)
{
return
numFmts
.
xlsx_serialize
(
_Wostream
);
}
}
}
ASCOfficeOdfFile/src/docx/xlsx_numFmts.h
View file @
bff7e2cd
...
...
@@ -17,15 +17,12 @@ namespace oox {
~
xlsx_num_fmts
();
public:
size_t
num_format_id
(
const
std
::
wstring
&
format_code
);
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
;
void
serialize
(
std
::
wostream
&
_Wostream
)
const
;
private:
struct
Impl
;
_CP_SCOPED_PTR
(
Impl
)
impl_
;
};
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
const
xlsx_num_fmts
&
numFmts
);
}
}
ASCOfficeOdfFile/src/docx/xlsx_output_xml.cpp
View file @
bff7e2cd
...
...
@@ -22,6 +22,7 @@ public:
std
::
wstringstream
comments_
;
std
::
wstringstream
sort_
;
std
::
wstringstream
autofilter_
;
std
::
wstringstream
conditionalFormatting_
;
rels
hyperlinks_rels_
;
...
...
@@ -72,6 +73,10 @@ std::wostream & xlsx_xml_worksheet::mergeCells()
{
return
impl_
->
mergeCells_
;
}
std
::
wostream
&
xlsx_xml_worksheet
::
conditionalFormatting
()
{
return
impl_
->
conditionalFormatting_
;
}
std
::
wostream
&
xlsx_xml_worksheet
::
sort
()
{
return
impl_
->
sort_
;
...
...
@@ -125,7 +130,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM
()
<<
impl_
->
sort_
.
str
();
//conditional formats
CP_XML_STREAM
()
<<
impl_
->
conditionalFormatting_
.
str
();
if
(
!
impl_
->
hyperlinks_
.
str
().
empty
())
{
...
...
ASCOfficeOdfFile/src/docx/xlsx_output_xml.h
View file @
bff7e2cd
...
...
@@ -13,7 +13,6 @@ namespace oox {
class
xlsx_xml_worksheet
;
typedef
_CP_PTR
(
xlsx_xml_worksheet
)
xlsx_xml_worksheet_ptr
;
// xlsx_xml_worksheet
class
xlsx_xml_worksheet
:
noncopyable
{
public:
...
...
@@ -30,6 +29,7 @@ public:
std
::
wostream
&
drawing
();
std
::
wostream
&
comments
();
std
::
wostream
&
autofilter
();
std
::
wostream
&
conditionalFormatting
();
std
::
wostream
&
sort
();
rels
&
hyperlinks_rels
();
...
...
ASCOfficeOdfFile/src/docx/xlsx_sharedstrings.cpp
View file @
bff7e2cd
...
...
@@ -12,14 +12,14 @@ namespace oox {
class
xlsx_shared_strings
::
Impl
{
public:
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
;
void
serialize
(
std
::
wostream
&
_Wostream
)
const
;
size_t
add
(
const
std
::
wstring
&
content
);
private:
std
::
vector
<
std
::
wstring
>
strings_
;
};
void
xlsx_shared_strings
::
Impl
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
void
xlsx_shared_strings
::
Impl
::
serialize
(
std
::
wostream
&
_Wostream
)
const
{
_Wostream
<<
L"<sst xmlns=
\"
http://schemas.openxmlformats.org/spreadsheetml/2006/main
\"
count=
\"
"
<<
strings_
.
size
()
<<
"
\"
uniqueCount=
\"
"
<<
strings_
.
size
()
<<
"
\"
>"
;
...
...
@@ -48,9 +48,9 @@ xlsx_shared_strings::~xlsx_shared_strings()
{
}
void
xlsx_shared_strings
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
void
xlsx_shared_strings
::
serialize
(
std
::
wostream
&
_Wostream
)
const
{
return
impl_
->
xlsx_
serialize
(
_Wostream
);
return
impl_
->
serialize
(
_Wostream
);
}
size_t
xlsx_shared_strings
::
add
(
const
std
::
wstring
&
content
)
...
...
ASCOfficeOdfFile/src/docx/xlsx_sharedstrings.h
View file @
bff7e2cd
...
...
@@ -15,7 +15,7 @@ public:
~
xlsx_shared_strings
();
public:
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
const
;
void
serialize
(
std
::
wostream
&
_Wostream
)
const
;
size_t
add
(
const
std
::
wstring
&
content
);
private:
...
...
ASCOfficeOdfFile/src/docx/xlsx_styles.cpp
View file @
bff7e2cd
...
...
@@ -6,6 +6,7 @@
#include "xlsxconversioncontext.h"
#include "xlsx_fonts.h"
#include "xlsx_xf.h"
#include "xlsx_dxfs.h"
#include "xlsx_borders.h"
#include "xlsx_fills.h"
#include "xlsx_cell_format.h"
...
...
@@ -21,32 +22,39 @@ namespace oox {
class
xlsx_style_manager
::
Impl
{
public:
//typedef std::vector<xlsx_xf> xlsx_xf_array;
typedef
boost
::
unordered_set
<
xlsx_xf
,
boost
::
hash
<
xlsx_xf
>
>
xlsx_xf_array
;
public:
Impl
(
xlsx_conversion_context
*
context
);
size_t
size
()
const
;
size_t
xfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
size_t
xfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
,
const
xlsx_cell_format
*
xlxsCellFormat
,
const
std
::
wstring
&
num_format
,
bool
default_set
,
bool
&
is_visible
);
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
);
void
xlsx_serialize_xf
(
std
::
wostream
&
_Wostream
,
const
xlsx_xf_array
&
xfArray
,
const
std
::
wstring
&
nodeName
);
size_t
dxfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
graphic_format_properties
*
graphProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
);
void
serialize
(
std
::
wostream
&
_Wostream
);
void
serialize_xf
(
std
::
wostream
&
_Wostream
,
const
xlsx_xf_array
&
xfArray
,
const
std
::
wstring
&
nodeName
);
private:
xlsx_fonts
fonts_
;
xlsx_borders
borders_
;
xlsx_fills
fills_
;
xlsx_num_fmts
numFmts_
;
xlsx_xf_array
cellXfs_
;
xlsx_cell_styles
cellStyles_
;
xlsx_xf_array
cellStyleXfs_
;
xlsx_num_fmts
numFmts_
;
private:
xlsx_dxfs
dxfs_
;
//-------------------------------------------------
xlsx_conversion_context
*
context
;
size_t
next_index_
;
...
...
@@ -72,6 +80,13 @@ size_t xlsx_style_manager::Impl::size() const
return
cellXfs_
.
size
();
}
size_t
xlsx_style_manager
::
Impl
::
dxfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
graphic_format_properties
*
graphProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
)
{
return
dxfs_
.
dxfId
(
textProp
,
graphProp
,
cellProp
);
}
size_t
xlsx_style_manager
::
Impl
::
xfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
paragraph_format_properties
*
parProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
,
...
...
@@ -140,19 +155,21 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
return
id
;
}
void
xlsx_style_manager
::
Impl
::
xlsx_
serialize
(
std
::
wostream
&
_Wostream
)
void
xlsx_style_manager
::
Impl
::
serialize
(
std
::
wostream
&
_Wostream
)
{
_Wostream
<<
L"<styleSheet xmlns=
\"
http://schemas.openxmlformats.org/spreadsheetml/2006/main
\"
>"
;
cpdoccore
::
oox
::
xlsx_serialize
(
_Wostream
,
numFmts_
);
cpdoccore
::
oox
::
xlsx_serialize
(
_Wostream
,
fonts_
);
cpdoccore
::
oox
::
xlsx_serialize
(
_Wostream
,
fills_
);
cpdoccore
::
oox
::
xlsx_serialize
(
_Wostream
,
borders_
);
numFmts_
.
serialize
(
_Wostream
);
fonts_
.
serialize
(
_Wostream
);
fills_
.
serialize
(
_Wostream
);
borders_
.
serialize
(
_Wostream
);
serialize_xf
(
_Wostream
,
cellStyleXfs_
,
L"cellStyleXfs"
);
serialize_xf
(
_Wostream
,
cellXfs_
,
L"cellXfs"
);
xlsx_serialize_xf
(
_Wostream
,
cellStyleXfs_
,
L"cellStyleXfs"
);
xlsx_serialize_xf
(
_Wostream
,
cellXfs_
,
L"cellXfs"
);
cellStyles_
.
xlsx_
serialize
(
_Wostream
);
cellStyles_
.
serialize
(
_Wostream
);
dxfs_
.
serialize
(
_Wostream
);
_Wostream
<<
L"</styleSheet>"
;
...
...
@@ -169,7 +186,7 @@ namespace
};
}
void
xlsx_style_manager
::
Impl
::
xlsx_
serialize_xf
(
std
::
wostream
&
_Wostream
,
const
xlsx_xf_array
&
xfArray
,
const
std
::
wstring
&
nodeName
)
void
xlsx_style_manager
::
Impl
::
serialize_xf
(
std
::
wostream
&
_Wostream
,
const
xlsx_xf_array
&
xfArray
,
const
std
::
wstring
&
nodeName
)
{
std
::
vector
<
xlsx_xf
>
xfs_
;
...
...
@@ -216,10 +233,16 @@ size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content
{
return
impl_
->
xfId
(
textProp
,
parProp
,
cellProp
,
xlxsCellFormat
,
num_format
,
default_set
,
is_visible
);
}
size_t
xlsx_style_manager
::
dxfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
graphic_format_properties
*
graphProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
)
{
return
impl_
->
dxfId
(
textProp
,
graphProp
,
cellProp
);
}
void
xlsx_style_manager
::
xlsx_serialize
(
std
::
wostream
&
_Wostream
)
{
return
impl_
->
xlsx_
serialize
(
_Wostream
);
return
impl_
->
serialize
(
_Wostream
);
}
xlsx_style_manager
::~
xlsx_style_manager
()
...
...
ASCOfficeOdfFile/src/docx/xlsx_styles.h
View file @
bff7e2cd
...
...
@@ -8,6 +8,7 @@ namespace cpdoccore {
namespace
odf_reader
{
class
text_format_properties_content
;
class
graphic_format_properties
;
class
paragraph_format_properties
;
class
style_table_cell_properties_attlist
;
}
...
...
@@ -35,6 +36,9 @@ public:
const
xlsx_cell_format
*
xlxsCellFormat
,
const
std
::
wstring
&
num_format
,
bool
default_set
);
size_t
dxfId
(
const
odf_reader
::
text_format_properties_content
*
textProp
,
const
odf_reader
::
graphic_format_properties
*
graphProp
,
const
odf_reader
::
style_table_cell_properties_attlist
*
cellProp
);
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
View file @
bff7e2cd
...
...
@@ -183,7 +183,7 @@ void xlsx_table_state::start_cell(size_t columnsSpanned, size_t rowsSpanned)
//
if
(
columnsSpanned
!=
0
||
rowsSpanned
!=
0
)
merge_cells_
.
add_merge
(
current_table_column_
,
current_table_row_
,
columnsSpanned
,
rowsSpanned
);
xlsx_
merge_cells_
.
add_merge
(
current_table_column_
,
current_table_row_
,
columnsSpanned
,
rowsSpanned
);
if
(
current_columns_spaned
()
>
0
)
{
...
...
@@ -368,14 +368,17 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
}
void
xlsx_table_state
::
serialize_merge_cells
(
std
::
wostream
&
_Wostream
)
{
return
merge_cells_
.
xlsx_serialize
(
_Wostream
);
return
xlsx_
merge_cells_
.
xlsx_serialize
(
_Wostream
);
}
void
xlsx_table_state
::
serialize_hyperlinks
(
std
::
wostream
&
_Wostream
)
{
return
xlsx_hyperlinks_
.
xlsx_serialize
(
_Wostream
);
}
void
xlsx_table_state
::
serialize_conditionalFormatting
(
std
::
wostream
&
_Wostream
)
{
return
xlsx_conditionalFormatting_context_
.
serialize
(
_Wostream
);
}
void
xlsx_table_state
::
dump_rels_hyperlinks
(
rels
&
Rels
)
{
return
xlsx_hyperlinks_
.
dump_rels
(
Rels
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_table_state.h
View file @
bff7e2cd
...
...
@@ -8,6 +8,7 @@
#include "xlsx_drawing_context.h"
#include "xlsx_comments_context.h"
#include "xlsx_hyperlinks.h"
#include "xlsx_conditionalFormatting.h"
namespace
cpdoccore
{
namespace
oox
{
...
...
@@ -51,18 +52,19 @@ public:
std
::
wstring
current_style
()
const
{
return
table_style_
;
}
void
start_column
(
unsigned
int
repeated
,
const
std
::
wstring
&
defaultCellStyleName
);
void
start_row
(
const
std
::
wstring
&
StyleName
,
const
std
::
wstring
&
defaultCellStyleName
);
void
start_column
(
unsigned
int
repeated
,
const
std
::
wstring
&
defaultCellStyleName
);
void
start_row
(
const
std
::
wstring
&
StyleName
,
const
std
::
wstring
&
defaultCellStyleName
);
void
non_empty_row
();
bool
is_empty_row
()
const
;
void
end_row
();
void
non_empty_row
();
bool
is_empty_row
()
const
;
void
end_row
();
std
::
wstring
current_row_style
()
const
;
std
::
wstring
default_row_cell_style
()
const
;
std
::
wstring
default_column_cell_style
()
const
;
std
::
wstring
current_row_style
()
const
;
std
::
wstring
default_row_cell_style
()
const
;
std
::
wstring
default_column_cell_style
()
const
;
void
set_table_row_group
(
int
count
,
bool
collapsed
,
int
level
);
void
start_cell
(
size_t
columnsSpanned
,
size_t
rowsSpanned
);
void
end_cell
();
...
...
@@ -75,20 +77,22 @@ public:
int
current_column
()
const
;
int
current_row
()
const
;
unsigned
int
current_columns_spaned
()
const
;
unsigned
int
current_rows_spanned
(
unsigned
int
Column
)
const
;
unsigned
int
columns_count
()
const
;
unsigned
int
current_columns_spaned
()
const
;
unsigned
int
current_rows_spanned
(
unsigned
int
Column
)
const
;
unsigned
int
columns_count
()
const
;
xlsx_table_metrics
&
get_table_metrics
()
{
return
xlsx_table_metrics_
;
}
xlsx_drawing_context
&
get_drawing_context
()
{
return
xlsx_drawing_context_
;
}
xlsx_comments_context
&
get_comments_context
()
{
return
xlsx_comments_context_
;
}
xlsx_conditionalFormatting_context
&
get_conditionalFormatting_context
()
{
return
xlsx_conditionalFormatting_context_
;}
void
table_column_last_width
(
double
w
)
{
table_column_last_width_
=
w
;
}
double
table_column_last_width
()
const
{
return
table_column_last_width_
;
};
void
start_hyperlink
();
std
::
wstring
end_hyperlink
(
std
::
wstring
const
&
ref
,
std
::
wstring
const
&
href
,
std
::
wstring
const
&
display
);
void
start_hyperlink
();
std
::
wstring
end_hyperlink
(
std
::
wstring
const
&
ref
,
std
::
wstring
const
&
href
,
std
::
wstring
const
&
display
);
void
serialize_conditionalFormatting
(
std
::
wostream
&
_Wostream
);
void
serialize_table_format
(
std
::
wostream
&
_Wostream
);
void
serialize_merge_cells
(
std
::
wostream
&
_Wostream
);
void
serialize_hyperlinks
(
std
::
wostream
&
_Wostream
);
...
...
@@ -96,6 +100,7 @@ public:
std
::
wstring
get_table_name
()
const
{
return
tableName_
;
}
int
get_table_id
()
const
{
return
tableId_
;
}
struct
_group_row
{
bool
enabled
;
...
...
@@ -108,8 +113,8 @@ public:
friend
class
xlsx_table_context
;
private:
bool
in_cell
;
xlsx_conversion_context
*
context_
;
std
::
wstring
tableName_
;
int
tableId_
;
...
...
@@ -122,6 +127,7 @@ private:
int
current_table_column_
;
int
current_table_row_
;
bool
empty_row_
;
bool
in_cell
;
unsigned
int
columns_spanned_num_
;
std
::
wstring
columns_spanned_style_
;
...
...
@@ -131,10 +137,12 @@ private:
unsigned
int
columns_count_
;
double
table_column_last_width_
;
xlsx_merge_cells
merge_cells_
;
xlsx_table_metrics
xlsx_table_metrics_
;
xlsx_drawing_context
xlsx_drawing_context_
;
xlsx_comments_context
xlsx_comments_context_
;
xlsx_conditionalFormatting_context
xlsx_conditionalFormatting_context_
;
xlsx_merge_cells
xlsx_merge_cells_
;
xlsx_table_metrics
xlsx_table_metrics_
;
xlsx_hyperlinks
xlsx_hyperlinks_
;
};
...
...
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp
View file @
bff7e2cd
...
...
@@ -273,6 +273,10 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
}
}
}
void
xlsx_table_context
::
serialize_conditionalFormatting
(
std
::
wostream
&
_Wostream
)
{
return
state
()
->
serialize_conditionalFormatting
(
_Wostream
);
}
void
xlsx_table_context
::
serialize_merge_cells
(
std
::
wostream
&
_Wostream
)
{
return
state
()
->
serialize_merge_cells
(
_Wostream
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
View file @
bff7e2cd
...
...
@@ -56,6 +56,7 @@ public:
void
serialize_autofilter
(
std
::
wostream
&
_Wostream
);
void
serialize_merge_cells
(
std
::
wostream
&
_Wostream
);
void
serialize_table_format
(
std
::
wostream
&
_Wostream
);
void
serialize_conditionalFormatting
(
std
::
wostream
&
_Wostream
);
xlsx_table_metrics
&
get_table_metrics
();
...
...
ASCOfficeOdfFile/src/docx/xlsx_textcontext.cpp
View file @
bff7e2cd
...
...
@@ -51,7 +51,7 @@ public:
void
start_drawing_content
();
std
::
wstring
end_drawing_content
();
void
writ
e_shared_strings
(
std
::
wostream
&
strm
);
void
serializ
e_shared_strings
(
std
::
wostream
&
strm
);
void
ApplyTextProperties
(
std
::
wstring
style
,
odf_reader
::
text_format_properties_content
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
);
void
ApplyParagraphProperties
(
std
::
wstring
style
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
);
...
...
@@ -95,9 +95,9 @@ private:
};
void
xlsx_text_context
::
Impl
::
writ
e_shared_strings
(
std
::
wostream
&
strm
)
void
xlsx_text_context
::
Impl
::
serializ
e_shared_strings
(
std
::
wostream
&
strm
)
{
xlsx_shared_strings_
.
xlsx_
serialize
(
strm
);
xlsx_shared_strings_
.
serialize
(
strm
);
}
...
...
@@ -603,9 +603,9 @@ std::wstring xlsx_text_context::end_drawing_content()
{
return
impl_
->
end_drawing_content
();
}
void
xlsx_text_context
::
writ
e_shared_strings
(
std
::
wostream
&
strm
)
void
xlsx_text_context
::
serializ
e_shared_strings
(
std
::
wostream
&
strm
)
{
return
impl_
->
writ
e_shared_strings
(
strm
);
return
impl_
->
serializ
e_shared_strings
(
strm
);
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_textcontext.h
View file @
bff7e2cd
...
...
@@ -51,7 +51,7 @@ public:
void
add_text
(
const
std
::
wstring
&
text
);
void
writ
e_shared_strings
(
std
::
wostream
&
strm
);
void
serializ
e_shared_strings
(
std
::
wostream
&
strm
);
bool
is_drawing_context
();
...
...
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
View file @
bff7e2cd
...
...
@@ -166,7 +166,7 @@ void xlsx_conversion_context::end_document()
count
++
;
package
::
chart_content_ptr
content
=
package
::
chart_content
::
create
();
chart
->
write_to
(
content
->
content
());
chart
->
serialize
(
content
->
content
());
output_document_
->
get_xl_files
().
add_charts
(
content
);
...
...
@@ -175,7 +175,7 @@ void xlsx_conversion_context::end_document()
{
std
::
wstringstream
strm
;
xlsx_text_context_
.
writ
e_shared_strings
(
strm
);
xlsx_text_context_
.
serializ
e_shared_strings
(
strm
);
output_document_
->
get_xl_files
().
set_sharedStrings
(
package
::
simple_element
::
create
(
L"sharedStrings.xml"
,
strm
.
str
())
);
}
...
...
@@ -288,8 +288,8 @@ void xlsx_conversion_context::end_table()
}
current_sheet
().
cols
()
<<
L"</cols>"
;
get_table_context
().
serialize_table_format
(
current_sheet
().
sheetFormat
());
get_table_context
().
serialize_table_format
(
current_sheet
().
sheetFormat
());
get_table_context
().
serialize_conditionalFormatting
(
current_sheet
().
conditionalFormatting
());
get_table_context
().
serialize_autofilter
(
current_sheet
().
autofilter
());
get_table_context
().
serialize_sort
(
current_sheet
().
sort
());
get_table_context
().
serialize_merge_cells
(
current_sheet
().
mergeCells
());
...
...
@@ -303,7 +303,7 @@ void xlsx_conversion_context::end_table()
if
(
!
get_drawing_context
().
empty
())
{
std
::
wstringstream
strm
;
get_drawing_context
().
write_drawing
(
strm
);
get_drawing_context
().
serialize
(
strm
);
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
drawingName
=
xlsx_drawing_context_handle_
.
add_drawing_xml
(
strm
.
str
(),
get_drawing_context
().
get_drawings
()
);
...
...
@@ -322,10 +322,10 @@ void xlsx_conversion_context::end_table()
if
(
!
get_comments_context
().
empty
())
{
std
::
wstringstream
strm
;
get_comments_context
().
write_comments
(
strm
);
get_comments_context
().
serialize
(
strm
);
std
::
wstringstream
vml_strm
;
get_comments_context
().
write_comments
_vml
(
vml_strm
);
get_comments_context
().
serialize
_vml
(
vml_strm
);
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
commentsName
=
xlsx_comments_context_handle_
.
add_comments_xml
(
strm
.
str
(),
vml_strm
.
str
(),
get_comments_context
().
get_comments
()
);
...
...
@@ -556,5 +556,39 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href)
}
}
void
xlsx_conversion_context
::
start_conditional_format
(
std
::
wstring
ref
)
{
get_table_context
().
state
()
->
get_conditionalFormatting_context
().
add
(
ref
);
}
void
xlsx_conversion_context
::
start_conditional_format_rule
(
int
type
)
{
get_table_context
().
state
()
->
get_conditionalFormatting_context
().
add_rule
(
type
);
}
void
xlsx_conversion_context
::
set_conditional_format_formula
(
std
::
wstring
f
)
{
get_table_context
().
state
()
->
get_conditionalFormatting_context
().
set_formula
(
f
);
}
void
xlsx_conversion_context
::
set_conditional_format_dxf
(
int
dxfId
)
{
get_table_context
().
state
()
->
get_conditionalFormatting_context
().
set_dxf
(
dxfId
);
}
void
xlsx_conversion_context
::
add_conditional_format_entry
(
int
type
,
std
::
wstring
value
)
{
get_table_context
().
state
()
->
get_conditionalFormatting_context
().
add_sfv
(
type
,
value
);
}
void
xlsx_conversion_context
::
set_conditional_format_showval
(
bool
val
)
{
get_table_context
().
state
()
->
get_conditionalFormatting_context
().
set_showVal
(
val
);
}
void
xlsx_conversion_context
::
add_conditional_format_color
(
std
::
wstring
col
)
{
get_table_context
().
state
()
->
get_conditionalFormatting_context
().
add_color
(
col
);
}
void
xlsx_conversion_context
::
set_conditional_format_dataBar
(
_CP_OPT
(
int
)
min
,
_CP_OPT
(
int
)
max
)
{
get_table_context
().
state
()
->
get_conditionalFormatting_context
().
set_dataBar
(
min
,
max
);
}
}
}
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.h
View file @
bff7e2cd
...
...
@@ -101,6 +101,22 @@ public:
std
::
wstring
current_cell_address
();
//------------------------------------------------------------------------------------
void
start_conditional_format
(
std
::
wstring
ref
);
void
end_conditional_format
(){}
void
start_conditional_format_rule
(
int
type
);
void
end_conditional_format_rule
(){}
void
set_conditional_format_formula
(
std
::
wstring
f
);
void
set_conditional_format_dxf
(
int
dxfId
);
void
set_conditional_format_showval
(
bool
val
);
void
add_conditional_format_color
(
std
::
wstring
col
);
void
add_conditional_format_entry
(
int
type
,
std
::
wstring
value
);
void
set_conditional_format_dataBar
(
_CP_OPT
(
int
)
min
,
_CP_OPT
(
int
)
max
);
//------------------------------------------------------------------------------------
odf_reader
::
odf_document
*
root
()
{
return
odf_document_
;
...
...
ASCOfficeOdfFile/src/odf/calcext_elements.cpp
View file @
bff7e2cd
...
...
@@ -13,6 +13,7 @@
#include <cpdoccore/odf/odf_document.h>
#include "serialize_elements.h"
#include "calcs_styles.h"
namespace
cpdoccore
{
...
...
@@ -26,6 +27,8 @@ void calcext_data_bar_attr::add_attributes( const xml::attributes_wc_ptr & Attri
CP_APPLY_ATTR
(
L"calcext:axis-color"
,
calcext_axis_color_
);
CP_APPLY_ATTR
(
L"calcext:positive-color"
,
calcext_positive_color_
);
CP_APPLY_ATTR
(
L"calcext:negative-color"
,
calcext_negative_color_
);
CP_APPLY_ATTR
(
L"calcext:min-length"
,
calcext_min_length_
);
CP_APPLY_ATTR
(
L"calcext:max-length"
,
calcext_max_length_
);
}
void
calcext_icon_set_attr
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
...
...
@@ -58,6 +61,10 @@ void calcext_conditional_formats::add_child_element( xml::sax * Reader, const ::
}
void
calcext_conditional_formats
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
content_
[
i
]
->
xlsx_convert
(
Context
);
}
}
// calcext_conditional_format
...
...
@@ -75,6 +82,15 @@ void calcext_conditional_format::add_child_element( xml::sax * Reader, const ::s
}
void
calcext_conditional_format
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
if
(
!
calcext_target_range_address_
)
return
;
Context
.
start_conditional_format
(
*
calcext_target_range_address_
);
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
content_
[
i
]
->
xlsx_convert
(
Context
);
}
Context
.
end_conditional_format
();
}
// calcext_data_bar
...
...
@@ -84,7 +100,9 @@ const wchar_t * calcext_data_bar::name = L"data-bar";
void
calcext_data_bar
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"calcext:show-value"
,
calcext_show_value_
);
calcext_data_bar_attr_
.
add_attributes
(
Attributes
);
}
void
calcext_data_bar
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
...
...
@@ -92,7 +110,20 @@ void calcext_data_bar::add_child_element( xml::sax * Reader, const ::std::wstrin
}
void
calcext_data_bar
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
Context
.
start_conditional_format_rule
(
2
);
if
(
calcext_show_value_
)
Context
.
set_conditional_format_showval
(
*
calcext_show_value_
);
if
(
calcext_data_bar_attr_
.
calcext_positive_color_
)
Context
.
add_conditional_format_color
(
L"ff"
+
calcext_data_bar_attr_
.
calcext_positive_color_
->
get_hex_value
());
Context
.
set_conditional_format_dataBar
(
calcext_data_bar_attr_
.
calcext_min_length_
,
calcext_data_bar_attr_
.
calcext_max_length_
);
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
content_
[
i
]
->
xlsx_convert
(
Context
);
}
Context
.
end_conditional_format_rule
();
}
// calcext_color_scale
//////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -108,7 +139,12 @@ void calcext_color_scale::add_child_element( xml::sax * Reader, const ::std::wst
}
void
calcext_color_scale
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
Context
.
start_conditional_format_rule
(
3
);
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
content_
[
i
]
->
xlsx_convert
(
Context
);
}
Context
.
end_conditional_format_rule
();
}
// calcext_icon_set
//////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -117,6 +153,7 @@ const wchar_t * calcext_icon_set::name = L"icon-set";
void
calcext_icon_set
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"calcext:show-value"
,
calcext_show_value_
);
calcext_icon_set_attr_
.
add_attributes
(
Attributes
);
}
void
calcext_icon_set
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
...
...
@@ -125,6 +162,15 @@ void calcext_icon_set::add_child_element( xml::sax * Reader, const ::std::wstrin
}
void
calcext_icon_set
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
Context
.
start_conditional_format_rule
(
4
);
if
(
calcext_show_value_
)
Context
.
set_conditional_format_showval
(
*
calcext_show_value_
);
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
content_
[
i
]
->
xlsx_convert
(
Context
);
}
Context
.
end_conditional_format_rule
();
}
// calcext_formatting_entry
...
...
@@ -134,6 +180,8 @@ const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
void
calcext_formatting_entry
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"calcext:value"
,
calcext_value_
);
CP_APPLY_ATTR
(
L"calcext:type"
,
calcext_type_
);
}
void
calcext_formatting_entry
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
...
...
@@ -141,6 +189,8 @@ void calcext_formatting_entry::add_child_element( xml::sax * Reader, const ::std
}
void
calcext_formatting_entry
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
calcext_type
::
type
type_
=
calcext_type_
.
get_value_or
(
calcext_type
::
Number
).
get_type
();
Context
.
add_conditional_format_entry
((
int
)
type_
,
calcext_value_
.
get_value_or
(
L""
));
}
// calcext_color_scale_entry
...
...
@@ -157,6 +207,13 @@ void calcext_color_scale_entry::add_child_element( xml::sax * Reader, const ::st
}
void
calcext_color_scale_entry
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
if
(
calcext_color_
)
Context
.
add_conditional_format_color
(
L"ff"
+
calcext_color_
->
get_hex_value
());
else
Context
.
add_conditional_format_color
(
L"ffffffff"
);
calcext_type
::
type
type_
=
calcext_type_
.
get_value_or
(
calcext_type
::
Number
).
get_type
();
Context
.
add_conditional_format_entry
((
int
)
type_
,
calcext_value_
.
get_value_or
(
L""
));
}
// calcext_condition
//////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -173,6 +230,28 @@ void calcext_condition::add_child_element( xml::sax * Reader, const ::std::wstri
}
void
calcext_condition
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
Context
.
start_conditional_format_rule
(
1
);
if
(
calcext_condition_attr_
.
calcext_value_
)
{
Context
.
set_conditional_format_formula
(
*
calcext_condition_attr_
.
calcext_value_
);
}
std
::
wstring
style_name
=
calcext_condition_attr_
.
calcext_apply_style_name_
.
get_value_or
(
L""
);
style_instance
*
instStyle
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_by_name
(
style_name
,
style_family
::
TableCell
,
false
);
if
(
!
instStyle
)
instStyle
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_by_display_name
(
style_name
,
style_family
::
TableCell
,
false
);
if
(
instStyle
)
{
text_format_properties_content
textFormats
=
calc_text_properties_content
(
instStyle
);
graphic_format_properties
graphicFormats
=
calc_graphic_properties_content
(
instStyle
);
style_table_cell_properties_attlist
cellFormats
=
calc_table_cell_properties
(
instStyle
);
int
dxfId
=
Context
.
get_style_manager
().
dxfId
(
&
textFormats
,
&
graphicFormats
,
&
cellFormats
);
Context
.
set_conditional_format_dxf
(
dxfId
);
}
Context
.
end_conditional_format_rule
();
}
// calcext_condition
//////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -189,6 +268,8 @@ void calcext_date_is::add_child_element( xml::sax * Reader, const ::std::wstring
}
void
calcext_date_is
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
//Context.start_conditional_format_rule(5);
//Context.end_conditional_format_rule();
}
}
...
...
ASCOfficeOdfFile/src/odf/calcext_elements.h
View file @
bff7e2cd
...
...
@@ -26,6 +26,8 @@ public:
_CP_OPT
(
odf_types
::
color
)
calcext_axis_color_
;
_CP_OPT
(
odf_types
::
color
)
calcext_positive_color_
;
_CP_OPT
(
odf_types
::
color
)
calcext_negative_color_
;
_CP_OPT
(
int
)
calcext_max_length_
;
_CP_OPT
(
int
)
calcext_min_length_
;
};
class
calcext_condition_attr
...
...
@@ -34,7 +36,7 @@ public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
_CP_OPT
(
std
::
wstring
)
calcext_base_cell_address_
;
_CP_OPT
(
odf_types
::
style_ref
)
calcext_apply_style_name_
;
_CP_OPT
(
std
::
wstring
)
calcext_apply_style_name_
;
_CP_OPT
(
std
::
wstring
)
calcext_value_
;
};
...
...
@@ -117,10 +119,9 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
_CP_OPT
(
bool
)
calcext_show_value_
;
calcext_icon_set_attr
calcext_icon_set_attr_
;
private:
office_element_ptr_array
content_
;
//entries
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
calcext_icon_set
);
...
...
@@ -140,10 +141,9 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
_CP_OPT
(
bool
)
calcext_show_value_
;
calcext_data_bar_attr
calcext_data_bar_attr_
;
private:
office_element_ptr_array
content_
;
//entries
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
calcext_data_bar
)
...
...
@@ -162,7 +162,6 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
private:
office_element_ptr_array
content_
;
//color_scale_entries
};
CP_REGISTER_OFFICE_ELEMENT2
(
calcext_color_scale
)
...
...
@@ -222,7 +221,6 @@ public:
_CP_OPT
(
std
::
wstring
)
calcext_target_range_address_
;
private:
office_element_ptr_array
content_
;
};
...
...
@@ -243,8 +241,6 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
private:
office_element_ptr_array
content_
;
};
...
...
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
View file @
bff7e2cd
...
...
@@ -311,7 +311,9 @@ void odf_document::Impl::parse_styles()
continue
;
}
context_
->
styleContainer
().
add_style
(
L"common:"
+
styleInst
->
style_name_
,
context_
->
styleContainer
().
add_style
(
L"common:"
+
styleInst
->
style_name_
,
styleInst
->
style_display_name_
.
get_value_or
(
L""
),
styleInst
->
style_family_
.
get_type
(),
&
(
styleInst
->
style_content_
),
true
,
...
...
@@ -384,6 +386,7 @@ void odf_document::Impl::parse_styles()
}
context_
->
styleContainer
().
add_style
(
L""
,
L""
,
styleInst
->
style_family_
.
get_type
(),
&
(
styleInst
->
style_content_
),
false
,
...
...
@@ -416,6 +419,7 @@ void odf_document::Impl::parse_styles()
context_
->
styleContainer
().
add_master_page_name
(
styleInst
->
style_name_
,
*
styleInst
->
style_master_page_name_
);
context_
->
styleContainer
().
add_style
(
styleInst
->
style_name_
,
styleInst
->
style_display_name_
.
get_value_or
(
L""
),
styleInst
->
style_family_
.
get_type
(),
&
(
styleInst
->
style_content_
),
false
,
...
...
@@ -547,6 +551,7 @@ void odf_document::Impl::parse_styles()
context_
->
styleContainer
().
add_master_page_name
(
styleInst
->
style_name_
,
*
styleInst
->
style_master_page_name_
);
context_
->
styleContainer
().
add_style
(
styleInst
->
style_name_
,
styleInst
->
style_display_name_
.
get_value_or
(
L""
),
styleInst
->
style_family_
.
get_type
(),
&
(
styleInst
->
style_content_
),
true
,
...
...
ASCOfficeOdfFile/src/odf/odfcontext.cpp
View file @
bff7e2cd
...
...
@@ -46,7 +46,8 @@ style_instance * styles_container::hyperlink_style()
return
NULL
;
}
void
styles_container
::
add_style
(
const
std
::
wstring
&
Name
,
void
styles_container
::
add_style
(
const
std
::
wstring
&
Name
,
const
std
::
wstring
&
DisplayName
,
style_family
::
type
Type
,
style_content
*
Content
,
bool
IsAutomatic
,
...
...
@@ -79,7 +80,12 @@ void styles_container::add_style(const std::wstring & Name,
//if ( boost::algorithm::contains(lName, L"internet_20_link") )
if
(
lName
==
L"internet_20_link"
)
///???????????????
hyperlink_style_pos_
=
pos
;
}
if
(
!
DisplayName
.
empty
())
{
std
::
wstring
n
=
DisplayName
+
L":"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
style_family
(
Type
)
);
map2_
[
n
]
=
pos
;
}
if
(
IsDefault
)
...
...
@@ -152,6 +158,7 @@ style_instance * styles_container::style_by_name(const std::wstring & Name, styl
std
::
wstring
n
=
L""
;
if
(
object_in_styles
)
n
=
L"common:"
;
n
=
n
+
Name
+
L":"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
style_family
(
Type
)
);
map_wstring_int_t
::
const_iterator
res
=
map_
.
find
(
n
);
if
(
res
!=
map_
.
end
())
...
...
@@ -162,7 +169,22 @@ style_instance * styles_container::style_by_name(const std::wstring & Name, styl
else
return
NULL
;
}
style_instance
*
styles_container
::
style_by_display_name
(
const
std
::
wstring
&
Name
,
style_family
::
type
Type
,
bool
object_in_styles
)
const
{
std
::
wstring
n
=
L""
;
if
(
object_in_styles
)
n
=
L"common:"
;
n
=
n
+
Name
+
L":"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
style_family
(
Type
)
);
map_wstring_int_t
::
const_iterator
res
=
map2_
.
find
(
n
);
if
(
res
!=
map2_
.
end
())
{
int
index
=
res
->
second
;
return
instances_
[
index
].
get
();
}
else
return
NULL
;
}
void
styles_container
::
add_master_page_name
(
const
std
::
wstring
&
StyleName
,
const
std
::
wstring
&
MasterPageName
)
{
master_page_name_
[
StyleName
]
=
MasterPageName
;
...
...
ASCOfficeOdfFile/src/odf/odfcontext.h
View file @
bff7e2cd
...
...
@@ -106,7 +106,8 @@ public:
typedef
std
::
vector
<
style_instance_ptr
>
instances_array
;
void
add_style
(
const
std
::
wstring
&
Name
,
void
add_style
(
const
std
::
wstring
&
Name
,
const
std
::
wstring
&
DisplayName
,
odf_types
::
style_family
::
type
Type
,
style_content
*
Content
,
bool
IsAutomatic
,
...
...
@@ -118,8 +119,11 @@ public:
void
add_master_page_name
(
const
std
::
wstring
&
StyleName
,
const
std
::
wstring
&
MasterPageName
);
style_instance
*
hyperlink_style
();
style_instance
*
style_by_name
(
const
std
::
wstring
&
Name
,
odf_types
::
style_family
::
type
Type
,
bool
object_in_styles
)
const
;
style_instance
*
style_default_by_type
(
odf_types
::
style_family
::
type
Type
)
const
;
style_instance
*
style_by_name
(
const
std
::
wstring
&
Name
,
odf_types
::
style_family
::
type
Type
,
bool
object_in_styles
)
const
;
style_instance
*
style_by_display_name
(
const
std
::
wstring
&
Name
,
odf_types
::
style_family
::
type
Type
,
bool
object_in_styles
)
const
;
style_instance
*
style_default_by_type
(
odf_types
::
style_family
::
type
Type
)
const
;
const
std
::
wstring
master_page_name_by_name
(
const
std
::
wstring
&
StyleName
)
const
;
...
...
@@ -135,13 +139,16 @@ private:
instances_array
instances_
;
typedef
boost
::
unordered_map
<
std
::
wstring
,
int
>
map_wstring_int_t
;
map_wstring_int_t
map_
;
map_wstring_int_t
map_
;
//by style name
map_wstring_int_t
map2_
;
//by style display name
typedef
boost
::
unordered_map
<
std
::
wstring
,
std
::
wstring
>
map_wstring_wstring
;
map_wstring_wstring
master_page_name_
;
typedef
boost
::
unordered_map
<
odf_types
::
style_family
::
type
,
int
>
map_style_family_int
;
map_style_family_int
default_map_
;
int
hyperlink_style_pos_
;
};
...
...
ASCOfficeOdfFile/src/odf/style_paragraph_properties.h
View file @
bff7e2cd
...
...
@@ -5,7 +5,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/CPOptional.h>
#include "office_elements.h"
#include "office_elements_create.h"
...
...
@@ -34,14 +33,9 @@
#include "datatypes/styleposition.h"
#include "datatypes/borderwidths.h"
//#include "common_draw_data.h"
#include "office_binary_data.h"
#include "datatypes/common_attlists.h"
//#include "office_elements.h"
//#include "office_elements_create.h"
namespace
cpdoccore
{
namespace
oox
{
...
...
ASCOfficeOdfFile/win32/cpodf.vcproj
View file @
bff7e2cd
This diff is collapsed.
Click to expand it.
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