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
9ea214e1
Commit
9ea214e1
authored
Mar 25, 2016
by
ElenaSubbotina
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - math
RtfFormat - styles table
parent
435f3353
Changes
39
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
3821 additions
and
1427 deletions
+3821
-1427
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
+43
-26
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
+12
-5
ASCOfficeOdfFile/src/docx/docx_package.cpp
ASCOfficeOdfFile/src/docx/docx_package.cpp
+0
-1
ASCOfficeOdfFile/src/odf/all_elements.h
ASCOfficeOdfFile/src/odf/all_elements.h
+1
-0
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
+25
-6
ASCOfficeOdfFile/src/odf/chart_build_oox.h
ASCOfficeOdfFile/src/odf/chart_build_oox.h
+11
-11
ASCOfficeOdfFile/src/odf/draw_frame.cpp
ASCOfficeOdfFile/src/odf/draw_frame.cpp
+2
-2
ASCOfficeOdfFile/src/odf/draw_frame.h
ASCOfficeOdfFile/src/odf/draw_frame.h
+2
-2
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+71
-19
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
+2
-2
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
+4
-4
ASCOfficeOdfFile/src/odf/font_face.h
ASCOfficeOdfFile/src/odf/font_face.h
+0
-1
ASCOfficeOdfFile/src/odf/math_elementaries.cpp
ASCOfficeOdfFile/src/odf/math_elementaries.cpp
+151
-0
ASCOfficeOdfFile/src/odf/math_elementaries.h
ASCOfficeOdfFile/src/odf/math_elementaries.h
+194
-0
ASCOfficeOdfFile/src/odf/math_elements.cpp
ASCOfficeOdfFile/src/odf/math_elements.cpp
+101
-14
ASCOfficeOdfFile/src/odf/math_elements.h
ASCOfficeOdfFile/src/odf/math_elements.h
+82
-8
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
+205
-0
ASCOfficeOdfFile/src/odf/math_layout_elements.h
ASCOfficeOdfFile/src/odf/math_layout_elements.h
+221
-0
ASCOfficeOdfFile/src/odf/math_limit_elements.cpp
ASCOfficeOdfFile/src/odf/math_limit_elements.cpp
+215
-0
ASCOfficeOdfFile/src/odf/math_limit_elements.h
ASCOfficeOdfFile/src/odf/math_limit_elements.h
+237
-0
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
+136
-0
ASCOfficeOdfFile/src/odf/math_table_elements.h
ASCOfficeOdfFile/src/odf/math_table_elements.h
+163
-0
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
+251
-0
ASCOfficeOdfFile/src/odf/math_token_elements.h
ASCOfficeOdfFile/src/odf/math_token_elements.h
+196
-0
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
+5
-0
ASCOfficeOdfFile/src/odf/odf_document_impl.h
ASCOfficeOdfFile/src/odf/odf_document_impl.h
+3
-1
ASCOfficeOdfFile/src/odf/office_elements_create.h
ASCOfficeOdfFile/src/odf/office_elements_create.h
+30
-12
ASCOfficeOdfFile/src/odf/office_elements_type.h
ASCOfficeOdfFile/src/odf/office_elements_type.h
+42
-1
ASCOfficeOdfFile/src/odf/paragraph_elements.cpp
ASCOfficeOdfFile/src/odf/paragraph_elements.cpp
+4
-4
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
+2
-3
ASCOfficeOdfFile/src/odf/styles.cpp
ASCOfficeOdfFile/src/odf/styles.cpp
+0
-2
ASCOfficeOdfFile/src/odf/text_elements.cpp
ASCOfficeOdfFile/src/odf/text_elements.cpp
+2
-2
ASCOfficeOdfFile/win32/ASCOfficeOdfFile.sln
ASCOfficeOdfFile/win32/ASCOfficeOdfFile.sln
+1
-5
ASCOfficeOdfFile/win32/cpodf.vcproj
ASCOfficeOdfFile/win32/cpodf.vcproj
+40
-0
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
+1128
-1196
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h
+14
-14
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
+185
-76
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h
+13
-9
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
...eRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
+27
-1
No files found.
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
View file @
9ea214e1
...
...
@@ -27,25 +27,24 @@ namespace oox {
docx_conversion_context
::
docx_conversion_context
(
package
::
docx_document
*
OutputDocument
,
odf_reader
::
odf_document
*
OdfDocument
)
:
streams_man_
(
streams_man
::
create
(
temp_stream_
)
),
output_document_
(
OutputDocument
),
odf_document_
(
OdfDocument
),
current_run_
(
false
),
page_break_after_
(
false
),
page_break_before_
(
false
),
page_break_
(
false
),
in_automatic_style_
(
false
),
output_document_
(
OutputDocument
),
odf_document_
(
OdfDocument
),
mediaitems_
(
OdfDocument
->
get_folder
()
),
current_run_
(
false
),
page_break_after_
(
false
),
page_break_before_
(
false
),
next_dump_page_properties_
(
false
),
next_dump_section_
(
false
),
mediaitems_
(
OdfDocument
->
get_folder
()
),
in_paragraph_
(
false
),
table_context_
(
*
this
),
in_automatic_style_
(
false
),
in_paragraph_
(
false
),
table_context_
(
*
this
),
section_properties_in_table_
(
NULL
),
new_list_style_number_
(
0
),
rtl_
(
false
),
delayed_converting_
(
false
),
process_note_
(
noNote
),
new_list_style_number_
(
0
),
rtl_
(
false
),
delayed_converting_
(
false
),
process_headers_footers_
(
false
),
process_
note_
(
noNot
e
),
process_
comment_
(
false
)
process_
comment_
(
fals
e
),
process_
math_formula_
(
false
)
{
applicationFonts_
=
new
CApplicationFonts
();
}
...
...
@@ -62,14 +61,20 @@ void docx_conversion_context::set_font_directory(std::wstring pathFonts)
std
::
wstring
styles_map
::
get
(
const
std
::
wstring
&
Name
,
odf_types
::
style_family
::
type
Type
)
{
const
std
::
wstring
n
=
name
(
Name
,
Type
);
if
(
map_
.
count
(
n
))
//typedef boost::unordered::unordered_map<std::wstring,std::wstring>::iterator _mapIter;
typedef
std
::
multimap
<
std
::
wstring
,
std
::
wstring
>::
iterator
_mapIter
;
_mapIter
it
=
map_
.
find
(
n
);
if
(
it
!=
map_
.
end
()
)
{
return
map_
[
n
]
;
return
it
->
second
;
}
else
{
const
std
::
wstring
id
=
std
::
wstring
(
L"style"
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
count_
++
);
map_
[
n
]
=
id
;
map_
.
insert
(
std
::
make_pair
(
n
,
id
))
;
return
id
;
}
}
...
...
@@ -140,6 +145,19 @@ void docx_conversion_context::finish_run()
}
}
}
void
docx_conversion_context
::
start_math_formula
()
{
process_math_formula_
=
true
;
output_stream
()
<<
L"<m:oMath>"
;
}
void
docx_conversion_context
::
end_math_formula
()
{
output_stream
()
<<
L"</m:oMath>"
;
process_math_formula_
=
false
;
}
void
docx_conversion_context
::
start_chart
(
std
::
wstring
const
&
name
)
{
charts_
.
push_back
(
oox_chart_context
::
create
(
name
));
...
...
@@ -399,7 +417,6 @@ xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\"
xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
\
xmlns:o=
\"
urn:schemas-microsoft-com:office:office
\"
\
xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
\
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
\
xmlns:v=
\"
urn:schemas-microsoft-com:vml
\"
\
xmlns:wp14=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing
\"
\
xmlns:wp=
\"
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing
\"
\
...
...
@@ -505,7 +522,7 @@ void docx_conversion_context::process_styles()
// add all styles to the map
BOOST_FOREACH
(
odf_reader
::
style_instance_ptr
&
inst
,
styles
.
instances
())
{
style_map_
.
get
(
inst
->
name
(),
inst
->
type
());
style
s
_map_
.
get
(
inst
->
name
(),
inst
->
type
());
}
_Wostream
<<
L"<w:docDefaults>"
;
...
...
@@ -532,7 +549,7 @@ void docx_conversion_context::process_styles()
inst
->
type
()
==
odf_types
::
style_family
::
Text
))
{
const
std
::
wstring
id
=
style_map_
.
get
(
inst
->
name
(),
inst
->
type
());
const
std
::
wstring
id
=
style
s
_map_
.
get
(
inst
->
name
(),
inst
->
type
());
_Wostream
<<
L"<w:style w:styleId=
\"
"
<<
id
<<
L"
\"
w:type=
\"
"
<<
StyleTypeOdf2Docx
(
inst
->
type
())
<<
L"
\"
"
;
if
(
!
inst
->
is_default
())
{
...
...
@@ -546,18 +563,18 @@ void docx_conversion_context::process_styles()
if
(
odf_reader
::
style_instance
*
baseOn
=
inst
->
parent
())
{
const
std
::
wstring
basedOnId
=
style_map_
.
get
(
baseOn
->
name
(),
baseOn
->
type
());
const
std
::
wstring
basedOnId
=
style
s
_map_
.
get
(
baseOn
->
name
(),
baseOn
->
type
());
_Wostream
<<
L"<w:basedOn w:val=
\"
"
<<
basedOnId
<<
"
\"
/>"
;
}
else
if
(
!
inst
->
is_default
()
&&
style_map_
.
check
(
L""
,
inst
->
type
()))
else
if
(
!
inst
->
is_default
()
&&
style
s
_map_
.
check
(
L""
,
inst
->
type
()))
{
const
std
::
wstring
basedOnId
=
style_map_
.
get
(
L""
,
inst
->
type
());
const
std
::
wstring
basedOnId
=
style
s
_map_
.
get
(
L""
,
inst
->
type
());
_Wostream
<<
L"<w:basedOn w:val=
\"
"
<<
basedOnId
<<
"
\"
/>"
;
}
if
(
odf_reader
::
style_instance
*
next
=
inst
->
next
())
{
const
std
::
wstring
nextId
=
style_map_
.
get
(
next
->
name
(),
next
->
type
());
const
std
::
wstring
nextId
=
style
s
_map_
.
get
(
next
->
name
(),
next
->
type
());
_Wostream
<<
L"<w:next w:val=
\"
"
<<
nextId
<<
"
\"
/>"
;
}
else
if
(
inst
->
is_default
())
...
...
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
View file @
9ea214e1
...
...
@@ -85,7 +85,9 @@ private:
std
::
wstring
name
(
const
std
::
wstring
&
Name
,
odf_types
::
style_family
::
type
Type
);
size_t
count_
;
boost
::
unordered_map
<
std
::
wstring
,
std
::
wstring
>
map_
;
//boost::unordered_map<std::wstring, std::wstring> map_;
std
::
multimap
<
std
::
wstring
,
std
::
wstring
>
map_
;
};
...
...
@@ -471,7 +473,7 @@ public:
bool
in_automatic_style
();
styles_context
&
get_styles_context
()
{
return
styles_context_
;
}
styles_map
&
get_style_map
()
{
return
style
_map_
;
}
styles_map
*
get_style_map
()
{
return
&
styles
_map_
;
}
void
push_text_properties
(
const
odf_reader
::
style_text_properties
*
TextProperties
);
void
pop_text_properties
();
...
...
@@ -522,8 +524,8 @@ public:
docx_table_context
&
get_table_context
()
{
return
table_context_
;
}
section_context
&
get_section_context
()
{
return
section_context_
;
}
void
section_properties_in_table
(
odf_reader
::
office_element
*
Elm
);
odf_reader
::
office_element
*
get_section_properties_in_table
();
void
section_properties_in_table
(
odf_reader
::
office_element
*
Elm
);
typedef
boost
::
shared_ptr
<
streams_man
>
StreamsManPtr
;
void
set_stream_man
(
StreamsManPtr
Sm
)
{
streams_man_
=
Sm
;
}
...
...
@@ -548,12 +550,18 @@ public:
void
end_comment
()
{
process_comment_
=
false
;}
bool
process_comment_
;
void
start_math_formula
();
void
end_math_formula
();
bool
process_math_formula_
;
void
set_process_headers_footers
(
bool
Val
)
{
process_headers_footers_
=
Val
;
}
headers_footers
&
get_headers_footers
()
{
return
headers_footers_
;
}
header_footer_context
&
get_header_footer_context
()
{
return
header_footer_context_
;
}
bool
process_headers_footers_
;
drop_cap_context
&
get_drop_cap_context
(){
return
drop_cap_context_
;}
styles_map
styles_map_
;
private:
std
::
wstringstream
document_xml_
;
std
::
wstringstream
styles_xml_
;
...
...
@@ -579,7 +587,6 @@ private:
hyperlinks
hyperlinks_
;
mediaitems
mediaitems_
;
styles_map
style_map_
;
styles_context
styles_context_
;
std
::
wstring
automatic_parent_style_
;
...
...
ASCOfficeOdfFile/src/docx/docx_package.cpp
View file @
9ea214e1
...
...
@@ -265,7 +265,6 @@ namespace
xmlns:wpg=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingGroup
\"
\
xmlns:wps=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingShape
\"
\
xmlns:wpc=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas
\"
\
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
\
xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
\
xmlns:wne=
\"
http://schemas.microsoft.com/office/word/2006/wordml
\"
\
xmlns:a14=
\"
http://schemas.microsoft.com/office/drawing/2010/main
\"
>"
;
...
...
ASCOfficeOdfFile/src/odf/all_elements.h
View file @
9ea214e1
...
...
@@ -12,6 +12,7 @@
#include "office_binary_data.h"
#include "math_elements.h"
#include "text_elements.h"
#include "list.h"
#include "style_text_properties.h"
...
...
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
View file @
9ea214e1
...
...
@@ -168,7 +168,24 @@ void chart_build::docx_convert(oox::docx_conversion_context & Context)
}
else
if
(
object_type_
==
3
&&
office_math_
)
{
oox
::
docx_conversion_context
::
StreamsManPtr
prev
=
Context
.
get_stream_man
();
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
)
));
bool
runState
=
Context
.
get_run_state
();
Context
.
set_run_state
(
false
);
bool
pState
=
Context
.
get_paragraph_state
();
Context
.
set_paragraph_state
(
false
);
bool
graphic_parent
=
false
;
office_math_
->
docx_convert
(
Context
);
Context
.
get_drawing_context
().
get_text_stream_frame
()
=
temp_stream
.
str
();
Context
.
set_stream_man
(
prev
);
Context
.
set_run_state
(
runState
);
Context
.
set_paragraph_state
(
pState
);
}
}
void
chart_build
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
...
...
@@ -235,7 +252,7 @@ void chart_build::oox_convert(oox::oox_chart_context & chart)
BOOST_FOREACH
(
series
&
s
,
series_
)
{
if
(
s
.
class_
!=
last_set_type
)
if
(
s
.
class_
!=
last_set_type
)
{
// - .
chart
.
add_chart
(
s
.
class_
);
last_set_type
=
s
.
class_
;
...
...
@@ -249,8 +266,9 @@ void chart_build::oox_convert(oox::oox_chart_context & chart)
current
->
add_series
(
series_id
++
);
if
(
s
.
cell_range_address_
.
length
()
<
1
)
s
.
cell_range_address_
=
plot_area_
.
cell_range_address_
;
//SplitByColumn(ind_ser,range);
//SplitByRow(ind_ser,range)
if
(
s
.
cell_range_address_
.
length
()
<
1
)
s
.
cell_range_address_
=
plot_area_
.
cell_range_address_
;
//SplitByColumn (ind_ser,range);
//SplitByRow (ind_ser,range);
// - -
// -
//
...
...
@@ -259,7 +277,7 @@ void chart_build::oox_convert(oox::oox_chart_context & chart)
std
::
vector
<
std
::
wstring
>
cell_cash
;
calc_cash_series
(
s
.
cell_range_address_
,
cell_cash
);
if
(
domain_cell_range_adress_
.
length
()
>
0
)
if
(
domain_cell_range_adress_
.
length
()
>
0
)
{
std
::
vector
<
std
::
wstring
>
domain_cash
;
...
...
@@ -425,11 +443,12 @@ void process_build_chart::visit(office_text& val)
chart_build_
.
object_type_
=
2
;
chart_build_
.
office_text_
=
&
val
;
//
}
void
process_build_chart
::
visit
(
const
math
&
val
)
void
process_build_chart
::
visit
(
office_
math
&
val
)
{
chart_build_
.
object_type_
=
3
;
//chart_build_.math_semantics_ = &val.semantics_
;//
chart_build_
.
office_math_
=
&
val
;
//
}
void
process_build_chart
::
visit
(
const
chart_chart
&
val
)
{
chart_build_
.
object_type_
=
1
;
...
...
ASCOfficeOdfFile/src/odf/chart_build_oox.h
View file @
9ea214e1
...
...
@@ -121,7 +121,7 @@ public:
int
object_type_
;
office_text
*
office_text_
;
math
*
office_math_
;
office_math
*
office_math_
;
std
::
wstring
str_class_
;
chart
::
class_type
class_
;
...
...
@@ -177,10 +177,8 @@ class process_build_chart : public base_visitor,
public
visitor
<
office_body
>
,
public
visitor
<
office_chart
>
,
public
visitor
<
office_text
>
,
public
const_visitor
<
math
>
,
public
visitor
<
office_math
>
,
public
const_visitor
<
chart_chart
>
,
...
...
@@ -248,10 +246,12 @@ private:
public:
virtual
void
visit
(
const
office_document_content
&
val
);
virtual
void
visit
(
office_body
&
val
);
virtual
void
visit
(
office_chart
&
val
);
virtual
void
visit
(
office_text
&
val
);
virtual
void
visit
(
const
math
&
val
);
virtual
void
visit
(
office_body
&
val
);
virtual
void
visit
(
office_chart
&
val
);
virtual
void
visit
(
office_text
&
val
);
virtual
void
visit
(
office_math
&
val
);
virtual
void
visit
(
const
chart_chart
&
val
);
virtual
void
visit
(
const
chart_title
&
val
);
virtual
void
visit
(
const
chart_subtitle
&
val
);
...
...
ASCOfficeOdfFile/src/odf/draw_frame.cpp
View file @
9ea214e1
...
...
@@ -152,8 +152,8 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes )
void
draw_frame
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
if
(
CP_CHECK_NAME
(
L"draw"
,
L"text-box"
)
||
CP_CHECK_NAME
(
L"draw"
,
L"image"
)
||
// ..
CP_CHECK_NAME
(
L"draw"
,
L"object"
)
||
//
CP_CHECK_NAME
(
L"draw"
,
L"image"
)
||
// ..
CP_CHECK_NAME
(
L"draw"
,
L"object"
)
||
//
embedded
CP_CHECK_NAME
(
L"draw"
,
L"object-ole"
)
||
CP_CHECK_NAME
(
L"draw"
,
L"applet"
)
||
CP_CHECK_NAME
(
L"draw"
,
L"floating-frame"
)
||
...
...
ASCOfficeOdfFile/src/odf/draw_frame.h
View file @
9ea214e1
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
9ea214e1
...
...
@@ -726,9 +726,13 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
std
::
vector
<
const
odf_reader
::
style_instance
*>
instances
;
odf_reader
::
style_instance
*
styleInst
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_by_name
(
styleName
,
odf_types
::
style_family
::
Graphic
,
Context
.
process_headers_footers_
);
if
(
styleInst
)
{
if
(
drawing
.
sub_type
>
0
)
{
style_instance
*
defaultStyle
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_default_by_type
(
odf_types
::
style_family
::
Graphic
);
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
}
instances
.
push_back
(
styleInst
);
}
graphic_format_properties
graphicProperties
=
calc_graphic_properties_content
(
instances
);
...
...
@@ -778,6 +782,9 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
if
(
!
drawing
.
isInline
)
{
if
(
!
drawing
.
styleWrap
)
drawing
.
styleWrap
=
style_wrap
(
style_wrap
::
Parallel
);
//
drawing
.
relativeHeight
=
L"2"
;
drawing
.
behindDoc
=
L"0"
;
...
...
@@ -1228,7 +1235,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
cpdoccore
::
odf_reader
::
odf_document
objectSubDoc
(
objectPath
,
NULL
);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
const
office_element
*
contentSubDoc
=
objectSubDoc
.
get_impl
()
->
get_content
();
office_element
*
contentSubDoc
=
objectSubDoc
.
get_impl
()
->
get_content
();
if
(
!
contentSubDoc
)
return
;
...
...
@@ -1237,14 +1244,13 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
contentSubDoc
->
accept
(
process_build_object_
);
objectBuild
.
docx_convert
(
Context
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if
(
objectBuild
.
object_type_
==
1
)
//
{
//
const
draw_frame
*
frame
=
Context
.
get_drawing_context
().
get_current_frame
();
//owner
draw_frame
*
frame
=
Context
.
get_drawing_context
().
get_current_frame
();
//owner
if
(
!
frame
)
return
;
//------------------------------------------------------------------------------------------------------------
if
(
objectBuild
.
object_type_
==
1
)
//
{
oox
::
_docx_drawing
drawing
=
oox
::
_docx_drawing
();
drawing
.
type
=
oox
::
mediaitems
::
typeChart
;
...
...
@@ -1253,7 +1259,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
bool
isMediaInternal
=
true
;
drawing
.
chartId
=
Context
.
add_mediaitem
(
href
,
oox
::
mediaitems
::
typeChart
,
isMediaInternal
,
href
);
drawing
.
chartId
=
Context
.
add_mediaitem
(
href
,
drawing
.
type
,
isMediaInternal
,
href
);
common_draw_docx_convert
(
Context
,
frame
->
common_draw_attlists_
,
drawing
);
...
...
@@ -1263,18 +1269,64 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
Context
.
set_run_state
(
false
);
Context
.
set_paragraph_state
(
false
);
std
::
wostream
&
strm
=
Context
.
output_stream
();
Context
.
add_new_run
(
_T
(
""
));
docx_serialize
(
Context
.
output_stream
(),
drawing
);
Context
.
finish_run
();
Context
.
set_run_state
(
runState
);
Context
.
set_paragraph_state
(
pState
);
}
else
if
(
objectBuild
.
object_type_
==
3
)
//
{
oox
::
_docx_drawing
drawing
=
oox
::
_docx_drawing
();
drawing
.
type
=
oox
::
mediaitems
::
typeShape
;
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
common_draw_docx_convert
(
Context
,
frame
->
common_draw_attlists_
,
drawing
);
const
std
::
wstring
&
content
=
Context
.
get_drawing_context
().
get_text_stream_frame
();
bool
runState
=
Context
.
get_run_state
();
bool
pState
=
Context
.
get_paragraph_state
();
if
(
drawing
.
isInline
)
{
if
(
runState
)
Context
.
finish_run
();
if
(
pState
==
false
)
{
Context
.
output_stream
()
<<
L"<m:oMathPara>"
;
Context
.
output_stream
()
<<
L"<m:oMathParaPr/>"
;
}
Context
.
output_stream
()
<<
content
;
if
(
pState
==
false
)
{
Context
.
output_stream
()
<<
L"</m:oMathPara>"
;
}
if
(
runState
)
Context
.
add_new_run
(
_T
(
""
));
}
else
{
//in frame
drawing
.
additional
.
push_back
(
_property
(
L"text-content"
,
std
::
wstring
(
L"<w:p>"
)
+
content
+
L"</w:p>"
));
Context
.
set_run_state
(
false
);
Context
.
set_paragraph_state
(
false
);
Context
.
add_new_run
(
_T
(
""
));
docx_serialize
(
strm
,
drawing
);
docx_serialize
(
Context
.
output_stream
()
,
drawing
);
Context
.
finish_run
();
Context
.
set_run_state
(
runState
);
Context
.
set_paragraph_state
(
pState
);
}
else
if
(
objectBuild
.
object_type_
==
0
||
objectBuild
.
object_type_
==
3
)
Context
.
get_drawing_context
().
clear_stream_frame
();
}
else
if
(
objectBuild
.
object_type_
==
0
)
{
// - ( )
...
...
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
View file @
9ea214e1
...
...
@@ -246,8 +246,8 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
try
{
const
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
odf_reader
::
odf_document
::
Impl
*
odfImpl
=
Context
.
root
()
->
get_impl
();
const
std
::
wstring
folderPath
=
odfImpl
->
get_folder
();
odf_reader
::
odf_document
*
odf_reader
=
Context
.
root
();
std
::
wstring
folderPath
=
odf_reader
->
get_folder
();
std
::
wstring
objectPath
=
folderPath
+
FILE_SEPARATOR_STR
+
href
;
...
...
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
View file @
9ea214e1
...
...
@@ -214,9 +214,9 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
try
{
const
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
odf_reader
::
odf_document
::
Impl
*
odfImpl
=
Context
.
root
()
->
get_impl
();
odf_reader
::
odf_document
*
odf_reader
=
Context
.
root
();
std
::
wstring
folderPath
=
odf
Impl
->
get_folder
();
std
::
wstring
folderPath
=
odf
_reader
->
get_folder
();
std
::
wstring
objectPath
=
folderPath
+
FILE_SEPARATOR_STR
+
href
;
// normalize path ???? todooo
...
...
@@ -231,7 +231,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
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
().
styleContainer
(),
objectSubDoc
.
odf_context
().
drawStyles
()
);
contentSubDoc
->
accept
(
process_build_object_
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
ASCOfficeOdfFile/src/odf/font_face.h
View file @
9ea214e1
...
...
@@ -11,7 +11,6 @@
#include "datatypes/fontvariant.h"
#include "datatypes/fontweight.h"
#include "datatypes/fontstretch.h"
#include "datatypes/length.h"
#include "datatypes/fontfamilygeneric.h"
#include "datatypes/fontpitch.h"
...
...
ASCOfficeOdfFile/src/odf/math_elementaries.cpp
0 → 100644
View file @
9ea214e1
#include "math_elementaries.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace
cpdoccore
{
using
namespace
odf_types
;
namespace
odf_reader
{
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mstack
::
ns
=
L"math"
;
const
wchar_t
*
math_mstack
::
name
=
L"mstack"
;
//----------------------------------------------------------------------------------------------------
void
math_mstack
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mstack
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mstack
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_msrow
::
ns
=
L"math"
;
const
wchar_t
*
math_msrow
::
name
=
L"msrow"
;
//----------------------------------------------------------------------------------------------------
void
math_msrow
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_msrow
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_msrow
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_msline
::
ns
=
L"math"
;
const
wchar_t
*
math_msline
::
name
=
L"msline"
;
//----------------------------------------------------------------------------------------------------
void
math_msline
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_msline
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_msline
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_msgroup
::
ns
=
L"math"
;
const
wchar_t
*
math_msgroup
::
name
=
L"msgroup"
;
//----------------------------------------------------------------------------------------------------
void
math_msgroup
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_msgroup
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_msgroup
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_mlongdiv
::
ns
=
L"math"
;
const
wchar_t
*
math_mlongdiv
::
name
=
L"mlongdiv"
;
//----------------------------------------------------------------------------------------------------
void
math_mlongdiv
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mlongdiv
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mlongdiv
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_mscarry
::
ns
=
L"math"
;
const
wchar_t
*
math_mscarry
::
name
=
L"mscarry"
;
//----------------------------------------------------------------------------------------------------
void
math_mscarry
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mscarry
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mscarry
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_mscarries
::
ns
=
L"math"
;
const
wchar_t
*
math_mscarries
::
name
=
L"mscarries"
;
//----------------------------------------------------------------------------------------------------
void
math_mscarries
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mscarries
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mscarries
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
}
}
ASCOfficeOdfFile/src/odf/math_elementaries.h
0 → 100644
View file @
9ea214e1
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
namespace
cpdoccore
{
namespace
odf_reader
{
class
math_mstack
:
public
office_element_impl
<
math_mstack
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMStack
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mstack
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mstack
);
//--------------------------------------------------------------------
class
math_msrow
:
public
office_element_impl
<
math_msrow
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSRow
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_msrow
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_msrow
);
//--------------------------------------------------------------------
class
math_msline
:
public
office_element_impl
<
math_msline
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSLine
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_msline
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_msline
);
//--------------------------------------------------------------------
class
math_mlongdiv
:
public
office_element_impl
<
math_mlongdiv
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSLongDiv
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mlongdiv
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mlongdiv
);
//--------------------------------------------------------------------
class
math_mscarries
:
public
office_element_impl
<
math_mscarries
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSCarries
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mscarries
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mscarries
);
//--------------------------------------------------------------------
class
math_msgroup
:
public
office_element_impl
<
math_msgroup
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSGroup
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_msgroup
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_msgroup
);
//--------------------------------------------------------------------
class
math_mscarry
:
public
office_element_impl
<
math_mscarry
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSCarry
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mscarry
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mscarry
);
//--------------------------------------------------------------------
}
}
ASCOfficeOdfFile/src/odf/math_elements.cpp
View file @
9ea214e1
...
...
@@ -13,40 +13,127 @@ namespace cpdoccore {
namespace
odf_reader
{
// math
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
math
::
ns
=
L""
;
const
wchar_t
*
math
::
name
=
L"math"
;
// math:math
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
math_math
::
ns
=
L"math"
;
const
wchar_t
*
math_math
::
name
=
L"math"
;
//---------------------------------------------------------------
const
wchar_t
*
office_math
::
ns
=
L"math"
;
const
wchar_t
*
office_math
::
name
=
L"math"
;
void
math
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
//----------------------------------------------------------------------------------------------------
void
office_math
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
office_math
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
if
CP_CHECK_NAME1
(
L"semantics"
)
{
CP_CREATE_ELEMENT
(
semantics_
);
}
}
void
office_math
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
semantics_
)
semantics_
->
docx_convert
(
Context
);
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_semantics
::
ns
=
L"math"
;
const
wchar_t
*
math_semantics
::
name
=
L"semantics"
;
//----------------------------------------------------------------------------------------------------
void
math_semantics
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_semantics
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
if
CP_CHECK_NAME1
(
L"annotation"
)
{
CP_CREATE_ELEMENT
(
annotation_
);
}
else
CP_CREATE_ELEMENT
(
content_
);
}
void
math_semantics
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
Context
.
start_math_formula
();
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
docx_convert
(
Context
);
}
Context
.
end_math_formula
();
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_annotation
::
ns
=
L"math"
;
const
wchar_t
*
math_annotation
::
name
=
L"annotation"
;
//----------------------------------------------------------------------------------------------------
void
math_annotation
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
// ver 2
CP_APPLY_ATTR
(
L"math:encoding"
,
encoding_
);
// ver 3
if
(
!
encoding_
)
CP_APPLY_ATTR
(
L"encoding"
,
encoding_
);
}
void
math
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
void
math
_annotation
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_NOT_APPLICABLE_ELM
();
CP_CREATE_ELEMENT
(
content_
);
}
void
math_annotation
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
void
math
_annotation
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
void
math
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_annotation_xml
::
ns
=
L"math"
;
const
wchar_t
*
math_annotation_xml
::
name
=
L"annotation-xml"
;
//----------------------------------------------------------------------------------------------------
void
math_annotation_xml
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
// ver 2
CP_APPLY_ATTR
(
L"math:encoding"
,
encoding_
);
// ver 3
if
(
!
encoding_
)
CP_APPLY_ATTR
(
L"encoding"
,
encoding_
);
}
void
math
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
void
math_annotation_xml
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_annotation_xml
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math_annotation_xml
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
}
}
ASCOfficeOdfFile/src/odf/math_elements.h
View file @
9ea214e1
#pragma once
#include "math_elementaries.h"
#include "math_token_elements.h"
#include "math_table_elements.h"
#include "math_limit_elements.h"
#include "math_layout_elements.h"
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
...
...
@@ -10,7 +16,7 @@
namespace
cpdoccore
{
namespace
odf_reader
{
class
math
:
public
office_element_impl
<
math
>
class
office_math
:
public
office_element_impl
<
office_
math
>
{
public:
static
const
wchar_t
*
ns
;
...
...
@@ -21,33 +27,101 @@ public:
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr
semantics_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math
);
CP_REGISTER_OFFICE_ELEMENT2
(
office_
math
);
CP_REGISTER_OFFICE_ELEMENT3
(
office_math
);
//--------------------------------------------------------------------
class
math_
math
:
public
math
class
math_
semantics
:
public
office_element_impl
<
math_semantics
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMath
Math
;
static
const
ElementType
type
=
typeMath
Semantics
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
office_element_ptr
annotation_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_math
);
CP_REGISTER_OFFICE_ELEMENT2
(
math_semantics
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_semantics
);
//-------------------------------------------------------------------------------------------
class
math_annotation
:
public
office_element_impl
<
math_annotation
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMathAnnotation
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
encoding_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_annotation
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_annotation
);
//--------------------------------------------------------------------
class
math_annotation_xml
:
public
office_element_impl
<
math_annotation_xml
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMathAnnotationXml
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
_CP_OPT
(
std
::
wstring
)
encoding_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_annotation_xml
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_annotation_xml
);
//--------------------------------------------------------------------
}
}
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
0 → 100644
View file @
9ea214e1
#include "math_layout_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace
cpdoccore
{
using
namespace
odf_types
;
namespace
odf_reader
{
//---------------------------------------------------------------
const
wchar_t
*
math_mrow
::
ns
=
L"math"
;
const
wchar_t
*
math_mrow
::
name
=
L"mrow"
;
//----------------------------------------------------------------------------------------------------
void
math_mrow
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mrow
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mrow
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
docx_convert
(
Context
);
}
}
//---------------------------------------------------------------
const
wchar_t
*
math_mfrac
::
ns
=
L"math"
;
const
wchar_t
*
math_mfrac
::
name
=
L"mfrac"
;
//----------------------------------------------------------------------------------------------------
void
math_mfrac
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mfrac
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mfrac
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
content_
.
size
()
!=
2
)
{
return
;
}
Context
.
output_stream
()
<<
L"<m:f>"
;
Context
.
output_stream
()
<<
L"<m:num>"
;
content_
[
0
]
->
docx_convert
(
Context
);
Context
.
output_stream
()
<<
L"</m:num>"
;
Context
.
output_stream
()
<<
L"<m:den>"
;
content_
[
1
]
->
docx_convert
(
Context
);
Context
.
output_stream
()
<<
L"</m:den>"
;
Context
.
output_stream
()
<<
L"</m:f>"
;
}
//---------------------------------------------------------------
const
wchar_t
*
math_msqrt
::
ns
=
L"math"
;
const
wchar_t
*
math_msqrt
::
name
=
L"msqrt"
;
//----------------------------------------------------------------------------------------------------
void
math_msqrt
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_msqrt
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_msqrt
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
docx_convert
(
Context
);
}
}
//---------------------------------------------------------------
const
wchar_t
*
math_mroot
::
ns
=
L"math"
;
const
wchar_t
*
math_mroot
::
name
=
L"mroot"
;
//----------------------------------------------------------------------------------------------------
void
math_mroot
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mroot
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mroot
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_mstyle
::
ns
=
L"math"
;
const
wchar_t
*
math_mstyle
::
name
=
L"mstyle"
;
//----------------------------------------------------------------------------------------------------
void
math_mstyle
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
// ver 2
CP_APPLY_ATTR
(
L"math:fontweight"
,
fontweight_
);
// ver 3
if
(
!
fontweight_
)
CP_APPLY_ATTR
(
L"fontweight"
,
fontweight_
);
}
void
math_mstyle
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mstyle
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
docx_convert
(
Context
);
}
}
//---------------------------------------------------------------
const
wchar_t
*
math_menclose
::
ns
=
L"math"
;
const
wchar_t
*
math_menclose
::
name
=
L"menclose"
;
//----------------------------------------------------------------------------------------------------
void
math_menclose
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
//// ver 2
// CP_APPLY_ATTR(L"math:fontweight", fontweight_);
//
//// ver 3
// if (!fontweight_) CP_APPLY_ATTR( L"fontweight", fontweight_);
}
void
math_menclose
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_menclose
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
//BOOST_FOREACH(const office_element_ptr & elm, content_)
//{
// elm->docx_convert(Context);
//}
}
//---------------------------------------------------------------
const
wchar_t
*
math_mfenced
::
ns
=
L"math"
;
const
wchar_t
*
math_mfenced
::
name
=
L"mfenced"
;
//----------------------------------------------------------------------------------------------------
void
math_mfenced
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
//// ver 2
// CP_APPLY_ATTR(L"math:fontweight", fontweight_);
//
//// ver 3
// if (!fontweight_) CP_APPLY_ATTR( L"fontweight", fontweight_);
}
void
math_mfenced
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mfenced
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
//BOOST_FOREACH(const office_element_ptr & elm, content_)
//{
// elm->docx_convert(Context);
//}
}
//---------------------------------------------------------------
const
wchar_t
*
math_mpadded
::
ns
=
L"mpadded"
;
const
wchar_t
*
math_mpadded
::
name
=
L"mpadded"
;
//----------------------------------------------------------------------------------------------------
void
math_mpadded
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
//// ver 2
// CP_APPLY_ATTR(L"math:fontweight", fontweight_);
//
//// ver 3
// if (!fontweight_) CP_APPLY_ATTR( L"fontweight", fontweight_);
}
void
math_mpadded
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mpadded
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
}
}
ASCOfficeOdfFile/src/odf/math_layout_elements.h
0 → 100644
View file @
9ea214e1
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
#include "datatypes/fontstyle.h"
#include "datatypes/fontweight.h"
namespace
cpdoccore
{
using
namespace
odf_types
;
namespace
odf_reader
{
class
math_mrow
:
public
office_element_impl
<
math_mrow
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMRow
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mrow
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mrow
);
//--------------------------------------------------------------------------------------
class
math_mfrac
:
public
office_element_impl
<
math_mfrac
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMFrac
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
//2 elements
_CP_OPT
(
length
)
linethickness
;
//numalign left, central,right
//denomalign
_CP_OPT
(
Bool
)
bevelled
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mfrac
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mfrac
);
//--------------------------------------------------------------------------------------
class
math_msqrt
:
public
office_element_impl
<
math_msqrt
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSqrt
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_msqrt
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_msqrt
);
//--------------------------------------------------------------------------------------
class
math_mroot
:
public
office_element_impl
<
math_mroot
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMRoot
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mroot
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mroot
);
//--------------------------------------------------------------------------------------
class
math_mstyle
:
public
office_element_impl
<
math_mstyle
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMStyle
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
_CP_OPT
(
font_weight
)
fontweight_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mstyle
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mstyle
);
//--------------------------------------------------------------------------------------
class
math_menclose
:
public
office_element_impl
<
math_menclose
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMEnClose
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_menclose
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_menclose
);
//--------------------------------------------------------------------------------------
class
math_mfenced
:
public
office_element_impl
<
math_mfenced
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMFenced
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mfenced
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mfenced
);
//--------------------------------------------------------------------------------------
class
math_mpadded
:
public
office_element_impl
<
math_mpadded
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMPadded
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mpadded
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mpadded
);
//--------------------------------------------------------------------------------------
//merror
//mphantom
}
}
ASCOfficeOdfFile/src/odf/math_limit_elements.cpp
0 → 100644
View file @
9ea214e1
#include "math_limit_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace
cpdoccore
{
using
namespace
odf_types
;
namespace
odf_reader
{
//---------------------------------------------------------------
const
wchar_t
*
math_msub
::
ns
=
L"math"
;
const
wchar_t
*
math_msub
::
name
=
L"msub"
;
//----------------------------------------------------------------------------------------------------
void
math_msub
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_msub
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
//<msub> base subscript </msub>
CP_CREATE_ELEMENT
(
content_
);
}
void
math_msub
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
content_
.
size
()
!=
2
)
{
return
;
//todooo
}
std
::
wostream
&
strm
=
Context
.
output_stream
();
strm
<<
L"<m:sSub>"
;
strm
<<
L"<m:e>"
;
content_
[
0
]
->
docx_convert
(
Context
);
strm
<<
L"</m:e>"
;
strm
<<
L"<m:sub>"
;
content_
[
1
]
->
docx_convert
(
Context
);
strm
<<
L"</m:sub>"
;
strm
<<
L"</m:sSub>"
;
}
//---------------------------------------------------------------
const
wchar_t
*
math_msup
::
ns
=
L"math"
;
const
wchar_t
*
math_msup
::
name
=
L"msup"
;
//----------------------------------------------------------------------------------------------------
void
math_msup
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_msup
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_msup
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
content_
.
size
()
!=
2
)
{
return
;
//todooo
}
std
::
wostream
&
strm
=
Context
.
output_stream
();
strm
<<
L"<m:sSup>"
;
strm
<<
L"<m:e>"
;
content_
[
0
]
->
docx_convert
(
Context
);
strm
<<
L"</m:e>"
;
strm
<<
L"<m:sup>"
;
content_
[
1
]
->
docx_convert
(
Context
);
strm
<<
L"</m:sup>"
;
strm
<<
L"</m:sSup>"
;
}
//---------------------------------------------------------------
const
wchar_t
*
math_msubsup
::
ns
=
L"math"
;
const
wchar_t
*
math_msubsup
::
name
=
L"msubsup"
;
//----------------------------------------------------------------------------------------------------
void
math_msubsup
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_msubsup
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_msubsup
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_none
::
ns
=
L"math"
;
const
wchar_t
*
math_none
::
name
=
L"none"
;
//----------------------------------------------------------------------------------------------------
void
math_none
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_none
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_none
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_mprescripts
::
ns
=
L"math"
;
const
wchar_t
*
math_mprescripts
::
name
=
L"mprescripts"
;
//----------------------------------------------------------------------------------------------------
void
math_mprescripts
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mprescripts
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mprescripts
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_mmultiscripts
::
ns
=
L"math"
;
const
wchar_t
*
math_mmultiscripts
::
name
=
L"mmultiscripts"
;
//----------------------------------------------------------------------------------------------------
void
math_mmultiscripts
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mmultiscripts
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mmultiscripts
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_munderover
::
ns
=
L"math"
;
const
wchar_t
*
math_munderover
::
name
=
L"munderover"
;
//----------------------------------------------------------------------------------------------------
void
math_munderover
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_munderover
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_munderover
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_mover
::
ns
=
L"math"
;
const
wchar_t
*
math_mover
::
name
=
L"mover"
;
//----------------------------------------------------------------------------------------------------
void
math_mover
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mover
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mover
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//---------------------------------------------------------------
const
wchar_t
*
math_munder
::
ns
=
L"math"
;
const
wchar_t
*
math_munder
::
name
=
L"munder"
;
//----------------------------------------------------------------------------------------------------
void
math_munder
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_munder
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_munder
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
}
}
ASCOfficeOdfFile/src/odf/math_limit_elements.h
0 → 100644
View file @
9ea214e1
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
namespace
cpdoccore
{
namespace
odf_reader
{
class
math_msub
:
public
office_element_impl
<
math_msub
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSub
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_msub
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_msub
);
//--------------------------------------------------------------------
class
math_msup
:
public
office_element_impl
<
math_msup
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSup
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_msup
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_msup
);
//--------------------------------------------------------------------
class
math_msubsup
:
public
office_element_impl
<
math_msubsup
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSubSup
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_msubsup
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_msubsup
);
//--------------------------------------------------------------------
class
math_none
:
public
office_element_impl
<
math_none
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMNone
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_none
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_none
);
//--------------------------------------------------------------------
class
math_mprescripts
:
public
office_element_impl
<
math_mprescripts
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMPreScripts
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mprescripts
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mprescripts
);
//--------------------------------------------------------------------
class
math_mmultiscripts
:
public
office_element_impl
<
math_mmultiscripts
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMMultiScripts
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mmultiscripts
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mmultiscripts
);
//--------------------------------------------------------------------
class
math_munderover
:
public
office_element_impl
<
math_munderover
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMUnderOver
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_munderover
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_munderover
);
//--------------------------------------------------------------------
class
math_mover
:
public
office_element_impl
<
math_mover
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMOver
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mover
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mover
);
//--------------------------------------------------------------------
class
math_munder
:
public
office_element_impl
<
math_munder
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMUnder
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_munder
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_munder
);
//--------------------------------------------------------------------
}
}
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
0 → 100644
View file @
9ea214e1
#include "math_table_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace
cpdoccore
{
using
namespace
odf_types
;
namespace
odf_reader
{
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mtable
::
ns
=
L"math"
;
const
wchar_t
*
math_mtable
::
name
=
L"mtable"
;
//----------------------------------------------------------------------------------------------------
void
math_mtable
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mtable
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mtable
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mtr
::
ns
=
L"math"
;
const
wchar_t
*
math_mtr
::
name
=
L"mtr"
;
//----------------------------------------------------------------------------------------------------
void
math_mtr
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mtr
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mtr
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mlabeledtr
::
ns
=
L"math"
;
const
wchar_t
*
math_mlabeledtr
::
name
=
L"mlabeledtr"
;
//----------------------------------------------------------------------------------------------------
void
math_mlabeledtr
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mlabeledtr
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mlabeledtr
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mtd
::
ns
=
L"math"
;
const
wchar_t
*
math_mtd
::
name
=
L"mtd"
;
//----------------------------------------------------------------------------------------------------
void
math_mtd
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mtd
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mtd
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_maligngroup
::
ns
=
L"math"
;
const
wchar_t
*
math_maligngroup
::
name
=
L"maligngroup"
;
//----------------------------------------------------------------------------------------------------
void
math_maligngroup
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_maligngroup
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_maligngroup
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_malignmark
::
ns
=
L"math"
;
const
wchar_t
*
math_malignmark
::
name
=
L"malignmarke"
;
//----------------------------------------------------------------------------------------------------
void
math_malignmark
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_malignmark
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_malignmark
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
}
}
ASCOfficeOdfFile/src/odf/math_table_elements.h
0 → 100644
View file @
9ea214e1
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
namespace
cpdoccore
{
namespace
odf_reader
{
class
math_mtable
:
public
office_element_impl
<
math_mtable
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMTable
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mtable
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mtable
);
//--------------------------------------------------------------------
class
math_malignmark
:
public
office_element_impl
<
math_malignmark
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMAlignMark
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_malignmark
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_malignmark
);
//--------------------------------------------------------------------
class
math_maligngroup
:
public
office_element_impl
<
math_maligngroup
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMAlignGroup
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_maligngroup
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_maligngroup
);
//--------------------------------------------------------------------
class
math_mtd
:
public
office_element_impl
<
math_mtd
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMTd
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mtd
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mtd
);
//--------------------------------------------------------------------
class
math_mlabeledtr
:
public
office_element_impl
<
math_mlabeledtr
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMLabelEdTr
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mlabeledtr
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mlabeledtr
);
//--------------------------------------------------------------------
class
math_mtr
:
public
office_element_impl
<
math_mtr
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMTr
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mtr
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mtr
);
//--------------------------------------------------------------------
}
}
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
0 → 100644
View file @
9ea214e1
#include "math_token_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/utils.h>
namespace
cpdoccore
{
using
namespace
odf_types
;
namespace
odf_reader
{
//---------------------------------------------------------------
const
wchar_t
*
math_mi
::
ns
=
L"math"
;
const
wchar_t
*
math_mi
::
name
=
L"mi"
;
//----------------------------------------------------------------------------------------------------
void
math_mi
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mi
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mi
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math_mi
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
!
text_
)
return
;
std
::
wostream
&
strm
=
Context
.
output_stream
();
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"m:r"
)
{
CP_XML_NODE
(
L"w:rPr"
)
{
CP_XML_NODE
(
L"w:rFonts"
)
{
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_ATTR(L"xml:space", L"preserve");
CP_XML_STREAM
()
<<
xml
::
utils
::
replace_text_to_xml
(
*
text_
);
}
}
}
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mo
::
ns
=
L"math"
;
const
wchar_t
*
math_mo
::
name
=
L"mo"
;
//----------------------------------------------------------------------------------------------------
void
math_mo
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mo
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mo
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math_mo
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
!
text_
)
return
;
std
::
wostream
&
strm
=
Context
.
output_stream
();
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"m:r"
)
{
CP_XML_NODE
(
L"w:rPr"
)
{
CP_XML_NODE
(
L"w:rFonts"
)
{
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_ATTR(L"xml:space", L"preserve");
CP_XML_STREAM
()
<<
xml
::
utils
::
replace_text_to_xml
(
*
text_
);
}
}
}
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mn
::
ns
=
L"math"
;
const
wchar_t
*
math_mn
::
name
=
L"mn"
;
//----------------------------------------------------------------------------------------------------
void
math_mn
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mn
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mn
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math_mn
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
!
text_
)
return
;
std
::
wostream
&
strm
=
Context
.
output_stream
();
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"m:r"
)
{
CP_XML_NODE
(
L"w:rPr"
)
{
CP_XML_NODE
(
L"w:rFonts"
)
{
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_ATTR(L"xml:space", L"preserve");
CP_XML_STREAM
()
<<
xml
::
utils
::
replace_text_to_xml
(
*
text_
);
}
}
}
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_ms
::
ns
=
L"math"
;
const
wchar_t
*
math_ms
::
name
=
L"ms"
;
//----------------------------------------------------------------------------------------------------
void
math_ms
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_ms
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_ms
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math_ms
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mspace
::
ns
=
L"math"
;
const
wchar_t
*
math_mspace
::
name
=
L"mspace"
;
//----------------------------------------------------------------------------------------------------
void
math_mspace
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mspace
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mspace
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math_mspace
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mtext
::
ns
=
L"math"
;
const
wchar_t
*
math_mtext
::
name
=
L"mtext"
;
//----------------------------------------------------------------------------------------------------
void
math_mtext
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mtext
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mtext
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math_mtext
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
//----------------------------------------------------------------------------------------------------
const
wchar_t
*
math_mglyph
::
ns
=
L"math"
;
const
wchar_t
*
math_mglyph
::
name
=
L"mglyph"
;
//----------------------------------------------------------------------------------------------------
void
math_mglyph
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
}
void
math_mglyph
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
math_mglyph
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
void
math_mglyph
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
}
}
}
ASCOfficeOdfFile/src/odf/math_token_elements.h
0 → 100644
View file @
9ea214e1
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
namespace
cpdoccore
{
namespace
odf_reader
{
class
math_mi
:
public
office_element_impl
<
math_mi
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMI
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mi
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mi
);
//--------------------------------------------------------------------
class
math_mo
:
public
office_element_impl
<
math_mo
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMO
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mo
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mo
);
//--------------------------------------------------------------------
class
math_mn
:
public
office_element_impl
<
math_mn
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMN
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mn
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mn
);
//--------------------------------------------------------------------
class
math_mtext
:
public
office_element_impl
<
math_mtext
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMText
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mtext
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mtext
);
//--------------------------------------------------------------------
class
math_mspace
:
public
office_element_impl
<
math_mspace
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMSpace
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mspace
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mspace
);
//--------------------------------------------------------------------
class
math_ms
:
public
office_element_impl
<
math_ms
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMS
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_ms
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_ms
);
//--------------------------------------------------------------------
class
math_mglyph
:
public
office_element_impl
<
math_mglyph
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeMGlyph
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
){}
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
){}
private:
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_text
(
const
std
::
wstring
&
Text
);
office_element_ptr_array
content_
;
_CP_OPT
(
std
::
wstring
)
text_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
math_mglyph
);
CP_REGISTER_OFFICE_ELEMENT3
(
math_mglyph
);
//--------------------------------------------------------------------
}
}
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
View file @
9ea214e1
...
...
@@ -33,6 +33,7 @@
#include "templates.h"
#include "math_elements.h"
#include "paragraph_elements.h"
#include "text_elements.h"
...
...
@@ -678,5 +679,9 @@ const office_element * odf_document::Impl::get_content() const
return
content_xml_
->
get_content
();
}
office_element
*
odf_document
::
Impl
::
get_content
()
{
return
content_xml_
->
get_content
();
}
}
}
ASCOfficeOdfFile/src/odf/odf_document_impl.h
View file @
9ea214e1
...
...
@@ -31,7 +31,9 @@ public:
bool
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
const
std
::
wstring
&
get_folder
()
const
{
return
base_folder_
;
}
const
office_element
*
get_content
()
const
;
office_element
*
get_content
();
long
get_office_mime_type
()
{
return
office_mime_type_
;}
...
...
ASCOfficeOdfFile/src/odf/office_elements_create.h
View file @
9ea214e1
...
...
@@ -23,7 +23,12 @@ typedef shared_ptr<office_element>::Type office_element_ptr;
#define CP_REGISTER_OFFICE_ELEMENT2(A) \
namespace
{
\
RegisterElement
<
A
>
RegisterElement
##
A
;
\
RegisterElement
<
A
>
RegisterElement
##
A
(
true
);
\
}
#define CP_REGISTER_OFFICE_ELEMENT3(A) \
namespace
{
\
RegisterElement
<
A
>
RegisterElement1
##
A
(
false
);
\
}
class
office_element_creator
...
...
@@ -62,28 +67,40 @@ private:
public:
static
typename
shared_ptr
<
V
>::
Type
create
()
{
//return shared_ptr<T>::Type( new T() );
return
boost
::
make_shared
<
V
>
();
}
};
static
int
class_registered_
;
static
int
class_registered_1_
;
public:
RegisterElement
()
RegisterElement
(
bool
is_namespace
)
{
if
(
class_registered_
++
==
0
)
if
(
is_namespace
)
{
if
(
class_registered_
++
==
0
)
// Jerry Schwarz counter
{
// Jerry Schwarz counter
office_element_creator
::
get
()
->
register_element
(
T
::
ns
,
T
::
name
,
&
CreateImpl_
<
T
>::
create
);
}
}
else
{
if
(
class_registered_1_
++
==
0
)
{
std
::
wstring
ns_
;
office_element_creator
::
get
()
->
register_element
(
ns_
,
T
::
name
,
&
CreateImpl_
<
T
>::
create
);
}
}
}
~
RegisterElement
()
{
}
};
template
<
class
T
>
int
RegisterElement
<
T
>::
class_registered_
=
0
;
template
<
class
T
>
int
RegisterElement
<
T
>::
class_registered_
=
0
;
//with namespace
template
<
class
T
>
int
RegisterElement
<
T
>::
class_registered_1_
=
0
;
//without namespace
/// \brief SAX, shared_ptr
bool
create_element_and_read
(
xml
::
sax
*
Reader
,
...
...
@@ -107,6 +124,7 @@ bool create_element_and_read(xml::sax * Reader,
#define _CPDOCCORE_CREATE_ELEMENT_ROOT(ELEMENT) create_element_and_read(Reader, Ns, Name, (ELEMENT), getContext(), true)
#define CP_CHECK_NAME(NS, NAME) ((NS) == Ns && (NAME) == Name)
#define CP_CHECK_NAME1(NAME) ((NAME) == Name)
void
not_applicable_element
(
const
office_element
*
CurrentElm
,
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
void
not_applicable_element
(
const
std
::
wstring
&
Current
,
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
...
...
ASCOfficeOdfFile/src/odf/office_elements_type.h
View file @
9ea214e1
...
...
@@ -170,7 +170,48 @@ enum ElementType
typeOfficeDocumentSettings
,
typeMath
,
typeMathMath
,
typeMathSemantics
,
typeMathAnnotation
,
typeMathAnnotationXml
,
typeMN
,
typeMI
,
typeMS
,
typeMSpace
,
typeMO
,
typeMText
,
typeMGlyph
,
typeMSqrt
,
typeMRoot
,
typeMFrac
,
typeMRow
,
typeMStyle
,
typeMEnClose
,
typeMFenced
,
typeMPadded
,
typeMError
,
typeMPhantom
,
typeMTable
,
typeMAlignMark
,
typeMAlignGroup
,
typeMTd
,
typeMLabelEdTr
,
typeMTr
,
typeMSub
,
typeMSup
,
typeMSubSup
,
typeMNone
,
typeMPreScripts
,
typeMMultiScripts
,
typeMUnderOver
,
typeMOver
,
typeMUnder
,
typeMStack
,
typeMSRow
,
typeMSLine
,
typeMSCarry
,
typeMSCarries
,
typeMSGroup
,
typeMSLongDiv
,
typeManifest
,
typeManifestEntry
,
...
...
ASCOfficeOdfFile/src/odf/paragraph_elements.cpp
View file @
9ea214e1
...
...
@@ -52,7 +52,7 @@ const wchar_t * text::name = L"";
void
text
::
add_text
(
const
std
::
wstring
&
Text
)
{
text_
=
Text
;
}
;
}
void
text
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
...
...
@@ -347,7 +347,7 @@ void span::docx_convert(oox::docx_conversion_context & Context)
}
else
{
const
std
::
wstring
id
=
Context
.
get_style_map
()
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
const
std
::
wstring
id
=
Context
.
styles_map_
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
Context
.
add_new_run
(
id
);
addNewRun
=
true
;
}
...
...
@@ -465,7 +465,7 @@ void a::docx_convert(oox::docx_conversion_context & Context)
}
else
{
const
std
::
wstring
id
=
Context
.
get_style_map
()
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
const
std
::
wstring
id
=
Context
.
styles_map_
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
tempStyleTextProp
=
style_text_properties_ptr
(
new
style_text_properties
(
id
)
);
Context
.
push_text_properties
(
tempStyleTextProp
.
get
()
);
pushed
=
true
;
...
...
@@ -573,7 +573,7 @@ void note::docx_convert(oox::docx_conversion_context & Context)
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_by_name
(
styleName
,
style_family
::
Text
,
Context
.
process_headers_footers_
)
)
{
const
std
::
wstring
id
=
Context
.
get_style_map
()
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
const
std
::
wstring
id
=
Context
.
styles_map_
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
Context
.
add_new_run
(
id
);
addNewRun
=
true
;
}
...
...
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
View file @
9ea214e1
...
...
@@ -833,7 +833,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
if
(
style_text_position_
->
has_font_size
()
&&
!
noNeedSize
)
{
const
double
mul
=
style_text_position_
->
font_size
().
get_value
()
/
100.0
;
if
(
fontSizeVal
>
0
&&
mul
>
0
)
if
(
fontSizeVal
>
0
)
{
const
std
::
wstring
fontSize
=
boost
::
lexical_cast
<
std
::
wstring
>
((
int
)(
fontSizeVal
*
mul
+
0.5
));
if
(
!
fontSize
.
empty
())
...
...
@@ -870,8 +870,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
if
(
fontSize
>
0
)
{
std
::
wstring
str_fontSize
=
boost
::
lexical_cast
<
std
::
wstring
>
(
fontSize
);
_rPr
<<
L"<w:sz w:val=
\"
"
<<
str_fontSize
<<
"
\"
/>"
;
_rPr
<<
L"<w:sz w:val=
\"
"
<<
fontSize
<<
"
\"
/>"
;
}
}
...
...
ASCOfficeOdfFile/src/odf/styles.cpp
View file @
9ea214e1
...
...
@@ -1409,7 +1409,6 @@ xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\"
xmlns:wps=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingShape
\"
\
xmlns:wpc=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas
\"
\
xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
\
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
\
xmlns:wne=
\"
http://schemas.microsoft.com/office/word/2006/wordml
\"
\
xmlns:a=
\"
http://schemas.openxmlformats.org/drawingml/2006/main
\"
\
xmlns:v=
\"
urn:schemas-microsoft-com:vml
\"
\
...
...
@@ -1427,7 +1426,6 @@ xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wpg=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingGroup
\"
\
xmlns:wps=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingShape
\"
\
xmlns:wpc=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas
\"
\
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
\
xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
\
xmlns:wne=
\"
http://schemas.microsoft.com/office/word/2006/wordml
\"
\
xmlns:a=
\"
http://schemas.openxmlformats.org/drawingml/2006/main
\"
\
...
...
ASCOfficeOdfFile/src/odf/text_elements.cpp
View file @
9ea214e1
...
...
@@ -119,7 +119,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
std
::
wstring
id
;
if
(
const
style_instance
*
parentStyleContent
=
styleInst
->
parent
())
{
id
=
Context
.
get_style_map
()
.
get
(
parentStyleContent
->
name
(),
parentStyleContent
->
type
()
);
id
=
Context
.
styles_map_
.
get
(
parentStyleContent
->
name
(),
parentStyleContent
->
type
()
);
}
Context
.
start_automatic_style
(
id
);
...
...
@@ -153,7 +153,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
}
else
{
const
std
::
wstring
id
=
Context
.
get_style_map
()
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
const
std
::
wstring
id
=
Context
.
styles_map_
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
std
::
wostream
&
_Wostream
=
Context
.
output_stream
();
_Wostream
<<
L"<w:pPr>"
;
_Wostream
<<
Context
.
get_section_context
().
dump_
;
...
...
ASCOfficeOdfFile/win32/ASCOfficeOdfFile.sln
View file @
9ea214e1
...
...
@@ -5,12 +5,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml_wrapper", "cpxml.vcproj
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormatReaderLib", "cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}"
ProjectSection(ProjectDependencies) = postProject
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfCommon", "cpcommon.vcproj", "{609ED938-3CA8-4BED-B363-25096D4C4812}"
...
...
@@ -29,9 +28,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFile", "..\ASCO
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileTest", "..\Test\ASCOfficeOdfFileTest\ASCOfficeOdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{64B09C98-22DC-494E-A882-9E2D7D18557C} = {64B09C98-22DC-494E-A882-9E2D7D18557C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml2", "..\..\Common\DocxFormat\Source\XML\libxml2\win_build\libxml2.vcproj", "{21663823-DE45-479B-91D0-B4FEF4916EF0}"
EndProject
...
...
ASCOfficeOdfFile/win32/cpodf.vcproj
View file @
9ea214e1
...
...
@@ -1359,6 +1359,14 @@
RelativePath=
"..\src\odf\list.h"
>
</File>
<File
RelativePath=
"..\src\odf\math_elementaries.cpp"
>
</File>
<File
RelativePath=
"..\src\odf\math_elementaries.h"
>
</File>
<File
RelativePath=
"..\src\odf\math_elements.cpp"
>
...
...
@@ -1375,6 +1383,38 @@
RelativePath=
"..\src\odf\math_elements.h"
>
</File>
<File
RelativePath=
"..\src\odf\math_layout_elements.cpp"
>
</File>
<File
RelativePath=
"..\src\odf\math_layout_elements.h"
>
</File>
<File
RelativePath=
"..\src\odf\math_limit_elements.cpp"
>
</File>
<File
RelativePath=
"..\src\odf\math_limit_elements.h"
>
</File>
<File
RelativePath=
"..\src\odf\math_table_elements.cpp"
>
</File>
<File
RelativePath=
"..\src\odf\math_table_elements.h"
>
</File>
<File
RelativePath=
"..\src\odf\math_token_elements.cpp"
>
</File>
<File
RelativePath=
"..\src\odf\math_token_elements.h"
>
</File>
<File
RelativePath=
"..\src\odf\note.cpp"
>
...
...
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
View file @
9ea214e1
...
...
@@ -225,6 +225,9 @@ public:
COMMAND_RTF_INT
(
_T
(
"tscellpct"
),
oOutput
.
m_nValue
,
sCommand
,
hasParameter
,
parameter
)
else
return
false
;
if
(
sCommand
==
_T
(
"clshdng"
))
oReader
.
m_oState
->
m_oCellProperty
.
m_nShadingPctFrom
=
1
;
if
(
sCommand
==
_T
(
"clshdngraw"
))
oReader
.
m_oState
->
m_oCellProperty
.
m_nShadingPctFrom
=
2
;
return
true
;
}
};
...
...
@@ -1110,13 +1113,15 @@ class PictureReader: public RtfAbstractReader
}
};
private:
RtfShape
&
m_oShape
;
private:
RtfShape
&
m_oShape
;
CString
m_sFile
;
CString
m_sData
;
bool
m_bBin
;
BYTE
*
m_pbBin
;
int
m_nBinLength
;
public:
PictureReader
(
RtfReader
&
oReader
,
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
public:
PictureReader
(
RtfReader
&
oReader
,
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
{
m_bBin
=
false
;
m_pbBin
=
NULL
;
...
...
@@ -1188,14 +1193,15 @@ public: OleReader(RtfOle& oOle):m_oOle(oOle)
};
class
ShapeReader
:
public
RtfAbstractReader
{
class
ShapePropertyReader
:
public
RtfAbstractReader
class
ShapePropertyReader
:
public
RtfAbstractReader
{
class
ShapePropertyValueReader
:
public
RtfAbstractReader
{
CString
&
m_sPropName
;
CString
m_sPropValue
;
RtfShape
&
m_oShape
;
public:
ShapePropertyValueReader
(
CString
&
sPropName
,
RtfShape
&
oShape
)
:
m_sPropName
(
sPropName
),
m_oShape
(
oShape
)
public:
ShapePropertyValueReader
(
CString
&
sPropName
,
RtfShape
&
oShape
)
:
m_sPropName
(
sPropName
),
m_oShape
(
oShape
)
{
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
...
...
@@ -1422,9 +1428,11 @@ class ShapePropertyReader : public RtfAbstractReader
m_sPropValue
.
Append
(
sValue
);
}
};
private:
CString
sPropName
;
private:
CString
sPropName
;
RtfShape
&
m_oShape
;
public:
ShapePropertyReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
public:
ShapePropertyReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
{
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
...
...
@@ -1446,8 +1454,10 @@ class ShapePropertyReader : public RtfAbstractReader
return
true
;
}
};
private:
RtfShape
&
m_oShape
;
public:
ShapeReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
private:
RtfShape
&
m_oShape
;
public:
ShapeReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
{
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
);
...
...
@@ -1520,9 +1530,11 @@ public: ShapeReader( RtfShape& oShape ):m_oShape(oShape)
}
}
};
class
ShapeGroupReader
:
public
ShapeReader
{
public:
RtfShapeGroup
&
m_oShapeGroup
;
public:
RtfShapeGroup
&
m_oShapeGroup
;
bool
m_bHeader
;
//чтобы отличать заголовок от вложенных групп
ShapeGroupReader
(
RtfShapeGroup
&
oShape
)
:
ShapeReader
(
oShape
),
m_oShapeGroup
(
oShape
)
{
...
...
@@ -1556,8 +1568,10 @@ public: RtfShapeGroup& m_oShapeGroup;
};
class
ShppictReader
:
public
RtfAbstractReader
{
private:
RtfShape
&
m_oShape
;
public:
ShppictReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
private:
RtfShape
&
m_oShape
;
public:
ShppictReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
{
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
...
...
@@ -1583,9 +1597,12 @@ public: ShppictReader( RtfShape& oShape ):m_oShape(oShape)
}
};
class
AllPictReader
:
public
RtfAbstractReader
{
private:
RtfShape
&
m_oShape
;
public:
AllPictReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
class
AllPictReader
:
public
RtfAbstractReader
{
private:
RtfShape
&
m_oShape
;
public:
AllPictReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
{
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
...
...
@@ -1618,9 +1635,11 @@ public: AllPictReader( RtfShape& oShape ):m_oShape(oShape)
return
true
;
}
};
class
RtfMathPropReader
:
public
RtfAbstractReader
{
public:
RtfMathPropReader
(
)
public:
RtfMathPropReader
(
)
{
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
...
...
@@ -1712,8 +1731,10 @@ public: RtfMathPropReader( )
class
RtfMathReader
:
public
RtfAbstractReader
{
private:
RtfCharProperty
m_oCharProp
;
public:
RtfMath
&
m_oMath
;
private:
RtfCharProperty
m_oCharProp
;
public:
RtfMath
&
m_oMath
;
RtfParagraphProperty
::
ParagraphAlign
m_eParAlign
;
RtfMathReader
(
RtfMath
&
oMath
)
:
m_oMath
(
oMath
)
{
...
...
@@ -1808,10 +1829,12 @@ public: RtfMath& m_oMath;
};
class
FieldReader
:
public
RtfAbstractReader
{
private:
typedef
enum
{
is_normal
,
is_insert
,
is_datafield
,
is_formfield
,
is_result
}
InternalState
;
private:
typedef
enum
{
is_normal
,
is_insert
,
is_datafield
,
is_formfield
,
is_result
}
InternalState
;
InternalState
m_eInternalState
;
RtfField
&
m_oField
;
public:
FieldReader
(
RtfField
&
oField
)
:
m_oField
(
oField
)
public:
FieldReader
(
RtfField
&
oField
)
:
m_oField
(
oField
)
{
m_eInternalState
=
is_normal
;
}
...
...
@@ -1840,7 +1863,8 @@ public: FieldReader( RtfField& oField ):m_oField(oField)
}
return
true
;
}
private:
void
TryToPepairResult
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
private:
void
TryToPepairResult
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
OOXWriter
oTempWriter
(
oDocument
,
_T
(
""
)
);
OOXRelsWriter
oTempRelsWriter
(
_T
(
""
),
oDocument
);
...
...
@@ -1929,9 +1953,11 @@ private: void TryToPepairResult( RtfDocument& oDocument, RtfReader& oReader )
m_oField
.
m_bTextOnly
=
true
;
}
};
class
BookmarkStartReader
:
public
RtfAbstractReader
{
public:
RtfBookmarkStart
&
m_oBookmarkStart
;
public:
RtfBookmarkStart
&
m_oBookmarkStart
;
BookmarkStartReader
(
RtfBookmarkStart
&
oBookmark
)
:
m_oBookmarkStart
(
oBookmark
)
{
}
...
...
@@ -1957,11 +1983,12 @@ public: RtfBookmarkStart& m_oBookmarkStart;
{
m_oBookmarkStart
.
m_sName
.
Append
(
sText
);
}
};
class
BookmarkEndReader
:
public
RtfAbstractReader
{
public:
RtfBookmarkEnd
&
m_oBookmarkEnd
;
public:
RtfBookmarkEnd
&
m_oBookmarkEnd
;
BookmarkEndReader
(
RtfBookmarkEnd
&
oBookmark
)
:
m_oBookmarkEnd
(
oBookmark
)
{
}
...
...
@@ -1970,6 +1997,7 @@ public: RtfBookmarkEnd& m_oBookmarkEnd;
m_oBookmarkEnd
.
m_sName
.
Append
(
sText
);
}
};
class
FootnoteReader
;
//Destination имеет состояния
class
ParagraphPropDestination
// todo - последний параграф не обрабатывается
...
...
@@ -2061,103 +2089,6 @@ public:
ExecuteText
(
oDocument
,
oReader
,
sText
);
}
}
//void ParseToRenderable( std::vector< boost::shared_ptr<ITextItem> >& aOutArray )
//{
// std::vector< ITextItemPtr > aCellRenderables;
// std::vector< int > aItaps;
// std::vector< RtfTableCellPtr > aCells;
// std::vector< RtfTableRowPtr > aRows;
// int nCurItap = 0;//main document
// RtfRowProperty oCurRowProperty;
// //убрал -1 для последнего параграфа
// //todo подумать
// for( int i = 0; i < (int)m_aArray.size() - 1 ; i++ )
// {
// if( m_aArray[i]->m_oProperty.m_bInTable == false )
// {
// RtfParagraphPtr oNewParagraph( new RtfParagraph() );
// oNewParagraph->m_oProperty = m_aArray[i]->m_oProperty;
// for( int j = 0 ; j < (int)m_aArray[i]->GetCount(); j++ )
// {
// IDocumentElementPtr oCurElement;
// m_aArray[i]->GetItem( oCurElement, j );
// oNewParagraph->AddItem( oCurElement );
// }
// if( nCurItap > 0 ) //todo ==1
// {
// RtfTablePtr oNewTable( new RtfTable() );
// oNewTable->m_oProperty = oCurRowProperty;
// for( int i = 0; i < (int)aRows.size(); i++ )
// oNewTable->AddItem( aRows[i] );
// oNewTable->CalculateGridProp();
// aRows.clear();
// aOutArray.push_back( oNewTable );
// }
// aOutArray.push_back( oNewParagraph );
// nCurItap = m_aArray[i]->m_oProperty.m_nItap;
// }
// else
// {
// if( true == m_aArray[i]->m_bEndRow )
// {
// RtfTableRowPtr oNewTableRow( new RtfTableRow() );
// oNewTableRow->m_oProperty = m_aArray[i]->m_oProperty.m_oRowProperty;
// for( int i = 0; i < (int)aCells.size(); i++ )
// oNewTableRow->AddItem( aCells[i] );
// aCells.clear();
// aRows.push_back( oNewTableRow );
// }
// else
// {
// RtfParagraphPtr oTempPar( new RtfParagraph() );
// oTempPar->m_oProperty = m_aArray[i]->m_oProperty;
// for( int j = 0 ; j < (int)m_aArray[i]->GetCount(); j++ )
// {
// IDocumentElementPtr oCurElement;
// m_aArray[i]->GetItem( oCurElement, j );
// oTempPar->AddItem( oCurElement );
// }
// if( nCurItap > oTempPar->m_oProperty.m_nItap )
// {
// RtfTablePtr oNewTable( new RtfTable() );
// oNewTable->m_oProperty = oCurRowProperty;
// for( int k = 0; k < (int)aRows.size(); k++ )
// oNewTable->AddItem( aRows[k] );
// oNewTable->CalculateGridProp();
// aRows.clear();
// aCellRenderables.push_back( oNewTable );
// aItaps.push_back( oTempPar->m_oProperty.m_nItap );
// }
// nCurItap = oTempPar->m_oProperty.m_nItap;
// aCellRenderables.push_back( oTempPar );
// aItaps.push_back( nCurItap );
// if( true == m_aArray[i]->m_bEndCell )
// {
// RtfTableCellPtr oNewTableCell( new RtfTableCell() );
// for( int k = (int)aCellRenderables.size() - 1; k >= 0 ; k-- )
// if( aItaps[k] == nCurItap )
// {
// oNewTableCell->InsertItem(aCellRenderables[k], 0 );
// aCellRenderables.RemoveAt(k);
// aItaps.RemoveAt(k);
// }
// else
// break;
// aCells.push_back( oNewTableCell );
// }
// }
// oCurRowProperty = m_aArray[i]->m_oProperty.m_oRowProperty;
// }
//
// }
//}
};
class
FootnoteReader
:
public
RtfAbstractReader
{
...
...
@@ -2194,30 +2125,32 @@ public:
oReader
.
m_nFootnote
=
PROP_DEF
;
}
};
//
class RtfDefParPropReader: public RtfAbstractReader
//
{
//
private: ParagraphPropDestination m_oParPropDest;
//
public: RtfDefParPropReader( )
//
{
//
}
//
//
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
//
{
//
if( _T("defpap") == sCommand )
//
return true;
//
else
//
return m_oParPropDest.ExecuteCommand( oDocument, oReader, (*this), sCommand, hasParameter, parameter);
//
}
//
void ExitReader(RtfDocument& oDocument, RtfReader& oReader)
//
{
//
oDocument.m_oDefaultParagraphProp = oReader.m_oState->m_oParagraphProp;
//
}
//
};
class
RtfDefParPropReader
:
public
RtfAbstractReader
{
private:
ParagraphPropDestination
m_oParPropDest
;
public:
RtfDefParPropReader
(
)
{
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
{
if
(
_T
(
"defpap"
)
==
sCommand
)
return
true
;
else
return
m_oParPropDest
.
ExecuteCommand
(
oDocument
,
oReader
,
(
*
this
),
sCommand
,
hasParameter
,
parameter
);
}
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
oDocument
.
m_oDefaultParagraphProp
=
oReader
.
m_oState
->
m_oParagraphProp
;
}
};
//class LockedExeceptReader: public RtfAbstractReader
//{
//private: RtfStyleException m_oCurException;
//public: bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
//private:
// RtfStyleException m_oCurException;
//public:
// bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
// {
// if( _T("lsdlockedexcept") == sCommand )
// return true;
...
...
@@ -2267,7 +2200,7 @@ public:
// }
// }
//};
//
//class LatentstyleTableReader: public RtfAbstractReader
//{
//public: bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
...
...
@@ -2319,305 +2252,306 @@ public:
//};
//
//class StyleTableReader: public RtfAbstractReader
//{
//class RtfStyleReader: public RtfAbstractReader
//{
////только для определения бордеров
//private: typedef enum { is_normal, is_tsbrdrt, is_tsbrdrb, is_tsbrdrl, is_tsbrdrr, is_tsbrdrh, is_tsbrdrv } InternalState;
// InternalState m_eInternalState;
// ParagraphPropDestination m_oParDest;
// RtfStylePtr m_oCurStyle;
//
//// RtfTableStyleProperty m_oTableStyleProperty;
//
//public: RtfStyleReader()
// {
// m_oCurStyle = RtfParagraphStylePtr( new RtfParagraphStyle() );
// m_eInternalState = is_normal;
// }
// bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
// {
// if( _T("s") == sCommand )
// {
// if( true == hasParameter )
// {
// m_oCurStyle = RtfParagraphStylePtr( new RtfParagraphStyle() );
// m_oCurStyle->m_nID = parameter;
// }
// }
// else if( _T("cs") == sCommand )
// {
// if( true == hasParameter )
// {
// m_oCurStyle = RtfCharStylePtr( new RtfCharStyle() );
// m_oCurStyle->m_nID = parameter;
// }
// }
// else if( _T("ts") == sCommand )
// {
// if( true == hasParameter )
// {
// m_oCurStyle = RtfTableStylePtr( new RtfTableStyle() );
// m_oCurStyle->m_nID = parameter;
// }
// }
// COMMAND_RTF_INT( _T("sbasedon"), m_oCurStyle->m_nBasedOn, sCommand, hasParameter, parameter )
// COMMAND_RTF_INT( _T("snext"), m_oCurStyle->m_nNext, sCommand, hasParameter, parameter )
// COMMAND_RTF_INT( _T("slink"), m_oCurStyle->m_nLink, sCommand, hasParameter, parameter )
// COMMAND_RTF_BOOL( _T("sqformat"), m_oCurStyle->m_bQFormat, sCommand, hasParameter, parameter )
// COMMAND_RTF_INT( _T("spriority"), m_oCurStyle->m_nPriority, sCommand, hasParameter, parameter )
// COMMAND_RTF_BOOL( _T("sunhideused"), m_oCurStyle->m_bUnhiddenWhenUse, sCommand, hasParameter, parameter )
// COMMAND_RTF_BOOL( _T("slocked"), m_oCurStyle->m_bLocked, sCommand, hasParameter, parameter )
// COMMAND_RTF_BOOL( _T("shidden"), m_oCurStyle->m_bHidden, sCommand, hasParameter, parameter )
// else if( _T("ssemihidden") == sCommand )
// {
// if( true == hasParameter && 0 == parameter)
// m_oCurStyle->m_nSemiHidden = 0;
// else
// m_oCurStyle->m_nSemiHidden = 1;
// }
// COMMAND_RTF_BOOL( _T("spersonal"), m_oCurStyle->m_bPersonal, sCommand, hasParameter, parameter )
// COMMAND_RTF_BOOL( _T("scompose"), m_oCurStyle->m_bCompose, sCommand, hasParameter, parameter )
// COMMAND_RTF_BOOL( _T("sreply"), m_oCurStyle->m_bReply, sCommand, hasParameter, parameter )
//
// //tableStyleCommands
// //else if( _T("tscellpaddt") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nPaddingTop = parameter;
// //}
// //else if( _T("tscellpaddl") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nPaddingLeft = parameter;
// //}
// //else if( _T("tscellpaddr") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nPaddingRight = parameter;
// //}
// //else if( _T("tscellpaddb") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nPaddingBottom = parameter;
// //}
// //else if( _T("tscellpaddft") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nIsPaddingTop = parameter;
// //}
// //else if( _T("tscellpaddfl") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nIsPaddingLeft = parameter;
// //}
// //else if( _T("tscellpaddfr") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nIsPaddingRight = parameter;
// //}
// //else if( _T("tscellpaddfb") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nIsPaddingBottom = parameter;
// //}
// //else if( _T("tsvertalt") == sCommand )
// // m_oTableStyleProperty.m_eAlign = RtfTableStyleProperty::av_tsvertalt;
// //else if( _T("tsvertalc") == sCommand )
// // m_oTableStyleProperty.m_eAlign = RtfTableStyleProperty::av_tsvertalc;
// //else if( _T("tsvertalb") == sCommand )
// // m_oTableStyleProperty.m_eAlign = RtfTableStyleProperty::av_tsvertalb;
// //else if( _T("tsnowrap") == sCommand )
// // m_oTableStyleProperty.m_bNoCellWrap = 1;
// //else if( _T("tscbandsh") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nRowBandNumber = parameter;
// //}
// //else if( _T("tscbandsv") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nCellBandNumber = parameter;
// //}
// //else if(_T("tsbghoriz") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbghoriz;
// //else if( _T("tsbgvert") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgvert;
// //else if( _T("tsbgfdiag") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgfdiag;
// //else if( _T("tsbgbdiag") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgbdiag;
// //else if( _T("tsbgcross") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgcross;
// //else if( _T("tsbgdcross") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdcross;
// //else if( _T("tsbgdkhor") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkhoriz;
// //else if( _T("tsbgdkvert") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkvert;
// //else if( _T("tsbgdkfdiag") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkfdiag;
// //else if( _T("tsbgdkbdiag") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkbdiag;
// //else if( _T("tsbgdkcross") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkcross;
// //else if( _T("tsbgdkdcross") == sCommand )
// // m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkdcross;
// //else if( _T("tscellcfpat") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_oShading.m_nForeColor = parameter;
// //}
// //else if( _T("tscellcbpat") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_oShading.m_nBackColor = parameter;
// //}
// //else if( _T("tscellpct") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_oShading.m_nValue = parameter;
// //}
// //else if( _T("tsbrdrt") == sCommand )
// // m_eInternalState = is_tsbrdrt;
// //else if( _T("tsbrdrb") == sCommand )
// // m_eInternalState = is_tsbrdrb;
// //else if( _T("tsbrdrl") == sCommand )
// // m_eInternalState = is_tsbrdrl;
// //else if( _T("tsbrdrr") == sCommand )
// // m_eInternalState = is_tsbrdrr;
// //else if( _T("tsbrdrh") == sCommand )
// // m_eInternalState = is_tsbrdrh;
// //else if( _T("tsbrdrv") == sCommand )
// // m_eInternalState = is_tsbrdrv;
// //else if( _T("tscbandsh") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nRowBandNumber = parameter;
// //}
// //else if( _T("tscbandsv") == sCommand )
// //{
// // if( true == hasParameter )
// // m_oTableStyleProperty.m_nCellBandNumber = parameter;
// //}
// else
// {
// bool bResult = false;
// //if( is_tsbrdrt == m_eInternalState )
// // bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellTopBorder );
// //else if( is_tsbrdrb == m_eInternalState )
// // bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellBottomBorder );
// //else if( is_tsbrdrl == m_eInternalState )
// // bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellLeftBorder );
// //else if( is_tsbrdrr == m_eInternalState )
// // bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellRightBorder );
// //else if( is_tsbrdrh == m_eInternalState )
// // bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellHorBorder );
// //else if( is_tsbrdrv == m_eInternalState )
// // bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellVerBorder );
//
// //if( true == bResult )
// // return true;
// bResult = m_oParDest.ExecuteCommand( oDocument, oReader,(*this),sCommand, hasParameter, parameter );
// if( true == bResult )
// return true;
// bResult = RtfCharPropCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, oReader.m_oState->m_oCharProp );
// if( true == bResult )
// return true;
//
// return false;
// }
// return true;
//
// }
//
// void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText)
// {
// if( sText.Find(';') != -1 )
// sText.Remove(';');
// m_oCurStyle->m_sName += sText;
// }
// void ExitReader(RtfDocument& oDocument, RtfReader& oReader)
// {
// switch( m_oCurStyle->m_eType )
// {
// case RtfStyle::stCharacter:
// {
// RtfCharStylePtr m_oCurCharStyle = boost::static_pointer_cast< RtfCharStyle, RtfStyle >( m_oCurStyle );
// m_oCurCharStyle->m_oCharProp = oReader.m_oState->m_oCharProp;
// oDocument.m_oStyleTable.AddItem( m_oCurStyle );
// break;
// }
// case RtfStyle::stParagraph:
// {
// RtfParagraphStylePtr m_oCurParStyle = boost::static_pointer_cast< RtfParagraphStyle, RtfStyle >( m_oCurStyle );
// m_oCurParStyle->m_oCharProp = oReader.m_oState->m_oCharProp;
// m_oCurParStyle->m_oParProp = oReader.m_oState->m_oParagraphProp;
// oDocument.m_oStyleTable.AddItem( m_oCurStyle );
// break;
// }
// case RtfStyle::stTable:
// {
// RtfTableStylePtr m_oCurTableStyle = boost::static_pointer_cast< RtfTableStyle, RtfStyle >( m_oCurStyle );
// m_oCurTableStyle->m_oCharProp = oReader.m_oState->m_oCharProp;
// m_oCurTableStyle->m_oParProp = oReader.m_oState->m_oParagraphProp;
// if( PROP_DEF == m_oCurTableStyle->m_oParProp.m_nSpaceBetween )
// m_oCurTableStyle->m_oParProp.m_nSpaceBetween = 240;//интервал - единичный
// m_oCurTableStyle->m_oTableProp = oReader.m_oState->m_oRowProperty;
// m_oCurTableStyle->m_oRowProp = oReader.m_oState->m_oRowProperty;
// //m_oCurTableStyle->m_oTableStyleProperty = m_oTableStyleProperty;
// //надо определить базовый это стиль или например firstRow
// RtfStylePtr oStyle;
// if( true == oDocument.m_oStyleTable.GetStyle(m_oCurTableStyle->m_nID, oStyle) )
// {
// if( oStyle->m_eType == RtfStyle::stTable )
// {//определяем какой это conditionalFormating
// RtfTableStylePtr oStyleTable = boost::static_pointer_cast<RtfTableStyle, RtfStyle>(oStyle);
// if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleFirstRow )
// oStyleTable->m_oFirstRow = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleLastRow )
// oStyleTable->m_oLastRow = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleFirstCollumn )
// oStyleTable->m_oFirstCol = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleLastCollumn )
// oStyleTable->m_oLastCol = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleOddRowBand )
// oStyleTable->m_oBandHorOdd = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleEvenRowBand )
// oStyleTable->m_oBandHorEven = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleOddColBand )
// oStyleTable->m_oBandVerOdd = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleEvenColBand )
// oStyleTable->m_oBandVerEven = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleNWCell )
// oStyleTable->m_oNWCell = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleNECell )
// oStyleTable->m_oNECell = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleSWCell )
// oStyleTable->m_oSWCell = m_oCurTableStyle;
// else if( 1 == m_oCurTableStyle->m_oParProp.m_bStyleSECell )
// oStyleTable->m_oSECell = m_oCurTableStyle;
// }
// }
// else
// oDocument.m_oStyleTable.AddItem( m_oCurStyle );
// break;
// }
// }
// }
//};
// bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
// {
// if( _T("stylesheet") == sCommand )
// return true;
// else
// {
// RtfStyleReader oStyleReader;
// return StartSubReader( oStyleReader, oDocument, oReader );
// }
// }
//};
class
StyleTableReader
:
public
RtfAbstractReader
{
class
RtfStyleReader
:
public
RtfAbstractReader
{
//только для определения бордеров
private:
typedef
enum
{
is_normal
,
is_tsbrdrt
,
is_tsbrdrb
,
is_tsbrdrl
,
is_tsbrdrr
,
is_tsbrdrh
,
is_tsbrdrv
}
InternalState
;
InternalState
m_eInternalState
;
ParagraphPropDestination
m_oParDest
;
RtfStylePtr
m_oCurStyle
;
// RtfTableStyleProperty m_oTableStyleProperty;
public:
RtfStyleReader
()
{
m_oCurStyle
=
RtfParagraphStylePtr
(
new
RtfParagraphStyle
()
);
m_eInternalState
=
is_normal
;
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
{
if
(
_T
(
"s"
)
==
sCommand
)
{
if
(
true
==
hasParameter
)
{
m_oCurStyle
=
RtfParagraphStylePtr
(
new
RtfParagraphStyle
()
);
m_oCurStyle
->
m_nID
=
parameter
;
}
}
else
if
(
_T
(
"cs"
)
==
sCommand
)
{
if
(
true
==
hasParameter
)
{
m_oCurStyle
=
RtfCharStylePtr
(
new
RtfCharStyle
()
);
m_oCurStyle
->
m_nID
=
parameter
;
}
}
else
if
(
_T
(
"ts"
)
==
sCommand
)
{
if
(
true
==
hasParameter
)
{
m_oCurStyle
=
RtfTableStylePtr
(
new
RtfTableStyle
()
);
m_oCurStyle
->
m_nID
=
parameter
;
}
}
COMMAND_RTF_INT
(
_T
(
"sbasedon"
),
m_oCurStyle
->
m_nBasedOn
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_INT
(
_T
(
"snext"
),
m_oCurStyle
->
m_nNext
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_INT
(
_T
(
"slink"
),
m_oCurStyle
->
m_nLink
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_BOOL
(
_T
(
"sqformat"
),
m_oCurStyle
->
m_bQFormat
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_INT
(
_T
(
"spriority"
),
m_oCurStyle
->
m_nPriority
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_BOOL
(
_T
(
"sunhideused"
),
m_oCurStyle
->
m_bUnhiddenWhenUse
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_BOOL
(
_T
(
"slocked"
),
m_oCurStyle
->
m_bLocked
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_BOOL
(
_T
(
"shidden"
),
m_oCurStyle
->
m_bHidden
,
sCommand
,
hasParameter
,
parameter
)
else
if
(
_T
(
"ssemihidden"
)
==
sCommand
)
{
if
(
true
==
hasParameter
&&
0
==
parameter
)
m_oCurStyle
->
m_nSemiHidden
=
0
;
else
m_oCurStyle
->
m_nSemiHidden
=
1
;
}
COMMAND_RTF_BOOL
(
_T
(
"spersonal"
),
m_oCurStyle
->
m_bPersonal
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_BOOL
(
_T
(
"scompose"
),
m_oCurStyle
->
m_bCompose
,
sCommand
,
hasParameter
,
parameter
)
COMMAND_RTF_BOOL
(
_T
(
"sreply"
),
m_oCurStyle
->
m_bReply
,
sCommand
,
hasParameter
,
parameter
)
//tableStyleCommands
//else if( _T("tscellpaddt") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nPaddingTop = parameter;
//}
//else if( _T("tscellpaddl") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nPaddingLeft = parameter;
//}
//else if( _T("tscellpaddr") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nPaddingRight = parameter;
//}
//else if( _T("tscellpaddb") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nPaddingBottom = parameter;
//}
//else if( _T("tscellpaddft") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nIsPaddingTop = parameter;
//}
//else if( _T("tscellpaddfl") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nIsPaddingLeft = parameter;
//}
//else if( _T("tscellpaddfr") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nIsPaddingRight = parameter;
//}
//else if( _T("tscellpaddfb") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nIsPaddingBottom = parameter;
//}
//else if( _T("tsvertalt") == sCommand )
// m_oTableStyleProperty.m_eAlign = RtfTableStyleProperty::av_tsvertalt;
//else if( _T("tsvertalc") == sCommand )
// m_oTableStyleProperty.m_eAlign = RtfTableStyleProperty::av_tsvertalc;
//else if( _T("tsvertalb") == sCommand )
// m_oTableStyleProperty.m_eAlign = RtfTableStyleProperty::av_tsvertalb;
//else if( _T("tsnowrap") == sCommand )
// m_oTableStyleProperty.m_bNoCellWrap = 1;
//else if( _T("tscbandsh") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nRowBandNumber = parameter;
//}
//else if( _T("tscbandsv") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nCellBandNumber = parameter;
//}
//else if(_T("tsbghoriz") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbghoriz;
//else if( _T("tsbgvert") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgvert;
//else if( _T("tsbgfdiag") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgfdiag;
//else if( _T("tsbgbdiag") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgbdiag;
//else if( _T("tsbgcross") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgcross;
//else if( _T("tsbgdcross") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdcross;
//else if( _T("tsbgdkhor") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkhoriz;
//else if( _T("tsbgdkvert") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkvert;
//else if( _T("tsbgdkfdiag") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkfdiag;
//else if( _T("tsbgdkbdiag") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkbdiag;
//else if( _T("tsbgdkcross") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkcross;
//else if( _T("tsbgdkdcross") == sCommand )
// m_oTableStyleProperty.m_oShading.m_eType = RtfShading::st_chbgdkdcross;
//else if( _T("tscellcfpat") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_oShading.m_nForeColor = parameter;
//}
//else if( _T("tscellcbpat") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_oShading.m_nBackColor = parameter;
//}
//else if( _T("tscellpct") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_oShading.m_nValue = parameter;
//}
//else if( _T("tsbrdrt") == sCommand )
// m_eInternalState = is_tsbrdrt;
//else if( _T("tsbrdrb") == sCommand )
// m_eInternalState = is_tsbrdrb;
//else if( _T("tsbrdrl") == sCommand )
// m_eInternalState = is_tsbrdrl;
//else if( _T("tsbrdrr") == sCommand )
// m_eInternalState = is_tsbrdrr;
//else if( _T("tsbrdrh") == sCommand )
// m_eInternalState = is_tsbrdrh;
//else if( _T("tsbrdrv") == sCommand )
// m_eInternalState = is_tsbrdrv;
//else if( _T("tscbandsh") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nRowBandNumber = parameter;
//}
//else if( _T("tscbandsv") == sCommand )
//{
// if( true == hasParameter )
// m_oTableStyleProperty.m_nCellBandNumber = parameter;
//}
else
{
bool
bResult
=
false
;
//if( is_tsbrdrt == m_eInternalState )
// bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellTopBorder );
//else if( is_tsbrdrb == m_eInternalState )
// bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellBottomBorder );
//else if( is_tsbrdrl == m_eInternalState )
// bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellLeftBorder );
//else if( is_tsbrdrr == m_eInternalState )
// bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellRightBorder );
//else if( is_tsbrdrh == m_eInternalState )
// bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellHorBorder );
//else if( is_tsbrdrv == m_eInternalState )
// bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_oTableStyleProperty.m_oCellVerBorder );
//if( true == bResult )
// return true;
bResult
=
m_oParDest
.
ExecuteCommand
(
oDocument
,
oReader
,(
*
this
),
sCommand
,
hasParameter
,
parameter
);
if
(
true
==
bResult
)
return
true
;
bResult
=
RtfCharPropCommand
::
ExecuteCommand
(
oDocument
,
oReader
,
sCommand
,
hasParameter
,
parameter
/*, oReader.m_oState->m_oCharProp*/
);
if
(
true
==
bResult
)
return
true
;
return
false
;
}
return
true
;
}
void
ExecuteText
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sText
)
{
if
(
sText
.
Find
(
';'
)
!=
-
1
)
sText
.
Remove
(
';'
);
m_oCurStyle
->
m_sName
+=
sText
;
}
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
switch
(
m_oCurStyle
->
m_eType
)
{
case
RtfStyle
:
:
stCharacter
:
{
RtfCharStylePtr
m_oCurCharStyle
=
boost
::
static_pointer_cast
<
RtfCharStyle
,
RtfStyle
>
(
m_oCurStyle
);
m_oCurCharStyle
->
m_oCharProp
=
oReader
.
m_oState
->
m_oCharProp
;
oDocument
.
m_oStyleTable
.
AddItem
(
m_oCurStyle
);
break
;
}
case
RtfStyle
:
:
stParagraph
:
{
RtfParagraphStylePtr
m_oCurParStyle
=
boost
::
static_pointer_cast
<
RtfParagraphStyle
,
RtfStyle
>
(
m_oCurStyle
);
m_oCurParStyle
->
m_oCharProp
=
oReader
.
m_oState
->
m_oCharProp
;
m_oCurParStyle
->
m_oParProp
=
oReader
.
m_oState
->
m_oParagraphProp
;
oDocument
.
m_oStyleTable
.
AddItem
(
m_oCurStyle
);
break
;
}
case
RtfStyle
:
:
stTable
:
{
RtfTableStylePtr
m_oCurTableStyle
=
boost
::
static_pointer_cast
<
RtfTableStyle
,
RtfStyle
>
(
m_oCurStyle
);
m_oCurTableStyle
->
m_oCharProp
=
oReader
.
m_oState
->
m_oCharProp
;
m_oCurTableStyle
->
m_oParProp
=
oReader
.
m_oState
->
m_oParagraphProp
;
if
(
PROP_DEF
==
m_oCurTableStyle
->
m_oParProp
.
m_nSpaceBetween
)
m_oCurTableStyle
->
m_oParProp
.
m_nSpaceBetween
=
240
;
//интервал - единичный
m_oCurTableStyle
->
m_oTableProp
=
oReader
.
m_oState
->
m_oRowProperty
;
m_oCurTableStyle
->
m_oRowProp
=
oReader
.
m_oState
->
m_oRowProperty
;
//m_oCurTableStyle->m_oTableStyleProperty = m_oTableStyleProperty;
//надо определить базовый это стиль или например firstRow
RtfStylePtr
oStyle
;
if
(
true
==
oDocument
.
m_oStyleTable
.
GetStyle
(
m_oCurTableStyle
->
m_nID
,
oStyle
)
)
{
if
(
oStyle
->
m_eType
==
RtfStyle
::
stTable
)
{
//определяем какой это conditionalFormating
RtfTableStylePtr
oStyleTable
=
boost
::
static_pointer_cast
<
RtfTableStyle
,
RtfStyle
>
(
oStyle
);
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleFirstRow
)
oStyleTable
->
m_oFirstRow
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleLastRow
)
oStyleTable
->
m_oLastRow
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleFirstCollumn
)
oStyleTable
->
m_oFirstCol
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleLastCollumn
)
oStyleTable
->
m_oLastCol
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleOddRowBand
)
oStyleTable
->
m_oBandHorOdd
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleEvenRowBand
)
oStyleTable
->
m_oBandHorEven
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleOddColBand
)
oStyleTable
->
m_oBandVerOdd
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleEvenColBand
)
oStyleTable
->
m_oBandVerEven
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleNWCell
)
oStyleTable
->
m_oNWCell
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleNECell
)
oStyleTable
->
m_oNECell
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleSWCell
)
oStyleTable
->
m_oSWCell
=
m_oCurTableStyle
;
else
if
(
1
==
m_oCurTableStyle
->
m_oParProp
.
m_bStyleSECell
)
oStyleTable
->
m_oSECell
=
m_oCurTableStyle
;
}
}
else
oDocument
.
m_oStyleTable
.
AddItem
(
m_oCurStyle
);
break
;
}
}
}
};
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
{
if
(
_T
(
"stylesheet"
)
==
sCommand
)
return
true
;
else
{
RtfStyleReader
oStyleReader
;
return
StartSubReader
(
oStyleReader
,
oDocument
,
oReader
);
}
}
};
class
ListTableReader
:
public
RtfAbstractReader
{
...
...
@@ -2866,7 +2800,6 @@ public:
};
class
ParagraphReader
:
public
RtfAbstractReader
{
//private: ItemContainer< RtfReaderParagraphPtr > m_aArray;
private:
CString
m_sHeader
;
public:
...
...
@@ -3351,9 +3284,8 @@ public:
}
else
if
(
_T
(
"stylesheet"
)
==
sCommand
)
{
Skip
(
oDocument
,
oReader
);
//StyleTableReader oStyleReader;
//return StartSubReader( oStyleReader, oDocument, oReader );
StyleTableReader
oStyleReader
;
return
StartSubReader
(
oStyleReader
,
oDocument
,
oReader
);
}
//else if( _T("latentstyles") == sCommand )
//{
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h
View file @
9ea214e1
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
View file @
9ea214e1
...
...
@@ -664,12 +664,18 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
RENDER_OOX_BOOL
(
m_bBold
,
sResult
,
_T
(
"w:b"
)
)
RENDER_OOX_BOOL
(
m_bCaps
,
sResult
,
_T
(
"w:caps"
)
)
RENDER_OOX_INT
(
(
int
)
m_nScalex
,
sResult
,
_T
(
"w:w"
)
)
//if( PROP_DEF != m_nCharStyle )
//{
// RtfStylePtr oStyle;
// if( true == poRtfDocument->m_oStyleTable.GetStyle( m_nCharStyle, oStyle ) )
// sResult.AppendFormat(_T("<w:pStyle w:val=\"%ls\" />"), oStyle->m_sName );
//}
if
(
PROP_DEF
!=
m_nCharStyle
)
{
RtfStylePtr
oStyle
;
if
(
true
==
poRtfDocument
->
m_oStyleTable
.
GetStyle
(
m_nCharStyle
,
oStyle
)
)
{
sResult
+=
_T
(
"<w:pStyle w:val=
\"
"
);
sResult
+=
oStyle
->
m_sName
;
sResult
+=
_T
(
"
\"
/>"
);
}
}
if
(
PROP_DEF
!=
m_nDown
)
sResult
.
AppendFormat
(
_T
(
"<w:position w:val=
\"
-%d
\"
/>"
),
m_nDown
);
RENDER_OOX_BOOL
(
m_bEmbo
,
sResult
,
_T
(
"w:emboss"
)
)
...
...
@@ -1083,43 +1089,54 @@ CString RtfStyle::RenderToRtfEnd( RenderParameter oRenderParameter )
}
CString
RtfCharStyle
::
RenderToRtf
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
sResult
.
Append
(
RenderToRtfBegin
(
oRenderParameter
)
);
CString
sResult
=
RenderToRtfBegin
(
oRenderParameter
)
;
sResult
.
Append
(
m_oCharProp
.
RenderToRtf
(
oRenderParameter
)
);
sResult
.
Append
(
RenderToRtfEnd
(
oRenderParameter
)
);
return
sResult
;
}
CString
RtfCharStyle
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
sResult
.
Append
(
RenderToOOXBegin
(
oRenderParameter
)
);
CString
sResult
=
RenderToOOXBegin
(
oRenderParameter
)
;
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCharProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:rPr>%ls</w:rPr>"
),
sCharProp
.
GetBuffer
()
);
sResult
.
Append
(
RenderToOOXEnd
(
oRenderParameter
)
);
{
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
sCharProp
;
sResult
+=
_T
(
"</w:rPr>"
);
}
sResult
+=
RenderToOOXEnd
(
oRenderParameter
);
return
sResult
;
}
CString
RtfParagraphStyle
::
RenderToRtf
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
sResult
.
Append
(
RenderToRtfBegin
(
oRenderParameter
)
);
sResult
.
Append
(
m_oParProp
.
RenderToRtf
(
oRenderParameter
)
)
;
sResult
.
Append
(
m_oCharProp
.
RenderToRtf
(
oRenderParameter
)
);
sResult
.
Append
(
RenderToRtfEnd
(
oRenderParameter
)
);
CString
sResult
=
RenderToRtfBegin
(
oRenderParameter
)
;
sResult
+=
m_oParProp
.
RenderToRtf
(
oRenderParameter
)
;
sResult
+=
m_oCharProp
.
RenderToRtf
(
oRenderParameter
);
sResult
+=
RenderToRtfEnd
(
oRenderParameter
);
return
sResult
;
}
CString
RtfParagraphStyle
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
sResult
.
Append
(
RenderToOOXBegin
(
oRenderParameter
)
);
CString
sResult
=
RenderToOOXBegin
(
oRenderParameter
)
;
CString
sParProp
=
m_oParProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sParProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:pPr>%ls</w:pPr>"
),
sParProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
sParProp
;
sResult
+=
_T
(
"</w:pPr>"
),
sParProp
.
GetBuffer
();
}
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCharProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:rPr>%ls</w:rPr>"
),
sCharProp
.
GetBuffer
()
);
sResult
.
Append
(
RenderToOOXEnd
(
oRenderParameter
)
);
{
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
sCharProp
;
sResult
+=
_T
(
"</w:rPr>"
);
}
sResult
+=
RenderToOOXEnd
(
oRenderParameter
)
;
return
sResult
;
}
...
...
@@ -1189,8 +1206,8 @@ CString RtfParagraphStyle::RenderToOOX(RenderParameter oRenderParameter)
CString
RtfTableStyle
::
RenderToRtf
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
sResult
.
Append
(
RenderToRtfBegin
(
oRenderParameter
)
);
CString
sResult
=
RenderToRtfBegin
(
oRenderParameter
)
;
RenderParameter
oNewParameter
=
oRenderParameter
;
oNewParameter
.
nType
=
RENDER_TO_RTF_PARAM_NO_WROWD
;
sResult
.
Append
(
m_oTableProp
.
RenderToRtf
(
oNewParameter
)
);
...
...
@@ -1232,22 +1249,43 @@ CString RtfTableStyle::RenderToOOX(RenderParameter oRenderParameter)
CString
sResult
;
if
(
RENDER_TO_OOX_PARAM_NESTED
!=
oRenderParameter
.
nType
)
{
sResult
.
Append
(
RenderToOOXBegin
(
oRenderParameter
)
);
sResult
+=
RenderToOOXBegin
(
oRenderParameter
)
;
CString
sTablProp
=
m_oTableProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sTablProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:tblPr>%ls</w:tblPr>"
),
sTablProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:tblPr>"
);
sResult
+=
sTablProp
;
sResult
+=
_T
(
"</w:tblPr>"
);
}
CString
sRowProp
=
m_oRowProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sRowProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:trPr>%ls</w:trPr>"
),
sRowProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:trPr>"
);
sResult
+=
sRowProp
;
sResult
+=
_T
(
"</w:trPr>"
);
}
CString
sCellProp
=
m_oCellProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCellProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:tcPr>%ls</w:tcPr>"
),
sCellProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:tcPr>"
);
sResult
+=
sCellProp
;
sResult
+=
_T
(
"</w:tcPr>"
);
}
CString
sParProp
=
m_oParProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sParProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:pPr>%ls</w:pPr>"
),
sParProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
sParProp
;
sResult
+=
_T
(
"</w:pPr>"
);
}
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCharProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:rPr>%ls</w:rPr>"
),
sCharProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
sCharProp
;
sResult
+=
_T
(
"</w:rPr>"
);
}
RenderParameter
oNewParam
=
oRenderParameter
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_NESTED
;
...
...
@@ -1255,84 +1293,105 @@ CString RtfTableStyle::RenderToOOX(RenderParameter oRenderParameter)
if
(
NULL
!=
m_oFirstRow
)
{
oNewParam
.
sValue
=
_T
(
"firstRow"
);
sResult
.
Append
(
m_oFirstRow
->
RenderToOOX
(
oNewParam
)
)
;
sResult
+=
m_oFirstRow
->
RenderToOOX
(
oNewParam
)
;
}
if
(
NULL
!=
m_oLastRow
)
{
oNewParam
.
sValue
=
_T
(
"lastRow"
);
sResult
.
Append
(
m_oLastRow
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oLastRow
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oFirstCol
)
{
oNewParam
.
sValue
=
_T
(
"firstCol"
);
sResult
.
Append
(
m_oFirstCol
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oFirstCol
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oLastCol
)
{
oNewParam
.
sValue
=
_T
(
"lastCol"
);
sResult
.
Append
(
m_oLastCol
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oLastCol
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oBandHorEven
)
{
oNewParam
.
sValue
=
_T
(
"band2Horz"
);
sResult
.
Append
(
m_oBandHorEven
->
RenderToOOX
(
oNewParam
)
)
;
sResult
+=
m_oBandHorEven
->
RenderToOOX
(
oNewParam
)
;
}
if
(
NULL
!=
m_oBandVerEven
)
{
oNewParam
.
sValue
=
_T
(
"band2Vert"
);
sResult
.
Append
(
m_oBandVerEven
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oBandVerEven
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oBandHorOdd
)
{
oNewParam
.
sValue
=
_T
(
"band1Horz"
);
sResult
.
Append
(
m_oBandHorOdd
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oBandHorOdd
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oBandVerOdd
)
{
oNewParam
.
sValue
=
_T
(
"band1Vert"
);
sResult
.
Append
(
m_oBandVerOdd
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oBandVerOdd
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oNWCell
)
{
oNewParam
.
sValue
=
_T
(
"nwCell"
);
sResult
.
Append
(
m_oNWCell
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oNWCell
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oNECell
)
{
oNewParam
.
sValue
=
_T
(
"neCell"
);
sResult
.
Append
(
m_oNECell
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oNECell
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oSWCell
)
{
oNewParam
.
sValue
=
_T
(
"swCell"
);
sResult
.
Append
(
m_oSWCell
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oSWCell
->
RenderToOOX
(
oNewParam
);
}
if
(
NULL
!=
m_oSECell
)
{
oNewParam
.
sValue
=
_T
(
"seCell"
);
sResult
.
Append
(
m_oSECell
->
RenderToOOX
(
oNewParam
)
);
sResult
+=
m_oSECell
->
RenderToOOX
(
oNewParam
);
}
sResult
.
Append
(
RenderToOOXEnd
(
oRenderParameter
)
)
;
sResult
+=
RenderToOOXEnd
(
oRenderParameter
)
;
}
else
{
sResult
.
Append
(
_T
(
"<w:tblStylePr w:type=
\"
"
)
+
oRenderParameter
.
sValue
+
_T
(
"
\"
>"
)
);
sResult
+=
_T
(
"<w:tblStylePr w:type=
\"
"
)
+
oRenderParameter
.
sValue
+
_T
(
"
\"
>"
);
CString
sTablProp
=
m_oTableProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sTablProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:tblPr>%ls</w:tblPr>"
),
sTablProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:tblPr>"
);
sResult
+=
sTablProp
;
sResult
+=
_T
(
"</w:tblPr>"
);
}
CString
sRowProp
=
m_oRowProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sRowProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:trPr>%ls</w:trPr>"
),
sRowProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:trPr>"
);
sResult
+=
sRowProp
;
sResult
+=
_T
(
"</w:trPr>"
);
}
CString
sCellProp
=
m_oCellProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCellProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:tcPr>%ls</w:tcPr>"
),
sCellProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:tcPr>"
);
sResult
+=
sCellProp
;
sResult
+=
_T
(
"</w:tcPr>"
);
}
CString
sParProp
=
m_oParProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sParProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:pPr>%ls</w:pPr>"
),
sParProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
sParProp
;
sResult
+=
_T
(
"</w:pPr>"
);
}
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCharProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:rPr>%ls</w:rPr>"
),
sCharProp
.
GetBuffer
()
);
sResult
.
Append
(
_T
(
"</w:tblStylePr>"
)
);
{
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
sCharProp
;
sResult
+=
_T
(
"</w:rPr>"
);
}
sResult
+=
_T
(
"</w:tblStylePr>"
)
;
}
return
sResult
;
}
...
...
@@ -1742,13 +1801,19 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
{
RtfDocument
*
poRtfDocument
=
static_cast
<
RtfDocument
*>
(
oRenderParameter
.
poDocument
);
OOXWriter
*
poOOXWriter
=
static_cast
<
OOXWriter
*>
(
oRenderParameter
.
poWriter
);
CString
sResult
;
//if( PROP_DEF != m_nStyle )
//{
// RtfStylePtr oCurStile;
// if( true == poRtfDocument->m_oStyleTable.GetStyle( m_nStyle, oCurStile ) )
// RENDER_OOX_STRING( oCurStile->m_sName, sResult, _T("w:pStyle") );
//}
if
(
PROP_DEF
!=
m_nStyle
)
{
RtfStylePtr
oCurStile
;
if
(
true
==
poRtfDocument
->
m_oStyleTable
.
GetStyle
(
m_nStyle
,
oCurStile
)
)
{
sResult
+=
_T
(
"<w:pStyle w:val=
\"
"
);
sResult
+=
oCurStile
->
m_sName
;
sResult
+=
_T
(
"
\"
/>"
)
;
}
}
if
(
0
==
m_bAutoHyphenation
)
sResult
.
Append
(
_T
(
"<w:suppressAutoHyphens/>"
)
);
else
if
(
1
==
m_bAutoHyphenation
)
...
...
@@ -1792,7 +1857,11 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
RENDER_OOX_INT_ATTRIBUTE
(
m_nIndStart
,
sIndent
,
_T
(
"w:start"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nIndEnd
,
sIndent
,
_T
(
"w:end"
)
);
if
(
false
==
sIndent
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:ind %ls/>"
),
sIndent
.
GetBuffer
());
{
sResult
+=
_T
(
"<w:ind "
);
sResult
+=
sIndent
;
sResult
+=
_T
(
"/>"
);
}
RENDER_OOX_BOOL
(
m_bIndRightAuto
,
sResult
,
_T
(
"w:adjustRightInd"
)
);
RENDER_OOX_BOOL
(
m_bIndMirror
,
sResult
,
_T
(
"w:mirrorIndents"
)
);
...
...
@@ -1825,7 +1894,11 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
//else
// sSpacing.AppendFormat(_T(" w:line=\"240\"")); //по умолчанию - единичный
if
(
false
==
sSpacing
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:spacing %ls/>"
),
sSpacing
.
GetBuffer
());
{
sResult
+=
_T
(
"<w:spacing "
);
sResult
+=
sSpacing
;
sResult
+=
_T
(
"/>"
);
}
RENDER_OOX_BOOL
(
m_bSnapToGrid
,
sResult
,
_T
(
"w:snapToGrid"
)
);
RENDER_OOX_BOOL
(
m_bContextualSpacing
,
sResult
,
_T
(
"w:contextualSpacing"
)
);
...
...
@@ -1873,9 +1946,17 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
}
if
(
true
==
m_oBorderBar
.
IsValid
()
)
sBorder
.
AppendFormat
(
_T
(
"<w:between %ls />"
),
m_oBorderBar
.
RenderToOOX
(
oNewParam
).
GetBuffer
()
);
{
sBorder
+=
_T
(
"<w:between "
);
sBorder
+=
m_oBorderBar
.
RenderToOOX
(
oNewParam
);
sBorder
+=
_T
(
"/>"
);
}
if
(
false
==
sBorder
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:pBdr>%ls</w:pBdr>"
),
sBorder
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:pBdr>"
);
sResult
+=
sBorder
;
sResult
+=
_T
(
"</w:pBdr>"
);
}
if
(
true
==
m_oFrame
.
IsValid
()
)
sResult
.
Append
(
m_oFrame
.
RenderToOOX
(
oRenderParameter
)
);
...
...
@@ -1890,10 +1971,16 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
case
tf_frmtxtbrlv
:
sResult
.
Append
(
_T
(
"<w:textFlow w:val=
\"
tbrlV
\"
/>"
)
);
break
;
}
if
(
true
==
m_oTabs
.
IsValid
()
)
sResult
.
AppendFormat
(
m_oTabs
.
RenderToOOX
(
oRenderParameter
)
);
{
sResult
+=
m_oTabs
.
RenderToOOX
(
oRenderParameter
);
}
CString
sCharProp
=
m_oCharProperty
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCharProp
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:rPr>%ls</w:rPr>"
),
sCharProp
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
sCharProp
;
sResult
+=
_T
(
"</w:rPr>"
);
}
return
sResult
;
}
CString
RtfCellProperty
::
RenderToRtf
(
RenderParameter
oRenderParameter
)
...
...
@@ -2013,7 +2100,11 @@ CString RtfCellProperty::RenderToOOX(RenderParameter oRenderParameter)
if
(
3
==
m_nIsPaddingBottom
&&
PROP_DEF
!=
m_nPaddingBottom
)
sResult
.
AppendFormat
(
_T
(
"<w:bottom w:w=
\"
%d
\"
w:type=
\"
dxa
\"
/>"
),
m_nPaddingBottom
);
if
(
false
==
sMargin
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:tcMar>%ls</w:tcMar>"
),
sMargin
.
GetBuffer
());
{
sResult
+=
_T
(
"<w:tcMar>"
);
sResult
+=
sMargin
;
sResult
+=
_T
(
"</w:tcMar>"
);
}
//if( true == m_bIsSpacingLeft )
// sResult.Append(_T("trspdl3"));
...
...
@@ -2085,18 +2176,30 @@ CString RtfCellProperty::RenderToOOX(RenderParameter oRenderParameter)
if
(
true
==
m_oBorderInsideH
.
IsValid
()
)
{
oNewParam
.
sValue
=
_T
(
"w:insideH"
);
s
Border
.
Append
(
m_oBorderInsideH
.
RenderToOOX
(
oNewParam
)
);
s
Result
+=
m_oBorderInsideH
.
RenderToOOX
(
oNewParam
);
}
if
(
true
==
m_oBorderInsideV
.
IsValid
()
)
{
oNewParam
.
sValue
=
_T
(
"w:insideV"
);
s
Border
.
Append
(
m_oBorderInsideV
.
RenderToOOX
(
oNewParam
)
);
s
Result
+=
m_oBorderInsideV
.
RenderToOOX
(
oNewParam
);
}
if
(
false
==
sBorder
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:tcBorders>%ls</w:tcBorders>"
),
sBorder
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:tcBorders>"
);
sResult
+=
sBorder
;
sResult
+=
_T
(
"</w:tcBorders>"
);
}
if
(
true
==
m_oShading
.
IsValid
()
)
{
if
(
PROP_DEF
!=
m_nShadingPctFrom
&&
PROP_DEF
!=
m_oShading
.
m_nValue
)
{
// todooo тут цвет подложки подкладывается от ячейки, таблицы или еще какой хрени
// пока берем второй цвет паттерна Romanization_Armenian.rtf
m_oShading
.
m_nBackColor
=
m_oShading
.
m_nForeColor
*
(
m_oShading
.
m_nValue
/
10000.
);
}
sResult
.
Append
(
m_oShading
.
RenderToOOX
(
oRenderParameter
)
);
}
switch
(
m_eAlign
)
{
...
...
@@ -2269,15 +2372,17 @@ CString RtfTableProperty::RenderToRtf(RenderParameter oRenderParameter)
CString
RtfTableProperty
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
//if( PROP_DEF != m_nStyle )
//{
// RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
// RtfStylePtr oCurStyle;
// if( true == poDocument->m_oStyleTable.GetStyle( m_nStyle, oCurStyle) )
// {
// sResult.AppendFormat( _T("<w:tblStyle w:val=\"%ls\" />") , oCurStyle->m_sName );
// }
//}
if
(
PROP_DEF
!=
m_nStyle
)
{
RtfDocument
*
poDocument
=
static_cast
<
RtfDocument
*>
(
oRenderParameter
.
poDocument
);
RtfStylePtr
oCurStyle
;
if
(
true
==
poDocument
->
m_oStyleTable
.
GetStyle
(
m_nStyle
,
oCurStyle
)
)
{
sResult
+=
_T
(
"<w:tblStyle w:val=
\"
"
);
sResult
+=
oCurStyle
->
m_sName
;
sResult
+=
_T
(
"
\"
/>"
);
}
}
RENDER_OOX_BOOL
(
m_bBidi
,
sResult
,
_T
(
"w:bidiVisual"
)
);
if
(
PROP_DEF
==
m_nAutoFit
||
0
==
m_nAutoFit
)
sResult
.
Append
(
_T
(
"<w:tblLayout w:type=
\"
fixed
\"
/>"
)
);
...
...
@@ -2354,7 +2459,11 @@ CString RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
case
vp_posyout
:
sFloatingPosition
.
Append
(
_T
(
" w:tblpYSpec=
\"
outside
\"
"
)
);
break
;
}
if
(
false
==
sFloatingPosition
.
IsEmpty
()
)
sResult
.
AppendFormat
(
_T
(
"<w:tblpPr %ls/>"
),
sFloatingPosition
.
GetBuffer
()
);
{
sResult
+=
_T
(
"<w:tblpPr "
);
sResult
+=
sFloatingPosition
;
sResult
+=
_T
(
"/>"
);
}
if
(
PROP_DEF
!=
m_nWidth
&&
(
2
==
m_eMUWidth
||
3
==
m_eMUWidth
))
{
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h
View file @
9ea214e1
...
...
@@ -1870,14 +1870,14 @@ public:
DEFAULT_PROPERTY
(
m_nWidth
)
m_eMUWidth
=
mu_none
;
m_nDefCellMarBottom
=
0
;
m_nDefCellMarRight
=
108
;
m_nDefCellMarLeft
=
108
;
m_nDefCellMarTop
=
0
;
//
DEFAULT_PROPERTY( m_nDefCellMarBottom )
//
DEFAULT_PROPERTY( m_nDefCellMarRight )
//
DEFAULT_PROPERTY( m_nDefCellMarLeft )
//
DEFAULT_PROPERTY( m_nDefCellMarTop )
//
m_nDefCellMarBottom = 0;
//
m_nDefCellMarRight = 108;
//
m_nDefCellMarLeft = 108;
//
m_nDefCellMarTop = 0;
DEFAULT_PROPERTY
(
m_nDefCellMarBottom
)
DEFAULT_PROPERTY
(
m_nDefCellMarRight
)
DEFAULT_PROPERTY
(
m_nDefCellMarLeft
)
DEFAULT_PROPERTY
(
m_nDefCellMarTop
)
m_nDefCellMarBottomUnits
=
3
;
m_nDefCellMarRightUnits
=
3
;
...
...
@@ -2171,6 +2171,7 @@ public:
RtfBorder
m_oBorderInsideV
;
RtfShadingCell
m_oShading
;
int
m_nShadingPctFrom
;
typedef
enum
{
ca_none
,
ca_Top
,
//\clvertalt Text is top-aligned in cell (the default).
...
...
@@ -2256,7 +2257,9 @@ public:
m_oBorderBottom
.
SetDefault
();
m_oBorderInsideH
.
SetDefault
();
m_oBorderInsideV
.
SetDefault
();
m_oShading
.
SetDefault
();
DEFAULT_PROPERTY
(
m_nShadingPctFrom
)
m_eAlign
=
ca_none
;
m_oCellFlow
=
cf_none
;
...
...
@@ -2324,6 +2327,7 @@ public:
m_oBorderInsideV
.
Merge
(
oCellPr
.
m_oBorderInsideV
);
m_oShading
.
Merge
(
oCellPr
.
m_oShading
);
MERGE_PROPERTY
(
m_nShadingPctFrom
,
oCellPr
)
MERGE_PROPERTY_DEF
(
m_eAlign
,
oCellPr
,
ca_none
)
MERGE_PROPERTY_DEF
(
m_oCellFlow
,
oCellPr
,
cf_none
)
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
View file @
9ea214e1
...
...
@@ -95,13 +95,39 @@ CString OOXDocumentWriter::CreateXmlEnd( )
OOXNumberingWriter
*
poNumberingWriter
=
static_cast
<
OOXNumberingWriter
*>
(
m_oWriter
.
m_poNumberingWriter
);
oNewParam
.
poRels
=
poNumberingWriter
->
m_oRelsWriter
.
get
();
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_NUMBERING
;
poNumberingWriter
->
AddNumbering
(
m_oDocument
.
m_oListTabel
.
RenderToOOX
(
oNewParam
)
);
poNumberingWriter
->
AddNumbering
(
m_oDocument
.
m_oListOverrideTabel
.
RenderToOOX
(
oNewParam
)
);
//style.xml
OOXStylesWriter
*
poStylesWriter
=
static_cast
<
OOXStylesWriter
*>
(
m_oWriter
.
m_poStylesWriter
);
oNewParam
.
poRels
=
poNumberingWriter
->
m_oRelsWriter
.
get
();
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_NUMBERING
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_STYLES
;
CString
sStyles
;
CString
sTempParaDef
=
m_oDocument
.
m_oDefaultParagraphProp
.
RenderToOOX
(
oNewParam
);
CString
sTempCharDef
=
m_oDocument
.
m_oDefaultCharProp
.
RenderToOOX
(
oNewParam
);
if
(
false
==
sTempParaDef
.
IsEmpty
()
||
false
==
sTempCharDef
.
IsEmpty
()
)
{
sStyles
+=
_T
(
"<w:docDefaults>"
);
if
(
false
==
sTempParaDef
.
IsEmpty
()
)
{
sStyles
+=
_T
(
"<w:pPrDefault><w:pPr>"
);
sStyles
+=
sTempParaDef
;
sStyles
+=
_T
(
"</w:pPr></w:pPrDefault>"
);
}
if
(
false
==
sTempCharDef
.
IsEmpty
()
)
{
sStyles
+=
_T
(
"<w:rPrDefault><w:rPr>"
);
sStyles
+=
sTempCharDef
;
sStyles
+=
_T
(
"</w:rPr></w:rPrDefault>"
);
}
sStyles
.
Append
(
_T
(
"</w:docDefaults>"
));
}
sStyles
+=
m_oDocument
.
m_oStyleTable
.
RenderToOOX
(
oNewParam
);
poStylesWriter
->
AddContent
(
sStyles
);
//core.xml
oNewParam
.
poRels
=
NULL
;
...
...
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