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
26c02c57
Commit
26c02c57
authored
Dec 23, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0d8c668f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
62 deletions
+108
-62
ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp
ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp
+43
-29
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.h
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.h
+2
-0
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConverterChart.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConverterChart.cpp
+39
-12
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
+24
-21
No files found.
ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp
View file @
26c02c57
...
...
@@ -125,7 +125,7 @@ namespace odf_writer
class
odf_chart_context
::
Impl
{
public:
Impl
(
odf_conversion_context
*
odf_context
)
:
odf_context_
(
odf_context
)
Impl
(
odf_conversion_context
*
odf_context
)
:
odf_context_
(
odf_context
)
{
styles_context_
=
NULL
;
current_series_count_
=
0
;
...
...
@@ -151,6 +151,9 @@ public:
std
::
vector
<
office_element_ptr
>
group_series_
;
std
::
vector
<
unsigned
int
>
axis_group_series_
;
_CP_OPT
(
int
)
bar_overlap
;
_CP_OPT
(
int
)
bar_gap_width
;
struct
_range
{
_range
(
std
::
wstring
&
r
,
bool
l
,
chart_series
*
s
)
:
label
(
l
),
index_cash
(
-
1
),
series
(
s
),
ref
(
r
)
{}
...
...
@@ -278,6 +281,9 @@ void odf_chart_context::Impl::clear_current()
data_cell_ranges_
.
clear
();
cash_
.
clear
();
bar_gap_width
=
boost
::
none
;
bar_overlap
=
boost
::
none
;
current_series_count_
=
0
;
local_table_reset_ref_
=
false
;
...
...
@@ -427,8 +433,6 @@ void odf_chart_context::set_chart_bar_direction(int type)
}
void
odf_chart_context
::
set_chart_bar_gap_width
(
std
::
wstring
val
)
{
if
(
!
impl_
->
current_level_
.
back
().
chart_properties_
)
return
;
int
res
=
val
.
find
(
L"%"
);
bool
percent
=
false
;
...
...
@@ -438,21 +442,22 @@ void odf_chart_context::set_chart_bar_gap_width(std::wstring val)
percent
=
true
;
}
double
dVal
=
boost
::
lexical_cast
<
double
>
(
val
);
impl_
->
current_level_
.
back
().
chart_properties_
->
content_
.
chart_gap_width_
=
(
int
)
dVal
;
impl_
->
bar_gap_width
=
(
int
)
dVal
;
}
void
odf_chart_context
::
set_chart_bar_overlap
(
std
::
wstring
val
)
{
if
(
!
impl_
->
current_level_
.
back
().
chart_properties_
)
return
;
int
res
=
val
.
find
(
L"%"
);
bool
percent
=
false
;
bool
percent
=
false
;
if
(
res
>
0
)
{
val
=
val
.
substr
(
0
,
res
);
percent
=
true
;
percent
=
true
;
}
double
dVal
=
boost
::
lexical_cast
<
double
>
(
val
);
impl_
->
current_level_
.
back
().
chart_properties_
->
content_
.
chart_overlap_
=
(
int
)
dVal
;
impl_
->
bar_overlap
=
(
int
)
dVal
;
}
void
odf_chart_context
::
set_chart_stock_candle_stick
(
bool
val
)
...
...
@@ -702,15 +707,17 @@ void odf_chart_context::end_group_series()
std
::
wstring
axis_name
;
bool
presentZ
=
false
;
long
countX
=
0
;
long
countY
=
0
;
long
countZ
=
0
;
for
(
size_t
j
=
0
;
j
<
impl_
->
axis_
.
size
();
j
++
)
{
if
(
impl_
->
axis_
[
j
].
dimension
==
1
)
countX
++
;
else
if
(
impl_
->
axis_
[
j
].
dimension
==
3
)
presentZ
=
true
;
else
countY
++
;
if
(
impl_
->
axis_
[
j
].
dimension
==
1
)
countX
++
;
else
if
(
impl_
->
axis_
[
j
].
dimension
==
2
)
countY
++
;
else
if
(
impl_
->
axis_
[
j
].
dimension
==
3
)
countZ
++
;
}
if
(
countX
<
1
&&
countY
>
1
)
{
impl_
->
axis_
[
0
].
dimension
==
1
;
...
...
@@ -718,15 +725,15 @@ void odf_chart_context::end_group_series()
axis
->
chart_axis_attlist_
.
chart_dimension_
=
L"x"
;
countY
--
;
}
if
(
presentZ
==
false
&&
impl_
->
axis_group_series_
.
size
()
==
3
&&
(
countY
>
1
||
countX
>
1
))
{
impl_
->
axis_
.
back
().
dimension
==
3
;
chart_axis
*
axis
=
dynamic_cast
<
chart_axis
*>
(
impl_
->
axis_
.
back
().
elm
.
get
());
axis
->
chart_axis_attlist_
.
chart_dimension_
=
L"z"
;
countY
--
;
}
//if (countZ > 0
&& impl_->axis_group_series_.size() == 3 && (countY > 1 || countX > 1))
//
{
//
impl_->axis_.back().dimension == 3;
//
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_.back().elm.get());
//
axis->chart_axis_attlist_.chart_dimension_ = L"z";
//
countY--;
//
}
for
(
size_t
i
=
0
;
i
<
impl_
->
axis_group_series_
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
impl_
->
axis_group_series_
.
size
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
impl_
->
axis_
.
size
();
j
++
)
{
...
...
@@ -740,7 +747,7 @@ void odf_chart_context::end_group_series()
}
for
(
size_t
i
=
0
;
i
<
impl_
->
group_series_
.
size
()
&&
axis_name
.
length
()
>
0
;
i
++
)
for
(
size_t
i
=
0
;
i
<
impl_
->
group_series_
.
size
()
&&
axis_name
.
length
()
>
0
;
i
++
)
{
chart_series
*
series
=
dynamic_cast
<
chart_series
*>
(
impl_
->
group_series_
[
i
].
get
());
if
(
series
)
...
...
@@ -796,7 +803,7 @@ void odf_chart_context::start_axis()
chart_axis
*
axis
=
dynamic_cast
<
chart_axis
*>
(
elm
.
get
());
if
(
axis
==
NULL
)
return
;
//////////
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Chart
,
true
,
false
,
-
1
);
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Chart
,
true
,
false
,
-
1
);
office_element_ptr
&
style_elm
=
impl_
->
styles_context_
->
last_state
()
->
get_office_element
();
...
...
@@ -810,10 +817,19 @@ void odf_chart_context::start_axis()
}
start_element
(
elm
,
style_elm
,
style_name
);
odf_axis_state
axis_state
=
{
0
,
0
,
L""
,
elm
};
odf_axis_state
axis_state
=
{
0
,
0
,
L""
,
elm
};
impl_
->
axis_
.
push_back
(
axis_state
);
/////////////////////defaults
impl_
->
current_level_
.
back
().
chart_properties_
->
content_
.
chart_reverse_direction_
=
false
;
if
(
impl_
->
bar_overlap
)
{
impl_
->
current_level_
.
back
().
chart_properties_
->
content_
.
chart_overlap_
=
impl_
->
bar_overlap
.
get
();
}
if
(
impl_
->
bar_gap_width
)
{
impl_
->
current_level_
.
back
().
chart_properties_
->
content_
.
chart_gap_width_
=
impl_
->
bar_gap_width
.
get
();
}
}
void
odf_chart_context
::
start_grid
(
int
type
)
{
...
...
@@ -826,7 +842,7 @@ void odf_chart_context::start_grid(int type)
if
(
type
==
1
)
grid
->
chart_grid_attlist_
.
chart_class_
=
L"major"
;
if
(
type
==
2
)
grid
->
chart_grid_attlist_
.
chart_class_
=
L"minor"
;
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Chart
,
true
,
false
,
-
1
);
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Chart
,
true
,
false
,
-
1
);
office_element_ptr
&
style_elm
=
impl_
->
styles_context_
->
last_state
()
->
get_office_element
();
...
...
@@ -850,7 +866,7 @@ void odf_chart_context::start_title()
chart_title
*
title
=
dynamic_cast
<
chart_title
*>
(
chart_elm
.
get
());
if
(
title
==
NULL
)
return
;
//////////
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Chart
,
true
,
false
,
-
1
);
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Chart
,
true
,
false
,
-
1
);
office_element_ptr
&
style_elm
=
impl_
->
styles_context_
->
last_state
()
->
get_office_element
();
...
...
@@ -874,7 +890,7 @@ void odf_chart_context::start_plot_area()
plot_area
->
chart_plot_area_attlist_
.
chart_data_source_has_labels_
=
L"both"
;
//////////
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Chart
,
true
,
false
,
-
1
);
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Chart
,
true
,
false
,
-
1
);
office_element_ptr
&
style_elm
=
impl_
->
styles_context_
->
last_state
()
->
get_office_element
();
...
...
@@ -911,8 +927,6 @@ void odf_chart_context::start_text()
impl_
->
odf_context_
->
start_text_context
();
impl_
->
odf_context_
->
text_context
()
->
set_styles_context
(
impl_
->
styles_context_
);
style_text_properties
*
text_props
=
NULL
;
style
*
style_
=
dynamic_cast
<
style
*>
(
impl_
->
current_chart_state_
.
elements_
.
back
().
style_elm
.
get
());
if
(
style_
)
{
...
...
@@ -926,7 +940,7 @@ void odf_chart_context::end_text()
{
odf_text_context
*
text_context_
=
text_context
();
if
(
text_context_
==
NULL
||
impl_
->
current_level_
.
size
()
<
1
)
return
;
if
(
text_context_
==
NULL
||
impl_
->
current_level_
.
size
()
<
1
)
return
;
for
(
size_t
i
=
0
;
i
<
text_context_
->
text_elements_list_
.
size
();
i
++
)
{
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.h
View file @
26c02c57
...
...
@@ -457,7 +457,9 @@ public:
void
convert
(
OOX
::
Spreadsheet
::
CT_Area3DChart
*
chart
);
void
convert
(
OOX
::
Spreadsheet
::
CT_AreaChart
*
chart
);
void
convert
(
OOX
::
Spreadsheet
::
CT_Bar3DChart
*
chart
);
void
convert_before
(
OOX
::
Spreadsheet
::
CT_Bar3DChart
*
chart
);
void
convert
(
OOX
::
Spreadsheet
::
CT_BarChart
*
chart
);
void
convert_before
(
OOX
::
Spreadsheet
::
CT_BarChart
*
chart
);
void
convert
(
OOX
::
Spreadsheet
::
CT_Line3DChart
*
chart
);
void
convert
(
OOX
::
Spreadsheet
::
CT_LineChart
*
chart
);
void
convert
(
OOX
::
Spreadsheet
::
CT_Pie3DChart
*
chart
);
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConverterChart.cpp
View file @
26c02c57
...
...
@@ -222,6 +222,17 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
convert
(
ct_plotArea
->
m_layout
);
///////////////////////
for
(
size_t
i
=
0
;
i
<
ct_plotArea
->
m_Items
.
size
();
i
++
)
//
{
if
(
!
ct_plotArea
->
m_ItemsElementName0
[
i
])
continue
;
switch
(
*
ct_plotArea
->
m_ItemsElementName0
[
i
])
{
case
OOX
:
:
Spreadsheet
::
itemschoicetype5BAR3DCHART
:
convert_before
((
OOX
::
Spreadsheet
::
CT_Bar3DChart
*
)
ct_plotArea
->
m_Items
[
i
]);
break
;
case
OOX
:
:
Spreadsheet
::
itemschoicetype5BARCHART
:
convert_before
((
OOX
::
Spreadsheet
::
CT_BarChart
*
)
ct_plotArea
->
m_Items
[
i
]);
break
;
}
}
for
(
size_t
i
=
0
;
i
<
ct_plotArea
->
m_Items1
.
size
();
i
++
)
{
if
(
!
ct_plotArea
->
m_ItemsElementName1
[
i
])
continue
;
...
...
@@ -514,12 +525,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
if
(
chart
->
m_barDir
&&
chart
->
m_barDir
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_direction
(
*
chart
->
m_barDir
->
m_val
);
if
(
chart
->
m_gapWidth
&&
chart
->
m_gapWidth
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_gap_width
(
*
chart
->
m_gapWidth
->
m_val
);
//if (chart->m_overlap && chart->m_overlap->m_val)
// odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
odf_context
()
->
chart_context
()
->
start_group_series
();
convert
(
chart
->
m_dLbls
);
...
...
@@ -533,23 +538,45 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
}
odf_context
()
->
chart_context
()
->
end_group_series
();
}
void
OoxConverter
::
convert
(
OOX
::
Spreadsheet
::
CT_Bar
Chart
*
chart
)
void
OoxConverter
::
convert
_before
(
OOX
::
Spreadsheet
::
CT_Bar3D
Chart
*
chart
)
{
if
(
chart
==
NULL
)
return
;
odf_context
()
->
chart_context
()
->
set_chart_type
(
L"bar"
);
if
(
chart
->
m_gapWidth
&&
chart
->
m_gapWidth
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_gap_width
(
*
chart
->
m_gapWidth
->
m_val
);
if
(
chart
->
m_grouping
&&
chart
->
m_grouping
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_grouping
(
*
chart
->
m_grouping
->
m_val
);
//if (chart->m_overlap && chart->m_overlap->m_val)
// odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
//else
// odf_context()->chart_context()->set_chart_bar_overlap(L"0");
if
(
chart
->
m_barDir
&&
chart
->
m_barDir
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_direction
(
*
chart
->
m_barDir
->
m_val
);
}
void
OoxConverter
::
convert_before
(
OOX
::
Spreadsheet
::
CT_BarChart
*
chart
)
{
if
(
chart
==
NULL
)
return
;
if
(
chart
->
m_gapWidth
&&
chart
->
m_gapWidth
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_gap_width
(
*
chart
->
m_gapWidth
->
m_val
);
else
odf_context
()
->
chart_context
()
->
set_chart_bar_overlap
(
L"100"
);
if
(
chart
->
m_overlap
&&
chart
->
m_overlap
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_overlap
(
*
chart
->
m_overlap
->
m_val
);
else
odf_context
()
->
chart_context
()
->
set_chart_bar_overlap
(
L"0"
);
}
void
OoxConverter
::
convert
(
OOX
::
Spreadsheet
::
CT_BarChart
*
chart
)
{
if
(
chart
==
NULL
)
return
;
odf_context
()
->
chart_context
()
->
set_chart_type
(
L"bar"
);
if
(
chart
->
m_grouping
&&
chart
->
m_grouping
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_grouping
(
*
chart
->
m_grouping
->
m_val
);
if
(
chart
->
m_barDir
&&
chart
->
m_barDir
->
m_val
)
odf_context
()
->
chart_context
()
->
set_chart_bar_direction
(
*
chart
->
m_barDir
->
m_val
);
odf_context
()
->
chart_context
()
->
start_group_series
();
convert
(
chart
->
m_dLbls
);
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
View file @
26c02c57
...
...
@@ -653,10 +653,12 @@ namespace PPTX
if
(
pVml
->
m_mapShapes
.
end
()
!=
pPair
)
{
pPair
->
second
.
bUsed
=
true
;
OOX
::
Vml
::
C
Shape
*
pShape
=
dynamic_cast
<
OOX
::
Vml
::
CShape
*>
(
pPair
->
second
.
pElement
);
OOX
::
Vml
::
C
VmlCommonElements
*
pShape
=
dynamic_cast
<
OOX
::
Vml
::
CVmlCommonElements
*>
(
pPair
->
second
.
pElement
);
if
(
pShape
)
{
for
(
std
::
list
<
OOX
::
WritingElement
*>::
iterator
it
=
pShape
->
m_arrItems
.
begin
();
(
pShape
)
&&
(
it
!=
pShape
->
m_arrItems
.
end
()
);
it
++
)
it
!=
pShape
->
m_arrItems
.
end
(
);
it
++
)
{
OOX
::
WritingElement
*
pChildElemShape
=
*
it
;
if
(
OOX
::
et_v_imagedata
==
pChildElemShape
->
getType
())
...
...
@@ -685,6 +687,7 @@ namespace PPTX
}
}
}
}
else
if
(
nvPicPr
.
nvPr
.
media
.
is_init
())
{
blipFill
.
additionalFile
=
GetMediaLink
();
...
...
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