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
1766dc9c
Commit
1766dc9c
authored
Jul 22, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - outline, fix sections with outline, ...
parent
12447c78
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
165 additions
and
135 deletions
+165
-135
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
+10
-6
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
+19
-10
ASCOfficeOdfFile/src/odf/draw_common.cpp
ASCOfficeOdfFile/src/odf/draw_common.cpp
+3
-2
ASCOfficeOdfFile/src/odf/draw_common.h
ASCOfficeOdfFile/src/odf/draw_common.h
+1
-1
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+3
-1
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
+1
-1
ASCOfficeOdfFile/src/odf/odfcontext.cpp
ASCOfficeOdfFile/src/odf/odfcontext.cpp
+5
-3
ASCOfficeOdfFile/src/odf/odfcontext.h
ASCOfficeOdfFile/src/odf/odfcontext.h
+1
-1
ASCOfficeOdfFile/src/odf/styles.cpp
ASCOfficeOdfFile/src/odf/styles.cpp
+31
-23
ASCOfficeOdfFile/src/odf/styles.h
ASCOfficeOdfFile/src/odf/styles.h
+4
-3
ASCOfficeOdfFile/src/odf/text_content.h
ASCOfficeOdfFile/src/odf/text_content.h
+2
-1
ASCOfficeOdfFile/src/odf/text_elements.cpp
ASCOfficeOdfFile/src/odf/text_elements.cpp
+48
-38
ASCOfficeOdfFile/src/odf/text_elements.h
ASCOfficeOdfFile/src/odf/text_elements.h
+37
-45
No files found.
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
View file @
1766dc9c
...
...
@@ -64,6 +64,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
next_dump_page_properties_
(
false
),
in_automatic_style_
(
false
),
in_paragraph_
(
false
),
in_header_
(
false
),
table_context_
(
*
this
),
output_document_
(
NULL
),
section_properties_in_table_
(
NULL
),
...
...
@@ -142,15 +143,16 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
}
}
void
docx_conversion_context
::
start_paragraph
()
void
docx_conversion_context
::
start_paragraph
(
bool
is_header
)
{
if
(
in_paragraph_
)
finish_paragraph
();
output_stream
()
<<
L"<w:p>"
;
in_paragraph_
=
true
;
rtl_
=
false
;
in_header_
=
is_header
;
in_paragraph_
=
true
;
rtl_
=
false
;
}
void
docx_conversion_context
::
finish_paragraph
()
...
...
@@ -159,7 +161,9 @@ void docx_conversion_context::finish_paragraph()
{
output_stream
()
<<
L"</w:p>"
;
}
in_paragraph_
=
false
;
in_paragraph_
=
false
;
in_header_
=
false
;
}
...
...
@@ -750,9 +754,9 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
CP_XML_WRITER
(
strm
)
{
if
(
get_section_context
().
dump_
.
empty
()
==
false
&&
(
!
ParentId
.
empty
()
||
get_section_context
().
get
().
is_dump_
)
if
(
get_section_context
().
dump_
.
empty
()
==
false
&&
(
!
ParentId
.
empty
()
||
get_section_context
().
get
().
is_dump_
||
in_header_
)
&&
!
get_table_context
().
in_table
())
{
//две подряд секции или если стиль определен
{
//две подряд секции или если стиль определен
и в заголовки нельзя пихать !!!
CP_XML_NODE
(
L"w:pPr"
)
{
CP_XML_STREAM
()
<<
get_section_context
().
dump_
;
...
...
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
View file @
1766dc9c
...
...
@@ -333,9 +333,15 @@ public:
}
void
remove_section
()
{
if
(
!
sections_
.
empty
())
if
(
sections_
.
empty
())
return
;
sections_
.
erase
(
sections_
.
begin
(),
sections_
.
begin
()
+
1
);
if
(
sections_
.
empty
())
{
sections_
.
erase
(
sections_
.
begin
(),
sections_
.
begin
()
+
1
);
//после оканчания разметки секциями и начале (возобновлении) основного раздела нужен разрыв (хотя настройки страницы могут и не поменяться)
//щас разрыв на текущей странице
//todooo проверить - может типо если следующий будет заголовок - разорвать
main_section_
.
is_dump_
=
false
;
}
}
std
::
wstring
dump_
;
...
...
@@ -495,15 +501,17 @@ public:
return
temp_stream_
;
}
void
add_element_to_run
(
std
::
wstring
parenStyleId
=
_T
(
""
));
void
finish_run
();
void
add_new_run
(
std
::
wstring
parentStyleId
=
_T
(
""
));
bool
get_run_state
()
{
return
current_run_
;
}
void
set_run_state
(
bool
Val
)
{
current_run_
=
Val
;
}
void
add_element_to_run
(
std
::
wstring
parenStyleId
=
_T
(
""
));
void
finish_run
();
void
add_new_run
(
std
::
wstring
parentStyleId
=
_T
(
""
));
bool
get_run_state
()
{
return
current_run_
;
}
void
set_run_state
(
bool
Val
)
{
current_run_
=
Val
;
}
void
start_paragraph
();
void
finish_paragraph
();
bool
get_paragraph_state
()
{
return
in_paragraph_
;
}
void
start_paragraph
(
bool
is_header
=
false
);
void
finish_paragraph
();
bool
is_paragraph_header
()
{
return
in_header_
;
}
bool
get_paragraph_state
()
{
return
in_paragraph_
;
}
void
set_paragraph_state
(
bool
Val
)
{
in_paragraph_
=
Val
;
}
std
::
wstring
add_hyperlink
(
const
std
::
wstring
&
href
,
bool
drawing
);
...
...
@@ -692,6 +700,7 @@ private:
bool
first_element_list_item_
;
bool
in_paragraph_
;
bool
in_header_
;
std
::
list
<
odf_reader
::
office_element
*>
delayed_elements_
;
...
...
ASCOfficeOdfFile/src/odf/draw_common.cpp
View file @
1766dc9c
...
...
@@ -360,7 +360,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
}
void
Compute_GraphicFill
(
const
common_draw_fill_attlist
&
props
,
const
office_element_ptr
&
style_image
,
styles_lite_container
&
styles
,
oox
::
_oox_fill
&
fill
)
void
Compute_GraphicFill
(
const
common_draw_fill_attlist
&
props
,
const
office_element_ptr
&
style_image
,
styles_lite_container
&
styles
,
oox
::
_oox_fill
&
fill
,
bool
txbx
)
{
if
(
fill
.
type
<
1
)
fill
.
type
=
0
;
...
...
@@ -395,7 +395,8 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{
fill
.
solid
=
oox
::
oox_solid_fill
::
create
();
fill
.
solid
->
color
=
props
.
draw_fill_color_
->
get_hex_value
();
if
(
fill
.
type
==
0
)
fill
.
type
=
1
;
//в этом случае тип может и не быть задан явно
if
(
fill
.
type
==
0
&&
!
txbx
)
fill
.
type
=
1
;
//в этом случае тип может и не быть задан явно
}
if
(
props
.
draw_fill_image_name_
)
...
...
ASCOfficeOdfFile/src/odf/draw_common.h
View file @
1766dc9c
...
...
@@ -73,7 +73,7 @@ int Compute_BorderWidth(const graphic_format_properties & graphicProperties, Bor
int
GetMargin
(
const
graphic_format_properties
&
graphicProperties
,
BorderSide
borderSide
);
//emu
void
Compute_GraphicFill
(
const
odf_types
::
common_draw_fill_attlist
&
props
,
const
office_element_ptr
&
style_image
,
styles_lite_container
&
styles
,
oox
::
_oox_fill
&
fill
);
const
office_element_ptr
&
style_image
,
styles_lite_container
&
styles
,
oox
::
_oox_fill
&
fill
,
bool
txbx
=
false
);
typedef
double
double_4
[
4
];
bool
parse_clipping
(
std
::
wstring
strClipping
,
std
::
wstring
fileName
,
double_4
&
clip_rect
,
CApplicationFonts
*
appFonts
);
...
...
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
1766dc9c
...
...
@@ -855,7 +855,9 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
//////////////////////////////////////////////
graphicProperties
.
apply_to
(
drawing
.
additional
);
//////////////////////////////////////////
Compute_GraphicFill
(
graphicProperties
.
common_draw_fill_attlist_
,
graphicProperties
.
style_background_image_
,
Context
.
root
()
->
odf_context
().
drawStyles
()
,
drawing
.
fill
);
bool
bTxbx
=
(
drawing
.
sub_type
==
1
);
Compute_GraphicFill
(
graphicProperties
.
common_draw_fill_attlist_
,
graphicProperties
.
style_background_image_
,
Context
.
root
()
->
odf_context
().
drawStyles
()
,
drawing
.
fill
,
bTxbx
);
if
((
drawing
.
fill
.
bitmap
)
&&
(
drawing
.
fill
.
bitmap
->
rId
.
length
()
<
1
))
{
...
...
ASCOfficeOdfFile/src/odf/odf_document_impl.cpp
View file @
1766dc9c
...
...
@@ -578,7 +578,7 @@ void odf_document::Impl::parse_styles()
continue
;
}
if
(
styleInst
->
style_master_page_name_
&&
!
styleInst
->
style_master_page_name_
->
empty
()
)
if
(
styleInst
->
style_master_page_name_
/* && !styleInst->style_master_page_name_->empty()*/
)
context_
->
styleContainer
().
add_master_page_name
(
styleInst
->
style_name_
,
*
styleInst
->
style_master_page_name_
);
context_
->
styleContainer
().
add_style
(
styleInst
->
style_name_
,
...
...
ASCOfficeOdfFile/src/odf/odfcontext.cpp
View file @
1766dc9c
...
...
@@ -292,12 +292,14 @@ void presentation_masters_instance::add_layout_to(const std::wstring & master_na
}
}
const
std
::
wstring
styles_container
::
master_page_name_by_name
(
const
std
::
wstring
&
StyleName
)
const
const
_CP_OPT
(
std
::
wstring
)
styles_container
::
master_page_name_by_name
(
const
std
::
wstring
&
StyleName
)
const
{
_CP_OPT
(
std
::
wstring
)
master_page
;
map_wstring_wstring
::
const_iterator
res
=
master_page_name_
.
find
(
StyleName
);
if
(
res
!=
master_page_name_
.
end
())
return
res
->
second
;
return
L""
;
master_page
=
res
->
second
;
return
master_page
;
}
style_instance
*
styles_container
::
style_default_by_type
(
style_family
::
type
Type
)
const
...
...
ASCOfficeOdfFile/src/odf/odfcontext.h
View file @
1766dc9c
...
...
@@ -156,7 +156,7 @@ public:
style_instance
*
style_default_by_type
(
odf_types
::
style_family
::
type
Type
)
const
;
const
std
::
wstring
master_page_name_by_name
(
const
std
::
wstring
&
StyleName
)
const
;
const
_CP_OPT
(
std
::
wstring
)
master_page_name_by_name
(
const
std
::
wstring
&
StyleName
)
const
;
instances_array
&
instances
()
{
return
instances_
;
}
...
...
ASCOfficeOdfFile/src/odf/styles.cpp
View file @
1766dc9c
...
...
@@ -325,21 +325,21 @@ const wchar_t * draw_gradient::name = L"gradient";
void
draw_gradient
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"draw:name"
,
draw_name_
);
CP_APPLY_ATTR
(
L"draw:display-name"
,
draw_display_name_
);
CP_APPLY_ATTR
(
L"draw:name"
,
draw_name_
);
CP_APPLY_ATTR
(
L"draw:display-name"
,
draw_display_name_
);
CP_APPLY_ATTR
(
L"draw:start-color"
,
draw_start_color_
);
CP_APPLY_ATTR
(
L"draw:end-color"
,
draw_end_color_
);
CP_APPLY_ATTR
(
L"draw:start-color"
,
draw_start_color_
);
CP_APPLY_ATTR
(
L"draw:end-color"
,
draw_end_color_
);
CP_APPLY_ATTR
(
L"draw:end-intensity"
,
draw_end_intensity_
);
CP_APPLY_ATTR
(
L"draw:start-intensity"
,
draw_start_intensity_
);
CP_APPLY_ATTR
(
L"draw:end-intensity"
,
draw_end_intensity_
);
CP_APPLY_ATTR
(
L"draw:start-intensity"
,
draw_start_intensity_
);
CP_APPLY_ATTR
(
L"draw:cy"
,
draw_cy_
);
//%
CP_APPLY_ATTR
(
L"draw:cx"
,
draw_cx_
);
CP_APPLY_ATTR
(
L"draw:cy"
,
draw_cy_
);
//%
CP_APPLY_ATTR
(
L"draw:cx"
,
draw_cx_
);
CP_APPLY_ATTR
(
L"draw:border"
,
draw_border_
);
CP_APPLY_ATTR
(
L"draw:angle"
,
draw_angle_
);
CP_APPLY_ATTR
(
L"draw:style"
,
draw_style_
);
//"square"
CP_APPLY_ATTR
(
L"draw:border"
,
draw_border_
);
CP_APPLY_ATTR
(
L"draw:angle"
,
draw_angle_
);
CP_APPLY_ATTR
(
L"draw:style"
,
draw_style_
);
//"square"
}
...
...
@@ -400,17 +400,25 @@ const wchar_t * style::name = L"style";
void
style
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"style:name"
,
style_name_
,
std
::
wstring
(
L""
));
CP_APPLY_ATTR
(
L"style:display-name"
,
style_display_name_
);
CP_APPLY_ATTR
(
L"style:family"
,
style_family_
,
style_family
());
CP_APPLY_ATTR
(
L"style:parent-style-name"
,
style_parent_style_name_
);
CP_APPLY_ATTR
(
L"style:next-style-name"
,
style_next_style_name_
);
CP_APPLY_ATTR
(
L"style:list-style-name"
,
style_list_style_name_
);
CP_APPLY_ATTR
(
L"style:master-page-name"
,
style_master_page_name_
);
CP_APPLY_ATTR
(
L"style:auto-update"
,
style_auto_update_
,
false
);
CP_APPLY_ATTR
(
L"style:data-style-name"
,
style_data_style_name_
);
CP_APPLY_ATTR
(
L"style:class"
,
style_class_
);
CP_APPLY_ATTR
(
L"style:name"
,
style_name_
,
std
::
wstring
(
L""
));
CP_APPLY_ATTR
(
L"style:display-name"
,
style_display_name_
);
CP_APPLY_ATTR
(
L"style:family"
,
style_family_
,
style_family
());
CP_APPLY_ATTR
(
L"style:parent-style-name"
,
style_parent_style_name_
);
CP_APPLY_ATTR
(
L"style:next-style-name"
,
style_next_style_name_
);
CP_APPLY_ATTR
(
L"style:list-style-name"
,
style_list_style_name_
);
CP_APPLY_ATTR
(
L"style:master-page-name"
,
style_master_page_name_
);
CP_APPLY_ATTR
(
L"style:auto-update"
,
style_auto_update_
,
false
);
CP_APPLY_ATTR
(
L"style:data-style-name"
,
style_data_style_name_
);
CP_APPLY_ATTR
(
L"style:class"
,
style_class_
);
CP_APPLY_ATTR
(
L"style:default-outline-level"
,
style_default_outline_level_
);
//было int .. error
if
(
style_master_page_name_
)
{
if
(
style_master_page_name_
->
empty
())
{
style_master_page_name_
.
reset
();
}
}
}
void
style
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
...
...
@@ -1255,7 +1263,7 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
CP_XML_NODE
(
L"w:sectPr"
)
{
Context
.
process_section
(
CP_XML_STREAM
(),
columns
);
CP_XML_NODE
(
L"w:type"
)
{
if
(
Context
.
is_next_dump_page_properties
())
...
...
@@ -1267,7 +1275,7 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
}
}
std
::
wstring
masterPageName
=
Context
.
get_master_page_name
();
//выдавался последний по document.xml!!!
std
::
wstring
masterPageName
=
Context
.
get_master_page_name
();
bool
res
=
Context
.
get_headers_footers
().
write_sectPr
(
masterPageName
,
strm
);
if
(
res
==
false
)
{
...
...
ASCOfficeOdfFile/src/odf/styles.h
View file @
1766dc9c
...
...
@@ -307,8 +307,8 @@ private:
private:
// attr
std
::
wstring
style_name_
;
bool
style_auto_update_
;
// default = false
std
::
wstring
style_name_
;
bool
style_auto_update_
;
// default = false
_CP_OPT
(
std
::
wstring
)
style_display_name_
;
odf_types
::
style_family
style_family_
;
...
...
@@ -319,7 +319,8 @@ private:
_CP_OPT
(
std
::
wstring
)
style_master_page_name_
;
_CP_OPT
(
std
::
wstring
)
style_data_style_name_
;
_CP_OPT
(
std
::
wstring
)
style_class_
;
_CP_OPT
(
std
::
wstring
)
style_default_outline_level_
;
_CP_OPT
(
std
::
wstring
)
style_default_outline_level_
;
private:
style_content
style_content_
;
office_element_ptr_array
style_map_
;
...
...
ASCOfficeOdfFile/src/odf/text_content.h
View file @
1766dc9c
...
...
@@ -63,11 +63,12 @@ class paragraph_attrs
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
odf_types
::
style_ref
text_style_name_
;
odf_types
::
style_ref_array
text_class_names_
;
odf_types
::
style_ref
text_cond_style_name_
;
_CP_OPT
(
unsigned
int
)
outline_level_
;
//from header attr
};
...
...
ASCOfficeOdfFile/src/odf/text_elements.cpp
View file @
1766dc9c
...
...
@@ -185,42 +185,52 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
else
{
const
std
::
wstring
id
=
Context
.
styles_map_
.
get
(
styleInst
->
name
(),
styleInst
->
type
()
);
std
::
wostream
&
_Wostream
=
Context
.
output_stream
();
_Wostream
<<
L"<w:pPr>"
;
if
(
!
Context
.
get_table_context
().
in_table
())
{
_Wostream
<<
Context
.
get_section_context
().
dump_
;
Context
.
get_section_context
().
dump_
.
clear
();
}
_Wostream
<<
L"<w:pStyle w:val=
\"
"
<<
id
<<
L"
\"
/>"
;
Context
.
docx_serialize_list_properties
(
_Wostream
);
_Wostream
<<
L"</w:pPr>"
;
Context
.
output_stream
()
<<
L"<w:pPr>"
;
//todooo причесать
if
(
Context
.
is_paragraph_header
()
&&
!
Context
.
get_section_context
().
dump_
.
empty
())
{
Context
.
output_stream
()
<<
Context
.
get_section_context
().
dump_
;
Context
.
get_section_context
().
dump_
.
clear
();
Context
.
output_stream
()
<<
L"</w:pPr>"
;
Context
.
finish_paragraph
();
Context
.
start_paragraph
();
Context
.
output_stream
()
<<
L"<w:pPr>"
;
}
else
if
(
!
Context
.
get_table_context
().
in_table
())
{
Context
.
output_stream
()
<<
Context
.
get_section_context
().
dump_
;
Context
.
get_section_context
().
dump_
.
clear
();
}
Context
.
output_stream
()
<<
L"<w:pStyle w:val=
\"
"
<<
id
<<
L"
\"
/>"
;
Context
.
docx_serialize_list_properties
(
Context
.
output_stream
());
if
((
Attr
.
outline_level_
)
&&
(
*
Attr
.
outline_level_
>
0
))
{
Context
.
output_stream
()
<<
L"<w:outlineLvl w:val=
\"
"
<<
*
Attr
.
outline_level_
-
1
<<
L"
\"
/>"
;
}
Context
.
output_stream
()
<<
L"</w:pPr>"
;
return
2
;
}
}
else
if
(
!
Context
.
get_section_context
().
dump_
.
empty
()
&&
!
Context
.
get_table_context
().
in_table
())
{
Context
.
output_stream
()
<<
L"<w:pPr>"
;
Context
.
output_stream
()
<<
Context
.
get_section_context
().
dump_
;
Context
.
get_section_context
().
dump_
.
clear
();
Context
.
output_stream
()
<<
L"</w:pPr>"
;
}
return
3
;
}
else
if
(
!
Context
.
get_section_context
().
dump_
.
empty
()
&&
!
Context
.
get_table_context
().
in_table
())
}
if
(
!
Context
.
get_section_context
().
dump_
.
empty
()
&&
!
Context
.
get_table_context
().
in_table
())
{
Context
.
output_stream
()
<<
L"<w:pPr>"
;
Context
.
output_stream
()
<<
Context
.
get_section_context
().
dump_
;
Context
.
get_section_context
().
dump_
.
clear
();
Context
.
output_stream
()
<<
L"</w:pPr>"
;
//todooo выяснить реальны ли заголовки без стилей и свойств
Context
.
output_stream
()
<<
L"</w:pPr>"
;
return
3
;
}
return
0
;
}
}
::
std
::
wostream
&
paragraph
::
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
std
::
wostream
&
paragraph
::
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
{
// TODO!!!!
CP_SERIALIZE_TEXT
(
paragraph_content_
);
...
...
@@ -348,7 +358,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
bool
is_empty
=
paragraph_content_
.
size
()
==
0
;
Context
.
start_paragraph
();
Context
.
start_paragraph
(
is_header_
);
std
::
wostream
&
_Wostream
=
Context
.
output_stream
();
...
...
@@ -358,10 +368,10 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
// если да — устанавливаем контексту флаг на то что необходимо в конце текущего параграфа
// распечатать свойства секции
//проверить ... не она ли основная - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
const
std
::
wstring
&
styleName
=
next_par_
->
paragraph_attrs_
.
text_style_name_
.
style_name
();
const
std
::
wstring
masterPageName
=
Context
.
root
()
->
odf_context
().
styleContainer
().
master_page_name_by_name
(
styleName
);
const
std
::
wstring
&
next_styleName
=
next_par_
->
paragraph_attrs_
.
text_style_name_
.
style_name
();
const
_CP_OPT
(
std
::
wstring
)
next_masterPageName
=
Context
.
root
()
->
odf_context
().
styleContainer
().
master_page_name_by_name
(
next_
styleName
);
if
(
!
masterPageName
.
empty
()
&&
Context
.
get_master_page_name
()
!=
masterPageName
)
if
(
(
next_masterPageName
)
&&
(
Context
.
get_master_page_name
()
!=
*
next_masterPageName
)
)
{
Context
.
next_dump_page_properties
(
true
);
is_empty
=
false
;
...
...
@@ -374,13 +384,13 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
}
const
std
::
wstring
&
styleName
=
paragraph_attrs_
.
text_style_name_
.
style_name
();
const
std
::
wstring
masterPageName
=
Context
.
root
()
->
odf_context
().
styleContainer
().
master_page_name_by_name
(
styleName
);
const
_CP_OPT
(
std
::
wstring
)
masterPageName
=
Context
.
root
()
->
odf_context
().
styleContainer
().
master_page_name_by_name
(
styleName
);
if
(
!
masterPageName
.
empty
()
)
if
(
masterPageName
)
{
Context
.
set_master_page_name
(
masterPageName
);
Context
.
set_master_page_name
(
*
masterPageName
);
const
std
::
wstring
masterPageNameLayout
=
Context
.
root
()
->
odf_context
().
pageLayoutContainer
().
page_layout_name_by_style
(
masterPageName
);
const
std
::
wstring
masterPageNameLayout
=
Context
.
root
()
->
odf_context
().
pageLayoutContainer
().
page_layout_name_by_style
(
*
masterPageName
);
Context
.
remove_page_properties
();
Context
.
add_page_properties
(
masterPageNameLayout
);
...
...
@@ -496,17 +506,17 @@ void soft_page_break::docx_convert(oox::docx_conversion_context & Context)
return
paragraph_
.
text_to_stream
(
_Wostream
);
}
h
::
h
()
:
text_outline_level_
(
1
),
text_restart_numbering_
(
false
),
text_is_list_header_
(
false
)
{}
void
h
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"text:outline-level"
,
text_outline_level_
,
(
unsigned
int
)
1
);
CP_APPLY_ATTR
(
L"text:restart-numbering"
,
text_restart_numbering_
,
false
);
CP_APPLY_ATTR
(
L"text:start-value"
,
text_start_value_
);
CP_APPLY_ATTR
(
L"text:is-list-header"
,
text_is_list_header_
,
false
);
CP_APPLY_ATTR
(
L"text:outline-level"
,
text_outline_level_
);
CP_APPLY_ATTR
(
L"text:restart-numbering"
,
text_restart_numbering_
);
CP_APPLY_ATTR
(
L"text:start-value"
,
text_start_value_
);
CP_APPLY_ATTR
(
L"text:is-list-header"
,
text_is_list_header_
);
paragraph_
.
add_attributes
(
Attributes
);
paragraph_
.
is_header_
=
true
;
paragraph_
.
paragraph_attrs_
.
outline_level_
=
text_outline_level_
;
}
void
h
::
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
...
...
ASCOfficeOdfFile/src/odf/text_elements.h
View file @
1766dc9c
...
...
@@ -52,17 +52,18 @@ namespace text {
class
paragraph
{
public:
paragraph
()
:
next_par_
(
NULL
),
next_section_
(
false
),
next_end_section_
(
false
)
{}
paragraph
()
:
next_par_
(
NULL
),
next_section_
(
false
),
next_end_section_
(
false
)
,
is_header_
(
false
)
{}
public:
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
,
document_context
*
Context
);
void
add_text
(
const
std
::
wstring
&
Text
);
paragraph
*
get_next
()
{
return
next_par_
;
}
void
set_next
(
paragraph
*
next
)
{
next_par_
=
next
;}
void
set_next_section
(
bool
Val
)
void
set_next_section
(
bool
Val
)
{
next_section_
=
Val
;
}
...
...
@@ -82,14 +83,21 @@ public:
private:
void
drop_cap_text_docx_convert
(
office_element_ptr
first_text_paragraph
,
oox
::
docx_conversion_context
&
Context
);
paragraph_attrs
paragraph_attrs_
;
paragraph_attrs
paragraph_attrs_
;
office_element_ptr_array
paragraph_content_
;
paragraph
*
next_par_
;
bool
next_section_
;
bool
next_end_section_
;
bool
is_header_
;
office_element_ptr_array
paragraph_content_
;
paragraph
*
next_par_
;
bool
next_section_
;
bool
next_end_section_
;
friend
class
par_docx_convert_class
;
friend
class
p
;
friend
class
h
;
};
// text:h
...
...
@@ -103,31 +111,25 @@ public:
static
const
ElementType
type
=
typeTextH
;
CPDOCCORE_DEFINE_VISITABLE
();
public:
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
;
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
;
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
virtual
void
afterCreate
();
virtual
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
public:
h
();
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
private:
// heading-attrs
unsigned
int
text_outline_level_
;
bool
text_restart_numbering_
;
// default false
_CP_OPT
(
unsigned
int
)
text_start_value_
;
bool
text_is_list_header_
;
// default false
_CP_OPT
(
std
::
wstring
)
text_number_
;
_CP_OPT
(
unsigned
int
)
text_outline_level_
;
_CP_OPT
(
bool
)
text_restart_numbering_
;
_CP_OPT
(
unsigned
int
)
text_start_value_
;
_CP_OPT
(
bool
)
text_is_list_header_
;
_CP_OPT
(
std
::
wstring
)
text_number_
;
paragraph
paragraph_
;
...
...
@@ -148,17 +150,14 @@ public:
static
const
ElementType
type
=
typeTextP
;
CPDOCCORE_DEFINE_VISITABLE
();
public:
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
;
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
;
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
virtual
void
afterCreate
();
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
virtual
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
public:
p
(){};
paragraph
paragraph_
;
...
...
@@ -166,9 +165,8 @@ private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
private:
friend
class
par_docx_convert_class
;
friend
class
par_docx_convert_class
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
p
);
...
...
@@ -221,8 +219,7 @@ public:
static
const
ElementType
type
=
typeTextSoftPageBreak
;
CPDOCCORE_DEFINE_VISITABLE
();
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
virtual
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
private:
...
...
@@ -238,7 +235,6 @@ class text_section_attr
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
_CP_OPT
(
odf_types
::
style_ref
)
text_style_name_
;
std
::
wstring
text_name_
;
_CP_OPT
(
bool
)
text_protected_
;
...
...
@@ -262,7 +258,6 @@ public:
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
//void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
virtual
void
afterCreate
();
virtual
void
afterReadContent
();
...
...
@@ -271,7 +266,6 @@ 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
);
private:
text_section_attr
text_section_attr_
;
office_element_ptr
text_section_source_
;
office_element_ptr_array
text_content_
;
...
...
@@ -310,7 +304,6 @@ 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
);
private:
text_section_source_attr
text_section_source_attr_
;
};
...
...
@@ -332,8 +325,8 @@ public:
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
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
);
...
...
@@ -362,8 +355,8 @@ public:
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
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
);
...
...
@@ -392,8 +385,8 @@ public:
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
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
);
...
...
@@ -422,8 +415,7 @@ public:
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
virtual
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
...
...
@@ -451,8 +443,8 @@ public:
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
public:
virtual
::
std
::
wostream
&
text_to_stream
(
::
std
::
wostream
&
_Wostream
)
const
;
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
);
...
...
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