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
b599a6bc
Commit
b599a6bc
authored
Dec 11, 2017
by
Sergey Konovalov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add open/save JsaProject.bin for OnlyOffice Macros
parent
20b781cb
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
212 additions
and
9 deletions
+212
-9
ASCOfficeDocxFile2/BinReader/Readers.h
ASCOfficeDocxFile2/BinReader/Readers.h
+15
-0
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
+2
-1
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+20
-0
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
+8
-1
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
+1
-1
ASCOfficePPTXFile/Editor/PPTXWriter.h
ASCOfficePPTXFile/Editor/PPTXWriter.h
+1
-1
ASCOfficePPTXFile/PPTXFormat/FileFactory.cpp
ASCOfficePPTXFile/PPTXFormat/FileFactory.cpp
+3
-0
ASCOfficePPTXFile/PPTXFormat/Folder.cpp
ASCOfficePPTXFile/PPTXFormat/Folder.cpp
+4
-0
ASCOfficePPTXFile/PPTXFormat/Presentation.h
ASCOfficePPTXFile/PPTXFormat/Presentation.h
+12
-1
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
+1
-0
Common/DocxFormat/Source/DocxFormat/Docx.h
Common/DocxFormat/Source/DocxFormat/Docx.h
+1
-0
Common/DocxFormat/Source/DocxFormat/FileFactory.cpp
Common/DocxFormat/Source/DocxFormat/FileFactory.cpp
+5
-0
Common/DocxFormat/Source/DocxFormat/FileTypes.h
Common/DocxFormat/Source/DocxFormat/FileTypes.h
+4
-0
Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h
Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h
+99
-0
XlsxSerializerCom/Common/BinReaderWriterDefines.h
XlsxSerializerCom/Common/BinReaderWriterDefines.h
+2
-1
XlsxSerializerCom/Reader/BinaryWriter.h
XlsxSerializerCom/Reader/BinaryWriter.h
+14
-0
XlsxSerializerCom/Writer/BinaryReader.h
XlsxSerializerCom/Writer/BinaryReader.h
+20
-3
No files found.
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
b599a6bc
...
...
@@ -3708,6 +3708,21 @@ public:
res
=
Read2
(
length
,
&
Binary_DocumentTableReader
::
Read_Background
,
this
,
&
oBackground
);
m_oDocumentWriter
.
m_oBackground
.
WriteString
(
oBackground
.
Write
());
}
else
if
(
c_oSerParType
::
JsaProject
==
type
)
{
BYTE
*
pData
=
m_oBufferedStream
.
GetPointer
(
length
);
OOX
::
CPath
sJsaProject
=
OOX
::
FileTypes
::
JsaProject
.
DefaultFileName
();
std
::
wstring
filePath
=
m_oFileWriter
.
m_oDocumentWriter
.
m_sDir
+
FILE_SEPARATOR_STR
+
L"word"
+
FILE_SEPARATOR_STR
+
sJsaProject
.
GetPath
();
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
filePath
);
oFile
.
WriteFile
(
pData
,
length
);
oFile
.
CloseFile
();
long
lId
;
m_oFileWriter
.
m_pDrawingConverter
->
WriteRels
(
OOX
::
FileTypes
::
JsaProject
.
RelationType
(),
sJsaProject
.
GetPath
(),
L""
,
&
lId
);
m_oFileWriter
.
m_pDrawingConverter
->
m_pImageManager
->
m_pContentTypes
->
AddDefault
(
sJsaProject
.
GetExtention
(
false
));
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
...
...
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
View file @
b599a6bc
...
...
@@ -474,7 +474,8 @@ extern int g_nCurFormatVersion;
MoveFromRangeStart
=
18
,
MoveFromRangeEnd
=
19
,
MoveToRangeStart
=
20
,
MoveToRangeEnd
=
21
MoveToRangeEnd
=
21
,
JsaProject
=
22
};}
namespace
c_oSerDocTableType
{
enum
c_oSerDocTableType
{
...
...
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
b599a6bc
...
...
@@ -2997,6 +2997,7 @@ namespace BinDocxRW
Binary_tblPrWriter
btblPrs
;
OOX
::
Logic
::
CSectionProperty
*
pSectPr
;
OOX
::
Logic
::
CBackground
*
pBackground
;
OOX
::
CDocument
*
poDocument
;
bool
m_bWriteSectPr
;
//Записывать ли свойства верхнего уровня в данном экземпляре BinaryOtherTableWriter
//---------------------------------
...
...
@@ -3005,6 +3006,7 @@ namespace BinDocxRW
{
pBackground
=
NULL
;
pSectPr
=
NULL
;
poDocument
=
NULL
;
m_bWriteSectPr
=
false
;
m_eFldState
=
SimpleTypes
::
fldchartypeEnd
;
}
...
...
@@ -3109,6 +3111,23 @@ namespace BinDocxRW
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
//Write JsaProject
if
(
NULL
!=
poDocument
)
{
smart_ptr
<
OOX
::
File
>
pFile
=
poDocument
->
Get
(
OOX
::
FileTypes
::
JsaProject
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
JsaProject
==
pFile
->
type
())
{
OOX
::
JsaProject
&
jsaProject
=
pFile
.
as
<
OOX
::
JsaProject
>
();
BYTE
*
pData
=
NULL
;
DWORD
nBytesCount
;
if
(
NSFile
::
CFileBinary
::
ReadAllBytes
(
jsaProject
.
filename
().
GetPath
(),
&
pData
,
nBytesCount
))
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
JsaProject
);
m_oBcw
.
m_oStream
.
WriteBYTEArray
(
pData
,
nBytesCount
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
}
}
void
WriteBackground
(
OOX
::
Logic
::
CBackground
*
pBackground
)
{
...
...
@@ -7880,6 +7899,7 @@ namespace BinDocxRW
oBinaryDocumentTableWriter
.
pSectPr
=
pFirstSectPr
;
oBinaryDocumentTableWriter
.
pBackground
=
poDocument
->
m_oBackground
.
GetPointer
();
oBinaryDocumentTableWriter
.
poDocument
=
poDocument
;
oBinaryDocumentTableWriter
.
m_bWriteSectPr
=
true
;
//Write Vba
...
...
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
View file @
b599a6bc
...
...
@@ -40,6 +40,7 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../Common/Base64.h"
...
...
@@ -1235,7 +1236,7 @@ namespace NSBinPptxRW
m_pWriter
->
WriteString
(
strRels
);
}
void
CRelsGenerator
::
EndPresentationRels
(
bool
bIsCommentsAuthors
,
bool
bIsNotesMaster
,
bool
bIsVbaProject
)
void
CRelsGenerator
::
EndPresentationRels
(
bool
bIsCommentsAuthors
,
bool
bIsNotesMaster
,
bool
bIsVbaProject
,
bool
bIsJsaProject
)
{
if
(
bIsNotesMaster
)
{
...
...
@@ -1266,6 +1267,12 @@ namespace NSBinPptxRW
L"
\"
Type=
\"
http://schemas.microsoft.com/office/2006/relationships/vbaProject
\"
Target=
\"
vbaProject.bin
\"
/>"
;
m_pWriter
->
WriteString
(
strRels4
);
}
if
(
bIsJsaProject
)
{
std
::
wstring
strRels5
=
L"<Relationship Id=
\"
rId"
+
std
::
to_wstring
(
m_lNextRelsID
++
)
+
L"
\"
Type=
\"
"
+
OOX
::
FileTypes
::
JsaProject
.
RelationType
()
+
L"
\"
Target=
\"
"
+
OOX
::
FileTypes
::
JsaProject
.
DefaultFileName
().
GetPath
()
+
L"
\"
/>"
;
m_pWriter
->
WriteString
(
strRels5
);
}
}
int
CRelsGenerator
::
GetNextId
()
{
...
...
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
View file @
b599a6bc
...
...
@@ -425,7 +425,7 @@ namespace NSBinPptxRW
int
WriteRels
(
const
std
::
wstring
&
bsType
,
const
std
::
wstring
&
bsTarget
,
const
std
::
wstring
&
bsTargetMode
);
int
WriteHyperlink
(
const
std
::
wstring
&
strLink
,
const
bool
&
bIsActionInit
);
void
EndPresentationRels
(
bool
bIsCommentsAuthors
=
false
,
bool
bIsNotesMaster
=
false
,
bool
bIsVbaProject
=
false
);
void
EndPresentationRels
(
bool
bIsCommentsAuthors
=
false
,
bool
bIsNotesMaster
=
false
,
bool
bIsVbaProject
=
false
,
bool
bIsJsaProject
=
false
);
int
GetNextId
();
void
CloseRels
();
...
...
ASCOfficePPTXFile/Editor/PPTXWriter.h
View file @
b599a6bc
...
...
@@ -812,7 +812,7 @@ namespace NSBinPptxRW
++
nCurrentRels
;
}
m_oReader
.
m_pRels
->
EndPresentationRels
(
m_oPresentation
.
commentAuthors
.
is_init
(),
bNotesMasterPresent
,
m_oPresentation
.
m_pVbaProject
.
is_init
());
m_oReader
.
m_pRels
->
EndPresentationRels
(
m_oPresentation
.
commentAuthors
.
is_init
(),
bNotesMasterPresent
,
m_oPresentation
.
m_pVbaProject
.
is_init
()
,
m_oPresentation
.
m_pJsaProject
.
is_init
()
);
m_oReader
.
m_pRels
->
CloseRels
();
oXmlWriter
.
ClearNoAttack
();
...
...
ASCOfficePPTXFile/PPTXFormat/FileFactory.cpp
View file @
b599a6bc
...
...
@@ -63,6 +63,7 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalImage.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalAudio.h"
...
...
@@ -144,6 +145,8 @@ namespace PPTX
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
OleObject
(
filename
,
true
));
else
if
(
relation
.
Type
()
==
OOX
::
FileTypes
::
VbaProject
)
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
VbaProject
(
filename
,
filename
));
else
if
(
relation
.
Type
()
==
OOX
::
FileTypes
::
JsaProject
)
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
JsaProject
(
filename
));
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
UnknowTypeFile
());
}
...
...
ASCOfficePPTXFile/PPTXFormat/Folder.cpp
View file @
b599a6bc
...
...
@@ -81,6 +81,10 @@ namespace PPTX
_presentation
->
m_bMacroEnabled
=
true
;
_presentation
->
m_pVbaProject
=
_presentation
->
Get
(
OOX
::
FileTypes
::
VbaProject
).
smart_dynamic_cast
<
OOX
::
VbaProject
>
();
}
if
(
_presentation
->
IsExist
(
OOX
::
FileTypes
::
JsaProject
))
{
_presentation
->
m_pJsaProject
=
_presentation
->
Get
(
OOX
::
FileTypes
::
JsaProject
).
smart_dynamic_cast
<
OOX
::
JsaProject
>
();
}
}
for
(
std
::
map
<
std
::
wstring
,
smart_ptr
<
OOX
::
File
>>::
const_iterator
pPair
=
map
.
m_map
.
begin
();
pPair
!=
map
.
m_map
.
end
();
++
pPair
)
...
...
ASCOfficePPTXFile/PPTXFormat/Presentation.h
View file @
b599a6bc
...
...
@@ -51,6 +51,7 @@
#include "Theme/ClrScheme.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
namespace
PPTX
{
...
...
@@ -233,6 +234,7 @@ namespace PPTX
}
pWriter
->
EndRecord
();
}
pWriter
->
WriteRecord2
(
9
,
m_pJsaProject
);
pWriter
->
EndRecord
();
}
...
...
@@ -352,9 +354,17 @@ namespace PPTX
m_bMacroEnabled
=
true
;
}
break
;
case
9
:
{
m_pJsaProject
=
new
OOX
::
JsaProject
();
m_pJsaProject
->
fromPPTY
(
pReader
);
smart_ptr
<
OOX
::
File
>
file
=
m_pJsaProject
.
smart_dynamic_cast
<
OOX
::
File
>
();
FileContainer
::
Add
(
file
);
}
break
;
default:
{
pReader
->
S
eek
(
_end_pos
);
pReader
->
S
kipRecord
(
);
return
;
}
}
...
...
@@ -468,6 +478,7 @@ namespace PPTX
public:
bool
m_bMacroEnabled
;
smart_ptr
<
OOX
::
VbaProject
>
m_pVbaProject
;
smart_ptr
<
OOX
::
JsaProject
>
m_pJsaProject
;
void
SetClrMap
(
Logic
::
ClrMap
map
)
{
m_clrMap
=
map
;}
void
SetClrScheme
(
nsTheme
::
ClrScheme
scheme
)
{
m_clrScheme
=
scheme
;}
...
...
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
View file @
b599a6bc
...
...
@@ -147,6 +147,7 @@ HEADERS += docxformatlib.h \
..
/
Source
/
DocxFormat
/
Media
/
Media
.
h
\
..
/
Source
/
DocxFormat
/
Media
/
OleObject
.
h
\
..
/
Source
/
DocxFormat
/
Media
/
Video
.
h
\
..
/
Source
/
DocxFormat
/
Media
/
JsaProject
.
h
\
..
/
Source
/
DocxFormat
/
Settings
/
Settings
.
h
\
..
/
Source
/
DocxFormat
/
Settings
/
WebSettings
.
h
\
..
/
Source
/
DocxFormat
/
App
.
h
\
...
...
Common/DocxFormat/Source/DocxFormat/Docx.h
View file @
b599a6bc
...
...
@@ -54,6 +54,7 @@
#include "Media/OleObject.h"
#include "Media/ActiveX.h"
#include "Media/VbaProject.h"
#include "Media/JsaProject.h"
#include "HeaderFooter.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
...
...
Common/DocxFormat/Source/DocxFormat/FileFactory.cpp
View file @
b599a6bc
...
...
@@ -49,6 +49,7 @@
#include "Media/Audio.h"
#include "Media/Video.h"
#include "Media/VbaProject.h"
#include "Media/JsaProject.h"
#include "External/HyperLink.h"
#include "External/ExternalVideo.h"
#include "External/ExternalAudio.h"
...
...
@@ -146,6 +147,8 @@ namespace OOX
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
VbaProject
(
oRootPath
,
oFileName
));
//else if ( oRelation.Type() == OOX::FileTypes::VbaData)
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
else
if
(
oRelation
.
Type
()
==
FileTypes
::
JsaProject
)
return
smart_ptr
<
OOX
::
File
>
(
new
JsaProject
(
oFileName
));
return
smart_ptr
<
OOX
::
File
>
(
new
UnknowTypeFile
()
);
}
...
...
@@ -238,6 +241,8 @@ namespace OOX
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
VbaProject
(
oRootPath
,
oFileName
));
//else if ( pRelation->Type() == FileTypes::VbaData)
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
else
if
(
pRelation
->
Type
()
==
FileTypes
::
JsaProject
)
return
smart_ptr
<
OOX
::
File
>
(
new
JsaProject
(
oFileName
));
return
smart_ptr
<
OOX
::
File
>
(
new
UnknowTypeFile
()
);
}
...
...
Common/DocxFormat/Source/DocxFormat/FileTypes.h
View file @
b599a6bc
...
...
@@ -192,6 +192,10 @@ namespace OOX
_T
(
"application/vnd.ms-word.vbaData+xml"
),
_T
(
"http://schemas.microsoft.com/office/2006/relationships/wordVbaData"
));
const
FileType
JsaProject
(
L""
,
L"jsaProject.bin"
,
_T
(
""
),
_T
(
"http://schemas.onlyoffice.com/jsaProject"
));
const
FileType
MicrosoftOfficeUnknown
(
L"embeddings"
,
L""
,
_T
(
""
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"
));
...
...
Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h
0 → 100644
View file @
b599a6bc
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_ONLY_JSA_PROJECT_INCLUDE_H_
#define OOX_ONLY_JSA_PROJECT_INCLUDE_H_
#include "Media.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
namespace
OOX
{
class
JsaProject
:
public
Media
{
public:
JsaProject
()
{
}
JsaProject
(
const
CPath
&
filename
)
{
read
(
filename
);
}
virtual
~
JsaProject
()
{
}
virtual
const
FileType
type
()
const
{
return
FileTypes
::
JsaProject
;
}
virtual
const
CPath
DefaultDirectory
()
const
{
return
type
().
DefaultDirectory
();
}
virtual
const
CPath
DefaultFileName
()
const
{
return
type
().
DefaultFileName
();
}
virtual
void
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
{
BYTE
*
pData
=
NULL
;
DWORD
nBytesCount
;
if
(
NSFile
::
CFileBinary
::
ReadAllBytes
(
m_filename
.
GetPath
(),
&
pData
,
nBytesCount
))
{
pWriter
->
WriteBYTEArray
(
pData
,
nBytesCount
);
}
}
virtual
void
fromPPTY
(
NSBinPptxRW
::
CBinaryFileReader
*
pReader
)
{
LONG
_length
=
pReader
->
GetLong
();
LONG
_end_rec
=
pReader
->
GetPos
()
+
_length
;
if
(
_length
>
0
)
{
BYTE
*
pData
=
pReader
->
GetPointer
(
_length
);
std
::
wstring
filePath
=
pReader
->
m_pRels
->
m_pManager
->
GetDstFolder
()
+
FILE_SEPARATOR_STR
+
OOX
::
FileTypes
::
JsaProject
.
DefaultFileName
().
GetPath
();
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
filePath
);
oFile
.
WriteFile
(
pData
,
_length
);
oFile
.
CloseFile
();
pReader
->
m_pRels
->
m_pManager
->
m_pContentTypes
->
AddDefault
(
OOX
::
FileTypes
::
JsaProject
.
DefaultFileName
().
GetExtention
(
false
));
set_filename
(
filePath
);
}
pReader
->
Seek
(
_end_rec
);
}
};
}
// namespace OOX
#endif // OOX_ONLY_JSA_PROJECT_INCLUDE_H_
XlsxSerializerCom/Common/BinReaderWriterDefines.h
View file @
b599a6bc
...
...
@@ -192,7 +192,8 @@ namespace BinXlsxRW
ExternalBook
=
9
,
OleLink
=
10
,
DdeLink
=
11
,
VbaProject
=
12
VbaProject
=
12
,
JsaProject
=
13
};}
namespace
c_oSerWorkbookVbaProjectTypes
{
enum
c_oSerWorkbookVbaProjectTypes
{
...
...
XlsxSerializerCom/Reader/BinaryWriter.h
View file @
b599a6bc
...
...
@@ -1536,6 +1536,20 @@ namespace BinXlsxRW
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
//Write JsaProject
smart_ptr
<
OOX
::
File
>
fileJsaProject
=
workbook
.
Get
(
OOX
::
FileTypes
::
JsaProject
);
if
(
fileJsaProject
.
IsInit
()
&&
OOX
::
FileTypes
::
JsaProject
==
fileJsaProject
->
type
())
{
smart_ptr
<
OOX
::
JsaProject
>
jsaProject
=
fileJsaProject
.
smart_dynamic_cast
<
OOX
::
JsaProject
>
();
BYTE
*
pData
=
NULL
;
DWORD
nBytesCount
;
if
(
NSFile
::
CFileBinary
::
ReadAllBytes
(
jsaProject
->
filename
().
GetPath
(),
&
pData
,
nBytesCount
))
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerWorkbookTypes
::
JsaProject
);
m_oBcw
.
m_oStream
.
WriteBYTEArray
(
pData
,
nBytesCount
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
}
void
WriteWorkbookPr
(
const
OOX
::
Spreadsheet
::
CWorkbookPr
&
workbookPr
)
{
...
...
XlsxSerializerCom/Writer/BinaryReader.h
View file @
b599a6bc
...
...
@@ -37,6 +37,7 @@
#include "../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../DesktopEditor/common/Path.h"
#include "../../DesktopEditor/common/Directory.h"
...
...
@@ -1507,9 +1508,10 @@ namespace BinXlsxRW {
OOX
::
Spreadsheet
::
CWorkbook
&
m_oWorkbook
;
std
::
map
<
long
,
NSCommon
::
smart_ptr
<
OOX
::
File
>>&
m_mapPivotCacheDefinitions
;
const
std
::
wstring
&
m_sDestinationDir
;
NSBinPptxRW
::
CDrawingConverter
*
m_pOfficeDrawingConverter
;
public:
BinaryWorkbookTableReader
(
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
,
OOX
::
Spreadsheet
::
CWorkbook
&
oWorkbook
,
std
::
map
<
long
,
NSCommon
::
smart_ptr
<
OOX
::
File
>>&
mapPivotCacheDefinitions
,
const
std
::
wstring
&
sDestinationDir
)
:
Binary_CommonReader
(
oBufferedStream
),
m_oWorkbook
(
oWorkbook
),
m_mapPivotCacheDefinitions
(
mapPivotCacheDefinitions
),
m_sDestinationDir
(
sDestinationDir
)
BinaryWorkbookTableReader
(
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
,
OOX
::
Spreadsheet
::
CWorkbook
&
oWorkbook
,
std
::
map
<
long
,
NSCommon
::
smart_ptr
<
OOX
::
File
>>&
mapPivotCacheDefinitions
,
const
std
::
wstring
&
sDestinationDir
,
NSBinPptxRW
::
CDrawingConverter
*
pOfficeDrawingConverter
)
:
Binary_CommonReader
(
oBufferedStream
),
m_oWorkbook
(
oWorkbook
),
m_mapPivotCacheDefinitions
(
mapPivotCacheDefinitions
),
m_sDestinationDir
(
sDestinationDir
)
,
m_pOfficeDrawingConverter
(
pOfficeDrawingConverter
)
{
}
int
Read
()
...
...
@@ -1557,6 +1559,21 @@ namespace BinXlsxRW {
m_oWorkbook
.
m_bMacroEnabled
=
true
;
}
else
if
(
c_oSerWorkbookTypes
::
JsaProject
==
type
)
{
BYTE
*
pData
=
m_oBufferedStream
.
GetPointer
(
length
);
OOX
::
CPath
oJsaProject
=
OOX
::
FileTypes
::
JsaProject
.
DefaultFileName
();
std
::
wstring
filePath
=
m_sDestinationDir
+
FILE_SEPARATOR_STR
+
_T
(
"xl"
)
+
FILE_SEPARATOR_STR
+
oJsaProject
.
GetPath
();
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
filePath
);
oFile
.
WriteFile
(
pData
,
length
);
oFile
.
CloseFile
();
smart_ptr
<
OOX
::
JsaProject
>
oFileJsaProject
(
new
OOX
::
JsaProject
());
m_oWorkbook
.
Add
(
oFileJsaProject
.
smart_dynamic_cast
<
OOX
::
File
>
());
m_pOfficeDrawingConverter
->
m_pImageManager
->
m_pContentTypes
->
AddDefault
(
oJsaProject
.
GetExtention
(
false
));
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
...
...
@@ -4430,7 +4447,7 @@ namespace BinXlsxRW {
if
(
-
1
!=
nWorkbookOffBits
)
{
oBufferedStream
.
Seek
(
nWorkbookOffBits
);
res
=
BinaryWorkbookTableReader
(
oBufferedStream
,
*
pWorkbook
,
m_mapPivotCacheDefinitions
,
sOutDir
).
Read
();
res
=
BinaryWorkbookTableReader
(
oBufferedStream
,
*
pWorkbook
,
m_mapPivotCacheDefinitions
,
sOutDir
,
pOfficeDrawingConverter
).
Read
();
if
(
c_oSerConstants
::
ReadOk
!=
res
)
return
res
;
}
...
...
Boris Kocherov
@bk
mentioned in commit
ede03faf
·
Jan 30, 2018
mentioned in commit
ede03faf
mentioned in commit ede03fafea5dc324082496a27fda173bf8d958a5
Toggle commit list
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