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
9db24f8e
Commit
9db24f8e
authored
May 02, 2016
by
ElenaSubbotina
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - конвертация стилевых настроек математических формул
parent
62e0c06c
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
554 additions
and
105 deletions
+554
-105
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
+12
-12
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
+5
-5
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
+5
-0
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
+3
-0
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
+34
-6
ASCOfficeOdfFile/src/odf/chart_build_oox.h
ASCOfficeOdfFile/src/odf/chart_build_oox.h
+18
-18
ASCOfficeOdfFile/src/odf/datatypes/color.cpp
ASCOfficeOdfFile/src/odf/datatypes/color.cpp
+24
-0
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.cpp
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.cpp
+16
-0
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.h
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.h
+15
-0
ASCOfficeOdfFile/src/odf/datatypes/mathvariant.cpp
ASCOfficeOdfFile/src/odf/datatypes/mathvariant.cpp
+146
-0
ASCOfficeOdfFile/src/odf/datatypes/mathvariant.h
ASCOfficeOdfFile/src/odf/datatypes/mathvariant.h
+42
-0
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+1
-1
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
+1
-1
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
+1
-1
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
+77
-7
ASCOfficeOdfFile/src/odf/math_layout_elements.h
ASCOfficeOdfFile/src/odf/math_layout_elements.h
+4
-0
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
+61
-25
ASCOfficeOdfFile/src/odf/math_token_elements.h
ASCOfficeOdfFile/src/odf/math_token_elements.h
+26
-10
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
+34
-1
ASCOfficeOdfFile/src/odf/odf_document_impl.h
ASCOfficeOdfFile/src/odf/odf_document_impl.h
+3
-1
ASCOfficeOdfFile/src/odf/odfcontext.h
ASCOfficeOdfFile/src/odf/odfcontext.h
+3
-0
ASCOfficeOdfFile/src/odf/office_settings.cpp
ASCOfficeOdfFile/src/odf/office_settings.cpp
+4
-1
ASCOfficeOdfFile/src/odf/office_settings.h
ASCOfficeOdfFile/src/odf/office_settings.h
+11
-16
ASCOfficeOdfFile/win32/cpcommon.vcproj
ASCOfficeOdfFile/win32/cpcommon.vcproj
+8
-0
No files found.
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
View file @
9db24f8e
...
@@ -108,7 +108,7 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
...
@@ -108,7 +108,7 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
get_styles_context
().
docx_serialize_text_style
(
output_stream
(),
parenStyleId
);
get_styles_context
().
docx_serialize_text_style
(
output_stream
(),
parenStyleId
);
}
}
}
}
}
}
void
docx_conversion_context
::
start_paragraph
()
void
docx_conversion_context
::
start_paragraph
()
...
...
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
View file @
9db24f8e
...
@@ -430,9 +430,9 @@ public:
...
@@ -430,9 +430,9 @@ public:
std
::
wstring
add_mediaitem
(
const
std
::
wstring
&
uri
,
mediaitems
::
Type
type
,
bool
&
isInternal
,
std
::
wstring
&
ref
);
std
::
wstring
add_mediaitem
(
const
std
::
wstring
&
uri
,
mediaitems
::
Type
type
,
bool
&
isInternal
,
std
::
wstring
&
ref
);
void
dump_mediaitems
(
rels
&
Rels
);
void
dump_mediaitems
(
rels
&
Rels
);
void
dump_headers_footers
(
rels
&
Rels
)
const
;
void
dump_headers_footers
(
rels
&
Rels
)
const
;
void
dump_notes
(
rels
&
Rels
)
const
;
void
dump_notes
(
rels
&
Rels
)
const
;
bool
next_dump_page_properties_
;
bool
next_dump_page_properties_
;
bool
next_dump_section_
;
bool
next_dump_section_
;
...
...
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
View file @
9db24f8e
...
@@ -47,6 +47,11 @@ std::wstringstream & styles_context::text_style()
...
@@ -47,6 +47,11 @@ std::wstringstream & styles_context::text_style()
return
text_style_
;
return
text_style_
;
}
}
std
::
wstringstream
&
styles_context
::
math_text_style
()
{
return
math_text_style_
;
}
std
::
wstringstream
&
styles_context
::
paragraph_nodes
()
std
::
wstringstream
&
styles_context
::
paragraph_nodes
()
{
{
return
paragraph_nodes_
;
return
paragraph_nodes_
;
...
...
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
View file @
9db24f8e
...
@@ -23,6 +23,7 @@ public:
...
@@ -23,6 +23,7 @@ public:
std
::
wstringstream
&
paragraph_attr
();
std
::
wstringstream
&
paragraph_attr
();
std
::
wstringstream
&
table_style
();
std
::
wstringstream
&
table_style
();
std
::
wstringstream
&
list_style
();
std
::
wstringstream
&
list_style
();
std
::
wstringstream
&
math_text_style
();
void
docx_serialize_text_style
(
std
::
wostream
&
strm
,
std
::
wstring
parenStyleId
);
void
docx_serialize_text_style
(
std
::
wostream
&
strm
,
std
::
wstring
parenStyleId
);
void
docx_serialize_table_style
(
std
::
wostream
&
strm
);
void
docx_serialize_table_style
(
std
::
wostream
&
strm
);
...
@@ -38,6 +39,7 @@ public:
...
@@ -38,6 +39,7 @@ public:
private:
private:
const
odf_reader
::
style_instance
*
current_processed_style_
;
const
odf_reader
::
style_instance
*
current_processed_style_
;
std
::
wstring
extern_node_
;
std
::
wstring
extern_node_
;
std
::
wstring
hlinkClick_
;
std
::
wstring
hlinkClick_
;
...
@@ -46,6 +48,7 @@ private:
...
@@ -46,6 +48,7 @@ private:
std
::
wstringstream
paragraph_nodes_
;
std
::
wstringstream
paragraph_nodes_
;
std
::
wstringstream
paragraph_attr_
;
std
::
wstringstream
paragraph_attr_
;
std
::
wstringstream
table_style_
;
std
::
wstringstream
table_style_
;
std
::
wstringstream
math_text_style_
;
};
};
...
...
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
View file @
9db24f8e
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#include "style_chart_properties.h"
#include "style_chart_properties.h"
#include "style_text_properties.h"
#include "style_text_properties.h"
#include "o
dfcontext
.h"
#include "o
ffice_settings
.h"
#include "draw_common.h"
#include "draw_common.h"
...
@@ -174,20 +174,27 @@ void chart_build::docx_convert(oox::docx_conversion_context & Context)
...
@@ -174,20 +174,27 @@ void chart_build::docx_convert(oox::docx_conversion_context & Context)
std
::
wstringstream
temp_stream
(
Context
.
get_drawing_context
().
get_text_stream_frame
());
std
::
wstringstream
temp_stream
(
Context
.
get_drawing_context
().
get_text_stream_frame
());
Context
.
set_stream_man
(
boost
::
shared_ptr
<
oox
::
streams_man
>
(
new
oox
::
streams_man
(
temp_stream
)
));
Context
.
set_stream_man
(
boost
::
shared_ptr
<
oox
::
streams_man
>
(
new
oox
::
streams_man
(
temp_stream
)
));
bool
runState
=
Context
.
get_run_state
();
bool
runState
=
Context
.
get_run_state
();
Context
.
set_run_state
(
false
);
Context
.
set_run_state
(
false
);
bool
pState
=
Context
.
get_paragraph_state
();
bool
pState
=
Context
.
get_paragraph_state
();
Context
.
set_paragraph_state
(
false
);
Context
.
set_paragraph_state
(
false
);
bool
graphic_parent
=
false
;
style_text_properties
textProperty
;
textProperty
.
content
().
style_font_name_
=
L"Cambria Math"
;
textProperty
.
content
().
fo_font_size_
=
odf_types
::
length
(
baseFontHeight_
,
odf_types
::
length
::
pt
);
Context
.
push_text_properties
(
&
textProperty
);
office_math_
->
docx_convert
(
Context
);
office_math_
->
docx_convert
(
Context
);
Context
.
pop_text_properties
();
Context
.
get_drawing_context
().
get_text_stream_frame
()
=
temp_stream
.
str
();
Context
.
get_drawing_context
().
get_text_stream_frame
()
=
temp_stream
.
str
();
Context
.
set_stream_man
(
prev
);
Context
.
set_run_state
(
runState
);
Context
.
set_stream_man
(
prev
);
Context
.
set_paragraph_state
(
pState
);
Context
.
set_run_state
(
runState
);
Context
.
set_paragraph_state
(
pState
);
}
}
}
}
void
chart_build
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
void
chart_build
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
...
@@ -364,6 +371,27 @@ void chart_build::oox_convert(oox::oox_chart_context & chart)
...
@@ -364,6 +371,27 @@ void chart_build::oox_convert(oox::oox_chart_context & chart)
chart
.
set_content_axis
(
a
);
chart
.
set_content_axis
(
a
);
}
}
}
}
//----------------------------------------------------------------------------------------
process_build_chart
::
process_build_chart
(
chart_build
&
chartBuild
,
odf_read_context
&
context
)
:
stop_
(
false
)
,
chart_build_
(
chartBuild
)
,
styles_
(
context
.
styleContainer
())
,
settings_
(
context
.
Settings
())
,
draw_styles_
(
context
.
drawStyles
())
{
office_element_ptr
sett_elm
=
settings_
.
find_by_style_name
(
L"BaseFontHeight"
);
settings_config_item
*
sett
=
dynamic_cast
<
settings_config_item
*>
(
sett_elm
.
get
());
if
(
sett
)
{
try
{
chart_build_
.
baseFontHeight_
=
boost
::
lexical_cast
<
int
>
(
sett
->
content_
);
}
catch
(...)
{
}
}
}
void
process_build_chart
::
ApplyChartProperties
(
std
::
wstring
style
,
std
::
vector
<
_property
>
&
propertiesOut
)
void
process_build_chart
::
ApplyChartProperties
(
std
::
wstring
style
,
std
::
vector
<
_property
>
&
propertiesOut
)
{
{
style_instance
*
styleInst
=
styles_
.
style_by_name
(
style
,
odf_types
::
style_family
::
Chart
,
false
);
style_instance
*
styleInst
=
styles_
.
style_by_name
(
style
,
odf_types
::
style_family
::
Chart
,
false
);
...
...
ASCOfficeOdfFile/src/odf/chart_build_oox.h
View file @
9db24f8e
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "office_text.h"
#include "office_text.h"
#include "math_elements.h"
#include "math_elements.h"
#include "table.h"
#include "table.h"
#include "odfcontext.h"
namespace
cpdoccore
{
namespace
cpdoccore
{
...
@@ -82,7 +83,8 @@ public:
...
@@ -82,7 +83,8 @@ public:
columns_count_
(
0
),
columns_count_
(
0
),
object_type_
(
0
),
object_type_
(
0
),
office_text_
(
NULL
),
office_text_
(
NULL
),
office_math_
(
NULL
)
office_math_
(
NULL
),
baseFontHeight_
(
12
)
{
{
}
}
...
@@ -123,6 +125,9 @@ public:
...
@@ -123,6 +125,9 @@ public:
office_text
*
office_text_
;
office_text
*
office_text_
;
office_math
*
office_math_
;
office_math
*
office_math_
;
int
baseFontHeight_
;
//---------------------------------------------------------------
std
::
wstring
str_class_
;
std
::
wstring
str_class_
;
chart
::
class_type
class_
;
chart
::
class_type
class_
;
std
::
wstring
style_name_
;
std
::
wstring
style_name_
;
...
@@ -140,7 +145,6 @@ public:
...
@@ -140,7 +145,6 @@ public:
chart
::
title
sub_title_
;
chart
::
title
sub_title_
;
chart
::
simple
legend_
;
chart
::
simple
legend_
;
chart
::
plot_area
plot_area_
;
chart
::
plot_area
plot_area_
;
chart
::
simple
wall_
;
chart
::
simple
wall_
;
...
@@ -226,13 +230,7 @@ class process_build_chart : public base_visitor,
...
@@ -226,13 +230,7 @@ class process_build_chart : public base_visitor,
{
{
public:
public:
process_build_chart
(
chart_build
&
chartBuild
,
styles_container
&
styles
,
styles_lite_container
&
draw_styles
)
:
process_build_chart
(
chart_build
&
chartBuild
,
odf_read_context
&
context
);
stop_
(
false
)
,
chart_build_
(
chartBuild
)
,
styles_
(
styles
)
,
draw_styles_
(
draw_styles
)
{
}
private:
private:
void
ApplyChartProperties
(
std
::
wstring
style
,
std
::
vector
<
_property
>
&
propertiesOut
);
void
ApplyChartProperties
(
std
::
wstring
style
,
std
::
vector
<
_property
>
&
propertiesOut
);
...
@@ -297,7 +295,9 @@ private:
...
@@ -297,7 +295,9 @@ private:
bool
stop_
;
bool
stop_
;
chart_build
&
chart_build_
;
chart_build
&
chart_build_
;
styles_container
&
styles_
;
styles_container
&
styles_
;
styles_lite_container
&
settings_
;
styles_lite_container
&
draw_styles_
;
styles_lite_container
&
draw_styles_
;
...
...
ASCOfficeOdfFile/src/odf/datatypes/color.cpp
View file @
9db24f8e
...
@@ -19,8 +19,32 @@ bool operator== (const color & c1, const color & c2)
...
@@ -19,8 +19,32 @@ bool operator== (const color & c1, const color & c2)
if
(
c1
.
get_hex_value
()
==
c2
.
get_hex_value
())
return
true
;
if
(
c1
.
get_hex_value
()
==
c2
.
get_hex_value
())
return
true
;
else
return
false
;
else
return
false
;
}
}
std
::
wstring
html4_colors
[
16
][
2
]
=
{
{
L"aqua"
,
L"#00ffff"
},
{
L"black"
,
L"#000000"
},
{
L"blue"
,
L"#0000ff"
},
{
L"fuchsia"
,
L"#ff00ff"
},
{
L"gray"
,
L"#808080"
},
{
L"green"
,
L"#008000"
},
{
L"lime"
,
L"#00ff00"
},
{
L"maroon"
,
L"#800000"
},
{
L"navy"
,
L"#000080"
},
{
L"olive"
,
L"#808000"
},
{
L"purple"
,
L"#800080"
},
{
L"red"
,
L"#ff0000"
},
{
L"silver"
,
L"#c0c0c0"
},
{
L"teal"
,
L"#008080"
},
{
L"white"
,
L"#FFFFFF"
},
{
L"yellow"
,
L"#ffff00"
}
};
color
color
::
parse
(
const
std
::
wstring
&
Str
)
color
color
::
parse
(
const
std
::
wstring
&
Str
)
{
{
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
if
(
Str
==
html4_colors
[
i
][
0
])
return
color
(
html4_colors
[
i
][
1
]);
}
return
color
(
Str
);
return
color
(
Str
);
}
}
...
...
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.cpp
View file @
9db24f8e
...
@@ -175,6 +175,22 @@ void common_margin_attlist::apply_from(const common_margin_attlist & Other)
...
@@ -175,6 +175,22 @@ void common_margin_attlist::apply_from(const common_margin_attlist & Other)
// TODO
// TODO
_CP_APPLY_PROP
(
fo_margin_
,
Other
.
fo_margin_
);
_CP_APPLY_PROP
(
fo_margin_
,
Other
.
fo_margin_
);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
void
common_math_style_attlist
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"math:mathvariant"
,
mathvariant_
);
if
(
!
mathvariant_
)
CP_APPLY_ATTR
(
L"mathvariant"
,
mathvariant_
);
}
void
common_math_style_attlist
::
serialize
(
CP_ATTR_NODE
)
{
CP_XML_ATTR_OPT
(
L"mathvariant"
,
mathvariant_
);
}
void
common_math_style_attlist
::
apply_from
(
const
common_math_style_attlist
&
Other
)
{
// TODO
_CP_APPLY_PROP
(
mathvariant_
,
Other
.
mathvariant_
);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
void
common_break_attlist
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
common_break_attlist
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
...
...
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.h
View file @
9db24f8e
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include "officevaluetype.h"
#include "officevaluetype.h"
#include "fillimagerefpoint.h"
#include "fillimagerefpoint.h"
#include "borderstyle.h"
#include "borderstyle.h"
#include "mathvariant.h"
#define _CP_APPLY_PROP(A, B) \
#define _CP_APPLY_PROP(A, B) \
if
(
B
)
\
if
(
B
)
\
...
@@ -117,6 +118,20 @@ public:
...
@@ -117,6 +118,20 @@ public:
friend
class
style_page_layout_properties_attlist
;
friend
class
style_page_layout_properties_attlist
;
};
};
// common-math_style_attlist
class
common_math_style_attlist
{
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
void
apply_from
(
const
common_math_style_attlist
&
Other
);
void
serialize
(
CP_ATTR_NODE
);
public:
_CP_OPT
(
math_variant
)
mathvariant_
;
};
// common-break-attlist
// common-break-attlist
class
common_break_attlist
class
common_break_attlist
{
{
...
...
ASCOfficeOdfFile/src/odf/datatypes/mathvariant.cpp
0 → 100644
View file @
9db24f8e
#include <boost/algorithm/string.hpp>
#include "mathvariant.h"
#include <vector>
namespace
cpdoccore
{
namespace
odf_types
{
std
::
wostream
&
operator
<<
(
std
::
wostream
&
_Wostream
,
const
math_variant
&
math_variant_
)
{
if
(
math_variant_
.
is_none
())
{
return
_Wostream
;
}
//.....
return
_Wostream
;
}
bool
operator
==
(
math_variant
&
_b1
,
math_variant
&
_b2
)
{
if
(
_b1
.
is_none
()
&&
_b2
.
is_none
())
return
true
;
if
(
_b1
.
is_none
()
||
_b2
.
is_none
())
return
false
;
if
(
_b1
.
style_
.
bold
==
_b2
.
style_
.
bold
&&
_b1
.
style_
.
italic
==
_b2
.
style_
.
italic
&&
_b1
.
style_
.
type
==
_b2
.
style_
.
type
)
return
true
;
return
false
;
}
math_variant
::
math_variant
(
const
math_variant
&
Value
)
{
style_
=
Value
.
style_
;
none_
=
Value
.
is_none
();
}
math_variant
&
math_variant
::
operator
=
(
const
math_variant
&
Value
)
{
style_
=
Value
.
style_
;
none_
=
Value
.
is_none
();
return
*
this
;
}
math_variant
::
math_variant
(
const
std
::
wstring
&
Value
)
:
none_
(
true
)
{
std
::
wstring
tmp
=
boost
::
algorithm
::
trim_copy
(
Value
);
if
(
tmp
.
length
()
<
1
)
return
;
boost
::
algorithm
::
to_lower
(
tmp
);
std
::
vector
<
std
::
wstring
>
splitted
;
boost
::
algorithm
::
split
(
splitted
,
Value
,
boost
::
algorithm
::
is_any_of
(
L"
\t
"
),
boost
::
algorithm
::
token_compress_on
);
for
(
int
i
=
0
;
i
<
splitted
.
size
();
i
++
)
{
if
(
splitted
[
i
]
==
L"bold"
)
{
style_
.
bold
=
true
;
}
else
if
(
splitted
[
i
]
==
L"italic"
)
{
style_
.
italic
=
true
;
}
else
if
(
splitted
[
i
]
==
L"bold-italic"
)
{
style_
.
bold
=
true
;
style_
.
italic
=
true
;
}
else
if
(
splitted
[
i
]
==
L"double-struck"
)
{
style_
.
type
=
1
;
}
else
if
(
splitted
[
i
]
==
L"bold-fraktur"
)
{
style_
.
type
=
2
;
style_
.
bold
=
true
;
}
else
if
(
splitted
[
i
]
==
L"fraktur"
)
{
style_
.
type
=
2
;
}
else
if
(
splitted
[
i
]
==
L"script"
)
{
style_
.
type
=
3
;
}
else
if
(
splitted
[
i
]
==
L"bold-script"
)
{
style_
.
type
=
3
;
style_
.
bold
=
true
;
}
else
if
(
splitted
[
i
]
==
L"sans-serif-italic"
)
{
style_
.
type
=
4
;
style_
.
italic
=
true
;
}
else
if
(
splitted
[
i
]
==
L"bold-sans-serif"
)
{
style_
.
type
=
4
;
style_
.
bold
=
true
;
}
else
if
(
splitted
[
i
]
==
L"sans-serif-bold-italic"
)
{
style_
.
type
=
4
;
style_
.
italic
=
true
;
style_
.
bold
=
true
;
}
else
if
(
splitted
[
i
]
==
L"monospace"
)
{
style_
.
type
=
5
;
}
else
if
(
splitted
[
i
]
==
L"stretched"
)
{
//style_.stretched = true;
}
else
if
(
splitted
[
i
]
==
L"tailed"
)
{
//style_.type = 7;
}
else
if
(
splitted
[
i
]
==
L"looped"
)
{
//style_.type = 8;
}
else
if
(
splitted
[
i
]
==
L"initial"
)
{
//style_.type = 9;
}
}
none_
=
false
;
}
math_variant
math_variant
::
parse
(
const
std
::
wstring
&
Value
)
{
return
math_variant
(
Value
);
}
}
}
ASCOfficeOdfFile/src/odf/datatypes/mathvariant.h
0 → 100644
View file @
9db24f8e
#pragma once
#include <string>
#include <cpdoccore/CPOptional.h>
#include "odfattributes.h"
namespace
cpdoccore
{
namespace
odf_types
{
class
math_variant
{
public:
math_variant
(){}
math_variant
(
const
std
::
wstring
&
Value
);
math_variant
(
const
math_variant
&
Value
);
static
math_variant
parse
(
const
std
::
wstring
&
Str
);
math_variant
&
operator
=
(
const
math_variant
&
d
);
bool
is_none
()
const
{
return
none_
;
}
struct
_style
{
_style
()
:
italic
(
false
),
bold
(
false
),
type
(
0
)
{}
bool
italic
;
bool
bold
;
int
type
;
}
style_
;
private:
bool
none_
;
};
std
::
wostream
&
operator
<<
(
std
::
wostream
&
_Wostream
,
const
math_variant
&
_Val
);
bool
operator
==
(
math_variant
&
_b1
,
math_variant
&
_b2
);
}
APPLY_PARSE_XML_ATTRIBUTES
(
odf_types
::
math_variant
);
}
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
9db24f8e
...
@@ -1251,7 +1251,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
...
@@ -1251,7 +1251,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
if
(
contentSubDoc
)
//Diagramma.odt -
if
(
contentSubDoc
)
//Diagramma.odt -
{
{
process_build_chart
process_build_object_
(
objectBuild
,
objectSubDoc
.
odf_context
()
.
styleContainer
(),
objectSubDoc
.
odf_context
().
drawStyles
()
);
process_build_chart
process_build_object_
(
objectBuild
,
objectSubDoc
.
odf_context
());
contentSubDoc
->
accept
(
process_build_object_
);
contentSubDoc
->
accept
(
process_build_object_
);
objectBuild
.
docx_convert
(
Context
);
objectBuild
.
docx_convert
(
Context
);
...
...
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
View file @
9db24f8e
...
@@ -272,7 +272,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
...
@@ -272,7 +272,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
chart_build
objectBuild
;
chart_build
objectBuild
;
process_build_chart
process_build_object_
(
objectBuild
,
objectSubDoc
.
odf_context
()
.
styleContainer
(),
objectSubDoc
.
odf_context
().
drawStyles
()
);
process_build_chart
process_build_object_
(
objectBuild
,
objectSubDoc
.
odf_context
());
contentSubDoc
->
accept
(
process_build_object_
);
contentSubDoc
->
accept
(
process_build_object_
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
View file @
9db24f8e
...
@@ -232,7 +232,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
...
@@ -232,7 +232,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
if
(
contentSubDoc
)
if
(
contentSubDoc
)
{
{
process_build_chart
process_build_object_
(
objectBuild
,
objectSubDoc
.
odf_context
()
.
styleContainer
(),
objectSubDoc
.
odf_context
().
drawStyles
()
);
process_build_chart
process_build_object_
(
objectBuild
,
objectSubDoc
.
odf_context
());
contentSubDoc
->
accept
(
process_build_object_
);
contentSubDoc
->
accept
(
process_build_object_
);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
View file @
9db24f8e
#include "math_layout_elements.h"
#include "math_layout_elements.h"
#include "math_token_elements.h"
#include "math_token_elements.h"
#include "style_text_properties.h"
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>
...
@@ -82,6 +83,7 @@ void math_mrow::docx_convert(oox::docx_conversion_context & Context)
...
@@ -82,6 +83,7 @@ void math_mrow::docx_convert(oox::docx_conversion_context & Context)
mo_test_last
->
text_to_stream
(
Context
.
output_stream
());
mo_test_last
->
text_to_stream
(
Context
.
output_stream
());
Context
.
output_stream
()
<<
L"
\"
/>"
;
Context
.
output_stream
()
<<
L"
\"
/>"
;
}
}
Context
.
output_stream
()
<<
Context
.
get_styles_context
().
math_text_style
().
str
();
Context
.
output_stream
()
<<
L"</m:dPr>"
;
Context
.
output_stream
()
<<
L"</m:dPr>"
;
Context
.
output_stream
()
<<
L"<m:e>"
;
Context
.
output_stream
()
<<
L"<m:e>"
;
}
}
...
@@ -149,6 +151,7 @@ void math_msqrt::docx_convert(oox::docx_conversion_context & Context)
...
@@ -149,6 +151,7 @@ void math_msqrt::docx_convert(oox::docx_conversion_context & Context)
strm
<<
L"<m:rad>"
;
strm
<<
L"<m:rad>"
;
strm
<<
L"<m:radPr>"
;
strm
<<
L"<m:radPr>"
;
strm
<<
L"<m:degHide m:val=
\"
1
\"
/>"
;
strm
<<
L"<m:degHide m:val=
\"
1
\"
/>"
;
strm
<<
Context
.
get_styles_context
().
math_text_style
().
str
();
strm
<<
L"</m:radPr>"
;
strm
<<
L"</m:radPr>"
;
strm
<<
L"<m:deg/>"
;
strm
<<
L"<m:deg/>"
;
...
@@ -181,7 +184,9 @@ void math_mroot::docx_convert(oox::docx_conversion_context & Context)
...
@@ -181,7 +184,9 @@ void math_mroot::docx_convert(oox::docx_conversion_context & Context)
strm
<<
L"<m:rad>"
;
strm
<<
L"<m:rad>"
;
strm
<<
L"<m:radPr/>"
;
strm
<<
L"<m:radPr>"
;
strm
<<
Context
.
get_styles_context
().
math_text_style
().
str
();
strm
<<
L"</m:radPr>"
;
strm
<<
L"<m:deg>"
;
strm
<<
L"<m:deg>"
;
content_
[
1
]
->
docx_convert
(
Context
);
content_
[
1
]
->
docx_convert
(
Context
);
...
@@ -199,11 +204,16 @@ const wchar_t * math_mstyle::name = L"mstyle";
...
@@ -199,11 +204,16 @@ const wchar_t * math_mstyle::name = L"mstyle";
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
void
math_mstyle
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
math_mstyle
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
common_attlist_
.
add_attributes
(
Attributes
);
// ver 2
// ver 2
CP_APPLY_ATTR
(
L"math:fontweight"
,
fontweight_
);
CP_APPLY_ATTR
(
L"math:fontweight"
,
fontweight_
);
CP_APPLY_ATTR
(
L"math:mathsize"
,
mathsize_
);
CP_APPLY_ATTR
(
L"math:color"
,
color_
);
// ver 3
// ver 3
if
(
!
fontweight_
)
CP_APPLY_ATTR
(
L"fontweight"
,
fontweight_
);
if
(
!
fontweight_
)
CP_APPLY_ATTR
(
L"fontweight"
,
fontweight_
);
if
(
!
mathsize_
)
CP_APPLY_ATTR
(
L"mathsize"
,
mathsize_
);
if
(
!
color_
)
CP_APPLY_ATTR
(
L"color"
,
color_
);
}
}
void
math_mstyle
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
void
math_mstyle
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
...
@@ -213,10 +223,70 @@ void math_mstyle::add_child_element( xml::sax * Reader, const ::std::wstring & N
...
@@ -213,10 +223,70 @@ void math_mstyle::add_child_element( xml::sax * Reader, const ::std::wstring & N
void
math_mstyle
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
void
math_mstyle
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
{
style_text_properties
textProperty
;
if
(
mathsize_
)
textProperty
.
content
().
fo_font_size_
=
mathsize_
;
if
(
color_
)
textProperty
.
content
().
fo_color_
=
color_
;
if
(
common_attlist_
.
mathvariant_
)
{
if
(
common_attlist_
.
mathvariant_
->
style_
.
bold
)
textProperty
.
content
().
fo_font_weight_
=
odf_types
::
font_weight
(
odf_types
::
font_weight
::
WBold
);
if
(
common_attlist_
.
mathvariant_
->
style_
.
italic
)
textProperty
.
content
().
fo_font_style_
=
odf_types
::
font_style
(
odf_types
::
font_style
::
Italic
);
}
Context
.
push_text_properties
(
&
textProperty
);
//--------------------------------------------------
{
std
::
wstringstream
&
strm
=
Context
.
get_styles_context
().
math_text_style
();
strm
.
str
(
std
::
wstring
()
);
strm
.
clear
();
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"m:ctrlPr"
)
{
Context
.
get_styles_context
().
start
();
Context
.
current_text_properties
()
->
docx_convert
(
Context
);
CP_XML_NODE
(
L"w:rPr"
)
{
CP_XML_STREAM
()
<<
Context
.
get_styles_context
().
text_style
().
str
();
}
}
}
}
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
{
elm
->
docx_convert
(
Context
);
elm
->
docx_convert
(
Context
);
}
}
Context
.
pop_text_properties
();
// reset style ... todooo ..
{
std
::
wstringstream
&
strm
=
Context
.
get_styles_context
().
math_text_style
();
strm
.
str
(
std
::
wstring
()
);
strm
.
clear
();
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"m:ctrlPr"
)
{
Context
.
get_styles_context
().
start
();
Context
.
current_text_properties
()
->
docx_convert
(
Context
);
CP_XML_NODE
(
L"w:rPr"
)
{
CP_XML_STREAM
()
<<
Context
.
get_styles_context
().
text_style
().
str
();
}
}
}
}
}
}
//---------------------------------------------------------------
//---------------------------------------------------------------
const
wchar_t
*
math_menclose
::
ns
=
L"math"
;
const
wchar_t
*
math_menclose
::
ns
=
L"math"
;
...
...
ASCOfficeOdfFile/src/odf/math_layout_elements.h
View file @
9db24f8e
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include "datatypes/common_attlists.h"
#include "datatypes/common_attlists.h"
#include "datatypes/fontstyle.h"
#include "datatypes/fontstyle.h"
#include "datatypes/fontweight.h"
#include "datatypes/fontweight.h"
#include "datatypes/fontsize.h"
namespace
cpdoccore
{
namespace
cpdoccore
{
...
@@ -140,6 +141,9 @@ private:
...
@@ -140,6 +141,9 @@ private:
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
common_math_style_attlist
common_attlist_
;
_CP_OPT
(
font_size
)
mathsize_
;
_CP_OPT
(
color
)
color_
;
_CP_OPT
(
font_weight
)
fontweight_
;
_CP_OPT
(
font_weight
)
fontweight_
;
};
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mstyle
);
CP_REGISTER_OFFICE_ELEMENT2
(
math_mstyle
);
...
...
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
View file @
9db24f8e
#include "math_token_elements.h"
#include "math_token_elements.h"
#include "style_text_properties.h"
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/simple_xml_writer.h>
...
@@ -20,7 +23,7 @@ const wchar_t * math_mi::name = L"mi";
...
@@ -20,7 +23,7 @@ const wchar_t * math_mi::name = L"mi";
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
void
math_mi
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
math_mi
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
common_attlist_
.
add_attributes
(
Attributes
);
}
}
void
math_mi
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
void
math_mi
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
...
@@ -44,20 +47,52 @@ void math_mi::docx_convert(oox::docx_conversion_context & Context)
...
@@ -44,20 +47,52 @@ void math_mi::docx_convert(oox::docx_conversion_context & Context)
{
{
if
(
!
text_
)
return
;
if
(
!
text_
)
return
;
std
::
wostream
&
strm
=
Context
.
output_stream
();
CP_XML_WRITER
(
strm
)
CP_XML_WRITER
(
Context
.
output_stream
()
)
{
{
CP_XML_NODE
(
L"m:r"
)
CP_XML_NODE
(
L"m:r"
)
{
{
CP_XML_NODE
(
L"w:rPr"
)
Context
.
get_styles_context
().
start
();
Context
.
current_text_properties
()
->
docx_convert
(
Context
);
if
(
common_attlist_
.
mathvariant_
)
{
std
::
wstring
m_sty_val
;
if
(
common_attlist_
.
mathvariant_
->
style_
.
bold
)
m_sty_val
+=
L"b"
;
if
(
common_attlist_
.
mathvariant_
->
style_
.
italic
)
m_sty_val
+=
L"i"
;
CP_XML_NODE
(
L"m:rPr"
)
{
if
(
!
m_sty_val
.
empty
())
{
{
CP_XML_NODE
(
L"w:rFonts
"
)
CP_XML_NODE
(
L"m:sty
"
)
{
{
CP_XML_ATTR
(
L"w:hAnsi"
,
L"Cambria Math"
);
CP_XML_ATTR
(
L"m:val"
,
m_sty_val
);
CP_XML_ATTR
(
L"w:ascii"
,
L"Cambria Math"
);
}
}
if
(
common_attlist_
.
mathvariant_
->
style_
.
type
>
0
)
{
CP_XML_NODE
(
L"m:scr"
)
{
switch
(
common_attlist_
.
mathvariant_
->
style_
.
type
)
{
case
1
:
CP_XML_ATTR
(
L"m:val"
,
L"double-struck"
);
break
;
case
2
:
CP_XML_ATTR
(
L"m:val"
,
L"fraktur"
);
break
;
case
3
:
CP_XML_ATTR
(
L"m:val"
,
L"script"
);
break
;
case
4
:
CP_XML_ATTR
(
L"m:val"
,
L"sans-serif"
);
break
;
case
5
:
CP_XML_ATTR
(
L"m:val"
,
L"monospace"
);
break
;
}
}
}
}
}
}
}
CP_XML_NODE
(
L"w:rPr"
)
{
CP_XML_STREAM
()
<<
Context
.
get_styles_context
().
text_style
().
str
();
}
CP_XML_NODE
(
L"m:t"
)
CP_XML_NODE
(
L"m:t"
)
{
{
//CP_XML_ATTR(L"xml:space", L"preserve");
//CP_XML_ATTR(L"xml:space", L"preserve");
...
@@ -72,6 +107,7 @@ const wchar_t * math_mo::name = L"mo";
...
@@ -72,6 +107,7 @@ const wchar_t * math_mo::name = L"mo";
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
void
math_mo
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
math_mo
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
common_attlist_
.
add_attributes
(
Attributes
);
CP_APPLY_ATTR
(
L"stretchy"
,
stretchy_
);
CP_APPLY_ATTR
(
L"stretchy"
,
stretchy_
);
CP_APPLY_ATTR
(
L"fence"
,
fence_
);
CP_APPLY_ATTR
(
L"fence"
,
fence_
);
}
}
...
@@ -97,19 +133,17 @@ void math_mo::docx_convert(oox::docx_conversion_context & Context)
...
@@ -97,19 +133,17 @@ void math_mo::docx_convert(oox::docx_conversion_context & Context)
{
{
if
(
!
text_
)
return
;
if
(
!
text_
)
return
;
std
::
wostream
&
strm
=
Context
.
output_stream
();
CP_XML_WRITER
(
Context
.
output_stream
())
CP_XML_WRITER
(
strm
)
{
{
CP_XML_NODE
(
L"m:r"
)
CP_XML_NODE
(
L"m:r"
)
{
{
// + ... todoooo
Context
.
get_styles_context
().
start
();
Context
.
current_text_properties
()
->
docx_convert
(
Context
);
CP_XML_NODE
(
L"w:rPr"
)
CP_XML_NODE
(
L"w:rPr"
)
{
{
CP_XML_NODE
(
L"w:rFonts"
)
CP_XML_STREAM
()
<<
Context
.
get_styles_context
().
text_style
().
str
();
{
CP_XML_ATTR
(
L"w:hAnsi"
,
L"Cambria Math"
);
CP_XML_ATTR
(
L"w:ascii"
,
L"Cambria Math"
);
}
}
}
CP_XML_NODE
(
L"m:t"
)
CP_XML_NODE
(
L"m:t"
)
{
{
...
@@ -125,6 +159,7 @@ const wchar_t * math_mn::name = L"mn";
...
@@ -125,6 +159,7 @@ const wchar_t * math_mn::name = L"mn";
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
void
math_mn
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
math_mn
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
common_attlist_
.
add_attributes
(
Attributes
);
}
}
...
@@ -143,19 +178,17 @@ void math_mn::docx_convert(oox::docx_conversion_context & Context)
...
@@ -143,19 +178,17 @@ void math_mn::docx_convert(oox::docx_conversion_context & Context)
{
{
if
(
!
text_
)
return
;
if
(
!
text_
)
return
;
std
::
wostream
&
strm
=
Context
.
output_stream
();
CP_XML_WRITER
(
Context
.
output_stream
())
CP_XML_WRITER
(
strm
)
{
{
CP_XML_NODE
(
L"m:r"
)
CP_XML_NODE
(
L"m:r"
)
{
{
// + ... todoooo
Context
.
get_styles_context
().
start
();
Context
.
current_text_properties
()
->
docx_convert
(
Context
);
CP_XML_NODE
(
L"w:rPr"
)
CP_XML_NODE
(
L"w:rPr"
)
{
{
CP_XML_NODE
(
L"w:rFonts"
)
CP_XML_STREAM
()
<<
Context
.
get_styles_context
().
text_style
().
str
();
{
CP_XML_ATTR
(
L"w:hAnsi"
,
L"Cambria Math"
);
CP_XML_ATTR
(
L"w:ascii"
,
L"Cambria Math"
);
}
}
}
CP_XML_NODE
(
L"m:t"
)
CP_XML_NODE
(
L"m:t"
)
{
{
...
@@ -171,6 +204,7 @@ const wchar_t * math_ms::name = L"ms";
...
@@ -171,6 +204,7 @@ const wchar_t * math_ms::name = L"ms";
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
void
math_ms
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
math_ms
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
common_attlist_
.
add_attributes
(
Attributes
);
}
}
...
@@ -219,6 +253,7 @@ const wchar_t * math_mtext::name = L"mtext";
...
@@ -219,6 +253,7 @@ const wchar_t * math_mtext::name = L"mtext";
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
void
math_mtext
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
math_mtext
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
common_attlist_
.
add_attributes
(
Attributes
);
}
}
...
@@ -243,6 +278,7 @@ const wchar_t * math_mglyph::name = L"mglyph";
...
@@ -243,6 +278,7 @@ const wchar_t * math_mglyph::name = L"mglyph";
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
void
math_mglyph
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
math_mglyph
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
common_attlist_
.
add_attributes
(
Attributes
);
}
}
...
...
ASCOfficeOdfFile/src/odf/math_token_elements.h
View file @
9db24f8e
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
#include "office_elements_create.h"
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
namespace
cpdoccore
{
namespace
cpdoccore
{
namespace
odf_reader
{
namespace
odf_reader
{
...
@@ -26,9 +28,11 @@ public:
...
@@ -26,9 +28,11 @@ public:
virtual
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
virtual
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
private:
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
odf_types
::
common_math_style_attlist
common_attlist_
;
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
text_
;
...
@@ -60,6 +64,8 @@ private:
...
@@ -60,6 +64,8 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
odf_types
::
common_math_style_attlist
common_attlist_
;
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
};
...
@@ -86,6 +92,8 @@ private:
...
@@ -86,6 +92,8 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
odf_types
::
common_math_style_attlist
common_attlist_
;
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
};
...
@@ -112,6 +120,8 @@ private:
...
@@ -112,6 +120,8 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
odf_types
::
common_math_style_attlist
common_attlist_
;
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
};
...
@@ -138,6 +148,8 @@ private:
...
@@ -138,6 +148,8 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
odf_types
::
common_math_style_attlist
common_attlist_
;
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
};
...
@@ -164,6 +176,8 @@ private:
...
@@ -164,6 +176,8 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
odf_types
::
common_math_style_attlist
common_attlist_
;
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
};
...
@@ -190,6 +204,8 @@ private:
...
@@ -190,6 +204,8 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
odf_types
::
common_math_style_attlist
common_attlist_
;
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
};
...
...
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
View file @
9db24f8e
...
@@ -105,6 +105,9 @@ odf_document::Impl::Impl(const std::wstring & folderPath, const ProgressCallback
...
@@ -105,6 +105,9 @@ odf_document::Impl::Impl(const std::wstring & folderPath, const ProgressCallback
_CP_LOG
<<
L"[info] parse manifest"
<<
std
::
endl
;
_CP_LOG
<<
L"[info] parse manifest"
<<
std
::
endl
;
parse_manifests
();
parse_manifests
();
_CP_LOG
<<
L"[info] parse settings"
<<
std
::
endl
;
parse_settings
();
UpdateProgress
(
400000
);
UpdateProgress
(
400000
);
}
}
bool
odf_document
::
Impl
::
UpdateProgress
(
long
nComplete
)
bool
odf_document
::
Impl
::
UpdateProgress
(
long
nComplete
)
...
@@ -198,6 +201,7 @@ void odf_document::Impl::parse_manifests()
...
@@ -198,6 +201,7 @@ void odf_document::Impl::parse_manifests()
if
(
!
manifest_xml_
)
return
;
if
(
!
manifest_xml_
)
return
;
office_document_base
*
document
=
dynamic_cast
<
office_document_base
*>
(
manifest_xml_
->
get_content
()
);
office_document_base
*
document
=
dynamic_cast
<
office_document_base
*>
(
manifest_xml_
->
get_content
()
);
if
(
!
document
)
return
;
if
(
!
document
)
return
;
int
res
=-
1
;
int
res
=-
1
;
...
@@ -229,6 +233,34 @@ void odf_document::Impl::parse_manifests()
...
@@ -229,6 +233,34 @@ void odf_document::Impl::parse_manifests()
}
}
}
}
void
odf_document
::
Impl
::
parse_settings
()
{
if
(
!
settings_xml_
)
return
;
office_document_base
*
document
=
dynamic_cast
<
office_document_base
*>
(
settings_xml_
->
get_content
()
);
if
(
!
document
)
return
;
office_settings
*
settings
=
dynamic_cast
<
office_settings
*>
(
document
->
office_settings_
.
get
());
if
(
!
settings
)
return
;
BOOST_FOREACH
(
office_element_ptr
&
elm
,
settings
->
content_
)
{
settings_config_item_set
*
item_set
=
dynamic_cast
<
settings_config_item_set
*>
(
elm
.
get
());
if
(
!
item_set
)
continue
;
if
(
item_set
->
config_name_
==
L"ooo:configuration-settings"
)
{
BOOST_FOREACH
(
office_element_ptr
&
elm_sett
,
item_set
->
content_
)
{
settings_config_item
*
sett
=
dynamic_cast
<
settings_config_item
*>
(
elm_sett
.
get
());
if
(
!
sett
)
continue
;
context_
->
Settings
().
add
(
sett
->
config_name_
,
elm_sett
);
}
}
}
}
void
odf_document
::
Impl
::
parse_styles
()
void
odf_document
::
Impl
::
parse_styles
()
{
{
do
do
...
@@ -683,5 +715,6 @@ office_element * odf_document::Impl::get_content()
...
@@ -683,5 +715,6 @@ office_element * odf_document::Impl::get_content()
{
{
return
content_xml_
->
get_content
();
return
content_xml_
->
get_content
();
}
}
}
}
}
}
ASCOfficeOdfFile/src/odf/odf_document_impl.h
View file @
9db24f8e
...
@@ -46,9 +46,11 @@ private:
...
@@ -46,9 +46,11 @@ private:
short
bUserStopConvert
;
short
bUserStopConvert
;
odf_read_context_ptr
context_
;
odf_read_context_ptr
context_
;
void
parse_styles
();
void
parse_styles
();
void
parse_fonts
();
void
parse_fonts
();
void
parse_manifests
();
void
parse_manifests
();
void
parse_settings
();
private:
private:
content_xml_t_ptr
content_xml_
;
content_xml_t_ptr
content_xml_
;
...
...
ASCOfficeOdfFile/src/odf/odfcontext.h
View file @
9db24f8e
...
@@ -332,6 +332,7 @@ public:
...
@@ -332,6 +332,7 @@ public:
styles_lite_container
&
numberStyles
()
{
return
number_style_container_
;
}
styles_lite_container
&
numberStyles
()
{
return
number_style_container_
;
}
styles_lite_container
&
drawStyles
()
{
return
draw_style_container_
;
}
styles_lite_container
&
drawStyles
()
{
return
draw_style_container_
;
}
styles_lite_container
&
Templates
()
{
return
template_container_
;
}
styles_lite_container
&
Templates
()
{
return
template_container_
;
}
styles_lite_container
&
Settings
()
{
return
settings_container_
;
}
private:
private:
styles_container
major_style_container_
;
styles_container
major_style_container_
;
...
@@ -344,6 +345,8 @@ private:
...
@@ -344,6 +345,8 @@ private:
styles_lite_container
draw_style_container_
;
styles_lite_container
draw_style_container_
;
styles_lite_container
template_container_
;
styles_lite_container
template_container_
;
styles_lite_container
settings_container_
;
};
};
...
...
ASCOfficeOdfFile/src/odf/office_settings.cpp
View file @
9db24f8e
...
@@ -33,6 +33,7 @@ const wchar_t * settings_config_item_set::name = L"config-item-set";
...
@@ -33,6 +33,7 @@ const wchar_t * settings_config_item_set::name = L"config-item-set";
void
settings_config_item_set
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
settings_config_item_set
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
CP_APPLY_ATTR
(
L"config:name"
,
config_name_
,
std
::
wstring
(
L""
));
}
}
void
settings_config_item_set
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
void
settings_config_item_set
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
...
@@ -46,11 +47,13 @@ const wchar_t * settings_config_item::name = L"config-item";
...
@@ -46,11 +47,13 @@ const wchar_t * settings_config_item::name = L"config-item";
void
settings_config_item
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
void
settings_config_item
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
{
CP_APPLY_ATTR
(
L"config:name"
,
config_name_
,
std
::
wstring
(
L""
));
CP_APPLY_ATTR
(
L"config:type"
,
config_type_
,
std
::
wstring
(
L""
));
}
}
void
settings_config_item
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
void
settings_config_item
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
{
CP_CREATE_ELEMENT
(
content_
);
//
CP_CREATE_ELEMENT(content_);
}
}
// config_item_map_indexed
// config_item_map_indexed
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
...
...
ASCOfficeOdfFile/src/odf/office_settings.h
View file @
9db24f8e
...
@@ -21,14 +21,12 @@ public:
...
@@ -21,14 +21,12 @@ public:
static
const
ElementType
type
=
typeOfficeSettings
;
static
const
ElementType
type
=
typeOfficeSettings
;
CPDOCCORE_DEFINE_VISITABLE
();
CPDOCCORE_DEFINE_VISITABLE
();
office_element_ptr_array
content_
;
private:
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
){}
virtual
void
add_text
(
const
std
::
wstring
&
Text
){}
private:
office_element_ptr_array
content_
;
};
};
CP_REGISTER_OFFICE_ELEMENT2
(
office_settings
);
CP_REGISTER_OFFICE_ELEMENT2
(
office_settings
);
...
@@ -44,15 +42,14 @@ public:
...
@@ -44,15 +42,14 @@ public:
static
const
ElementType
type
=
typeOfficeSettingsConfigItemSet
;
static
const
ElementType
type
=
typeOfficeSettingsConfigItemSet
;
CPDOCCORE_DEFINE_VISITABLE
();
CPDOCCORE_DEFINE_VISITABLE
();
std
::
wstring
config_name_
;
office_element_ptr_array
content_
;
private:
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
){}
virtual
void
add_text
(
const
std
::
wstring
&
Text
){}
private:
office_element_ptr_array
content_
;
};
};
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item_set
);
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item_set
);
...
@@ -67,15 +64,13 @@ public:
...
@@ -67,15 +64,13 @@ public:
static
const
ElementType
type
=
typeOfficeSettingsConfigItem
;
static
const
ElementType
type
=
typeOfficeSettingsConfigItem
;
CPDOCCORE_DEFINE_VISITABLE
();
CPDOCCORE_DEFINE_VISITABLE
();
std
::
wstring
config_name_
;
std
::
wstring
config_type_
;
std
::
wstring
content_
;
private:
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
){}
virtual
void
add_text
(
const
std
::
wstring
&
Text
){
content_
=
Text
;
}
private:
office_element_ptr_array
content_
;
};
};
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item
);
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item
);
...
...
ASCOfficeOdfFile/win32/cpcommon.vcproj
View file @
9db24f8e
...
@@ -673,6 +673,14 @@
...
@@ -673,6 +673,14 @@
RelativePath=
"..\src\odf\datatypes\markerstyle.h"
RelativePath=
"..\src\odf\datatypes\markerstyle.h"
>
>
</File>
</File>
<File
RelativePath=
"..\src\odf\datatypes\mathvariant.cpp"
>
</File>
<File
RelativePath=
"..\src\odf\datatypes\mathvariant.h"
>
</File>
<File
<File
RelativePath=
"..\src\odf\datatypes\noteclass.cpp"
RelativePath=
"..\src\odf\datatypes\noteclass.cpp"
>
>
...
...
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