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
2e61fcfd
Commit
2e61fcfd
authored
Aug 17, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read/write pptm
parent
3df883cb
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
139 additions
and
25 deletions
+139
-25
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
+20
-1
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
+7
-2
ASCOfficePPTXFile/Editor/PPTXWriter.h
ASCOfficePPTXFile/Editor/PPTXWriter.h
+15
-3
ASCOfficePPTXFile/PPTXFormat/FileFactory.cpp
ASCOfficePPTXFile/PPTXFormat/FileFactory.cpp
+4
-1
ASCOfficePPTXFile/PPTXFormat/FileTypes.h
ASCOfficePPTXFile/PPTXFormat/FileTypes.h
+3
-0
ASCOfficePPTXFile/PPTXFormat/Folder.cpp
ASCOfficePPTXFile/PPTXFormat/Folder.cpp
+6
-0
ASCOfficePPTXFile/PPTXFormat/Presentation.h
ASCOfficePPTXFile/PPTXFormat/Presentation.h
+37
-17
ASCOfficePPTXFile/PPTXFormat/Slide.h
ASCOfficePPTXFile/PPTXFormat/Slide.h
+1
-1
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
+46
-0
No files found.
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
View file @
2e61fcfd
...
...
@@ -125,6 +125,19 @@ namespace NSBinPptxRW
m_lIndexNextImage
=
0
;
m_lIndexCounter
=
0
;
}
void
CImageManager2
::
SetDstFolder
(
const
std
::
wstring
&
strDst
)
{
m_strDstFolder
=
strDst
;
m_strDstMedia
=
m_strDstFolder
+
FILE_SEPARATOR_STR
+
_T
(
"media"
);
m_strDstEmbed
=
m_strDstFolder
+
FILE_SEPARATOR_STR
+
_T
(
"embeddings"
);
NSDirectory
::
CreateDirectory
(
m_strDstMedia
);
NSDirectory
::
CreateDirectory
(
m_strDstEmbed
);
}
std
::
wstring
CImageManager2
::
GetDstFolder
()
{
return
m_strDstFolder
;
}
void
CImageManager2
::
SetDstMedia
(
const
std
::
wstring
&
strDst
)
{
m_strDstMedia
=
strDst
;
...
...
@@ -1222,7 +1235,7 @@ namespace NSBinPptxRW
m_pWriter
->
WriteString
(
strRels
);
}
void
CRelsGenerator
::
EndPresentationRels
(
const
bool
&
bIsCommentsAuthors
=
false
,
const
bool
&
bIsNotesMaster
)
void
CRelsGenerator
::
EndPresentationRels
(
bool
bIsCommentsAuthors
,
bool
bIsNotesMaster
,
bool
bIsVbaProject
)
{
if
(
bIsNotesMaster
)
{
...
...
@@ -1247,6 +1260,12 @@ namespace NSBinPptxRW
L"
\"
Type=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors
\"
Target=
\"
commentAuthors.xml
\"
/>"
;
m_pWriter
->
WriteString
(
strRels4
);
}
if
(
bIsVbaProject
)
{
std
::
wstring
strRels4
=
L"<Relationship Id=
\"
rId"
+
std
::
to_wstring
(
m_lNextRelsID
++
)
+
L"
\"
Type=
\"
http://schemas.microsoft.com/office/2006/relationships/vbaProject
\"
Target=
\"
vbaProject.bin
\"
/>"
;
m_pWriter
->
WriteString
(
strRels4
);
}
}
int
CRelsGenerator
::
GetNextId
()
{
...
...
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
View file @
2e61fcfd
...
...
@@ -178,8 +178,10 @@ namespace NSBinPptxRW
std
::
map
<
std
::
wstring
,
_imageManager2Info
>
m_mapImages
;
_INT32
m_lIndexNextImage
;
_INT32
m_lIndexCounter
;
std
::
wstring
m_strDstMedia
;
std
::
wstring
m_strDstEmbed
;
std
::
wstring
m_strDstFolder
;
public:
int
m_nDocumentType
;
OOX
::
CContentTypes
*
m_pContentTypes
;
...
...
@@ -194,6 +196,9 @@ namespace NSBinPptxRW
void
SetDstEmbed
(
const
std
::
wstring
&
strDst
);
std
::
wstring
GetDstEmbed
();
void
SetDstFolder
(
const
std
::
wstring
&
strDst
);
std
::
wstring
GetDstFolder
();
int
IsDisplayedImage
(
const
std
::
wstring
&
strInput
);
_imageManager2Info
GenerateImage
(
const
std
::
wstring
&
strInput
,
NSCommon
::
smart_ptr
<
OOX
::
File
>
&
additionalFile
,
const
std
::
wstring
&
oleData
,
std
::
wstring
strBase64Image
);
...
...
@@ -420,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
(
const
bool
&
bIsCommentsAuthors
,
const
bool
&
bIsNotesMaster
=
false
);
void
EndPresentationRels
(
bool
bIsCommentsAuthors
=
false
,
bool
bIsNotesMaster
=
false
,
bool
bIsVbaProject
=
false
);
int
GetNextId
();
void
CloseRels
();
...
...
ASCOfficePPTXFile/Editor/PPTXWriter.h
View file @
2e61fcfd
...
...
@@ -100,6 +100,8 @@ namespace NSBinPptxRW
m_oImageManager
.
Clear
();
m_oImageManager
.
SetDstFolder
(
pathPPT
.
GetPath
());
OOX
::
CPath
pathMedia
=
pathPPT
/
_T
(
"media"
);
NSDirectory
::
CreateDirectory
(
pathMedia
.
GetPath
());
...
...
@@ -809,7 +811,8 @@ namespace NSBinPptxRW
m_oPresentation
.
notesMasterIdLst
[
0
].
rid
=
(
size_t
)
nCurrentRels
;
++
nCurrentRels
;
}
m_oReader
.
m_pRels
->
EndPresentationRels
(
m_oPresentation
.
commentAuthors
.
is_init
(),
bNotesMasterPresent
);
m_oReader
.
m_pRels
->
EndPresentationRels
(
m_oPresentation
.
commentAuthors
.
is_init
(),
bNotesMasterPresent
,
m_oPresentation
.
m_pVbaProject
.
is_init
());
m_oReader
.
m_pRels
->
CloseRels
();
oXmlWriter
.
ClearNoAttack
();
...
...
@@ -840,7 +843,16 @@ namespace NSBinPptxRW
// content types
OOX
::
CContentTypes
*
pContentTypes
=
m_oImageManager
.
m_pContentTypes
;
pContentTypes
->
Registration
(
L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
,
L"/ppt"
,
L"presentation.xml"
);
pContentTypes
->
Registration
(
m_oPresentation
.
type
().
OverrideType
(),
m_oPresentation
.
type
().
DefaultDirectory
(),
m_oPresentation
.
type
().
DefaultFileName
());
if
(
m_oPresentation
.
m_pVbaProject
.
IsInit
())
{
pContentTypes
->
Registration
(
m_oPresentation
.
m_pVbaProject
->
type
().
OverrideType
(),
m_oPresentation
.
type
().
DefaultDirectory
()
/
m_oPresentation
.
m_pVbaProject
->
type
().
DefaultDirectory
(),
m_oPresentation
.
m_pVbaProject
->
type
().
DefaultFileName
());
}
pContentTypes
->
Registration
(
L"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"
,
L"/ppt"
,
L"presProps.xml"
);
pContentTypes
->
Registration
(
L"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"
,
L"/ppt"
,
L"viewProps.xml"
);
pContentTypes
->
Registration
(
L"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"
,
L"/ppt"
,
L"tableStyles.xml"
);
...
...
ASCOfficePPTXFile/PPTXFormat/FileFactory.cpp
View file @
2e61fcfd
...
...
@@ -84,7 +84,8 @@ namespace PPTX
return
smart_ptr
<
OOX
::
File
>
(
new
PPTX
::
App
(
filename
,
map
));
else
if
(
relation
.
Type
()
==
OOX
::
FileTypes
::
Core
)
return
smart_ptr
<
OOX
::
File
>
(
new
PPTX
::
Core
(
filename
,
map
));
else
if
(
relation
.
Type
()
==
OOX
::
Presentation
::
FileTypes
::
Presentation
)
else
if
(
relation
.
Type
()
==
OOX
::
Presentation
::
FileTypes
::
Presentation
||
relation
.
Type
()
==
OOX
::
Presentation
::
FileTypes
::
PresentationMacro
)
return
smart_ptr
<
OOX
::
File
>
(
new
PPTX
::
Presentation
(
filename
,
map
));
else
if
(
relation
.
Type
()
==
OOX
::
FileTypes
::
Theme
)
return
smart_ptr
<
OOX
::
File
>
(
new
PPTX
::
Theme
(
filename
,
map
));
...
...
@@ -141,6 +142,8 @@ namespace PPTX
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
OleObject
(
filename
));
else
if
(
relation
.
Type
()
==
OOX
::
FileTypes
::
MicrosoftOfficeUnknown
)
//ms package
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
));
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
UnknowTypeFile
());
}
...
...
ASCOfficePPTXFile/PPTXFormat/FileTypes.h
View file @
2e61fcfd
...
...
@@ -44,6 +44,9 @@ namespace Presentation
const
FileType
Presentation
(
L"ppt"
,
L"presentation.xml"
,
_T
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
));
const
FileType
PresentationMacro
(
L"ppt"
,
L"presentation.xml"
,
_T
(
"application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml"
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
));
const
FileType
Slide
(
L"slides"
,
L"slide.xml"
,
_T
(
"application/vnd.openxmlformats-officedocument.presentationml.slide+xml"
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
));
...
...
ASCOfficePPTXFile/PPTXFormat/Folder.cpp
View file @
2e61fcfd
...
...
@@ -75,6 +75,12 @@ namespace PPTX
if
(
_presentation
.
is_init
())
{
_presentation
->
commentAuthors
=
_presentation
->
Get
(
OOX
::
Presentation
::
FileTypes
::
CommentAuthors
).
smart_dynamic_cast
<
PPTX
::
Authors
>
();
if
(
_presentation
->
IsExist
(
OOX
::
FileTypes
::
VbaProject
))
{
_presentation
->
m_bMacroEnabled
=
true
;
_presentation
->
m_pVbaProject
=
_presentation
->
Get
(
OOX
::
FileTypes
::
VbaProject
).
smart_dynamic_cast
<
OOX
::
VbaProject
>
();
}
}
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 @
2e61fcfd
...
...
@@ -50,6 +50,8 @@
#include "Logic/ExtP.h"
#include "Theme/ClrScheme.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
namespace
PPTX
{
class
Presentation
:
public
WrapperFile
,
public
PPTX
::
FileContainer
...
...
@@ -57,16 +59,16 @@ namespace PPTX
public:
Presentation
()
{
m_bMacroEnabled
=
false
;
}
Presentation
(
const
OOX
::
CPath
&
filename
,
FileMap
&
map
)
{
m_bMacroEnabled
=
false
;
read
(
filename
,
map
);
}
virtual
~
Presentation
()
{
}
public:
virtual
void
read
(
const
OOX
::
CPath
&
filename
,
FileMap
&
map
)
{
//FileContainer::read(filename, map);
...
...
@@ -182,6 +184,7 @@ namespace PPTX
}
}
}
//smartTags (Smart Tags)
Normalize
();
}
...
...
@@ -222,6 +225,15 @@ namespace PPTX
pWriter
->
WriteRecord2
(
6
,
commentAuthors
);
pWriter
->
WriteRecord2
(
7
,
sectionLst
);
if
(
m_pVbaProject
.
IsInit
())
{
pWriter
->
StartRecord
(
8
);
{
m_pVbaProject
->
toPPTY
(
pWriter
);
}
pWriter
->
EndRecord
();
}
pWriter
->
EndRecord
();
}
virtual
void
fromPPTY
(
NSBinPptxRW
::
CBinaryFileReader
*
pReader
)
...
...
@@ -319,21 +331,27 @@ namespace PPTX
return
;
}
}
break
;
}
}
break
;
case
6
:
{
commentAuthors
=
new
PPTX
::
Authors
();
commentAuthors
->
fromPPTY
(
pReader
);
break
;
}
}
break
;
case
7
:
{
sectionLst
=
new
nsPresentation
::
SectionLst
();
sectionLst
->
fromPPTY
(
pReader
);
break
;
}
}
break
;
case
8
:
{
m_pVbaProject
=
new
OOX
::
VbaProject
();
m_pVbaProject
->
fromPPTY
(
pReader
);
smart_ptr
<
OOX
::
File
>
file
=
m_pVbaProject
.
smart_dynamic_cast
<
OOX
::
File
>
();
FileContainer
::
Add
(
file
);
m_bMacroEnabled
=
true
;
}
break
;
default:
{
pReader
->
Seek
(
_end_pos
);
...
...
@@ -397,10 +415,10 @@ namespace PPTX
pWriter
->
EndNode
(
L"p:presentation"
);
}
public:
virtual
const
OOX
::
FileType
type
()
const
{
return
OOX
::
Presentation
::
FileTypes
::
Presentation
;
if
(
m_bMacroEnabled
)
return
OOX
::
Presentation
::
FileTypes
::
PresentationMacro
;
else
return
OOX
::
Presentation
::
FileTypes
::
Presentation
;
}
virtual
const
OOX
::
CPath
DefaultDirectory
()
const
{
...
...
@@ -411,7 +429,6 @@ namespace PPTX
return
type
().
DefaultFileName
();
}
public:
//Childs
//custDataLst (Customer Data List)
//property<std::list<Presentation::CustShow> > custShowLst (List of Custom Shows)
...
...
@@ -449,6 +466,9 @@ namespace PPTX
Logic
::
ClrMap
m_clrMap
;
nsTheme
::
ClrScheme
m_clrScheme
;
public:
bool
m_bMacroEnabled
;
smart_ptr
<
OOX
::
VbaProject
>
m_pVbaProject
;
void
SetClrMap
(
Logic
::
ClrMap
map
)
{
m_clrMap
=
map
;};
void
SetClrScheme
(
nsTheme
::
ClrScheme
scheme
)
{
m_clrScheme
=
scheme
;};
...
...
ASCOfficePPTXFile/PPTXFormat/Slide.h
View file @
2e61fcfd
...
...
@@ -363,7 +363,7 @@ namespace PPTX
}
if
(
IsExist
(
OOX
::
FileTypes
::
VmlDrawing
))
{
Vml
=
FileContainer
::
Get
(
OOX
::
FileTypes
::
VmlDrawing
).
smart_dynamic_cast
<
OOX
::
CVmlDrawing
>
();
//boost::shared_dynamic_cast<PPTX::VmlDrawing, PPTX::File>(FileContainer::get(OOX::Presentation::FileTypes::VmlDrawing));
Vml
=
FileContainer
::
Get
(
OOX
::
FileTypes
::
VmlDrawing
).
smart_dynamic_cast
<
OOX
::
CVmlDrawing
>
();
}
}
}
...
...
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
View file @
2e61fcfd
...
...
@@ -34,6 +34,9 @@
#define OOX_VBA_PROJECT_INCLUDE_H_
#include "Media.h"
#include "../../../../../ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h"
#include "../../../../../ASCOfficePPTXFile/Editor/imagemanager.h"
#include "../IFileContainer.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
...
...
@@ -72,6 +75,49 @@ namespace OOX
{
return
m_filename
.
GetFilename
();
}
virtual
void
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
{
pWriter
->
WriteBYTE
(
NSBinPptxRW
::
g_nodeAttributeStart
);
pWriter
->
WriteString1
(
0
,
m_filename
.
GetFilename
());
pWriter
->
WriteBYTE
(
NSBinPptxRW
::
g_nodeAttributeEnd
);
copy_to
(
pWriter
->
m_pCommon
->
m_pImageManager
->
m_strDstMedia
);
}
virtual
void
fromPPTY
(
NSBinPptxRW
::
CBinaryFileReader
*
pReader
)
{
LONG
_end_rec
=
pReader
->
GetPos
()
+
pReader
->
GetLong
()
+
4
;
pReader
->
Skip
(
1
);
// start attributes
while
(
true
)
{
BYTE
_at
=
pReader
->
GetUChar_TypeNode
();
if
(
_at
==
NSBinPptxRW
::
g_nodeAttributeEnd
)
break
;
switch
(
_at
)
{
case
0
:
{
std
::
wstring
file_name
=
pReader
->
GetString2
();
OOX
::
CPath
inputPath
=
pReader
->
m_strFolder
+
FILE_SEPARATOR_STR
+
_T
(
"media"
)
+
FILE_SEPARATOR_STR
+
file_name
;
OOX
::
CPath
outputPath
=
pReader
->
m_pRels
->
m_pManager
->
GetDstFolder
()
+
FILE_SEPARATOR_STR
+
_T
(
"vbaProject.bin"
);
NSFile
::
CFileBinary
::
Copy
(
inputPath
.
GetPath
(),
outputPath
.
GetPath
());
set_filename
(
outputPath
.
GetPath
());
}
break
;
default:
break
;
}
}
pReader
->
Seek
(
_end_rec
);
}
protected:
};
}
// namespace OOX
...
...
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