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
b13eba5f
Commit
b13eba5f
authored
Dec 15, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t optimization rels
parent
a48058c7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
40 deletions
+41
-40
ASCOfficePPTXFile/PPTXFormat/FileContainer.cpp
ASCOfficePPTXFile/PPTXFormat/FileContainer.cpp
+3
-5
Common/DocxFormat/Source/DocxFormat/IFileContainer.cpp
Common/DocxFormat/Source/DocxFormat/IFileContainer.cpp
+6
-6
Common/DocxFormat/Source/DocxFormat/Rels.h
Common/DocxFormat/Source/DocxFormat/Rels.h
+32
-29
No files found.
ASCOfficePPTXFile/PPTXFormat/FileContainer.cpp
View file @
b13eba5f
...
...
@@ -103,11 +103,9 @@ namespace PPTX
pSrcFile
->
type
()
==
OOX
::
Presentation
::
FileTypes
::
NotesSlide
)
?
true
:
false
;
}
size_t
nCount
=
rels
.
m_arrRelations
.
size
();
for
(
size_t
i
=
0
;
i
<
nCount
;
++
i
)
for
(
std
::
map
<
std
::
wstring
,
OOX
::
Rels
::
CRelationShip
*>::
const_iterator
it
=
rels
.
m_mapRelations
.
begin
();
it
!=
rels
.
m_mapRelations
.
end
();
it
++
)
{
OOX
::
Rels
::
CRelationShip
*
pRelation
=
rels
.
m_arrRelations
[
i
]
;
OOX
::
Rels
::
CRelationShip
*
pRelation
=
it
->
second
;
OOX
::
CPath
normPath
=
CorrectPathRels
(
path
,
pRelation
);
...
...
Common/DocxFormat/Source/DocxFormat/IFileContainer.cpp
View file @
b13eba5f
...
...
@@ -74,19 +74,19 @@ namespace OOX
void
IFileContainer
::
Read
(
const
OOX
::
CRels
&
oRels
,
const
OOX
::
CPath
&
oRootPath
,
const
OOX
::
CPath
&
oPath
)
{
unsigned
int
nCount
=
oRels
.
m_arrRelations
.
size
();
for
(
unsigned
int
nIndex
=
0
;
nIndex
<
nCount
;
++
nIndex
)
for
(
std
::
map
<
std
::
wstring
,
Rels
::
CRelationShip
*>::
const_iterator
it
=
oRels
.
m_mapRelations
.
begin
();
it
!=
oRels
.
m_mapRelations
.
end
();
it
++
)
{
if
(
!
it
->
second
)
continue
;
smart_ptr
<
OOX
::
File
>
pFile
;
if
(
m_bSpreadsheets
)
pFile
=
OOX
::
Spreadsheet
::
CreateFile
(
oRootPath
,
oPath
,
oRels
.
m_arrRelations
[
nIndex
]
);
pFile
=
OOX
::
Spreadsheet
::
CreateFile
(
oRootPath
,
oPath
,
it
->
second
);
if
(
pFile
.
IsInit
()
==
false
||
pFile
->
type
()
==
FileTypes
::
Unknow
)
pFile
=
OOX
::
CreateFile
(
oRootPath
,
oPath
,
oRels
.
m_arrRelations
[
nIndex
]
);
pFile
=
OOX
::
CreateFile
(
oRootPath
,
oPath
,
it
->
second
);
Add
(
oRels
.
m_arrRelations
[
nIndex
]
->
rId
(),
pFile
);
Add
(
it
->
second
->
rId
(),
pFile
);
}
}
...
...
Common/DocxFormat/Source/DocxFormat/Rels.h
View file @
b13eba5f
...
...
@@ -172,12 +172,12 @@ namespace OOX
}
~
CRels
()
{
for
(
unsigned
int
nIndex
=
0
;
nIndex
<
m_arrRelations
.
size
();
nIndex
++
)
for
(
std
::
map
<
std
::
wstring
,
Rels
::
CRelationShip
*>::
iterator
it
=
m_mapRelations
.
begin
();
it
!=
m_mapRelations
.
end
();
it
++
)
{
if
(
m_arrRelations
[
nIndex
]
)
delete
m_arrRelations
[
nIndex
]
;
m_arrRelations
[
nIndex
]
=
NULL
;
if
(
it
->
second
)
delete
it
->
second
;
it
->
second
=
NULL
;
}
m_
arr
Relations
.
clear
();
m_
map
Relations
.
clear
();
}
...
...
@@ -206,8 +206,12 @@ namespace OOX
sName
=
oReader
.
GetName
();
if
(
_T
(
"Relationship"
)
==
sName
)
{
OOX
::
Rels
::
CRelationShip
*
oRel
=
new
OOX
::
Rels
::
CRelationShip
(
oReader
);
if
(
oRel
)
m_arrRelations
.
push_back
(
oRel
);
OOX
::
Rels
::
CRelationShip
*
pRel
=
new
OOX
::
Rels
::
CRelationShip
(
oReader
);
if
(
pRel
)
{
std
::
wstring
rid
=
pRel
->
rId
().
get
();
m_mapRelations
.
insert
(
std
::
make_pair
(
rid
,
pRel
)
);
}
}
}
}
...
...
@@ -226,9 +230,12 @@ namespace OOX
{
if
(
oNodes
.
GetAt
(
nIndex
,
oRelNode
)
)
{
//Rels::CRelationShip oRel = oRelNode;
Rels
::
CRelationShip
*
oRel
=
new
Rels
::
CRelationShip
(
oRelNode
);
m_arrRelations
.
push_back
(
oRel
);
Rels
::
CRelationShip
*
pRel
=
new
Rels
::
CRelationShip
(
oRelNode
);
if
(
pRel
)
{
std
::
wstring
rid
=
pRel
->
rId
().
get
();
m_mapRelations
.
insert
(
std
::
make_pair
(
rid
,
pRel
)
);
}
}
}
}
...
...
@@ -237,7 +244,7 @@ namespace OOX
}
void
Write
(
const
CPath
&
oFilePath
)
const
{
if
(
0
<
m_arrRelations
.
size
()
)
if
(
!
m_mapRelations
.
empty
()
)
{
CPath
oFile
=
CreateFileName
(
oFilePath
);
CSystemUtility
::
CreateDirectories
(
oFile
.
GetDirectory
()
);
...
...
@@ -250,10 +257,10 @@ namespace OOX
oWriter
.
WriteAttribute
(
_T
(
"xmlns"
),
_T
(
"http://schemas.openxmlformats.org/package/2006/relationships"
)
);
oWriter
.
WriteNodeEnd
(
_T
(
"Relationships"
),
true
,
false
);
for
(
unsigned
int
nIndex
=
0
;
nIndex
<
m_arrRelations
.
size
();
nIndex
++
)
for
(
std
::
map
<
std
::
wstring
,
Rels
::
CRelationShip
*>::
const_iterator
it
=
m_mapRelations
.
begin
();
it
!=
m_mapRelations
.
end
();
it
++
)
{
if
(
m_arrRelations
[
nIndex
]
)
oWriter
.
WriteString
(
m_arrRelations
[
nIndex
]
->
toXML
()
);
if
(
it
->
second
)
oWriter
.
WriteString
(
it
->
second
->
toXML
()
);
}
oWriter
.
WriteNodeEnd
(
_T
(
"Relationships"
)
);
...
...
@@ -270,39 +277,37 @@ namespace OOX
std
::
wstring
strFileName
=
oPath
.
m_strFilename
;
std
::
wstring
strDir
=
oPath
.
GetDirectory
()
+
_T
(
""
);
if
(
_T
(
""
)
==
oPath
.
GetExtention
()
)
if
(
L""
==
oPath
.
GetExtention
()
)
{
if
(
oType
.
RelationType
()
==
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
)
)
if
(
oType
.
RelationType
()
==
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
)
{
strFileName
+=
L".bin"
;
m_
arrRelations
.
push_back
(
new
Rels
::
CRelationShip
(
rId
,
oType
.
RelationType
(),
strDir
+
strFileName
)
);
m_
mapRelations
.
insert
(
std
::
make_pair
(
rId
.
get
(),
new
Rels
::
CRelationShip
(
rId
,
oType
.
RelationType
(),
strDir
+
strFileName
)
)
);
}
else
if
(
oType
.
RelationType
()
==
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
)
)
else
if
(
oType
.
RelationType
()
==
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
)
{
strFileName
+=
L".wmf"
;
m_
arrRelations
.
push_back
(
new
Rels
::
CRelationShip
(
rId
,
oType
.
RelationType
(),
strDir
+
strFileName
)
);
m_
mapRelations
.
insert
(
std
::
make_pair
(
rId
.
get
(),
new
Rels
::
CRelationShip
(
rId
,
oType
.
RelationType
(),
strDir
+
strFileName
)
)
);
}
}
else
{
m_arrRelations
.
push_back
(
new
Rels
::
CRelationShip
(
rId
,
oType
.
RelationType
(),
oPath
.
GetPath
())
);
//m_arrRelations.push_back( Rels::CRelationShip( rId, oType.RelationType(), replace_extension( oPath, L"svm", L"png") );
m_mapRelations
.
insert
(
std
::
make_pair
(
rId
.
get
(),
new
Rels
::
CRelationShip
(
rId
,
oType
.
RelationType
(),
oPath
.
GetPath
())));
}
}
}
void
Registration
(
const
RId
&
rId
,
const
smart_ptr
<
External
>
pExternal
)
{
m_
arrRelations
.
push_back
(
new
Rels
::
CRelationShip
(
rId
,
pExternal
)
);
m_
mapRelations
.
insert
(
std
::
make_pair
(
rId
.
get
(),
new
Rels
::
CRelationShip
(
rId
,
pExternal
)
)
);
}
void
GetRel
(
const
RId
&
rId
,
Rels
::
CRelationShip
**
ppRelationShip
)
{
(
*
ppRelationShip
)
=
NULL
;
for
(
size_t
i
=
0
,
length
=
m_arrRelations
.
size
();
i
<
length
;
++
i
)
{
if
((
m_arrRelations
[
i
])
&&
(
m_arrRelations
[
i
]
->
rId
()
==
rId
))
std
::
map
<
std
::
wstring
,
Rels
::
CRelationShip
*>::
iterator
pFind
=
m_mapRelations
.
find
(
rId
.
get
());
if
(
pFind
!=
m_mapRelations
.
end
(
))
{
(
*
ppRelationShip
)
=
new
Rels
::
CRelationShip
(
*
m_arrRelations
[
i
]);
}
(
*
ppRelationShip
)
=
pFind
->
second
;
}
}
...
...
@@ -319,11 +324,9 @@ namespace OOX
return
pathTemp
.
GetPath
();
}
public:
std
::
vector
<
Rels
::
CRelationShip
*>
m_arr
Relations
;
std
::
map
<
std
::
wstring
,
Rels
::
CRelationShip
*>
m_map
Relations
;
};
}
// 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