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
62e0c06c
Commit
62e0c06c
authored
Apr 28, 2016
by
konovalovsergey
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
падения при открытии docx, xlsx.
parent
2f515afe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
34 deletions
+42
-34
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+20
-24
ASCOfficeDocxFile2/DocWrapper/FontProcessor.cpp
ASCOfficeDocxFile2/DocWrapper/FontProcessor.cpp
+10
-10
Common/DocxFormat/Source/DocxFormat/Logic/ParagraphProperty.h
...on/DocxFormat/Source/DocxFormat/Logic/ParagraphProperty.h
+12
-0
No files found.
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
62e0c06c
...
@@ -4978,36 +4978,32 @@ namespace BinDocxRW
...
@@ -4978,36 +4978,32 @@ namespace BinDocxRW
OOX
::
Logic
::
CObject
*
pObject
=
static_cast
<
OOX
::
Logic
::
CObject
*>
(
item
);
OOX
::
Logic
::
CObject
*
pObject
=
static_cast
<
OOX
::
Logic
::
CObject
*>
(
item
);
CString
*
pXml
=
pObject
?
pObject
->
m_sXml
.
GetPointer
()
:
NULL
;
CString
*
pXml
=
pObject
?
pObject
->
m_sXml
.
GetPointer
()
:
NULL
;
CString
sProgID
;
if
((
pObject
)
&&
(
pObject
->
m_oOleObject
.
IsInit
()))
sProgID
=
pObject
->
m_oOleObject
->
m_sProgId
.
get
().
GetString
();
int
nPosObject
=
m_oBcw
.
WriteItemStart
(
c_oSerRunType
::
object
);
int
nPosObject
=
m_oBcw
.
WriteItemStart
(
c_oSerRunType
::
object
);
if
(
_T
(
"Word.Document"
)
==
sProgID
)
if
(
pObject
&&
pObject
->
m_oOleObject
.
IsInit
()
&&
pObject
->
m_oOleObject
->
m_sProgId
.
IsInit
()
&&
pObject
->
m_oOleObject
->
m_oId
.
IsInit
()
)
{
{
int
nPosEmbedded
=
m_oBcw
.
WriteItemStart
(
c_oSerImageType2
::
Embedded
);
CString
sProgID
=
pObject
->
m_oOleObject
->
m_sProgId
.
get
().
GetString
();
if
(
_T
(
"Word.Document"
)
==
sProgID
)
{
int
nPosEmbedded
=
m_oBcw
.
WriteItemStart
(
c_oSerImageType2
::
Embedded
);
OOX
::
Rels
::
CRelationShip
*
oRels
=
NULL
;
OOX
::
Rels
::
CRelationShip
*
oRels
=
NULL
;
smart_ptr
<
OOX
::
File
>
pFile
=
m_oParamsDocumentWriter
.
m_pRels
->
Find
(
OOX
::
RId
(
pObject
->
m_oOleObject
->
m_oId
.
get
().
GetValue
()));
smart_ptr
<
OOX
::
File
>
pFile
=
m_oParamsDocumentWriter
.
m_pRels
->
Find
(
OOX
::
RId
(
pObject
->
m_oOleObject
->
m_oId
.
get
().
GetValue
()));
CString
sLink
;
CString
sLink
;
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
OleObject
==
pFile
->
type
())
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
OleObject
==
pFile
->
type
())
{
{
OOX
::
HyperLink
*
pHyperlinkFile
=
static_cast
<
OOX
::
HyperLink
*>
(
pFile
.
operator
->
());
OOX
::
HyperLink
*
pHyperlinkFile
=
static_cast
<
OOX
::
HyperLink
*>
(
pFile
.
operator
->
());
sLink
=
pHyperlinkFile
->
Uri
().
GetPath
();
sLink
=
pHyperlinkFile
->
Uri
().
GetPath
();
}
OOX
::
CPath
path
(
sLink
);
OOX
::
CDocument
poDocumentEmbedded
(
path
,
path
);
WriteDocumentContent
(
poDocumentEmbedded
.
m_arrItems
);
m_oBcw
.
WriteItemEnd
(
nPosEmbedded
);
}
}
OOX
::
CPath
path
(
sLink
);
else
if
(
_T
(
"Equation.3"
)
==
sProgID
)
OOX
::
CDocument
poDocumentEmbedded
(
path
,
path
);
WriteDocumentContent
(
poDocumentEmbedded
.
m_arrItems
);
m_oBcw
.
WriteItemEnd
(
nPosEmbedded
);
}
else
{
//write equation
if
(
_T
(
"Equation.3"
)
==
sProgID
)
{
{
//write equation
OOX
::
Rels
::
CRelationShip
*
oRels
=
NULL
;
OOX
::
Rels
::
CRelationShip
*
oRels
=
NULL
;
smart_ptr
<
OOX
::
File
>
pFile
=
m_oParamsDocumentWriter
.
m_pRels
->
Find
(
OOX
::
RId
(
pObject
->
m_oOleObject
->
m_oId
.
get
().
GetValue
()));
smart_ptr
<
OOX
::
File
>
pFile
=
m_oParamsDocumentWriter
.
m_pRels
->
Find
(
OOX
::
RId
(
pObject
->
m_oOleObject
->
m_oId
.
get
().
GetValue
()));
...
@@ -5021,7 +5017,7 @@ namespace BinDocxRW
...
@@ -5021,7 +5017,7 @@ namespace BinDocxRW
MathEquation
::
CEquationReader
oReader
(
sLink
);
MathEquation
::
CEquationReader
oReader
(
sLink
);
oReader
.
SetOutputDev
(
&
oBinEqWriter
);
oReader
.
SetOutputDev
(
&
oBinEqWriter
);
oReader
.
Parse
();
oReader
.
Parse
();
}
}
}
}
//write Picture
//write Picture
...
...
ASCOfficeDocxFile2/DocWrapper/FontProcessor.cpp
View file @
62e0c06c
//#include "stdafx.h"
//#include "stdafx.h"
#include "FontProcessor.h"
#include "FontProcessor.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
...
@@ -26,7 +26,7 @@ namespace DocWrapper {
...
@@ -26,7 +26,7 @@ namespace DocWrapper {
}
}
void
FontProcessor
::
setFontTable
(
OOX
::
CFontTable
*
fontTable
)
void
FontProcessor
::
setFontTable
(
OOX
::
CFontTable
*
fontTable
)
{
{
//
js
//
подбор перенесен в
js
return
;
return
;
for
(
int
i
=
0
;
i
<
fontTable
->
m_arrFonts
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
fontTable
->
m_arrFonts
.
size
();
++
i
)
addToFontMap
(
*
fontTable
->
m_arrFonts
[
i
]);
addToFontMap
(
*
fontTable
->
m_arrFonts
[
i
]);
...
@@ -34,7 +34,7 @@ namespace DocWrapper {
...
@@ -34,7 +34,7 @@ namespace DocWrapper {
CString
FontProcessor
::
getFont
(
const
CString
&
name
)
CString
FontProcessor
::
getFont
(
const
CString
&
name
)
{
{
//
js
//
подбор перенесен в
js
return
name
;
return
name
;
CString
fontName
=
gc_sDefaultFontName
;
CString
fontName
=
gc_sDefaultFontName
;
if
(
fontMap
.
find
(
name
)
!=
fontMap
.
end
())
if
(
fontMap
.
find
(
name
)
!=
fontMap
.
end
())
...
@@ -54,9 +54,9 @@ namespace DocWrapper {
...
@@ -54,9 +54,9 @@ namespace DocWrapper {
{
{
CFontSelectFormat
oFontSelectFormat
;
CFontSelectFormat
oFontSelectFormat
;
CString
sFontName
;
CString
sFontName
;
if
(
oScheme
.
IsInit
()
&&
oScheme
->
m_oFontScheme
.
IsInit
())
if
(
NULL
!=
pTheme
&&
oScheme
.
IsInit
()
&&
oScheme
->
m_oFontScheme
.
IsInit
())
{
{
//
//
берем шрифт из темы
const
SimpleTypes
::
Spreadsheet
::
EFontScheme
eFontScheme
=
oScheme
->
m_oFontScheme
->
GetValue
();
const
SimpleTypes
::
Spreadsheet
::
EFontScheme
eFontScheme
=
oScheme
->
m_oFontScheme
->
GetValue
();
if
(
SimpleTypes
::
Spreadsheet
::
fontschemeMajor
==
eFontScheme
)
if
(
SimpleTypes
::
Spreadsheet
::
fontschemeMajor
==
eFontScheme
)
sFontName
=
pTheme
->
GetMajorFont
();
sFontName
=
pTheme
->
GetMajorFont
();
...
@@ -67,14 +67,14 @@ namespace DocWrapper {
...
@@ -67,14 +67,14 @@ namespace DocWrapper {
sFontName
=
oRFont
->
ToString2
();
sFontName
=
oRFont
->
ToString2
();
if
(
sFontName
.
IsEmpty
())
if
(
sFontName
.
IsEmpty
())
sFontName
=
CString
(
gc_sNoNameFont
);
sFontName
=
CString
(
gc_sNoNameFont
);
//
js
//
подбор перенесен в
js
return
sFontName
;
return
sFontName
;
oFontSelectFormat
.
wsName
=
new
std
::
wstring
;
oFontSelectFormat
.
wsName
=
new
std
::
wstring
;
*
oFontSelectFormat
.
wsName
=
string2std_string
(
sFontName
);
*
oFontSelectFormat
.
wsName
=
string2std_string
(
sFontName
);
if
(
oCharset
.
IsInit
()
&&
oCharset
->
m_oCharset
.
IsInit
())
if
(
oCharset
.
IsInit
()
&&
oCharset
->
m_oCharset
.
IsInit
())
{
{
SimpleTypes
::
Spreadsheet
::
EFontCharset
eCharset
=
oCharset
->
m_oCharset
->
GetValue
();
SimpleTypes
::
Spreadsheet
::
EFontCharset
eCharset
=
oCharset
->
m_oCharset
->
GetValue
();
//
fontcharsetANSI fontcharsetDefault, , dll
//
на серверве на берем в расчет fontcharsetANSI и fontcharsetDefault, потому что он зависит от локали, а dll работает на сервере
if
(
SimpleTypes
::
fontcharsetANSI
!=
eCharset
&&
SimpleTypes
::
fontcharsetDefault
!=
eCharset
)
if
(
SimpleTypes
::
fontcharsetANSI
!=
eCharset
&&
SimpleTypes
::
fontcharsetDefault
!=
eCharset
)
{
{
oFontSelectFormat
.
unCharset
=
new
BYTE
;
oFontSelectFormat
.
unCharset
=
new
BYTE
;
...
@@ -114,7 +114,7 @@ namespace DocWrapper {
...
@@ -114,7 +114,7 @@ namespace DocWrapper {
if
(
font
.
m_oCharset
.
IsInit
())
if
(
font
.
m_oCharset
.
IsInit
())
{
{
SimpleTypes
::
EFontCharset
eCharset
=
font
.
m_oCharset
->
GetValue
();
SimpleTypes
::
EFontCharset
eCharset
=
font
.
m_oCharset
->
GetValue
();
//
fontcharsetANSI fontcharsetDefault, , dll
//
на серверве на берем в расчет fontcharsetANSI и fontcharsetDefault, потому что он зависит от локали, а dll работает на сервере
if
(
SimpleTypes
::
fontcharsetANSI
!=
eCharset
&&
SimpleTypes
::
fontcharsetDefault
!=
eCharset
)
if
(
SimpleTypes
::
fontcharsetANSI
!=
eCharset
&&
SimpleTypes
::
fontcharsetDefault
!=
eCharset
)
{
{
oFontSelectFormat
.
unCharset
=
new
BYTE
;
oFontSelectFormat
.
unCharset
=
new
BYTE
;
...
@@ -134,7 +134,7 @@ namespace DocWrapper {
...
@@ -134,7 +134,7 @@ namespace DocWrapper {
{
{
unsigned
char
cCurVal
=
font
.
m_oPanose
->
Get_Number
(
i
);
unsigned
char
cCurVal
=
font
.
m_oPanose
->
Get_Number
(
i
);
oFontSelectFormat
.
pPanose
[
i
]
=
cCurVal
;
oFontSelectFormat
.
pPanose
[
i
]
=
cCurVal
;
//
0,
Panose
//
Если хоть одно значение не 0, то используем
Panose
if
(
0
!=
cCurVal
)
if
(
0
!=
cCurVal
)
bIsPanose
=
true
;
bIsPanose
=
true
;
}
}
...
@@ -189,4 +189,4 @@ namespace DocWrapper {
...
@@ -189,4 +189,4 @@ namespace DocWrapper {
else
else
fontMap
[
sFontName
]
=
gc_sDefaultFontName
;
fontMap
[
sFontName
]
=
gc_sDefaultFontName
;
}
}
}
}
\ No newline at end of file
Common/DocxFormat/Source/DocxFormat/Logic/ParagraphProperty.h
View file @
62e0c06c
...
@@ -998,6 +998,18 @@ namespace OOX
...
@@ -998,6 +998,18 @@ namespace OOX
}
}
m_arrTabs
.
clear
();
m_arrTabs
.
clear
();
}
}
CTabs
(
const
CTabs
&
oSrc
)
{
*
this
=
oSrc
;
}
const
CTabs
&
operator
=
(
const
CTabs
&
oTabs
)
{
for
(
size_t
i
=
0
;
i
<
oTabs
.
m_arrTabs
.
size
();
++
i
)
{
m_arrTabs
.
push_back
(
new
ComplexTypes
::
Word
::
CTabStop
(
*
oTabs
.
m_arrTabs
[
i
]));
}
return
*
this
;
}
public:
public:
virtual
void
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
virtual
void
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
...
...
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