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
2550167a
Commit
2550167a
authored
Jun 30, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatWriter - fix bugs after auto-testing (charts, shapes ...)
parent
529f028e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
42 deletions
+97
-42
ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp
ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp
+6
-3
ASCOfficeOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
...eOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
+1
-1
ASCOfficeOdfFileW/source/OdfFormat/Shapes/odf_shape_mapping.h
...fficeOdfFileW/source/OdfFormat/Shapes/odf_shape_mapping.h
+1
-1
ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp
ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp
+10
-2
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
+17
-10
ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.cpp
ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.cpp
+18
-4
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp
+17
-11
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
+27
-10
No files found.
ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp
View file @
2550167a
...
...
@@ -542,22 +542,25 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
std
::
wstring
res1
=
boost
::
regex_replace
(
workstr
,
boost
::
wregex
(
L"('.*?')|(
\"
.*?
\"
)"
),
&
oox2odf_converter
::
Impl
::
convert_scobci
,
boost
::
match_default
|
boost
::
format_all
);
&
oox2odf_converter
::
Impl
::
convert_scobci
,
boost
::
match_default
|
boost
::
format_all
);
std
::
wstring
res
=
boost
::
regex_replace
(
res1
,
boost
::
wregex
(
L"(?:(?=[()])(.*?)(?=[)]))"
),
&
oox2odf_converter
::
Impl
::
replace_arguments
,
boost
::
match_default
|
boost
::
format_all
);
&
oox2odf_converter
::
Impl
::
replace_arguments
,
boost
::
match_default
|
boost
::
format_all
);
if
(
res1
==
res
)
{
boost
::
algorithm
::
replace_all
(
res1
,
L"KAVYCHKA"
,
L"
\"
"
);
//IMCONJUGATE_emb.xlsx
res
=
boost
::
regex_replace
(
res1
,
boost
::
wregex
(
L"(
\\
$?
\\
w+
\\
!)?([a-zA-Z$]+
\\
d{1,})
\\
:?([a-zA-Z$]+
\\
d{1,})?"
),
&
replace_cells_range_formater1
,
boost
::
match_default
|
boost
::
format_all
);
replace_vertical
(
res
);
replace_vertical
(
res
);
replace_semicolons
(
res
);
}
...
...
ASCOfficeOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
View file @
2550167a
...
...
@@ -57,7 +57,7 @@ std::wstring DetectTypeDocument(const std::wstring & pathOOX)
if
(
file
.
OpenFile
(
fileContentType
)
!=
S_OK
)
return
sRes
;
int
nBufferSize
=
min
(
file
.
GetFileSize
(),
4096
);
int
nBufferSize
=
min
(
file
.
GetFileSize
(),
10000
);
BYTE
*
pBuffer
=
new
BYTE
[
nBufferSize
];
file
.
ReadFile
(
pBuffer
,
nBufferSize
);
...
...
ASCOfficeOdfFileW/source/OdfFormat/Shapes/odf_shape_mapping.h
View file @
2550167a
...
...
@@ -57,7 +57,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{
L"mso-spt200"
,
7
},
// shapetypeActionButtonMovie,
{
L"mso-spt197"
,
7
},
// shapetypeActionButtonReturn,
{
L"mso-spt199"
,
7
},
// shapetypeActionButtonSound,
{
L"
"
,
7
},
// shapetypeArc,
{
L"
ooxml-arc"
,
7
},
// shapetypeArc,
{
L"mso-spt91"
,
7
},
// shapetypeBentArrow,
{
L"mso-spt33"
,
7
},
// shapetypeBentConnector2,
{
L"mso-spt34"
,
7
},
// shapetypeBentConnector3,
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp
View file @
2550167a
...
...
@@ -129,7 +129,7 @@ public:
styles_context_
=
NULL
;
current_series_count_
=
0
;
if
(
odf_context
->
type
==
SpreadsheetDocument
)
if
(
odf_context
_
->
type
==
SpreadsheetDocument
)
{
local_table_enabled_
=
false
;
}
...
...
@@ -208,7 +208,15 @@ void odf_chart_context::Impl::clear_current()
cash_
.
clear
();
current_series_count_
=
0
;
local_table_enabled_
=
true
;
//false; пока тока кэш - demo.docx
if
(
odf_context_
->
type
==
SpreadsheetDocument
)
{
local_table_enabled_
=
false
;
}
else
{
local_table_enabled_
=
true
;
}
}
void
odf_chart_context
::
Impl
::
set_default_series_color
()
{
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
View file @
2550167a
...
...
@@ -473,16 +473,21 @@ void odf_drawing_context::end_drawing()
if
(
impl_
->
current_drawing_state_
.
svg_x_
&&
impl_
->
current_drawing_state_
.
svg_y_
)
{
odf_types
::
length
pos_x
=
(
impl_
->
current_drawing_state_
.
svg_x_
->
get_value
()
+
odf_types
::
length
pos_x
=
odf_types
::
length
(
impl_
->
current_drawing_state_
.
svg_x_
->
get_value
()
+
(
impl_
->
current_drawing_state_
.
svg_width_
?
(
impl_
->
current_drawing_state_
.
svg_width_
->
get_value
()
/
2.
)
:
0.
),
impl_
->
current_drawing_state_
.
svg_x_
->
get_unit
());
odf_types
::
length
pos_y
=
(
impl_
->
current_drawing_state_
.
svg_y_
->
get_value
()
+
odf_types
::
length
pos_y
=
odf_types
::
length
(
impl_
->
current_drawing_state_
.
svg_y_
->
get_value
()
+
(
impl_
->
current_drawing_state_
.
svg_height_
?
(
impl_
->
current_drawing_state_
.
svg_height_
->
get_value
()
/
2.
)
:
0.
),
impl_
->
current_drawing_state_
.
svg_y_
->
get_unit
());
strTransform
+=
std
::
wstring
(
L" translate("
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
pos_x
)
+
std
::
wstring
(
L","
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
pos_y
)
+
std
::
wstring
(
L")"
)
;
impl_
->
current_drawing_state_
.
svg_x_
=
boost
::
none
;
impl_
->
current_drawing_state_
.
svg_y_
=
boost
::
none
;
if
(
pos_x
.
get_unit
()
!=
odf_types
::
length
::
none
&&
pos_y
.
get_unit
()
!=
odf_types
::
length
::
none
)
{
strTransform
+=
std
::
wstring
(
L" translate("
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
pos_x
)
+
std
::
wstring
(
L","
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
pos_y
)
+
std
::
wstring
(
L")"
)
;
impl_
->
current_drawing_state_
.
svg_x_
=
boost
::
none
;
impl_
->
current_drawing_state_
.
svg_y_
=
boost
::
none
;
}
}
}
...
...
@@ -1554,7 +1559,6 @@ void odf_drawing_context::get_size( double & width_pt, double & height_pt)
}
void
odf_drawing_context
::
set_size
(
_CP_OPT
(
double
)
&
width_pt
,
_CP_OPT
(
double
)
&
height_pt
)
{
if
(
impl_
->
current_drawing_state_
.
in_group
)
{
if
(
width_pt
)
...
...
@@ -1569,8 +1573,11 @@ void odf_drawing_context::set_size( _CP_OPT(double) & width_pt, _CP_OPT(double)
}
}
else
{
if
(
!
impl_
->
current_drawing_state_
.
svg_width_
&&
width_pt
)
impl_
->
current_drawing_state_
.
svg_width_
=
length
(
length
(
*
width_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
!
impl_
->
current_drawing_state_
.
svg_height_
&&
height_pt
)
impl_
->
current_drawing_state_
.
svg_height_
=
length
(
length
(
*
height_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
!
impl_
->
current_drawing_state_
.
svg_width_
&&
width_pt
)
impl_
->
current_drawing_state_
.
svg_width_
=
length
(
length
(
*
width_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
!
impl_
->
current_drawing_state_
.
svg_height_
&&
height_pt
)
impl_
->
current_drawing_state_
.
svg_height_
=
length
(
length
(
*
height_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
}
}
void
odf_drawing_context
::
set_line_width
(
double
pt
)
...
...
ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.cpp
View file @
2550167a
...
...
@@ -825,7 +825,8 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x,
{
double
sz_col
=
0
;
int
curr_col
=
0
,
i
;
for
(
i
=
0
;
i
<
columns_
.
size
();
i
++
)
for
(
i
=
0
;
i
<
columns_
.
size
();
i
++
)
{
if
(
oox_pos
.
col
>
columns_
[
i
].
repeated
+
curr_col
)
{
...
...
@@ -834,16 +835,22 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x,
else
{
sz_col
+=
(
oox_pos
.
col
-
curr_col
)
*
columns_
[
i
].
size
;
curr_col
+=
(
oox_pos
.
col
-
curr_col
);
break
;
}
curr_col
+=
columns_
[
i
].
repeated
;
}
if
(
curr_col
<
oox_pos
.
col
&&
columns_
.
size
()
>
0
)
{
sz_col
+=
(
oox_pos
.
col
-
curr_col
)
*
columns_
[
columns_
.
size
()
-
1
].
size
;
}
x
=
sz_col
+
oox_pos
.
col_off
;
x
=
sz_col
+
oox_pos
.
col_off
;
double
sz_row
=
0
;
int
curr_row
=
0
;
for
(
i
=
0
;
i
<
rows_
.
size
();
i
++
)
for
(
i
=
0
;
i
<
rows_
.
size
();
i
++
)
{
if
(
oox_pos
.
row
>
rows_
[
i
].
repeated
+
curr_row
)
{
...
...
@@ -852,12 +859,19 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x,
else
{
sz_row
+=
(
oox_pos
.
row
-
curr_row
)
*
rows_
[
i
].
size
;
curr_row
+=
(
oox_pos
.
row
-
curr_row
);
break
;
}
curr_row
+=
rows_
[
i
].
repeated
;
}
y
=
sz_row
+
oox_pos
.
row_off
;
if
(
curr_row
<
oox_pos
.
row
&&
rows_
.
size
()
>
0
)
{
sz_row
+=
(
oox_pos
.
row
-
curr_row
)
*
rows_
[
rows_
.
size
()
-
1
].
size
;
}
y
=
sz_row
+
oox_pos
.
row_off
;
}
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp
View file @
2550167a
...
...
@@ -633,21 +633,27 @@ void OoxConverter::convert(OOX::Drawing::CLineProperties *oox_line_prop, CString
}
if
(
oox_line_prop
->
m_oHeadEnd
.
IsInit
())
{
int
type
=
0
,
w
=
1
,
len
=
1
;
//medium arrow
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oLen
.
IsInit
())
len
=
oox_line_prop
->
m_oHeadEnd
->
m_oLen
->
GetValue
();
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oType
.
IsInit
())
type
=
oox_line_prop
->
m_oHeadEnd
->
m_oType
->
GetValue
();
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oW
.
IsInit
())
w
=
oox_line_prop
->
m_oHeadEnd
->
m_oW
->
GetValue
();
odf_context
()
->
drawing_context
()
->
set_line_head
(
type
,
len
,
w
);
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oLen
.
IsInit
()
||
oox_line_prop
->
m_oHeadEnd
->
m_oType
.
IsInit
()
||
oox_line_prop
->
m_oHeadEnd
->
m_oW
.
IsInit
())
{
int
type
=
0
,
w
=
1
,
len
=
1
;
//medium arrow
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oLen
.
IsInit
())
len
=
oox_line_prop
->
m_oHeadEnd
->
m_oLen
->
GetValue
();
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oType
.
IsInit
())
type
=
oox_line_prop
->
m_oHeadEnd
->
m_oType
->
GetValue
();
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oW
.
IsInit
())
w
=
oox_line_prop
->
m_oHeadEnd
->
m_oW
->
GetValue
();
odf_context
()
->
drawing_context
()
->
set_line_head
(
type
,
len
,
w
);
}
}
if
(
oox_line_prop
->
m_oTailEnd
.
IsInit
())
{
int
type
=
0
,
w
=
1
,
len
=
1
;
//medium arrow
if
(
oox_line_prop
->
m_oTailEnd
->
m_oLen
.
IsInit
())
len
=
oox_line_prop
->
m_oTailEnd
->
m_oLen
->
GetValue
();
if
(
oox_line_prop
->
m_oTailEnd
->
m_oType
.
IsInit
())
type
=
oox_line_prop
->
m_oTailEnd
->
m_oType
->
GetValue
();
if
(
oox_line_prop
->
m_oTailEnd
->
m_oW
.
IsInit
())
w
=
oox_line_prop
->
m_oTailEnd
->
m_oW
->
GetValue
();
if
(
oox_line_prop
->
m_oTailEnd
->
m_oLen
.
IsInit
()
||
oox_line_prop
->
m_oTailEnd
->
m_oType
.
IsInit
()
||
oox_line_prop
->
m_oTailEnd
->
m_oW
.
IsInit
())
{
int
type
=
0
,
w
=
1
,
len
=
1
;
//medium arrow
if
(
oox_line_prop
->
m_oTailEnd
->
m_oLen
.
IsInit
())
len
=
oox_line_prop
->
m_oTailEnd
->
m_oLen
->
GetValue
();
if
(
oox_line_prop
->
m_oTailEnd
->
m_oType
.
IsInit
())
type
=
oox_line_prop
->
m_oTailEnd
->
m_oType
->
GetValue
();
if
(
oox_line_prop
->
m_oTailEnd
->
m_oW
.
IsInit
())
w
=
oox_line_prop
->
m_oTailEnd
->
m_oW
->
GetValue
();
odf_context
()
->
drawing_context
()
->
set_line_tail
(
type
,
len
,
w
);
odf_context
()
->
drawing_context
()
->
set_line_tail
(
type
,
len
,
w
);
}
}
if
(
oox_line_prop
->
m_oCustDash
.
IsInit
())
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
View file @
2550167a
...
...
@@ -817,14 +817,13 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorkbookView *oox_book_views)
if
(
oox_book_views
->
m_oActiveTab
.
IsInit
())
{
int
table_id
=
oox_book_views
->
m_oActiveTab
->
GetValue
()
+
1
;
int
table_id
=
oox_book_views
->
m_oActiveTab
->
GetValue
();
for
(
int
i
=
0
;
i
<
Workbook
->
m_oSheets
->
m_arrItems
.
size
();
i
++
)
if
(
table_id
>=
0
&&
table_id
<
Workbook
->
m_oSheets
->
m_arrItems
.
size
()
)
{
OOX
::
Spreadsheet
::
CSheet
*
pSheet
=
Workbook
->
m_oSheets
->
m_arrItems
[
i
];
if
(
!
pSheet
)
continue
;
OOX
::
Spreadsheet
::
CSheet
*
pSheet
=
Workbook
->
m_oSheets
->
m_arrItems
[
table_id
];
if
(
pSheet
->
m_oSheetId
.
IsInit
()
&&
pSheet
->
m_oSheetId
->
GetValue
()
==
table_id
)
if
(
pSheet
)
{
ods_context
->
settings_context
()
->
add_property
(
L"ActiveTable"
,
L"string"
,
string2std_string
(
pSheet
->
m_oName
.
get2
()));
}
...
...
@@ -901,17 +900,19 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
{
ods_context
->
settings_context
()
->
add_property
(
L"GridColor"
,
L"int"
,
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oColorId
->
ToString
().
GetBuffer
());
}
bool
bPaneX
=
false
;
bool
bPaneY
=
false
;
int
ActiveCellX
=
-
1
,
ActiveCellY
=
-
1
;
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oSelection
.
IsInit
())
{
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oSelection
->
m_oActiveCell
.
IsInit
())
{
int
col
=
-
1
,
row
=
-
1
;
odf_writer
::
utils
::
parsing_ref
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oSelection
->
m_oActiveCell
->
GetBuffer
(),
col
,
row
);
odf_writer
::
utils
::
parsing_ref
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oSelection
->
m_oActiveCell
->
GetBuffer
(),
ActiveCellX
,
ActiveCellY
);
if
(
col
>=
0
&&
row
>=
0
)
if
(
ActiveCellX
>=
0
&&
ActiveCellY
>=
0
)
{
ods_context
->
settings_context
()
->
add_property
(
L"CursorPositionX"
,
L"int"
,
boost
::
lexical_cast
<
std
::
wstring
>
(
col
));
ods_context
->
settings_context
()
->
add_property
(
L"CursorPositionY"
,
L"int"
,
boost
::
lexical_cast
<
std
::
wstring
>
(
row
));
ods_context
->
settings_context
()
->
add_property
(
L"CursorPositionX"
,
L"int"
,
boost
::
lexical_cast
<
std
::
wstring
>
(
ActiveCellX
));
ods_context
->
settings_context
()
->
add_property
(
L"CursorPositionY"
,
L"int"
,
boost
::
lexical_cast
<
std
::
wstring
>
(
ActiveCellY
));
}
}
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oSelection
->
m_oSqref
.
IsInit
())
...
...
@@ -931,6 +932,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
ods_context
->
settings_context
()
->
add_property
(
L"HorizontalSplitPosition"
,
L"int"
,
sVal
);
ods_context
->
settings_context
()
->
add_property
(
L"PositionLeft"
,
L"int"
,
L"0"
);
ods_context
->
settings_context
()
->
add_property
(
L"PositionRight"
,
L"int"
,
sVal
);
bPaneX
=
true
;
}
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oPane
->
m_oYSplit
.
IsInit
())
{
...
...
@@ -939,8 +941,23 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
ods_context
->
settings_context
()
->
add_property
(
L"VerticalSplitPosition"
,
L"int"
,
sVal
);
ods_context
->
settings_context
()
->
add_property
(
L"PositionTop"
,
L"int"
,
L"0"
);
ods_context
->
settings_context
()
->
add_property
(
L"PositionBottom"
,
L"int"
,
sVal
);
bPaneY
=
true
;
}
}
//if (!bPaneX && ActiveCellX >= 0)
//{
// ods_context->settings_context()->add_property(L"HorizontalSplitMode", L"short", L"0");
// ods_context->settings_context()->add_property(L"HorizontalSplitPosition", L"int", L"0");
// ods_context->settings_context()->add_property(L"PositionLeft", L"int", L"0");
// ods_context->settings_context()->add_property(L"PositionRight", L"int", boost::lexical_cast<std::wstring>(ActiveCellX));
//}
//if (!bPaneY && ActiveCellY >= 0)
//{
// ods_context->settings_context()->add_property(L"VerticalSplitMode", L"short", L"0");
// ods_context->settings_context()->add_property(L"VerticalSplitPosition", L"int", L"0");
// ods_context->settings_context()->add_property(L"PositionTop", L"int", L"0");
// ods_context->settings_context()->add_property(L"PositionBottom", L"int", boost::lexical_cast<std::wstring>(ActiveCellY));
//}
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oShowRowColHeaders
.
IsInit
())
{
ods_context
->
settings_context
()
->
add_property
(
L"HasColumnRowHeaders"
,
L"boolean"
,
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oShowRowColHeaders
->
ToBool
()
?
L"true"
:
L"false"
);
...
...
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