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
a88ad0c2
Commit
a88ad0c2
authored
Jul 14, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XlsFormat - fix calculations in pivot tables
parent
cf5458c7
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
84 additions
and
109 deletions
+84
-109
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.cpp
+1
-16
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.h
+1
-3
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.cpp
+0
-12
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.h
+0
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp
...XlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp
+0
-12
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.h
...ceXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.h
+0
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxBool.cpp
...ceXlsFile2/source/XlsFormat/Logic/Biff_records/SxBool.cpp
+0
-14
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxBool.h
...ficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxBool.h
+0
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxErr.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxErr.h
+0
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.cpp
+0
-9
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.h
+0
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgSxName.cpp
...ile2/source/XlsFormat/Logic/Biff_structures/PtgSxName.cpp
+1
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHE.cpp
...lsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHE.cpp
+44
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.cpp
+30
-29
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.h
+5
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.cpp
...ceXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.cpp
+2
-2
No files found.
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.cpp
View file @
a88ad0c2
...
...
@@ -39,7 +39,6 @@ SXDtr::SXDtr()
{
}
SXDtr
::~
SXDtr
()
{
}
...
...
@@ -54,7 +53,7 @@ void SXDtr::readFields(CFRecord& record)
record
>>
yr
>>
mon
>>
dom
>>
hr
>>
min
>>
sec
;
}
std
::
wstring
SXDtr
::
get_string_dat
e
()
std
::
wstring
SXDtr
::
valu
e
()
{
std
::
wstringstream
s
;
s
<<
yr
<<
L"-"
<<
(
mon
<
10
?
L"0"
:
L""
)
<<
mon
<<
L"-"
<<
(
dom
<
10
?
L"0"
:
L""
)
<<
dom
<<
L"T"
...
...
@@ -63,19 +62,5 @@ std::wstring SXDtr::get_string_date()
return
s
.
str
();
}
int
SXDtr
::
serialize
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"d"
)
{
CP_XML_ATTR
(
L"v"
,
get_string_date
());
}
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.h
View file @
a88ad0c2
...
...
@@ -48,8 +48,6 @@ public:
void
readFields
(
CFRecord
&
record
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSXDtr
;
unsigned
short
yr
;
...
...
@@ -59,7 +57,7 @@ public:
unsigned
char
min
;
unsigned
char
sec
;
std
::
wstring
get_string_dat
e
();
std
::
wstring
valu
e
();
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.cpp
View file @
a88ad0c2
...
...
@@ -53,17 +53,5 @@ void SXNum::readFields(CFRecord& record)
record
>>
num
;
}
int
SXNum
::
serialize
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"n"
)
{
CP_XML_ATTR
(
L"v"
,
num
.
data
.
value
);
}
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.h
View file @
a88ad0c2
...
...
@@ -49,8 +49,6 @@ public:
void
readFields
(
CFRecord
&
record
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSXNum
;
Xnum
num
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp
View file @
a88ad0c2
...
...
@@ -59,18 +59,6 @@ void SXString::readFields(CFRecord& record)
record
>>
segment
;
}
}
int
SXString
::
serialize
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"s"
)
{
CP_XML_ATTR
(
L"v"
,
segment
.
value
());
}
}
return
0
;
}
std
::
wstring
SXString
::
value
()
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.h
View file @
a88ad0c2
...
...
@@ -51,8 +51,6 @@ public:
std
::
wstring
value
();
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSXString
;
unsigned
short
cch
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxBool.cpp
View file @
a88ad0c2
...
...
@@ -39,7 +39,6 @@ SxBool::SxBool()
{
}
SxBool
::~
SxBool
()
{
}
...
...
@@ -56,18 +55,5 @@ void SxBool::readFields(CFRecord& record)
val
=
(
flags
!=
0
);
}
int
SxBool
::
serialize
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"b"
)
{
CP_XML_ATTR
(
L"v"
,
val
);
}
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxBool.h
View file @
a88ad0c2
...
...
@@ -48,8 +48,6 @@ public:
void
readFields
(
CFRecord
&
record
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSxBool
;
bool
val
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxErr.h
View file @
a88ad0c2
...
...
@@ -32,7 +32,6 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/CellRangeRef.h"
namespace
XLS
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.cpp
View file @
a88ad0c2
...
...
@@ -52,14 +52,5 @@ void SxNil::readFields(CFRecord& record)
{
}
int
SxNil
::
serialize
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"m"
);
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.h
View file @
a88ad0c2
...
...
@@ -48,8 +48,6 @@ public:
void
readFields
(
CFRecord
&
record
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSxNil
;
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgSxName.cpp
View file @
a88ad0c2
...
...
@@ -100,7 +100,7 @@ void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
SXOPER
*
cache
=
dynamic_cast
<
SXOPER
*>
(
field
->
m_arSRCSXOPER
[
pair
->
iCache
].
get
());
if
(
cache
)
{
_Name
+=
L"["
+
cache
->
get_value
()
+
L"]"
;
_Name
+=
L"["
+
cache
->
value
+
L"]"
;
}
}
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHE.cpp
View file @
a88ad0c2
...
...
@@ -35,10 +35,15 @@
#include "SXFORMULA_bu.h"
#include "FDB.h"
#include "DBB.h"
#include "SXOPER.h"
#include "PRFILTER.h"
#include "PIVOTRULE.h"
#include "../Biff_records/SXDB.h"
#include "../Biff_records/SXDBEx.h"
#include "../Biff_records/EOF.h"
#include "../Biff_records/SxItm.h"
#include "../Biff_records/SxFilt.h"
namespace
XLS
{
...
...
@@ -105,6 +110,45 @@ const bool PIVOTCACHE::loadContent(BinProcessor& proc)
{
elements_
.
pop_back
();
}
//--------------------------------------------------------------------------------------------------------------------
for
(
size_t
i
=
0
;
i
<
m_arSXFORMULA
.
size
();
i
++
)
{
SXFORMULA
*
formula
=
dynamic_cast
<
SXFORMULA
*>
(
m_arSXFORMULA
[
i
].
get
());
if
(
!
formula
)
continue
;
PIVOTRULE
*
pivot_rule
=
dynamic_cast
<
PIVOTRULE
*>
(
formula
->
m_PIVOTRULE
.
get
());
if
(
!
pivot_rule
)
continue
;
for
(
size_t
j
=
0
;
j
<
pivot_rule
->
m_arPRFILTER
.
size
();
j
++
)
{
PRFILTER
*
filter
=
dynamic_cast
<
PRFILTER
*>
(
pivot_rule
->
m_arPRFILTER
[
j
].
get
());
if
(
!
filter
)
continue
;
SxItm
*
item
=
dynamic_cast
<
SxItm
*>
(
filter
->
m_SxItm
.
get
());
SxFilt
*
filt
=
dynamic_cast
<
SxFilt
*>
(
filter
->
m_SxFilt
.
get
());
for
(
size_t
i
=
0
;
(
item
&&
filt
)
&&
i
<
item
->
rgisxvi
.
size
();
i
++
)
{
short
index_cache
=
filt
->
isxvd
;
short
index_item
=
item
->
rgisxvi
[
i
];
if
(
index_cache
>=
0
&&
index_cache
<
m_arFDB
.
size
())
{
FDB
*
field
=
dynamic_cast
<
FDB
*>
(
m_arFDB
[
index_cache
].
get
());
if
(
field
)
{
if
(
index_item
>=
0
&&
index_item
<
field
->
m_arSRCSXOPER
.
size
())
{
SXOPER
*
cache
=
dynamic_cast
<
SXOPER
*>
(
field
->
m_arSRCSXOPER
[
index_item
].
get
());
if
(
cache
)
{
cache
->
bFormula
=
true
;
}
}
}
}
}
}
}
return
true
;
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.cpp
View file @
a88ad0c2
...
...
@@ -43,6 +43,8 @@ namespace XLS
SXOPER
::
SXOPER
()
{
bFormula
=
false
;
bString
=
false
;
bDate
=
false
;
bNumber
=
false
;
...
...
@@ -66,10 +68,10 @@ const bool SXOPER::loadContent(BinProcessor& proc)
if
(
proc
.
optional
<
SxNil
>
())
{
bEmpty
=
true
;
node
=
L"m"
;
}
else
if
(
proc
.
optional
<
SXNum
>
())
{
SXNum
*
num
=
dynamic_cast
<
SXNum
*>
(
elements_
.
back
().
get
());
if
(
num
)
{
...
...
@@ -79,22 +81,36 @@ const bool SXOPER::loadContent(BinProcessor& proc)
num
->
num
.
data
.
bytes
.
Byte4
==
0
);
}
bNumber
=
!
bInteger
;
node
=
L"n"
;
value
=
std
::
to_wstring
(
num
->
num
.
data
.
value
);
}
else
if
(
proc
.
optional
<
SxBool
>
())
{
bBool
=
true
;
SxBool
*
b
=
dynamic_cast
<
SxBool
*>
(
elements_
.
back
().
get
());
bBool
=
true
;
node
=
L"b"
;
value
=
std
::
to_wstring
(
b
->
val
);
}
else
if
(
proc
.
optional
<
SxErr
>
())
{
SxErr
*
err
=
dynamic_cast
<
SxErr
*>
(
elements_
.
back
().
get
());
bNumber
=
true
;
node
=
L"e"
;
value
=
std
::
to_wstring
(
err
->
wbe
);
}
else
if
(
proc
.
optional
<
SXString
>
())
{
SXString
*
str
=
dynamic_cast
<
SXString
*>
(
elements_
.
back
().
get
());
bString
=
true
;
node
=
L"s"
;
value
=
str
->
value
();
}
else
if
(
proc
.
optional
<
SXDtr
>
())
{
bDate
=
true
;
SXDtr
*
dtr
=
dynamic_cast
<
SXDtr
*>
(
elements_
.
back
().
get
());
bDate
=
true
;
node
=
L"d"
;
value
=
dtr
->
value
();
}
else
return
false
;
...
...
@@ -102,44 +118,29 @@ const bool SXOPER::loadContent(BinProcessor& proc)
m_element
=
elements_
.
back
();
elements_
.
pop_back
();
return
true
;
}
int
SXOPER
::
serialize
(
std
::
wostream
&
strm
)
{
if
(
!
m_element
)
return
0
;
if
(
node
.
empty
())
return
0
;
m_element
->
serialize
(
strm
);
return
0
;
}
std
::
wstring
SXOPER
::
get_value
()
{
std
::
wstring
value
;
SXNum
*
num
=
dynamic_cast
<
SXNum
*>
(
m_element
.
get
());
if
(
num
)
CP_XML_WRITER
(
strm
)
{
value
=
std
::
to_wstring
(
num
->
num
.
data
.
value
);
}
else
{
SXString
*
str
=
dynamic_cast
<
SXString
*>
(
m_element
.
get
());
if
(
str
)
{
value
=
str
->
segment
.
value
();
}
else
{
SXDtr
*
dtr
=
dynamic_cast
<
SXDtr
*>
(
m_element
.
get
());
if
(
dtr
)
CP_XML_NODE
(
node
)
{
if
(
!
value
.
empty
())
{
value
=
dtr
->
get_string_date
(
);
CP_XML_ATTR
(
L"v"
,
value
);
}
else
if
(
bFormula
)
{
CP_XML_ATTR
(
L"f"
,
1
);
}
}
}
}
return
value
;
return
0
;
}
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.h
View file @
a88ad0c2
...
...
@@ -49,18 +49,21 @@ public:
int
serialize
(
std
::
wostream
&
strm
);
std
::
wstring
get_value
();
static
const
ElementType
type
=
typeSXOPER
;
BaseObjectPtr
m_element
;
bool
bFormula
;
bool
bString
;
bool
bDate
;
bool
bNumber
;
bool
bEmpty
;
bool
bInteger
;
bool
bBool
;
std
::
wstring
value
;
std
::
wstring
node
;
};
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.cpp
View file @
a88ad0c2
...
...
@@ -140,8 +140,8 @@ int SXRANGE::serialize(std::wostream & strm)
SXDtr
*
startDate
=
dynamic_cast
<
SXDtr
*>
(
m_arSXDtr
[
0
].
get
());
SXDtr
*
endDate
=
dynamic_cast
<
SXDtr
*>
(
m_arSXDtr
[
1
].
get
());
CP_XML_ATTR
(
L"startDate"
,
startDate
->
get_string_dat
e
());
CP_XML_ATTR
(
L"endDate"
,
endDate
->
get_string_dat
e
());
CP_XML_ATTR
(
L"startDate"
,
startDate
->
valu
e
());
CP_XML_ATTR
(
L"endDate"
,
endDate
->
valu
e
());
}
if
(
m_arSXNum
.
size
()
==
3
)
{
...
...
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