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
7a27150d
Commit
7a27150d
authored
Oct 02, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - fix math after testing
parent
2197fddb
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
101 additions
and
31 deletions
+101
-31
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
+1
-1
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
+2
-0
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
+2
-2
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
+47
-11
ASCOfficeOdfFile/src/odf/math_limit_elements.cpp
ASCOfficeOdfFile/src/odf/math_limit_elements.cpp
+24
-0
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
+23
-15
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
+1
-1
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
+1
-1
No files found.
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
View file @
7a27150d
...
...
@@ -144,7 +144,7 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
namespace
oox
{
math_context
::
math_context
(
odf_reader
::
fonts_container
&
fonts
,
bool
graphic
)
:
base_font_size_
(
12
),
fonts_container_
(
fonts
)
base_font_size_
(
12
),
fonts_container_
(
fonts
),
is_need_e_
(
false
)
{
graphRPR_
=
graphic
;
...
...
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
View file @
7a27150d
...
...
@@ -106,6 +106,8 @@ namespace oox {
std
::
wstring
nsRPr_
;
bool
graphRPR_
;
bool
is_need_e_
;
private:
std
::
wstringstream
math_stream_
;
std
::
wstringstream
math_style_stream_
;
...
...
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
View file @
7a27150d
...
...
@@ -753,10 +753,10 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
{
CP_XML_ATTR
(
L"spd"
,
impl_
->
transition_
.
Speed
.
get
());
}
if
(
impl_
->
transition_
.
Time
)
/*
if (impl_->transition_.Time)
{
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
}
}
*/
if
(
impl_
->
transition_
.
PageTime
)
{
CP_XML_ATTR
(
L"advTm"
,
impl_
->
transition_
.
PageTime
.
get
());
...
...
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
View file @
7a27150d
...
...
@@ -96,6 +96,7 @@ void math_mrow::oox_convert(oox::math_context & Context)
bDPr
=
true
;
}
bool
need_e_old
=
Context
.
is_need_e_
,
need_e
=
false
;
if
(
bDPr
)
{
Context
.
output_stream
()
<<
L"<m:d>"
;
...
...
@@ -115,20 +116,31 @@ void math_mrow::oox_convert(oox::math_context & Context)
}
Context
.
output_stream
()
<<
Context
.
math_style_stream
().
str
();
Context
.
output_stream
()
<<
L"</m:dPr>"
;
Context
.
output_stream
()
<<
L"<m:e>"
;
need_e
=
true
;
}
else
need_e
=
Context
.
is_need_e_
;
Context
.
is_need_e_
=
false
;
if
(
need_e
)
{
Context
.
output_stream
()
<<
L"<m:e>"
;
}
for
(
int
i
=
i_start
;
i
<
i_end
;
i
++
)
{
office_math_element
*
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
i
].
get
());
math_element
->
oox_convert
(
Context
);
}
if
(
bDPr
)
if
(
need_e
)
{
Context
.
output_stream
()
<<
L"</m:e>"
;
}
if
(
bDPr
)
{
Context
.
output_stream
()
<<
L"</m:d>"
;
}
Context
.
is_need_e_
=
need_e_old
;
}
//---------------------------------------------------------------
const
wchar_t
*
math_mfrac
::
ns
=
L"math"
;
...
...
@@ -150,20 +162,36 @@ void math_mfrac::oox_convert(oox::math_context & Context)
{
return
;
}
bool
need_e
=
Context
.
is_need_e_
;
if
(
need_e
)
{
Context
.
output_stream
()
<<
L"<m:e>"
;
}
Context
.
is_need_e_
=
false
;
office_math_element
*
math_element
=
NULL
;
Context
.
output_stream
()
<<
L"<m:f>"
;
Context
.
output_stream
()
<<
L"<m:num>"
;
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
0
].
get
());
math_element
->
oox_convert
(
Context
);
Context
.
output_stream
()
<<
L"</m:num>"
;
Context
.
is_need_e_
=
false
;
Context
.
output_stream
()
<<
L"<m:den>"
;
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
1
].
get
());
math_element
->
oox_convert
(
Context
);
Context
.
output_stream
()
<<
L"</m:den>"
;
Context
.
output_stream
()
<<
L"</m:f>"
;
if
(
need_e
)
{
Context
.
output_stream
()
<<
L"</m:e>"
;
}
Context
.
is_need_e_
=
need_e
;
}
//---------------------------------------------------------------
const
wchar_t
*
math_msqrt
::
ns
=
L"math"
;
...
...
@@ -192,6 +220,8 @@ void math_msqrt::oox_convert(oox::math_context & Context)
strm
<<
L"<m:deg/>"
;
strm
<<
L"<m:e>"
;
Context
.
is_need_e_
=
false
;
for
(
size_t
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
office_math_element
*
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
i
].
get
());
...
...
@@ -230,6 +260,9 @@ void math_mroot::oox_convert(oox::math_context & Context)
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
1
].
get
());
math_element
->
oox_convert
(
Context
);
strm
<<
L"</m:deg>"
;
Context
.
is_need_e_
=
false
;
strm
<<
L"<m:e>"
;
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
0
].
get
());
math_element
->
oox_convert
(
Context
);
...
...
@@ -295,21 +328,23 @@ void math_mstyle::oox_convert(oox::math_context & Context)
}
}
}
bool
need_e_old
=
Context
.
is_need_e_
;
Context
.
is_need_e_
=
content_
.
size
()
>
1
?
true
:
need_e_old
;
for
(
size_t
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
math_munder
*
munder_test
=
dynamic_cast
<
math_munder
*>
(
content_
[
i
].
get
());
math_mfrac
*
frac_test
=
dynamic_cast
<
math_mfrac
*>
(
content_
[
i
].
get
());
math_mrow
*
row_test
=
dynamic_cast
<
math_mrow
*>
(
content_
[
i
].
get
());
//
math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
//
math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
//
math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
if
(
row_test
||
munder_test
||
frac_test
)
Context
.
output_stream
()
<<
L"<m:e>"
;
//
if (row_test || munder_test || frac_test)
//
Context.output_stream() << L"<m:e>";
office_math_element
*
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
i
].
get
());
math_element
->
oox_convert
(
Context
);
if
(
row_test
||
munder_test
||
frac_test
)
Context
.
output_stream
()
<<
L"</m:e>"
;
//
if (row_test || munder_test || frac_test)
//
Context.output_stream() << L"</m:e>";
//office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
//math_element->oox_convert(Context);
...
...
@@ -320,6 +355,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
Context
.
text_properties_
->
content
().
style_font_name_
=
L"Cambria Math"
;
Context
.
text_properties_
->
content
().
fo_font_size_
=
odf_types
::
length
(
Context
.
base_font_size_
,
odf_types
::
length
::
pt
);
Context
.
is_need_e_
=
need_e_old
;
{
std
::
wstringstream
&
strm
=
Context
.
math_style_stream
();
strm
.
str
(
std
::
wstring
()
);
...
...
ASCOfficeOdfFile/src/odf/math_limit_elements.cpp
View file @
7a27150d
...
...
@@ -71,11 +71,15 @@ void math_msub::oox_convert(oox::math_context & Context)
strm
<<
L"<m:sSub>"
;
strm
<<
L"<m:e>"
;
Context
.
is_need_e_
=
false
;
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
0
].
get
());
math_element
->
oox_convert
(
Context
);
strm
<<
L"</m:e>"
;
strm
<<
L"<m:sub>"
;
Context
.
is_need_e_
=
false
;
//??
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
1
].
get
());
math_element
->
oox_convert
(
Context
);
strm
<<
L"</m:sub>"
;
...
...
@@ -109,6 +113,8 @@ void math_msup::oox_convert(oox::math_context & Context)
strm
<<
L"<m:sSup>"
;
strm
<<
L"<m:e>"
;
Context
.
is_need_e_
=
false
;
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
0
].
get
());
math_element
->
oox_convert
(
Context
);
strm
<<
L"</m:e>"
;
...
...
@@ -143,6 +149,8 @@ void math_msubsup::oox_convert(oox::math_context & Context)
strm
<<
L"<m:sSubSup>"
;
Context
.
is_need_e_
=
false
;
strm
<<
L"<m:e>"
;
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
0
].
get
());
math_element
->
oox_convert
(
Context
);
...
...
@@ -328,6 +336,9 @@ void math_mover::oox_convert(oox::math_context & Context)
strm
<<
L"<m:limUpp>"
;
strm
<<
L"<m:limUppPr/>"
;
strm
<<
L"<m:e>"
;
Context
.
is_need_e_
=
false
;
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
0
].
get
());
math_element
->
oox_convert
(
Context
);
strm
<<
L"</m:e>"
;
...
...
@@ -355,6 +366,13 @@ void math_munder::oox_convert(oox::math_context & Context)
{
//2 elements
std
::
wostream
&
strm
=
Context
.
output_stream
();
bool
need_e
=
Context
.
is_need_e_
;
if
(
need_e
)
{
Context
.
output_stream
()
<<
L"<m:e>"
;
}
Context
.
is_need_e_
=
false
;
office_math_element
*
math_element
=
NULL
;
strm
<<
L"<m:limLow>"
;
strm
<<
L"<m:limLowPr/>"
;
...
...
@@ -367,6 +385,12 @@ void math_munder::oox_convert(oox::math_context & Context)
math_element
->
oox_convert
(
Context
);
strm
<<
L"</m:lim>"
;
strm
<<
L"</m:limLow>"
;
if
(
need_e
)
{
Context
.
output_stream
()
<<
L"</m:e>"
;
}
Context
.
is_need_e_
=
need_e
;
}
}
}
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
View file @
7a27150d
...
...
@@ -92,23 +92,30 @@ void math_mtr::oox_convert(oox::math_context & Context)
std
::
wostream
&
strm
=
Context
.
output_stream
();
strm
<<
L"<m:mr>"
;
bool
need_e_old
=
Context
.
is_need_e_
;
for
(
size_t
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
math_mrow
*
row_test
=
dynamic_cast
<
math_mrow
*>
(
content_
[
i
].
get
());
math_munder
*
munder_test
=
dynamic_cast
<
math_munder
*>
(
content_
[
i
].
get
());
math_mfrac
*
frac_test
=
dynamic_cast
<
math_mfrac
*>
(
content_
[
i
].
get
());
if
(
row_test
||
munder_test
||
frac_test
)
Context
.
output_stream
()
<<
L"<m:e>"
;
// EqArray записался в числитель вместо знаменателя.docx - дублирование
//Context.is_need_e_ = content_.size() > 1 ? true : false;
Context
.
is_need_e_
=
true
;
//math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
//math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
//math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
//
//if (row_test || munder_test || frac_test)
// Context.output_stream() << L"<m:e>";// EqArray записался в числитель вместо знаменателя.docx - дублирование
office_math_element
*
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
i
].
get
());
math_element
->
oox_convert
(
Context
);
if
(
row_test
||
munder_test
||
frac_test
)
strm
<<
L"</m:e>"
;
//
if (row_test || munder_test || frac_test)
//
strm << L"</m:e>";
}
strm
<<
L"</m:mr>"
;
Context
.
is_need_e_
=
need_e_old
;
}
//----------------------------------------------------------------------------------------------------
...
...
@@ -151,6 +158,7 @@ void math_mtd::oox_convert(oox::math_context & Context)
std
::
wostream
&
strm
=
Context
.
output_stream
();
strm
<<
L"<m:e>"
;
Context
.
is_need_e_
=
false
;
for
(
size_t
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
office_math_element
*
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
i
].
get
());
...
...
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
View file @
7a27150d
...
...
@@ -286,7 +286,7 @@ void math_mtext::oox_convert(oox::math_context & Context)
if
(
text_
)
{
Context
.
output_stream
()
<<
L"<m:r><m:rPr><m:nor/></m:rPr><m:t>"
;
Context
.
output_stream
()
<<
*
text_
;
Context
.
output_stream
()
<<
XmlUtils
::
EncodeXmlString
(
*
text_
)
;
Context
.
output_stream
()
<<
L"</m:t></m:r>"
;
}
}
...
...
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
View file @
7a27150d
...
...
@@ -407,7 +407,7 @@ void text_format_properties_content::drawing_serialize(std::wostream & strm, std
switch
(
style_text_underline_style_
->
get_type
())
{
case
line_style
:
:
Solid
:
if
(
underlineBold
)
underline
=
L"
thick
"
;
if
(
underlineBold
)
underline
=
L"
heavy
"
;
else
underline
=
L"sng"
;
break
;
case
line_style
:
:
Dotted
:
...
...
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