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
ef8e5cab
Commit
ef8e5cab
authored
Jul 02, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XlsFormat ...
parent
028e58ad
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
540 additions
and
110 deletions
+540
-110
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.cpp
+16
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.h
+2
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.cpp
+12
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.h
+2
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp
...XlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp
+12
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.h
...ceXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.h
+2
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.cpp
+9
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.h
+2
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/DREF.cpp
...fficeXlsFile2/source/XlsFormat/Logic/Biff_unions/DREF.cpp
+34
-3
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/DREF.h
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/DREF.h
+5
-3
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FDB.cpp
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FDB.cpp
+127
-19
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FDB.h
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FDB.h
+2
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/GLOBALS.h
...ficeXlsFile2/source/XlsFormat/Logic/Biff_unions/GLOBALS.h
+1
-3
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHE.cpp
...lsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHE.cpp
+0
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.cpp
...urce/XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.cpp
+97
-4
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.h
...source/XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.h
+5
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.cpp
+9
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.h
+4
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.cpp
...ceXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.cpp
+59
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.h
...ficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.h
+6
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXSRC.cpp
...ficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXSRC.cpp
+8
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXSRC.h
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXSRC.h
+3
-1
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
+5
-11
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp
...File2/source/XlsXlsxConverter/xlsx_conversion_context.cpp
+8
-29
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h
...lsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h
+3
-6
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_pivots_context.cpp
...eXlsFile2/source/XlsXlsxConverter/xlsx_pivots_context.cpp
+95
-0
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_pivots_context.h
...iceXlsFile2/source/XlsXlsxConverter/xlsx_pivots_context.h
+8
-17
ASCOfficeXlsFile2/source/linux/XlsFormatLib.pro
ASCOfficeXlsFile2/source/linux/XlsFormatLib.pro
+2
-2
ASCOfficeXlsFile2/source/win32/XlsXlsxConverter.vcproj
ASCOfficeXlsFile2/source/win32/XlsXlsxConverter.vcproj
+2
-2
No files found.
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.cpp
View file @
ef8e5cab
...
...
@@ -54,5 +54,21 @@ void SXDtr::readFields(CFRecord& record)
record
>>
yr
>>
mon
>>
dom
>>
hr
>>
min
>>
sec
;
}
int
SXDtr
::
serialize
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"d"
)
{
std
::
wstringstream
s
;
s
<<
yr
<<
L"-"
<<
mon
<<
L"-"
<<
dom
<<
L"T"
<<
hr
<<
L":"
<<
min
<<
L":"
<<
sec
;
CP_XML_ATTR
(
L"v"
,
s
.
str
());
}
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXDtr.h
View file @
ef8e5cab
...
...
@@ -32,7 +32,6 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/CellRangeRef.h"
namespace
XLS
{
...
...
@@ -49,6 +48,8 @@ public:
void
readFields
(
CFRecord
&
record
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSXDtr
;
unsigned
short
yr
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXNum.cpp
View file @
ef8e5cab
...
...
@@ -39,7 +39,6 @@ SXNum::SXNum()
{
}
SXNum
::~
SXNum
()
{
}
...
...
@@ -54,5 +53,17 @@ 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 @
ef8e5cab
...
...
@@ -49,6 +49,8 @@ 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 @
ef8e5cab
...
...
@@ -61,6 +61,17 @@ 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
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.h
View file @
ef8e5cab
...
...
@@ -49,6 +49,8 @@ public:
void
readFields
(
CFRecord
&
record
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSXString
;
unsigned
short
cch
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SxNil.cpp
View file @
ef8e5cab
...
...
@@ -39,7 +39,6 @@ SxNil::SxNil()
{
}
SxNil
::~
SxNil
()
{
}
...
...
@@ -53,5 +52,14 @@ 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 @
ef8e5cab
...
...
@@ -48,6 +48,8 @@ public:
void
readFields
(
CFRecord
&
record
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSxNil
;
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/DREF.cpp
View file @
ef8e5cab
...
...
@@ -43,18 +43,15 @@ DREF::DREF()
{
}
DREF
::~
DREF
()
{
}
BaseObjectPtr
DREF
::
clone
()
{
return
BaseObjectPtr
(
new
DREF
(
*
this
));
}
// DREF = DConName / DConBin / DConRef
const
bool
DREF
::
loadContent
(
BinProcessor
&
proc
)
{
...
...
@@ -68,8 +65,42 @@ const bool DREF::loadContent(BinProcessor& proc)
}
}
}
m_DCon
=
elements_
.
back
();
elements_
.
pop_back
();
return
true
;
}
int
DREF
::
serialize
(
std
::
wostream
&
strm
)
{
if
(
!
m_DCon
)
return
0
;
DConName
*
name
=
dynamic_cast
<
DConName
*>
(
m_DCon
.
get
());
DConBin
*
bin
=
dynamic_cast
<
DConBin
*>
(
m_DCon
.
get
());
DConRef
*
ref
=
dynamic_cast
<
DConRef
*>
(
m_DCon
.
get
());
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"cacheSource"
)
{
if
(
name
)
{
CP_XML_ATTR
(
L"type"
,
L"worksheet"
);
CP_XML_NODE
(
L"worksheetSource"
)
{
CP_XML_ATTR
(
L"name"
,
name
->
stName
.
value
());
}
}
else
if
(
bin
)
{
}
else
if
(
ref
)
{
}
}
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/DREF.h
View file @
ef8e5cab
...
...
@@ -36,8 +36,6 @@
namespace
XLS
{
// Logical representation of DREF union of records
class
DREF
:
public
CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME
(
DREF
)
...
...
@@ -49,7 +47,11 @@ public:
virtual
const
bool
loadContent
(
BinProcessor
&
proc
);
int
serialize
(
std
::
wostream
&
stream
);
static
const
ElementType
type
=
typeDREF
;
BaseObjectPtr
m_DCon
;
};
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FDB.cpp
View file @
ef8e5cab
...
...
@@ -47,6 +47,10 @@ class Parenthesis_FDB: public ABNFParenthesis
{
BASE_OBJECT_DEFINE_CLASS_NAME
(
Parenthesis_FDB
)
public:
Parenthesis_FDB
(
int
count
=
0
)
{
m_count
=
count
;
}
BaseObjectPtr
clone
()
{
return
BaseObjectPtr
(
new
Parenthesis_FDB
(
*
this
));
...
...
@@ -54,7 +58,9 @@ public:
const
bool
loadContent
(
BinProcessor
&
proc
)
{
int
count
=
proc
.
repeated
<
SXOPER
>
(
0
,
0
);
if
(
m_count
<
1
)
return
false
;
int
count
=
proc
.
repeated
<
SXOPER
>
(
0
,
m_count
);
if
(
!
proc
.
optional
<
SXRANGE
>
())
{
...
...
@@ -62,6 +68,8 @@ public:
}
return
true
;
};
private:
int
m_count
;
};
FDB
::
FDB
()
...
...
@@ -92,6 +100,8 @@ const bool FDB::loadContent(BinProcessor& proc)
m_SXFDB
=
elements_
.
back
();
elements_
.
pop_back
();
SXFDB
*
fdb
=
dynamic_cast
<
SXFDB
*>
(
m_SXFDB
.
get
());
if
(
proc
.
mandatory
<
SXFDBType
>
())
{
m_SXFDBType
=
elements_
.
back
();
...
...
@@ -103,7 +113,11 @@ const bool FDB::loadContent(BinProcessor& proc)
m_SXFMLA
=
elements_
.
back
();
elements_
.
pop_back
();
}
else
if
(
proc
.
optional
<
Parenthesis_FDB
>
())
else
{
Parenthesis_FDB
parenthesis_FDB
(
fdb
->
csxoper
);
if
(
proc
.
optional
(
parenthesis_FDB
))
{
int
count
=
elements_
.
size
();
...
...
@@ -130,6 +144,7 @@ const bool FDB::loadContent(BinProcessor& proc)
count
--
;
}
}
}
int
count
=
proc
.
repeated
<
SXOPER
>
(
0
,
0
);
while
(
count
--
)
...
...
@@ -140,5 +155,98 @@ const bool FDB::loadContent(BinProcessor& proc)
return
true
;
}
int
FDB
::
serialize
(
std
::
wostream
&
strm
)
{
SXFDB
*
fdb
=
dynamic_cast
<
SXFDB
*>
(
m_SXFDB
.
get
());
SXFDBType
*
fdb_type
=
dynamic_cast
<
SXFDBType
*>
(
m_SXFDBType
.
get
());
if
(
!
fdb
||
!
fdb_type
)
return
0
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"cacheField"
)
{
CP_XML_ATTR
(
L"name"
,
fdb
->
stFieldName
.
value
());
CP_XML_ATTR
(
L"numFmtId"
,
fdb_type
->
wTypeSql
);
switch
(
fdb_type
->
wTypeSql
)
//format code
{
case
0x0000
:
case
0x0001
:
case
0x0003
:
case
0x0004
:
case
0x0005
:
case
0x0006
:
case
0x0007
:
case
0x0008
:
case
0x000B
:
case
0x000C
:
case
0xFFF9
:
case
0xFFFE
:
break
;
}
if
(
m_SXFMLA
)
{
//{formula
}
//caption, databaseFields, ..
if
(
m_arSRCSXOPER
.
empty
()
==
false
)
{
CP_XML_NODE
(
L"sharedItems"
)
{
//CP_XML_ATTR(L"containsSemiMixedTypes", 0);
CP_XML_ATTR
(
L"containsNonDate"
,
fdb
->
fNonDates
);
CP_XML_ATTR
(
L"containsDate"
,
fdb
->
fDateInField
);
CP_XML_ATTR
(
L"containsNumber"
,
fdb
->
fNumField
);
CP_XML_ATTR
(
L"containsBlank"
,
fdb
->
fTextEtcField
);
//CP_XML_ATTR(L"containsString", 0);
if
(
fdb
->
fnumMinMaxValid
)
{
if
(
fdb
->
fDateInField
)
{
CP_XML_ATTR
(
L"minDate"
,
0
);
// "2007-11-18T00:00:00"
CP_XML_ATTR
(
L"maxDate"
,
0
);
// "2007-12-25T00:00:00"
}
else
if
(
fdb
->
fNumField
)
{
CP_XML_ATTR
(
L"minValue"
,
0
);
CP_XML_ATTR
(
L"maxValue"
,
0
);
}
}
CP_XML_ATTR
(
L"count"
,
fdb
->
catm
);
for
(
size_t
i
=
0
;
i
<
m_arSRCSXOPER
.
size
();
i
++
)
{
m_arSRCSXOPER
[
i
]
->
serialize
(
CP_XML_STREAM
());
}
}
}
if
(
m_arGRPSXOPER
.
empty
()
==
false
)
{
CP_XML_NODE
(
L"fieldGroup"
)
{
if
(
fdb
->
ifdbParent
>
0
)
CP_XML_ATTR
(
L"par"
,
fdb
->
ifdbParent
);
if
(
m_SXRANGE
)
m_SXRANGE
->
serialize
(
CP_XML_STREAM
());
CP_XML_NODE
(
L"groupItems"
)
{
CP_XML_ATTR
(
L"count"
,
m_arGRPSXOPER
.
size
());
for
(
size_t
i
=
0
;
i
<
m_arGRPSXOPER
.
size
();
i
++
)
{
m_arGRPSXOPER
[
i
]
->
serialize
(
CP_XML_STREAM
());
}
}
}
}
}
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FDB.h
View file @
ef8e5cab
...
...
@@ -47,6 +47,8 @@ public:
virtual
const
bool
loadContent
(
BinProcessor
&
proc
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeFDB
;
BaseObjectPtr
m_SXFDB
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/GLOBALS.h
View file @
ef8e5cab
...
...
@@ -36,8 +36,6 @@
namespace
XLS
{
// Logical representation of GLOBALS union of records
class
GLOBALS
:
public
CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME
(
GLOBALS
)
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHE.cpp
View file @
ef8e5cab
...
...
@@ -47,7 +47,6 @@ PIVOTCACHE::PIVOTCACHE()
{
}
PIVOTCACHE
::~
PIVOTCACHE
()
{
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.cpp
View file @
ef8e5cab
...
...
@@ -31,10 +31,14 @@
*/
#include "PIVOTCACHEDEFINITION.h"
#include <Logic/Biff_records/SXStreamID.h>
#include <Logic/Biff_records/SXVS.h>
#include <Logic/Biff_unions/SXSRC.h>
#include <Logic/Biff_unions/SXADDLCACHE.h>
#include "PIVOTCACHE.h"
#include "SXSRC.h"
#include "SXADDLCACHE.h"
#include "../Biff_records/SXStreamID.h"
#include "../Biff_records/SXVS.h"
#include "../Biff_records/SXDB.h"
#include "../Biff_records/SXDBEx.h"
namespace
XLS
{
...
...
@@ -59,6 +63,8 @@ BaseObjectPtr PIVOTCACHEDEFINITION::clone()
// PIVOTCACHEDEFINITION = SXStreamID SXVS [SXSRC] [SXADDLCACHE]
const
bool
PIVOTCACHEDEFINITION
::
loadContent
(
BinProcessor
&
proc
)
{
global_info_
=
proc
.
getGlobalWorkbookInfo
();
if
(
!
proc
.
mandatory
<
SXStreamID
>
())
{
return
false
;
...
...
@@ -83,6 +89,93 @@ const bool PIVOTCACHEDEFINITION::loadContent(BinProcessor& proc)
}
return
true
;
}
int
PIVOTCACHEDEFINITION
::
serialize_definitions
(
std
::
wostream
&
strm
)
{
SXStreamID
*
streamId
=
dynamic_cast
<
SXStreamID
*>
(
m_SXStreamID
.
get
());
if
(
!
streamId
)
return
0
;
std
::
map
<
int
,
BaseObjectPtr
>::
iterator
pFind
=
global_info_
->
mapPivotCache
.
find
(
streamId
->
idStm
);
if
(
pFind
==
global_info_
->
mapPivotCache
.
end
())
return
0
;
PIVOTCACHE
*
pivot_cache
=
dynamic_cast
<
PIVOTCACHE
*>
(
pFind
->
second
.
get
());
if
(
!
pivot_cache
)
return
0
;
SXDB
*
db
=
dynamic_cast
<
SXDB
*>
(
pivot_cache
->
m_SXDB
.
get
());
SXDBEx
*
db_ex
=
dynamic_cast
<
SXDBEx
*>
(
pivot_cache
->
m_SXDBEx
.
get
());
if
(
!
db
||
!
db_ex
)
return
0
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"pivotCacheDefinition"
)
{
CP_XML_ATTR
(
L"xmlns"
,
L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
if
(
pivot_cache
->
m_arDBB
.
empty
()
==
false
)
{
CP_XML_ATTR
(
L"r:id"
,
L"rId1"
);
}
CP_XML_ATTR
(
L"recordCount"
,
db
->
crdbUsed
);
CP_XML_ATTR
(
L"refreshedBy"
,
db
->
rgb
.
value
());
CP_XML_ATTR
(
L"refreshedDate"
,
db_ex
->
numDate
.
data
.
value
);
//createdVersion="1"
//refreshedVersion="2"
//upgradeOnRefresh="1">
SXSRC
*
src
=
dynamic_cast
<
SXSRC
*>
(
m_SXSRC
.
get
());
if
(
src
)
src
->
serialize
(
CP_XML_STREAM
());
if
(
pivot_cache
->
m_arFDB
.
empty
()
==
false
)
{
CP_XML_NODE
(
L"cacheFields"
)
{
CP_XML_ATTR
(
L"count"
,
pivot_cache
->
m_arFDB
.
size
());
for
(
size_t
i
=
0
;
i
<
pivot_cache
->
m_arFDB
.
size
();
i
++
)
{
pivot_cache
->
m_arFDB
[
i
]
->
serialize
(
CP_XML_STREAM
());
}
}
}
}
}
return
0
;
}
int
PIVOTCACHEDEFINITION
::
serialize_records
(
std
::
wostream
&
strm
)
{
SXStreamID
*
streamId
=
dynamic_cast
<
SXStreamID
*>
(
m_SXStreamID
.
get
());
if
(
!
streamId
)
return
0
;
std
::
map
<
int
,
BaseObjectPtr
>::
iterator
pFind
=
global_info_
->
mapPivotCache
.
find
(
streamId
->
idStm
);
if
(
pFind
==
global_info_
->
mapPivotCache
.
end
())
return
0
;
PIVOTCACHE
*
pivot_cache
=
dynamic_cast
<
PIVOTCACHE
*>
(
pFind
->
second
.
get
());
if
(
!
pivot_cache
)
return
0
;
if
(
pivot_cache
->
m_arDBB
.
empty
())
return
0
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"pivotCacheRecords"
)
{
CP_XML_ATTR
(
L"xmlns"
,
L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
CP_XML_ATTR
(
L"count"
,
pivot_cache
->
m_arDBB
.
size
());
for
(
size_t
i
=
0
;
i
<
pivot_cache
->
m_arDBB
.
size
();
i
++
)
{
pivot_cache
->
m_arDBB
[
i
]
->
serialize
(
CP_XML_STREAM
());
}
}
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.h
View file @
ef8e5cab
...
...
@@ -49,12 +49,17 @@ public:
virtual
const
bool
loadContent
(
BinProcessor
&
proc
);
int
serialize_definitions
(
std
::
wostream
&
stream
);
int
serialize_records
(
std
::
wostream
&
stream
);
static
const
ElementType
type
=
typePIVOTCACHEDEFINITION
;
BaseObjectPtr
m_SXStreamID
;
BaseObjectPtr
m_SXVS
;
BaseObjectPtr
m_SXSRC
;
BaseObjectPtr
m_SXADDLCACHE
;
GlobalWorkbookInfoPtr
global_info_
;
};
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.cpp
View file @
ef8e5cab
...
...
@@ -45,7 +45,6 @@ SXOPER::SXOPER()
{
}
SXOPER
::~
SXOPER
()
{
}
...
...
@@ -79,8 +78,17 @@ const bool SXOPER::loadContent(BinProcessor& proc)
else
return
false
;
m_element
=
elements_
.
back
();
elements_
.
pop_back
();
return
true
;
}
int
SXOPER
::
serialize
(
std
::
wostream
&
strm
)
{
if
(
!
m_element
)
return
0
;
m_element
->
serialize
(
strm
);
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXOPER.h
View file @
ef8e5cab
...
...
@@ -47,9 +47,11 @@ public:
virtual
const
bool
loadContent
(
BinProcessor
&
proc
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSXOPER
;
BaseObjectPtr
m_
SXOPER
;
BaseObjectPtr
m_
element
;
};
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.cpp
View file @
ef8e5cab
...
...
@@ -92,10 +92,69 @@ const bool SXRANGE::loadContent(BinProcessor& proc)
if
(
proc
.
optional
<
Parenthesis_SXRANGE
>
())
{
while
(
elements_
.
empty
()
==
false
)
{
SXNum
*
num
=
dynamic_cast
<
SXNum
*>
(
elements_
.
front
().
get
());
if
(
num
)
{
m_arSXNum
.
push_back
(
elements_
.
front
());
}
else
{
SXDtr
*
dtr
=
dynamic_cast
<
SXDtr
*>
(
elements_
.
front
().
get
());
if
(
dtr
)
{
m_arSXDtr
.
push_back
(
elements_
.
front
());
}
}
elements_
.
pop_front
();
}
}
return
true
;
}
int
SXRANGE
::
serialize
(
std
::
wostream
&
strm
)
{
SXRng
*
rng
=
dynamic_cast
<
SXRng
*>
(
m_SXRng
.
get
());
if
(
!
rng
)
return
0
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"rangePr"
)
{
switch
(
rng
->
iByType
)
{
case
0
:
CP_XML_ATTR
(
L"groupBy"
,
L"range"
);
break
;
case
1
:
CP_XML_ATTR
(
L"groupBy"
,
L"seconds"
);
break
;
case
2
:
CP_XML_ATTR
(
L"groupBy"
,
L"minutes"
);
break
;
case
3
:
CP_XML_ATTR
(
L"groupBy"
,
L"hours"
);
break
;
case
4
:
CP_XML_ATTR
(
L"groupBy"
,
L"days"
);
break
;
case
5
:
CP_XML_ATTR
(
L"groupBy"
,
L"months"
);
break
;
case
6
:
CP_XML_ATTR
(
L"groupBy"
,
L"quarters"
);
break
;
case
7
:
CP_XML_ATTR
(
L"groupBy"
,
L"years"
);
break
;
}
if
(
m_arSXDtr
.
size
()
==
2
)
{
SXDtr
*
startDate
=
dynamic_cast
<
SXDtr
*>
(
m_arSXDtr
[
0
].
get
());
SXDtr
*
endDate
=
dynamic_cast
<
SXDtr
*>
(
m_arSXDtr
[
1
].
get
());
std
::
wstringstream
s_start
,
s_end
;
s_start
<<
startDate
->
yr
<<
L"-"
<<
startDate
->
mon
<<
L"-"
<<
startDate
->
dom
<<
L"T"
<<
startDate
->
hr
<<
L":"
<<
startDate
->
min
<<
L":"
<<
startDate
->
sec
;
s_end
<<
endDate
->
yr
<<
L"-"
<<
endDate
->
mon
<<
L"-"
<<
endDate
->
dom
<<
L"T"
<<
endDate
->
hr
<<
L":"
<<
endDate
->
min
<<
L":"
<<
endDate
->
sec
;
CP_XML_ATTR
(
L"startDate"
,
s_start
.
str
());
CP_XML_ATTR
(
L"endDate"
,
s_end
.
str
());
}
if
(
m_arSXNum
.
size
()
==
3
)
{
}
}
}
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXRANGE.h
View file @
ef8e5cab
...
...
@@ -47,9 +47,13 @@ public:
virtual
const
bool
loadContent
(
BinProcessor
&
proc
);
int
serialize
(
std
::
wostream
&
strm
);
static
const
ElementType
type
=
typeSXRANGE
;
BaseObjectPtr
m_SXRng
;
std
::
vector
<
BaseObjectPtr
>
m_arSXNum
;
std
::
vector
<
BaseObjectPtr
>
m_arSXDtr
;
};
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXSRC.cpp
View file @
ef8e5cab
...
...
@@ -73,5 +73,13 @@ const bool SXSRC::loadContent(BinProcessor& proc)
return
true
;
}
int
SXSRC
::
serialize
(
std
::
wostream
&
stream
)
{
if
(
m_source
)
m_source
->
serialize
(
stream
);
return
0
;
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SXSRC.h
View file @
ef8e5cab
...
...
@@ -47,6 +47,8 @@ public:
virtual
const
bool
loadContent
(
BinProcessor
&
proc
);
int
serialize
(
std
::
wostream
&
stream
);
static
const
ElementType
type
=
typeSXSRC
;
BaseObjectPtr
m_source
;
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
View file @
ef8e5cab
...
...
@@ -1922,16 +1922,10 @@ void XlsConverter::convert(XLS::PIVOTCACHEDEFINITION * pivot_cached)
{
if
(
pivot_cached
==
NULL
)
return
;
xlsx_context
->
start_pivot_cache
()
;
std
::
wstringstream
strmD
,
strmR
;
pivot_cached
->
serialize
(
xlsx_context
->
current_pivot_cache
().
definitions
());
pivot_cached
->
serialize_definitions
(
strmD
);
pivot_cached
->
serialize_records
(
strmR
);
//if (pivot_cached->is_records())//??
{
xlsx_context
->
current_pivot_cache
().
isRecordsPresent
=
true
;
//pivot_cached->serialize_records(xlsx_context->current_pivot_cache().records());
}
xlsx_context
->
end_pivot_cache
();
xlsx_context
->
get_pivots_context
().
add_cache
(
strmD
.
str
(),
strmR
.
str
());
}
\ No newline at end of file
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp
View file @
ef8e5cab
...
...
@@ -84,17 +84,7 @@ xlsx_xml_worksheet & xlsx_conversion_context::current_sheet()
throw
std
::
runtime_error
(
"internal error"
);
}
}
xlsx_pivot_cache_context
&
xlsx_conversion_context
::
current_pivot_cache
()
{
if
(
!
pivot_caches_
.
empty
())
{
return
*
pivot_caches_
.
back
().
get
();
}
else
{
throw
std
::
runtime_error
(
"internal error"
);
}
}
oox_chart_context
&
xlsx_conversion_context
::
current_chart
()
{
if
(
!
charts_
.
empty
())
...
...
@@ -133,15 +123,6 @@ void xlsx_conversion_context::end_chart()
{
}
void
xlsx_conversion_context
::
start_pivot_cache
()
{
pivot_caches_
.
push_back
(
xlsx_pivot_cache_context
::
create
());
}
void
xlsx_conversion_context
::
end_pivot_cache
()
{
}
void
xlsx_conversion_context
::
end_table
()
{
get_table_context
().
serialize_hyperlinks
(
current_sheet
().
hyperlinks
());
...
...
@@ -246,6 +227,7 @@ void xlsx_conversion_context::end_document()
{
CP_XML_ATTR
(
L"xmlns"
,
L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
CP_XML_ATTR
(
L"xmlns:mc"
,
L"http://schemas.openxmlformats.org/markup-compatibility/2006"
);
CP_XML_NODE
(
L"bookViews"
)
{
...
...
@@ -271,11 +253,12 @@ void xlsx_conversion_context::end_document()
CP_XML_STREAM
()
<<
str_
;
}
}
if
(
!
pivot_caches_
.
empty
())
int
pivot_cache_count
=
xlsx_pivots_context_
.
get_cache_count
();
if
(
pivot_cache_count
>
0
)
{
CP_XML_NODE
(
L"pivotCaches"
)
{
for
(
size_t
i
=
0
;
i
<
pivot_caches_
.
size
()
;
i
++
)
for
(
int
i
=
0
;
i
<
pivot_cache_count
;
i
++
)
{
std
::
wstring
rId
=
L"pcId"
+
std
::
to_wstring
(
i
+
1
);
static
const
std
::
wstring
sType
=
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition"
;
...
...
@@ -289,14 +272,10 @@ void xlsx_conversion_context::end_document()
CP_XML_ATTR
(
L"r:id"
,
rId
);
}
pivot_caches_
[
i
]
->
dump_rels
(
content
->
get_rels
());
pivot_caches_
[
i
]
->
write_to
(
content
->
definitions
());
if
(
pivot_caches_
[
i
]
->
isRecordsPresent
)
{
pivot_caches_
[
i
]
->
write_records_to
(
content
->
records
());
xlsx_pivots_context_
.
dump_rels
(
i
,
content
->
get_rels
());
xlsx_pivots_context_
.
write_definitions_to
(
i
,
content
->
definitions
());
xlsx_pivots_context_
.
write_records_to
(
i
,
content
->
records
());
}
output_document_
->
get_xl_files
().
add_pivot_cache
(
content
);
}
}
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h
View file @
ef8e5cab
...
...
@@ -41,7 +41,7 @@
#include "xlsx_drawing_context.h"
#include "xlsx_chart_context.h"
#include "xlsx_comments_context.h"
#include "xlsx_pivot
_cache
_context.h"
#include "xlsx_pivot
s
_context.h"
#include "xlsx_output_xml.h"
...
...
@@ -71,9 +71,6 @@ public:
void
start_chart
();
void
end_chart
();
void
start_pivot_cache
();
void
end_pivot_cache
();
std
::
wostream
&
shared_strings
()
{
return
xlsx_shared_strings_
;
}
std
::
wostream
&
defined_names
()
{
return
xlsx_defined_names_
;
}
std
::
wostream
&
workbook_views
()
{
return
xlsx_workbook_views_
;
}
...
...
@@ -84,8 +81,8 @@ public:
xlsx_xml_worksheet
&
current_sheet
();
oox_chart_context
&
current_chart
();
xlsx_pivot_cache_context
&
current_pivot_cache
();
xlsx_pivots_context
&
get_pivots_context
()
{
return
xlsx_pivots_context_
;}
xlsx_drawing_context
&
get_drawing_context
();
xlsx_drawing_context_handle
&
get_drawing_context_handle
();
xlsx_comments_context
&
get_comments_context
();
...
...
@@ -102,7 +99,6 @@ private:
std
::
vector
<
xlsx_xml_worksheet_ptr
>
sheets_
;
std
::
vector
<
oox_chart_context_ptr
>
charts_
;
std
::
vector
<
xlsx_pivot_cache_context_ptr
>
pivot_caches_
;
//std::wstringstream defaultOutput_;
//std::pair<float,float> maxDigitSize_;
...
...
@@ -111,6 +107,7 @@ private:
size_t
next_vml_file_id_
;
//используется для footer/header & comments
xlsx_pivots_context
xlsx_pivots_context_
;
xlsx_table_context
xlsx_table_context_
;
xlsx_text_context
xlsx_text_context_
;
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_pivot
_cache
_context.cpp
→
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_pivot
s
_context.cpp
View file @
ef8e5cab
...
...
@@ -29,124 +29,64 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "xlsx_pivot
_cache
_context.h"
#include "xlsx_pivot
s
_context.h"
#include "oox_rels.h"
#include "mediaitems_utils.h"
#include <boost/make_shared.hpp>
#include <simple_xml_writer.h>
namespace
oox
{
class
xlsx_pivot_cache_context
::
Impl
{
// struct rel_
// {
// rel_(bool is_internal, std::wstring const & rid, std::wstring const & target, external_items::Type type) :
// is_internal_(is_internal),
// rid_(rid),
//target_(target),
// type_(type)
// {}
// bool is_internal_;
// std::wstring rid_;
// std::wstring target_;
// external_items::Type type_;
// };
public:
Impl
()
{}
std
::
wstringstream
definitionsData_
;
std
::
wstringstream
recordsData_
;
class
xlsx_pivots_context
::
Impl
{
public:
struct
_pivot_cache
{
std
::
wstring
definitionsData_
;
std
::
wstring
recordsData_
;
};
//rels rels_;
Impl
()
{}
std
::
vector
<
_pivot_cache
>
caches_
;
};
xlsx_pivot
_cache_context_ptr
xlsx_pivot_cache_context
::
create
(
)
xlsx_pivot
s_context
::
xlsx_pivots_context
()
:
impl_
(
new
xlsx_pivots_context
::
Impl
()
)
{
return
boost
::
make_shared
<
xlsx_pivot_cache_context
>
();
}
int
countPivotCaches
=
0
;
xlsx_pivot_cache_context
::
xlsx_pivot_cache_context
()
:
impl_
(
new
xlsx_pivot_cache_context
::
Impl
()),
isRecordsPresent
(
false
)
{
index
=
++
countPivotCaches
;
}
std
::
wostream
&
xlsx_pivot_cache_context
::
definitions
()
void
xlsx_pivots_context
::
add_cache
(
std
::
wstring
definitions
,
std
::
wstring
records
)
{
return
impl_
->
definitionsData_
;
Impl
::
_pivot_cache
c
=
{
definitions
,
records
};
impl_
->
caches_
.
push_back
(
c
);
}
std
::
wostream
&
xlsx_pivot_cache_context
::
records
()
int
xlsx_pivots_context
::
get_cache_count
()
{
return
impl_
->
recordsData_
;
return
(
int
)
impl_
->
caches_
.
size
()
;
}
//void xlsx_pivot_cache_context::add_rels(
// bool isInternal,
// std::wstring const & rid,
// std::wstring const & target,
// external_items::Type type)
//{
// impl_->add_rels(isInternal, rid, target, type);
//}
void
xlsx_pivot_cache_context
::
dump_rels
(
rels
&
Rels
)
void
xlsx_pivots_context
::
dump_rels
(
int
index
,
rels
&
Rels
)
{
if
(
isRecordsPresent
)
if
(
!
impl_
->
caches_
[
index
].
recordsData_
.
empty
()
)
{
Rels
.
add
(
relationship
(
L"rId1"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords"
,
L"pivotCacheRecords"
+
std
::
to_wstring
(
index
)
+
L".xml"
,
L""
));
}
}
void
xlsx_pivot
_cache_context
::
write_to
(
std
::
wostream
&
strm
)
void
xlsx_pivot
s_context
::
write_definitions_to
(
int
index
,
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"pivotCacheDefinition"
)
{
CP_XML_ATTR
(
L"xmlns"
,
L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
if
(
isRecordsPresent
)
{
CP_XML_ATTR
(
L"r:id"
,
L"rId1"
);
}
CP_XML_ATTR
(
L"recordCount"
,
0
);
//refreshedBy="Debra S Dalgleish"
//refreshedDate="39449.496381365738"
//createdVersion="1"
//refreshedVersion="2"
//recordCount="11"
//upgradeOnRefresh="1">
CP_XML_STREAM
()
<<
impl_
->
definitionsData_
.
str
();
}
}
strm
<<
impl_
->
caches_
[
index
].
definitionsData_
;
}
void
xlsx_pivot
_cache_context
::
write_records_to
(
std
::
wostream
&
strm
)
void
xlsx_pivot
s_context
::
write_records_to
(
int
index
,
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"pivotCacheRecords"
)
{
CP_XML_ATTR
(
L"xmlns"
,
L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
CP_XML_ATTR
(
L"count"
,
0
);
CP_XML_STREAM
()
<<
impl_
->
recordsData_
.
str
();
}
}
strm
<<
impl_
->
caches_
[
index
].
recordsData_
;
}
xlsx_pivot
_cache_context
::~
xlsx_pivot_cache
_context
()
xlsx_pivot
s_context
::~
xlsx_pivots
_context
()
{
}
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_pivot
_cache
_context.h
→
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_pivot
s
_context.h
View file @
ef8e5cab
...
...
@@ -37,28 +37,19 @@ namespace oox {
class
xlsx_pivot_cache_context
;
typedef
_CP_PTR
(
xlsx_pivot_cache_context
)
xlsx_pivot_cache_context_ptr
;
class
xlsx_pivot
_cache
_context
class
xlsx_pivot
s
_context
{
public:
xlsx_pivot
_cache
_context
();
~
xlsx_pivot
_cache
_context
();
xlsx_pivot
s
_context
();
~
xlsx_pivot
s
_context
();
std
::
wostream
&
definitions
(
);
std
::
wostream
&
records
();
void
add_cache
(
std
::
wstring
definitions
,
std
::
wstring
records
);
int
get_cache_count
();
void
write_
to
(
std
::
wostream
&
strm
);
void
write_records_to
(
std
::
wostream
&
strm
);
void
write_
definitions_to
(
int
index
,
std
::
wostream
&
strm
);
void
write_records_to
(
int
index
,
std
::
wostream
&
strm
);
void
dump_rels
(
rels
&
Rels
);
static
xlsx_pivot_cache_context_ptr
create
();
//void add_rels( bool isInternal,
// std::wstring const & rid,
// std::wstring const & target,
// external_items::Type type);
bool
isRecordsPresent
;
int
index
;
void
dump_rels
(
int
index
,
rels
&
Rels
);
private:
class
Impl
;
_CP_PTR
(
Impl
)
impl_
;
...
...
ASCOfficeXlsFile2/source/linux/XlsFormatLib.pro
View file @
ef8e5cab
...
...
@@ -840,7 +840,7 @@ SOURCES += \
..
/
XlsXlsxConverter
/
xlsx_tablecontext
.
cpp
\
..
/
XlsXlsxConverter
/
xlsx_textcontext
.
cpp
\
..
/
XlsXlsxConverter
/
xlsx_chart_context
.
cpp
\
..
/
XlsXlsxConverter
/
xlsx_pivot
_cache
_context
.
cpp
\
..
/
XlsXlsxConverter
/
xlsx_pivot
s
_context
.
cpp
\
..
/
XlsXlsxConverter
/
xlsx_comments
.
cpp
\
..
/
XlsXlsxConverter
/
xlsx_comments_context
.
cpp
\
...
...
@@ -1598,7 +1598,7 @@ HEADERS += \
..
/
XlsXlsxConverter
/
xlsx_conversion_context
.
h
\
..
/
XlsXlsxConverter
/
xlsx_drawing_context
.
h
\
..
/
XlsXlsxConverter
/
xlsx_drawings
.
h
\
..
/
XlsXlsxConverter
/
xlsx_pivot
_cache
_context
.
cpp
\
..
/
XlsXlsxConverter
/
xlsx_pivot
s
_context
.
cpp
\
..
/
XlsXlsxConverter
/
xlsx_hyperlinks
.
h
\
..
/
XlsXlsxConverter
/
xlsx_output_xml
.
h
\
..
/
XlsXlsxConverter
/
xlsx_package
.
h
\
...
...
ASCOfficeXlsFile2/source/win32/XlsXlsxConverter.vcproj
View file @
ef8e5cab
...
...
@@ -417,11 +417,11 @@
>
</File>
<File
RelativePath=
"..\XlsXlsxConverter\xlsx_pivot
_cache
_context.cpp"
RelativePath=
"..\XlsXlsxConverter\xlsx_pivot
s
_context.cpp"
>
</File>
<File
RelativePath=
"..\XlsXlsxConverter\xlsx_pivot
_cache
_context.h"
RelativePath=
"..\XlsXlsxConverter\xlsx_pivot
s
_context.h"
>
</File>
<File
...
...
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