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
0b15c314
Commit
0b15c314
authored
Aug 07, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug #35485
parent
44fdbf6d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
145 additions
and
111 deletions
+145
-111
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
+5
-5
ASCOfficeOdfFile/src/odf/table.cpp
ASCOfficeOdfFile/src/odf/table.cpp
+44
-9
ASCOfficeOdfFile/src/odf/table.h
ASCOfficeOdfFile/src/odf/table.h
+13
-35
ASCOfficeOdfFile/src/odf/table_docx.cpp
ASCOfficeOdfFile/src/odf/table_docx.cpp
+14
-14
ASCOfficeOdfFile/src/odf/table_pptx.cpp
ASCOfficeOdfFile/src/odf/table_pptx.cpp
+15
-15
ASCOfficeOdfFile/src/odf/table_xlsx.cpp
ASCOfficeOdfFile/src/odf/table_xlsx.cpp
+54
-33
No files found.
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
View file @
0b15c314
...
...
@@ -837,7 +837,7 @@ void process_build_object::visit(table_table_rows& val)
}
void
process_build_object
::
visit
(
const
table_table_row
&
val
)
{
unsigned
int
repeated
=
val
.
table_table_row_
attlist_
.
table_number_rows_repeated_
;
unsigned
int
repeated
=
val
.
attlist_
.
table_number_rows_repeated_
;
ACCEPT_ALL_CONTENT_CONST
(
val
.
content_
);
visit_rows
(
repeated
);
}
...
...
@@ -891,13 +891,13 @@ void process_build_object::visit(const table_rows_no_group& val)
}
void
process_build_object
::
visit
(
const
table_table_cell
&
val
)
{
const
table_table_cell_attlist
&
attlist
=
val
.
table_table_cell_
attlist_
;
const
table_table_cell_attlist
&
attlist
=
val
.
attlist_
;
unsigned
int
repeated
=
val
.
table_table_cell_
attlist_
.
table_number_columns_repeated_
;
unsigned
int
repeated
=
val
.
attlist_
.
table_number_columns_repeated_
;
std
::
wstringstream
wstream_temp
;
val
.
table_table_cell_
content_
.
text_to_stream
(
wstream_temp
);
val
.
content_
.
text_to_stream
(
wstream_temp
);
std
::
wstring
cell_cash
=
wstream_temp
.
str
();
std
::
wstring
cell_val
;
...
...
@@ -920,7 +920,7 @@ void process_build_object::visit(const table_table_cell& val)
}
void
process_build_object
::
visit
(
const
table_covered_table_cell
&
val
)
{
unsigned
int
repeated
=
val
.
table_table_cell_
attlist_
.
table_number_columns_repeated_
;
unsigned
int
repeated
=
val
.
attlist_
.
table_number_columns_repeated_
;
if
(
repeated
<
2
)
return
;
...
...
ASCOfficeOdfFile/src/odf/table.cpp
View file @
0b15c314
...
...
@@ -376,18 +376,18 @@ const wchar_t * table_table_cell::name = L"table-cell";
std
::
wostream
&
table_table_cell
::
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
{
return
table_table_cell_
content_
.
text_to_stream
(
_Wostream
);
return
content_
.
text_to_stream
(
_Wostream
);
}
void
table_table_cell
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
table_table_cell_
attlist_
.
add_attributes
(
Attributes
);
table_table_cell_
attlist_extra_
.
add_attributes
(
Attributes
);
attlist_
.
add_attributes
(
Attributes
);
attlist_extra_
.
add_attributes
(
Attributes
);
}
void
table_table_cell
::
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
)
{
table_table_cell_
content_
.
add_child_element
(
Reader
,
Ns
,
Name
,
getContext
());
content_
.
add_child_element
(
Reader
,
Ns
,
Name
,
getContext
());
}
void
table_table_cell
::
add_text
(
const
std
::
wstring
&
Text
)
...
...
@@ -402,18 +402,18 @@ const wchar_t * table_covered_table_cell::name = L"covered-table-cell";
std
::
wostream
&
table_covered_table_cell
::
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
{
return
table_table_cell_
content_
.
text_to_stream
(
_Wostream
);
return
content_
.
text_to_stream
(
_Wostream
);
}
void
table_covered_table_cell
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
table_table_cell_
attlist_
.
add_attributes
(
Attributes
);
attlist_
.
add_attributes
(
Attributes
);
}
void
table_covered_table_cell
::
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
)
{
empty_
=
false
;
table_table_cell_
content_
.
add_child_element
(
Reader
,
Ns
,
Name
,
getContext
());
content_
.
add_child_element
(
Reader
,
Ns
,
Name
,
getContext
());
}
void
table_covered_table_cell
::
add_text
(
const
std
::
wstring
&
Text
)
...
...
@@ -432,7 +432,7 @@ std::wostream & table_table_row::text_to_stream(std::wostream & _Wostream) const
void
table_table_row
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
table_table_row_
attlist_
.
add_attributes
(
Attributes
);
attlist_
.
add_attributes
(
Attributes
);
}
void
table_table_row
::
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
)
...
...
@@ -519,6 +519,42 @@ void table_rows::add_child_element( xml::sax * Reader, const std::wstring & Ns,
not_applicable_element
(
L"table-rows"
,
Reader
,
Ns
,
Name
);
}
}
void
table_rows
::
remove_equals_empty
()
{
if
(
table_table_row_
.
empty
())
return
;
while
(
true
)
{
size_t
i
=
table_table_row_
.
size
()
-
1
;
if
(
i
==
0
)
break
;
if
(
table_table_row_
[
i
]
->
get_type
()
!=
typeTableTableRow
)
break
;
if
(
table_table_row_
[
i
-
1
]
->
get_type
()
!=
typeTableTableRow
)
break
;
table_table_row
*
prev
=
dynamic_cast
<
table_table_row
*>
(
table_table_row_
[
i
-
1
].
get
());
table_table_row
*
next
=
dynamic_cast
<
table_table_row
*>
(
table_table_row_
[
i
].
get
());
if
(
prev
->
content_
.
size
()
>
1
||
next
->
content_
.
size
()
>
1
)
break
;
if
(
prev
->
attlist_
.
table_style_name_
.
get_value_or
(
L""
)
!=
next
->
attlist_
.
table_style_name_
.
get_value_or
(
L""
))
break
;
table_table_cell
*
prev_cell
=
dynamic_cast
<
table_table_cell
*>
(
prev
->
content_
[
0
].
get
());
table_table_cell
*
next_cell
=
dynamic_cast
<
table_table_cell
*>
(
next
->
content_
[
0
].
get
());
if
(
!
prev_cell
||
!
next_cell
)
break
;
if
(
!
prev_cell
->
content_
.
elements_
.
empty
()
||
!
next_cell
->
content_
.
elements_
.
empty
())
break
;
if
(
prev_cell
->
attlist_
.
table_style_name_
.
get_value_or
(
L""
)
!=
next_cell
->
attlist_
.
table_style_name_
.
get_value_or
(
L""
))
break
;
prev
->
attlist_
.
table_number_rows_repeated_
+=
next
->
attlist_
.
table_number_rows_repeated_
;
table_table_row_
.
pop_back
();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// table:rows-no-group
...
...
@@ -561,7 +597,6 @@ void table_rows_no_group::add_child_element( xml::sax * Reader, const std::wstri
else
not_applicable_element
(
L"table-rows-no-group"
,
Reader
,
Ns
,
Name
);
}
// table-rows-and-groups
//////////////////////////////////////////////////////////////////////////////////////////////////
...
...
ASCOfficeOdfFile/src/odf/table.h
View file @
0b15c314
...
...
@@ -57,7 +57,6 @@ class table_table_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
_CP_OPT
(
bool
)
table_is_sub_table_
;
_CP_OPT
(
std
::
wstring
)
table_name_
;
_CP_OPT
(
std
::
wstring
)
table_style_name_
;
...
...
@@ -82,7 +81,6 @@ class table_table_row_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
unsigned
int
table_number_rows_repeated_
;
// default 1
_CP_OPT
(
std
::
wstring
)
table_style_name_
;
_CP_OPT
(
std
::
wstring
)
table_default_cell_style_name_
;
...
...
@@ -96,7 +94,6 @@ class table_table_cell_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
unsigned
int
table_number_columns_repeated_
;
// default 1
_CP_OPT
(
std
::
wstring
)
table_style_name_
;
_CP_OPT
(
std
::
wstring
)
table_content_validation_name_
;
...
...
@@ -104,7 +101,6 @@ public:
odf_types
::
common_value_and_type_attlist
common_value_and_type_attlist_
;
bool
table_protect_
;
// default false
};
...
...
@@ -115,7 +111,6 @@ class table_table_cell_attlist_extra
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
unsigned
int
table_number_columns_spanned_
;
// default 1
unsigned
int
table_number_rows_spanned_
;
// default 1
...
...
@@ -130,7 +125,6 @@ class table_table_source_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
odf_types
::
table_mode
table_mode_
;
// default CopyAll
_CP_OPT
(
std
::
wstring
)
table_table_name_
;
...
...
@@ -142,7 +136,6 @@ class table_linked_source_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
odf_types
::
common_xlink_attlist
common_xlink_attlist_
;
_CP_OPT
(
std
::
wstring
)
table_filter_name_
;
...
...
@@ -182,7 +175,6 @@ public:
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
office_element_ptr
table_table_columns_
;
office_element_ptr_array
table_table_column_
;
...
...
@@ -204,7 +196,6 @@ public:
CPDOCCORE_DEFINE_VISITABLE
();
public:
table_columns_no_group
();
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
,
document_context
*
Context
);
...
...
@@ -214,13 +205,11 @@ public:
static
_CP_PTR
(
table_columns_no_group
)
create
();
public:
table_columns
table_columns_1_
;
bool
was_header_
;
office_element_ptr
table_table_header_columns_
;
table_columns
table_columns_2_
;
table_columns
table_columns_2_
;
};
// table:columns-and-groups
...
...
@@ -234,7 +223,6 @@ public:
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
public:
// office_element_ptr table_table_column_group_;
// table_columns_no_group table_columns_no_group_;
...
...
@@ -248,7 +236,6 @@ class table_table_column_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
unsigned
int
table_number_columns_repeated_
;
// default 1
_CP_OPT
(
std
::
wstring
)
table_style_name_
;
odf_types
::
table_visibility
table_visibility_
;
// default Visible
...
...
@@ -340,7 +327,6 @@ class table_table_column_group_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
private:
bool
table_display_
;
// default true
};
...
...
@@ -390,7 +376,6 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
private:
...
...
@@ -398,7 +383,7 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
public:
table_table_row_attlist
table_table_row_
attlist_
;
table_table_row_attlist
attlist_
;
office_element_ptr_array
content_
;
// table-table-cell or table-covered-table-cell
};
...
...
@@ -417,8 +402,8 @@ public:
bool
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
office_element_ptr_array
elements_
;
private:
// TODO table-cell-range-source
// TODO table-cell-range-source
// TODO table-detective
};
...
...
@@ -440,7 +425,6 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
;
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
private:
...
...
@@ -451,9 +435,9 @@ private:
public:
bool
last_cell_
;
table_table_cell_attlist
table_table_cell_
attlist_
;
table_table_cell_attlist_extra
table_table_cell_
attlist_extra_
;
table_table_cell_content
table_table_cell_
content_
;
table_table_cell_attlist
attlist_
;
table_table_cell_attlist_extra
attlist_extra_
;
table_table_cell_content
content_
;
};
...
...
@@ -476,7 +460,6 @@ public:
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
;
public:
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
private:
...
...
@@ -489,8 +472,8 @@ public:
bool
last_cell_
;
bool
empty_
;
table_table_cell_attlist
table_table_cell_
attlist_
;
table_table_cell_content
table_table_cell_
content_
;
table_table_cell_attlist
attlist_
;
table_table_cell_content
content_
;
};
...
...
@@ -514,7 +497,6 @@ public:
table_table_rows
()
{
}
public:
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
private:
...
...
@@ -543,7 +525,6 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
;
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
private:
...
...
@@ -569,10 +550,10 @@ public:
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
office_element_ptr
table_table_rows_
;
office_element_ptr_array
table_table_row_
;
void
remove_equals_empty
();
};
// table:rows-no-group
...
...
@@ -593,8 +574,8 @@ public:
CPDOCCORE_DEFINE_VISITABLE
();
public:
table_rows_no_group
();
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
,
document_context
*
Context
);
...
...
@@ -602,7 +583,6 @@ public:
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
public:
bool
was_header_
;
table_rows
table_rows_1_
;
...
...
@@ -617,15 +597,13 @@ class table_rows_and_groups
public:
table_rows_and_groups
();
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
,
document_context
*
Context
);
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
,
document_context
*
Context
);
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
int
get_count
(){
return
content_
.
size
();}
//временно .. для группировок
public:
office_element_ptr_array
content_
;
//int type_;
//office_element_ptr table_table_row_group_;
...
...
ASCOfficeOdfFile/src/odf/table_docx.cpp
View file @
0b15c314
...
...
@@ -67,10 +67,10 @@ void table_table_row::docx_convert(oox::docx_conversion_context & Context)
{
std
::
wostream
&
_Wostream
=
Context
.
output_stream
();
const
std
::
wstring
styleName
=
table_table_row_
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
defaultCellStyle
=
table_table_row_
attlist_
.
table_default_cell_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
styleName
=
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
defaultCellStyle
=
attlist_
.
table_default_cell_style_name_
.
get_value_or
(
L""
);
for
(
unsigned
int
i
=
0
;
i
<
table_table_row_
attlist_
.
table_number_rows_repeated_
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
attlist_
.
table_number_rows_repeated_
;
++
i
)
{
_Wostream
<<
L"<w:tr>"
;
const
style_instance
*
inst
=
...
...
@@ -259,7 +259,7 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
{
std
::
wostream
&
_Wostream
=
Context
.
output_stream
();
for
(
unsigned
int
r
=
0
;
r
<
table_table_cell_
attlist_
.
table_number_columns_repeated_
;
++
r
)
for
(
unsigned
int
r
=
0
;
r
<
attlist_
.
table_number_columns_repeated_
;
++
r
)
{
int
pushTextPropCount
=
0
;
...
...
@@ -267,24 +267,24 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
_Wostream
<<
L"<w:tc>"
;
_Wostream
<<
L"<w:tcPr>"
;
const
std
::
wstring
styleName
=
table_table_cell_
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
styleName
=
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
//_Wostream << L"<w:tcW w:w=\"0\" w:type=\"auto\" />";
if
(
table_table_cell_
attlist_extra_
.
table_number_rows_spanned_
>
1
)
if
(
attlist_extra_
.
table_number_rows_spanned_
>
1
)
{
_Wostream
<<
L"<w:vMerge w:val=
\"
restart
\"
/>"
;
Context
.
get_table_context
().
set_rows_spanned
(
Context
.
get_table_context
().
current_column
(),
table_table_cell_
attlist_extra_
.
table_number_rows_spanned_
-
1
,
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
-
1
,
attlist_extra_
.
table_number_rows_spanned_
-
1
,
attlist_extra_
.
table_number_columns_spanned_
-
1
,
styleName
);
}
if
(
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
>
1
)
if
(
attlist_extra_
.
table_number_columns_spanned_
>
1
)
{
_Wostream
<<
L"<w:gridSpan w:val=
\"
"
<<
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
<<
"
\"
/>"
;
Context
.
get_table_context
().
set_columns_spanned
(
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
-
1
);
_Wostream
<<
L"<w:gridSpan w:val=
\"
"
<<
attlist_extra_
.
table_number_columns_spanned_
<<
"
\"
/>"
;
Context
.
get_table_context
().
set_columns_spanned
(
attlist_extra_
.
table_number_columns_spanned_
-
1
);
}
const
style_instance
*
inst
=
...
...
@@ -344,7 +344,7 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
}
// если одержимое не содержит ниодного параграфа, то добавляем параграф, иначе word считает файл битым
if
(
!
table_table_cell_
content_
.
docx_convert
(
Context
))
if
(
!
content_
.
docx_convert
(
Context
))
{
_Wostream
<<
emptyPar
;
}
...
...
@@ -361,11 +361,11 @@ void table_covered_table_cell::docx_convert(oox::docx_conversion_context & Conte
{
std
::
wostream
&
_Wostream
=
Context
.
output_stream
();
for
(
unsigned
int
i
=
0
;
i
<
table_table_cell_
attlist_
.
table_number_columns_repeated_
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
attlist_
.
table_number_columns_repeated_
;
++
i
)
{
if
(
Context
.
get_table_context
().
start_covered_cell
(
Context
))
{
if
(
!
table_table_cell_
content_
.
docx_convert
(
Context
))
if
(
!
content_
.
docx_convert
(
Context
))
{
_Wostream
<<
emptyPar
;
}
...
...
ASCOfficeOdfFile/src/odf/table_pptx.cpp
View file @
0b15c314
...
...
@@ -70,10 +70,10 @@ void table_table_row::pptx_convert(oox::pptx_conversion_context & Context)
{
std
::
wostream
&
_Wostream
=
Context
.
get_table_context
().
tableData
();
const
std
::
wstring
styleName
=
table_table_row_
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
defaultCellStyle
=
table_table_row_
attlist_
.
table_default_cell_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
styleName
=
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
defaultCellStyle
=
attlist_
.
table_default_cell_style_name_
.
get_value_or
(
L""
);
for
(
unsigned
int
i
=
0
;
i
<
table_table_row_
attlist_
.
table_number_rows_repeated_
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
attlist_
.
table_number_rows_repeated_
;
++
i
)
{
int
height
=
0
;
...
...
@@ -323,7 +323,7 @@ void table_table_cell::pptx_convert(oox::pptx_conversion_context & Context)
CP_XML_WRITER
(
_Wostream
)
{
for
(
unsigned
int
r
=
0
;
r
<
table_table_cell_
attlist_
.
table_number_columns_repeated_
;
++
r
)
for
(
unsigned
int
r
=
0
;
r
<
attlist_
.
table_number_columns_repeated_
;
++
r
)
{
Context
.
get_table_context
().
start_cell
();
CP_XML_NODE
(
L"a:tc"
)
...
...
@@ -352,35 +352,35 @@ void table_table_cell::pptx_convert(oox::pptx_conversion_context & Context)
style_inst
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_by_name
(
style_name
,
style_family
::
TableCell
,
false
);
if
(
style_inst
)
style_instances
.
push_back
(
style_inst
);
}
style_name
=
table_table_cell_
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
style_name
=
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
if
(
!
style_name
.
empty
())
{
style_inst
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_by_name
(
style_name
,
style_family
::
TableCell
,
false
);
if
(
style_inst
)
style_instances
.
push_back
(
style_inst
);
}
if
(
table_table_cell_
attlist_extra_
.
table_number_rows_spanned_
>
1
)
if
(
attlist_extra_
.
table_number_rows_spanned_
>
1
)
{
CP_XML_ATTR
(
L"rowSpan"
,
table_table_cell_
attlist_extra_
.
table_number_rows_spanned_
);
CP_XML_ATTR
(
L"rowSpan"
,
attlist_extra_
.
table_number_rows_spanned_
);
CP_XML_ATTR
(
L"vMerge"
,
1
);
Context
.
get_table_context
().
set_rows_spanned
(
Context
.
get_table_context
().
current_column
(),
table_table_cell_
attlist_extra_
.
table_number_rows_spanned_
-
1
,
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
-
1
,
attlist_extra_
.
table_number_rows_spanned_
-
1
,
attlist_extra_
.
table_number_columns_spanned_
-
1
,
style_name
);
}
if
(
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
>
1
)
if
(
attlist_extra_
.
table_number_columns_spanned_
>
1
)
{
//CP_XML_ATTR(L"hMerge", true);
CP_XML_ATTR
(
L"gridSpan"
,
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
);
CP_XML_ATTR
(
L"gridSpan"
,
attlist_extra_
.
table_number_columns_spanned_
);
Context
.
get_table_context
().
set_columns_spanned
(
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
-
1
);
Context
.
get_table_context
().
set_columns_spanned
(
attlist_extra_
.
table_number_columns_spanned_
-
1
);
}
Context
.
get_text_context
().
start_object
();
bool
presentText
=
table_table_cell_
content_
.
pptx_convert
(
Context
);
bool
presentText
=
content_
.
pptx_convert
(
Context
);
std
::
wstring
cellContent
=
Context
.
get_text_context
().
end_object
();
...
...
@@ -408,11 +408,11 @@ void table_covered_table_cell::pptx_convert(oox::pptx_conversion_context & Conte
{
std
::
wostream
&
_Wostream
=
Context
.
get_table_context
().
tableData
();
for
(
unsigned
int
i
=
0
;
i
<
table_table_cell_
attlist_
.
table_number_columns_repeated_
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
attlist_
.
table_number_columns_repeated_
;
++
i
)
{
if
(
Context
.
get_table_context
().
start_covered_cell
(
Context
))
{
if
(
!
table_table_cell_
content_
.
pptx_convert
(
Context
))
if
(
!
content_
.
pptx_convert
(
Context
))
{
_Wostream
<<
emptyParTable
;
}
...
...
ASCOfficeOdfFile/src/odf/table_xlsx.cpp
View file @
0b15c314
...
...
@@ -82,8 +82,8 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
///обработка чтилей для роу -
size_t
Default_Cell_style_in_row_
=
0
;
const
std
::
wstring
rowStyleName
=
table_table_row_
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
defaultCellStyleName
=
table_table_row_
attlist_
.
table_default_cell_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
rowStyleName
=
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
const
std
::
wstring
defaultCellStyleName
=
attlist_
.
table_default_cell_style_name_
.
get_value_or
(
L""
);
style_instance
*
instStyle_CellDefault
=
Context
.
root
()
->
odf_context
().
styleContainer
().
style_by_name
(
defaultCellStyleName
,
style_family
::
TableCell
,
false
/*false*/
);
...
...
@@ -140,9 +140,9 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
}
int
row_current
=
Context
.
current_table_row
()
+
1
;
bool
hidden
=
table_table_row_
attlist_
.
table_visibility_
.
get_type
()
==
table_visibility
::
Collapse
;
bool
hidden
=
attlist_
.
table_visibility_
.
get_type
()
==
table_visibility
::
Collapse
;
for
(
unsigned
int
i
=
0
;
i
<
table_table_row_
attlist_
.
table_number_rows_repeated_
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
attlist_
.
table_number_rows_repeated_
;
++
i
)
{
Context
.
start_table_row
(
rowStyleName
,
defaultCellStyleName
);
...
...
@@ -214,20 +214,20 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
if
(
Context
.
is_empty_row
())
{
skip_next_row
=
true
;
if
(
table_table_row_
attlist_
.
table_number_rows_repeated_
>
0xf000
)
if
(
attlist_
.
table_number_rows_repeated_
>
0xf000
)
break
;
//Уведомление_о_вручении.ods (1 лист)
}
if
(
content_
.
size
()
>
0
&&
table_table_row_
attlist_
.
table_number_rows_repeated_
>
1000
)
if
(
content_
.
size
()
>
0
&&
attlist_
.
table_number_rows_repeated_
>
1000
)
{
table_table_cell
*
table_cell
=
dynamic_cast
<
table_table_cell
*>
(
content_
[
0
].
get
());
if
((
table_cell
)
&&
(
table_cell
->
table_table_cell_
attlist_
.
table_number_columns_repeated_
>
1000
))
if
((
table_cell
)
&&
(
table_cell
->
attlist_
.
table_number_columns_repeated_
>
1000
))
{
break
;
//Уведомление_о_вручении.ods (2 лист)
}
}
}
Context
.
get_table_metrics
().
add_rows
(
table_table_row_
attlist_
.
table_number_rows_repeated_
,
!
hidden
?
row_height
:
0.0
);
Context
.
get_table_metrics
().
add_rows
(
attlist_
.
table_number_rows_repeated_
,
!
hidden
?
row_height
:
0.0
);
}
...
...
@@ -259,16 +259,16 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
table_table_row
*
row_last
=
dynamic_cast
<
table_table_row
*>
(
table_table_row_
[
table_table_row_
.
size
()
-
1
].
get
());
table_table_row
*
row_last_1
=
dynamic_cast
<
table_table_row
*>
(
table_table_row_
[
table_table_row_
.
size
()
-
2
].
get
());
if
(
row_last
->
table_table_row_
attlist_
.
table_number_rows_repeated_
>
1000
&&
row_last_1
->
table_table_row_
attlist_
.
table_number_rows_repeated_
>
1000
||
row_last_1
->
table_table_row_
attlist_
.
table_number_rows_repeated_
>
0xf000
)
if
(
row_last
->
attlist_
.
table_number_rows_repeated_
>
1000
&&
row_last_1
->
attlist_
.
table_number_rows_repeated_
>
1000
||
row_last_1
->
attlist_
.
table_number_rows_repeated_
>
0xf000
)
{
std
::
wstring
style
=
row_last
->
table_table_row_
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
std
::
wstring
style_1
=
row_last
->
table_table_row_
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
std
::
wstring
style
=
row_last
->
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
std
::
wstring
style_1
=
row_last
->
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
if
(
style
==
style_1
)
//check for empty also ????
{
row_last_1
->
table_table_row_
attlist_
.
table_number_rows_repeated_
=
1024
;
row_last_1
->
attlist_
.
table_number_rows_repeated_
=
1024
;
table_table_row_
.
pop_back
();
}
}
...
...
@@ -301,11 +301,11 @@ void table_rows_and_groups::xlsx_convert(oox::xlsx_conversion_context & Context)
void
table_table_row_group
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
int
count
=
table_rows_and_groups_
.
get_count
();
size_t
count
=
table_rows_and_groups_
.
content_
.
size
();
int
level
=
1
;
Context
.
set_table_row_group
(
count
,
table_table_row_group_attlist_
.
table_display_
,
level
);
Context
.
set_table_row_group
(
(
int
)
count
,
table_table_row_group_attlist_
.
table_display_
,
level
);
table_rows_and_groups_
.
xlsx_convert
(
Context
);
}
...
...
@@ -328,6 +328,27 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
Context
.
start_table
(
tableName
,
tableStyleName
);
table_columns_and_groups_
.
xlsx_convert
(
Context
);
// check last rows for equal style and empties - collapsed
//<table:table-row table:style-name="ro3" table:number-rows-repeated="65353">
// <table:table-cell table:style-name="ce14" table:number-columns-repeated="5"/>
// <table:table-cell table:number-columns-repeated="1019"/>
//</table:table-row>
//<table:table-row table:style-name="ro3" table:number-rows-repeated="983017">
// <table:table-cell table:number-columns-repeated="1024"/>
//</table:table-row>
//<table:table-row table:style-name="ro3">
// <table:table-cell table:number-columns-repeated="1024"/>
//</table:table-row>
if
(
table_rows_and_groups_
.
content_
.
empty
()
==
false
&&
table_rows_and_groups_
.
content_
.
back
()
->
get_type
()
==
typeTableTableRowNoGroup
)
{
table_rows_no_group
*
rows
=
dynamic_cast
<
table_rows_no_group
*>
(
table_rows_and_groups_
.
content_
.
back
().
get
());
rows
->
table_rows_1_
.
remove_equals_empty
();
rows
->
table_rows_2_
.
remove_equals_empty
();
}
table_rows_and_groups_
.
xlsx_convert
(
Context
);
if
(
table_shapes_
)
...
...
@@ -607,11 +628,11 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
std
::
wostream
&
strm
=
Context
.
current_sheet
().
sheetData
();
const
common_value_and_type_attlist
&
attr
=
table_table_cell_
attlist_
.
common_value_and_type_attlist_
;
const
common_value_and_type_attlist
&
attr
=
attlist_
.
common_value_and_type_attlist_
;
office_value_type
::
type
odf_value_type
=
office_value_type
::
Custom
;
oox
::
XlsxCellType
::
type
t_val
=
oox
::
XlsxCellType
::
s
;
std
::
wstring
formula
=
table_table_cell_
attlist_
.
table_formula_
.
get_value_or
(
L""
);
std
::
wstring
formula
=
attlist_
.
table_formula_
.
get_value_or
(
L""
);
std
::
wstring
number_val
;
_CP_OPT
(
bool
)
bool_val
;
...
...
@@ -626,11 +647,11 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
bool
is_data_visible
=
false
;
// вычислить стиль для ячейки
std
::
wstring
cellStyleName
=
table_table_cell_
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
std
::
wstring
cellStyleName
=
attlist_
.
table_style_name_
.
get_value_or
(
L""
);
std
::
wstring
columnStyleName
=
Context
.
get_table_context
().
default_column_cell_style
();
std
::
wstring
rowStyleName
=
Context
.
get_table_context
().
default_row_cell_style
();
if
(
table_table_cell_
attlist_
.
table_number_columns_repeated_
>
1
)
if
(
attlist_
.
table_number_columns_repeated_
>
1
)
columnStyleName
.
clear
();
// могут быть разные стили колонок Book 24.ods
odf_read_context
&
odfContext
=
Context
.
root
()
->
odf_context
();
...
...
@@ -760,15 +781,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
is_style_visible
=
(
!
cellStyleName
.
empty
()
||
defaultColumnCellStyle
)
?
true
:
false
;
if
(
table_table_cell_
content_
.
elements_
.
size
()
>
0
||
if
(
content_
.
elements_
.
size
()
>
0
||
!
formula
.
empty
()
||
(
t_val
==
oox
::
XlsxCellType
::
n
&&
!
number_val
.
empty
())
||
(
t_val
==
oox
::
XlsxCellType
::
b
&&
bool_val
)
||
((
t_val
==
oox
::
XlsxCellType
::
str
||
oox
::
XlsxCellType
::
inlineStr
)
&&
str_val
))
is_data_visible
=
true
;
if
(
table_table_cell_
attlist_
.
table_number_columns_repeated_
<
199
&&
last_cell_
)
last_cell_
=
false
;
if
(
attlist_
.
table_number_columns_repeated_
<
199
&&
last_cell_
)
last_cell_
=
false
;
int
cell_repeated_max
=
Context
.
current_table_column
()
+
table_table_cell_
attlist_
.
table_number_columns_repeated_
+
1
;
int
cell_repeated_max
=
Context
.
current_table_column
()
+
attlist_
.
table_number_columns_repeated_
+
1
;
if
(
cell_repeated_max
>=
1024
&&
cellStyleName
.
empty
()
&&
last_cell_
&&
!
is_data_visible
)
{
//Book 24.ods
...
...
@@ -780,15 +801,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
xfId_last_set
=
Context
.
get_style_manager
().
xfId
(
&
textFormatProperties
,
&
parFormatProperties
,
&
cellFormatProperties
,
&
cellFormat
,
num_format
,
false
,
is_style_visible
);
}
for
(
unsigned
int
r
=
0
;
r
<
table_table_cell_
attlist_
.
table_number_columns_repeated_
;
++
r
)
for
(
unsigned
int
r
=
0
;
r
<
attlist_
.
table_number_columns_repeated_
;
++
r
)
{
Context
.
start_table_cell
(
formula
,
table_table_cell_
attlist_extra_
.
table_number_columns_spanned_
-
1
,
table_table_cell_
attlist_extra_
.
table_number_rows_spanned_
-
1
);
Context
.
start_table_cell
(
formula
,
attlist_extra_
.
table_number_columns_spanned_
-
1
,
attlist_extra_
.
table_number_rows_spanned_
-
1
);
if
(
is_style_visible
)
Context
.
set_current_cell_style_id
(
xfId_last_set
);
const
int
sharedStringId
=
table_table_cell_
content_
.
xlsx_convert
(
Context
,
&
textFormatProperties
);
const
int
sharedStringId
=
content_
.
xlsx_convert
(
Context
,
&
textFormatProperties
);
if
(
t_val
==
oox
::
XlsxCellType
::
str
&&
sharedStringId
>=
0
)
t_val
=
oox
::
XlsxCellType
::
s
;
//в случае текста, если он есть берем кэшированное значение
...
...
@@ -813,12 +834,12 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
CP_XML_NODE
(
L"f"
)
{
if
(
table_table_cell_attlist_extra_
.
table_number_matrix_columns_spanned_
&&
table_table_cell_
attlist_extra_
.
table_number_matrix_rows_spanned_
)
if
(
attlist_extra_
.
table_number_matrix_columns_spanned_
&&
attlist_extra_
.
table_number_matrix_rows_spanned_
)
{
std
::
wstring
ref
=
oox
::
getCellAddress
(
Context
.
current_table_column
(),
Context
.
current_table_row
());
ref
+=
L":"
;
ref
+=
oox
::
getCellAddress
(
Context
.
current_table_column
()
+
*
table_table_cell_
attlist_extra_
.
table_number_matrix_columns_spanned_
-
1
,
Context
.
current_table_row
()
+
*
table_table_cell_
attlist_extra_
.
table_number_matrix_rows_spanned_
-
1
);
ref
+=
oox
::
getCellAddress
(
Context
.
current_table_column
()
+
*
attlist_extra_
.
table_number_matrix_columns_spanned_
-
1
,
Context
.
current_table_row
()
+
*
attlist_extra_
.
table_number_matrix_rows_spanned_
-
1
);
CP_XML_ATTR
(
L"ref"
,
ref
);
CP_XML_ATTR
(
L"t"
,
L"array"
);
CP_XML_ATTR
(
L"aca"
,
false
);
...
...
@@ -854,7 +875,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
empty_cell_count
++
;
//Уведомление_о_вручении.ods - 13 повторов пустых с cellStyle=NULL - нужные !!!
if
(
empty_cell_count
>
19
&&
last_cell_
&&
(
table_table_cell_
attlist_
.
table_number_columns_repeated_
>
299
||
cellStyle
==
NULL
))
if
(
empty_cell_count
>
19
&&
last_cell_
&&
(
attlist_
.
table_number_columns_repeated_
>
299
||
cellStyle
==
NULL
))
{
//пишем простыню только если задан стиль тока для этих ячеек
skip_next_cell
=
true
;
}
...
...
@@ -875,9 +896,9 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
{
std
::
wostream
&
strm
=
Context
.
current_sheet
().
sheetData
();
const
int
sharedStringId
=
table_table_cell_
content_
.
xlsx_convert
(
Context
,
NULL
);
const
int
sharedStringId
=
content_
.
xlsx_convert
(
Context
,
NULL
);
for
(
unsigned
int
r
=
0
;
r
<
table_table_cell_
attlist_
.
table_number_columns_repeated_
;
++
r
)
for
(
unsigned
int
r
=
0
;
r
<
attlist_
.
table_number_columns_repeated_
;
++
r
)
{
Context
.
start_table_covered_cell
();
const
int
xfId
=
Context
.
get_current_cell_style_id
();
...
...
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