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 {
...
@@ -189,6 +189,14 @@ namespace formulasconvert {
return
c1
+
(
c3
.
empty
()
?
L""
:
(
L":"
+
c3
)
);
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""
;
return
L""
;
}
}
std
::
wstring
odf2oox_converter
::
Impl
::
replace_named_ref_formater1
(
boost
::
wsmatch
const
&
what
)
std
::
wstring
odf2oox_converter
::
Impl
::
replace_named_ref_formater1
(
boost
::
wsmatch
const
&
what
)
...
@@ -216,10 +224,10 @@ namespace formulasconvert {
...
@@ -216,10 +224,10 @@ namespace formulasconvert {
void
odf2oox_converter
::
Impl
::
replace_cells_range
(
std
::
wstring
&
expr
,
bool
withTableName
)
void
odf2oox_converter
::
Impl
::
replace_cells_range
(
std
::
wstring
&
expr
,
bool
withTableName
)
{
{
convert_with_TableName
=
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
(
const
std
::
wstring
res
=
boost
::
regex_replace
(
...
@@ -235,7 +243,7 @@ namespace formulasconvert {
...
@@ -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}([^\\.]+?){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}"
);
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
(
const
std
::
wstring
res
=
boost
::
regex_replace
(
expr
,
expr
,
complexRef
,
complexRef
,
...
@@ -590,34 +598,37 @@ namespace formulasconvert {
...
@@ -590,34 +598,37 @@ namespace formulasconvert {
bool
isFormula
=
impl_
->
check_formula
(
workstr
);
bool
isFormula
=
impl_
->
check_formula
(
workstr
);
boost
::
wregex
complexRef
(
L"('(?!
\\
s
\\
'){0,1}.*?')"
);
// поиск того что в апострофах и замена там
if
(
isFormula
)
{
workstr
=
impl_
->
convert
(
expr
);
}
else
{
workstr
=
boost
::
regex_replace
(
boost
::
wregex
complexRef
(
L"('(?!
\\
s
\\
'){0,1}.*?')"
);
// поиск того что в апострофах и замена там
workstr
,
complexRef
,
&
replace_point_space
,
boost
::
match_default
|
boost
::
format_all
);
XmlUtils
::
replace_all
(
workstr
,
L"'"
,
L"APOSTROF"
);
workstr
=
boost
::
regex_replace
(
workstr
,
impl_
->
replace_cells_range
(
workstr
,
withTableName
);
complexRef
,
impl_
->
replace_semicolons
(
workstr
);
&
replace_point_space
,
impl_
->
replace_vertical
(
workstr
);
boost
::
match_default
|
boost
::
format_all
);
int
res_find
=
0
;
XmlUtils
::
replace_all
(
workstr
,
L"'"
,
L"APOSTROF"
)
;
if
((
res_find
=
workstr
.
find
(
L"CONCATINATE"
))
>
0
)
{
impl_
->
replace_cells_range
(
workstr
,
withTableName
);
//могут быть частично заданы диапазоны
impl_
->
replace_semicolons
(
workstr
);
//todooo
impl_
->
replace_vertical
(
workstr
);
}
int
res_find
=
0
;
XmlUtils
::
replace_all
(
workstr
,
L"PROBEL"
,
L" "
);
if
((
res_find
=
workstr
.
find
(
L"CONCATINATE"
))
>
0
)
XmlUtils
::
replace_all
(
workstr
,
L"APOSTROF"
,
L"'"
);
{
XmlUtils
::
replace_all
(
workstr
,
L"TOCHKA"
,
L"."
);
//могут быть частично заданы диапазоны
//todooo
if
(
!
isFormula
)
}
{
XmlUtils
::
replace_all
(
workstr
,
L"PROBEL"
,
L" "
);
workstr
=
L"
\"
"
+
workstr
+
L"
\"
"
;
XmlUtils
::
replace_all
(
workstr
,
L"APOSTROF"
,
L"'"
);
XmlUtils
::
replace_all
(
workstr
,
L"TOCHKA"
,
L"."
);
}
}
return
workstr
;
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