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
ed59c2b9
Commit
ed59c2b9
authored
Aug 09, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
925bca71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
27 deletions
+38
-27
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
+38
-27
No files found.
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
View file @
ed59c2b9
...
...
@@ -189,6 +189,14 @@ namespace formulasconvert {
return
c1
+
(
c3
.
empty
()
?
L""
:
(
L":"
+
c3
)
);
}
}
else
if
(
sz
==
5
&&
!
what
[
1
].
matched
)
{
const
std
::
wstring
c1
=
what
[
2
].
str
();
const
std
::
wstring
c2
=
what
[
3
].
str
();
//sheet name 2
const
std
::
wstring
c3
=
what
[
4
].
str
();
return
c1
+
(
c3
.
empty
()
?
L""
:
(
L":"
+
c3
)
);
}
return
L""
;
}
std
::
wstring
odf2oox_converter
::
Impl
::
replace_named_ref_formater1
(
boost
::
wsmatch
const
&
what
)
...
...
@@ -216,10 +224,10 @@ namespace formulasconvert {
void
odf2oox_converter
::
Impl
::
replace_cells_range
(
std
::
wstring
&
expr
,
bool
withTableName
)
{
convert_with_TableName
=
withTableName
;
//boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
boost
::
wregex
complexRef
(
L"
\\
[(?:
\
\
$)?([^
\\
.]+?){0,1}
\\
.(
\\
${0,1}[a-zA-Z]*
\\
${0,1}
\\
d*)(?::
\\
.(
\\
${0,1}[a-zA-Z]*
\\
${0,1}
\\
d*)){0,1}
\\
]"
);
boost
::
wregex
complexRef
(
L"
\\
[(?:\
$)?([^
\\
.]+?){0,1}
\\
.(
\\
${0,1}[a-zA-Z]*
\\
${0,1}
\\
d*)(?::(
\\
${0,1}[^
\\
.]+?){0,1}
\\
.(
\\
${0,1}[a-zA-Z]*
\\
${0,1}
\\
d*)){0,1}
\\
]"
);
/*
[ $ Sheet2 . A1
:
. B5 ]
[ $ Sheet2 . A1
: ( $ Sheet2)?
. B5 ]
*/
const
std
::
wstring
res
=
boost
::
regex_replace
(
...
...
@@ -235,7 +243,7 @@ namespace formulasconvert {
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost
::
wregex
complexRef
(
L"
\\
${0,1}([^
\\
.
\\
s]+?){0,1}
\\
.(
\\
${0,1}[a-zA-Z]*
\\
${0,1}
\\
d*)(?::
\\
${0,1}([^
\\
.
\\
s]+?){0,1}
\\
.(
\\
${0,1}[a-zA-Z]*
\\
${0,1}
\\
d*)){0,1}"
);
const
std
::
wstring
res
=
boost
::
regex_replace
(
expr
,
complexRef
,
...
...
@@ -590,34 +598,37 @@ namespace formulasconvert {
bool
isFormula
=
impl_
->
check_formula
(
workstr
);
boost
::
wregex
complexRef
(
L"('(?!
\\
s
\\
'){0,1}.*?')"
);
// поиск того что в апострофах и замена там
if
(
isFormula
)
{
workstr
=
impl_
->
convert
(
expr
);
}
else
{
workstr
=
boost
::
regex_replace
(
workstr
,
complexRef
,
&
replace_point_space
,
boost
::
match_default
|
boost
::
format_all
);
boost
::
wregex
complexRef
(
L"('(?!
\\
s
\\
'){0,1}.*?')"
);
// поиск того что в апострофах и замена там
XmlUtils
::
replace_all
(
workstr
,
L"'"
,
L"APOSTROF"
);
impl_
->
replace_cells_range
(
workstr
,
withTableName
);
impl_
->
replace_semicolons
(
workstr
);
impl_
->
replace_vertical
(
workstr
);
workstr
=
boost
::
regex_replace
(
workstr
,
complexRef
,
&
replace_point_space
,
boost
::
match_default
|
boost
::
format_all
);
int
res_find
=
0
;
if
((
res_find
=
workstr
.
find
(
L"CONCATINATE"
))
>
0
)
{
//могут быть частично заданы диапазоны
//todooo
XmlUtils
::
replace_all
(
workstr
,
L"'"
,
L"APOSTROF"
)
;
impl_
->
replace_cells_range
(
workstr
,
withTableName
);
impl_
->
replace_semicolons
(
workstr
);
impl_
->
replace_vertical
(
workstr
);
}
XmlUtils
::
replace_all
(
workstr
,
L"PROBEL"
,
L" "
);
XmlUtils
::
replace_all
(
workstr
,
L"APOSTROF"
,
L"'"
);
XmlUtils
::
replace_all
(
workstr
,
L"TOCHKA"
,
L"."
);
int
res_find
=
0
;
if
((
res_find
=
workstr
.
find
(
L"CONCATINATE"
))
>
0
)
{
//могут быть частично заданы диапазоны
//todooo
if
(
!
isFormula
)
{
workstr
=
L"
\"
"
+
workstr
+
L"
\"
"
;
}
XmlUtils
::
replace_all
(
workstr
,
L"PROBEL"
,
L" "
);
XmlUtils
::
replace_all
(
workstr
,
L"APOSTROF"
,
L"'"
);
XmlUtils
::
replace_all
(
workstr
,
L"TOCHKA"
,
L"."
);
}
return
workstr
;
}
...
...
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