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
b98a545d
Commit
b98a545d
authored
Dec 06, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - ole embedded ....
parent
ceb2c786
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
420 additions
and
187 deletions
+420
-187
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
+13
-5
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
+15
-13
ASCOfficeOdfFile/src/docx/headers_footers.cpp
ASCOfficeOdfFile/src/docx/headers_footers.cpp
+5
-2
ASCOfficeOdfFile/src/docx/headers_footers.h
ASCOfficeOdfFile/src/docx/headers_footers.h
+7
-7
ASCOfficeOdfFile/src/docx/mediaitems.cpp
ASCOfficeOdfFile/src/docx/mediaitems.cpp
+3
-0
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
+1
-1
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
+3
-1
ASCOfficeOdfFile/src/docx/oox_package.cpp
ASCOfficeOdfFile/src/docx/oox_package.cpp
+1
-0
ASCOfficeOdfFile/src/docx/pptx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/pptx_conversion_context.cpp
+10
-10
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
+4
-4
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
+1
-1
ASCOfficeOdfFile/src/odf/datatypes/custom_shape_types_convert.h
...iceOdfFile/src/odf/datatypes/custom_shape_types_convert.h
+3
-2
ASCOfficeOdfFile/src/odf/draw_frame.h
ASCOfficeOdfFile/src/odf/draw_frame.h
+1
-1
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+49
-26
ASCOfficeOdfFile/src/odf/draw_shapes.cpp
ASCOfficeOdfFile/src/odf/draw_shapes.cpp
+20
-4
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
+2
-2
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
+2
-0
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
+3
-3
ASCOfficeOdfFile/src/odf/office_body.cpp
ASCOfficeOdfFile/src/odf/office_body.cpp
+0
-2
ASCOfficeOdfFile/src/odf/style_table_properties.cpp
ASCOfficeOdfFile/src/odf/style_table_properties.cpp
+3
-23
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
+103
-49
ASCOfficeOdfFile/src/odf/style_text_properties.h
ASCOfficeOdfFile/src/odf/style_text_properties.h
+3
-1
ASCOfficeOdfFile/src/odf/styles.cpp
ASCOfficeOdfFile/src/odf/styles.cpp
+11
-13
ASCOfficeOdfFile/src/odf/text_elements.cpp
ASCOfficeOdfFile/src/odf/text_elements.cpp
+124
-17
ASCOfficeOdfFile/src/odf/text_elements.h
ASCOfficeOdfFile/src/odf/text_elements.h
+33
-0
No files found.
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
View file @
b98a545d
...
...
@@ -82,6 +82,8 @@ void text_tracked_context::start_changes_content()
void
text_tracked_context
::
end_changes_content
()
{
docx_context_
.
finish_run
();
//0106GS-GettingStartedWithWriter_el.odt - удаленный заголовок
current_state_
.
content
.
push_back
(
changes_stream_
.
str
());
docx_context_
.
set_delete_text_state
(
false
);
...
...
@@ -130,9 +132,7 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
//----------------------------------------------------------------------------------------------------------------
docx_conversion_context
::
docx_conversion_context
(
odf_reader
::
odf_document
*
OdfDocument
)
:
mediaitems_
(
OdfDocument
->
get_folder
()
),
next_dump_page_properties_
(
false
),
page_break_
(
false
),
page_break_after_
(
false
),
page_break_before_
(
false
),
in_run_
(
false
),
...
...
@@ -151,7 +151,8 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
delayed_converting_
(
false
),
process_headers_footers_
(
false
),
process_comment_
(
false
),
math_context_
(
false
),
mediaitems_
(
OdfDocument
->
get_folder
()
),
math_context_
(
OdfDocument
->
odf_context
().
fontContainer
(),
false
),
odf_document_
(
OdfDocument
)
{
streams_man_
=
streams_man
::
create
(
temp_stream_
);
...
...
@@ -833,13 +834,20 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
//in_styles = true -> styles.xml
//почему то конструкция <pPr><rPr/></pPr><rPr/> "не работает" в части в rPr в ms2010 )
{
bool
in_drawing
=
false
;
if
(
get_drawing_context
().
get_current_shape
()
||
get_drawing_context
().
get_current_frame
())
{
in_drawing
=
true
;
}
std
::
wstringstream
&
paragraph_style
=
get_styles_context
().
paragraph_nodes
();
std
::
wstringstream
&
run_style
=
get_styles_context
().
text_style
();
CP_XML_WRITER
(
strm
)
{
//Tutor_Charlotte_Tutor_the_Entire_World_.odt
if
(
get_section_context
().
dump_
.
empty
()
==
false
&&
(
!
ParentId
.
empty
()
||
get_section_context
().
get
().
is_dump_
||
in_header_
)
&&
!
get_table_context
().
in_table
())
&&
!
get_table_context
().
in_table
()
&&
!
in_drawing
)
{
//две подряд секции или если стиль определен и в заголовки нельзя пихать !!!
CP_XML_NODE
(
L"w:pPr"
)
{
...
...
@@ -854,7 +862,7 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
{
CP_XML_NODE
(
L"w:pPr"
)
{
if
(
!
get_table_context
().
in_table
()
)
if
(
!
get_table_context
().
in_table
()
&&
!
in_drawing
)
{
CP_XML_STREAM
()
<<
get_section_context
().
dump_
;
get_section_context
().
dump_
.
clear
();
...
...
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
View file @
b98a545d
...
...
@@ -438,8 +438,6 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
std
::
wstring
relativeFrom
=
L"margin"
;
if
(
val
.
styleHorizontalRel
)
relativeFrom
=
val
.
styleHorizontalRel
->
get_type_str
();
if
(
relativeFrom
==
L"column"
)
relativeFrom
=
L"margin"
;
CP_XML_ATTR
(
L"relativeFrom"
,
relativeFrom
);
if
(
val
.
styleHorizontalPos
&&
...
...
@@ -457,10 +455,10 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
CP_XML_NODE
(
L"wp:positionV"
)
{
std
::
wstring
relativeFrom
=
L"
paragraph
"
;
if
(
val
.
styleVerticalRel
)
relativeFrom
=
val
.
styleVerticalRel
->
get_type_str
();
CP_XML_ATTR
(
L"relativeFrom"
,
relativeFrom
);
std
::
wstring
relativeFrom
=
L"
margin
"
;
if
(
val
.
styleVerticalRel
)
relativeFrom
=
val
.
styleVerticalRel
->
get_type_str
();
CP_XML_ATTR
(
L"relativeFrom"
,
relativeFrom
);
if
(
val
.
styleVerticalPos
&&
val
.
styleVerticalPos
->
get_type
()
!=
odf_types
::
vertical_pos
::
FromTop
&&
...
...
@@ -511,6 +509,8 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
std
::
wstring
relativeFrom
=
L"paragraph"
;
if
(
val
.
styleVerticalRel
)
relativeFrom
=
val
.
styleVerticalRel
->
get_type_str
();
if
(
relativeFrom
==
L"paragraph"
)
relativeFrom
=
L"margin"
;
CP_XML_NODE
(
L"wp14:sizeRelV"
)
{
CP_XML_ATTR
(
L"relativeFrom"
,
relativeFrom
);
...
...
@@ -588,8 +588,8 @@ void docx_serialize_object(std::wostream & strm, _docx_drawing & val)
CP_XML_ATTR
(
L"o:ole"
,
""
);
std
::
wstring
style_str
;
// = L"width:730.6pt; height:261.8pt";
style_str
+=
L"width:"
+
std
::
to_wstring
(
val
.
cx
/
12700
)
+
L"pt;"
;
style_str
+=
L"height:"
+
std
::
to_wstring
(
val
.
cy
/
12700
)
+
L"pt;"
;
style_str
+=
L"width:"
+
std
::
to_wstring
(
val
.
cx
/
12700
.
)
+
L"pt;"
;
style_str
+=
L"height:"
+
std
::
to_wstring
(
val
.
cy
/
12700
.
)
+
L"pt;"
;
CP_XML_ATTR
(
L"style"
,
style_str
);
...
...
@@ -597,19 +597,19 @@ void docx_serialize_object(std::wostream & strm, _docx_drawing & val)
{
CP_XML_NODE
(
L"v:imagedata"
)
{
CP_XML_ATTR
(
L"o:title"
,
L""
);
CP_XML_ATTR
(
L"o:title"
,
val
.
name
);
CP_XML_ATTR
(
L"r:id"
,
val
.
fill
.
bitmap
->
rId
);
}
}
}
CP_XML_NODE
(
L"o:OLEObject"
)
{
CP_XML_ATTR
(
L"r:id"
,
L"ole_"
+
val
.
objectId
);
CP_XML_ATTR
(
L"ObjectID"
,
L"_1480208863"
);
CP_XML_ATTR
(
L"DrawAspect"
,
L"Content"
);
CP_XML_ATTR
(
L"ShapeID"
,
val
.
objectId
);
CP_XML_ATTR
(
L"Type"
,
L"Embed"
);
CP_XML_ATTR
(
L"ProgID"
,
val
.
objectProgId
);
CP_XML_ATTR
(
L"ShapeID"
,
L"ole_"
+
val
.
objectId
);
CP_XML_ATTR
(
L"DrawAspect"
,
L"Content"
);
CP_XML_ATTR
(
L"ObjectID"
,
0x583A3000
+
val
.
id
);
CP_XML_ATTR
(
L"r:id"
,
val
.
objectId
);
}
}
}
...
...
@@ -617,6 +617,8 @@ void docx_serialize_object(std::wostream & strm, _docx_drawing & val)
void
_docx_drawing
::
serialize
(
std
::
wostream
&
strm
/*, bool insideOtherDrawing*/
)
{
if
(
type
==
typeUnknown
)
return
;
if
(
inGroup
)
return
docx_serialize_child
(
strm
,
*
this
);
...
...
ASCOfficeOdfFile/src/docx/headers_footers.cpp
View file @
b98a545d
...
...
@@ -97,9 +97,12 @@ void headers_footers::dump_rels(rels & Rels) const//внешние релсы
}
}
bool
headers_footers
::
write_sectPr
(
const
std
::
wstring
&
StyleName
,
std
::
wostream
&
_Wostream
)
const
bool
headers_footers
::
write_sectPr
(
const
std
::
wstring
&
StyleName
,
bool
next_page
/*not used*/
,
std
::
wostream
&
_Wostream
)
{
if
(
!
instances_
.
count
(
StyleName
))
return
false
;
if
(
!
instances_
.
count
(
StyleName
))
return
false
;
if
(
last_write_style_
==
StyleName
)
return
true
;
last_write_style_
=
StyleName
;
bool
first
=
false
,
left
=
false
;
bool
res
=
false
;
...
...
ASCOfficeOdfFile/src/docx/headers_footers.h
View file @
b98a545d
...
...
@@ -49,7 +49,8 @@ namespace oox {
class
headers_footers
{
public:
headers_footers
()
:
size_
(
0
),
enable_write_
(
false
){}
headers_footers
()
:
size_
(
0
)
{}
enum
Type
{
header
,
footer
,
headerLeft
,
footerLeft
,
headerFirst
,
footerFirst
,
none
};
std
::
wstring
add
(
const
std
::
wstring
&
StyleName
,
const
std
::
wstring
&
Content
,
Type
type
,
rels
&
_rels
);
...
...
@@ -66,18 +67,17 @@ public:
};
void
dump_rels
(
rels
&
Rels
)
const
;
bool
write_sectPr
(
const
std
::
wstring
&
StyleName
,
std
::
wostream
&
_Wostream
)
const
;
bool
write_sectPr
(
const
std
::
wstring
&
StyleName
,
bool
next_page
,
std
::
wostream
&
_Wostream
)
;
typedef
boost
::
shared_ptr
<
instance
>
instance_ptr
;
typedef
std
::
vector
<
instance_ptr
>
instances_array
;
typedef
boost
::
unordered_map
<
std
::
wstring
,
instances_array
>
instances_map
;
const
instances_map
&
instances
()
const
{
return
instances_
;
}
bool
get_enable_write
(){
return
enable_write_
;}
void
set_enable_write
(
bool
val
){
enable_write_
=
val
;}
const
instances_map
&
instances
()
const
{
return
instances_
;
}
private:
bool
enable_write_
;
std
::
wstring
last_write_style_
;
static
std
::
wstring
create_id
(
size_t
i
);
static
std
::
wstring
create_name
(
size_t
i
,
Type
_Type
);
instances_map
instances_
;
...
...
ASCOfficeOdfFile/src/docx/mediaitems.cpp
View file @
b98a545d
...
...
@@ -122,6 +122,9 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
sExt
=
uri
.
substr
(
n
);
}
}
if
(
type
==
typeObject
&&
sExt
.
empty
())
sExt
=
L".bin"
;
return
get_default_file_name
(
type
)
+
std
::
to_wstring
(
Num
)
+
sExt
;
}
...
...
ASCOfficeOdfFile/src/docx/oox_conversion_context.cpp
View file @
b98a545d
...
...
@@ -144,7 +144,7 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
}
namespace
oox
{
math_context
::
math_context
(
bool
graphic
)
:
base_font_size_
(
12
)
math_context
::
math_context
(
odf_reader
::
fonts_container
&
fonts
,
bool
graphic
)
:
base_font_size_
(
12
),
fonts_container_
(
fonts
)
{
graphRPR_
=
graphic
;
...
...
ASCOfficeOdfFile/src/docx/oox_conversion_context.h
View file @
b98a545d
...
...
@@ -44,6 +44,7 @@ namespace odf_reader
{
class
style_instance
;
class
style_text_properties
;
class
fonts_container
;
typedef
boost
::
shared_ptr
<
style_text_properties
>
style_text_properties_ptr
;
};
...
...
@@ -90,7 +91,7 @@ namespace oox {
class
math_context
:
boost
::
noncopyable
{
public:
math_context
(
bool
graphic
=
false
);
math_context
(
odf_reader
::
fonts_container
&
fonts
,
bool
graphic
=
false
);
void
start
();
std
::
wstring
end
();
...
...
@@ -99,6 +100,7 @@ namespace oox {
std
::
wstringstream
&
math_style_stream
()
{
return
math_style_stream_
;
}
odf_reader
::
fonts_container
&
fonts_container_
;
int
base_font_size_
;
odf_reader
::
style_text_properties_ptr
text_properties_
;
...
...
ASCOfficeOdfFile/src/docx/oox_package.cpp
View file @
b98a545d
...
...
@@ -143,6 +143,7 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
content_type
=
L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
;
content_type_content_
.
add_override
(
fileName
,
content_type
);
//add_or_find_default(extension);
}
void
content_types_file
::
set_media
(
mediaitems
&
_Mediaitems
)
...
...
ASCOfficeOdfFile/src/docx/pptx_conversion_context.cpp
View file @
b98a545d
...
...
@@ -61,16 +61,16 @@ namespace package
class
pptx_document
;
}
pptx_conversion_context
::
pptx_conversion_context
(
odf_reader
::
odf_document
*
odfDocument
)
:
output_document_
(
NULL
)
,
odf_document_
(
odfDocument
)
,
pptx_text_context_
(
odf_document_
->
odf_context
(),
*
this
)
,
pptx_table_context_
(
*
this
)
,
pptx_comments_context_
(
comments_context_handle_
)
,
pptx_slide_context_
(
*
this
/*, pptx_text_context_*/
)
,
math_context_
(
true
)
,
last_idx_placeHolder
(
1
)
,
last_uniq_big_id
(
1
)
pptx_conversion_context
::
pptx_conversion_context
(
odf_reader
::
odf_document
*
odfDocument
)
:
output_document_
(
NULL
)
,
odf_document_
(
odfDocument
)
,
pptx_text_context_
(
odf_document_
->
odf_context
(),
*
this
)
,
pptx_table_context_
(
*
this
)
,
pptx_comments_context_
(
comments_context_handle_
)
,
pptx_slide_context_
(
*
this
/*, pptx_text_context_*/
)
,
math_context_
(
odf_document_
->
odf_context
().
fontContainer
(),
true
)
,
last_idx_placeHolder
(
1
)
,
last_uniq_big_id
(
1
)
{
applicationFonts_
=
new
CApplicationFonts
();
}
...
...
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
View file @
b98a545d
...
...
@@ -707,10 +707,10 @@ void pptx_slide_context::serialize_objects(std::wostream & strm)
{
CP_XML_NODE
(
L"a:xfrm"
)
{
CP_XML_NODE
(
L"a:off"
)
{
CP_XML_ATTR
(
L"x"
,
0
);
CP_XML_ATTR
(
L"y"
,
0
);
}
CP_XML_NODE
(
L"a:ext"
)
{
CP_XML_ATTR
(
L"cx"
,
0
);
CP_XML_ATTR
(
L"cy"
,
0
);
}
CP_XML_NODE
(
L"a:chOff"
)
{
CP_XML_ATTR
(
L"x"
,
0
);
CP_XML_ATTR
(
L"y"
,
0
);
}
CP_XML_NODE
(
L"a:chExt"
)
{
CP_XML_ATTR
(
L"cx"
,
0
);
CP_XML_ATTR
(
L"cy"
,
0
);
}
CP_XML_NODE
(
L"a:off"
)
{
CP_XML_ATTR
(
L"x"
,
0
);
CP_XML_ATTR
(
L"y"
,
0
);
}
CP_XML_NODE
(
L"a:ext"
)
{
CP_XML_ATTR
(
L"cx"
,
0
);
CP_XML_ATTR
(
L"cy"
,
0
);
}
CP_XML_NODE
(
L"a:chOff"
)
{
CP_XML_ATTR
(
L"x"
,
0
);
CP_XML_ATTR
(
L"y"
,
0
);
}
CP_XML_NODE
(
L"a:chExt"
)
{
CP_XML_ATTR
(
L"cx"
,
0
);
CP_XML_ATTR
(
L"cy"
,
0
);
}
}
}
}
...
...
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
View file @
b98a545d
...
...
@@ -66,7 +66,7 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
num_format_context_
(
odf_document_
->
odf_context
()),
xlsx_text_context_
(
odf_document_
->
odf_context
().
styleContainer
()),
xlsx_table_context_
(
this
,
xlsx_text_context_
),
math_context_
(
true
),
math_context_
(
odf_document_
->
odf_context
().
fontContainer
(),
true
),
xlsx_style_
(
this
),
maxDigitSize_
(
std
::
pair
<
float
,
float
>
(
-
1.0
,
-
1.0
)
),
...
...
ASCOfficeOdfFile/src/odf/datatypes/custom_shape_types_convert.h
View file @
b98a545d
...
...
@@ -52,10 +52,10 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{
L"hexagon"
,
L"hexagon"
,
0
,
0
,
0
},
{
L"octagon"
,
L"octagon"
,
0
,
0
,
0
},
{
L"star4"
,
L"star4"
,
1
,
0
,
50000
},
{
L"star5"
,
L"star5"
,
1
,
0
,
50000
},
{
L"star5"
,
L"star5"
,
0
,
0
,
50000
},
//??? 19098 неверно
{
L"star8"
,
L"star8"
,
1
,
0
,
50000
},
{
L"star24"
,
L"star24"
,
1
,
0
,
50000
},
{
L"star6"
,
L"star6"
,
1
,
0
,
50000
},
{
L"star6"
,
L"star6"
,
0
,
0
,
50000
},
{
L"star12"
,
L"star12"
,
1
,
0
,
50000
},
{
L"round-rectangle"
,
L"roundRect"
,
0
,
0
,
0
},
{
L"ellipse"
,
L"ellipse"
,
0
,
0
,
0
},
...
...
@@ -137,6 +137,7 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{
L"mso-spt14"
,
L"thickArrow"
,
0
,
0
,
0
},
{
L"mso-spt17"
,
L"Balloon"
,
0
,
0
,
0
},
{
L"mso-spt18"
,
L"irregularSeal1"
,
0
,
0
,
0
},
{
L"mso-spt19"
,
L"rect"
,
0
,
0
,
0
},
{
L"mso-spt24"
,
L"textBox"
,
0
,
0
,
0
},
{
L"mso-spt25"
,
L""
,
0
,
0
,
0
},
{
L"mso-spt26"
,
L""
,
0
,
0
,
0
},
...
...
ASCOfficeOdfFile/src/odf/draw_frame.h
View file @
b98a545d
...
...
@@ -335,7 +335,7 @@ private:
public:
odf_types
::
common_xlink_attlist
common_xlink_attlist_
;
_CP_OPT
(
std
::
wstring
)
draw_class_id_
;
_CP_OPT
(
std
::
wstring
)
draw_class_id_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_object_ole
);
...
...
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
b98a545d
...
...
@@ -1000,8 +1000,8 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
if
(
drawing
->
inGroup
&&
drawing
->
type
!=
oox
::
typeGroupShape
)
{
Context
.
get_drawing_context
().
set_position_child_group
(
drawing
->
x
,
drawing
->
y
);
Context
.
get_drawing_context
().
set_size_child_group
(
drawing
->
cx
+
drawing
->
x
,
drawing
->
cy
+
drawing
->
y
);
Context
.
get_drawing_context
().
set_position_child_group
(
drawing
->
x
,
drawing
->
y
);
Context
.
get_drawing_context
().
set_size_child_group
(
drawing
->
cx
+
drawing
->
x
,
drawing
->
cy
+
drawing
->
y
);
// ваще то тут "несовсем" всерно ... нужно сначала все стартовые позиции добавить ..
_INT32
x_group_offset
,
y_group_offset
;
...
...
@@ -1094,7 +1094,15 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
oox
::
_docx_drawing
*
drawing
=
dynamic_cast
<
oox
::
_docx_drawing
*>
(
frame
->
oox_drawing_
.
get
());
if
(
!
drawing
)
return
;
oox
::
StreamsManPtr
prev
=
Context
.
get_stream_man
();
if
(
pos_replaicement
>=
0
&&
!
Context
.
get_drawing_context
().
get_use_image_replace
())
{
return
;
//skip replacement image (math, chart, ...) - возможно записать как альтернативный контент - todooo ???
}
if
(
drawing
->
type
==
oox
::
typeUnknown
)
drawing
->
type
=
oox
::
typeImage
;
oox
::
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
)
));
...
...
@@ -1115,12 +1123,6 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
Context
.
get_drawing_context
().
get_text_stream_frame
()
=
temp_stream
.
str
();
Context
.
set_stream_man
(
prev
);
//--------------------------------------------------
if
(
pos_replaicement
<
0
||
Context
.
get_drawing_context
().
get_use_image_replace
())
{
drawing
->
type
=
oox
::
typeImage
;
}
//--------------------------------------------------
oox
::
hyperlinks
::
_ref
hyperlink
=
Context
.
last_hyperlink
();
...
...
@@ -1162,7 +1164,6 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing
->
fill
.
bitmap
->
bCrop
=
parse_clipping
(
strRectClip
,
fileName
,
drawing
->
fill
.
bitmap
->
cropRect
,
NULL
/*Context.applicationFonts_*/
);
}
}
Context
.
set_paragraph_state
(
pState
);
}
void
draw_text_box
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
...
...
@@ -1378,27 +1379,28 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
oox_drawing_
=
oox_drawing_ptr
(
new
oox
::
_docx_drawing
());
Context
.
get_drawing_context
().
start_frame
(
this
);
oox
::
_docx_drawing
*
drawing
=
dynamic_cast
<
oox
::
_docx_drawing
*>
(
oox_drawing_
.
get
());
const
_CP_OPT
(
std
::
wstring
)
name
=
common_draw_attlists_
.
shape_with_text_and_styles_
.
common_draw_shape_with_styles_attlist_
.
common_draw_name_attlist_
.
draw_name_
;
Context
.
get_drawing_context
().
add_name_object
(
name
.
get_value_or
(
L"Object"
));
oox
::
_docx_drawing
*
drawing
=
dynamic_cast
<
oox
::
_docx_drawing
*>
(
oox_drawing_
.
get
());
drawing
->
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
->
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
->
inGroup
=
Context
.
get_drawing_context
().
in_group
();
common_draw_docx_convert
(
Context
,
common_draw_attlists_
,
drawing
);
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
content_
[
i
]
->
docx_convert
(
Context
);
}
//-----------------------------------------------------------------------------------------------------
Context
.
get_drawing_context
().
add_name_object
(
name
.
get_value_or
(
L"Object"
));
drawing
->
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
->
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
->
inGroup
=
Context
.
get_drawing_context
().
in_group
();
//-----------------------------------------------------------------------------------------------------
bool
runState
=
Context
.
get_run_state
();
bool
pState
=
Context
.
get_paragraph_state
();
bool
keepState
=
Context
.
get_paragraph_keep
();
...
...
@@ -1473,8 +1475,9 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
drawing
->
objectId
=
Context
.
add_mediaitem
(
href
,
drawing
->
type
,
isMediaInternal
,
href
);
}
else
if
(
objectBuild
.
object_type_
==
3
)
//мат формулы
{
{
//skip replacement image !!!
const
std
::
wstring
&
content
=
Context
.
get_drawing_context
().
get_text_stream_frame
();
bool
in_frame
=
!
drawing
->
isInline
;
...
...
@@ -1514,10 +1517,13 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
}
if
(
objectBuild
.
object_type_
==
4
)
//embedded sheet
{
cpdoccore
::
oox
::
package
::
xlsx_document
outputXlsx
;
cpdoccore
::
oox
::
xlsx_conversion_context
conversionXlsxContext
(
&
objectSubDoc
);
bool
&
use_image_replace
=
Context
.
get_drawing_context
().
get_use_image_replace
();
use_image_replace
=
true
;
oox
::
package
::
xlsx_document
outputXlsx
;
oox
::
xlsx_conversion_context
conversionXlsxContext
(
&
objectSubDoc
);
conversionXlsxContext
.
set_output_document
(
&
outputXlsx
);
conversionXlsxContext
.
set_output_document
(
&
outputXlsx
);
//conversionContext.set_font_directory (fontsPath);
if
(
objectSubDoc
.
xlsx_convert
(
conversionXlsxContext
))
...
...
@@ -1527,15 +1533,18 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
std
::
wstring
objectXlsxPath
=
FileSystem
::
Directory
::
CreateDirectoryWithUniqueName
(
folderPath
);
outputXlsx
.
write
(
objectXlsxPath
);
href
=
FileSystem
::
Directory
::
CreateTempFileWithUniqueName
(
folderPath
,
L"xlsx"
)
+
L".xlsx"
;
href
=
Context
.
get_drawing_context
().
get_current_object_name
()
+
L".xlsx"
;
std
::
wstring
temp_file
=
folderPath
+
FILE_SEPARATOR_STR
+
href
;
COfficeUtils
oCOfficeUtils
(
NULL
);
oCOfficeUtils
.
CompressFileOrDirectory
(
objectXlsxPath
.
c_str
(),
href
.
c_str
(),
-
1
);
oCOfficeUtils
.
CompressFileOrDirectory
(
objectXlsxPath
.
c_str
(),
temp_file
.
c_str
(),
-
1
);
FileSystem
::
Directory
::
DeleteDirectory
(
objectXlsxPath
);
bool
isMediaInternal
=
true
;
drawing
->
objectId
=
Context
.
add_mediaitem
(
href
,
drawing
->
type
,
isMediaInternal
,
href
);
drawing
->
objectId
=
Context
.
add_mediaitem
(
href
,
drawing
->
type
,
isMediaInternal
,
temp_file
);
drawing
->
objectProgId
=
L"Excel.Sheet.12"
;
}
else
{
...
...
@@ -1564,6 +1573,20 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
bool
&
use_image_replace
=
Context
.
get_drawing_context
().
get_use_image_replace
();
use_image_replace
=
true
;
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
if
(
href
.
empty
())
return
;
draw_frame
*
frame
=
Context
.
get_drawing_context
().
get_current_frame
();
//owner
if
(
!
frame
)
return
;
oox
::
_docx_drawing
*
drawing
=
dynamic_cast
<
oox
::
_docx_drawing
*>
(
frame
->
oox_drawing_
.
get
());
if
(
!
drawing
)
return
;
drawing
->
type
=
oox
::
typeObject
;
bool
isMediaInternal
=
true
;
drawing
->
objectId
=
Context
.
add_mediaitem
(
href
,
drawing
->
type
,
isMediaInternal
,
href
);
drawing
->
objectProgId
=
L""
;
//detect ???
}
}
...
...
ASCOfficeOdfFile/src/odf/draw_shapes.cpp
View file @
b98a545d
...
...
@@ -230,7 +230,11 @@ void draw_path::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void
draw_path
::
reset_svg_path
()
{
if
(
draw_path_attlist_
.
svg_d_
)
if
(
!
draw_path_attlist_
.
svg_d_
)
{
bad_shape_
=
true
;
}
else
{
std
::
vector
<
svg_path
::
_polyline
>
o_Polyline_pt
;
std
::
vector
<
svg_path
::
_polyline
>
o_Polyline_cm
;
...
...
@@ -286,7 +290,11 @@ void draw_polygon::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void
draw_polygon
::
reset_polygon_path
()
{
if
(
draw_polygon_attlist_
.
draw_points_
)
if
(
!
draw_polygon_attlist_
.
draw_points_
)
{
bad_shape_
=
true
;
}
else
{
std
::
vector
<
svg_path
::
_polyline
>
o_Polyline_pt
;
std
::
vector
<
svg_path
::
_polyline
>
o_Polyline_cm
;
...
...
@@ -338,7 +346,11 @@ void draw_polyline::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void
draw_polyline
::
reset_polyline_path
()
{
if
(
draw_polyline_attlist_
.
draw_points_
)
if
(
!
draw_polyline_attlist_
.
draw_points_
)
{
bad_shape_
=
true
;
}
else
{
std
::
vector
<
svg_path
::
_polyline
>
o_Polyline_pt
;
std
::
vector
<
svg_path
::
_polyline
>
o_Polyline_cm
;
...
...
@@ -601,7 +613,11 @@ void draw_connector::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void
draw_connector
::
reset_svg_path
()
{
if
(
draw_connector_attlist_
.
svg_d_
)
if
(
!
draw_connector_attlist_
.
svg_d_
)
{
bad_shape_
=
true
;
}
else
{
std
::
vector
<
svg_path
::
_polyline
>
o_Polyline_pt
;
std
::
vector
<
svg_path
::
_polyline
>
o_Polyline_cm
;
...
...
ASCOfficeOdfFile/src/odf/math_layout_elements.cpp
View file @
b98a545d
...
...
@@ -292,7 +292,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
{
CP_XML_NODE
(
L"m:ctrlPr"
)
{
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
);
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
,
Context
.
fonts_container_
);
}
}
}
...
...
@@ -317,7 +317,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
{
CP_XML_NODE
(
L"m:ctrlPr"
)
{
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
);
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
,
Context
.
fonts_container_
);
}
}
}
...
...
ASCOfficeOdfFile/src/odf/math_table_elements.cpp
View file @
b98a545d
...
...
@@ -94,8 +94,10 @@ void math_mtr::oox_convert(oox::math_context & Context)
strm
<<
L"<m:mr>"
;
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
strm
<<
L"<m:e>"
;
office_math_element
*
math_element
=
dynamic_cast
<
office_math_element
*>
(
content_
[
i
].
get
());
math_element
->
oox_convert
(
Context
);
strm
<<
L"</m:e>"
;
}
strm
<<
L"</m:mr>"
;
}
...
...
ASCOfficeOdfFile/src/odf/math_token_elements.cpp
View file @
b98a545d
...
...
@@ -114,7 +114,7 @@ void math_mi::oox_convert(oox::math_context & Context)
}
}
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
);
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
,
Context
.
fonts_container_
);
CP_XML_NODE
(
L"m:t"
)
{
...
...
@@ -162,7 +162,7 @@ void math_mo::oox_convert(oox::math_context & Context)
{
// + доп стили текста ... todoooo
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
);
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
,
Context
.
fonts_container_
);
CP_XML_NODE
(
L"m:t"
)
{
...
...
@@ -203,7 +203,7 @@ void math_mn::oox_convert(oox::math_context & Context)
{
// + доп стили текста ... todoooo
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
);
Context
.
text_properties_
->
content
().
oox_convert
(
CP_XML_STREAM
(),
Context
.
graphRPR_
,
Context
.
fonts_container_
);
CP_XML_NODE
(
L"m:t"
)
{
...
...
ASCOfficeOdfFile/src/odf/office_body.cpp
View file @
b98a545d
...
...
@@ -128,8 +128,6 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
if
(
content_
)
content_
->
docx_convert
(
Context
);
Context
.
get_headers_footers
().
set_enable_write
(
true
);
if
(
!
Context
.
get_section_context
().
dump_
.
empty
()
&&
!
Context
.
get_table_context
().
in_table
())
{
Context
.
output_stream
()
<<
Context
.
get_section_context
().
dump_
;
...
...
ASCOfficeOdfFile/src/odf/style_table_properties.cpp
View file @
b98a545d
...
...
@@ -87,27 +87,6 @@ bool table_format_properties::add_child_element( xml::sax * Reader, const std::w
}
}
/*
[ ] w:tblStyle Referenced Table Style
[ ] w:tblpPr Floating Table Positioning
[ ] w:tblOverlap Floating Table Allows Other Tables to Overlap
[ ] w:bidiVisual Visually Right to Left Table
[ ] w:tblStyleRowBandSize Number of Rows in Row Band
[ ] w:tblStyleColBandSize Number of Columns in Column Band
[x] w:tblW Preferred Table Width
[x] w:jc Table Alignment
[ ] w:tblCellSpacing Table Cell Spacing Default
[ ] w:tblInd Table Indent from Leading Margin
[ ] w:tblBorders Table Borders
[ ] w:shd Table Shading
[ ] w:tblLayout Table Layout
[ ] w:tblCellMar Table Cell Margin Defaults
[ ] w:tblLook Table Style Conditional Formatting Settings
[ ] w:tblPrChange Revision Information for Table Properties
*/
void
table_format_properties
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
std
::
wostream
&
_tblPr
=
Context
.
get_styles_context
().
table_style
();
...
...
@@ -115,13 +94,13 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if
(
style_rel_width_
)
{
int
w_w
=
(
int
)(
0.5
+
50.0
*
style_rel_width_
->
get_value
());
_tblPr
<<
L"<w:tblW w:type=
\"
pct
\"
w:w=
\"
"
<<
w_w
<<
"
\"
/>"
;
_tblPr
<<
L"<w:tblW w:type=
\"
pct
\"
w:w=
\"
"
<<
w_w
<<
"
\"
/>"
;
}
else
if
(
style_width_
)
{
int
w_w
=
(
int
)(
0.5
+
20.0
*
style_width_
->
get_value_unit
(
length
::
pt
));
if
(
w_w
>
31680
)
w_w
=
31680
;
_tblPr
<<
L"<w:tblW w:type=
\"
dxa
\"
w:w=
\"
"
<<
w_w
<<
"
\"
/>"
;
_tblPr
<<
L"<w:tblW w:type=
\"
dxa
\"
w:w=
\"
"
<<
w_w
<<
"
\"
/>"
;
}
else
{
...
...
@@ -147,6 +126,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if
(
w_val
!=
L"center"
&&
common_horizontal_margin_attlist_
.
fo_margin_left_
)
{
odf_types
::
length
indent
=
common_horizontal_margin_attlist_
.
fo_margin_left_
->
get_length
();
_tblPr
<<
L"<w:tblInd w:w=
\"
"
<<
indent
.
get_value_unit
(
odf_types
::
length
::
pt
)
*
20
<<
"
\"
w:type=
\"
dxa
\"
/>"
;
}
}
...
...
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
View file @
b98a545d
...
...
@@ -276,18 +276,20 @@ void text_format_properties_content::pptx_convert_as_list(oox::pptx_conversion_c
{
std
::
wstring
w_font
=
(
fo_font_family_
?
*
fo_font_family_
:
L""
);
if
(
w_font
.
length
()
<
1
)
if
(
w_font
.
empty
()
)
{
std
::
wstring
w_ascii
=
(
style_font_name_
?
*
style_font_name_
:
L""
);
std
::
wstring
w_eastAsia
=
(
style_font_name_asian_
?
*
style_font_name_asian_
:
L""
);
std
::
wstring
w_cs
=
(
style_font_name_complex_
?
*
style_font_name_complex_
:
L""
);
std
::
wstring
w_ascii
=
(
style_font_name_
?
*
style_font_name_
:
L""
);
std
::
wstring
w_eastAsia
=
(
style_font_name_asian_
?
*
style_font_name_asian_
:
L""
);
std
::
wstring
w_cs
=
(
style_font_name_complex_
?
*
style_font_name_complex_
:
L""
);
fonts_container
&
fonts
=
Context
.
root
()
->
odf_context
().
fontContainer
();
font_instance
*
font
=
fonts
.
font_by_style_name
(
w_ascii
);
if
(
font
==
NULL
)
font
=
fonts
.
font_by_style_name
(
w_eastAsia
);
if
(
font
==
NULL
)
font
=
fonts
.
font_by_style_name
(
w_cs
);
if
(
font
)
w_font
=
font
->
name
();
font_instance
*
font
=
fonts
.
font_by_style_name
(
w_ascii
);
if
(
font
==
NULL
)
font
=
fonts
.
font_by_style_name
(
w_eastAsia
);
if
(
font
==
NULL
)
font
=
fonts
.
font_by_style_name
(
w_cs
);
if
(
font
)
w_font
=
font
->
name
();
//'Arial' глючит
removeCharsFromString
(
w_font
,
_T
(
"'"
));
...
...
@@ -436,12 +438,12 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
if
(
fo_language_
||
style_language_asian_
||
style_language_complex_
)
{
std
::
wstring
w_val
;
if
(
fo_language_
)
w_val
=
*
fo_language_
;
else
if
(
fo_country_
)
w_val
=
*
fo_country_
;
else
if
(
style_country_asian_
)
w_val
=
*
style_country_asian_
;
else
if
(
style_language_asian_
)
w_val
=
*
style_language_asian_
;
else
if
(
style_language_complex_
)
w_val
=
*
style_language_complex_
;
else
if
(
style_country_complex_
)
w_val
=
*
style_country_complex_
;
if
(
fo_language_
)
w_val
=
*
fo_language_
;
else
if
(
fo_country_
)
w_val
=
*
fo_country_
;
else
if
(
style_country_asian_
)
w_val
=
*
style_country_asian_
;
else
if
(
style_language_asian_
)
w_val
=
*
style_language_asian_
;
else
if
(
style_language_complex_
)
w_val
=
*
style_language_complex_
;
else
if
(
style_country_complex_
)
w_val
=
*
style_country_complex_
;
CP_XML_ATTR
(
L"lang"
,
w_val
);
}
...
...
@@ -455,23 +457,45 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
}
if
(
style_font_name_
||
style_font_name_asian_
||
style_font_name_complex_
||
fo_font_family_
)
{
std
::
wstring
w_font
=
(
fo_font_family_
?
*
fo_font_family_
:
L""
);
std
::
wstring
w_ascii
=
(
style_font_name_
?
*
style_font_name_
:
w_font
);
if
(
w_ascii
.
length
()
>
0
)
fonts_container
&
fonts
=
Context
.
root
()
->
odf_context
().
fontContainer
();
std
::
wstring
w_eastAsia
;
std
::
wstring
w_hAnsi
;
std
::
wstring
w_cs
;
std
::
wstring
w_ascii
=
w_hAnsi
=
w_cs
=
(
fo_font_family_
?
*
fo_font_family_
:
L""
);
if
(
style_font_name_complex_
)
{
CP_XML_NODE
(
L"a:latin"
){
CP_XML_ATTR
(
L"typeface"
,
delete_apostroph_in_name
(
w_ascii
));}
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_complex_
);
if
(
font
)
w_cs
=
font
->
name
();
}
if
(
style_font_name_asian_
)
{
std
::
wstring
w_eastAsia
=
*
style_font_name_asian_
;
CP_XML_NODE
(
L"a:ea"
){
CP_XML_ATTR
(
L"typeface"
,
delete_apostroph_in_name
(
w_eastAsia
));}
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_asian_
);
if
(
font
)
w_eastAsia
=
font
->
name
();
}
if
(
style_font_name_
)
{
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_
);
if
(
font
)
w_ascii
=
w_hAnsi
=
font
->
name
();
}
if
(
!
w_ascii
.
empty
())
{
CP_XML_NODE
(
L"a:latin"
){
CP_XML_ATTR
(
L"typeface"
,
delete_apostroph_in_name
(
w_ascii
));}
}
if
(
style_font_name_complex_
)
if
(
!
w_eastAsia
.
empty
())
{
CP_XML_NODE
(
L"a:ea"
){
CP_XML_ATTR
(
L"typeface"
,
delete_apostroph_in_name
(
w_eastAsia
));}
}
if
(
!
w_cs
.
empty
())
{
std
::
wstring
w_cs
=
*
style_font_name_complex_
;
CP_XML_NODE
(
L"a:cs"
){
CP_XML_ATTR
(
L"typeface"
,
delete_apostroph_in_name
(
w_cs
));}
CP_XML_NODE
(
L"a:cs"
){
CP_XML_ATTR
(
L"typeface"
,
delete_apostroph_in_name
(
w_cs
));}
}
}
...
...
@@ -852,22 +876,38 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
if
(
style_font_name_
||
style_font_name_asian_
||
style_font_name_complex_
||
fo_font_family_
)
{
fonts_container
&
fonts
=
Context
.
root
()
->
odf_context
().
fontContainer
();
std
::
wstring
w_eastAsia
;
std
::
wstring
w_hAnsi
;
std
::
wstring
w_cs
;
std
::
wstring
w_ascii
=
w_hAnsi
=
w_cs
=
(
style_font_name_
?
*
style_font_name_
:
L""
);
std
::
wstring
w_ascii
=
w_hAnsi
=
w_cs
=
(
fo_font_family_
?
*
fo_font_family_
:
L""
);
_rPr
<<
L"<w:rFonts "
;
if
(
!
w_ascii
.
empty
())
_rPr
<<
L"w:ascii=
\"
"
<<
w_ascii
<<
"
\"
"
;
if
(
!
w_hAnsi
.
empty
())
_rPr
<<
L"w:hAnsi=
\"
"
<<
w_hAnsi
<<
"
\"
"
;
if
(
!
w_eastAsia
.
empty
())
_rPr
<<
L"w:eastAsia=
\"
"
<<
w_eastAsia
<<
"
\"
"
;
if
(
!
w_cs
.
empty
())
_rPr
<<
L"w:cs=
\"
"
<<
w_cs
<<
"
\"
"
;
if
(
style_font_name_complex_
)
{
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_complex_
);
if
(
font
)
w_cs
=
font
->
name
();
}
if
(
style_font_name_asian_
)
{
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_asian_
);
if
(
font
)
w_eastAsia
=
font
->
name
();
}
if
(
style_font_name_
)
{
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_
);
if
(
font
)
w_ascii
=
w_hAnsi
=
font
->
name
();
}
_rPr
<<
L" />"
;
_rPr
<<
L"<w:rFonts"
;
if
(
!
w_ascii
.
empty
())
_rPr
<<
L" w:ascii=
\"
"
<<
w_ascii
<<
"
\"
"
;
if
(
!
w_hAnsi
.
empty
())
_rPr
<<
L" w:hAnsi=
\"
"
<<
w_hAnsi
<<
"
\"
"
;
if
(
!
w_eastAsia
.
empty
())
_rPr
<<
L" w:eastAsia=
\"
"
<<
w_eastAsia
<<
"
\"
"
;
if
(
!
w_cs
.
empty
())
_rPr
<<
L" w:cs=
\"
"
<<
w_cs
<<
"
\"
"
;
_rPr
<<
L"/>"
;
}
_CP_OPT
(
color
)
color_text
=
fo_color_
;
...
...
@@ -974,12 +1014,12 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
}
void
text_format_properties_content
::
oox_convert
(
std
::
wostream
&
_rPr
,
bool
graphic
)
void
text_format_properties_content
::
oox_convert
(
std
::
wostream
&
_rPr
,
bool
graphic
,
fonts_container
&
fonts
)
{
const
int
W
=
process_font_weight
(
fo_font_weight_
);
const
int
fontStyle
=
process_font_style
(
fo_font_style_
);
const
int
WCs
=
process_font_weight
(
style_font_weight_complex_
);
if
(
graphic
)
{
_rPr
<<
L"<a:rPr"
;
...
...
@@ -1324,19 +1364,33 @@ void text_format_properties_content::oox_convert (std::wostream & _rPr, bool gra
std
::
wstring
w_eastAsia
;
std
::
wstring
w_hAnsi
;
std
::
wstring
w_cs
;
std
::
wstring
w_ascii
=
w_hAnsi
=
w_cs
=
(
style_font_name_
?
*
style_font_name_
:
L""
);
_rPr
<<
L"<w:rFonts "
;
if
(
!
w_ascii
.
empty
())
_rPr
<<
L"w:ascii=
\"
"
<<
w_ascii
<<
"
\"
"
;
if
(
!
w_hAnsi
.
empty
())
_rPr
<<
L"w:hAnsi=
\"
"
<<
w_hAnsi
<<
"
\"
"
;
if
(
!
w_eastAsia
.
empty
())
_rPr
<<
L"w:eastAsia=
\"
"
<<
w_eastAsia
<<
"
\"
"
;
if
(
!
w_cs
.
empty
())
_rPr
<<
L"w:cs=
\"
"
<<
w_cs
<<
"
\"
"
;
std
::
wstring
w_ascii
=
w_hAnsi
=
w_cs
=
(
fo_font_family_
?
*
fo_font_family_
:
L""
);
if
(
style_font_name_complex_
)
{
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_complex_
);
if
(
font
)
w_cs
=
font
->
name
();
}
if
(
style_font_name_asian_
)
{
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_asian_
);
if
(
font
)
w_eastAsia
=
font
->
name
();
}
if
(
style_font_name_
)
{
font_instance
*
font
=
fonts
.
font_by_style_name
(
*
style_font_name_
);
if
(
font
)
w_ascii
=
w_hAnsi
=
font
->
name
();
}
_rPr
<<
L" />"
;
_rPr
<<
L"<w:rFonts"
;
if
(
!
w_ascii
.
empty
())
_rPr
<<
L" w:ascii=
\"
"
<<
w_ascii
<<
"
\"
"
;
if
(
!
w_hAnsi
.
empty
())
_rPr
<<
L" w:hAnsi=
\"
"
<<
w_hAnsi
<<
"
\"
"
;
if
(
!
w_eastAsia
.
empty
())
_rPr
<<
L" w:eastAsia=
\"
"
<<
w_eastAsia
<<
"
\"
"
;
if
(
!
w_cs
.
empty
())
_rPr
<<
L" w:cs=
\"
"
<<
w_cs
<<
"
\"
"
;
_rPr
<<
L"/>"
;
}
_CP_OPT
(
color
)
color_text
=
fo_color_
;
...
...
ASCOfficeOdfFile/src/odf/style_text_properties.h
View file @
b98a545d
...
...
@@ -69,6 +69,7 @@ namespace cpdoccore {
namespace
odf_reader
{
class
style_instance
;
class
fonts_container
;
// 15.4
class
text_format_properties_content
:
public
oox
::
conversion_element
...
...
@@ -79,7 +80,8 @@ public:
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
void
pptx_convert_as_list
(
oox
::
pptx_conversion_context
&
Context
);
void
oox_convert
(
std
::
wostream
&
stream
,
bool
graphic
);
void
oox_convert
(
std
::
wostream
&
stream
,
bool
graphic
,
fonts_container
&
fonts
);
void
apply_from
(
const
text_format_properties_content
&
Other
);
void
apply_to
(
std
::
vector
<
_property
>
&
properties
);
...
...
ASCOfficeOdfFile/src/odf/styles.cpp
View file @
b98a545d
...
...
@@ -1134,14 +1134,14 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
CP_XML_NODE
(
L"w:pgMar"
)
{
CP_XML_ATTR
(
L"w:header"
,
process_page_margin
(
common_vertical_margin_attlist_
.
fo_margin_top_
)
);
CP_XML_ATTR
(
L"w:footer"
,
process_page_margin
(
common_vertical_margin_attlist_
.
fo_margin_bottom_
)
);
CP_XML_ATTR
(
L"w:gutter"
,
0
);
CP_XML_ATTR
(
L"w:left"
,
process_page_margin
(
common_horizontal_margin_attlist_
.
fo_margin_left_
,
margin_left_length
)
);
CP_XML_ATTR
(
L"w:right"
,
process_page_margin
(
common_horizontal_margin_attlist_
.
fo_margin_right_
,
margin_right_length
)
);
CP_XML_ATTR
(
L"w:top"
,
process_page_margin
(
common_vertical_margin_attlist_
.
fo_margin_top_
,
Context
.
get_header_footer_context
().
header
())
);
CP_XML_ATTR
(
L"w:bottom"
,
process_page_margin
(
common_vertical_margin_attlist_
.
fo_margin_bottom_
,
Context
.
get_header_footer_context
().
footer
())
);
CP_XML_ATTR
(
L"w:header"
,
process_page_margin
(
common_vertical_margin_attlist_
.
fo_margin_top_
)
);
CP_XML_ATTR
(
L"w:footer"
,
process_page_margin
(
common_vertical_margin_attlist_
.
fo_margin_bottom_
)
);
CP_XML_ATTR
(
L"w:gutter"
,
0
);
}
}
...
...
@@ -1286,19 +1286,17 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
{
Context
.
process_section
(
CP_XML_STREAM
(),
columns
);
bool
next_page
=
Context
.
is_next_dump_page_properties
();
CP_XML_NODE
(
L"w:type"
)
{
if
(
Context
.
is_next_dump_page_properties
())
{
CP_XML_ATTR
(
L"w:val"
,
L"nextPage"
);
}
else
{
CP_XML_ATTR
(
L"w:val"
,
L"continuous"
);
}
if
(
next_page
)
CP_XML_ATTR
(
L"w:val"
,
L"nextPage"
);
else
CP_XML_ATTR
(
L"w:val"
,
L"continuous"
);
}
std
::
wstring
masterPageName
=
Context
.
get_master_page_name
();
bool
res
=
Context
.
get_headers_footers
().
write_sectPr
(
masterPageName
,
strm
);
bool
res
=
Context
.
get_headers_footers
().
write_sectPr
(
masterPageName
,
next_page
,
strm
);
if
(
res
==
false
)
{
// default???
...
...
@@ -1308,7 +1306,7 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
Context
.
remove_page_properties
();
Context
.
add_page_properties
(
masterPageNameLayout
);
bool
res
=
Context
.
get_headers_footers
().
write_sectPr
(
masterPageName
,
strm
);
bool
res
=
Context
.
get_headers_footers
().
write_sectPr
(
masterPageName
,
next_page
,
strm
);
}
oox
::
section_context
::
_section
&
section
=
Context
.
get_section_context
().
get
();
...
...
ASCOfficeOdfFile/src/odf/text_elements.cpp
View file @
b98a545d
...
...
@@ -137,7 +137,14 @@ typedef std::map<std::wstring, oox::text_tracked_context::_state>::iterator map_
int
process_paragraph_attr
(
const
paragraph_attrs
&
Attr
,
oox
::
docx_conversion_context
&
Context
)
{
if
(
!
Attr
.
text_style_name_
.
empty
())
bool
in_drawing
=
false
;
if
(
Context
.
get_drawing_context
().
get_current_shape
()
||
Context
.
get_drawing_context
().
get_current_frame
())
{
in_drawing
=
true
;
}
if
(
!
Attr
.
text_style_name_
.
empty
())
{
if
(
style_instance
*
styleInst
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_by_name
(
Attr
.
text_style_name_
.
style_name
(),
style_family
::
Paragraph
,
Context
.
process_headers_footers_
)
...
...
@@ -180,7 +187,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
Context
.
end_automatic_style
();
Context
.
push_text_properties
(
styleContent
->
get_style_text_properties
());
return
1
;
return
1
;
}
}
else
...
...
@@ -188,9 +195,10 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
const
std
::
wstring
id
=
Context
.
styles_map_
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
Context
.
output_stream
()
<<
L"<w:pPr>"
;
//todooo причесать
if
(
!
Context
.
get_section_context
().
dump_
.
empty
()
&&
!
Context
.
get_table_context
().
in_table
()
&&
(
Context
.
get_process_note
()
==
oox
::
docx_conversion_context
::
noNote
))
if
(
!
Context
.
get_section_context
().
dump_
.
empty
()
&&
!
Context
.
get_table_context
().
in_table
()
&&
(
Context
.
get_process_note
()
==
oox
::
docx_conversion_context
::
noNote
)
&&
!
in_drawing
)
{
if
(
Context
.
is_paragraph_header
()
)
{
...
...
@@ -236,9 +244,10 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
}
}
}
if
(
!
Context
.
get_section_context
().
dump_
.
empty
()
&&
!
Context
.
get_table_context
().
in_table
()
&&
(
Context
.
get_process_note
()
==
oox
::
docx_conversion_context
::
noNote
))
if
(
!
Context
.
get_section_context
().
dump_
.
empty
()
&&
!
Context
.
get_table_context
().
in_table
()
&&
(
Context
.
get_process_note
()
==
oox
::
docx_conversion_context
::
noNote
)
&&
!
in_drawing
)
{
Context
.
output_stream
()
<<
L"<w:pPr>"
;
Context
.
output_stream
()
<<
Context
.
get_section_context
().
dump_
;
...
...
@@ -361,18 +370,18 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
{
const
std
::
wstring
&
styleName
=
attrs_
.
text_style_name_
.
style_name
();
bool
drawing
=
false
;
bool
in_
drawing
=
false
;
if
(
Context
.
get_drawing_context
().
get_current_shape
()
||
Context
.
get_drawing_context
().
get_current_frame
())
{
drawing
=
true
;
in_
drawing
=
true
;
}
bool
bIsNewParagraph
=
true
;
bool
is_empty
=
content_
.
empty
();
if
(
Context
.
get_paragraph_state
()
&&
(
Context
.
get_process_note
()
==
oox
::
docx_conversion_context
::
noNote
)
&&
!
drawing
)
if
(
Context
.
get_paragraph_state
()
&&
(
Context
.
get_process_note
()
==
oox
::
docx_conversion_context
::
noNote
)
&&
!
in_
drawing
)
{
//вложеннные элементы ... или после графики embedded_linux_kernel_and_drivers_labs_zh_TW.odt
bIsNewParagraph
=
false
;
...
...
@@ -425,8 +434,6 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
Context
.
remove_page_properties
();
Context
.
add_page_properties
(
masterPageNameLayout
);
Context
.
set_page_break
(
true
);
is_empty
=
false
;
}
...
...
@@ -453,7 +460,8 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
if
(
Context
.
get_page_break
())
{
if
(
Context
.
process_headers_footers_
==
false
)
_Wostream
<<
L"<w:lastRenderedPageBreak/>"
;
//_Wostream << L"<w:lastRenderedPageBreak/>";
_Wostream
<<
L"<w:br w:type=
\"
page
\"
/>"
;
Context
.
set_page_break
(
false
);
}
elm
->
docx_convert
(
Context
);
...
...
@@ -482,7 +490,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
is_empty
=
false
;
Context
.
add_new_run
(
_T
(
""
));
_Wostream
<<
L"<w:br w:type=
\"
page
\"
/>"
;
_Wostream
<<
L"<w:br w:type=
\"
page
\"
/>"
;
Context
.
finish_run
();
}
...
...
@@ -967,9 +975,39 @@ void text_table_index::add_child_element( xml::sax * Reader, const std::wstring
const
wchar_t
*
text_illustration_index
::
ns
=
L"text"
;
const
wchar_t
*
text_illustration_index
::
name
=
L"illustration-index"
;
void
text_illustration_index
::
afterCreate
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_section
(
true
);
}
}
}
void
text_illustration_index
::
afterReadContent
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_end_section
(
true
);
}
}
}
void
text_illustration_index
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
text_index_body_
)
std
::
wstring
current_page_properties
=
Context
.
get_page_properties
();
Context
.
get_section_context
().
add_section
(
text_section_attr_
.
text_name_
,
text_section_attr_
.
text_style_name_
.
get_value_or
(
style_ref
()).
style_name
(),
current_page_properties
);
Context
.
add_page_properties
(
current_page_properties
);
if
(
text_index_body_
)
text_index_body_
->
docx_convert
(
Context
);
}
...
...
@@ -997,8 +1035,77 @@ void text_illustration_index::add_child_element( xml::sax * Reader, const std::w
{
CP_CREATE_ELEMENT
(
text_index_body_
);
}
// TODO text-illustration-index-source
// todooo text-illustration-index-source
}
// text:alphabetical-index
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
text_alphabetical_index
::
ns
=
L"text"
;
const
wchar_t
*
text_alphabetical_index
::
name
=
L"alphabetical-index"
;
void
text_alphabetical_index
::
afterCreate
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_section
(
true
);
}
}
}
void
text_alphabetical_index
::
afterReadContent
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_end_section
(
true
);
}
}
}
void
text_alphabetical_index
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
std
::
wstring
current_page_properties
=
Context
.
get_page_properties
();
Context
.
get_section_context
().
add_section
(
text_section_attr_
.
text_name_
,
text_section_attr_
.
text_style_name_
.
get_value_or
(
style_ref
()).
style_name
(),
current_page_properties
);
Context
.
add_page_properties
(
current_page_properties
);
if
(
text_index_body_
)
text_index_body_
->
docx_convert
(
Context
);
}
void
text_alphabetical_index
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
if
(
text_index_body_
)
text_index_body_
->
pptx_convert
(
Context
);
}
std
::
wostream
&
text_alphabetical_index
::
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
{
CP_SERIALIZE_TEXT
(
text_index_body_
);
return
_Wostream
;
}
void
text_alphabetical_index
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
text_section_attr_
.
add_attributes
(
Attributes
);
}
void
text_alphabetical_index
::
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
)
{
if
CP_CHECK_NAME
(
L"text"
,
L"index-body"
)
{
CP_CREATE_ELEMENT
(
text_index_body_
);
}
// todooo text-alphabetical-index-source
}
//--------------------------------------------------------------------------------------------------------
// text:tracked-changes
const
wchar_t
*
text_tracked_changes
::
ns
=
L"text"
;
...
...
ASCOfficeOdfFile/src/odf/text_elements.h
View file @
b98a545d
...
...
@@ -360,6 +360,9 @@ public:
static
const
ElementType
type
=
typeTextIllustrationIndex
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
afterCreate
();
virtual
void
afterReadContent
();
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
...
...
@@ -377,6 +380,36 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_illustration_index
);
//---------------------------------------------------------------------------------------------------
class
text_alphabetical_index
:
public
text_content_impl
<
text_alphabetical_index
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeTextAlphabeticalIndex
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
afterCreate
();
virtual
void
afterReadContent
();
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
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
);
public:
text_section_attr
text_section_attr_
;
office_element_ptr
text_alphabetical_index_source_
;
office_element_ptr
text_index_body_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_alphabetical_index
);
//---------------------------------------------------------------------------------------------------
class
text_index_body
:
public
text_content_impl
<
text_index_body
>
...
...
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