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
3a10eabf
Commit
3a10eabf
authored
Aug 31, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs after testing
parent
f9e80f36
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
40 deletions
+74
-40
ASCOfficeOdfFile/formulasconvert/formulasconvert.h
ASCOfficeOdfFile/formulasconvert/formulasconvert.h
+3
-0
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
+57
-30
Common/DocxFormat/Source/DocxFormat/Drawing/DrawingExt.cpp
Common/DocxFormat/Source/DocxFormat/Drawing/DrawingExt.cpp
+8
-6
Common/DocxFormat/Source/XlsxFormat/Workbook/ExternalReferences.h
...ocxFormat/Source/XlsxFormat/Workbook/ExternalReferences.h
+2
-0
Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h
...rmat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h
+1
-1
Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h
...Format/Source/XlsxFormat/Worksheets/WorksheetChildOther.h
+1
-1
XlsxSerializerCom/Writer/BinaryReader.h
XlsxSerializerCom/Writer/BinaryReader.h
+2
-2
No files found.
ASCOfficeOdfFile/formulasconvert/formulasconvert.h
View file @
3a10eabf
...
...
@@ -32,6 +32,7 @@
#pragma once
#include <string>
#include <vector>
#include "../include/cpdoccore/CPScopedPtr.h"
namespace
cpdoccore
{
...
...
@@ -58,6 +59,8 @@ public:
//Sheet2.C3:Sheet2.C19 -> Sheet2!C3:C19
std
::
wstring
convert_chart_distance
(
std
::
wstring
const
&
expr
);
void
split_distance_by
(
const
std
::
wstring
&
expr
,
const
std
::
wstring
&
by
,
std
::
vector
<
std
::
wstring
>&
out
);
std
::
wstring
convert_ref
(
std
::
wstring
const
&
expr
);
...
...
ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp
View file @
3a10eabf
...
...
@@ -32,7 +32,6 @@
#include "formulasconvert.h"
#include <boost/regex.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include"../../Common/DocxFormat/Source/XML/Utils.h"
...
...
@@ -46,6 +45,9 @@ namespace formulasconvert {
std
::
wstring
convert
(
const
std
::
wstring
&
expr
);
std
::
wstring
convert_chart_distance
(
const
std
::
wstring
&
expr
);
void
split_distance_by
(
const
std
::
wstring
&
expr
,
const
std
::
wstring
&
by
,
std
::
vector
<
std
::
wstring
>&
out
);
void
replace_cells_range
(
std
::
wstring
&
expr
,
bool
withTableName
);
bool
check_formula
(
std
::
wstring
&
expr
);
void
replace_semicolons
(
std
::
wstring
&
expr
);
...
...
@@ -189,7 +191,7 @@ namespace formulasconvert {
if
(
convert_with_TableName
)
{
return
(
sheet1
+
L"!"
)
+
c1
+
(
c
2
.
empty
()
?
L""
:
(
L":"
+
c3
)
);
return
(
sheet1
+
L"!"
)
+
c1
+
(
c
3
.
empty
()
?
L""
:
(
L":"
+
c3
)
);
}
else
{
...
...
@@ -389,25 +391,24 @@ namespace formulasconvert {
std
::
wstring
forbidden_formulas
[]
=
{
L"NULLFORMULA"
/*
L"BETADIST",
L"CEILING",
L"FLOOR",
L"RANK",
L"ROUND",
L"ROUNDDOWN",
L"ROUNDUP",
L"SUBTOTAL",
L"FORMULA",
L"ISREF"*/
L"NULLFORMULA"
//L"BETADIST",
//L"CEILING",
//L"FLOOR",
//L"RANK",
//L"ROUND",
//L"ROUNDDOWN",
//L"ROUNDUP",
//L"SUBTOTAL",
//L"FORMULA",
//L"ISREF"
};
bool
is_forbidden
(
const
std
::
wstring
&
formula
)
{
BOOST_FOREACH
(
const
std
::
wstring
&
s
,
forbidden_formulas
)
for
(
size_t
i
=
0
;
i
<
1
/*forbidden_formulas.size()*/
;
i
++
)
{
if
(
boost
::
algorithm
::
contains
(
formula
,
s
))
if
(
boost
::
algorithm
::
contains
(
formula
,
forbidden_formulas
[
i
]
))
return
true
;
}
return
false
;
...
...
@@ -490,10 +491,30 @@ namespace formulasconvert {
return
workstr
;
}
void
odf2oox_converter
::
Impl
::
split_distance_by
(
const
std
::
wstring
&
expr
,
const
std
::
wstring
&
by
,
std
::
vector
<
std
::
wstring
>&
out
)
{
std
::
wstring
workstr
=
expr
;
boost
::
wregex
complexRef
(
L"('(?!
\\
s
\\
'){0,1}.*?')"
);
// поиск того что в апострофах и замена там
workstr
=
boost
::
regex_replace
(
expr
,
complexRef
,
&
replace_point_space
,
boost
::
match_default
|
boost
::
format_all
);
boost
::
algorithm
::
split
(
out
,
workstr
,
boost
::
algorithm
::
is_any_of
(
by
),
boost
::
algorithm
::
token_compress_on
);
for
(
size_t
i
=
0
;
i
<
out
.
size
();
i
++
)
{
XmlUtils
::
replace_all
(
out
[
i
],
L"PROBEL"
,
L" "
);
XmlUtils
::
replace_all
(
out
[
i
],
L"TOCHKA"
,
L"."
);
}
}
//Sheet2.C3:Sheet2.C19 Sheet2.L29:Sheet2.L36
//в
//Sheet2!C3:C19,Sheet2!L27:L34
std
::
wstring
odf2oox_converter
::
Impl
::
convert_chart_distance
(
const
std
::
wstring
&
expr
)
{
if
(
is_forbidden
(
expr
))
...
...
@@ -515,25 +536,27 @@ namespace formulasconvert {
boost
::
algorithm
::
split
(
distance_inp
,
workstr
,
boost
::
algorithm
::
is_any_of
(
L" "
),
boost
::
algorithm
::
token_compress_on
);
BOOST_FOREACH
(
std
::
wstring
&
d
,
distance_inp
)
for
(
size_t
i
=
0
;
i
<
distance_inp
.
size
();
i
++
)
{
std
::
wstring
sheet
;
std
::
vector
<
std
::
wstring
>
range
;
std
::
vector
<
std
::
wstring
>
cells
;
boost
::
algorithm
::
split
(
range
,
d
,
boost
::
algorithm
::
is_any_of
(
L":"
),
boost
::
algorithm
::
token_compress_on
);
boost
::
algorithm
::
split
(
range
,
distance_inp
[
i
]
,
boost
::
algorithm
::
is_any_of
(
L":"
),
boost
::
algorithm
::
token_compress_on
);
BOOST_FOREACH
(
std
::
wstring
&
c
,
range
)
for
(
size_t
j
=
0
;
j
<
range
.
size
();
j
++
)
{
const
std
::
string
::
size_type
colon
=
c
.
find
(
'.'
);
cells
.
push_back
(
c
.
substr
(
colon
+
1
));
if
(
sheet
.
size
()
<
1
)
sheet
=
c
.
substr
(
0
,
colon
);
const
std
::
string
::
size_type
colon
=
range
[
j
].
find
(
'.'
);
cells
.
push_back
(
range
[
j
].
substr
(
colon
+
1
));
if
(
sheet
.
size
()
<
1
)
{
sheet
=
range
[
j
].
substr
(
0
,
colon
);
}
}
std
::
wstring
cells_out
;
BOOST_FOREACH
(
std
::
wstring
&
c
,
cells
)
for
(
size_t
j
=
0
;
j
<
cells
.
size
();
j
++
)
{
cells_out
.
append
(
c
);
cells_out
.
append
(
c
ells
[
j
]
);
cells_out
.
append
(
L":"
);
}
int
res1
=
sheet
.
find
(
L"-"
);
...
...
@@ -544,19 +567,19 @@ namespace formulasconvert {
sheet
=
L"'"
+
sheet
+
L"'"
;
}
distance_out
.
push_back
(
sheet
+
L"!"
+
cells_out
.
substr
(
0
,
cells_out
.
size
()
-
1
));
distance_out
.
push_back
(
sheet
+
L"!"
+
cells_out
.
substr
(
0
,
cells_out
.
size
()
-
1
));
}
std
::
wstring
result
;
BOOST_FOREACH
(
std
::
wstring
&
d
,
distance_out
)
for
(
size_t
i
=
0
;
i
<
distance_out
.
size
();
i
++
)
{
result
.
append
(
d
);
result
.
append
(
d
istance_out
[
i
]
);
result
.
append
(
L","
);
}
XmlUtils
::
replace_all
(
result
,
L"PROBEL"
,
L" "
);
XmlUtils
::
replace_all
(
result
,
L"TOCHKA"
,
L"."
);
XmlUtils
::
replace_all
(
result
,
L"TOCHKA"
,
L"."
);
return
result
.
substr
(
0
,
result
.
size
()
-
1
);
// минус последняя лишняя запятая
return
result
.
substr
(
0
,
result
.
size
()
-
1
);
// минус последняя лишняя запятая
}
odf2oox_converter
::
odf2oox_converter
()
:
impl_
(
new
odf2oox_converter
::
Impl
)
{
...
...
@@ -579,6 +602,10 @@ namespace formulasconvert {
{
return
impl_
->
convert_chart_distance
(
expr
);
}
void
odf2oox_converter
::
split_distance_by
(
const
std
::
wstring
&
expr
,
const
std
::
wstring
&
by
,
std
::
vector
<
std
::
wstring
>&
out
)
{
return
impl_
->
split_distance_by
(
expr
,
by
,
out
);
}
std
::
wstring
odf2oox_converter
::
convert_named_ref
(
const
std
::
wstring
&
expr
,
bool
withTableName
,
std
::
wstring
separator
)
{
boost
::
wregex
complexRef
(
L"('(?!
\\
s
\\
'){0,1}.*?')"
);
// поиск того что в апострофах и замена там
...
...
Common/DocxFormat/Source/DocxFormat/Drawing/DrawingExt.cpp
View file @
3a10eabf
...
...
@@ -111,16 +111,18 @@ namespace OOX
std
::
wstring
sResult
=
_T
(
"<"
);
sResult
+=
sNamespace
;
sResult
+=
_T
(
"ext"
);
sResult
+=
m_sAdditionalNamespace
;
if
(
m_sUri
.
IsInit
()
)
{
sResult
+=
_T
(
" uri=
\"
"
);
sResult
+=
m_sUri
.
get2
();
sResult
+=
_T
(
"
\"
>"
);
sResult
+=
L" uri=
\"
"
+
m_sUri
.
get2
()
+
L"
\"
"
;
}
else
sResult
+=
_T
(
">"
);
if
(
!
m_sAdditionalNamespace
.
empty
())
{
sResult
+=
L" "
+
m_sAdditionalNamespace
;
}
sResult
+=
_T
(
">"
);
if
(
m_oCompatExt
.
IsInit
())
{
...
...
Common/DocxFormat/Source/XlsxFormat/Workbook/ExternalReferences.h
View file @
3a10eabf
...
...
@@ -110,6 +110,8 @@ namespace OOX
}
virtual
void
toXML
(
NSStringUtils
::
CStringBuilder
&
writer
)
const
{
if
(
m_arrItems
.
empty
())
return
;
writer
.
WriteString
(
_T
(
"<externalReferences>"
));
for
(
size_t
i
=
0
,
length
=
m_arrItems
.
size
();
i
<
length
;
++
i
)
...
...
Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h
View file @
3a10eabf
...
...
@@ -67,7 +67,7 @@ namespace OOX
WritingStringAttrString
(
L"type"
,
m_oType
->
ToString
());
if
(
m_oGte
.
IsInit
()
&&
false
==
m_oGte
->
ToBool
())
writer
.
WriteString
(
L" gte=
\"
0
\"
"
);
WritingStringNullableAttrString
(
L"val"
,
m_oVal
,
m_oVal
.
get
());
WritingStringNullableAttr
EncodeXml
String
(
L"val"
,
m_oVal
,
m_oVal
.
get
());
writer
.
WriteString
(
_T
(
"/>"
));
}
}
...
...
Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h
View file @
3a10eabf
...
...
@@ -433,8 +433,8 @@ namespace OOX
writer
.
WriteString
(
_T
(
"<selection"
));
WritingStringNullableAttrString
(
L"activeCell"
,
m_oActiveCell
,
m_oActiveCell
.
get
());
WritingStringNullableAttrInt
(
L"activeCellId"
,
m_oActiveCellId
,
m_oActiveCellId
->
GetValue
());
WritingStringNullableAttrString
(
L"sqref"
,
m_oSqref
,
m_oSqref
.
get
());
WritingStringNullableAttrString
(
L"pane"
,
m_oPane
,
m_oPane
->
ToString
());
WritingStringNullableAttrString
(
L"sqref"
,
m_oSqref
,
m_oSqref
.
get
());
writer
.
WriteString
(
_T
(
"/>"
));
}
virtual
void
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
...
...
XlsxSerializerCom/Writer/BinaryReader.h
View file @
3a10eabf
...
...
@@ -212,7 +212,7 @@ namespace BinXlsxRW {
pOfficeArtExtension
->
m_sUri
.
Init
();
pOfficeArtExtension
->
m_sUri
->
append
(
_T
(
"{504A1905-F514-4f6f-8877-14C23A59335A}"
));
pOfficeArtExtension
->
m_sAdditionalNamespace
=
_T
(
"
xmlns:x14=
\"
http://schemas.microsoft.com/office/spreadsheetml/2009/9/main
\"
"
);
pOfficeArtExtension
->
m_sAdditionalNamespace
=
_T
(
"xmlns:x14=
\"
http://schemas.microsoft.com/office/spreadsheetml/2009/9/main
\"
"
);
pTable
->
m_oExtLst
.
Init
();
pTable
->
m_oExtLst
->
m_arrExt
.
push_back
(
pOfficeArtExtension
);
}
...
...
@@ -2580,7 +2580,7 @@ namespace BinXlsxRW {
pOfficeArtExtension
->
m_sUri
.
Init
();
pOfficeArtExtension
->
m_sUri
->
append
(
_T
(
"{05C60535-1F16-4fd2-B633-F4F36F0B64E0}"
));
pOfficeArtExtension
->
m_sAdditionalNamespace
=
_T
(
"
xmlns:x14=
\"
http://schemas.microsoft.com/office/spreadsheetml/2009/9/main
\"
"
);
pOfficeArtExtension
->
m_sAdditionalNamespace
=
_T
(
"xmlns:x14=
\"
http://schemas.microsoft.com/office/spreadsheetml/2009/9/main
\"
"
);
m_pCurWorksheet
->
m_oExtLst
.
Init
();
m_pCurWorksheet
->
m_oExtLst
->
m_arrExt
.
push_back
(
pOfficeArtExtension
);
}
...
...
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