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
be45d169
Commit
be45d169
authored
Aug 22, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small refactoring writing vba in doct, xlst
parent
03267ba2
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
166 additions
and
193 deletions
+166
-193
ASCOfficeDocxFile2/BinReader/Readers.cpp
ASCOfficeDocxFile2/BinReader/Readers.cpp
+4
-20
ASCOfficeDocxFile2/BinReader/Readers.h
ASCOfficeDocxFile2/BinReader/Readers.h
+1
-2
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+4
-17
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
+8
-4
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
+7
-6
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
+18
-17
ASCOfficePPTXFile/ASCOfficeDrawingConverter.h
ASCOfficePPTXFile/ASCOfficeDrawingConverter.h
+6
-4
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
+9
-4
ASCOfficePPTXFile/PPTXFormat/Presentation.h
ASCOfficePPTXFile/PPTXFormat/Presentation.h
+2
-2
XlsxSerializerCom/Reader/BinaryWriter.h
XlsxSerializerCom/Reader/BinaryWriter.h
+44
-51
XlsxSerializerCom/Writer/BinaryReader.h
XlsxSerializerCom/Writer/BinaryReader.h
+63
-66
No files found.
ASCOfficeDocxFile2/BinReader/Readers.cpp
View file @
be45d169
...
...
@@ -36,26 +36,10 @@ 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
;
m_oFileWriter
.
m_pVbaProject
->
fromPPTY
(
&
m_oBufferedStream
);
return
c_oSerConstants
::
ReadOk
;
}
//-------------------------------------------------------------------------------------
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
)
...
...
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
be45d169
...
...
@@ -285,8 +285,7 @@ public:
}
int
Read
();
int
ReadContent
(
BYTE
type
,
long
length
,
void
*
poResult
);
};
};
class
Binary_HdrFtrTableReader
:
public
Binary_CommonReader
<
Binary_HdrFtrTableReader
>
{
...
...
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
be45d169
...
...
@@ -3027,25 +3027,12 @@ 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
);
m_oBcw
.
m_oStream
.
StartRecord
(
0
);
oVbaProject
.
toPPTY
(
&
m_oBcw
.
m_oStream
);
m_oBcw
.
m_oStream
.
EndRecord
();
}
void
Write
(
std
::
vector
<
OOX
::
WritingElement
*>&
aElems
)
{
...
...
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
View file @
be45d169
...
...
@@ -93,6 +93,8 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
oDrawingConverter
.
SetFontDir
(
m_sFontDir
);
oDrawingConverter
.
SetFontPicker
(
pFontPicker
);
oDrawingConverter
.
SetMainDocument
(
this
);
oDrawingConverter
.
SetDstPath
(
pathMain
.
GetDirectory
()
+
FILE_SEPARATOR_STR
+
L"word"
);
oDrawingConverter
.
SetMediaDstPath
(
pathMedia
.
GetPath
());
m_pParamsWriter
=
new
ParamsWriter
(
&
oBufferedStream
,
&
fp
,
&
oDrawingConverter
,
pEmbeddedFontsManager
);
...
...
@@ -264,6 +266,8 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
if
(
NULL
!=
pData
)
{
oDrawingConverter
.
SetMainDocument
(
this
);
oDrawingConverter
.
SetDstPath
(
sDstPath
+
FILE_SEPARATOR_STR
+
L"word"
);
oDrawingConverter
.
SetMediaDstPath
(
sMediaPath
);
oDrawingConverter
.
SetEmbedDstPath
(
sEmbedPath
);
...
...
@@ -273,7 +277,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
std
::
wstring
strFileInDir
=
NSSystemPath
::
GetDirectoryName
(
sSrcFileName
);
std
::
wstring
sFileInDir
=
strFileInDir
.
c_str
();
oDrawingConverter
.
SetS
ourceFileDir
(
sFileInDir
);
oDrawingConverter
.
SetS
rcPath
(
sFileInDir
);
BinaryFileReader
oBinaryFileReader
(
sFileInDir
,
oBufferedStream
,
*
m_pCurFileWriter
);
oBinaryFileReader
.
ReadFile
();
...
...
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
View file @
be45d169
...
...
@@ -86,15 +86,16 @@ namespace BinXlsxRW{
}
bool
CXlsxSerializer
::
loadFromFile
(
const
std
::
wstring
&
sSrcFileName
,
const
std
::
wstring
&
sDstPath
,
const
std
::
wstring
&
sXMLOptions
,
const
std
::
wstring
&
sMediaDir
,
const
std
::
wstring
&
sEmbedDir
)
{
std
::
wstring
strFileInDir
=
NSSystemPath
::
GetDirectoryName
(
sSrcFileName
);
NSBinPptxRW
::
CDrawingConverter
oDrawingConverter
;
oDrawingConverter
.
SetDstPath
(
sDstPath
+
FILE_SEPARATOR_STR
+
L"xl"
);
oDrawingConverter
.
SetSrcPath
(
strFileInDir
,
2
);
oDrawingConverter
.
SetMediaDstPath
(
sMediaDir
);
oDrawingConverter
.
SetEmbedDstPath
(
sEmbedDir
);
std
::
wstring
strFileInDir
=
NSSystemPath
::
GetDirectoryName
(
sSrcFileName
);
oDrawingConverter
.
SetSourceFileDir
(
strFileInDir
,
2
);
BinXlsxRW
::
BinaryFileReader
oBinaryFileReader
;
oBinaryFileReader
.
ReadFile
(
sSrcFileName
,
sDstPath
,
&
oDrawingConverter
,
sXMLOptions
);
return
true
;
...
...
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
View file @
be45d169
...
...
@@ -913,20 +913,29 @@ HRESULT CDrawingConverter::SetMainDocument(BinDocxRW::CDocxSerializer* pDocument
return
S_OK
;
}
HRESULT
CDrawingConverter
::
SetMediaDstPath
(
const
std
::
wstring
&
bsMediaPath
)
void
CDrawingConverter
::
SetSrcPath
(
const
std
::
wstring
&
sPath
,
int
nDocType
)
{
m_pBinaryWriter
->
m_pCommon
->
m_pImageManager
->
m_strDstMedia
=
(
std
::
wstring
)
bsMediaPath
;
m_pImageManager
->
SetDstMedia
(
m_pBinaryWriter
->
m_pCommon
->
m_pImageManager
->
m_strDstMedia
)
;
m_pReader
->
m_pRels
->
m_pManager
=
m_pImageManager
;
m_pReader
->
m_strFolder
=
sPath
;
NSDirectory
::
CreateDirectory
(
bsMediaPath
);
return
S_OK
;
m_pImageManager
->
m_nDocumentType
=
nDocType
;
}
void
CDrawingConverter
::
SetDstPath
(
const
std
::
wstring
&
sPath
)
{
m_pImageManager
->
SetDstFolder
(
sPath
);
}
HRESULT
CDrawingConverter
::
SetEmbedDstPath
(
const
std
::
wstring
&
bsEmbed
Path
)
void
CDrawingConverter
::
SetMediaDstPath
(
const
std
::
wstring
&
s
Path
)
{
m_pImageManager
->
SetDstEmbed
(
bsEmbedPath
);
m_pBinaryWriter
->
m_pCommon
->
m_pImageManager
->
m_strDstMedia
=
sPath
;
m_pImageManager
->
SetDstMedia
(
sPath
);
NSDirectory
::
CreateDirectory
(
bsEmbedPath
);
return
S_OK
;
NSDirectory
::
CreateDirectory
(
sPath
);
}
void
CDrawingConverter
::
SetEmbedDstPath
(
const
std
::
wstring
&
sPath
)
{
m_pImageManager
->
SetDstEmbed
(
sPath
);
NSDirectory
::
CreateDirectory
(
sPath
);
}
HRESULT
CDrawingConverter
::
AddShapeType
(
const
std
::
wstring
&
bsXml
)
{
...
...
@@ -5274,14 +5283,6 @@ OOX::CContentTypes* CDrawingConverter::GetContentTypes()
//return m_pReader->mm_strContentTypes;
}
void
CDrawingConverter
::
SetSourceFileDir
(
std
::
wstring
path
,
int
nDocType
)
{
m_pReader
->
m_pRels
->
m_pManager
=
m_pImageManager
;
m_pReader
->
m_strFolder
=
path
;
m_pImageManager
->
m_nDocumentType
=
nDocType
;
}
void
CDrawingConverter
::
Clear
()
{
for
(
std
::
map
<
std
::
wstring
,
CShape
*>::
iterator
pPair
=
m_mapShapeTypes
.
begin
();
pPair
!=
m_mapShapeTypes
.
end
();
++
pPair
)
...
...
ASCOfficePPTXFile/ASCOfficeDrawingConverter.h
View file @
be45d169
...
...
@@ -215,8 +215,12 @@ namespace NSBinPptxRW
smart_ptr
<
OOX
::
IFileContainer
>
GetRels
();
HRESULT
SetMainDocument
(
BinDocxRW
::
CDocxSerializer
*
pDocument
);
HRESULT
SetMediaDstPath
(
const
std
::
wstring
&
sMediaPath
);
HRESULT
SetEmbedDstPath
(
const
std
::
wstring
&
sEmbedPath
);
void
SetSrcPath
(
const
std
::
wstring
&
sPath
,
int
nDocType
=
1
/*XMLWRITER_DOC_TYPE_DOCX*/
);
void
SetDstPath
(
const
std
::
wstring
&
sPath
);
void
SetMediaDstPath
(
const
std
::
wstring
&
sMediaPath
);
void
SetEmbedDstPath
(
const
std
::
wstring
&
sEmbedPath
);
HRESULT
AddShapeType
(
const
std
::
wstring
&
sXml
);
HRESULT
AddObject
(
const
std
::
wstring
&
sXml
,
std
::
wstring
**
pMainProps
);
...
...
@@ -255,8 +259,6 @@ namespace NSBinPptxRW
void
SetDocumentChartsCount
(
int
val
);
int
GetDocumentChartsCount
();
void
SetSourceFileDir
(
std
::
wstring
path
,
int
nDocType
=
1
/*XMLWRITER_DOC_TYPE_DOCX*/
);
OOX
::
CContentTypes
*
GetContentTypes
();
protected:
nullable
<
PPTX
::
Logic
::
Xfrm
>
m_oxfrm_override
;
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
View file @
be45d169
...
...
@@ -346,7 +346,10 @@ namespace PPTX
pReader
->
m_pRels
=
new
NSBinPptxRW
::
CRelsGenerator
();
oDrawingConverter
.
SetMainDocument
(
&
oDocxSerializer
);
oDrawingConverter
.
SetSourceFileDir
(
pReader
->
m_strFolder
,
1
);
oDrawingConverter
.
SetDstPath
(
sDstEmbeddedTemp
+
FILE_SEPARATOR_STR
+
L"word"
);
oDrawingConverter
.
SetSrcPath
(
pReader
->
m_strFolder
,
1
);
oDrawingConverter
.
SetMediaDstPath
(
sMediaPath
);
oDrawingConverter
.
SetEmbedDstPath
(
sEmbedPath
);
...
...
@@ -434,7 +437,9 @@ namespace PPTX
oDrawingConverter
.
m_pReader
=
pReader
;
pReader
->
m_pRels
=
new
NSBinPptxRW
::
CRelsGenerator
();
oDrawingConverter
.
SetSourceFileDir
(
pReader
->
m_strFolder
,
2
);
oDrawingConverter
.
SetDstPath
(
sDstEmbeddedTemp
+
FILE_SEPARATOR_STR
+
L"xl"
);
oDrawingConverter
.
SetSrcPath
(
pReader
->
m_strFolder
,
2
);
oDrawingConverter
.
SetMediaDstPath
(
sMediaPath
);
oDrawingConverter
.
SetEmbedDstPath
(
sEmbedPath
);
...
...
ASCOfficePPTXFile/PPTXFormat/Presentation.h
View file @
be45d169
...
...
@@ -469,8 +469,8 @@ namespace PPTX
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
;};
void
SetClrMap
(
Logic
::
ClrMap
map
)
{
m_clrMap
=
map
;}
void
SetClrScheme
(
nsTheme
::
ClrScheme
scheme
)
{
m_clrScheme
=
scheme
;}
DWORD
GetRGBAFromMap
(
const
std
::
wstring
&
str
)
const
{
...
...
XlsxSerializerCom/Reader/BinaryWriter.h
View file @
be45d169
This diff is collapsed.
Click to expand it.
XlsxSerializerCom/Writer/BinaryReader.h
View file @
be45d169
This diff is collapsed.
Click to expand it.
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