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
a5e821cd
Commit
a5e821cd
authored
Apr 19, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
cb5d9233
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
447 additions
and
356 deletions
+447
-356
ASCOfficeOdfFile/src/docx/pptx_text_context.cpp
ASCOfficeOdfFile/src/docx/pptx_text_context.cpp
+36
-38
ASCOfficeOdfFile/src/docx/xlsx_textcontext.cpp
ASCOfficeOdfFile/src/docx/xlsx_textcontext.cpp
+37
-38
ASCOfficeOdfFile/src/odf/datatypes/presentationclass.cpp
ASCOfficeOdfFile/src/odf/datatypes/presentationclass.cpp
+33
-50
ASCOfficeOdfFile/src/odf/style_paragraph_properties_pptx.cpp
ASCOfficeOdfFile/src/odf/style_paragraph_properties_pptx.cpp
+1
-1
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
+99
-62
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h
+6
-3
ASCOfficeOdfFileW/source/OdfFormat/odp_conversion_context.cpp
...fficeOdfFileW/source/OdfFormat/odp_conversion_context.cpp
+20
-1
ASCOfficeOdfFileW/source/OdfFormat/odp_conversion_context.h
ASCOfficeOdfFileW/source/OdfFormat/odp_conversion_context.h
+4
-4
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp
+173
-131
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.h
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.h
+7
-3
ASCOfficeOdfFileW/source/Oox2OdfConverter/PptxConverter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/PptxConverter.cpp
+31
-25
No files found.
ASCOfficeOdfFile/src/docx/pptx_text_context.cpp
View file @
a5e821cd
...
...
@@ -72,8 +72,8 @@ public:
void
start_base_style
(
const
std
::
wstring
baseStyleName
,
const
odf_types
::
style_family
::
type
baseStyleType
);
void
end_base_style
();
void
ApplyTextProperties
(
std
::
wstring
style
,
odf_reader
::
text_format_properties_content
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
);
void
ApplyParagraphProperties
(
std
::
wstring
style
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
);
void
ApplyTextProperties
(
std
::
wstring
style
,
std
::
wstring
para_style
,
odf_reader
::
text_format_properties_content
&
propertiesOut
);
void
ApplyParagraphProperties
(
std
::
wstring
para_style
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
);
void
ApplyListProperties
(
odf_reader
::
paragraph_format_properties
&
propertiesOut
,
int
Level
);
void
set_local_styles_container
(
odf_reader
::
styles_container
*
local_styles_
);
//это если стили объектов содержатся в другом документе
...
...
@@ -239,32 +239,37 @@ void pptx_text_context::Impl::end_hyperlink(std::wstring hId)
dump_run
();
hyperlink_hId
=
L""
;
}
void
pptx_text_context
::
Impl
::
ApplyTextProperties
(
std
::
wstring
style_name
,
odf_reader
::
text_format_properties_content
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
)
void
pptx_text_context
::
Impl
::
ApplyTextProperties
(
std
::
wstring
style_name
,
std
::
wstring
para_style_name
,
odf_reader
::
text_format_properties_content
&
propertiesOut
)
{
std
::
vector
<
const
odf_reader
::
style_instance
*>
instances
;
odf_reader
::
style_instance
*
defaultStyle
=
NULL
;
odf_reader
::
style_instance
*
style
=
NULL
;
odf_reader
::
style_instance
*
baseStyle
=
NULL
;
odf_reader
::
style_instance
*
defaultStyle
=
NULL
;
odf_reader
::
style_instance
*
para_style
=
NULL
;
odf_reader
::
style_instance
*
text_style
=
NULL
;
odf_reader
::
style_instance
*
baseStyle
=
NULL
;
if
(
local_styles_ptr_
)
{
style
=
local_styles_ptr_
->
style_by_name
(
style_name
,
Type
,
false
/*process_headers_footers_*/
);
defaultStyle
=
local_styles_ptr_
->
style_default_by_type
(
Type
);
baseStyle
=
local_styles_ptr_
->
style_by_name
(
base_style_name_
,
base_style_family_
,
false
/*process_headers_footers_*/
);
para_style
=
local_styles_ptr_
->
style_by_name
(
para_style_name
,
odf_types
::
style_family
::
Paragraph
,
false
/*process_headers_footers_*/
);
text_style
=
local_styles_ptr_
->
style_by_name
(
style_name
,
odf_types
::
style_family
::
Text
,
false
/*process_headers_footers_*/
);
defaultStyle
=
local_styles_ptr_
->
style_default_by_type
(
odf_types
::
style_family
::
Text
);
baseStyle
=
local_styles_ptr_
->
style_by_name
(
base_style_name_
,
base_style_family_
,
false
/*process_headers_footers_*/
);
}
else
{
style
=
odf_context_
.
styleContainer
().
style_by_name
(
style_name
,
Type
,
false
/*process_headers_footers_*/
);
defaultStyle
=
odf_context_
.
styleContainer
().
style_default_by_type
(
Type
);
baseStyle
=
odf_context_
.
styleContainer
().
style_by_name
(
base_style_name_
,
base_style_family_
,
false
/*process_headers_footers_*/
);
para_style
=
odf_context_
.
styleContainer
().
style_by_name
(
para_style_name
,
odf_types
::
style_family
::
Paragraph
,
false
/*process_headers_footers_*/
);
text_style
=
odf_context_
.
styleContainer
().
style_by_name
(
style_name
,
odf_types
::
style_family
::
Text
,
false
/*process_headers_footers_*/
);
defaultStyle
=
odf_context_
.
styleContainer
().
style_default_by_type
(
odf_types
::
style_family
::
Text
);
baseStyle
=
odf_context_
.
styleContainer
().
style_by_name
(
base_style_name_
,
base_style_family_
,
false
/*process_headers_footers_*/
);
}
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
if
(
baseStyle
)
instances
.
push_back
(
baseStyle
);
if
(
style
)
instances
.
push_back
(
style
);
if
(
para_style
)
instances
.
push_back
(
para_style
);
if
(
text_style
)
instances
.
push_back
(
text_style
);
if
(
style
)
get_styles_context
().
start_process_style
(
style
);
else
get_styles_context
().
start_process_style
(
baseStyle
);
if
(
text_style
)
get_styles_context
().
start_process_style
(
text_style
);
else
if
(
para_style
)
get_styles_context
().
start_process_style
(
para_style
);
else
get_styles_context
().
start_process_style
(
baseStyle
);
propertiesOut
.
apply_from
(
calc_text_properties_content
(
instances
));
}
...
...
@@ -323,33 +328,33 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
}
void
pptx_text_context
::
Impl
::
ApplyParagraphProperties
(
std
::
wstring
style_name
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
)
void
pptx_text_context
::
Impl
::
ApplyParagraphProperties
(
std
::
wstring
style_name
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
)
{
std
::
vector
<
const
odf_reader
::
style_instance
*>
instances
;
odf_reader
::
style_instance
*
style
=
NULL
;
odf_reader
::
style_instance
*
defaultStyle
=
NULL
;
odf_reader
::
style_instance
*
baseStyle
=
NULL
;
odf_reader
::
style_instance
*
style
=
NULL
;
odf_reader
::
style_instance
*
defaultStyle
=
NULL
;
odf_reader
::
style_instance
*
baseStyle
=
NULL
;
if
(
local_styles_ptr_
)
{
style
=
local_styles_ptr_
->
style_by_name
(
style_name
,
Type
,
false
/*process_headers_footers_*/
);
defaultStyle
=
local_styles_ptr_
->
style_default_by_type
(
Type
);
baseStyle
=
local_styles_ptr_
->
style_by_name
(
base_style_name_
,
base_style_family_
,
false
/*process_headers_footers_*/
);
style
=
local_styles_ptr_
->
style_by_name
(
style_name
,
odf_types
::
style_family
::
Paragraph
,
false
/*process_headers_footers_*/
);
defaultStyle
=
local_styles_ptr_
->
style_default_by_type
(
odf_types
::
style_family
::
Paragraph
);
baseStyle
=
local_styles_ptr_
->
style_by_name
(
base_style_name_
,
base_style_family_
,
false
/*process_headers_footers_*/
);
}
else
{
style
=
odf_context_
.
styleContainer
().
style_by_name
(
style_name
,
Type
,
false
/*process_headers_footers_*/
);
defaultStyle
=
odf_context_
.
styleContainer
().
style_default_by_type
(
Type
);
baseStyle
=
odf_context_
.
styleContainer
().
style_by_name
(
base_style_name_
,
base_style_family_
,
false
/*process_headers_footers_*/
);
style
=
odf_context_
.
styleContainer
().
style_by_name
(
style_name
,
odf_types
::
style_family
::
Paragraph
,
false
/*process_headers_footers_*/
);
defaultStyle
=
odf_context_
.
styleContainer
().
style_default_by_type
(
odf_types
::
style_family
::
Paragraph
);
baseStyle
=
odf_context_
.
styleContainer
().
style_by_name
(
base_style_name_
,
base_style_family_
,
false
/*process_headers_footers_*/
);
}
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
if
(
baseStyle
)
instances
.
push_back
(
baseStyle
);
if
(
style
)
instances
.
push_back
(
style
);
if
(
style
)
get_styles_context
().
start_process_style
(
style
);
else
get_styles_context
().
start_process_style
(
baseStyle
);
if
(
style
)
get_styles_context
().
start_process_style
(
style
);
else
get_styles_context
().
start_process_style
(
baseStyle
);
propertiesOut
.
apply_from
(
calc_paragraph_properties_content
(
instances
));
}
...
...
@@ -360,9 +365,9 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
int
level
=
list_style_stack_
.
size
()
-
1
;
odf_reader
::
paragraph_format_properties
paragraph_properties_
;
odf_reader
::
paragraph_format_properties
paragraph_properties_
;
ApplyParagraphProperties
(
paragraph_style_name_
,
paragraph_properties_
,
odf_types
::
style_family
::
Paragraph
);
ApplyParagraphProperties
(
paragraph_style_name_
,
paragraph_properties_
);
ApplyListProperties
(
paragraph_properties_
,
level
);
//выравнивания листа накатим на свойства параграфа
paragraph_properties_
.
pptx_convert
(
pptx_context_
);
...
...
@@ -403,16 +408,9 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
if
(
paragraph_style_name_
.
empty
()
&&
span_style_name_
.
empty
()
&&
!
(
!
hyperlink_hId
.
empty
())
&&
base_style_name_
.
empty
())
return
;
odf_reader
::
text_format_properties_content
text_properties_paragraph_
;
ApplyTextProperties
(
paragraph_style_name_
,
text_properties_paragraph_
,
odf_types
::
style_family
::
Paragraph
);
odf_reader
::
text_format_properties_content
text_properties_span_
;
ApplyTextProperties
(
span_style_name_
,
text_properties_span_
,
odf_types
::
style_family
::
Text
);
odf_reader
::
text_format_properties_content
text_properties_
;
text_properties_
.
apply_from
(
text_properties_paragraph_
);
text_properties_
.
apply_from
(
text_properties_span_
);
ApplyTextProperties
(
span_style_name_
,
paragraph_style_name_
,
text_properties_
);
get_styles_context
().
start
();
...
...
ASCOfficeOdfFile/src/docx/xlsx_textcontext.cpp
View file @
a5e821cd
...
...
@@ -84,10 +84,10 @@ public:
void
serialize_shared_strings
(
std
::
wostream
&
strm
);
void
ApplyTextProperties
(
std
::
wstring
style
,
odf_reader
::
text_format_properties_content
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
);
void
ApplyParagraphProperties
(
std
::
wstring
style
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
);
void
ApplyTextProperties
(
std
::
wstring
style
,
std
::
wstring
para_style
,
odf_reader
::
text_format_properties_content
&
propertiesOut
);
void
ApplyParagraphProperties
(
std
::
wstring
style
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
);
void
set_local_styles_container
(
odf_reader
::
styles_container
*
local_styles_
);
//это если стили объектов содержатся в другом документе
void
set_local_styles_container
(
odf_reader
::
styles_container
*
local_styles_
);
//это если стили объектов содержатся в другом документе
bool
is_drawing_context
(){
return
in_draw
;}
...
...
@@ -237,48 +237,54 @@ void xlsx_text_context::Impl::end_hyperlink(std::wstring hId)
hyperlink_hId
=
hId
;
}
void
xlsx_text_context
::
Impl
::
ApplyParagraphProperties
(
std
::
wstring
style
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
)
void
xlsx_text_context
::
Impl
::
ApplyParagraphProperties
(
std
::
wstring
style
,
odf_reader
::
paragraph_format_properties
&
propertiesOut
)
{
std
::
vector
<
const
odf_reader
::
style_instance
*>
instances
;
odf_reader
::
style_instance
*
defaultStyle
=
NULL
;
odf_reader
::
style_instance
*
paraStyle
=
NULL
;
if
(
local_styles_ptr_
)
{
odf_reader
::
style_instance
*
defaultStyle
=
local_styles_ptr_
->
style_default_by_type
(
Type
);
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
odf_reader
::
style_instance
*
styleInst
=
local_styles_ptr_
->
style_by_name
(
style
,
Type
,
false
/*process_headers_footers_*/
);
if
(
styleInst
)
instances
.
push_back
(
styleInst
);
defaultStyle
=
local_styles_ptr_
->
style_default_by_type
(
odf_types
::
style_family
::
Paragraph
);
paraStyle
=
local_styles_ptr_
->
style_by_name
(
style
,
odf_types
::
style_family
::
Paragraph
,
false
/*process_headers_footers_*/
);
}
else
{
odf_reader
::
style_instance
*
defaultStyle
=
styles_
.
style_default_by_type
(
Type
);
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
odf_reader
::
style_instance
*
styleInst
=
styles_
.
style_by_name
(
style
,
Type
,
false
/*process_headers_footers_*/
);
if
(
styleInst
)
instances
.
push_back
(
styleInst
);
defaultStyle
=
styles_
.
style_default_by_type
(
odf_types
::
style_family
::
Paragraph
);
paraStyle
=
styles_
.
style_by_name
(
style
,
odf_types
::
style_family
::
Paragraph
,
false
/*process_headers_footers_*/
);
}
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
if
(
paraStyle
)
instances
.
push_back
(
paraStyle
);
propertiesOut
.
apply_from
(
calc_paragraph_properties_content
(
instances
));
}
void
xlsx_text_context
::
Impl
::
ApplyTextProperties
(
std
::
wstring
style
,
odf_reader
::
text_format_properties_content
&
propertiesOut
,
odf_types
::
style_family
::
type
Type
)
void
xlsx_text_context
::
Impl
::
ApplyTextProperties
(
std
::
wstring
style
,
std
::
wstring
para_style
,
odf_reader
::
text_format_properties_content
&
propertiesOut
)
{
std
::
vector
<
const
odf_reader
::
style_instance
*>
instances
;
odf_reader
::
style_instance
*
defaultStyle
=
NULL
;
odf_reader
::
style_instance
*
textStyle
=
NULL
;
odf_reader
::
style_instance
*
paraStyle
=
NULL
;
if
(
local_styles_ptr_
)
{
odf_reader
::
style_instance
*
defaultStyle
=
local_styles_ptr_
->
style_default_by_type
(
Type
);
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
odf_reader
::
style_instance
*
styleInst
=
local_styles_ptr_
->
style_by_name
(
style
,
Type
,
false
/*process_headers_footers_*/
);
if
(
styleInst
)
instances
.
push_back
(
styleInst
);
defaultStyle
=
local_styles_ptr_
->
style_default_by_type
(
odf_types
::
style_family
::
Text
);
paraStyle
=
local_styles_ptr_
->
style_by_name
(
para_style
,
odf_types
::
style_family
::
Paragraph
,
false
/*process_headers_footers_*/
);
textStyle
=
local_styles_ptr_
->
style_by_name
(
style
,
odf_types
::
style_family
::
Text
,
false
/*process_headers_footers_*/
);
}
else
{
odf_reader
::
style_instance
*
defaultStyle
=
styles_
.
style_default_by_type
(
Type
);
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
odf_reader
::
style_instance
*
styleInst
=
styles_
.
style_by_name
(
style
,
Type
,
false
/*process_headers_footers_*/
);
if
(
styleInst
)
instances
.
push_back
(
styleInst
);
defaultStyle
=
styles_
.
style_default_by_type
(
odf_types
::
style_family
::
Text
);
paraStyle
=
styles_
.
style_by_name
(
para_style
,
odf_types
::
style_family
::
Paragraph
,
false
/*process_headers_footers_*/
);
textStyle
=
styles_
.
style_by_name
(
style
,
odf_types
::
style_family
::
Text
,
false
/*process_headers_footers_*/
);
}
if
(
defaultStyle
)
instances
.
push_back
(
defaultStyle
);
if
(
paraStyle
)
instances
.
push_back
(
paraStyle
);
if
(
textStyle
)
instances
.
push_back
(
textStyle
);
propertiesOut
.
apply_from
(
calc_text_properties_content
(
instances
));
}
...
...
@@ -291,10 +297,10 @@ void xlsx_text_context::Impl::write_pPr (std::wostream & strm)
{
if
(
paragraph_style_name_
.
empty
())
return
;
odf_reader
::
paragraph_format_properties
paragraph_format_properties_
;
odf_reader
::
paragraph_format_properties
paragraph_format_properties_
;
ApplyParagraphProperties
(
paragraph_style_name_
,
paragraph_format_properties_
,
odf_types
::
style_family
::
Paragraph
);
paragraph_format_properties_
.
xlsx_convert
(
strm
,
in_draw
);
ApplyParagraphProperties
(
paragraph_style_name_
,
paragraph_format_properties_
);
paragraph_format_properties_
.
xlsx_convert
(
strm
,
in_draw
);
}
void
xlsx_text_context
::
Impl
::
write_rPr
(
std
::
wostream
&
strm
)
...
...
@@ -303,20 +309,13 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
&&
!
(
!
hyperlink_hId
.
empty
()
&&
in_draw
)
&&
!
(
text_properties_cell_
&&
in_cell_content
))
return
;
odf_reader
::
text_format_properties_content
text_properties_paragraph_
;
odf_reader
::
text_format_properties_content
text_properties_span_
;
ApplyTextProperties
(
paragraph_style_name_
,
text_properties_paragraph_
,
odf_types
::
style_family
::
Paragraph
);
ApplyTextProperties
(
span_style_name_
,
text_properties_span_
,
odf_types
::
style_family
::
Text
);
odf_reader
::
text_format_properties_content
text_properties_
;
if
(
in_cell_content
&&
text_properties_cell_
)
{
text_properties_
.
apply_from
(
*
text_properties_cell_
);
}
text_properties_
.
apply_from
(
text_properties_paragraph_
);
text_properties_
.
apply_from
(
text_properties_span
_
);
}
ApplyTextProperties
(
span_style_name_
,
paragraph_style_name_
,
text_properties
_
);
_CP_OPT
(
double
)
dValFontSize
;
if
(
text_properties_
.
fo_font_size_
)
...
...
ASCOfficeOdfFile/src/odf/datatypes/presentationclass.cpp
View file @
a5e821cd
...
...
@@ -41,22 +41,22 @@ std::wostream & operator << (std::wostream & _Wostream, const presentation_class
std
::
wstring
res
=
L""
;
switch
(
_Val
.
get_type
())
{
case
presentation_class
:
:
title
:
_Wostream
<<
L"title"
;
break
;
case
presentation_class
:
:
subtitle
:
_Wostream
<<
L"subtitle"
;
break
;
case
presentation_class
:
:
graphic
:
_Wostream
<<
L"graphic"
;
break
;
case
presentation_class
:
:
object
:
_Wostream
<<
L"object"
;
break
;
case
presentation_class
:
:
chart
:
_Wostream
<<
L"chart"
;
break
;
case
presentation_class
:
:
table
:
_Wostream
<<
L"table"
;
break
;
case
presentation_class
:
:
orgchart
:
_Wostream
<<
L"orgchart"
;
break
;
case
presentation_class
:
:
header
:
_Wostream
<<
L"header"
;
break
;
case
presentation_class
:
:
footer
:
_Wostream
<<
L"footer"
;
break
;
case
presentation_class
:
:
date_time
:
_Wostream
<<
L"date
_time"
;
break
;
case
presentation_class
:
:
page_number
:
_Wostream
<<
L"page
_number"
;
break
;
case
presentation_class
:
:
page
:
_Wostream
<<
L"page"
;
break
;
case
presentation_class
:
:
notes
:
_Wostream
<<
L"notes"
;
break
;
case
presentation_class
:
:
handout
:
_Wostream
<<
L"handout"
;
break
;
case
presentation_class
:
:
outline
:
_Wostream
<<
L"outline"
;
break
;
case
presentation_class
:
:
text
:
_Wostream
<<
L"text"
;
break
;
case
presentation_class
:
:
title
:
_Wostream
<<
L"title"
;
break
;
case
presentation_class
:
:
subtitle
:
_Wostream
<<
L"subtitle"
;
break
;
case
presentation_class
:
:
graphic
:
_Wostream
<<
L"graphic"
;
break
;
case
presentation_class
:
:
object
:
_Wostream
<<
L"object"
;
break
;
case
presentation_class
:
:
chart
:
_Wostream
<<
L"chart"
;
break
;
case
presentation_class
:
:
table
:
_Wostream
<<
L"table"
;
break
;
case
presentation_class
:
:
orgchart
:
_Wostream
<<
L"orgchart"
;
break
;
case
presentation_class
:
:
header
:
_Wostream
<<
L"header"
;
break
;
case
presentation_class
:
:
footer
:
_Wostream
<<
L"footer"
;
break
;
case
presentation_class
:
:
date_time
:
_Wostream
<<
L"date
-time"
;
break
;
case
presentation_class
:
:
page_number
:
_Wostream
<<
L"page
-number"
;
break
;
case
presentation_class
:
:
page
:
_Wostream
<<
L"page"
;
break
;
case
presentation_class
:
:
notes
:
_Wostream
<<
L"notes"
;
break
;
case
presentation_class
:
:
handout
:
_Wostream
<<
L"handout"
;
break
;
case
presentation_class
:
:
outline
:
_Wostream
<<
L"outline"
;
break
;
case
presentation_class
:
:
text
:
_Wostream
<<
L"text"
;
break
;
}
return
_Wostream
;
}
...
...
@@ -65,41 +65,24 @@ presentation_class presentation_class::parse(const std::wstring & Str)
std
::
wstring
tmp
=
Str
;
boost
::
algorithm
::
to_lower
(
tmp
);
if
(
tmp
==
L"page"
)
return
presentation_class
(
page
);
else
if
(
tmp
==
L"title"
)
return
presentation_class
(
title
);
else
if
(
tmp
==
L"outline"
)
return
presentation_class
(
outline
);
else
if
(
tmp
==
L"subtitle"
)
return
presentation_class
(
subtitle
);
else
if
(
tmp
==
L"text"
)
return
presentation_class
(
text
);
else
if
(
tmp
==
L"graphic"
)
return
presentation_class
(
graphic
);
else
if
(
tmp
==
L"object"
)
return
presentation_class
(
object
);
else
if
(
tmp
==
L"chart"
)
return
presentation_class
(
chart
);
else
if
(
tmp
==
L"table"
)
return
presentation_class
(
table
);
else
if
(
tmp
==
L"orgchart"
)
return
presentation_class
(
orgchart
);
else
if
(
tmp
==
L"notes"
)
return
presentation_class
(
notes
);
else
if
(
tmp
==
L"handout"
)
return
presentation_class
(
handout
);
else
if
(
tmp
==
L"header"
)
return
presentation_class
(
header
);
else
if
(
tmp
==
L"footer"
)
return
presentation_class
(
footer
);
else
if
(
tmp
==
L"date-time"
)
return
presentation_class
(
date_time
);
else
if
(
tmp
==
L"page-number"
)
return
presentation_class
(
page_number
);
else
if
(
tmp
==
L"page"
)
return
presentation_class
(
page
);
else
if
(
tmp
==
L"title"
)
return
presentation_class
(
title
);
else
if
(
tmp
==
L"outline"
)
return
presentation_class
(
outline
);
else
if
(
tmp
==
L"subtitle"
)
return
presentation_class
(
subtitle
);
else
if
(
tmp
==
L"text"
)
return
presentation_class
(
text
);
else
if
(
tmp
==
L"graphic"
)
return
presentation_class
(
graphic
);
else
if
(
tmp
==
L"object"
)
return
presentation_class
(
object
);
else
if
(
tmp
==
L"chart"
)
return
presentation_class
(
chart
);
else
if
(
tmp
==
L"table"
)
return
presentation_class
(
table
);
else
if
(
tmp
==
L"orgchart"
)
return
presentation_class
(
orgchart
);
else
if
(
tmp
==
L"notes"
)
return
presentation_class
(
notes
);
else
if
(
tmp
==
L"handout"
)
return
presentation_class
(
handout
);
else
if
(
tmp
==
L"header"
)
return
presentation_class
(
header
);
else
if
(
tmp
==
L"footer"
)
return
presentation_class
(
footer
);
else
if
(
tmp
==
L"date-time"
)
return
presentation_class
(
date_time
);
else
if
(
tmp
==
L"page-number"
)
return
presentation_class
(
page_number
);
else
{
BOOST_THROW_EXCEPTION
(
errors
::
invalid_attribute
()
);
return
presentation_class
(
page
);
}
}
...
...
ASCOfficeOdfFile/src/odf/style_paragraph_properties_pptx.cpp
View file @
a5e821cd
...
...
@@ -458,7 +458,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
{
CP_XML_NODE
(
L"a:spcBef"
)
{
if
(
fo_margin_
bottom
_
->
get_type
()
==
length_or_percent
::
Length
)
if
(
fo_margin_
top
_
->
get_type
()
==
length_or_percent
::
Length
)
{
std
::
wstring
w_before
=
pptx_process_margin
(
fo_margin_top_
,
length
::
pt
,
100.0
);
CP_XML_NODE
(
L"a:spcPts"
)
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
View file @
a5e821cd
...
...
@@ -76,7 +76,7 @@ struct odf_group_state
scale_cx
=
scale_cy
=
1.
;
flipH
=
flipV
=
false
;
elm
=
elm_
;
elm
=
elm_
;
level
=
level_
;
prev_group
=
prev
;
...
...
@@ -185,19 +185,19 @@ struct odf_drawing_state
presentation_class_
=
boost
::
none
;
presentation_placeholder_
=
boost
::
none
;
rotateAngle
=
boost
::
none
;
rotateAngle
_
=
boost
::
none
;
path_
=
L""
;
view_box_
=
L""
;
path_last_command_
=
L""
;
oox_shape_preset
=
-
1
;
oox_shape_preset
_
=
-
1
;
oox_shape_
.
reset
();
in_group
=
false
;
text_box_tableframe
=
false
;
in_group
_
=
false
;
text_box_tableframe
_
=
false
;
flipH
=
flipV
=
false
;
flipH
_
=
flipV_
=
false
;
}
std
::
vector
<
odf_element_state
>
elements_
;
...
...
@@ -207,28 +207,29 @@ struct odf_drawing_state
_CP_OPT
(
length
)
svg_height_
;
_CP_OPT
(
length
)
svg_width_
;
bool
flipH_
;
bool
flipV_
;
std
::
wstring
name_
;
std
::
wstring
description_
;
int
z_order_
;
bool
hidden_
;
_CP_OPT
(
double
)
rotateAngle
;
_CP_OPT
(
double
)
rotateAngle
_
;
_CP_OPT
(
unsigned
int
)
fill_color_
;
_CP_OPT
(
presentation_class
)
presentation_class_
;
_CP_OPT
(
std
::
wstring
)
presentation_placeholder_
;
bool
flipH
;
bool
flipV
;
std
::
wstring
path_
;
std
::
wstring
view_box_
;
std
::
wstring
path_last_command_
;
oox_shape_ptr
oox_shape_
;
///////////////////////
int
oox_shape_preset
;
bool
in_group
;
bool
text_box_tableframe
;
int
oox_shape_preset
_
;
bool
in_group
_
;
bool
text_box_tableframe
_
;
};
class
odf_drawing_context
::
Impl
...
...
@@ -461,7 +462,7 @@ void odf_drawing_context::start_drawing()
//else
if
(
impl_
->
current_level_
.
size
()
>
0
)
{
impl_
->
current_drawing_state_
.
in_group
=
true
;
impl_
->
current_drawing_state_
.
in_group
_
=
true
;
}
}
...
...
@@ -509,20 +510,20 @@ void odf_drawing_context::end_drawing()
std
::
wstring
strTransform
;
if
(
impl_
->
current_drawing_state_
.
in_group
&&
impl_
->
current_group_
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
&&
impl_
->
current_group_
)
{
double
rotate
=
impl_
->
current_group_
->
rotate
;
if
(
impl_
->
current_drawing_state_
.
rotateAngle
)
rotate
+=
*
impl_
->
current_drawing_state_
.
rotateAngle
;
if
(
impl_
->
current_drawing_state_
.
rotateAngle
_
)
rotate
+=
*
impl_
->
current_drawing_state_
.
rotateAngle
_
;
if
(
fabs
(
rotate
)
>
0.001
)
impl_
->
current_drawing_state_
.
rotateAngle
=
rotate
;
if
(
fabs
(
rotate
)
>
0.001
)
impl_
->
current_drawing_state_
.
rotateAngle
_
=
rotate
;
}
double
x
=
impl_
->
current_drawing_state_
.
svg_x_
?
impl_
->
current_drawing_state_
.
svg_x_
->
get_value
()
:
0
;
double
y
=
impl_
->
current_drawing_state_
.
svg_y_
?
impl_
->
current_drawing_state_
.
svg_y_
->
get_value
()
:
0
;
if
(
impl_
->
current_drawing_state_
.
rotateAngle
)
if
(
impl_
->
current_drawing_state_
.
rotateAngle
_
)
{
if
(
impl_
->
current_drawing_state_
.
in_group
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
)
{
if
(
impl_
->
current_drawing_state_
.
svg_width_
&&
impl_
->
current_drawing_state_
.
svg_height_
)
{
...
...
@@ -532,7 +533,7 @@ void odf_drawing_context::end_drawing()
}
}
strTransform
+=
std
::
wstring
(
L"rotate("
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
impl_
->
current_drawing_state_
.
rotateAngle
.
get
())
+
std
::
wstring
(
L")"
);
strTransform
+=
std
::
wstring
(
L"rotate("
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
impl_
->
current_drawing_state_
.
rotateAngle
_
.
get
())
+
std
::
wstring
(
L")"
);
//так как вращения все в мс относительно центра фигуры, а не от начала координат - убираем смещение
if
(
impl_
->
current_drawing_state_
.
svg_x_
&&
impl_
->
current_drawing_state_
.
svg_y_
)
...
...
@@ -576,14 +577,14 @@ void odf_drawing_context::end_drawing()
placeholder
->
svg_height_
=
impl_
->
current_drawing_state_
.
svg_height_
;
placeholder
->
svg_width_
=
impl_
->
current_drawing_state_
.
svg_width_
;
}
if
(
impl_
->
current_drawing_state_
.
in_group
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
)
{
odf_group_state_ptr
gr
=
impl_
->
current_group_
;
while
(
gr
)
{
impl_
->
current_drawing_state_
.
flipH
=
impl_
->
current_drawing_state_
.
flipH
^
gr
->
flipH
;
impl_
->
current_drawing_state_
.
flipV
=
impl_
->
current_drawing_state_
.
flipV
^
gr
->
flipV
;
impl_
->
current_drawing_state_
.
flipH
_
=
impl_
->
current_drawing_state_
.
flipH_
^
gr
->
flipH
;
impl_
->
current_drawing_state_
.
flipV
_
=
impl_
->
current_drawing_state_
.
flipV_
^
gr
->
flipV
;
gr
=
gr
->
prev_group
;
}
...
...
@@ -594,8 +595,8 @@ void odf_drawing_context::end_drawing()
draw_enhanced_geometry
*
enhan
=
dynamic_cast
<
draw_enhanced_geometry
*>
(
custom
->
draw_enhanced_geometry_
.
get
());
if
(
enhan
)
{
if
(
impl_
->
current_drawing_state_
.
flipV
)
enhan
->
draw_enhanced_geometry_attlist_
.
draw_mirror_vertical_
=
true
;
if
(
impl_
->
current_drawing_state_
.
flipH
)
enhan
->
draw_enhanced_geometry_attlist_
.
draw_mirror_horizontal_
=
true
;
if
(
impl_
->
current_drawing_state_
.
flipV
_
)
enhan
->
draw_enhanced_geometry_attlist_
.
draw_mirror_vertical_
=
true
;
if
(
impl_
->
current_drawing_state_
.
flipH
_
)
enhan
->
draw_enhanced_geometry_attlist_
.
draw_mirror_horizontal_
=
true
;
}
}
else
{
...
...
@@ -615,7 +616,7 @@ void odf_drawing_context::end_drawing()
impl_
->
current_graphic_properties
->
common_horizontal_margin_attlist_
.
fo_margin_right_
=
impl_
->
anchor_settings_
.
fo_margin_right_
;
impl_
->
current_graphic_properties
->
common_vertical_margin_attlist_
.
fo_margin_bottom_
=
impl_
->
anchor_settings_
.
fo_margin_bottom_
;
if
(
draw
&&
!
impl_
->
current_drawing_state_
.
in_group
)
if
(
draw
&&
!
impl_
->
current_drawing_state_
.
in_group
_
)
draw
->
common_draw_attlists_
.
shape_with_text_and_styles_
.
common_text_anchor_attlist_
.
type_
=
impl_
->
anchor_settings_
.
anchor_type_
;
impl_
->
current_graphic_properties
->
style_wrap_
=
impl_
->
anchor_settings_
.
style_wrap_
;
...
...
@@ -728,7 +729,7 @@ void odf_drawing_context::Impl::create_draw_base(int type)
void
odf_drawing_context
::
start_shape
(
int
type
)
{
impl_
->
current_drawing_state_
.
oox_shape_preset
=
type
;
impl_
->
current_drawing_state_
.
oox_shape_preset
_
=
type
;
if
(
type
<
sizeof
(
Shape_Types_Mapping
)
/
sizeof
(
_sh_typ
))
{
...
...
@@ -756,12 +757,21 @@ void odf_drawing_context::start_shape(int type)
}
}
bool
odf_drawing_context
::
is_wordart
()
{
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset_
>
2000
&&
impl_
->
current_drawing_state_
.
oox_shape_preset_
<
3000
)
return
true
;
return
false
;
}
bool
odf_drawing_context
::
change_text_box_2_wordart
()
{
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
>
2000
&&
impl_
->
current_drawing_state_
.
oox_shape_preset
<
3000
)
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
>
2000
&&
impl_
->
current_drawing_state_
.
oox_shape_preset_
<
3000
)
return
true
;
if
(
impl_
->
current_drawing_state_
.
text_box_tableframe
)
return
false
;
if
(
impl_
->
current_drawing_state_
.
presentation_class_
)
return
false
;
if
(
impl_
->
current_drawing_state_
.
text_box_tableframe_
)
return
false
;
if
(
impl_
->
current_drawing_state_
.
elements_
.
empty
())
return
false
;
draw_text_box
*
t
=
dynamic_cast
<
draw_text_box
*>
(
impl_
->
current_drawing_state_
.
elements_
.
back
().
elm
.
get
());
...
...
@@ -799,7 +809,7 @@ bool odf_drawing_context::change_text_box_2_wordart()
impl_
->
current_drawing_state_
.
elements_
.
erase
(
impl_
->
current_drawing_state_
.
elements_
.
end
()
-
2
,
impl_
->
current_drawing_state_
.
elements_
.
end
());
impl_
->
current_drawing_state_
.
elements_
.
push_back
(
state
);
impl_
->
current_drawing_state_
.
oox_shape_preset
=
2031
;
//plain text
impl_
->
current_drawing_state_
.
oox_shape_preset
_
=
2031
;
//plain text
if
(
sz
==
2
)
impl_
->
root_element_
=
draw_elm
;
return
true
;
...
...
@@ -810,8 +820,8 @@ void odf_drawing_context::end_shape()
if
(
impl_
->
current_drawing_state_
.
elements_
.
empty
())
return
;
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
==
2000
)
return
end_text_box
();
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
==
3000
)
return
end_image
();
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
==
2000
)
return
end_text_box
();
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
==
3000
)
return
end_image
();
//вторичные, вычисляемые свойства шейпов
if
(
isLineShape
())
...
...
@@ -848,7 +858,7 @@ void odf_drawing_context::end_shape()
impl_
->
current_drawing_state_
.
svg_x_
=
boost
::
none
;
impl_
->
current_drawing_state_
.
svg_y_
=
boost
::
none
;
if
(
impl_
->
current_drawing_state_
.
flipV
)
if
(
impl_
->
current_drawing_state_
.
flipV
_
)
{
_CP_OPT
(
length
)
tmp
;
...
...
@@ -856,7 +866,7 @@ void odf_drawing_context::end_shape()
line
->
draw_line_attlist_
.
svg_y1_
=
line
->
draw_line_attlist_
.
svg_y2_
;
line
->
draw_line_attlist_
.
svg_y2_
=
tmp
;
}
if
(
impl_
->
current_drawing_state_
.
flipH
)
if
(
impl_
->
current_drawing_state_
.
flipH
_
)
{
_CP_OPT
(
length
)
tmp
;
...
...
@@ -881,11 +891,11 @@ void odf_drawing_context::end_shape()
std
::
wstring
sub_type
;
bool
text_shape
=
false
;
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
<
sizeof
(
Shape_Types_Mapping
)
/
sizeof
(
_sh_typ
))
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
<
sizeof
(
Shape_Types_Mapping
)
/
sizeof
(
_sh_typ
))
{
sub_type
=
Shape_Types_Mapping
[
impl_
->
current_drawing_state_
.
oox_shape_preset
].
first
;
sub_type
=
Shape_Types_Mapping
[
impl_
->
current_drawing_state_
.
oox_shape_preset
_
].
first
;
}
else
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
>
2000
&&
impl_
->
current_drawing_state_
.
oox_shape_preset
<
3000
)
// 3000 - все равно сюда не попадет
else
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
>
2000
&&
impl_
->
current_drawing_state_
.
oox_shape_preset_
<
3000
)
// 3000 - все равно сюда не попадет
{
text_shape
=
true
;
}
...
...
@@ -925,7 +935,7 @@ void odf_drawing_context::end_shape()
}
else
{
oox_shape_ptr
shape_define
=
oox_shape
::
create
(
impl_
->
current_drawing_state_
.
oox_shape_preset
);
oox_shape_ptr
shape_define
=
oox_shape
::
create
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
);
if
(
!
shape_define
)
shape_define
=
impl_
->
current_drawing_state_
.
oox_shape_
;
...
...
@@ -1001,7 +1011,7 @@ bool odf_drawing_context::isLineShape()
draw_path
*
path
=
dynamic_cast
<
draw_path
*>
(
impl_
->
current_level_
.
back
().
get
());
if
(
path
)
return
true
;
switch
(
impl_
->
current_drawing_state_
.
oox_shape_preset
)
switch
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
)
{
case
20
:
//SimpleTypes::shapetypeBentConnector2:
case
21
:
//SimpleTypes::shapetypeBentConnector3:
...
...
@@ -1486,7 +1496,7 @@ void odf_drawing_context::set_viewBox (double W, double H)
}
void
odf_drawing_context
::
set_flip_H
(
bool
bVal
)
{
impl_
->
current_drawing_state_
.
flipH
=
bVal
;
impl_
->
current_drawing_state_
.
flipH
_
=
bVal
;
if
(
impl_
->
current_graphic_properties
==
NULL
)
return
;
if
(
bVal
==
false
)
return
;
...
...
@@ -1498,7 +1508,7 @@ void odf_drawing_context::set_flip_H(bool bVal)
}
void
odf_drawing_context
::
set_flip_V
(
bool
bVal
)
{
impl_
->
current_drawing_state_
.
flipV
=
bVal
;
impl_
->
current_drawing_state_
.
flipV
_
=
bVal
;
if
(
impl_
->
current_graphic_properties
==
NULL
)
return
;
if
(
bVal
==
false
)
return
;
...
...
@@ -1513,7 +1523,7 @@ void odf_drawing_context::set_rotate(double dVal)
{
if
(
dVal
>
180
)
dVal
=
dVal
-
360
;
double
dRotate
=
dVal
/
180.
*
3.14159265358979323846
;
impl_
->
current_drawing_state_
.
rotateAngle
=
dRotate
;
impl_
->
current_drawing_state_
.
rotateAngle
_
=
dRotate
;
}
void
odf_drawing_context
::
set_drawings_rect
(
_CP_OPT
(
double
)
x_pt
,
_CP_OPT
(
double
)
y_pt
,
_CP_OPT
(
double
)
width_pt
,
_CP_OPT
(
double
)
height_pt
)
// "- 1" не задано
...
...
@@ -1742,7 +1752,7 @@ void odf_drawing_context::set_group_flip_V(bool bVal)
{
if
(
impl_
->
group_list_
.
empty
()
)
return
;
impl_
->
current_group_
->
flipV
=
bVal
;
impl_
->
current_group_
->
flipV
=
bVal
;
}
void
odf_drawing_context
::
set_group_z_order
(
int
Val
)
{
...
...
@@ -1767,7 +1777,7 @@ void odf_drawing_context::set_group_flip_H(bool bVal)
{
if
(
impl_
->
group_list_
.
empty
()
)
return
;
impl_
->
current_group_
->
flipH
=
bVal
;
impl_
->
current_group_
->
flipH
=
bVal
;
}
void
odf_drawing_context
::
set_group_rotate
(
int
iVal
)
...
...
@@ -1794,14 +1804,14 @@ void odf_drawing_context::set_position_line(_CP_OPT(double) & x_pt, _CP_OPT(doub
draw_line
*
line
=
dynamic_cast
<
draw_line
*>
(
impl_
->
current_level_
.
back
().
get
());
if
(
line
==
NULL
)
return
;
if
(
impl_
->
current_drawing_state_
.
in_group
&&
impl_
->
current_group_
&&
x_pt
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
&&
impl_
->
current_group_
&&
x_pt
)
x_pt
=
*
x_pt
*
impl_
->
current_group_
->
scale_cx
+
impl_
->
current_group_
->
shift_x
;
// + (impl_->current_group_->flipH ? (impl_->current_group_->cx - 2 * x_pt): 0);
if
(
x_pt
&&
!
line
->
draw_line_attlist_
.
svg_x1_
)
line
->
draw_line_attlist_
.
svg_x1_
=
length
(
length
(
*
x_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
impl_
->
current_drawing_state_
.
in_group
&&
impl_
->
current_group_
&&
y_pt
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
&&
impl_
->
current_group_
&&
y_pt
)
y_pt
=
*
y_pt
*
impl_
->
current_group_
->
scale_cy
+
impl_
->
current_group_
->
shift_y
;
//+ (impl_->current_group_->flipV ? (impl_->current_group_->cy - 2 * y_pt): 0);
...
...
@@ -1809,13 +1819,13 @@ void odf_drawing_context::set_position_line(_CP_OPT(double) & x_pt, _CP_OPT(doub
line
->
draw_line_attlist_
.
svg_y1_
=
length
(
length
(
*
y_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
///////////////////////////////////////
if
(
impl_
->
current_drawing_state_
.
in_group
&&
impl_
->
current_group_
&&
x2_pt
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
&&
impl_
->
current_group_
&&
x2_pt
)
x2_pt
=
*
x2_pt
*
impl_
->
current_group_
->
scale_cx
+
impl_
->
current_group_
->
shift_x
;
// + (impl_->current_group_->flipH ? (impl_->current_group_->cx - 2 * x_pt): 0);
if
(
x2_pt
&&
!
line
->
draw_line_attlist_
.
svg_x2_
)
line
->
draw_line_attlist_
.
svg_x2_
=
length
(
length
(
*
x2_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
impl_
->
current_drawing_state_
.
in_group
&&
impl_
->
current_group_
&&
y2_pt
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
&&
impl_
->
current_group_
&&
y2_pt
)
y2_pt
=
*
y2_pt
*
impl_
->
current_group_
->
scale_cy
+
impl_
->
current_group_
->
shift_y
;
//+ (impl_->current_group_->flipV ? (impl_->current_group_->cy - 2 * y_pt): 0);
...
...
@@ -1841,14 +1851,14 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
{
double
x
=
*
x_pt
;
if
(
impl_
->
current_drawing_state_
.
in_group
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
)
{
for
(
int
i
=
impl_
->
group_list_
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
x
=
(
x
+
impl_
->
group_list_
[
i
]
->
shift_x
)
*
impl_
->
group_list_
[
i
]
->
scale_cx
;
}
}
if
(
!
impl_
->
current_drawing_state_
.
svg_x_
||
impl_
->
current_drawing_state_
.
in_group
)
if
(
!
impl_
->
current_drawing_state_
.
svg_x_
||
impl_
->
current_drawing_state_
.
in_group
_
)
{
impl_
->
current_drawing_state_
.
svg_x_
=
length
(
length
(
x
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
}
...
...
@@ -1858,7 +1868,7 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
{
double
y
=
*
y_pt
;
if
(
impl_
->
current_drawing_state_
.
in_group
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
)
{
for
(
int
i
=
impl_
->
group_list_
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
...
...
@@ -1866,7 +1876,7 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
}
}
if
(
!
impl_
->
current_drawing_state_
.
svg_y_
||
impl_
->
current_drawing_state_
.
in_group
)
if
(
!
impl_
->
current_drawing_state_
.
svg_y_
||
impl_
->
current_drawing_state_
.
in_group
_
)
{
impl_
->
current_drawing_state_
.
svg_y_
=
length
(
length
(
y
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
}
...
...
@@ -1887,7 +1897,7 @@ void odf_drawing_context::get_size( _CP_OPT(double) & width_pt, _CP_OPT(double)
}
void
odf_drawing_context
::
set_size
(
_CP_OPT
(
double
)
&
width_pt
,
_CP_OPT
(
double
)
&
height_pt
)
{
if
(
impl_
->
current_drawing_state_
.
in_group
)
if
(
impl_
->
current_drawing_state_
.
in_group
_
)
{
if
(
width_pt
)
{
...
...
@@ -2129,7 +2139,7 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
style
*
style_
=
NULL
;
if
(
!
draw
->
common_draw_attlists_
.
shape_with_text_and_styles_
.
common_shape_draw_attlist_
.
draw_text_style_name_
)
{
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Paragraph
,
true
,
false
,
-
1
);
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Paragraph
,
true
,
false
,
-
1
);
office_element_ptr
&
style_shape_elm
=
impl_
->
styles_context_
->
last_state
()
->
get_office_element
();
style_
=
dynamic_cast
<
style
*>
(
style_shape_elm
.
get
());
...
...
@@ -2168,10 +2178,37 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
impl_
->
current_paragraph_properties
->
content_
.
style_writing_mode_
=
odf_types
::
writing_mode
(
odf_types
::
writing_mode
::
LrTb
);
break
;
}
}
void
odf_drawing_context
::
set_paragraph_properties
(
style_paragraph_properties
*
paragraph_properties
)
{
if
(
impl_
->
current_drawing_state_
.
elements_
.
empty
())
return
;
if
(
!
impl_
->
current_paragraph_properties
)
{
draw_base
*
draw
=
dynamic_cast
<
draw_base
*>
(
impl_
->
current_drawing_state_
.
elements_
[
0
].
elm
.
get
());
if
(
draw
)
{
if
(
!
draw
->
common_draw_attlists_
.
shape_with_text_and_styles_
.
common_shape_draw_attlist_
.
draw_text_style_name_
)
{
impl_
->
styles_context_
->
create_style
(
L""
,
style_family
::
Paragraph
,
true
,
false
,
-
1
);
office_element_ptr
&
style_shape_elm
=
impl_
->
styles_context_
->
last_state
()
->
get_office_element
();
style
*
style_
=
dynamic_cast
<
style
*>
(
style_shape_elm
.
get
());
if
(
style_
)
{
impl_
->
current_paragraph_properties
=
style_
->
content_
.
get_style_paragraph_properties
();
draw
->
common_draw_attlists_
.
shape_with_text_and_styles_
.
common_shape_draw_attlist_
.
draw_text_style_name_
=
style_
->
style_name_
;
}
}
else
{
//??? find by name
}
}
}
if
(
impl_
->
current_paragraph_properties
)
impl_
->
current_paragraph_properties
->
apply_from
(
paragraph_properties
);
}
void
odf_drawing_context
::
set_textarea_padding
(
_CP_OPT
(
double
)
&
left
,
_CP_OPT
(
double
)
&
top
,
_CP_OPT
(
double
)
&
right
,
_CP_OPT
(
double
)
&
bottom
)
//in pt
{
if
(
!
impl_
->
current_graphic_properties
)
return
;
...
...
@@ -2200,7 +2237,7 @@ void odf_drawing_context::start_image(std::wstring odf_path)
return
;
}
impl_
->
current_drawing_state_
.
oox_shape_preset
=
3000
;
impl_
->
current_drawing_state_
.
oox_shape_preset
_
=
3000
;
start_frame
();
...
...
@@ -2247,7 +2284,7 @@ void odf_drawing_context::start_object(std::wstring name)
void
odf_drawing_context
::
start_text_box
()
{
impl_
->
current_drawing_state_
.
oox_shape_preset
=
2000
;
impl_
->
current_drawing_state_
.
oox_shape_preset
_
=
2000
;
start_frame
();
...
...
@@ -2292,7 +2329,7 @@ void odf_drawing_context::set_text_box_tableframe(bool val)
{
if
(
impl_
->
current_drawing_state_
.
elements_
.
empty
())
return
;
impl_
->
current_drawing_state_
.
text_box_tableframe
=
val
;
impl_
->
current_drawing_state_
.
text_box_tableframe
_
=
val
;
}
void
odf_drawing_context
::
set_text_box_parent_style
(
std
::
wstring
style_name
)
...
...
@@ -2437,7 +2474,7 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
}
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
>
2000
&&
impl_
->
current_drawing_state_
.
oox_shape_preset
<
3000
)
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
>
2000
&&
impl_
->
current_drawing_state_
.
oox_shape_preset_
<
3000
)
{
//настройки цвета - перетащить в линии и заливки - так уж нужно wordart-у оо
style_text_properties
*
text_properties_
=
text_context
->
get_text_properties
();
...
...
@@ -2947,7 +2984,7 @@ void odf_drawing_context::end_hatch_style()
void
odf_drawing_context
::
start_bitmap_style
()
{
if
(
!
impl_
->
current_graphic_properties
)
return
;
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
==
3000
)
return
;
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
==
3000
)
return
;
odf_writer
::
office_element_ptr
fill_image_element
;
...
...
@@ -3043,7 +3080,7 @@ void odf_drawing_context::set_bitmap_link(std::wstring file_path)
std
::
wstring
odf_ref_name
;
impl_
->
odf_context_
->
mediaitems
()
->
add_or_find
(
file_path
,
_mediaitems
::
typeImage
,
odf_ref_name
);
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
==
3000
)
if
(
impl_
->
current_drawing_state_
.
oox_shape_preset
_
==
3000
)
{
if
(
impl_
->
current_level_
.
size
()
<
1
)
return
;
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h
View file @
a5e821cd
...
...
@@ -52,6 +52,7 @@ namespace odf_writer
class
odf_conversion_context
;
class
odf_style_context
;
class
odf_text_context
;
class
style_paragraph_properties
;
class
odf_drawing_context
{
...
...
@@ -124,16 +125,18 @@ public:
void
start_frame
();
void
end_frame
();
bool
change_text_box_2_wordart
();
void
start_image
(
std
::
wstring
file_path
);
void
end_image
();
bool
change_text_box_2_wordart
();
bool
is_wordart
();
void
set_paragraph_properties
(
style_paragraph_properties
*
paragraph_properties
);
void
start_text_box
();
void
set_text_box_min_size
(
bool
val
);
void
set_text_box_min_size
(
double
w_pt
,
double
h_pt
);
void
set_text_box_parent_style
(
std
::
wstring
style_name
);
void
set_text_box_tableframe
(
bool
val
);
void
set_text_box_tableframe
(
bool
val
);
void
end_text_box
();
void
start_object
(
std
::
wstring
name
);
...
...
ASCOfficeOdfFileW/source/OdfFormat/odp_conversion_context.cpp
View file @
a5e821cd
...
...
@@ -56,7 +56,26 @@ odp_conversion_context::odp_conversion_context(package::odf_document * outputDoc
:
odf_conversion_context
(
PresentationDocument
,
outputDocument
),
slide_context_
(
*
this
),
text_context_
(
NULL
)
{
}
odf_text_context
*
odp_conversion_context
::
text_context
()
{
return
text_context_
;
}
odp_slide_context
*
odp_conversion_context
::
slide_context
()
{
return
&
slide_context_
;
}
odf_drawing_context
*
odp_conversion_context
::
drawing_context
()
{
if
(
slide_context_
.
page_state_list_
.
empty
())
return
NULL
;
return
slide_context_
.
state
().
drawing_context
();
}
odf_comment_context
*
odp_conversion_context
::
comment_context
()
{
if
(
slide_context_
.
page_state_list_
.
empty
())
return
NULL
;
return
slide_context_
.
state
().
comment_context
();
}
void
odp_conversion_context
::
start_document
()
{
...
...
ASCOfficeOdfFileW/source/OdfFormat/odp_conversion_context.h
View file @
a5e821cd
...
...
@@ -64,10 +64,10 @@ public:
virtual
void
start_text_context
();
virtual
void
end_text_context
();
virtual
odf_drawing_context
*
drawing_context
()
{
return
current_slide
().
drawing_context
();}
virtual
odf_text_context
*
text_context
()
{
return
text_context_
;
}
odp_slide_context
*
slide_context
()
{
return
&
slide_context_
;}
odf_comment_context
*
comment_context
()
{
return
current_slide
().
comment_context
();}
virtual
odf_drawing_context
*
drawing_context
()
;
virtual
odf_text_context
*
text_context
()
;
odp_slide_context
*
slide_context
()
;
odf_comment_context
*
comment_context
();
void
start_drawings
();
void
end_drawings
();
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp
View file @
a5e821cd
...
...
@@ -75,6 +75,22 @@ void OoxConverter::convert(PPTX::Logic::SpTreeElem *oox_element)
convert
(
elem
.
operator
->
());
}
void
OoxConverter
::
convert_font
(
PPTX
::
Theme
*
theme
,
std
::
wstring
&
font
)
{
if
(
font
==
L"+mj-lt"
)
font
=
theme
?
theme
->
themeElements
.
fontScheme
.
majorFont
.
latin
.
typeface
:
L""
;
else
if
(
font
==
L"+mn-lt"
)
font
=
theme
?
theme
->
themeElements
.
fontScheme
.
minorFont
.
latin
.
typeface
:
L""
;
else
if
(
font
==
L"+mj-ea"
)
font
=
theme
?
theme
->
themeElements
.
fontScheme
.
majorFont
.
ea
.
typeface
:
L""
;
else
if
(
font
==
L"+mn-ea"
)
font
=
theme
?
theme
->
themeElements
.
fontScheme
.
minorFont
.
ea
.
typeface
:
L""
;
else
if
(
font
==
L"+mj-cs"
)
font
=
theme
?
theme
->
themeElements
.
fontScheme
.
majorFont
.
cs
.
typeface
:
L""
;
else
if
(
font
==
L"+mn-cs"
)
font
=
theme
?
theme
->
themeElements
.
fontScheme
.
minorFont
.
cs
.
typeface
:
L""
;
}
void
OoxConverter
::
convert
(
PPTX
::
Logic
::
GraphicFrame
*
oox_graphic_frame
)
{
if
(
!
oox_graphic_frame
)
return
;
...
...
@@ -156,11 +172,42 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
{
if
(
!
oox_picture
)
return
;
odf_context
()
->
drawing_context
()
->
start_drawing
();
bool
bImage
=
true
;
if
(
oox_picture
->
spPr
.
Geometry
.
is_init
())
{
int
type
=
SimpleTypes
::
shapetypeRect
;
if
(
oox_picture
->
spPr
.
Geometry
.
is
<
PPTX
::
Logic
::
CustGeom
>
()
)
{
type
=
1000
;
}
else
if
(
oox_picture
->
spPr
.
Geometry
.
is
<
PPTX
::
Logic
::
PrstGeom
>
()
)
{
const
PPTX
::
Logic
::
PrstGeom
&
prstGeom
=
oox_picture
->
spPr
.
Geometry
.
as
<
PPTX
::
Logic
::
PrstGeom
>
();
SimpleTypes
::
CShapeType
<>
preset
;
preset
.
FromString
(
prstGeom
.
prst
.
get
());
type
=
preset
.
GetValue
();
}
std
::
wstring
pathImage
;
double
Width
=
0
,
Height
=
0
;
if
(
type
!=
SimpleTypes
::
shapetypeRect
)
{
odf_context
()
->
drawing_context
()
->
start_drawing
();
odf_context
()
->
drawing_context
()
->
start_shape
(
type
);
convert
(
&
oox_picture
->
spPr
,
oox_picture
->
style
.
GetPointer
());
convert
(
&
oox_picture
->
nvPicPr
);
odf_context
()
->
drawing_context
()
->
start_area_properties
();
convert
(
&
oox_picture
->
blipFill
);
odf_context
()
->
drawing_context
()
->
end_area_properties
();
odf_context
()
->
drawing_context
()
->
end_shape
();
odf_context
()
->
drawing_context
()
->
end_drawing
();
return
;
}
}
std
::
wstring
pathImage
;
if
(
oox_picture
->
blipFill
.
blip
.
IsInit
())
{
std
::
wstring
sID
;
...
...
@@ -174,10 +221,13 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
{
pathImage
=
oox_picture
->
blipFill
.
blip
->
link
->
get
();
}
_graphics_utils_
::
GetResolution
(
pathImage
.
c_str
(),
Width
,
Height
);
}
odf_context
()
->
drawing_context
()
->
start_drawing
();
odf_context
()
->
start_image
(
pathImage
);
{
double
Width
=
0
,
Height
=
0
;
_graphics_utils_
::
GetResolution
(
pathImage
.
c_str
(),
Width
,
Height
);
if
(
oox_picture
->
blipFill
.
tile
.
IsInit
())
{
odf_context
()
->
drawing_context
()
->
set_image_style_repeat
(
2
);
...
...
@@ -196,24 +246,7 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
}
OoxConverter
::
convert
(
&
oox_picture
->
nvPicPr
.
cNvPr
);
//oox_picture->m_oNvPicPr.m_oCNvPicPr
//oox_picture->m_oNvPicPr.m_oCNvPicPr.m_oPicLocks
{
//if (oox_picture->m_oNvPicPr.m_oCNvPicPr.m_oPicLocks->m_oNoChangeAspect)
//{
//}
//if (oox_picture->m_oNvPicPr.m_oCNvPicPr.m_oPicLocks->m_oNoCrop))
//{
//}
//if (oox_picture->m_oNvPicPr.m_oCNvPicPr.m_oPicLocks->m_oNoResize)
//{
//}
}
//m_oExtLst
OoxConverter
::
convert
(
&
oox_picture
->
spPr
,
NULL
);
OoxConverter
::
convert
(
&
oox_picture
->
spPr
,
oox_picture
->
style
.
GetPointer
());
}
odf_context
()
->
drawing_context
()
->
end_image
();
...
...
@@ -401,7 +434,6 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
if
(
oox_shape
->
spPr
.
Geometry
.
is_init
())
{
if
(
oox_shape
->
spPr
.
Geometry
.
is
<
PPTX
::
Logic
::
PrstGeom
>
()
)
{
const
PPTX
::
Logic
::
PrstGeom
&
prstGeom
=
oox_shape
->
spPr
.
Geometry
.
as
<
PPTX
::
Logic
::
PrstGeom
>
();
...
...
@@ -812,11 +844,11 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB)
odf_context
()
->
drawing_context
()
->
set_opacity_start
(
*
opacityStart
);
odf_context
()
->
drawing_context
()
->
set_opacity_end
(
*
opacityEnd
);
if
(
grad_style
==
odf_types
::
gradient_style
::
linear
)
if
(
oox_grad_fill
->
lin
.
is_init
()
)
{
odf_context
()
->
drawing_context
()
->
set_opacity_angle
(
oox_grad_fill
->
lin
->
ang
.
get
()
/
60000.
);
}
else
else
if
(
oox_grad_fill
->
path
.
is_init
())
{
odf_context
()
->
drawing_context
()
->
set_opacity_rect
(
XmlUtils
::
GetInteger
(
oox_grad_fill
->
path
->
rect
->
l
.
get_value_or
(
L""
)),
XmlUtils
::
GetInteger
(
oox_grad_fill
->
path
->
rect
->
t
.
get_value_or
(
L""
)),
...
...
@@ -1102,12 +1134,15 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
}
}
odf_writer
::
style_paragraph_properties
*
paragraph_properties
=
odf_context
()
->
text_context
()
->
get_paragraph_properties
();
//свойства могут быть приписаны не только к параграфу, но и к самому объекту
odf_writer
::
style_paragraph_properties
*
paragraph_properties
=
odf_context
()
->
text_context
()
->
get_paragraph_properties
();
odf_writer
::
style_text_properties
*
text_properties
=
NULL
;
if
(
!
paragraph_properties
)
{
odf_context
()
->
text_context
()
->
get_styles_context
()
->
create_style
(
L""
,
odf_types
::
style_family
::
Paragraph
,
true
,
false
,
-
1
);
paragraph_properties
=
odf_context
()
->
text_context
()
->
get_styles_context
()
->
last_state
()
->
get_paragraph_properties
();
paragraph_properties
=
odf_context
()
->
text_context
()
->
get_styles_context
()
->
last_state
()
->
get_paragraph_properties
();
text_properties
=
odf_context
()
->
text_context
()
->
get_styles_context
()
->
last_state
()
->
get_text_properties
();
//if(list_present && oox_list_style)
//{
...
...
@@ -1116,8 +1151,11 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
//}
styled
=
true
;
}
convert
(
oox_list_style
,
list_level
,
paragraph_properties
);
convert
(
oox_paragraph
->
pPr
.
GetPointer
(),
paragraph_properties
);
convert
(
oox_list_style
,
list_level
,
paragraph_properties
,
text_properties
);
convert
(
oox_paragraph
->
pPr
.
GetPointer
(),
paragraph_properties
,
text_properties
);
if
(
odf_context
()
->
drawing_context
()
->
is_wordart
())
odf_context
()
->
drawing_context
()
->
set_paragraph_properties
(
paragraph_properties
);
}
if
(
list_present
)
...
...
@@ -1162,77 +1200,79 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
odf_context
()
->
text_context
()
->
end_list_item
();
}
}
void
OoxConverter
::
convert
(
PPTX
::
Logic
::
TextListStyle
*
oox_list_style
,
int
level
,
odf_writer
::
style_paragraph_properties
*
paragraph_properties
)
void
OoxConverter
::
convert
(
PPTX
::
Logic
::
TextListStyle
*
oox_list_style
,
int
level
,
odf_writer
::
style_paragraph_properties
*
paragraph_properties
,
odf_writer
::
style_text_properties
*
text_properties
)
{
if
(
!
oox_list_style
)
return
;
if
(
!
paragraph_properties
)
return
;
convert
(
oox_list_style
->
levels
[
9
].
GetPointer
(),
paragraph_properties
);
convert
(
oox_list_style
->
levels
[
9
].
GetPointer
(),
paragraph_properties
,
text_properties
);
if
(
level
<
0
||
level
>
9
)
return
;
convert
(
oox_list_style
->
levels
[
level
].
GetPointer
(),
paragraph_properties
);
convert
(
oox_list_style
->
levels
[
level
].
GetPointer
(),
paragraph_properties
,
text_properties
);
}
void
OoxConverter
::
convert
(
PPTX
::
Logic
::
TextParagraphPr
*
oox_paragraph_pr
,
odf_writer
::
style_paragraph_properties
*
paragraph_properties
)
void
OoxConverter
::
convert
(
PPTX
::
Logic
::
TextParagraphPr
*
oox_paragraph_pr
,
odf_writer
::
style_paragraph_properties
*
paragraph_properties
,
odf_writer
::
style_text_properties
*
text_properties
)
{
if
(
!
oox_paragraph_pr
)
return
;
if
(
!
paragraph_properties
)
return
;
if
(
oox_paragraph_pr
->
lnSpc
.
IsInit
())
{
odf_types
::
length_or_percent
length
;
convert
(
oox_paragraph_pr
->
lnSpc
.
GetPointer
(),
length
);
paragraph_properties
->
content_
.
fo_line_height_
=
odf_types
::
line_width
(
length
);
}
if
(
oox_paragraph_pr
->
spcAft
.
IsInit
())
{
odf_types
::
length_or_percent
length
;
convert
(
oox_paragraph_pr
->
spcAft
.
GetPointer
(),
length
);
paragraph_properties
->
content_
.
fo_margin_bottom_
=
length
;
}
if
(
oox_paragraph_pr
->
spcBef
.
IsInit
())
{
odf_types
::
length_or_percent
length
;
convert
(
oox_paragraph_pr
->
spcBef
.
GetPointer
(),
length
);
paragraph_properties
->
content_
.
fo_margin_top_
=
length
;
}
if
(
oox_paragraph_pr
->
algn
.
IsInit
())
if
(
!
oox_paragraph_pr
)
return
;
if
(
paragraph_properties
)
{
switch
(
oox_paragraph_pr
->
algn
->
GetBYTECode
())
if
(
oox_paragraph_pr
->
lnSpc
.
IsInit
())
{
case
0
:
paragraph_properties
->
content_
.
fo_text_align_
=
odf_types
::
text_align
(
odf_types
::
text_align
::
Center
);
break
;
case
1
:
case
2
:
case
3
:
paragraph_properties
->
content_
.
fo_text_align_
=
odf_types
::
text_align
(
odf_types
::
text_align
::
Justify
);
break
;
case
5
:
paragraph_properties
->
content_
.
fo_text_align_
=
odf_types
::
text_align
(
odf_types
::
text_align
::
Right
);
break
;
case
4
:
default:
paragraph_properties
->
content_
.
fo_text_align_
=
odf_types
::
text_align
(
odf_types
::
text_align
::
Left
);
break
;
odf_types
::
length_or_percent
length
;
convert
(
oox_paragraph_pr
->
lnSpc
.
GetPointer
(),
length
);
paragraph_properties
->
content_
.
fo_line_height_
=
odf_types
::
line_width
(
length
);
}
if
(
oox_paragraph_pr
->
spcAft
.
IsInit
())
{
odf_types
::
length_or_percent
length
;
convert
(
oox_paragraph_pr
->
spcAft
.
GetPointer
(),
length
);
paragraph_properties
->
content_
.
fo_margin_bottom_
=
length
;
}
if
(
oox_paragraph_pr
->
spcBef
.
IsInit
())
{
odf_types
::
length_or_percent
length
;
convert
(
oox_paragraph_pr
->
spcBef
.
GetPointer
(),
length
);
paragraph_properties
->
content_
.
fo_margin_top_
=
length
;
}
if
(
oox_paragraph_pr
->
algn
.
IsInit
())
{
switch
(
oox_paragraph_pr
->
algn
->
GetBYTECode
())
{
case
0
:
paragraph_properties
->
content_
.
fo_text_align_
=
odf_types
::
text_align
(
odf_types
::
text_align
::
Center
);
break
;
case
1
:
case
2
:
case
3
:
paragraph_properties
->
content_
.
fo_text_align_
=
odf_types
::
text_align
(
odf_types
::
text_align
::
Justify
);
break
;
case
5
:
paragraph_properties
->
content_
.
fo_text_align_
=
odf_types
::
text_align
(
odf_types
::
text_align
::
Right
);
break
;
case
4
:
default:
paragraph_properties
->
content_
.
fo_text_align_
=
odf_types
::
text_align
(
odf_types
::
text_align
::
Left
);
break
;
}
}
if
(
oox_paragraph_pr
->
marL
.
IsInit
())
{
paragraph_properties
->
content_
.
fo_margin_left_
=
odf_types
::
length_or_percent
(
odf_types
::
length
(
oox_paragraph_pr
->
marL
.
get
()
/
12700.
,
odf_types
::
length
::
pt
));
}
if
(
oox_paragraph_pr
->
marR
.
IsInit
())
{
paragraph_properties
->
content_
.
fo_margin_right_
=
odf_types
::
length_or_percent
(
odf_types
::
length
(
oox_paragraph_pr
->
marR
.
get
()
/
12700.
,
odf_types
::
length
::
pt
));
}
if
(
oox_paragraph_pr
->
indent
.
IsInit
())
{
paragraph_properties
->
content_
.
fo_text_indent_
=
odf_types
::
length_or_percent
(
odf_types
::
length
(
oox_paragraph_pr
->
indent
.
get
()
/
12700.
,
odf_types
::
length
::
pt
));
}
if
(
oox_paragraph_pr
->
rtl
.
IsInit
())
{
}
}
if
(
oox_paragraph_pr
->
marL
.
IsInit
())
{
paragraph_properties
->
content_
.
fo_margin_left_
=
odf_types
::
length_or_percent
(
odf_types
::
length
(
oox_paragraph_pr
->
marL
.
get
()
/
12700.
,
odf_types
::
length
::
pt
));
}
if
(
oox_paragraph_pr
->
marR
.
IsInit
())
{
paragraph_properties
->
content_
.
fo_margin_right_
=
odf_types
::
length_or_percent
(
odf_types
::
length
(
oox_paragraph_pr
->
marR
.
get
()
/
12700.
,
odf_types
::
length
::
pt
));
}
if
(
oox_paragraph_pr
->
indent
.
IsInit
())
{
paragraph_properties
->
content_
.
fo_text_indent_
=
odf_types
::
length_or_percent
(
odf_types
::
length
(
oox_paragraph_pr
->
indent
.
get
()
/
12700.
,
odf_types
::
length
::
pt
));
}
if
(
oox_paragraph_pr
->
rtl
.
IsInit
())
{
}
//nullable<SimpleTypes::CDecimalNumber<> > m_oLvl;
//nullable<SimpleTypes::CCoordinate32<> > m_oDefTabSz;
//nullable<SimpleTypes::CTextFontAlignType<>> m_oFontAlgn;
if
(
oox_paragraph_pr
->
defRPr
.
IsInit
())
{
odf_writer
::
style_text_properties
*
text_properties
=
odf_context
()
->
text_context
()
->
get_styles_context
()
->
last_state
()
->
get_text_properties
();
if
(
text_properties
)
convert
(
oox_paragraph_pr
->
defRPr
.
GetPointer
(),
text_properties
);
convert
(
oox_paragraph_pr
->
defRPr
.
GetPointer
(),
text_properties
);
//надо подумать как брать последний по family !!!
//convert(oox_paragraph_pr->m_oDefRunProperty.GetPointer());
...
...
@@ -1251,7 +1291,7 @@ void OoxConverter::convert(PPTX::Logic::TextSpacing *oox_spacing, cpdoccore::odf
}
if
(
oox_spacing
->
spcPts
.
IsInit
()
)
{
odf_types
::
length
length
=
odf_types
::
length
(
oox_spacing
->
GetVal
()
/
127
00.
,
odf_types
::
length
::
pt
);
odf_types
::
length
length
=
odf_types
::
length
(
-
oox_spacing
->
GetVal
()
/
1
00.
,
odf_types
::
length
::
pt
);
length_or_percent
=
odf_types
::
length_or_percent
(
length
);
}
}
...
...
@@ -1263,43 +1303,59 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
PPTX
::
Theme
*
theme
=
oox_theme
();
PPTX
::
Logic
::
GradFill
*
gradFill
=
&
oox_run_pr
->
Fill
.
as
<
PPTX
::
Logic
::
GradFill
>
();
if
(
gradFill
)
{
if
(
odf_context
()
->
drawing_context
()
->
change_text_box_2_wordart
())
//------------------------------------------------------
odf_writer
::
odf_drawing_context
*
drawing
=
odf_context
()
->
drawing_context
();
if
(
drawing
)
//from styles impossible(
{
if
((
oox_run_pr
->
Fill
.
is
<
PPTX
::
Logic
::
GradFill
>
())
||
((
oox_run_pr
->
ln
.
IsInit
())
&&
(
oox_run_pr
->
ln
->
Fill
.
is_init
()
&&
oox_run_pr
->
ln
->
Fill
.
getType
()
!=
OOX
::
et_a_noFill
)))
{
drawing
->
change_text_box_2_wordart
();
}
if
(
drawing
->
is_wordart
())
{
odf_context
()
->
drawing_context
()
->
start_area_properties
();
{
convert
(
gradFill
);
if
(
oox_run_pr
->
Fill
.
is_init
())
{
drawing
->
start_area_properties
();
convert
(
&
oox_run_pr
->
Fill
);
drawing
->
end_area_properties
();
}
if
(
oox_run_pr
->
ln
.
is_init
())
{
drawing
->
start_line_properties
();
if
(
oox_run_pr
->
ln
->
Fill
.
is_init
()
&&
oox_run_pr
->
ln
->
Fill
.
getType
()
!=
OOX
::
et_a_noFill
)
{
drawing
->
set_line_dash_preset
(
6
);
convert
(
oox_run_pr
->
ln
.
GetPointer
());
}
else
if
(
drawing
->
is_wordart
())
drawing
->
set_no_fill
();
drawing
->
end_line_properties
();
}
odf_context
()
->
drawing_context
()
->
end_area_properties
();
}
}
//---------------------------------------
_CP_OPT
(
double
)
opacityText
;
std
::
wstring
hexColorText
;
PPTX
::
Logic
::
GradFill
*
gradFill
=
&
oox_run_pr
->
Fill
.
as
<
PPTX
::
Logic
::
GradFill
>
();
if
(
gradFill
&&
!
gradFill
->
GsLst
.
empty
())
{
convert
(
&
gradFill
->
GsLst
[
0
].
color
,
hexColorText
,
opacityText
);
}
PPTX
::
Logic
::
SolidFill
*
solidFill
=
&
oox_run_pr
->
Fill
.
as
<
PPTX
::
Logic
::
SolidFill
>
();
if
(
solidFill
)
{
std
::
wstring
hexColor
;
_CP_OPT
(
double
)
opacity
;
convert
(
&
solidFill
->
Color
,
hexColor
,
opacity
);
convert
(
&
solidFill
->
Color
,
hexColorText
,
opacityText
)
;
}
if
(
!
hexColorText
.
empty
())
{
int
res
=
0
;
if
((
res
=
hexColor
.
find
(
L"#"
))
<
0
)
hexColor
=
std
::
wstring
(
L"#"
)
+
hexColor
;
text_properties
->
content_
.
fo_color_
=
odf_types
::
color
(
hexColor
);
}
if
(
oox_run_pr
->
ln
.
IsInit
()
&&
oox_run_pr
->
ln
->
Fill
.
getType
()
!=
OOX
::
et_a_noFill
)
{
if
(
odf_context
()
->
drawing_context
()
->
change_text_box_2_wordart
())
{
odf_context
()
->
drawing_context
()
->
start_line_properties
();
{
odf_context
()
->
drawing_context
()
->
set_line_dash_preset
(
6
);
convert
(
oox_run_pr
->
ln
.
GetPointer
());
}
odf_context
()
->
drawing_context
()
->
end_line_properties
();
}
if
((
res
=
hexColorText
.
find
(
L"#"
))
<
0
)
hexColorText
=
std
::
wstring
(
L"#"
)
+
hexColorText
;
text_properties
->
content_
.
fo_color_
=
odf_types
::
color
(
hexColorText
);
}
//---------------------------------------
if
(
oox_run_pr
->
b
.
IsInit
())
{
if
(
oox_run_pr
->
b
.
get
()
==
true
)
...
...
@@ -1326,12 +1382,8 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
if
(
!
oox_run_pr
->
latin
->
typeface
.
empty
())
{
std
::
wstring
font
=
oox_run_pr
->
latin
->
typeface
;
if
(
font
==
L"+mj-lt"
)
font
=
theme
->
themeElements
.
fontScheme
.
majorFont
.
latin
.
typeface
;
else
if
(
font
==
L"+mn-lt"
)
font
=
theme
->
themeElements
.
fontScheme
.
minorFont
.
latin
.
typeface
;
convert_font
(
theme
,
font
);
if
(
!
font
.
empty
())
text_properties
->
content_
.
fo_font_family_
=
font
;
}
...
...
@@ -1345,11 +1397,7 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
if
(
!
oox_run_pr
->
ea
->
typeface
.
empty
())
{
std
::
wstring
font
=
oox_run_pr
->
ea
->
typeface
;
if
(
font
==
L"+mj-ea"
)
font
=
theme
->
themeElements
.
fontScheme
.
majorFont
.
ea
.
typeface
;
else
if
(
font
==
L"+mn-ea"
)
font
=
theme
->
themeElements
.
fontScheme
.
minorFont
.
ea
.
typeface
;
convert_font
(
theme
,
font
);
if
(
!
font
.
empty
())
text_properties
->
content_
.
style_font_family_asian_
=
font
;
...
...
@@ -1363,11 +1411,7 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
if
(
!
oox_run_pr
->
cs
->
typeface
.
empty
())
{
std
::
wstring
font
=
oox_run_pr
->
cs
->
typeface
;
if
(
font
==
L"+mj-cs"
)
font
=
theme
->
themeElements
.
fontScheme
.
majorFont
.
cs
.
typeface
;
else
if
(
font
==
L"+mn-cs"
)
font
=
theme
->
themeElements
.
fontScheme
.
minorFont
.
cs
.
typeface
;
convert_font
(
theme
,
font
);
if
(
!
font
.
empty
())
text_properties
->
content_
.
style_font_family_complex_
=
font
;
...
...
@@ -1382,12 +1426,12 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
int
res
=
oox_language
.
find
(
L"-"
);
if
(
res
>=
0
)
{
oox_country
=
oox_language
.
substr
(
res
);
oox_country
=
oox_language
.
substr
(
res
+
1
);
oox_language
=
oox_language
.
substr
(
0
,
res
);
}
text_properties
->
content_
.
fo_language_
=
oox_language
;
if
(
oox_country
.
length
()
>
0
)
if
(
!
oox_country
.
empty
()
)
text_properties
->
content_
.
fo_country_
=
oox_country
;
}
...
...
@@ -1499,8 +1543,6 @@ void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeSt
if
(
oox_txBody
->
Paragrs
.
empty
())
return
;
odf_context
()
->
start_text_context
();
for
(
size_t
i
=
0
;
i
<
oox_txBody
->
Paragrs
.
size
();
i
++
)
{
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.h
View file @
a5e821cd
...
...
@@ -364,6 +364,7 @@ public:
void
convert
(
double
oox_font_size
,
_CP_OPT
(
cpdoccore
::
odf_types
::
font_size
)
&
odf_font_size
);
bool
convert
(
std
::
wstring
sSchemeColor
,
DWORD
&
argb
);
void
convert_font
(
PPTX
::
Theme
*
theme
,
std
::
wstring
&
font
);
//.......................................................................................................................
void
convert
(
OOX
::
WritingElement
*
oox_unknown
);
//drawingML & pptx................................................................................................................................
...
...
@@ -403,9 +404,12 @@ public:
void
convert
(
PPTX
::
Logic
::
NvGrpSpPr
*
oox_nvSpPr
);
void
convert
(
PPTX
::
Logic
::
NvPr
*
oox_nvPr
);
void
convert
(
PPTX
::
Logic
::
Paragraph
*
oox_para
,
PPTX
::
Logic
::
TextListStyle
*
oox_list_style
=
NULL
);
void
convert
(
PPTX
::
Logic
::
TextListStyle
*
oox_list_style
,
int
level
,
cpdoccore
::
odf_writer
::
style_paragraph_properties
*
paragraph_properties
);
void
convert
(
PPTX
::
Logic
::
TextParagraphPr
*
oox_para_props
,
cpdoccore
::
odf_writer
::
style_paragraph_properties
*
paragraph_properties
);
void
convert
(
PPTX
::
Logic
::
RunProperties
*
oox_run_props
,
cpdoccore
::
odf_writer
::
style_text_properties
*
text_properties
);
void
convert
(
PPTX
::
Logic
::
TextListStyle
*
oox_list_style
,
int
level
,
cpdoccore
::
odf_writer
::
style_paragraph_properties
*
paragraph_properties
,
cpdoccore
::
odf_writer
::
style_text_properties
*
text_properties
);
void
convert
(
PPTX
::
Logic
::
TextParagraphPr
*
oox_para_props
,
cpdoccore
::
odf_writer
::
style_paragraph_properties
*
paragraph_properties
,
cpdoccore
::
odf_writer
::
style_text_properties
*
text_properties
);
void
convert
(
PPTX
::
Logic
::
RunProperties
*
oox_run_props
,
cpdoccore
::
odf_writer
::
style_text_properties
*
text_properties
);
void
convert
(
PPTX
::
Logic
::
Run
*
oox_run
);
void
convert
(
PPTX
::
Logic
::
Fld
*
oox_fld
);
void
convert
(
PPTX
::
Logic
::
Br
*
oox_br
);
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/PptxConverter.cpp
View file @
a5e821cd
...
...
@@ -219,21 +219,20 @@ void PptxConverter::convert_styles()
odf_writer
::
style_paragraph_properties
*
paragraph_properties
=
odp_context
->
styles_context
()
->
last_state
()
->
get_paragraph_properties
();
odf_writer
::
style_text_properties
*
text_properties
=
odp_context
->
styles_context
()
->
last_state
()
->
get_text_properties
();
if
(
text_properties
)
if
(
presentation
->
defaultTextStyle
.
IsInit
()
)
{
text_properties
->
content_
.
fo_font_size_
=
odf_types
::
font_size
(
odf_types
::
length
(
18
,
odf_types
::
length
::
pt
));
}
if
(
slide
->
theme
.
IsInit
()
&&
text_properties
)
{
if
(
slide
->
theme
->
themeElements
.
fontScheme
.
majorFont
.
latin
.
typeface
.
empty
()
==
false
)
text_properties
->
content_
.
fo_font_family_
=
slide
->
theme
->
themeElements
.
fontScheme
.
majorFont
.
latin
.
typeface
;
if
(
slide
->
theme
->
themeElements
.
fontScheme
.
majorFont
.
cs
.
typeface
.
empty
()
==
false
)
text_properties
->
content_
.
style_font_family_complex_
=
slide
->
theme
->
themeElements
.
fontScheme
.
majorFont
.
cs
.
typeface
;
OoxConverter
::
convert
(
presentation
->
defaultTextStyle
->
levels
[
9
].
GetPointer
(),
paragraph_properties
,
text_properties
);
//defPPr
OoxConverter
::
convert
(
presentation
->
defaultTextStyle
->
levels
[
0
].
GetPointer
(),
paragraph_properties
,
text_properties
);
//default text
if
(
slide
->
theme
->
themeElements
.
fontScheme
.
majorFont
.
ea
.
typeface
.
empty
()
==
false
)
text_properties
->
content_
.
style_font_family_asian_
=
slide
->
theme
->
themeElements
.
fontScheme
.
majorFont
.
ea
.
typeface
;
odp_context
->
styles_context
()
->
create_default_style
(
odf_types
::
style_family
::
Paragraph
);
paragraph_properties
=
odp_context
->
styles_context
()
->
last_state
()
->
get_paragraph_properties
();
OoxConverter
::
convert
(
presentation
->
defaultTextStyle
->
levels
[
0
].
GetPointer
(),
paragraph_properties
,
text_properties
);
//default text
odp_context
->
styles_context
()
->
create_default_style
(
odf_types
::
style_family
::
Text
);
text_properties
=
odp_context
->
styles_context
()
->
last_state
()
->
get_text_properties
();
OoxConverter
::
convert
(
presentation
->
defaultTextStyle
->
levels
[
0
].
GetPointer
(),
paragraph_properties
,
text_properties
);
//default text
}
//convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков
...
...
@@ -302,19 +301,27 @@ void PptxConverter::convert_slides()
std
::
wstring
master_style_name
;
std
::
wstring
layout_style_name
;
bool
bShow
=
slide
->
show
.
get_value_or
(
true
);
bool
bShowMasterAnim
=
slide
->
showMasterPhAnim
.
get_value_or
(
true
);
bool
bShowMasterSp
=
slide
->
showMasterSp
.
get_value_or
(
true
);
PPTX
::
Logic
::
TxStyles
*
current_txStyles
=
NULL
;
if
(
slide
->
Master
.
IsInit
())
{
current_clrMap
=
&
slide
->
Master
->
clrMap
;
current_txStyles
=
slide
->
Master
->
txStyles
.
GetPointer
();
std
::
map
<
std
::
wstring
,
std
::
wstring
>::
iterator
pFind
=
m_mapMasters
.
find
(
slide
->
Master
->
m_sOutputFilename
+
slide
->
Layout
->
m_sOutputFilename
);
std
::
wstring
master_name
=
(
bShowMasterSp
?
slide
->
Master
->
m_sOutputFilename
:
L""
)
+
slide
->
Layout
->
m_sOutputFilename
;
std
::
map
<
std
::
wstring
,
std
::
wstring
>::
iterator
pFind
=
m_mapMasters
.
find
(
master_name
);
if
(
pFind
==
m_mapMasters
.
end
())
{
master_style_name
=
L"MasterPage"
;
if
(
slide
->
Master
->
cSld
.
attrName
.
IsInit
())
master_style_name
=
slide
->
Master
->
cSld
.
attrName
.
get
();
else
if
(
current_theme
->
name
.
IsInit
())
master_style_name
=
current_theme
->
name
.
get
();
if
(
bShowMasterSp
)
{
if
(
slide
->
Master
->
cSld
.
attrName
.
IsInit
())
master_style_name
=
slide
->
Master
->
cSld
.
attrName
.
get
();
else
if
(
current_theme
->
name
.
IsInit
())
master_style_name
=
current_theme
->
name
.
get
();
}
master_style_name
+=
L"_"
;
if
(
slide
->
Layout
->
cSld
.
attrName
.
IsInit
())
master_style_name
+=
slide
->
Layout
->
cSld
.
attrName
.
get
();
else
if
(
slide
->
Layout
->
attrType
.
IsInit
())
master_style_name
+=
slide
->
Layout
->
attrType
->
get
();
...
...
@@ -323,18 +330,20 @@ void PptxConverter::convert_slides()
odp_context
->
start_master_slide
(
master_style_name
);
convert_common
();
//if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
{
current_slide
=
slide
->
Master
.
operator
->
();
current_slide
=
slide
->
Master
.
operator
->
();
if
(
bShowMasterSp
)
convert_slide
(
&
slide
->
Master
->
cSld
,
current_txStyles
,
false
);
}
else
convert
(
slide
->
Master
->
cSld
.
bg
.
GetPointer
());
if
(
slide
->
Layout
->
clrMapOvr
.
IsInit
()
&&
slide
->
Layout
->
clrMapOvr
->
overrideClrMapping
.
IsInit
())
current_clrMap
=
slide
->
Layout
->
clrMapOvr
->
overrideClrMapping
.
GetPointer
();
current_slide
=
slide
->
Layout
.
operator
->
();
convert_slide
(
&
slide
->
Layout
->
cSld
,
current_txStyles
,
true
);
odp_context
->
end_master_slide
();
m_mapMasters
.
insert
(
std
::
make_pair
(
slide
->
Master
->
m_sOutputFilename
+
slide
->
Layout
->
m_sOutputFile
name
,
master_style_name
));
m_mapMasters
.
insert
(
std
::
make_pair
(
master_
name
,
master_style_name
));
}
else
{
...
...
@@ -369,9 +378,6 @@ void PptxConverter::convert_slides()
odp_context
->
current_slide
().
set_master_page
(
master_style_name
);
odp_context
->
current_slide
().
set_layout_page
(
layout_style_name
);
//nullable_bool show;
//nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp;
convert_slide
(
slide
->
cSld
.
GetPointer
(),
current_txStyles
,
true
);
convert
(
slide
->
comments
.
operator
->
());
...
...
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