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
0ed3f740
Commit
0ed3f740
authored
Aug 16, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read/write docm
parent
af2e76ae
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
291 additions
and
188 deletions
+291
-188
ASCOfficeDocxFile2/BinReader/DocumentWriter.h
ASCOfficeDocxFile2/BinReader/DocumentWriter.h
+4
-4
ASCOfficeDocxFile2/BinReader/FileWriter.h
ASCOfficeDocxFile2/BinReader/FileWriter.h
+4
-0
ASCOfficeDocxFile2/BinReader/Readers.cpp
ASCOfficeDocxFile2/BinReader/Readers.cpp
+27
-3
ASCOfficeDocxFile2/BinReader/Readers.h
ASCOfficeDocxFile2/BinReader/Readers.h
+102
-72
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
+22
-17
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+34
-7
Common/DocxFormat/Source/DocxFormat/Document.h
Common/DocxFormat/Source/DocxFormat/Document.h
+11
-3
Common/DocxFormat/Source/DocxFormat/Docx.cpp
Common/DocxFormat/Source/DocxFormat/Docx.cpp
+46
-66
Common/DocxFormat/Source/DocxFormat/Docx.h
Common/DocxFormat/Source/DocxFormat/Docx.h
+18
-14
Common/DocxFormat/Source/DocxFormat/FileFactory.cpp
Common/DocxFormat/Source/DocxFormat/FileFactory.cpp
+2
-2
Common/DocxFormat/Source/DocxFormat/FileTypes.h
Common/DocxFormat/Source/DocxFormat/FileTypes.h
+4
-0
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
+1
-0
Common/DocxFormat/Source/XlsxFormat/Xlsx.h
Common/DocxFormat/Source/XlsxFormat/Xlsx.h
+2
-0
X2tConverter/src/cextracttools.cpp
X2tConverter/src/cextracttools.cpp
+14
-0
No files found.
ASCOfficeDocxFile2/BinReader/DocumentWriter.h
View file @
0ed3f740
...
...
@@ -40,11 +40,11 @@ namespace Writers
class
DocumentWriter
:
public
ContentWriter
{
XmlUtils
::
CStringWriter
m_oWriter
;
HeaderFooterWriter
&
m_oHeaderFooterWriter
;
HeaderFooterWriter
&
m_oHeaderFooterWriter
;
public:
std
::
wstring
m_sDir
;
public:
DocumentWriter
(
std
::
wstring
sDir
,
HeaderFooterWriter
&
oHeaderFooterWriter
)
:
m_sDir
(
sDir
),
m_oHeaderFooterWriter
(
oHeaderFooterWriter
)
std
::
wstring
m_sDir
;
DocumentWriter
(
std
::
wstring
sDir
,
HeaderFooterWriter
&
oHeaderFooterWriter
)
:
m_sDir
(
sDir
),
m_oHeaderFooterWriter
(
oHeaderFooterWriter
)
{
}
void
Write
()
...
...
ASCOfficeDocxFile2/BinReader/FileWriter.h
View file @
0ed3f740
...
...
@@ -31,7 +31,9 @@
*/
#ifndef FILE_WRITER
#define FILE_WRITER
#include "../../DesktopEditor/common/Path.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "NumberingWriter.h"
#include "fontTableWriter.h"
...
...
@@ -75,6 +77,8 @@ namespace Writers
DocumentRelsWriter
m_oDocumentRelsWriter
;
WebSettingsWriter
m_oWebSettingsWriter
;
DefaultThemeWriter
m_oTheme
;
smart_ptr
<
OOX
::
VbaProject
>
m_pVbaProject
;
NSBinPptxRW
::
CDrawingConverter
*
m_pDrawingConverter
;
bool
m_bSaveChartAsImg
;
...
...
ASCOfficeDocxFile2/BinReader/Readers.cpp
View file @
0ed3f740
...
...
@@ -34,6 +34,30 @@
namespace
BinDocxRW
{
int
Binary_VbaProjectTableReader
::
Read
()
{
return
ReadTable
(
&
Binary_VbaProjectTableReader
::
ReadContent
,
this
);
}
int
Binary_VbaProjectTableReader
::
ReadContent
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSerVbaProjectTypes
::
Name
==
type
)
{
std
::
wstring
file_name
=
m_oBufferedStream
.
GetString4
(
length
);
OOX
::
CPath
inputPath
=
m_oBufferedStream
.
m_strFolder
+
FILE_SEPARATOR_STR
+
L"media"
+
FILE_SEPARATOR_STR
+
file_name
;
OOX
::
CPath
outputPath
=
m_oFileWriter
.
m_oDocumentWriter
.
m_sDir
+
FILE_SEPARATOR_STR
+
L"word"
+
FILE_SEPARATOR_STR
+
L"vbaProject.bin"
;
NSFile
::
CFileBinary
::
Copy
(
inputPath
.
GetPath
(),
outputPath
.
GetPath
());
m_oFileWriter
.
m_pVbaProject
=
new
OOX
::
VbaProject
();
m_oFileWriter
.
m_pVbaProject
->
set_filename
(
outputPath
.
GetPath
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
//-------------------------------------------------------------------------------------
Binary_HdrFtrTableReader
::
Binary_HdrFtrTableReader
(
NSBinPptxRW
::
CBinaryFileReader
&
poBufferedStream
,
Writers
::
FileWriter
&
oFileWriter
,
CComments
*
pComments
)
:
Binary_CommonReader
(
poBufferedStream
),
m_oFileWriter
(
oFileWriter
),
m_oHeaderFooterWriter
(
oFileWriter
.
m_oHeaderFooterWriter
),
m_pComments
(
pComments
)
{
}
...
...
@@ -93,9 +117,9 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes
Binary_DocumentTableReader
oBinary_DocumentTableReader
(
m_oBufferedStream
,
m_oFileWriter
,
poHdrFtrItem
->
Header
,
m_pComments
);
res
=
Read1
(
length
,
&
Binary_HdrFtrTableReader
::
ReadHdrFtrItemContent
,
this
,
&
oBinary_DocumentTableReader
);
OOX
::
CPath
fileRelsPath
=
m_oFileWriter
.
m_oDocumentWriter
.
m_sDir
+
FILE_SEPARATOR_STR
+
_T
(
"word"
)
+
FILE_SEPARATOR_STR
+
_T
(
"_rels"
)
+
FILE_SEPARATOR_STR
+
poHdrFtrItem
->
m_sFilename
+
_T
(
".rels"
)
;
OOX
::
CPath
fileRelsPath
=
m_oFileWriter
.
m_oDocumentWriter
.
m_sDir
+
FILE_SEPARATOR_STR
+
L"word"
+
FILE_SEPARATOR_STR
+
L"_rels"
+
FILE_SEPARATOR_STR
+
poHdrFtrItem
->
m_sFilename
+
L".rels"
;
m_oFileWriter
.
m_pDrawingConverter
->
SaveDstContentRels
(
fileRelsPath
.
GetPath
());
}
...
...
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
0ed3f740
This diff is collapsed.
Click to expand it.
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
View file @
0ed3f740
...
...
@@ -142,19 +142,20 @@ extern int g_nCurFormatVersion;
};}
namespace
c_oSerTableTypes
{
enum
c_oSerTableTypes
{
Signature
=
0
,
Info
=
1
,
Media
=
2
,
Numbering
=
3
,
HdrFtr
=
4
,
Style
=
5
,
Document
=
6
,
Other
=
7
,
Comments
=
8
,
Settings
=
9
,
Footnotes
=
10
,
Endnotes
=
11
,
Background
Signature
=
0
,
Info
=
1
,
Media
=
2
,
Numbering
=
3
,
HdrFtr
=
4
,
Style
=
5
,
Document
=
6
,
Other
=
7
,
Comments
=
8
,
Settings
=
9
,
Footnotes
=
10
,
Endnotes
=
11
,
Background
=
12
,
VbaProject
=
13
};}
namespace
c_oSerSigTypes
{
enum
c_oSerSigTypes
{
...
...
@@ -203,10 +204,10 @@ extern int g_nCurFormatVersion;
};}
namespace
c_oSerOtherTableTypes
{
enum
c_oSerOtherTableTypes
{
ImageMap
=
0
,
ImageMap_Src
=
1
,
EmbeddedFonts
=
2
,
DocxTheme
=
3
ImageMap
=
0
,
ImageMap_Src
=
1
,
EmbeddedFonts
=
2
,
DocxTheme
=
3
};}
namespace
c_oSerFontsTypes
{
enum
c_oSerFontsTypes
{
...
...
@@ -521,6 +522,10 @@ extern int g_nCurFormatVersion;
endnoteReference
=
27
,
arPr
=
28
};}
namespace
c_oSerVbaProjectTypes
{
enum
c_oSerVbaProjectType
{
Name
=
0
};}
namespace
c_oSerBackgroundType
{
enum
c_oSerBackgroundType
{
Color
=
0
,
...
...
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
0ed3f740
...
...
@@ -82,11 +82,11 @@ namespace BinDocxRW
int
m_nType
;
public:
std
::
wstring
m_sFld
;
public:
FldStruct
(
std
::
wstring
sFld
,
int
nType
)
:
m_sFld
(
sFld
),
m_nType
(
nType
){}
public:
int
GetType
()
{
return
m_nType
;
}
FldStruct
(
std
::
wstring
sFld
,
int
nType
)
:
m_sFld
(
sFld
),
m_nType
(
nType
){}
int
GetType
()
{
return
m_nType
;
}
};
class
BinaryCommonWriter
{
...
...
@@ -3027,6 +3027,26 @@ namespace BinDocxRW
}
pOfficeDrawingConverter
->
SetRels
(
oldRels
);
}
void
WriteVbaProjectContent
(
OOX
::
VbaProject
&
oVbaProject
)
{
std
::
wstring
file_name
=
oVbaProject
.
filename
().
GetFilename
();
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerVbaProjectTypes
::
Name
);
m_oBcw
.
m_oStream
.
WriteStringW
(
file_name
);
//... todooo write parsing vba project
//write vbaData.... todooo
//copy file bin
oVbaProject
.
copy_to
(
m_oBcw
.
m_oStream
.
m_pCommon
->
m_pImageManager
->
m_strDstMedia
);
}
void
WriteVbaProject
(
OOX
::
VbaProject
&
oVbaProject
)
{
int
nStart
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteVbaProjectContent
(
oVbaProject
);
m_oBcw
.
WriteItemWithLengthEnd
(
nStart
);
}
void
Write
(
std
::
vector
<
OOX
::
WritingElement
*>&
aElems
)
{
int
nStart
=
m_oBcw
.
WriteItemWithLengthStart
();
...
...
@@ -7866,9 +7886,8 @@ namespace BinDocxRW
//Write DocumentTable
ParamsDocumentWriter
oParamsDocumentWriter
(
poDocument
);
m_oParamsWriter
.
m_pCurRels
=
oParamsDocumentWriter
.
m_pRels
;
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
nCurPos
=
this
->
WriteTableStart
(
BinDocxRW
::
c_oSerTableTypes
::
Document
);
BinDocxRW
::
BinaryDocumentTableWriter
oBinaryDocumentTableWriter
(
m_oParamsWriter
,
oParamsDocumentWriter
,
&
m_oParamsWriter
.
m_mapIgnoreComments
,
&
oBinaryHeaderFooterTableWriter
);
oBinaryDocumentTableWriter
.
prepareOfficeDrawingConverter
(
m_oParamsWriter
.
m_pOfficeDrawingConverter
,
oParamsDocumentWriter
.
m_pRels
,
poDocument
->
m_arrShapeTypes
);
...
...
@@ -7876,7 +7895,15 @@ namespace BinDocxRW
oBinaryDocumentTableWriter
.
pBackground
=
poDocument
->
m_oBackground
.
GetPointer
();
oBinaryDocumentTableWriter
.
m_bWriteSectPr
=
true
;
//Write Vba
if
(
NULL
!=
oDocx
.
m_pVbaProject
)
{
nCurPos
=
this
->
WriteTableStart
(
BinDocxRW
::
c_oSerTableTypes
::
VbaProject
);
oBinaryDocumentTableWriter
.
WriteVbaProject
(
*
oDocx
.
m_pVbaProject
);
this
->
WriteTableEnd
(
nCurPos
);
}
// Write content
nCurPos
=
this
->
WriteTableStart
(
BinDocxRW
::
c_oSerTableTypes
::
Document
);
oBinaryDocumentTableWriter
.
Write
(
poDocument
->
m_arrItems
);
this
->
WriteTableEnd
(
nCurPos
);
...
...
Common/DocxFormat/Source/DocxFormat/Document.h
View file @
0ed3f740
...
...
@@ -201,9 +201,12 @@ namespace OOX
public:
CDocument
()
{
m_bMacroEnabled
=
false
;
}
CDocument
(
const
CPath
&
oRootPath
,
const
CPath
&
oPath
)
{
m_bMacroEnabled
=
false
;
read
(
oRootPath
,
oPath
);
}
virtual
~
CDocument
()
...
...
@@ -218,7 +221,6 @@ namespace OOX
m_arrItems
.
clear
();
}
public:
virtual
void
read
(
const
CPath
&
oPath
)
{
...
...
@@ -317,7 +319,11 @@ namespace OOX
{
m_oReadPath
=
oPath
;
IFileContainer
::
Read
(
oRootPath
,
oPath
);
if
(
IFileContainer
::
IsExist
(
OOX
::
FileTypes
::
VbaProject
))
{
m_bMacroEnabled
=
true
;
}
#ifdef USE_LITE_READER
Common
::
readAllShapeTypes
(
oPath
,
m_arrShapeTypes
);
...
...
@@ -491,7 +497,8 @@ namespace OOX
}
virtual
const
OOX
::
FileType
type
()
const
{
return
FileTypes
::
Document
;
if
(
m_bMacroEnabled
)
return
FileTypes
::
DocumentMacro
;
else
return
FileTypes
::
Document
;
}
virtual
const
CPath
DefaultDirectory
()
const
{
...
...
@@ -634,6 +641,7 @@ namespace OOX
WritingElement_ReadAttributes_End
(
oReader
)
}
public:
bool
m_bMacroEnabled
;
CPath
m_oReadPath
;
// Attributes
SimpleTypes
::
CConformanceClass
<
SimpleTypes
::
conformanceclassTransitional
>
m_oConformance
;
...
...
Common/DocxFormat/Source/DocxFormat/Docx.cpp
View file @
0ed3f740
...
...
@@ -43,100 +43,80 @@ namespace OOX {
// Ищем основной документ
smart_ptr
<
OOX
::
File
>
pFile
=
Find
(
OOX
::
FileTypes
::
Document
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
Document
==
pFile
->
type
())
m_pDocument
=
(
OOX
::
CDocument
*
)
pFile
.
operator
->
();
else
m_pDocument
=
NULL
;
if
(
pFile
.
IsInit
()
==
false
)
{
pFile
=
Find
(
OOX
::
FileTypes
::
DocumentMacro
);
}
if
(
pFile
.
IsInit
())
m_pDocument
=
dynamic_cast
<
OOX
::
CDocument
*>
(
pFile
.
operator
->
());
if
(
m_pDocument
)
{
OOX
::
IFileContainer
*
pDocumentContainer
=
(
OOX
::
IFileContainer
*
)
m_pDocument
;
// Ищем таблицу шрифтов
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
FontTable
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
FontTable
==
pFile
->
type
()
)
m_pFontTable
=
(
OOX
::
CFontTable
*
)
pFile
.
operator
->
();
else
m_pFontTable
=
NULL
;
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
FontTable
);
if
(
pFile
.
IsInit
()
)
m_pFontTable
=
dynamic_cast
<
OOX
::
CFontTable
*>
(
pFile
.
operator
->
());
// Ищем таблицу нумераций
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
Numbering
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
Numbering
==
pFile
->
type
()
)
m_pNumbering
=
(
OOX
::
CNumbering
*
)
pFile
.
operator
->
();
else
m_pNumbering
=
NULL
;
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
Numbering
);
if
(
pFile
.
IsInit
())
m_pNumbering
=
dynamic_cast
<
OOX
::
CNumbering
*>
(
pFile
.
operator
->
());
// Ищем таблицу стилей
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
Style
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
Style
==
pFile
->
type
()
)
m_pStyles
=
(
OOX
::
CStyles
*
)
pFile
.
operator
->
();
else
m_pStyles
=
NULL
;
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
Style
);
if
(
pFile
.
IsInit
())
m_pStyles
=
dynamic_cast
<
OOX
::
CStyles
*>
(
pFile
.
operator
->
());
// Ищем сноски для страниц
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
FootNote
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
FootNote
==
pFile
->
type
()
)
m_pFootnotes
=
(
OOX
::
CFootnotes
*
)
pFile
.
operator
->
();
else
m_pFootnotes
=
NULL
;
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
EndNote
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
EndNote
==
pFile
->
type
()
)
m_pEndnotes
=
(
OOX
::
CEndnotes
*
)
pFile
.
operator
->
();
else
m_pEndnotes
=
NULL
;
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
FootNote
);
if
(
pFile
.
IsInit
())
m_pFootnotes
=
dynamic_cast
<
OOX
::
CFootnotes
*>
(
pFile
.
operator
->
());
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
EndNote
);
if
(
pFile
.
IsInit
())
m_pEndnotes
=
dynamic_cast
<
OOX
::
CEndnotes
*>
(
pFile
.
operator
->
());
// Ищем файл с наcтройками
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
Setting
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
Setting
==
pFile
->
type
()
)
m_pSettings
=
(
OOX
::
CSettings
*
)
pFile
.
operator
->
();
else
m_pSettings
=
NULL
;
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
Setting
);
if
(
pFile
.
IsInit
()
)
m_pSettings
=
dynamic_cast
<
OOX
::
CSettings
*>
(
pFile
.
operator
->
());
// Ищем файл с комментариями
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
Comments
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
Comments
==
pFile
->
type
()
)
m_pComments
=
(
OOX
::
CComments
*
)
pFile
.
operator
->
();
else
m_pComments
=
NULL
;
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
Comments
);
if
(
pFile
.
IsInit
())
m_pComments
=
dynamic_cast
<
OOX
::
CComments
*>
(
pFile
.
operator
->
());
// Ищем файл с комментариями Ext
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
CommentsExt
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
CommentsExt
==
pFile
->
type
()
)
m_pCommentsExt
=
(
OOX
::
CCommentsExt
*
)
pFile
.
operator
->
();
else
m_pCommentsExt
=
NULL
;
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
CommentsExt
);
if
(
pFile
.
IsInit
())
m_pCommentsExt
=
dynamic_cast
<
OOX
::
CCommentsExt
*>
(
pFile
.
operator
->
());
// Ищем файл с авторами
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
People
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
People
==
pFile
->
type
()
)
m_pPeople
=
(
OOX
::
CPeople
*
)
pFile
.
operator
->
();
else
m_pPeople
=
NULL
;
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
People
);
if
(
pFile
.
IsInit
())
m_pPeople
=
dynamic_cast
<
OOX
::
CPeople
*>
(
pFile
.
operator
->
());
//OOX::CRels rels(oFilePath / m_pDocument->DefaultDirectory() / m_pDocument->DefaultFileName());
//IFileContainer::Read(rels, oFilePath);
// Ищем файл с темами
pFile
=
pDocumentContainer
->
Find
(
OOX
::
FileTypes
::
Theme
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
Theme
==
pFile
->
type
())
m_pTheme
=
(
PPTX
::
Theme
*
)
pFile
.
operator
->
();
else
m_pTheme
=
NULL
;
}
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
Theme
);
if
(
pFile
.
IsInit
())
m_pTheme
=
dynamic_cast
<
PPTX
::
Theme
*>
(
pFile
.
operator
->
());
pFile
=
m_pDocument
->
Find
(
OOX
::
FileTypes
::
VbaProject
);
if
(
pFile
.
IsInit
())
m_pVbaProject
=
dynamic_cast
<
OOX
::
VbaProject
*>
(
pFile
.
operator
->
());
}
// Ищем настройки
pFile
=
Find
(
OOX
::
FileTypes
::
App
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
App
==
pFile
->
type
()
)
m_pApp
=
(
OOX
::
CApp
*
)
pFile
.
operator
->
();
else
m_pApp
=
NULL
;
if
(
pFile
.
IsInit
())
m_pApp
=
dynamic_cast
<
OOX
::
CApp
*>
(
pFile
.
operator
->
());
pFile
=
Find
(
OOX
::
FileTypes
::
Core
);
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
Core
==
pFile
->
type
()
)
m_pCore
=
(
OOX
::
CCore
*
)
pFile
.
operator
->
();
else
m_pCore
=
NULL
;
if
(
pFile
.
IsInit
())
m_pCore
=
dynamic_cast
<
OOX
::
CCore
*>
(
pFile
.
operator
->
());
return
true
;
}
...
...
Common/DocxFormat/Source/DocxFormat/Docx.h
View file @
0ed3f740
...
...
@@ -53,6 +53,7 @@
#include "Media/Image.h"
#include "Media/OleObject.h"
#include "Media/ActiveX.h"
#include "Media/VbaProject.h"
#include "HeaderFooter.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
...
...
@@ -82,6 +83,7 @@ namespace OOX
m_pComments
=
NULL
;
m_pCommentsExt
=
NULL
;
m_pPeople
=
NULL
;
m_pVbaProject
=
NULL
;
}
CDocx
(
const
CPath
&
oFilePath
)
{
...
...
@@ -98,6 +100,7 @@ namespace OOX
m_pComments
=
NULL
;
m_pCommentsExt
=
NULL
;
m_pPeople
=
NULL
;
m_pVbaProject
=
NULL
;
Read
(
oFilePath
);
}
...
...
@@ -198,21 +201,22 @@ namespace OOX
return
NULL
;
}
OOX
::
CApp
*
m_pApp
;
OOX
::
CCore
*
m_pCore
;
OOX
::
CDocument
*
m_pDocument
;
// Основной документ word/document.xml
OOX
::
CFontTable
*
m_pFontTable
;
// Таблица шрифтов word/fonttable.xml
OOX
::
CNumbering
*
m_pNumbering
;
// Нумерации word/numbering.xml
OOX
::
CStyles
*
m_pStyles
;
// Стили word/styles.xml
OOX
::
CFootnotes
*
m_pFootnotes
;
// Сноски word/footnotes.xml
OOX
::
CEndnotes
*
m_pEndnotes
;
// Сноски word/endnotes.xml
OOX
::
CSettings
*
m_pSettings
;
// Настройки word/settings.xml
OOX
::
CComments
*
m_pComments
;
// word/comments.xml
OOX
::
CCommentsExt
*
m_pCommentsExt
;
// word/commentsExtended.xml
OOX
::
CPeople
*
m_pPeople
;
// word/people.xml
OOX
::
CApp
*
m_pApp
;
OOX
::
CCore
*
m_pCore
;
OOX
::
CDocument
*
m_pDocument
;
// Основной документ word/document.xml
OOX
::
CFontTable
*
m_pFontTable
;
// Таблица шрифтов word/fonttable.xml
OOX
::
CNumbering
*
m_pNumbering
;
// Нумерации word/numbering.xml
OOX
::
CStyles
*
m_pStyles
;
// Стили word/styles.xml
OOX
::
CFootnotes
*
m_pFootnotes
;
// Сноски word/footnotes.xml
OOX
::
CEndnotes
*
m_pEndnotes
;
// Сноски word/endnotes.xml
OOX
::
CSettings
*
m_pSettings
;
// Настройки word/settings.xml
OOX
::
CComments
*
m_pComments
;
// word/comments.xml
OOX
::
CCommentsExt
*
m_pCommentsExt
;
// word/commentsExtended.xml
OOX
::
CPeople
*
m_pPeople
;
// word/people.xml
OOX
::
VbaProject
*
m_pVbaProject
;
PPTX
::
Theme
*
m_pTheme
;
PPTX
::
Theme
*
m_pTheme
;
};
}
// OOX
...
...
Common/DocxFormat/Source/DocxFormat/FileFactory.cpp
View file @
0ed3f740
...
...
@@ -75,7 +75,7 @@ namespace OOX
else
oFileName
=
oPath
/
oRelationFilename
;
if
(
oRelation
.
Type
()
==
FileTypes
::
Document
)
if
(
oRelation
.
Type
()
==
FileTypes
::
Document
||
oRelation
.
Type
()
==
FileTypes
::
DocumentMacro
)
return
smart_ptr
<
OOX
::
File
>
(
new
CDocument
(
oRootPath
,
oFileName
));
else
if
(
oRelation
.
Type
()
==
FileTypes
::
FontTable
)
return
smart_ptr
<
OOX
::
File
>
(
new
CFontTable
(
oFileName
));
...
...
@@ -165,7 +165,7 @@ namespace OOX
return
smart_ptr
<
OOX
::
File
>
(
new
CApp
(
oFileName
));
else
if
(
pRelation
->
Type
()
==
FileTypes
::
Core
)
return
smart_ptr
<
OOX
::
File
>
(
new
CCore
(
oFileName
));
else
if
(
pRelation
->
Type
()
==
FileTypes
::
Document
)
else
if
(
pRelation
->
Type
()
==
FileTypes
::
Document
||
pRelation
->
Type
()
==
FileTypes
::
DocumentMacro
)
return
smart_ptr
<
OOX
::
File
>
(
new
CDocument
(
oRootPath
,
oFileName
));
else
if
(
pRelation
->
Type
()
==
FileTypes
::
Theme
)
{
...
...
Common/DocxFormat/Source/DocxFormat/FileTypes.h
View file @
0ed3f740
...
...
@@ -52,6 +52,10 @@ namespace OOX
_T
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
));
const
FileType
DocumentMacro
(
L"word"
,
L"document.xml"
,
_T
(
"application/vnd.ms-word.document.macroEnabled.main+xml"
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
));
const
FileType
Theme
(
L"theme"
,
L"theme.xml"
,
_T
(
"application/vnd.openxmlformats-officedocument.theme+xml"
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
),
true
);
...
...
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
View file @
0ed3f740
...
...
@@ -34,6 +34,7 @@
#define OOX_VBA_PROJECT_INCLUDE_H_
#include "Media.h"
#include "../IFileContainer.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
namespace
OOX
...
...
Common/DocxFormat/Source/XlsxFormat/Xlsx.h
View file @
0ed3f740
...
...
@@ -105,6 +105,8 @@ namespace OOX
{
m_pWorkbook
=
dynamic_cast
<
OOX
::
Spreadsheet
::
CWorkbook
*>
(
pFile
.
operator
->
());
}
else
m_pWorkbook
=
NULL
;
if
(
m_pWorkbook
)
{
...
...
X2tConverter/src/cextracttools.cpp
View file @
0ed3f740
...
...
@@ -133,35 +133,41 @@ namespace NExtractTools
case
AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_DOCT2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".docm"
)))
res
=
TCD_DOCT2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_T2BIN
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".rtf"
)))
res
=
TCD_DOCT2RTF
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsx"
)))
res
=
TCD_XLST2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsm"
)))
res
=
TCD_XLST2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_T2BIN
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".csv"
)))
res
=
TCD_XLST2CSV
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".pptx"
)))
res
=
TCD_PPTT2PPTX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptm"
)))
res
=
TCD_PPTT2PPTX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_T2BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_CANVAS_WORD
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_DOCT_BIN2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".docm"
)))
res
=
TCD_DOCT_BIN2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_BIN2T
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".rtf"
)))
res
=
TCD_DOCT_BIN2RTF
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsx"
)))
res
=
TCD_XLST_BIN2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsm"
)))
res
=
TCD_XLST_BIN2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlst"
)))
res
=
TCD_BIN2T
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".csv"
)))
res
=
TCD_XLST_BIN2CSV
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".pptx"
)))
res
=
TCD_PPTT_BIN2PPTX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptm"
)))
res
=
TCD_PPTT_BIN2PPTX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptt"
)))
res
=
TCD_BIN2T
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_CANVAS_PDF
:
...
...
@@ -171,18 +177,21 @@ namespace NExtractTools
case
AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsx"
)))
res
=
TCD_CSV2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsm"
)))
res
=
TCD_CSV2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlst"
)))
res
=
TCD_CSV2XLST
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_CSV2XLST_BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_RTF2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".docm"
)))
res
=
TCD_RTF2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_RTF2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_RTF2DOCT_BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_DOC2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".docm"
)))
res
=
TCD_DOC2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_DOC2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_DOC2DOCT_BIN
;
}
break
;
...
...
@@ -195,12 +204,14 @@ namespace NExtractTools
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_TXT2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".docm"
)))
res
=
TCD_TXT2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_TXT2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_TXT2DOCT_BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".pptx"
)))
res
=
TCD_PPT2PPTX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptm"
)))
res
=
TCD_PPT2PPTX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_PPT2PPTT_BIN
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptt"
)))
res
=
TCD_PPT2PPTT
;
}
break
;
...
...
@@ -215,6 +226,9 @@ namespace NExtractTools
else
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
))
||
0
==
sExt2
.
compare
(
_T
(
".xlsx"
))
||
0
==
sExt2
.
compare
(
_T
(
".pptx"
)))
res
=
TCD_ODF2OOX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".docm"
))
||
0
==
sExt2
.
compare
(
_T
(
".xlsm"
))
||
0
==
sExt2
.
compare
(
_T
(
".pptm"
)))
res
=
TCD_ODF2OOX
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO
:
{
...
...
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