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
a3274076
Commit
a3274076
authored
Oct 16, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XlsFormatReader - graphic in footer/header, refactoring shape for comment
parent
80477c83
Changes
32
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
855 additions
and
428 deletions
+855
-428
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/HFPicture.cpp
...lsFile2/source/XlsFormat/Logic/Biff_records/HFPicture.cpp
+11
-13
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/HFPicture.h
...eXlsFile2/source/XlsFormat/Logic/Biff_records/HFPicture.h
+2
-3
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/HeaderFooter.cpp
...ile2/source/XlsFormat/Logic/Biff_records/HeaderFooter.cpp
+7
-4
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/HeaderFooter.h
...sFile2/source/XlsFormat/Logic/Biff_records/HeaderFooter.h
+5
-4
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.cpp
.../Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.cpp
+3
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainerFileBlock.cpp
...ff_structures/ODRAW/OfficeArtBStoreContainerFileBlock.cpp
+2
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorChart.h
.../Logic/Biff_structures/ODRAW/OfficeArtClientAnchorChart.h
+1
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.cpp
...t/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.cpp
+1
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h
...mat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h
+2
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.h
...Format/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.h
+2
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h
...t/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h
+4
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
...fficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
+46
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.h
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.h
+22
-17
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.cpp
...iceXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.cpp
+73
-19
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.h
...fficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.h
+32
-26
ASCOfficeXlsFile2/source/XlsFormat/Logic/XlsElementsType.h
ASCOfficeXlsFile2/source/XlsFormat/Logic/XlsElementsType.h
+3
-0
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
+84
-10
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h
+3
-1
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments.cpp
+3
-108
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments.h
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments.h
+11
-23
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments_context.cpp
...lsFile2/source/XlsXlsxConverter/xlsx_comments_context.cpp
+24
-62
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments_context.h
...eXlsFile2/source/XlsXlsxConverter/xlsx_comments_context.h
+10
-14
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp
...File2/source/XlsXlsxConverter/xlsx_conversion_context.cpp
+23
-10
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h
...lsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h
+15
-13
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
...XlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
+317
-34
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.h
...ceXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.h
+53
-11
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_output_xml.cpp
...fficeXlsFile2/source/XlsXlsxConverter/xlsx_output_xml.cpp
+36
-17
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_output_xml.h
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_output_xml.h
+7
-5
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.cpp
+16
-3
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.h
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.h
+11
-15
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_tablecontext.cpp
...iceXlsFile2/source/XlsXlsxConverter/xlsx_tablecontext.cpp
+18
-7
Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h
Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h
+8
-3
No files found.
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/HFPicture.cpp
View file @
a3274076
...
...
@@ -54,12 +54,6 @@ BaseObjectPtr HFPicture::clone()
void
HFPicture
::
writeFields
(
CFRecord
&
record
)
{
FrtHeader
frtHeader
(
rt_HFPicture
);
record
<<
frtHeader
;
#pragma message("####################### HFPicture record is not implemented")
Log
::
error
(
"HFPicture record is not implemented."
);
//record << some_value;
}
...
...
@@ -70,13 +64,17 @@ void HFPicture::readFields(CFRecord& record)
unsigned
short
flags
;
record
>>
flags
;
fIsDrawing
=
GETBIT
(
flags
,
0
);
fIsDrawingGroup
=
GETBIT
(
flags
,
0
);
fContinue
=
GETBIT
(
flags
,
0
);
fIsDrawingGroup
=
GETBIT
(
flags
,
1
);
fContinue
=
GETBIT
(
flags
,
2
);
int
size
=
record
.
getDataSize
()
-
record
.
getRdPtr
();
recordDrawingGroup
=
CFRecordPtr
(
new
CFRecord
(
CFRecordType
::
ANY_TYPE
,
record
.
getGlobalWorkbookInfo
()));
recordDrawingGroup
->
appendRawData
(
record
.
getCurData
<
char
>
(),
size
);
#pragma message("############################ OfficeArtDggContainer containers are not implemented yet")
Log
::
info
(
"OfficeArtDggContainer containers are not implemented yet"
);
//record >> rgDrawing;
record
.
skipNunBytes
(
size
);
}
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/HFPicture.h
View file @
a3274076
...
...
@@ -32,11 +32,11 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/ODRAW/OfficeArtDgContainer.h"
namespace
XLS
{
// Logical representation of HFPicture record in BIFF8
class
HFPicture
:
public
BiffRecord
{
...
...
@@ -53,12 +53,11 @@ public:
static
const
ElementType
type
=
typeHFPicture
;
//-----------------------------
bool
fIsDrawing
;
bool
fIsDrawingGroup
;
bool
fContinue
;
//OfficeArtDgContainer rgDrawing;
CFRecordPtr
recordDrawingGroup
;
};
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/HeaderFooter.cpp
View file @
a3274076
...
...
@@ -97,10 +97,13 @@ void HeaderFooter::readFields(CFRecord& record)
{
FrtHeader
frtHeader
(
rt_HeaderFooter
);
record
>>
frtHeader
;
unsigned
short
flags
;
_GUID_
guid_num
;
record
>>
guid_num
>>
flags
;
guidSView
=
STR
::
guid2bstr
(
guid_num
);
fHFDiffOddEven
=
GETBIT
(
flags
,
0
);
fHFDiffFirst
=
GETBIT
(
flags
,
1
);
fHFScaleWithDoc
=
GETBIT
(
flags
,
2
);
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/HeaderFooter.h
View file @
a3274076
...
...
@@ -56,6 +56,7 @@ public:
//-----------------------------
std
::
wstring
guidSView
;
bool
fHFDiffOddEven
;
bool
fHFDiffFirst
;
bool
fHFScaleWithDoc
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.cpp
View file @
a3274076
...
...
@@ -65,6 +65,9 @@ void OfficeArtBStoreContainer::loadFields(XLS::CFRecord& record)
rgfb
.
push_back
(
fileBlock
);
}
//int skip_data = record.getDataSize() - record.getRdPtr();
//record.skipNunBytes(skip_data);
// OpenOffice
while
(
1
)
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainerFileBlock.cpp
View file @
a3274076
...
...
@@ -249,7 +249,9 @@ void OfficeArtBStoreContainerFileBlock::load(XLS::CFRecord& record)
pict_size
=
rc_header
.
recLen
-
skipLen
;
if
(
pict_size
>
record
.
getDataSize
()
-
record
.
getRdPtr
())
{
return
;
}
else
result
=
true
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorChart.h
View file @
a3274076
...
...
@@ -51,7 +51,6 @@ public:
static
const
XLS
::
ElementType
type
=
XLS
::
typeOfficeArtClientAnchorChart
;
virtual
void
loadFields
(
XLS
::
CFRecord
&
record
);
virtual
void
storeFields
(
XLS
::
CFRecord
&
record
);
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.cpp
View file @
a3274076
...
...
@@ -50,13 +50,12 @@ XLS::BiffStructurePtr OfficeArtClientAnchorHF::clone()
void
OfficeArtClientAnchorHF
::
storeFields
(
XLS
::
CFRecord
&
record
)
{
record
<<
width
<<
height
;
}
void
OfficeArtClientAnchorHF
::
loadFields
(
XLS
::
CFRecord
&
record
)
{
record
>>
width
>>
height
;
record
>>
_cx
>>
_cy
;
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h
View file @
a3274076
...
...
@@ -54,8 +54,8 @@ public:
virtual
void
loadFields
(
XLS
::
CFRecord
&
record
);
virtual
void
storeFields
(
XLS
::
CFRecord
&
record
);
int
width
;
int
height
;
int
_cx
;
int
_cy
;
};
typedef
boost
::
shared_ptr
<
OfficeArtClientAnchorHF
>
OfficeArtClientAnchorHFPtr
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.h
View file @
a3274076
...
...
@@ -52,6 +52,8 @@ public:
static
const
bool
CheckIfContainerStartFound
(
XLS
::
CFRecord
&
record
);
static
const
bool
CheckIfContainerSizeOK
(
XLS
::
CFRecord
&
record
);
static
const
XLS
::
ElementType
type
=
XLS
::
typeOfficeArtDgContainer
;
void
loadFields
(
XLS
::
CFRecord
&
record
);
OfficeArtRecordPtr
m_OfficeArtFDG
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h
View file @
a3274076
...
...
@@ -61,6 +61,8 @@ public:
void
loadFields
(
XLS
::
CFRecord
&
record
);
static
const
XLS
::
ElementType
type
=
XLS
::
typeOfficeArtSpgrContainer
;
std
::
vector
<
OfficeArtContainerPtr
>
m_OfficeArtSpgrContainerFileBlock
;
};
...
...
@@ -82,6 +84,8 @@ public:
OfficeArtSpContainer
(
const
OfficeArtClientAnchorType
anchor_type
)
:
OfficeArtContainer
(
0x0F
,
SpContainer
,
anchor_type
)
{}
XLS
::
BiffStructurePtr
clone
()
{
return
XLS
::
BiffStructurePtr
(
new
OfficeArtSpContainer
(
*
this
));
}
static
const
XLS
::
ElementType
type
=
XLS
::
typeOfficeArtSpContainer
;
void
loadFields
(
XLS
::
CFRecord
&
record
);
OfficeArtRecordPtr
m_OfficeArtFSP
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
View file @
a3274076
...
...
@@ -95,6 +95,8 @@
#include <Logic/Biff_records/DXF.h>
#include <Logic/Biff_unions/STYLES.h>
#include "Biff_structures/ODRAW/OfficeArtDgContainer.h"
namespace
XLS
{;
...
...
@@ -184,6 +186,8 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
{
int
count
=
0
;
global_info_
=
proc
.
getGlobalWorkbookInfo
();
while
(
true
)
{
CFRecordType
::
TypeId
type
=
proc
.
getNextRecordType
();
...
...
@@ -481,8 +485,50 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
}
}
}
LoadHFPicture
();
return
true
;
}
void
GlobalsSubstream
::
LoadHFPicture
()
{
if
(
m_arHFPicture
.
empty
())
return
;
int
current_size_hf
=
0
,
j
=
0
;
for
(
int
i
=
0
;
i
<
m_arHFPicture
.
size
();
i
++
)
{
HFPicture
*
hf
=
dynamic_cast
<
HFPicture
*>
(
m_arHFPicture
[
i
].
get
());
if
((
hf
)
&&
(
hf
->
recordDrawingGroup
))
{
if
(
!
hf
->
fContinue
&&
current_size_hf
>
0
)
{
XLS
::
CFRecord
record
(
CFRecordType
::
ANY_TYPE
,
global_info_
);
for
(;
j
<
i
;
j
++
)
{
hf
=
dynamic_cast
<
HFPicture
*>
(
m_arHFPicture
[
j
].
get
());
record
.
appendRawData
(
hf
->
recordDrawingGroup
);
}
ODRAW
::
OfficeArtDgContainerPtr
rgDrawing
=
ODRAW
::
OfficeArtDgContainerPtr
(
new
ODRAW
::
OfficeArtDgContainer
(
ODRAW
::
OfficeArtRecord
::
CA_HF
));
rgDrawing
->
loadFields
(
record
);
m_arHFPictureDrawing
.
push_back
(
rgDrawing
);
current_size_hf
=
0
;
}
current_size_hf
+=
hf
->
recordDrawingGroup
->
getDataSize
();
}
}
if
(
current_size_hf
>
0
)
{
XLS
::
CFRecord
record
(
ODRAW
::
OfficeArtRecord
::
DggContainer
,
global_info_
);
for
(;
j
<
m_arHFPicture
.
size
();
j
++
)
{
HFPicture
*
hf
=
dynamic_cast
<
HFPicture
*>
(
m_arHFPicture
[
j
].
get
());
record
.
appendRawData
(
hf
->
recordDrawingGroup
);
}
ODRAW
::
OfficeArtDgContainerPtr
rgDrawing
=
ODRAW
::
OfficeArtDgContainerPtr
(
new
ODRAW
::
OfficeArtDgContainer
(
ODRAW
::
OfficeArtRecord
::
CA_HF
));
rgDrawing
->
loadFields
(
record
);
m_arHFPictureDrawing
.
push_back
(
rgDrawing
);
}
}
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.h
View file @
a3274076
...
...
@@ -39,7 +39,6 @@ namespace XLS
class
CFStreamCacheReader
;
class
BOF
;
// Logical representation of Globals substream
class
GlobalsSubstream
;
typedef
boost
::
shared_ptr
<
GlobalsSubstream
>
GlobalsSubstreamPtr
;
...
...
@@ -73,7 +72,13 @@ public:
std
::
vector
<
BaseObjectPtr
>
m_arUserBView
;
std
::
vector
<
BaseObjectPtr
>
m_arSUPBOOK
;
std
::
vector
<
BiffStructurePtr
>
m_arHFPictureDrawing
;
unsigned
short
code_page_
;
GlobalWorkbookInfoPtr
global_info_
;
private:
void
LoadHFPicture
();
};
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.cpp
View file @
a3274076
...
...
@@ -53,7 +53,7 @@
#include <Logic/Biff_unions/BACKGROUND.h>
#include <Logic/Biff_unions/BIGNAME.h>
#include <Logic/Biff_unions/PROTECTION_COMMON.h>
// special name to exclude ambiguous meaning
#include <Logic/Biff_unions/PROTECTION_COMMON.h>
#include <Logic/Biff_unions/COLUMNS.h>
#include <Logic/Biff_unions/SCENARIOS.h>
#include <Logic/Biff_unions/SORTANDFILTER.h>
...
...
@@ -74,6 +74,8 @@
#include <Logic/Biff_unions/RECORD12.h>
#include <Logic/Biff_unions/SHFMLA_SET.h>
#include "Biff_structures/ODRAW/OfficeArtDgContainer.h"
namespace
XLS
{;
...
...
@@ -105,13 +107,14 @@ WORKSHEET = BOF WORKSHEETCONTENT
*/
const
bool
WorksheetSubstream
::
loadContent
(
BinProcessor
&
proc
)
{
GlobalWorkbookInfoPtr
global_info
=
proc
.
getGlobalWorkbookInfo
();
global_info_
=
proc
.
getGlobalWorkbookInfo
();
GlobalWorkbookInfo
::
_sheet_size_info
sheet_size_info
;
global_info
->
sheet_size_info
.
push_back
(
sheet_size_info
);
global_info
->
current_sheet
=
global_info
->
sheet_size_info
.
size
();
global_info
->
cmt_rules
=
0
;
global_info_
->
sheet_size_info
.
push_back
(
sheet_size_info
);
global_info_
->
current_sheet
=
global_info_
->
sheet_size_info
.
size
();
global_info_
->
cmt_rules
=
0
;
int
count
=
0
;
std
::
vector
<
CellRangeRef
>
shared_formulas_locations
;
...
...
@@ -251,8 +254,16 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
elements_
.
pop_back
();
}
}
break
;
case
rt_HFPicture
:
proc
.
repeated
<
HFPicture
>
(
0
,
0
);
break
;
case
rt_HFPicture
:
{
count
=
proc
.
repeated
<
HFPicture
>
(
0
,
0
);
while
(
count
>
0
)
{
m_arHFPicture
.
insert
(
m_arHFPicture
.
begin
(),
elements_
.
back
());
elements_
.
pop_back
();
count
--
;
}
}
break
;
case
rt_CommentText
:
{
count
=
proc
.
repeated
<
CommentText
>
(
0
,
0
);
...
...
@@ -263,7 +274,6 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
count
--
;
}
}
break
;
case
rt_Note
:
{
count
=
proc
.
repeated
<
Note
>
(
0
,
0
);
...
...
@@ -304,7 +314,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
elements_
.
pop_back
();
DxGCol
*
dx
=
dynamic_cast
<
DxGCol
*>
(
m_DxGCol
.
get
());
global_info
->
sheet_size_info
.
back
().
defaultColumnWidth
=
dx
->
dxgCol
/
256.
;
global_info
_
->
sheet_size_info
.
back
().
defaultColumnWidth
=
dx
->
dxgCol
/
256.
;
}
}
break
;
case
rt_MergeCells
:
...
...
@@ -386,8 +396,9 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
count
--
;
}
}
break
;
case
rt_HeaderFooter
:
proc
.
repeated
<
RECORD12
>
(
0
,
0
);
break
;
case
rt_HeaderFooter
:
proc
.
repeated
<
RECORD12
>
(
0
,
0
);
break
;
default:
//unknown .... skip
{
proc
.
SkipRecord
();
...
...
@@ -395,8 +406,51 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
}
}
LoadHFPicture
();
return
true
;
}
void
WorksheetSubstream
::
LoadHFPicture
()
{
if
(
m_arHFPicture
.
empty
())
return
;
int
current_size_hf
=
0
,
j
=
0
;
for
(
int
i
=
0
;
i
<
m_arHFPicture
.
size
();
i
++
)
{
HFPicture
*
hf
=
dynamic_cast
<
HFPicture
*>
(
m_arHFPicture
[
i
].
get
());
if
((
hf
)
&&
(
hf
->
recordDrawingGroup
))
{
if
(
!
hf
->
fContinue
&&
current_size_hf
>
0
)
{
XLS
::
CFRecord
record
(
CFRecordType
::
ANY_TYPE
,
global_info_
);
for
(;
j
<
i
;
j
++
)
{
hf
=
dynamic_cast
<
HFPicture
*>
(
m_arHFPicture
[
j
].
get
());
record
.
appendRawData
(
hf
->
recordDrawingGroup
);
}
ODRAW
::
OfficeArtDgContainerPtr
rgDrawing
=
ODRAW
::
OfficeArtDgContainerPtr
(
new
ODRAW
::
OfficeArtDgContainer
(
ODRAW
::
OfficeArtRecord
::
CA_HF
));
rgDrawing
->
loadFields
(
record
);
m_arHFPictureDrawing
.
push_back
(
rgDrawing
);
current_size_hf
=
0
;
}
current_size_hf
+=
hf
->
recordDrawingGroup
->
getDataSize
();
}
}
if
(
current_size_hf
>
0
)
{
XLS
::
CFRecord
record
(
ODRAW
::
OfficeArtRecord
::
DggContainer
,
global_info_
);
for
(;
j
<
m_arHFPicture
.
size
();
j
++
)
{
HFPicture
*
hf
=
dynamic_cast
<
HFPicture
*>
(
m_arHFPicture
[
j
].
get
());
record
.
appendRawData
(
hf
->
recordDrawingGroup
);
}
ODRAW
::
OfficeArtDgContainerPtr
rgDrawing
=
ODRAW
::
OfficeArtDgContainerPtr
(
new
ODRAW
::
OfficeArtDgContainer
(
ODRAW
::
OfficeArtRecord
::
CA_HF
));
rgDrawing
->
loadFields
(
record
);
m_arHFPictureDrawing
.
push_back
(
rgDrawing
);
}
}
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.h
View file @
a3274076
...
...
@@ -37,7 +37,6 @@
namespace
XLS
{;
// Logical representation of WorksheetSubstream union of records
class
WorksheetSubstream
;
typedef
boost
::
shared_ptr
<
WorksheetSubstream
>
WorksheetSubstreamPtr
;
...
...
@@ -54,12 +53,9 @@ public:
static
const
ElementType
type
=
typeWorksheetSubstream
;
GlobalWorkbookInfoPtr
global_info_
;
size_t
ws_index_
;
std
::
vector
<
BaseObjectPtr
>
m_arMergeCells
;
std
::
vector
<
BaseObjectPtr
>
m_arWINDOW
;
std
::
vector
<
BaseObjectPtr
>
m_arCUSTOMVIEW
;
BaseObjectPtr
m_GLOBALS
;
BaseObjectPtr
m_PAGESETUP
;
BaseObjectPtr
m_BACKGROUND
;
...
...
@@ -75,12 +71,22 @@ public:
BaseObjectPtr
m_SheetExt
;
BaseObjectPtr
m_DxGCol
;
std
::
vector
<
BaseObjectPtr
>
m_arMergeCells
;
std
::
vector
<
BaseObjectPtr
>
m_arWINDOW
;
std
::
vector
<
BaseObjectPtr
>
m_arCUSTOMVIEW
;
std
::
vector
<
BaseObjectPtr
>
m_arFEAT
;
std
::
vector
<
BaseObjectPtr
>
m_arFEAT11
;
std
::
vector
<
BaseObjectPtr
>
m_arNote
;
std
::
vector
<
BaseObjectPtr
>
m_arHLINK
;
std
::
vector
<
BaseObjectPtr
>
m_arSORT
;
std
::
vector
<
BaseObjectPtr
>
m_arLabel
;
std
::
vector
<
BaseObjectPtr
>
m_arHFPicture
;
std
::
vector
<
BiffStructurePtr
>
m_arHFPictureDrawing
;
private:
void
LoadHFPicture
();
//todoooo - обобщить
};
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/XlsElementsType.h
View file @
a3274076
...
...
@@ -652,6 +652,7 @@ enum ElementType
typeOfficeArtRecord
=
3000
,
typeOfficeArtBStoreContainerFileBlock
,
typeOfficeArtDgContainer
,
typeOfficeArtCOLORREF
,
typeOfficeArtFOPTE
,
typeOfficeArtFRIT
,
...
...
@@ -660,6 +661,8 @@ enum ElementType
typeOfficeArtRecordHeader
,
typeOfficeArtRGFOPTE
,
typeOfficeArtBlip
,
typeOfficeArtSpContainer
,
typeOfficeArtSpgrContainer
,
typeOfficeArtBStoreContainer
,
typeOfficeArtClientAnchorChart
,
typeOfficeArtClientAnchorHF
,
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
View file @
a3274076
...
...
@@ -78,6 +78,7 @@
#include <Logic/Biff_structures/ODRAW/OfficeArtBlip.h>
#include <Logic/Biff_structures/ODRAW/OfficeArtFSPGR.h>
#include <Logic/Biff_structures/ODRAW/OfficeArtClientAnchorSheet.h>
#include <Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h>
#include "xlsx_conversion_context.h"
#include "xlsx_package.h"
...
...
@@ -447,6 +448,11 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
sheet
->
m_PAGESETUP
->
serialize
(
xlsx_context
->
current_sheet
().
pageProperties
());
}
for
(
int
i
=
0
;
i
<
sheet
->
m_arHFPictureDrawing
.
size
();
i
++
)
{
//convert(dynamic_cast<XLS::Note*>(sheet->sheet->m_arHFPictureDrawing[i].get(),
}
if
(
sheet
->
m_arCUSTOMVIEW
.
size
()
>
0
)
{
CP_XML_WRITER
(
xlsx_context
->
current_sheet
().
customViews
())
...
...
@@ -465,6 +471,11 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{
convert
(
dynamic_cast
<
XLS
::
BACKGROUND
*>
(
sheet
->
m_BACKGROUND
.
get
()));
}
for
(
int
i
=
0
;
i
<
sheet
->
m_arHFPictureDrawing
.
size
();
i
++
)
{
convert
((
ODRAW
::
OfficeArtDgContainer
*
)
sheet
->
m_arHFPictureDrawing
[
i
].
get
());
}
}
void
XlsConverter
::
convert
(
XLS
::
GlobalsSubstream
*
global
)
...
...
@@ -486,6 +497,12 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
{
convert
((
XLS
::
MSODRAWINGGROUP
*
)
global
->
m_arMSODRAWINGGROUP
[
i
].
get
());
}
for
(
int
i
=
0
;
i
<
global
->
m_arHFPictureDrawing
.
size
();
i
++
)
{
convert
((
ODRAW
::
OfficeArtDgContainer
*
)
global
->
m_arHFPictureDrawing
[
i
].
get
());
}
for
(
int
i
=
0
;
i
<
global
->
m_arWindow1
.
size
();
i
++
)
{
global
->
m_arWindow1
[
i
]
->
serialize
(
xlsx_context
->
workbook_views
());
...
...
@@ -591,7 +608,7 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
{
if
(
size
<
1
||
!
data
)
return
L""
;
if
(
id
<
0
)
id
=
xlsx_context
->
get_mediaitems
().
count_image
+
1000
;
//
встроенные в поток
if
(
id
<
0
)
id
=
xlsx_context
->
get_mediaitems
().
count_image
+
1000
;
//
1000 - встроенные в поток , 3000 - footer/header
xlsx_context
->
get_mediaitems
().
create_media_path
(
xlsx_path
);
...
...
@@ -714,14 +731,14 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
return
L""
;
}
void
XlsConverter
::
convert
(
ODRAW
::
OfficeArtBStoreContainer
*
art_bstore
)
void
XlsConverter
::
convert
(
ODRAW
::
OfficeArtBStoreContainer
*
art_bstore
,
int
start_id
)
{
if
(
art_bstore
==
NULL
)
return
;
if
(
art_bstore
->
rgfb
.
size
()
<
1
)
return
;
for
(
int
i
=
0
;
i
<
art_bstore
->
rgfb
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
art_bstore
->
rgfb
.
size
();
i
++
)
{
int
bin_id
=
i
+
1
;
int
bin_id
=
i
+
start_id
+
1
;
WriteMediaFile
(
art_bstore
->
rgfb
[
i
]
->
pict_data
,
art_bstore
->
rgfb
[
i
]
->
pict_size
,
art_bstore
->
rgfb
[
i
]
->
pict_type
,
bin_id
);
}
...
...
@@ -796,7 +813,7 @@ void XlsConverter::convert(XLS::BACKGROUND * back)
if
(
rId
.
empty
())
return
;
CP_XML_WRITER
(
xlsx_context
->
current_sheet
().
picture
())
CP_XML_WRITER
(
xlsx_context
->
current_sheet
().
picture
_background
())
{
CP_XML_NODE
(
L"picture"
)
{
...
...
@@ -1029,7 +1046,24 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
}
}
}
void
XlsConverter
::
convert
(
ODRAW
::
OfficeArtSpgrContainer
*
spgr
)
{
if
(
spgr
==
NULL
)
return
;
if
(
spgr
->
anchor_type_
!=
ODRAW
::
OfficeArtRecord
::
CA_HF
)
return
;
//todooo проверить что тока для header/footer это нужно
for
(
int
i
=
0
;
i
<
spgr
->
child_records
.
size
();
i
++
)
{
int
type_object
=
2
;
//rect
if
(
xlsx_context
->
get_drawing_context
().
start_drawing
(
type_object
))
{
xlsx_context
->
get_drawing_context
().
set_mode_vmlwrite
(
true
);
convert
(
spgr
->
child_records
[
i
].
get
());
xlsx_context
->
get_drawing_context
().
end_drawing
();
}
}
}
void
XlsConverter
::
convert
(
ODRAW
::
OfficeArtSpContainer
*
sp
,
bool
anchor_only
)
{
if
(
sp
==
NULL
)
return
;
...
...
@@ -1068,6 +1102,11 @@ void XlsConverter::convert(ODRAW::OfficeArtRecord * art)
xlsx_context
->
get_drawing_context
().
set_group_anchor
(
ch
->
_x
,
ch
->
_y
,
ch
->
_cx
,
ch
->
_cy
);
}
break
;
case
XLS
:
:
typeOfficeArtClientAnchorHF
:
{
ODRAW
::
OfficeArtClientAnchorHF
*
hf
=
dynamic_cast
<
ODRAW
::
OfficeArtClientAnchorHF
*>
(
art
);
xlsx_context
->
get_drawing_context
().
set_child_anchor
(
0
,
0
,
hf
->
_cx
*
3
/
5
,
hf
->
_cy
*
3
/
5
);
}
break
;
case
XLS
:
:
typeOfficeArtChildAnchor
:
{
ODRAW
::
OfficeArtChildAnchor
*
ch
=
dynamic_cast
<
ODRAW
::
OfficeArtChildAnchor
*>
(
art
);
...
...
@@ -1081,6 +1120,34 @@ void XlsConverter::convert(ODRAW::OfficeArtRecord * art)
//xlsx_context->get_drawing_context().set_child_anchor(ch->_x, ch->_y, ch->_cx, ch->_cy);
xlsx_context
->
get_drawing_context
().
set_sheet_anchor
(
ch
->
colL
,
ch
->
_dxL
,
ch
->
rwT
,
ch
->
_dyT
,
ch
->
colR
,
ch
->
_dxR
,
ch
->
rwB
,
ch
->
_dyB
);
}
break
;
case
XLS
:
:
typeOfficeArtBStoreContainer
:
{
convert
(
dynamic_cast
<
ODRAW
::
OfficeArtBStoreContainer
*>
(
art
),
3000
);
}
break
;
case
XLS
:
:
typeOfficeArtSpContainer
:
{
convert
(
dynamic_cast
<
ODRAW
::
OfficeArtSpContainer
*>
(
art
));
}
break
;
case
XLS
:
:
typeOfficeArtSpgrContainer
:
{
convert
(
dynamic_cast
<
ODRAW
::
OfficeArtSpgrContainer
*>
(
art
));
}
break
;
case
XLS
:
:
typeOfficeArtDgContainer
:
{
ODRAW
::
OfficeArtDgContainer
*
dg
=
dynamic_cast
<
ODRAW
::
OfficeArtDgContainer
*>
(
art
);
for
(
int
i
=
0
;
i
<
dg
->
child_records
.
size
();
i
++
)
//a-la msodrawing for headers/footers
{
convert
(
dg
->
child_records
[
i
].
get
());
}
for
(
int
i
=
0
;
i
<
dg
->
m_OfficeArtSpContainer
.
size
();
i
++
)
{
convert
(
dg
->
m_OfficeArtSpContainer
[
i
].
get
());
}
convert
(
dg
->
m_OfficeArtSpgrContainer
.
get
());
}
break
;
}
}
...
...
@@ -1368,7 +1435,12 @@ void XlsConverter::convert_blip(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
bool
isIternal
=
false
;
std
::
wstring
target
;
std
::
wstring
rId
=
xlsx_context
->
get_mediaitems
().
find_image
(
props
[
i
]
->
op
,
target
,
isIternal
);
int
id
=
props
[
i
]
->
op
;
if
(
xlsx_context
->
get_drawing_context
().
get_mode_vmlwrite
())
id
+=
3000
;
std
::
wstring
rId
=
xlsx_context
->
get_mediaitems
().
find_image
(
id
,
target
,
isIternal
);
xlsx_context
->
get_drawing_context
().
set_fill_texture
(
target
);
}
break
;
}
...
...
@@ -1637,16 +1709,18 @@ void XlsConverter::convert(XLS::Note* note)
xlsx_context
->
get_comments_context
().
start_comment
();
}
xlsx_context
->
get_comments_context
().
set_ref
(
note
->
note_sh
.
ref_
,
note
->
note_sh
.
col
,
note
->
note_sh
.
row
);
xlsx_context
->
get_comments_context
().
set_ref
(
note
->
note_sh
.
ref_
,
note
->
note_sh
.
col
,
note
->
note_sh
.
row
);
xlsx_context
->
get_comments_context
().
set_author
(
note
->
note_sh
.
stAuthor
);
xlsx_context
->
get_comments_context
().
set_visibly
(
note
->
note_sh
.
fShow
);
xlsx_context
->
get_drawing_context
().
set_object_id
(
xlsx_context
->
get_comments_context
().
get_id
());
xlsx_context
->
get_drawing_context
().
set_object_visible
(
note
->
note_sh
.
fShow
);
xlsx_context
->
get_drawing_context
().
set_object_anchor
(
note
->
note_sh
.
col
,
note
->
note_sh
.
row
);
if
(
xls_global_info
->
Version
<
0x0600
)
{
//todooo размеры произвольные .. можно сделать оценку по размеру строки
xlsx_context
->
get_
comments_context
().
set_size
(
120
,
64
,
note
->
note_sh
.
x_
/
12700.
,
note
->
note_sh
.
y_
/
12700.
);
xlsx_context
->
get_
drawing_context
().
set_child_anchor
(
120
,
64
,
note
->
note_sh
.
x_
/
12700.
,
note
->
note_sh
.
y_
/
12700.
);
xlsx_context
->
get_comments_context
().
set_content
(
std
::
wstring
(
L"<t>"
)
+
note
->
note_sh
.
stText
.
value
()
+
std
::
wstring
(
L"</t>"
));
xlsx_context
->
get_comments_context
().
end_comment
();
}
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h
View file @
a3274076
...
...
@@ -79,6 +79,7 @@ namespace ODRAW
{
class
OfficeArtRecord
;
class
OfficeArtBStoreContainer
;
class
OfficeArtSpgrContainer
;
class
OfficeArtSpContainer
;
class
OfficeArtFOPT
;
class
OfficeArtFSP
;
...
...
@@ -118,7 +119,8 @@ public:
void
convert
(
XLS
::
IMDATA
*
imadata
);
void
convert
(
ODRAW
::
OfficeArtRecord
*
art
);
void
convert
(
ODRAW
::
OfficeArtBStoreContainer
*
art_bstore
);
void
convert
(
ODRAW
::
OfficeArtBStoreContainer
*
art_bstore
,
int
start_id
=
0
);
void
convert
(
ODRAW
::
OfficeArtSpgrContainer
*
spgr
);
void
convert
(
ODRAW
::
OfficeArtSpContainer
*
sp
,
bool
anchor_only
=
false
);
void
convert
(
ODRAW
::
OfficeArtFOPT
*
fort
);
void
convert
(
ODRAW
::
OfficeArtFSP
*
fsp
);
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments.cpp
View file @
a3274076
...
...
@@ -102,106 +102,6 @@ public:
}
}
}
void
serialize_vml
(
std
::
wostream
&
strm
)
const
{
_CP_OPT
(
std
::
wstring
)
strVal
;
_CP_OPT
(
double
)
dVal
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"xml"
)
{
CP_XML_ATTR
(
L"xmlns:v"
,
L"urn:schemas-microsoft-com:vml"
);
CP_XML_ATTR
(
L"xmlns:o"
,
L"urn:schemas-microsoft-com:office:office"
);
CP_XML_ATTR
(
L"xmlns:x"
,
L"urn:schemas-microsoft-com:office:excel"
);
CP_XML_NODE
(
L"v:shapetype"
)
{
CP_XML_ATTR
(
L"id"
,
L"_x0000_t202"
);
CP_XML_ATTR
(
L"coordsize"
,
L"21600,21600"
);
CP_XML_ATTR
(
L"o:spt"
,
L"202"
);
CP_XML_ATTR
(
L"path"
,
L"m,l,21600r21600,l21600,xe"
);
CP_XML_NODE
(
L"v:stroke"
)
{
CP_XML_ATTR
(
L"joinstyle"
,
L"miter"
);
}
CP_XML_NODE
(
L"v:path"
)
{
CP_XML_ATTR
(
L"gradientshapeok"
,
L"t"
);
CP_XML_ATTR
(
L"o:connecttype"
,
L"rect"
);
}
}
int
count
=
0
;
BOOST_FOREACH
(
_xlsx_comment
const
&
c
,
xlsx_comment_
)
{
CP_XML_NODE
(
L"v:shape"
)
{
CP_XML_ATTR
(
L"fillcolor"
,
std
::
wstring
(
L"#"
)
+
c
.
fill_
);
CP_XML_ATTR
(
L"id"
,
L"shape_"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
count
++
));
std
::
wstring
style
=
std
::
wstring
(
L"position:absolute;"
);
//todooo сделать "покороче" значения .. достаточно 2 знаков после запятой
style
+=
std
::
wstring
(
L"margin-left:"
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
c
.
left_
)
+
std
::
wstring
(
L"pt;"
);
style
+=
std
::
wstring
(
L"margin-top:"
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
c
.
top_
)
+
std
::
wstring
(
L"pt;"
);
style
+=
std
::
wstring
(
L"width:"
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
c
.
width_
)
+
std
::
wstring
(
L"pt;"
);
style
+=
std
::
wstring
(
L"height:"
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
c
.
height_
)
+
std
::
wstring
(
L"pt;"
);
style
+=
std
::
wstring
(
L"z-index:"
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
count
)
+
std
::
wstring
(
L";"
);
if
(
c
.
visibly_
==
false
)
style
+=
std
::
wstring
(
L"visibility:hidden;"
);
CP_XML_ATTR
(
L"style"
,
style
);
CP_XML_ATTR
(
L"type"
,
L"_x0000_t202"
);
// CP_XML_ATTR(L"opacity",boost::lexical_cast<std::wstring>((int)(100.-dVal.get())) + L"%");
CP_XML_NODE
(
L"v:shadow"
)
{
CP_XML_ATTR
(
L"color"
,
L"black"
);
CP_XML_ATTR
(
L"obscured"
,
L"t"
);
CP_XML_ATTR
(
L"on"
,
L"t"
);
}
CP_XML_NODE
(
L"v:wrap"
)
{
CP_XML_ATTR
(
L"v:type"
,
L"none"
);
}
CP_XML_NODE
(
L"v:fill"
)
{
CP_XML_ATTR
(
L"color"
,
std
::
wstring
(
L"#"
)
+
c
.
fill_
);
//CP_XML_ATTR(L"color2" , std::wstring(L"#") + c.fill_);
CP_XML_ATTR
(
L"type"
,
L"solid"
);
// CP_XML_ATTR(L"opacity", (dVal.get())/100.);
}
CP_XML_NODE
(
L"v:stroke"
)
{
CP_XML_ATTR
(
L"color"
,
std
::
wstring
(
L"#"
)
+
c
.
line_
);
// CP_XML_ATTR(L"opacity",(100.-dVal.get())/100.);
}
CP_XML_NODE
(
L"x:ClientData"
)
{
CP_XML_ATTR
(
L"ObjectType"
,
L"Note"
);
CP_XML_NODE
(
L"x:MoveWithCells"
){}
CP_XML_NODE
(
L"x:SizeWithCells"
){}
if
(
!
c
.
anchor_
.
empty
())
{
CP_XML_NODE
(
L"x:Anchor"
){
CP_XML_CONTENT
(
c
.
anchor_
);}
}
CP_XML_NODE
(
L"x:AutoFill"
)
{
CP_XML_CONTENT
(
"False"
);}
CP_XML_NODE
(
L"x:Row"
)
{
CP_XML_CONTENT
(
c
.
row_
);}
CP_XML_NODE
(
L"x:Column"
)
{
CP_XML_CONTENT
(
c
.
col_
);}
if
(
c
.
visibly_
)
CP_XML_NODE
(
L"x:Visible"
);
}
}
}
}
}
}
bool
empty
()
const
{
return
(
xlsx_comment_
.
empty
());
...
...
@@ -251,11 +151,6 @@ void xlsx_comments::serialize(std::wostream & _Wostream)
impl_
->
serialize
(
_Wostream
);
}
void
xlsx_comments
::
serialize_vml
(
std
::
wostream
&
_Wostream
)
{
impl_
->
serialize_vml
(
_Wostream
);
}
xlsx_comments_ptr
xlsx_comments
::
create
()
{
return
boost
::
make_shared
<
xlsx_comments
>
();
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments.h
View file @
a3274076
...
...
@@ -38,18 +38,10 @@
namespace
oox
{
struct
_xlsx_comment
{
double
left_
,
top_
;
double
width_
,
height_
;
std
::
wstring
anchor_
;
struct
_xlsx_comment
{
std
::
wstring
ref_
;
std
::
wstring
fill_
;
std
::
wstring
line_
;
int
col_
;
int
row_
;
...
...
@@ -57,23 +49,20 @@ namespace oox {
std
::
wstring
author_
;
std
::
wstring
content_
;
};
};
class
xlsx_comments
;
typedef
_CP_PTR
(
xlsx_comments
)
xlsx_comments_ptr
;
struct
comment_elm
{
comment_elm
(
std
::
wstring
const
&
_filename
,
std
::
wstring
const
&
_
vml_filename
,
std
::
wstring
const
&
_content
,
std
::
wstring
const
&
_vml_
content
,
xlsx_comments_ptr
_comments
)
:
filename
(
_filename
),
content
(
_content
),
comments
(
_comments
)
,
vml_filename
(
_vml_filename
),
vml_content
(
_vml_content
)
comment_elm
(
std
::
wstring
const
&
_filename
,
std
::
wstring
const
&
_content
,
xlsx_comments_ptr
_comments
)
:
filename
(
_filename
),
content
(
_content
),
comments
(
_comments
)
{}
xlsx_comments_ptr
comments
;
std
::
wstring
filename
;
std
::
wstring
content
;
std
::
wstring
vml_filename
;
std
::
wstring
vml_content
;
};
class
xlsx_comments
...
...
@@ -88,7 +77,6 @@ public:
bool
empty
()
const
;
void
serialize
(
std
::
wostream
&
strm
);
void
serialize_vml
(
std
::
wostream
&
strm
);
private:
class
Impl
;
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments_context.cpp
View file @
a3274076
...
...
@@ -46,32 +46,23 @@ typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
class
xlsx_comments_context_handle
::
Impl
{
public:
Impl
()
:
next_comments_id_
(
1
)
,
next_file_id_
(
1
)
Impl
()
:
next_comments_id_
(
1
)
,
next_comments_file_id_
(
1
)
{
}
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
add_comments_xml
(
std
::
wstring
const
&
content
,
std
::
wstring
const
&
vml_content
,
xlsx_comments_ptr
comments
)
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
add_comments_xml
(
std
::
wstring
const
&
content
,
xlsx_comments_ptr
comments
)
{
const
std
::
wstring
file_
id
=
boost
::
lexical_cast
<
std
::
wstring
>
(
next
_file_id_
++
);
const
std
::
wstring
file_
comments_id
=
boost
::
lexical_cast
<
std
::
wstring
>
(
next_comments
_file_id_
++
);
const
std
::
wstring
fileName
=
std
::
wstring
(
L"comments"
)
+
file_id
+
L".xml"
;
const
std
::
wstring
vml_fileName
=
std
::
wstring
(
L"vmlDrawing"
)
+
file_id
+
L".vml"
;
const
std
::
wstring
fileName
=
std
::
wstring
(
L"comments"
)
+
file_comments_id
+
L".xml"
;
comments_
.
push_back
(
comment_elm
(
fileName
,
vml_fileName
,
content
,
vml_
content
,
comments
));
comments_
.
push_back
(
comment_elm
(
fileName
,
content
,
comments
));
const
std
::
wstring
id
=
boost
::
lexical_cast
<
std
::
wstring
>
(
next_comments_id_
++
);
const
std
::
wstring
rId
=
std
::
wstring
(
L"comId"
)
+
id
;
return
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
fileName
,
rId
);
}
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
get_vml_drawing_xml
()
{
const
std
::
wstring
id
=
boost
::
lexical_cast
<
std
::
wstring
>
(
next_comments_id_
++
);
const
std
::
wstring
rId
=
std
::
wstring
(
L"comId"
)
+
id
;
return
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
comments_
.
back
().
vml_filename
,
rId
);
}
const
std
::
vector
<
comment_elm
>
&
content
()
const
{
return
comments_
;
...
...
@@ -82,11 +73,12 @@ private:
std
::
vector
<
comment_elm
>
comments_
;
size_t
next_comments_id_
;
size_t
next_file_id_
;
size_t
next_comments_file_id_
;
};
xlsx_comments_context_handle
::
xlsx_comments_context_handle
()
:
impl_
(
new
xlsx_comments_context_handle
::
Impl
(
))
xlsx_comments_context_handle
::
xlsx_comments_context_handle
(
/*size_t & next_vml_file_id*/
)
:
impl_
(
new
xlsx_comments_context_handle
::
Impl
(
/*next_vml_file_id*/
))
{
}
...
...
@@ -94,13 +86,9 @@ xlsx_comments_context_handle::~xlsx_comments_context_handle()
{
}
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
xlsx_comments_context_handle
::
add_comments_xml
(
std
::
wstring
const
&
content
,
std
::
wstring
const
&
vml_content
,
xlsx_comments_ptr
comments
)
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
xlsx_comments_context_handle
::
add_comments_xml
(
std
::
wstring
const
&
content
,
xlsx_comments_ptr
comments
)
{
return
impl_
->
add_comments_xml
(
content
,
vml_content
,
comments
);
}
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
xlsx_comments_context_handle
::
get_vml_drawing_xml
()
{
return
impl_
->
get_vml_drawing_xml
();
return
impl_
->
add_comments_xml
(
content
,
comments
);
}
const
std
::
vector
<
comment_elm
>
&
xlsx_comments_context_handle
::
content
()
const
...
...
@@ -112,7 +100,7 @@ class xlsx_comments_context::Impl
{
public:
Impl
(
xlsx_comments_context_handle
&
handle
)
:
xlsx_comments_
(
xlsx_comments
::
create
()),
handle_
(
handle
)
handle_
(
handle
)
,
count_comments_
(
0
)
{}
xlsx_comments_context_handle
&
handle_
;
...
...
@@ -121,16 +109,13 @@ public:
void
add_comment
(
_xlsx_comment
&
d
)
{
xlsx_comments_
->
add
(
d
);
count_comments_
++
;
}
void
write_comments
(
std
::
wostream
&
strm
)
{
xlsx_comments_
->
serialize
(
strm
);
}
void
write_comments_vml
(
std
::
wostream
&
strm
)
{
xlsx_comments_
->
serialize_vml
(
strm
);
}
bool
empty
()
const
{
return
xlsx_comments_
->
empty
();
...
...
@@ -140,8 +125,10 @@ public:
{
return
xlsx_comments_
;
}
int
get_count_comments
()
{
return
count_comments_
;}
private:
xlsx_comments_ptr
xlsx_comments_
;
int
count_comments_
;
};
...
...
@@ -158,22 +145,14 @@ void xlsx_comments_context::start_comment ()
{
impl_
->
current_
.
ref_
=
L""
;
impl_
->
current_
.
visibly_
=
false
;
impl_
->
current_
.
fill_
=
L"FFFFE1"
;
impl_
->
current_
.
line_
=
L"3465af"
;
impl_
->
current_
.
anchor_
=
L""
;
impl_
->
current_
.
left_
=
impl_
->
current_
.
top_
=
impl_
->
current_
.
width_
=
impl_
->
current_
.
height_
=
0
;
}
void
xlsx_comments_context
::
set_size
(
double
width_pt
,
double
height_pt
,
double
x_pt
,
double
y_pt
)
{
impl_
->
current_
.
width_
=
width_pt
;
impl_
->
current_
.
height_
=
height_pt
;
impl_
->
current_
.
left_
=
x_pt
;
impl_
->
current_
.
top_
=
y_pt
;
int
xlsx_comments_context
::
get_id
()
{
return
impl_
->
get_count_comments
()
+
1
;
}
void
xlsx_comments_context
::
set_content
(
std
::
wstring
content
)
{
impl_
->
current_
.
content_
=
content
;
...
...
@@ -186,10 +165,7 @@ void xlsx_comments_context::set_visibly(bool Val)
{
impl_
->
current_
.
visibly_
=
Val
;
}
void
xlsx_comments_context
::
set_anchor
(
std
::
wstring
val
)
{
impl_
->
current_
.
anchor_
=
val
;
}
void
xlsx_comments_context
::
set_ref
(
std
::
wstring
ref
,
int
col
,
int
row
)
{
impl_
->
current_
.
ref_
=
ref
;
...
...
@@ -197,16 +173,6 @@ void xlsx_comments_context::set_ref(std::wstring ref, int col, int row)
impl_
->
current_
.
col_
=
col
;
impl_
->
current_
.
row_
=
row
;
}
void
xlsx_comments_context
::
set_fill_color
(
std
::
wstring
color
)
{
if
(
color
.
empty
())
return
;
impl_
->
current_
.
fill_
=
color
;
}
void
xlsx_comments_context
::
set_line_color
(
std
::
wstring
color
)
{
if
(
color
.
empty
())
return
;
impl_
->
current_
.
line_
=
color
;
}
void
xlsx_comments_context
::
end_comment
()
{
...
...
@@ -224,10 +190,6 @@ void xlsx_comments_context::write_comments(std::wostream & strm)
{
impl_
->
write_comments
(
strm
);
}
void
xlsx_comments_context
::
write_comments_vml
(
std
::
wostream
&
strm
)
{
impl_
->
write_comments_vml
(
strm
);
}
xlsx_comments_ptr
xlsx_comments_context
::
get_comments
()
{
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_comments_context.h
View file @
a3274076
...
...
@@ -46,11 +46,10 @@ typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
class
xlsx_comments_context_handle
{
public:
xlsx_comments_context_handle
();
~
xlsx_comments_context_handle
();
xlsx_comments_context_handle
();
~
xlsx_comments_context_handle
();
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
add_comments_xml
(
std
::
wstring
const
&
content
,
std
::
wstring
const
&
vml_content
,
xlsx_comments_ptr
comments
);
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
get_vml_drawing_xml
();
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
add_comments_xml
(
std
::
wstring
const
&
content
,
xlsx_comments_ptr
comments
);
const
std
::
vector
<
comment_elm
>
&
content
()
const
;
friend
class
xlsx_comments_context
;
...
...
@@ -70,21 +69,18 @@ public:
void
start_comment
();
int
get_id
();
void
set_content
(
std
::
wstring
content
);
void
set_author
(
std
::
wstring
author
);
void
set_anchor
(
std
::
wstring
anchor
);
void
set_size
(
double
width_pt
,
double
height_pt
,
double
x_pt
,
double
y_pt
);
void
set_ref
(
std
::
wstring
ref
,
int
col
,
int
row
);
void
set_visibly
(
bool
Val
);
void
set_fill_color
(
std
::
wstring
color
);
void
set_line_color
(
std
::
wstring
color
);
void
end_comment
();
bool
empty
()
const
;
void
write_comments
(
std
::
wostream
&
strm
);
void
write_comments_vml
(
std
::
wostream
&
strm
);
xlsx_comments_ptr
get_comments
();
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp
View file @
a3274076
...
...
@@ -44,9 +44,10 @@
namespace
oox
{
xlsx_conversion_context
::
xlsx_conversion_context
(
package
::
xlsx_document
*
outputDocument
)
:
output_document_
(
outputDocument
),
xlsx_table_context_
(
*
this
),
xlsx_drawing_context_handle_
(
get_mediaitems
())
xlsx_conversion_context
::
xlsx_conversion_context
(
package
::
xlsx_document
*
outputDocument
)
:
output_document_
(
outputDocument
),
next_vml_file_id_
(
1
),
xlsx_table_context_
(
*
this
),
xlsx_drawing_context_handle_
(
next_vml_file_id_
,
get_mediaitems
())
{
}
xlsx_conversion_context
::~
xlsx_conversion_context
()
...
...
@@ -178,6 +179,15 @@ void xlsx_conversion_context::end_document()
static
const
std
::
wstring
kType
=
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"
;
const
std
::
wstring
dName
=
std
::
wstring
(
L"../drawings/"
+
p3
.
first
);
content
->
add_rel
(
relationship
(
dId
,
kType
,
dName
));
}
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
p4
=
sheet
->
get_vml_drawing_HF_link
();
if
(
!
p4
.
first
.
empty
())
{
const
std
::
wstring
dId
=
p4
.
second
;
static
const
std
::
wstring
kType
=
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"
;
const
std
::
wstring
dName
=
std
::
wstring
(
L"../drawings/"
+
p4
.
first
);
content
->
add_rel
(
relationship
(
dId
,
kType
,
dName
));
}
/////////////////////////////////////////////////////////////////////////////////////////////////
sheet
->
write_to
(
content
->
content
());
...
...
@@ -262,6 +272,9 @@ void xlsx_conversion_context::end_document()
package
::
xl_drawings_ptr
drawings
=
package
::
xl_drawings
::
create
(
xlsx_drawing_context_handle_
.
content
());
output_document_
->
get_xl_files
().
set_drawings
(
drawings
);
package
::
xl_drawings_ptr
drawings_vml
=
package
::
xl_drawings
::
create
(
xlsx_drawing_context_handle_
.
content_vml
());
output_document_
->
get_xl_files
().
set_vml_drawings
(
drawings_vml
);
package
::
xl_comments_ptr
comments
=
package
::
xl_comments
::
create
(
xlsx_comments_context_handle_
.
content
());
output_document_
->
get_xl_files
().
set_comments
(
comments
);
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h
View file @
a3274076
...
...
@@ -55,7 +55,7 @@ namespace package
class
xlsx_conversion_context
:
boost
::
noncopyable
{
public:
xlsx_conversion_context
(
package
::
xlsx_document
*
outputDocument
);
xlsx_conversion_context
(
package
::
xlsx_document
*
outputDocument
);
~
xlsx_conversion_context
();
//void set_font_directory(std::wstring pathFonts);
...
...
@@ -103,6 +103,8 @@ private:
//num_format_context num_format_context_;
//size_t default_style_;
size_t
next_vml_file_id_
;
//используется для footer/header & comments
xlsx_table_context
xlsx_table_context_
;
xlsx_text_context
xlsx_text_context_
;
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
View file @
a3274076
This diff is collapsed.
Click to expand it.
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.h
View file @
a3274076
...
...
@@ -61,11 +61,14 @@ namespace oox {
class
xlsx_drawing_context_handle
{
public:
xlsx_drawing_context_handle
(
external_items
&
items
);
xlsx_drawing_context_handle
(
size_t
&
next_vml_file_id
,
external_items
&
items
);
~
xlsx_drawing_context_handle
();
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
add_drawing_xml
(
std
::
wstring
const
&
content
,
xlsx_drawings_rels_ptr
rels
);
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
add_drawing_xml
(
std
::
wstring
const
&
content
,
xlsx_drawings_rels_ptr
rels
);
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
add_drawing_vml
(
std
::
wstring
const
&
content
,
xlsx_drawings_rels_ptr
rels
);
const
std
::
vector
<
drawing_elm
>
&
content
()
const
;
const
std
::
vector
<
drawing_elm
>
&
content_vml
()
const
;
friend
class
xlsx_drawing_context
;
private:
...
...
@@ -131,7 +134,8 @@ public:
_drawing_state
()
:
shape_id
(
msosptRectangle
),
flipH
(
false
),
flipV
(
false
),
bTextBox
(
false
),
type_anchor
(
0
)
type_anchor
(
0
),
vmlwrite_mode_
(
false
)
{
id
=
-
1
;
rotation
=
0
;
...
...
@@ -161,6 +165,7 @@ public:
int
type_anchor
;
bool
vmlwrite_mode_
;
std
::
wstring
shape
;
int
id
;
...
...
@@ -267,6 +272,14 @@ public:
_fill
fill
;
_arrow
arrow
;
}
line
;
struct
_object
{
_object
()
{
visible
=
false
;
col
=
row
=
0
;
id
=
0
;}
int
id
;
bool
visible
;
int
col
;
int
row
;
}
object
;
//for group
std
::
vector
<
_drawing_state_ptr
>
drawing_states
;
std
::
vector
<
_drawing_state_ptr
>*
parent_drawing_states
;
...
...
@@ -287,11 +300,16 @@ public:
external_items
::
Type
getType
();
xlsx_drawings_rels_ptr
get_drawings_rels
();
xlsx_drawings_rels_ptr
get_rels
();
xlsx_drawings_rels_ptr
get_vml_HF_rels
();
xlsx_drawings_rels_ptr
get_vml_comments_rels
();
bool
empty
();
bool
empty_vml_HF
();
void
start_group
();
bool
start_drawing
(
int
type
);
//--------------------------------------------------------------------------------------
void
start_image
();
void
start_shape
(
int
type
);
void
start_chart
();
...
...
@@ -301,6 +319,9 @@ public:
void
set_FlipH
();
void
set_FlipV
();
void
set_shape_id
(
int
id
);
//--------------------------------------------------------------------------------------
void
set_mode_vmlwrite
(
bool
val
);
bool
get_mode_vmlwrite
();
//--------------------------------------------------------------------------------------
void
set_name
(
const
std
::
wstring
&
str
);
void
set_description
(
const
std
::
wstring
&
str
);
...
...
@@ -366,7 +387,11 @@ public:
void
set_wordart_strike
(
bool
val
);
void
set_wordart_vertical
(
bool
val
);
void
set_wordart_spacing
(
double
val
);
//---------------------------------------------------------------------------------------------
void
set_object_id
(
int
val
);
void
set_object_visible
(
bool
val
);
void
set_object_anchor
(
int
col
,
int
row
);
//---------------------------------------------------------------------------------------------
void
set_custom_rect
(
_rect
&
rect
);
void
set_custom_verticles
(
std
::
vector
<
ODRAW
::
MSOPOINT
>
&
points
);
void
set_custom_segments
(
std
::
vector
<
ODRAW
::
MSOPATHINFO
>&
segments
);
...
...
@@ -380,9 +405,19 @@ public:
void
serialize_chart
(
_drawing_state_ptr
&
drawing_state
,
std
::
wstring
rId
);
void
serialize_pic
(
_drawing_state_ptr
&
drawing_state
,
std
::
wstring
rId
);
void
serialize
(
std
::
wostream
&
stream
,
_drawing_state_ptr
&
drawing_state
);
void
serialize_shape_comment
(
_drawing_state_ptr
&
drawing_state
);
//part of vml shape
//-----------------------------------------------------------------------------------
void
serialize_vml_shape
(
_drawing_state_ptr
&
drawing_state
);
void
serialize_vml_pic
(
_drawing_state_ptr
&
drawing_state
,
std
::
wstring
rId
);
//-----------------------------------------------------------------------------------
void
serialize_fill
(
std
::
wostream
&
stream
,
_drawing_state_ptr
&
drawing_state
);
void
serialize_fill
(
std
::
wostream
&
stream
);
//-----------------------------------------------------------------------------------
void
serialize
(
std
::
wostream
&
stream
,
_drawing_state_ptr
&
drawing_state
);
void
serialize_vml
(
std
::
wostream
&
stream
,
_drawing_state_ptr
&
drawing_state
);
//-----------------------------------------------------------------------------------
void
serialize_vml_HF
(
std
::
wostream
&
stream
);
void
serialize_vml_comments
(
std
::
wostream
&
stream
);
void
serialize
(
std
::
wostream
&
stream
);
//-----------------------------------------------------------------------------------
bool
is_lined_shape
(
_drawing_state_ptr
&
drawing_state
);
...
...
@@ -393,12 +428,19 @@ private:
xlsx_conversion_context
&
context_
;
xlsx_drawing_context_handle
&
handle_
;
xlsx_drawings_rels_ptr
rels_
;
xlsx_drawings_rels_ptr
vml_comments_rels_
;
xlsx_drawings_rels_ptr
vml_HF_rels_
;
int
count_object
;
bool
in_chart_
;
std
::
vector
<
_hlink_desc
>
hlinks_
;
std
::
vector
<
_drawing_state_ptr
>
drawing_states_vml_HF
;
std
::
vector
<
_drawing_state_ptr
>
drawing_states_vml_comments
;
std
::
vector
<
_drawing_state_ptr
>
drawing_states
;
std
::
vector
<
_drawing_state_ptr
>*
current_drawing_states
;
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_output_xml.cpp
View file @
a3274076
...
...
@@ -63,7 +63,7 @@ public:
std
::
wstringstream
sortAndFilters_
;
std
::
wstringstream
customViews_
;
std
::
wstringstream
conditionalFormatting_
;
std
::
wstringstream
picture_
;
std
::
wstringstream
picture_
background_
;
rels
rels_
;
...
...
@@ -75,6 +75,9 @@ public:
std
::
wstring
vml_drawingName_
;
std
::
wstring
vml_drawingId_
;
std
::
wstring
vml_drawingName_HF_
;
std
::
wstring
vml_drawingId_HF_
;
};
std
::
wstring
xlsx_xml_worksheet
::
name
()
const
...
...
@@ -137,10 +140,10 @@ std::wostream & xlsx_xml_worksheet::pageProperties()
{
return
impl_
->
pageProperties_
;
}
std
::
wostream
&
xlsx_xml_worksheet
::
comments
()
{
return
impl_
->
comments_
;
}
//
std::wostream & xlsx_xml_worksheet::comments()
//
{
//
return impl_->comments_;
//
}
std
::
wostream
&
xlsx_xml_worksheet
::
hyperlinks
()
{
return
impl_
->
hyperlinks_
;
...
...
@@ -157,9 +160,9 @@ std::wostream & xlsx_xml_worksheet::conditionalFormatting()
{
return
impl_
->
conditionalFormatting_
;
}
std
::
wostream
&
xlsx_xml_worksheet
::
picture
()
std
::
wostream
&
xlsx_xml_worksheet
::
picture
_background
()
{
return
impl_
->
picture_
;
return
impl_
->
picture_
background_
;
}
//-----------------------------------------------------------------
...
...
@@ -207,15 +210,22 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM
()
<<
impl_
->
drawing_
.
str
();
if
(
impl_
->
commentsId_
.
length
()
>
0
)
if
(
!
impl_
->
commentsId_
.
empty
()
&&
!
impl_
->
vml_drawingId_
.
empty
()
)
{
CP_XML_NODE
(
L"legacyDrawing"
)
{
CP_XML_ATTR
(
L"r:id"
,
impl_
->
vml_drawingId_
);
CP_XML_ATTR
(
L"r:id"
,
impl_
->
vml_drawingId_
);
}
}
if
(
!
impl_
->
vml_drawingId_HF_
.
empty
())
{
CP_XML_NODE
(
L"legacyDrawingHF"
)
{
CP_XML_ATTR
(
L"r:id"
,
impl_
->
vml_drawingId_HF_
);
}
}
CP_XML_STREAM
()
<<
impl_
->
picture_
.
str
();
CP_XML_STREAM
()
<<
impl_
->
picture_
background_
.
str
();
//CP_XML_NODE(L"rowBreaks){}
...
...
@@ -242,6 +252,11 @@ void xlsx_xml_worksheet::set_vml_drawing_link(std::wstring const & fileName, std
impl_
->
vml_drawingName_
=
fileName
;
impl_
->
vml_drawingId_
=
id
;
}
void
xlsx_xml_worksheet
::
set_vml_drawing_link_HF
(
std
::
wstring
const
&
fileName
,
std
::
wstring
const
&
id
)
{
impl_
->
vml_drawingName_HF_
=
fileName
;
impl_
->
vml_drawingId_HF_
=
id
;
}
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
xlsx_xml_worksheet
::
get_drawing_link
()
const
{
return
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
impl_
->
drawingName_
,
impl_
->
drawingId_
);
...
...
@@ -254,6 +269,10 @@ std::pair<std::wstring, std::wstring> xlsx_xml_worksheet::get_vml_drawing_link()
{
return
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
impl_
->
vml_drawingName_
,
impl_
->
vml_drawingId_
);
}
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
xlsx_xml_worksheet
::
get_vml_drawing_HF_link
()
const
{
return
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
impl_
->
vml_drawingName_HF_
,
impl_
->
vml_drawingId_HF_
);
}
}
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_output_xml.h
View file @
a3274076
...
...
@@ -63,12 +63,12 @@ public:
std
::
wostream
&
hyperlinks
();
std
::
wostream
&
mergeCells
();
std
::
wostream
&
drawing
();
std
::
wostream
&
comments
();
//
std::wostream & comments();
std
::
wostream
&
sheetSortAndFilters
();
std
::
wostream
&
pageProperties
();
std
::
wostream
&
customViews
();
std
::
wostream
&
conditionalFormatting
();
std
::
wostream
&
picture
();
std
::
wostream
&
picture
_background
();
rels
&
sheet_rels
();
//hyperlink, background image, external, media ...
...
...
@@ -78,9 +78,11 @@ public:
void
set_vml_drawing_link
(
std
::
wstring
const
&
fileName
,
std
::
wstring
const
&
id
);
void
set_comments_link
(
std
::
wstring
const
&
fileName
,
std
::
wstring
const
&
id
);
void
set_state
(
std
::
wstring
const
&
state
);
void
set_vml_drawing_link_HF
(
std
::
wstring
const
&
fileName
,
std
::
wstring
const
&
id
);
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
get_drawing_link
()
const
;
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
get_vml_drawing_link
()
const
;
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
get_vml_drawing_HF_link
()
const
;
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
get_comments_link
()
const
;
static
xlsx_xml_worksheet_ptr
create
(
std
::
wstring
const
&
name
);
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.cpp
View file @
a3274076
...
...
@@ -217,6 +217,12 @@ void xl_files::write(const std::wstring & RootPath)
comments_
->
set_main_document
(
get_main_document
());
comments_
->
write
(
path
);
}
if
(
vml_drawings_
)
{
vml_drawings_
->
set_main_document
(
get_main_document
());
vml_drawings_
->
write
(
path
);
}
rels_files_
.
write
(
path
);
}
...
...
@@ -255,6 +261,8 @@ void xl_files::set_drawings(element_ptr Element)
void
xl_files
::
set_vml_drawings
(
element_ptr
Element
)
{
vml_drawings_
=
Element
;
xl_drawings
*
d
=
dynamic_cast
<
xl_drawings
*>
(
vml_drawings_
.
get
());
d
->
vml
=
true
;
}
void
xl_files
::
add_charts
(
chart_content_ptr
chart
)
{
...
...
@@ -320,8 +328,14 @@ void xl_drawings::write(const std::wstring & RootPath)
content_type
&
contentTypes
=
this
->
get_main_document
()
->
content_type
().
get_content_type
();
const
std
::
wstring
kDrawingCT
=
L"application/vnd.openxmlformats-officedocument.drawing+xml"
;
contentTypes
.
add_override
(
L"/xl/drawings/"
+
e
.
filename
,
kDrawingCT
);
if
(
vml
)
{
contentTypes
.
add_override
(
L"/xl/drawings/"
+
e
.
filename
,
L"application/vnd.openxmlformats-officedocument.vmlDrawing"
);
}
else
{
contentTypes
.
add_override
(
L"/xl/drawings/"
+
e
.
filename
,
L"application/vnd.openxmlformats-officedocument.drawing+xml"
);
}
}
}
...
...
@@ -344,7 +358,6 @@ void xl_comments::write(const std::wstring & RootPath)
contentTypes
.
add_override
(
std
::
wstring
(
L"/xl/"
)
+
e
.
filename
,
kWSConType
);
package
::
simple_element
(
e
.
filename
,
e
.
content
).
write
(
RootPath
);
package
::
simple_element
(
e
.
vml_filename
,
e
.
vml_content
).
write
(
vml_path
);
}
}
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.h
View file @
a3274076
...
...
@@ -67,7 +67,6 @@ private:
rels_file_ptr
rels_
;
};
/// \class sheets_files
class
sheets_files
:
public
element
{
public:
...
...
@@ -88,7 +87,6 @@ public:
};
/// \class xl_charts_files
class
xl_charts_files
:
public
element
{
public:
...
...
@@ -105,7 +103,6 @@ public:
class
xl_comments
;
typedef
_CP_PTR
(
xl_comments
)
xl_comments_ptr
;
/// \class xl_comments
class
xl_comments
:
public
element
{
public:
...
...
@@ -128,13 +125,14 @@ typedef _CP_PTR(xl_drawings) xl_drawings_ptr;
class
xl_drawings
:
public
element
{
public:
bool
vml
;
virtual
void
write
(
const
std
::
wstring
&
RootPath
);
void
set_rels
(
rels_files
*
rels
)
{
rels_
=
rels
;
}
xl_drawings
(
const
std
::
vector
<
drawing_elm
>
&
elms
)
:
drawings_
(
elms
)
xl_drawings
(
const
std
::
vector
<
drawing_elm
>
&
elms
)
:
drawings_
(
elms
)
,
vml
(
false
)
{
}
...
...
@@ -146,7 +144,6 @@ private:
};
/// \class xl_files
class
xl_files
:
public
element
{
public:
...
...
@@ -155,15 +152,15 @@ public:
public:
virtual
void
write
(
const
std
::
wstring
&
RootPath
);
void
set_workbook
(
element_ptr
Element
);
void
set_styles
(
element_ptr
Element
);
void
set_sharedStrings
(
element_ptr
Element
);
void
add_sheet
(
sheet_content_ptr
sheet
);
void
set_media
(
external_items
&
_Mediaitems
);
void
set_drawings
(
element_ptr
Element
);
void
set_vml_drawings
(
element_ptr
Element
);
void
set_comments
(
element_ptr
Element
);
void
add_charts
(
chart_content_ptr
chart
);
void
set_workbook
(
element_ptr
Element
);
void
set_styles
(
element_ptr
Element
);
void
set_sharedStrings
(
element_ptr
Element
);
void
add_sheet
(
sheet_content_ptr
sheet
);
void
set_media
(
external_items
&
_Mediaitems
);
void
set_drawings
(
element_ptr
Element
);
void
set_vml_drawings
(
element_ptr
Element
);
void
set_comments
(
element_ptr
Element
);
void
add_charts
(
chart_content_ptr
chart
);
private:
rels_files
rels_files_
;
...
...
@@ -181,7 +178,6 @@ private:
};
/// \class xlsx_document
class
xlsx_document
:
public
document
{
public:
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_tablecontext.cpp
View file @
a3274076
...
...
@@ -69,7 +69,7 @@ void xlsx_table_context::end_table()
get_drawing_context
().
serialize
(
strm
);
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
drawingName
=
context_
.
get_drawing_context_handle
().
add_drawing_xml
(
strm
.
str
(),
get_drawing_context
().
get_
drawings_
rels
());
context_
.
get_drawing_context_handle
().
add_drawing_xml
(
strm
.
str
(),
get_drawing_context
().
get_rels
());
context_
.
current_sheet
().
set_drawing_link
(
drawingName
.
first
,
drawingName
.
second
);
...
...
@@ -80,6 +80,17 @@ void xlsx_table_context::end_table()
CP_XML_ATTR
(
L"r:id"
,
drawingName
.
second
);
}
}
}
if
(
!
get_drawing_context
().
empty_vml_HF
())
{
std
::
wstringstream
strm
;
get_drawing_context
().
serialize_vml_HF
(
strm
);
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
vmlDrawingName
=
context_
.
get_drawing_context_handle
().
add_drawing_vml
(
strm
.
str
(),
get_drawing_context
().
get_vml_HF_rels
());
context_
.
current_sheet
().
set_vml_drawing_link_HF
(
vmlDrawingName
.
first
,
vmlDrawingName
.
second
);
}
if
(
!
get_comments_context
().
empty
())
{
...
...
@@ -87,16 +98,16 @@ void xlsx_table_context::end_table()
get_comments_context
().
write_comments
(
strm
);
std
::
wstringstream
vml_strm
;
get_comments_context
().
write_comments_vml
(
vml_strm
);
get_drawing_context
().
serialize_vml_comments
(
vml_strm
);
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
commentsName
=
context_
.
get_comments_context_handle
().
add_comments_xml
(
strm
.
str
(),
vml_strm
.
str
(),
context_
.
get_comments_context
().
get_comments
()
);
context_
.
get_comments_context_handle
().
add_comments_xml
(
strm
.
str
(),
context_
.
get_comments_context
().
get_comments
()
);
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
vml
_drawingName
=
context_
.
get_comments_context_handle
().
get_vml_drawing_xml
(
);
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
vml
DrawingName
=
context_
.
get_drawing_context_handle
().
add_drawing_vml
(
vml_strm
.
str
(),
get_drawing_context
().
get_vml_comments_rels
()
);
context_
.
current_sheet
().
set_comments_link
(
commentsName
.
first
,
commentsName
.
second
);
context_
.
current_sheet
().
set_vml_drawing_link
(
vml_drawingName
.
first
,
vml_d
rawingName
.
second
);
context_
.
current_sheet
().
set_comments_link
(
commentsName
.
first
,
commentsName
.
second
);
context_
.
current_sheet
().
set_vml_drawing_link
(
vmlDrawingName
.
first
,
vmlD
rawingName
.
second
);
}
}
...
...
Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h
View file @
a3274076
...
...
@@ -212,9 +212,14 @@ namespace OOX
{
if
(
sNodeName
.
IsEmpty
())
return
L""
;
CString
sResult
=
_T
(
"<"
)
+
sNodeName
+
_T
(
" m:val=
\"
"
);
CString
sResult
=
_T
(
"<"
)
+
sNodeName
;
if
(
m_val
.
IsInit
())
{
sResult
+=
_T
(
" m:val=
\"
"
);
sResult
+=
m_val
->
ToString
();
sResult
+=
_T
(
"
\"
/>"
);
sResult
+=
_T
(
"
\"
"
);
}
sResult
+=
_T
(
"/>"
);
return
sResult
;
}
...
...
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