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
c3da9a66
Commit
c3da9a66
authored
Aug 09, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - convert pilots ...
parent
f907a90b
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
58 additions
and
14 deletions
+58
-14
ASCOfficeOdfFile/formulasconvert/formulasconvert.h
ASCOfficeOdfFile/formulasconvert/formulasconvert.h
+2
-1
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
+14
-2
ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp
ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp
+1
-1
ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp
ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp
+16
-2
ASCOfficeOdfFile/src/docx/xlsx_pivots_context.h
ASCOfficeOdfFile/src/docx/xlsx_pivots_context.h
+4
-3
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
+0
-1
ASCOfficeOdfFile/src/odf/table_data_pilot_tables.cpp
ASCOfficeOdfFile/src/odf/table_data_pilot_tables.cpp
+16
-1
ASCOfficeOdfFile/src/odf/table_data_pilot_tables.h
ASCOfficeOdfFile/src/odf/table_data_pilot_tables.h
+1
-1
ASCOfficeOdfFileW/source/OdfFormat/ods_table_context.cpp
ASCOfficeOdfFileW/source/OdfFormat/ods_table_context.cpp
+2
-2
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
+2
-0
No files found.
ASCOfficeOdfFile/formulasconvert/formulasconvert.h
View file @
c3da9a66
...
...
@@ -51,6 +51,7 @@ public:
// $Лист1.$A$1 -> Лист1!$A$1
std
::
wstring
convert_named_ref
(
std
::
wstring
const
&
expr
,
bool
withTableName
=
true
,
std
::
wstring
separator
=
L" "
);
std
::
wstring
get_table_name
();
//a-la convert without check formula
std
::
wstring
convert_named_expr
(
std
::
wstring
const
&
expr
,
bool
withTableName
=
true
);
...
...
@@ -90,7 +91,7 @@ public:
std
::
wstring
convert_named_ref
(
std
::
wstring
const
&
expr
);
std
::
wstring
convert_named_formula
(
std
::
wstring
const
&
expr
);
std
::
wstring
get_base_cell_formula
(
std
::
wstring
const
&
expr
);
std
::
wstring
get_base_cell_formula
();
//Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19
std
::
wstring
convert_chart_distance
(
std
::
wstring
const
&
expr
);
...
...
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
View file @
c3da9a66
...
...
@@ -43,7 +43,6 @@ namespace formulasconvert {
class
odf2oox_converter
::
Impl
{
public:
static
bool
convert_with_TableName
;
std
::
wstring
convert
(
const
std
::
wstring
&
expr
);
std
::
wstring
convert_chart_distance
(
const
std
::
wstring
&
expr
);
...
...
@@ -61,8 +60,12 @@ namespace formulasconvert {
void
replace_named_ref
(
std
::
wstring
&
expr
,
bool
w
=
true
);
bool
find_first_ref
(
std
::
wstring
const
&
expr
,
std
::
wstring
&
table
,
std
::
wstring
&
ref
);
bool
find_first_last_ref
(
std
::
wstring
const
&
expr
,
std
::
wstring
&
table
,
std
::
wstring
&
ref_first
,
std
::
wstring
&
ref_last
);
static
bool
convert_with_TableName
;
static
std
::
wstring
table_name_
;
};
bool
odf2oox_converter
::
Impl
::
convert_with_TableName
=
true
;
std
::
wstring
odf2oox_converter
::
Impl
::
table_name_
=
L""
;
bool
odf2oox_converter
::
Impl
::
find_first_last_ref
(
std
::
wstring
const
&
expr
,
std
::
wstring
&
table
,
std
::
wstring
&
ref_first
,
std
::
wstring
&
ref_last
)
{
...
...
@@ -152,6 +155,8 @@ namespace formulasconvert {
std
::
wstring
sheet1
=
what
[
1
].
str
();
XmlUtils
::
replace_all
(
sheet1
,
L"$"
,
L""
);
table_name_
=
sheet1
;
const
std
::
wstring
c1
=
what
[
2
].
str
();
const
std
::
wstring
c2
=
what
[
3
].
str
();
...
...
@@ -180,6 +185,8 @@ namespace formulasconvert {
const
std
::
wstring
c2
=
what
[
3
].
str
();
//sheet name 2
const
std
::
wstring
c3
=
what
[
4
].
str
();
table_name_
=
sheet1
;
if
(
convert_with_TableName
)
{
return
(
sheet1
+
L"!"
)
+
c1
+
(
c2
.
empty
()
?
L""
:
(
L":"
+
c3
)
);
...
...
@@ -559,6 +566,11 @@ namespace formulasconvert {
{
}
std
::
wstring
odf2oox_converter
::
get_table_name
()
{
return
impl_
->
table_name_
;
}
std
::
wstring
odf2oox_converter
::
convert
(
const
std
::
wstring
&
expr
)
{
return
impl_
->
convert
(
expr
);
...
...
ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp
View file @
c3da9a66
...
...
@@ -614,7 +614,7 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
impl_
->
replace_named_formula
(
workstr
);
return
workstr
;
}
std
::
wstring
oox2odf_converter
::
get_base_cell_formula
(
const
std
::
wstring
&
expr
)
std
::
wstring
oox2odf_converter
::
get_base_cell_formula
()
{
return
impl_
->
base_cell_formula_
;
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp
View file @
c3da9a66
...
...
@@ -65,6 +65,14 @@ public:
std
::
wstringstream
view_
;
std
::
wstringstream
cache_
;
struct
_desc
{
void
clear
()
{
}
std
::
wstring
name
;
}
current_
;
};
xlsx_pivots_context
::
xlsx_pivots_context
()
:
impl_
(
new
xlsx_pivots_context
::
Impl
())
...
...
@@ -131,6 +139,7 @@ void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm)
void
xlsx_pivots_context
::
start_table
()
{
impl_
->
current_
.
clear
();
impl_
->
fields_
.
clear
();
}
...
...
@@ -143,7 +152,7 @@ int xlsx_pivots_context::end_table()
{
CP_XML_ATTR
(
L"xmlns"
,
L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
);
//CP_XML_ATTR(L"name", view->stTable.value()
);
CP_XML_ATTR
(
L"name"
,
impl_
->
current_
.
name
);
//CP_XML_ATTR(L"cacheId", view->iCache);
//CP_XML_ATTR(L"dataOnRows", view->sxaxis4Data.bRw);
//CP_XML_ATTR(L"applyNumberFormats", view->fAtrNum);
...
...
@@ -180,7 +189,7 @@ int xlsx_pivots_context::end_table()
CP_XML_ATTR
(
L"count"
,
impl_
->
fields_
.
size
());
for
(
size_t
i
=
0
;
i
<
impl_
->
fields_
.
size
();
i
++
)
{
impl_
->
fields_
[
i
].
view_
;
CP_XML_STREAM
()
<<
impl_
->
fields_
[
i
].
view_
;
}
}
}
...
...
@@ -191,6 +200,11 @@ int xlsx_pivots_context::end_table()
return
impl_
->
views_
.
size
();
}
void
xlsx_pivots_context
::
set_view_name
(
std
::
wstring
name
)
{
impl_
->
current_
.
name
=
name
;
}
void
xlsx_pivots_context
::
start_field
()
{
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_pivots_context.h
View file @
c3da9a66
...
...
@@ -52,11 +52,12 @@ public:
void
start_field
();
void
end_field
();
//int add_view(int indexCache);
int
get_view_count
();
int
get_view_count
();
//equal in libre
int
get_cache_count
();
void
set_view_name
(
std
::
wstring
name
);
void
add_cache
(
std
::
wstring
definitions
,
std
::
wstring
records
);
int
get_cache_count
();
void
write_cache_definitions_to
(
int
index
,
std
::
wostream
&
strm
);
void
write_cache_records_to
(
int
index
,
std
::
wostream
&
strm
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
View file @
c3da9a66
...
...
@@ -48,7 +48,6 @@ class xlsx_table_context
public:
xlsx_table_context
(
xlsx_conversion_context
*
Context
,
xlsx_text_context
&
textCotnext
);
public:
void
start_table
(
std
::
wstring
tableName
,
std
::
wstring
tableStyleName
,
int
id
);
void
end_table
();
...
...
ASCOfficeOdfFile/src/odf/table_data_pilot_tables.cpp
View file @
c3da9a66
...
...
@@ -31,6 +31,7 @@
*/
#include "table_data_pilot_tables.h"
#include "../formulasconvert/formulasconvert.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
...
...
@@ -72,7 +73,7 @@ void table_data_pilot_table::add_attributes( const xml::attributes_wc_ptr & Attr
CP_APPLY_ATTR
(
L"table:identify-categories"
,
table_identify_categories_
);
CP_APPLY_ATTR
(
L"table:ignore-empty-rows"
,
table_ignore_empty_rows_
);
CP_APPLY_ATTR
(
L"table:show-filter-button"
,
table_show_filter_button_
);
CP_APPLY_ATTR
(
L"table:show-target-range-address"
,
table_show
_target_range_address_
);
CP_APPLY_ATTR
(
L"table:target-range-address"
,
table
_target_range_address_
);
}
...
...
@@ -90,6 +91,20 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
Context
.
get_pivots_context
().
start_table
();
if
(
table_name_
)
Context
.
get_pivots_context
().
set_view_name
(
*
table_name_
);
if
(
table_target_range_address_
)
{
formulasconvert
::
odf2oox_converter
formulas_converter
;
std
::
wstring
ref
=
formulas_converter
.
convert_named_ref
(
*
table_target_range_address_
,
false
);
std
::
wstring
table_name
=
formulas_converter
.
get_table_name
();
//Context.get_table_context()
//Context.get_pivots_context()->set_view_target_range(ref);
//Context.get_pivots_context()->set_view_target_table(table_index);
}
source_
->
xlsx_convert
(
Context
);
for
(
size_t
i
=
0
;
i
<
fields_
.
size
();
i
++
)
...
...
ASCOfficeOdfFile/src/odf/table_data_pilot_tables.h
View file @
c3da9a66
...
...
@@ -88,6 +88,7 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
_CP_OPT
(
std
::
wstring
)
table_name_
;
_CP_OPT
(
std
::
wstring
)
table_target_range_address_
;
_CP_OPT
(
std
::
wstring
)
table_application_data_
;
_CP_OPT
(
std
::
wstring
)
table_buttons_
;
_CP_OPT
(
odf_types
::
Bool
)
table_drill_down_ondouble_click_
;
...
...
@@ -95,7 +96,6 @@ private:
_CP_OPT
(
odf_types
::
Bool
)
table_identify_categories_
;
_CP_OPT
(
odf_types
::
Bool
)
table_ignore_empty_rows_
;
_CP_OPT
(
odf_types
::
Bool
)
table_show_filter_button_
;
_CP_OPT
(
odf_types
::
Bool
)
table_show_target_range_address_
;
office_element_ptr
source_
;
office_element_ptr_array
fields_
;
...
...
ASCOfficeOdfFileW/source/OdfFormat/ods_table_context.cpp
View file @
c3da9a66
...
...
@@ -138,7 +138,7 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std::
XmlUtils
::
replace_all
(
odf_range
,
L"["
,
L""
);
XmlUtils
::
replace_all
(
odf_range
,
L"]"
,
L""
);
std
::
wstring
odf_base_cell
=
formulas_converter
.
get_base_cell_formula
(
cell_range
);
std
::
wstring
odf_base_cell
=
formulas_converter
.
get_base_cell_formula
();
named_range
->
table_name_
=
name
;
named_range
->
table_cell_range_address_
=
odf_range
;
...
...
@@ -182,7 +182,7 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const
formulasconvert
::
oox2odf_converter
formulas_converter
;
std
::
wstring
odf_value
=
formulas_converter
.
convert_named_formula
(
value
);
std
::
wstring
odf_base_cell
=
formulas_converter
.
get_base_cell_formula
(
value
);
std
::
wstring
odf_base_cell
=
formulas_converter
.
get_base_cell_formula
();
named_expression
->
table_name_
=
name
;
named_expression
->
table_expression_
=
odf_value
;
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
View file @
c3da9a66
...
...
@@ -219,6 +219,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDefinedName *oox_defined)
bool
printable
=
false
;
if
(
name
==
L"_xlnm.Print_Area"
)
printable
=
true
;
//todoooo !!!! сделать анализ на функцию, диапазон, константы .... !!!
if
(
false
)
//если простой - range, составной - выражение
ods_context
->
add_defined_range
(
name
,
oox_defined
->
m_oRef
.
get2
(),
sheet_id
,
printable
);
else
...
...
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