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
a038e156
Commit
a038e156
authored
Oct 18, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XlsFormat - control objects
parent
9c7a03fd
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
164 additions
and
125 deletions
+164
-125
ASCOfficePPTXFile/PPTXFormat/Logic/CNvPr.h
ASCOfficePPTXFile/PPTXFormat/Logic/CNvPr.h
+3
-3
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp
+10
-10
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h
+1
-1
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.cpp
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.cpp
+20
-18
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.h
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.h
+2
-3
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Style.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_records/Style.cpp
+2
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/StyleExt.h
...ceXlsFile2/source/XlsFormat/Logic/Biff_records/StyleExt.h
+1
-4
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgNameX.cpp
...File2/source/XlsFormat/Logic/Biff_structures/PtgNameX.cpp
+5
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp
+8
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.cpp
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.cpp
+3
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.h
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.h
+1
-2
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
+51
-54
ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.cpp
+22
-0
ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.h
ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.h
+4
-3
ASCOfficeXlsFile2/source/XlsXlsxConverter/oox_package.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/oox_package.cpp
+19
-6
Common/DocxFormat/Source/DocxFormat/ContentTypes.h
Common/DocxFormat/Source/DocxFormat/ContentTypes.h
+1
-1
Common/DocxFormat/Source/DocxFormat/Drawing/DrawingExt.h
Common/DocxFormat/Source/DocxFormat/Drawing/DrawingExt.h
+0
-4
Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h
Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h
+6
-7
XlsxSerializerCom/Reader/BinaryWriter.h
XlsxSerializerCom/Reader/BinaryWriter.h
+5
-5
No files found.
ASCOfficePPTXFile/PPTXFormat/Logic/CNvPr.h
View file @
a038e156
...
...
@@ -99,7 +99,7 @@ namespace PPTX
ext
.
fromXML
(
oReader
);
if
(
ext
.
spid
.
IsInit
())
{
ole
Spid
=
ext
.
spid
;
vml
Spid
=
ext
.
spid
;
break
;
}
}
...
...
@@ -137,7 +137,7 @@ namespace PPTX
ext
.
fromXML
(
oNode
);
if
(
ext
.
spid
.
IsInit
())
{
ole
Spid
=
ext
.
spid
;
vml
Spid
=
ext
.
spid
;
break
;
}
}
...
...
@@ -320,7 +320,7 @@ namespace PPTX
nullable
<
Hyperlink
>
hlinkHover
;
//std::vector<Ext> extLst;
nullable_string
ole
Spid
;
nullable_string
vml
Spid
;
protected:
virtual
void
FillParentPointersForChilds
()
{
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp
View file @
a038e156
...
...
@@ -112,7 +112,7 @@ namespace PPTX
void
GraphicFrame
::
ReadAttributes3
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
WritingElement_ReadAttributes_Start
(
oReader
)
WritingElement_ReadAttributes_ReadSingle
(
oReader
,
_T
(
"spid"
),
ole
Spid
)
WritingElement_ReadAttributes_ReadSingle
(
oReader
,
_T
(
"spid"
),
vml
Spid
)
WritingElement_ReadAttributes_End
(
oReader
)
}
void
GraphicFrame
::
fromXML2
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
...
...
@@ -293,7 +293,7 @@ namespace PPTX
}
else
if
(
L"legacyDrawing"
==
strName
)
{
oNode
.
ReadAttributeBase
(
L"spid"
,
ole
Spid
);
oNode
.
ReadAttributeBase
(
L"spid"
,
vml
Spid
);
result
=
true
;
}
}
...
...
@@ -377,7 +377,7 @@ namespace PPTX
bool
GraphicFrame
::
IsEmpty
()
const
{
return
!
olePic
.
is_init
()
&&
!
smartArt
.
is_init
()
&&
!
table
.
is_init
()
&&
!
chartRec
.
is_init
()
&&
!
ole
Spid
.
is_init
()
&&
!
element
.
is_init
();
return
!
olePic
.
is_init
()
&&
!
smartArt
.
is_init
()
&&
!
table
.
is_init
()
&&
!
chartRec
.
is_init
()
&&
!
vml
Spid
.
is_init
()
&&
!
element
.
is_init
();
}
void
GraphicFrame
::
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
...
...
@@ -394,12 +394,12 @@ namespace PPTX
std
::
wstring
xml_object_vml
;
smart_ptr
<
OOX
::
IFileContainer
>
xml_object_rels
;
if
(
ole
Spid
.
is_init
())
if
(
vml
Spid
.
is_init
())
{
xml_object_vml
=
GetVmlXmlBySpid
(
xml_object_rels
);
}
if
(
smartArt
.
is_init
()
&&
!
table
.
is_init
()
&&
!
chartRec
.
is_init
()
&&
!
ole
Spid
.
is_init
())
if
(
smartArt
.
is_init
()
&&
!
table
.
is_init
()
&&
!
chartRec
.
is_init
()
&&
!
vml
Spid
.
is_init
())
{
smartArt
->
LoadDrawing
(
pWriter
);
...
...
@@ -482,7 +482,7 @@ namespace PPTX
pWriter
->
StartRecord
(
SPTREE_TYPE_GRFRAME
);
pWriter
->
WriteBYTE
(
NSBinPptxRW
::
g_nodeAttributeStart
);
pWriter
->
WriteString2
(
0
,
ole
Spid
);
pWriter
->
WriteString2
(
0
,
vml
Spid
);
pWriter
->
WriteBYTE
(
NSBinPptxRW
::
g_nodeAttributeEnd
);
pWriter
->
WriteRecord1
(
0
,
nvGraphicFramePr
);
...
...
@@ -523,7 +523,7 @@ namespace PPTX
{
case
0
:
{
ole
Spid
=
pReader
->
GetString2
();
vml
Spid
=
pReader
->
GetString2
();
break
;
}
default:
...
...
@@ -640,17 +640,17 @@ namespace PPTX
std
::
wstring
xml
;
if
(
parentFileIs
<
PPTX
::
Slide
>
()
&&
parentFileAs
<
PPTX
::
Slide
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
Slide
>
().
GetVmlXmlBySpid
(
ole
Spid
.
get_value_or
(
L""
));
xml
=
parentFileAs
<
PPTX
::
Slide
>
().
GetVmlXmlBySpid
(
vml
Spid
.
get_value_or
(
L""
));
rels
=
parentFileAs
<
PPTX
::
Slide
>
().
Vml
.
smart_dynamic_cast
<
OOX
::
IFileContainer
>
();
}
else
if
(
parentFileIs
<
PPTX
::
SlideLayout
>
()
&&
parentFileAs
<
PPTX
::
SlideLayout
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
GetVmlXmlBySpid
(
ole
Spid
.
get_value_or
(
L""
));
xml
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
GetVmlXmlBySpid
(
vml
Spid
.
get_value_or
(
L""
));
rels
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
Vml
.
smart_dynamic_cast
<
OOX
::
IFileContainer
>
();
}
else
if
(
parentFileIs
<
PPTX
::
SlideMaster
>
()
&&
parentFileAs
<
PPTX
::
SlideMaster
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
GetVmlXmlBySpid
(
ole
Spid
.
get_value_or
(
L""
));
xml
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
GetVmlXmlBySpid
(
vml
Spid
.
get_value_or
(
L""
));
rels
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
Vml
.
smart_dynamic_cast
<
OOX
::
IFileContainer
>
();
}
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h
View file @
a038e156
...
...
@@ -89,7 +89,7 @@ namespace PPTX
nullable
<
Xfrm
>
xfrm
;
nullable_string
ole
Spid
;
nullable_string
vml
Spid
;
nullable
<
Pic
>
olePic
;
nullable
<
Table
>
table
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.cpp
View file @
a038e156
...
...
@@ -97,7 +97,7 @@ CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode m
Open
(
file_path
,
mode
);
}
void
CompoundFile
::
copy_stream
(
std
::
string
streamName
,
POLE
::
Storage
*
storageOut
,
bool
w
ithRoot
)
void
CompoundFile
::
copy_stream
(
std
::
string
streamName
,
POLE
::
Storage
*
storageOut
,
bool
bW
ithRoot
)
{
POLE
::
Stream
*
stream
=
new
POLE
::
Stream
(
storage_
,
streamName
);
if
(
!
stream
)
return
;
...
...
@@ -105,7 +105,7 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
stream
->
seek
(
0
);
int
size_stream
=
stream
->
size
();
if
(
w
ithRoot
==
false
)
if
(
bW
ithRoot
==
false
)
{
int
pos
=
streamName
.
find
(
"/"
);
if
(
pos
>=
0
)
...
...
@@ -132,9 +132,9 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
delete
stream
;
}
void
CompoundFile
::
copy
(
int
indent
,
std
::
string
path
,
POLE
::
Storage
*
storageOut
,
bool
withRoot
)
void
CompoundFile
::
copy
(
int
indent
,
std
::
string
path
,
POLE
::
Storage
*
storageOut
,
bool
bWithRoot
,
bool
bSortFiles
)
{
std
::
list
<
std
::
string
>
entries
,
entries_
sort
;
std
::
list
<
std
::
string
>
entries
,
entries_
files
,
entries_dir
;
entries
=
storage_
->
entries
(
path
);
for
(
std
::
list
<
std
::
string
>::
iterator
it
=
entries
.
begin
();
it
!=
entries
.
end
();
it
++
)
...
...
@@ -144,27 +144,29 @@ void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOu
if
(
storage_
->
isDirectory
(
fullname
)
)
{
entries_
sort
.
push_back
(
name
);
entries_
dir
.
push_back
(
name
);
}
else
{
entries_
sort
.
push_front
(
name
);
entries_
files
.
push_front
(
name
);
}
}
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
for
(
std
::
list
<
std
::
string
>::
iterator
it
=
entries_sort
.
begin
();
it
!=
entries_sort
.
end
();
it
++
)
for
(
std
::
list
<
std
::
string
>::
iterator
it
=
entries_dir
.
begin
();
it
!=
entries_dir
.
end
();
it
++
)
{
std
::
string
name
=
*
it
;
std
::
string
fullname
=
path
+
name
;
std
::
string
fullname
=
path
+
*
it
;
if
(
storage_
->
isDirectory
(
fullname
)
)
{
copy
(
indent
+
1
,
fullname
+
"/"
,
storageOut
,
withRoot
);
}
else
{
copy_stream
(
fullname
,
storageOut
,
withRoot
);
}
copy
(
indent
+
1
,
fullname
+
"/"
,
storageOut
,
bWithRoot
,
bSortFiles
);
}
if
(
bSortFiles
)
{
entries_files
.
sort
();
//todooo ??? со спецсимволами выше
}
for
(
std
::
list
<
std
::
string
>::
iterator
it
=
entries_files
.
begin
();
it
!=
entries_files
.
end
();
it
++
)
{
std
::
string
fullname
=
path
+
*
it
;
copy_stream
(
fullname
,
storageOut
,
bWithRoot
);
}
}
CFStreamPtr
CompoundFile
::
getWorkbookStream
()
...
...
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.h
View file @
a038e156
...
...
@@ -58,14 +58,14 @@ public:
bool
isError
();
void
copy
(
int
indent
,
std
::
string
path
,
POLE
::
Storage
*
storageOut
,
bool
withRoot
=
tru
e
);
void
copy
(
int
indent
,
std
::
string
path
,
POLE
::
Storage
*
storageOut
,
bool
bWithRoot
=
true
,
bool
bSortFiles
=
fals
e
);
CFStreamPtr
getWorkbookStream
();
CFStreamPtr
getNamedStream
(
const
std
::
string
&
name
);
POLE
::
Storage
*
storage_
;
private:
void
copy_stream
(
std
::
string
streamName
,
POLE
::
Storage
*
storageOut
,
bool
w
ithRoot
=
true
);
void
copy_stream
(
std
::
string
streamName
,
POLE
::
Storage
*
storageOut
,
bool
bW
ithRoot
=
true
);
POLE
::
Stream
*
openStream
(
const
std
::
string
&
stream_name
);
// Opens a stream in the storage (shall be called not more than once per stream)
POLE
::
Stream
*
createStream
(
const
std
::
string
&
stream_name
);
// Creates a new stream in the storage
...
...
@@ -73,7 +73,6 @@ private:
CFStreamPtr
createNamedStream
(
const
std
::
string
&
name
);
void
closeNamedStream
(
const
std
::
string
&
name
);
private:
std
::
map
<
std
::
string
,
CFStreamPtr
>
streams
;
ReadWriteMode
rwMode
;
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Style.cpp
View file @
a038e156
...
...
@@ -72,7 +72,9 @@ void Style::readFields(CFRecord& record)
user
=
s
;
}
else
{
record
>>
user
;
}
}
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/StyleExt.h
View file @
a038e156
...
...
@@ -41,8 +41,6 @@
namespace
XLS
{
// Logical representation of StyleExt record in BIFF8
class
StyleExt
:
public
BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO
(
StyleExt
)
...
...
@@ -53,10 +51,9 @@ public:
BaseObjectPtr
clone
();
void
readFields
(
CFRecord
&
record
);
static
const
ElementType
type
=
typeStyleExt
;
static
const
ElementType
type
=
typeStyleExt
;
int
serialize
(
std
::
wostream
&
stream
);
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgNameX.cpp
View file @
a038e156
...
...
@@ -93,10 +93,14 @@ void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
std
::
wstring
link
=
global_info
->
arXti
[
ixti
].
link
;
std
::
wstring
name
;
if
(
global_info
->
arXti
[
ixti
].
pNames
&&
nameindex
>
0
)
if
(
(
global_info
->
arXti
[
ixti
].
pNames
)
&&
(
nameindex
>
0
&&
nameindex
<=
global_info
->
arXti
[
ixti
].
pNames
->
size
())
)
{
name
=
global_info
->
arXti
[
ixti
].
pNames
->
at
(
nameindex
-
1
);
}
else
{
name
=
global_info
->
arDefineNames
[
nameindex
-
1
];
}
if
(
!
link
.
empty
()
&&
!
name
.
empty
())
{
ptg_stack
.
push
(
link
+
L"!"
+
name
);
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp
View file @
a038e156
...
...
@@ -34,6 +34,7 @@
#include "../Biff_records/Style.h"
#include "../Biff_records/StyleExt.h"
#include "../../../../../Common/DocxFormat/Source/XML/Utils.h"
namespace
XLS
{
...
...
@@ -137,7 +138,13 @@ int STYLES::serialize(std::wostream & stream)
}
else
if
(
style
)
{
CP_XML_ATTR
(
L"name"
,
style
->
user
.
value
());
std
::
wstring
name
=
style
->
user
.
value
();
XmlUtils
::
replace_all
(
name
,
L"
\x01
"
,
L"_x0001_"
);
XmlUtils
::
replace_all
(
name
,
L"
\x0d
"
,
L"_x000d_"
);
XmlUtils
::
replace_all
(
name
,
L"
\x0a
"
,
L"_x000a_"
);
CP_XML_ATTR
(
L"name"
,
name
);
if
(
style
->
fBuiltIn
)
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.cpp
View file @
a038e156
...
...
@@ -101,9 +101,10 @@ const bool XFS::loadContent(BinProcessor& proc)
if
(
proc
.
optional
<
XFCRC
>
())
{
elements_
.
pop_back
();
// Crc не нужен
m_XFCRC
=
elements_
.
back
();
elements_
.
pop_back
();
XFCRC
*
crc
=
dynamic_cast
<
XFCRC
*>
(
m_XFCRC
.
get
());
count
=
proc
.
repeated
<
XFExt
>
(
16
,
4050
);
count
=
proc
.
repeated
<
XFExt
>
(
0
/*16*/
,
4050
);
// 074_JKH.OPEN.INFO.PRICE.VO_зПТПДУЛЙЕ ПЛТХЗБ юЕМСВЙОУЛПК ПВМ ...
while
(
count
>
0
)
{
if
(
elements_
.
empty
())
break
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.h
View file @
a038e156
...
...
@@ -36,8 +36,6 @@
namespace
XLS
{
// Logical representation of XFS union of records
class
XFS
:
public
CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME
(
XFS
)
...
...
@@ -62,6 +60,7 @@ public:
std
::
vector
<
BaseObjectPtr
>
m_arCellStyles
;
std
::
vector
<
BaseObjectPtr
>
m_arXFext
;
BaseObjectPtr
m_XFCRC
;
};
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
View file @
a038e156
...
...
@@ -1933,72 +1933,69 @@ void XlsConverter::convert(XLS::TxO * text_obj)
void
XlsConverter
::
convert
(
XLS
::
Obj
*
obj
)
{
if
(
obj
==
NULL
)
return
;
//controls & objects
if
(
!
obj
->
pictFlags
.
fExist
||
!
obj
->
pictFmla
.
fExist
||
obj
->
cmo
.
ot
!=
8
)
return
;
std
::
wstring
link_cell
,
fill_range
,
fmla
,
info
;
if
(
obj
->
pictFmla
.
fmla
.
bFmlaExist
)
{
fmla
=
obj
->
pictFmla
.
fmla
.
fmla
.
getAssembledFormula
();
if
(
obj
->
pictFmla
.
fmla
.
bInfoExist
)
info
=
obj
->
pictFmla
.
fmla
.
embedInfo
.
strClass
.
value
();
}
if
(
obj
->
pictFmla
.
key
.
fmlaLinkedCell
.
bFmlaExist
)
{
link_cell
=
obj
->
pictFmla
.
key
.
fmlaLinkedCell
.
fmla
.
getAssembledFormula
();
}
if
(
obj
->
pictFmla
.
key
.
fmlaListFillRange
.
bFmlaExist
)
{
fill_range
=
obj
->
pictFmla
.
key
.
fmlaListFillRange
.
fmla
.
getAssembledFormula
();
}
if
(
obj
==
NULL
)
return
;
if
(
obj
->
pictFlags
.
fCtl
&&
obj
->
pictFlags
.
fPrstm
)
//Controls Storage
//controls & objects
if
(
obj
->
cmo
.
ot
==
8
&&
obj
->
pictFmla
.
fExist
&&
obj
->
pictFlags
.
fExist
)
{
xlsx_context
->
get_mediaitems
().
create_activeX_path
(
xlsx_path
);
std
::
wstring
info
;
if
(
obj
->
pictFmla
.
fmla
.
bFmlaExist
)
{
if
(
obj
->
pictFmla
.
fmla
.
bInfoExist
)
info
=
obj
->
pictFmla
.
fmla
.
embedInfo
.
strClass
.
value
();
}
if
(
obj
->
pictFlags
.
fCtl
&&
obj
->
pictFlags
.
fPrstm
)
//Controls Storage
{
xlsx_context
->
get_mediaitems
().
create_activeX_path
(
xlsx_path
);
int
id
=
++
xlsx_context
->
get_mediaitems
().
count_activeX
;
std
::
wstring
file_name
=
xlsx_context
->
get_mediaitems
().
activeX_path
()
+
L"activeX"
+
std
::
to_wstring
(
id
)
+
L".bin"
;
int
id
=
++
xlsx_context
->
get_mediaitems
().
count_activeX
;
std
::
wstring
file_name
=
xlsx_context
->
get_mediaitems
().
activeX_path
()
+
L"activeX"
+
std
::
to_wstring
(
id
)
+
L".bin"
;
NSFile
::
CFileBinary
file
;
if
(
file
.
CreateFileW
(
file_name
)
)
{
file
.
WriteFile
(
xls_global_info
->
controls_data
.
first
.
get
()
+
obj
->
pictFmla
.
lPosInCtlStm
,
obj
->
pictFmla
.
cbBufInCtlStm
);
file
.
CloseFile
();
NSFile
::
CFileBinary
file
;
if
(
file
.
CreateFileW
(
file_name
)
)
{
file
.
WriteFile
(
xls_global_info
->
controls_data
.
first
.
get
()
+
obj
->
pictFmla
.
lPosInCtlStm
,
obj
->
pictFmla
.
cbBufInCtlStm
);
file
.
CloseFile
();
}
}
}
else
if
(
!
obj
->
pictFlags
.
fPrstm
)
{
std
::
string
object_stream
;
if
(
obj
->
pictFlags
.
fDde
)
object_stream
=
"LNK"
;
else
object_stream
=
"MBD"
;
object_stream
+=
XmlUtils
::
IntToString
(
obj
->
pictFmla
.
lPosInCtlStm
,
"%08X"
)
+
"/"
;
if
(
xls_file
->
storage_
->
isDirectory
(
object_stream
))
else
if
(
!
obj
->
pictFlags
.
fPrstm
)
{
xlsx_context
->
get_mediaitems
().
create_embeddings_path
(
xlsx_path
);
int
id
=
++
xlsx_context
->
get_mediaitems
().
count_embeddings
;
std
::
wstring
file_name
=
L"oleObject"
+
std
::
to_wstring
(
id
)
+
L".bin"
;
std
::
string
object_stream
;
if
(
obj
->
pictFlags
.
fDde
)
object_stream
=
"LNK"
;
else
object_stream
=
"MBD"
;
object_stream
+=
XmlUtils
::
IntToString
(
obj
->
pictFmla
.
lPosInCtlStm
,
"%08X"
)
+
"/"
;
if
(
xls_file
->
storage_
->
isDirectory
(
object_stream
))
{
xlsx_context
->
get_mediaitems
().
create_embeddings_path
(
xlsx_path
);
std
::
wstring
target
;
std
::
wstring
objectId
=
xlsx_context
->
get_mediaitems
().
add_embedding
(
target
,
info
);
POLE
::
Storage
*
storageOle
=
new
POLE
::
Storage
((
xlsx_context
->
get_mediaitems
().
embeddings_path
()
+
file_name
).
c_str
());
POLE
::
Storage
*
storageOle
=
new
POLE
::
Storage
((
xlsx_context
->
get_mediaitems
().
embeddings_path
()
+
target
).
c_str
());
if
((
storageOle
)
&&
(
storageOle
->
open
(
true
,
true
)))
{
xls_file
->
copy
(
0
,
object_stream
,
storageOle
,
fals
e
);
if
((
storageOle
)
&&
(
storageOle
->
open
(
true
,
true
)))
{
xls_file
->
copy
(
0
,
object_stream
,
storageOle
,
false
,
tru
e
);
storageOle
->
close
();
delete
storageOle
;
}
std
::
wstring
objectId
=
L"objId"
+
std
::
to_wstring
(
id
);
xlsx_context
->
current_sheet
().
sheet_rels
().
add
(
oox
::
relationship
(
objectId
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
,
L"../embeddings/"
+
file_name
));
storageOle
->
close
();
delete
storageOle
;
}
xlsx_context
->
current_sheet
().
sheet_rels
().
add
(
oox
::
relationship
(
objectId
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
,
L"../embeddings/"
+
target
));
xlsx_context
->
get_drawing_context
().
set_ole_object
(
objectId
,
info
);
xlsx_context
->
get_drawing_context
().
set_ole_object
(
objectId
,
info
);
}
}
}
if
(
obj
->
list
.
fExist
)
{
}
if
(
obj
->
macro
.
fExist
&&
obj
->
macro
.
fmla
.
bFmlaExist
)
{
std
::
wstring
macro
=
obj
->
macro
.
fmla
.
fmla
.
getAssembledFormula
();
xlsx_context
->
get_drawing_context
().
set_macro
(
macro
);
}
}
void
XlsConverter
::
convert_chart_sheet
(
XLS
::
ChartSheetSubstream
*
chart
)
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.cpp
View file @
a038e156
...
...
@@ -43,6 +43,8 @@
#include "mediaitems_utils.h"
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
#include "../../../DesktopEditor/common/Directory.h"
namespace
oox
{
...
...
@@ -115,6 +117,26 @@ std::wstring external_items::add_chart(std::wstring & oox_target)
return
rId
;
}
std
::
wstring
external_items
::
add_embedding
(
std
::
wstring
&
oox_target
,
const
std
::
wstring
&
info
)
{
const
bool
isMediaInternal
=
true
;
count_embeddings
++
;
std
::
wstring
rId
=
std
::
wstring
(
L"objId"
)
+
std
::
to_wstring
(
count_embeddings
);
std
::
wstring
lowerInfo
=
XmlUtils
::
GetLower
(
info
);
std
::
wstring
extension
=
L".bin"
;
if
(
std
::
wstring
::
npos
!=
lowerInfo
.
find
(
L"excel"
))
extension
=
L".xls"
;
if
(
std
::
wstring
::
npos
!=
lowerInfo
.
find
(
L"word"
))
extension
=
L".doc"
;
oox_target
=
std
::
wstring
(
L"oleObject"
)
+
std
::
to_wstring
(
count_embeddings
)
+
extension
;
items_
.
push_back
(
item
(
oox_target
,
typeOleObject
,
isMediaInternal
,
-
1
,
rId
)
);
return
rId
;
}
std
::
wstring
external_items
::
find_image
(
int
_id
,
std
::
wstring
&
oox_target
,
bool
&
isInternal
)
{
for
(
int
i
=
0
;
i
<
items_
.
size
();
i
++
)
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.h
View file @
a038e156
...
...
@@ -41,7 +41,7 @@ class rels;
class
external_items
{
public:
enum
Type
{
typeUnknown
=
0
,
typeImage
,
typeChart
,
typeShape
,
typeTable
,
typeHyperlink
,
typeComment
,
typeMedia
,
typeGroup
,
typeExternalLink
,
typeOleObject
};
enum
Type
{
typeUnknown
=
0
,
typeImage
,
typeChart
,
typeShape
,
typeTable
,
typeHyperlink
,
typeComment
,
typeMedia
,
typeGroup
,
typeExternalLink
,
typeOleObject
,
typeActiveX
};
external_items
()
{
...
...
@@ -81,8 +81,9 @@ public:
size_t
count_embeddings
;
//std::wstring add_or_find(const std::wstring & href, Type type, bool & isInternal);//возможны ссылки на один и тот же объект
std
::
wstring
add_image
(
const
std
::
wstring
&
file_name
,
int
bin_id
);
std
::
wstring
add_chart
(
std
::
wstring
&
oox_target
);
std
::
wstring
add_image
(
const
std
::
wstring
&
file_name
,
int
bin_id
);
std
::
wstring
add_chart
(
std
::
wstring
&
oox_target
);
std
::
wstring
add_embedding
(
std
::
wstring
&
oox_target
,
const
std
::
wstring
&
info
);
std
::
wstring
find_image
(
int
id
,
std
::
wstring
&
oox_target
,
bool
&
isExternal
);
std
::
wstring
find_image
(
const
std
::
wstring
&
oox_target
,
bool
&
isExternal
);
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/oox_package.cpp
View file @
a038e156
...
...
@@ -61,6 +61,8 @@ static std::wstring get_mime_type(const std::wstring & extension)
if
(
L"wav"
==
extension
)
return
L"audio/wav"
;
if
(
L"bin"
==
extension
)
return
L"application/vnd.openxmlformats-officedocument.oleObject"
;
if
(
L"xlsx"
==
extension
)
return
L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
;
if
(
L"xls"
==
extension
)
return
L"application/vnd.ms-excel"
;
if
(
L"doc"
==
extension
)
return
L"application/vnd.ms-word"
;
return
L""
;
}
...
...
@@ -92,13 +94,24 @@ void content_types_file::set_media(external_items & _Mediaitems)
{
BOOST_FOREACH
(
external_items
::
item
&
item
,
_Mediaitems
.
items
()
)
{
if
((
item
.
type
==
external_items
::
typeImage
||
item
.
type
==
external_items
::
typeMedia
)
&&
item
.
mediaInternal
)
if
(
!
item
.
mediaInternal
)
continue
;
std
::
wstring
extension
;
int
n
=
item
.
uri
.
rfind
(
L"."
);
if
(
n
>
0
)
extension
=
item
.
uri
.
substr
(
n
+
1
);
if
(
item
.
type
==
external_items
::
typeImage
||
item
.
type
==
external_items
::
typeMedia
)
{
add_or_find_default
(
extension
);
}
else
if
(
item
.
type
==
external_items
::
typeOleObject
)
{
int
n
=
item
.
uri
.
rfind
(
L"."
);
if
(
n
>
0
)
{
add_or_find_default
(
item
.
uri
.
substr
(
n
+
1
,
item
.
uri
.
length
()
-
n
));
}
std
::
wstring
link
=
L"application/vnd.openxmlformats-officedocument.oleObject"
;
if
(
extension
==
L"xls"
||
extension
==
L"doc"
)
add_or_find_default
(
extension
);
else
content_type_
.
add_override
(
L"/xl/embeddings/"
+
item
.
uri
,
link
);
}
}
}
...
...
Common/DocxFormat/Source/DocxFormat/ContentTypes.h
View file @
a038e156
...
...
@@ -85,7 +85,7 @@ namespace OOX
m_mTable
.
insert
(
std
::
make_pair
(
_T
(
"sldm"
),
_T
(
"application/vnd.ms-powerpoint.slide.macroEnabled.12"
)));
m_mTable
.
insert
(
std
::
make_pair
(
_T
(
"sldx"
),
_T
(
"application/vnd.openxmlformats-officedocument.presentationml.slide"
)));
m_mTable
.
insert
(
std
::
make_pair
(
_T
(
"doc"
),
_T
(
"application/msword"
)));
m_mTable
.
insert
(
std
::
make_pair
(
_T
(
"docm"
),
_T
(
"a
a
pplication/vnd.ms-word.document.macroEnabled.12"
)));
m_mTable
.
insert
(
std
::
make_pair
(
_T
(
"docm"
),
_T
(
"application/vnd.ms-word.document.macroEnabled.12"
)));
m_mTable
.
insert
(
std
::
make_pair
(
_T
(
"docx"
),
_T
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
)));
m_mTable
.
insert
(
std
::
make_pair
(
_T
(
"vml"
),
_T
(
"application/vnd.openxmlformats-officedocument.vmlDrawing"
)));
}
...
...
Common/DocxFormat/Source/DocxFormat/Drawing/DrawingExt.h
View file @
a038e156
...
...
@@ -90,11 +90,7 @@ namespace OOX
}
public:
// Attributes
nullable
<
std
::
wstring
>
m_sSpId
;
// Childs
};
class
CDataModelExt
:
public
WritingElement
{
...
...
Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h
View file @
a038e156
...
...
@@ -155,18 +155,17 @@ namespace OOX
if
(
shape
.
IsInit
())
{
m_nId
=
shape
->
nvSpPr
.
cNvPr
.
id
;
if
(
shape
->
nvSpPr
.
cNvPr
.
ole
Spid
.
IsInit
())
if
(
shape
->
nvSpPr
.
cNvPr
.
vml
Spid
.
IsInit
())
{
//ссылка на объект
m_bShapeOle
=
true
;
m_sSpId
=
shape
->
nvSpPr
.
cNvPr
.
oleSpid
.
get
();
//ссылка на объект или шейп в vmlDrawing
m_sVmlSpId
=
shape
->
nvSpPr
.
cNvPr
.
vmlSpid
.
get
();
}
}
smart_ptr
<
PPTX
::
Logic
::
GraphicFrame
>
frame
=
m_oElement
->
GetElem
().
smart_dynamic_cast
<
PPTX
::
Logic
::
GraphicFrame
>
();
if
((
frame
.
IsInit
())
&&
(
frame
->
ole
Spid
.
IsInit
()))
if
((
frame
.
IsInit
())
&&
(
frame
->
vml
Spid
.
IsInit
()))
{
//ссылка на объект или шейп в vmlDrawing
m_s
SpId
=
frame
->
ole
Spid
.
get
();
m_s
VmlSpId
=
frame
->
vml
Spid
.
get
();
}
}
}
...
...
@@ -221,7 +220,7 @@ namespace OOX
nullable
<
SimpleTypes
::
COnOff
<>>
m_oAlternateContent
;
//для удобства
nullable
<
std
::
wstring
>
m_sSpId
;
nullable
<
std
::
wstring
>
m_s
Vml
SpId
;
nullable
<
int
>
m_nId
;
};
}
//Spreadsheet
...
...
XlsxSerializerCom/Reader/BinaryWriter.h
View file @
a038e156
...
...
@@ -3136,8 +3136,8 @@ namespace BinXlsxRW
if
(
pCellAnchor
)
{
pCellAnchor
->
m_sSpId
.
Init
();
pCellAnchor
->
m_sSpId
->
append
(
it
->
first
);
pCellAnchor
->
m_s
Vml
SpId
.
Init
();
pCellAnchor
->
m_s
Vml
SpId
->
append
(
it
->
first
);
int
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerWorksheetsTypes
::
Drawing
);
WriteDrawing
(
oWorksheet
,
pDrawing
,
pCellAnchor
,
pVmlDrawing
,
NULL
);
...
...
@@ -3157,7 +3157,7 @@ namespace BinXlsxRW
if
(
!
pCellAnchor
)
return
;
if
(
pCellAnchor
->
m_oElement
.
IsInit
()
==
false
&&
pCellAnchor
->
m_sSpId
.
IsInit
()
==
false
)
return
;
pCellAnchor
->
m_s
Vml
SpId
.
IsInit
()
==
false
)
return
;
//Type
int
nCurPos
;
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSer_DrawingType
::
Type
);
...
...
@@ -3191,9 +3191,9 @@ namespace BinXlsxRW
WriteExt
(
pCellAnchor
->
m_oExt
.
get
());
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
if
(
pCellAnchor
->
m_sSpId
.
IsInit
()
&&
pVmlDrawing
)
if
(
pCellAnchor
->
m_s
Vml
SpId
.
IsInit
()
&&
pVmlDrawing
)
{
std
::
map
<
std
::
wstring
,
OOX
::
CVmlDrawing
::
_vml_shape
>::
iterator
pFind
=
pVmlDrawing
->
m_mapShapes
.
find
(
pCellAnchor
->
m_sSpId
.
get2
());
std
::
map
<
std
::
wstring
,
OOX
::
CVmlDrawing
::
_vml_shape
>::
iterator
pFind
=
pVmlDrawing
->
m_mapShapes
.
find
(
pCellAnchor
->
m_s
Vml
SpId
.
get2
());
if
(
pFind
!=
pVmlDrawing
->
m_mapShapes
.
end
()
&&
!
pFind
->
second
.
bUsed
)
{
...
...
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