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
3e44b5d8
Commit
3e44b5d8
authored
Jul 13, 2016
by
alexey.musinov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://github.com/ONLYOFFICE/core
into develop
parents
a2016d3f
511a9d02
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
554 additions
and
375 deletions
+554
-375
ASCOfficeDocFile/Common/SPRMCodes.h
ASCOfficeDocFile/Common/SPRMCodes.h
+1
-0
ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp
...ceDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp
+4
-0
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
+1
-0
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.cpp
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.cpp
+25
-4
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.h
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.h
+24
-15
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h
...DocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h
+6
-0
ASCOfficeDocFile/DocDocxConverter/PictureDescriptor.cpp
ASCOfficeDocFile/DocDocxConverter/PictureDescriptor.cpp
+93
-83
ASCOfficeDocFile/DocDocxConverter/PictureDescriptor.h
ASCOfficeDocFile/DocDocxConverter/PictureDescriptor.h
+1
-0
ASCOfficeDocFile/DocDocxConverter/PropertyExceptions.cpp
ASCOfficeDocFile/DocDocxConverter/PropertyExceptions.cpp
+5
-2
ASCOfficeDocFile/DocDocxConverter/SinglePropertyModifier.cpp
ASCOfficeDocFile/DocDocxConverter/SinglePropertyModifier.cpp
+11
-2
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
+2
-1
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
+112
-72
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
+157
-153
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
+4
-9
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
+1
-0
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
+104
-31
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
+1
-1
X2tConverter/build/Qt/X2tConverter.pro
X2tConverter/build/Qt/X2tConverter.pro
+1
-1
No files found.
ASCOfficeDocFile/Common/SPRMCodes.h
View file @
3e44b5d8
...
...
@@ -98,6 +98,7 @@ namespace DocFileFormat
sprmOldCChse
=
73
,
sprmOldCSymbol
=
74
,
sprmOldCFOle2
=
75
,
sprmCOldHighlight
=
77
,
sprmOldCIstd
=
80
,
sprmOldCIstdPermute
=
81
,
sprmOldCDefault
=
82
,
...
...
ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp
View file @
3e44b5d8
...
...
@@ -301,6 +301,10 @@ namespace DocFileFormat
colorVal
->
SetValue
(
rgbColor
.
GetString
()
);
}
break
;
case
sprmCOldHighlight
:
{
appendValueElement
(
parent
,
_T
(
"highlight"
),
FormatUtils
::
MapValueToWideString
(
iter
->
Arguments
[
1
],
&
Global
::
ColorIdentifier
[
0
][
0
],
17
,
12
).
c_str
(),
true
);
}
break
;
case
sprmCHighlight
:
{
appendValueElement
(
parent
,
_T
(
"highlight"
),
FormatUtils
::
MapValueToWideString
(
iter
->
Arguments
[
0
],
&
Global
::
ColorIdentifier
[
0
][
0
],
17
,
12
).
c_str
(),
true
);
...
...
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
View file @
3e44b5d8
...
...
@@ -70,6 +70,7 @@ namespace OpenXmlContentTypes
static
const
TCHAR
*
Png
=
_T
(
"image/png"
);
static
const
TCHAR
*
Tiff
=
_T
(
"image/tiff"
);
static
const
TCHAR
*
Wmf
=
_T
(
"image/x-wmf"
);
static
const
TCHAR
*
Bmp
=
_T
(
"image/bmp"
);
}
namespace
WordprocessingMLContentTypes
...
...
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
View file @
3e44b5d8
...
...
@@ -268,7 +268,7 @@ namespace DocFileFormat
std
::
vector
<
int
>
bookmarks
=
searchBookmarks
(
chpxChars
,
cp
);
//if there are bookmarks in this run, split the run into several runs
if
(
bookmarks
.
size
())
if
(
!
bookmarks
.
empty
())
{
std
::
list
<
std
::
vector
<
wchar_t
>>*
runs
=
splitCharList
(
chpxChars
,
&
bookmarks
);
if
(
runs
)
...
...
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.cpp
View file @
3e44b5d8
...
...
@@ -103,8 +103,8 @@ namespace DocFileFormat
void
DrawingPrimitive
::
read_fill
(
VirtualStreamReader
*
reader
)
{
fillFore
=
read_color
(
reader
);
fillBack
=
read_color
(
reader
);
fillFore
=
read_color
(
reader
);
fillPattern
=
reader
->
ReadInt16
();
}
void
DrawingPrimitive
::
read_shadow
(
VirtualStreamReader
*
reader
)
...
...
@@ -225,13 +225,34 @@ namespace DocFileFormat
}
DrawingPrimitiveTextBox
::
DrawingPrimitiveTextBox
(
VirtualStreamReader
*
reader
,
int
length
)
:
DrawingPrimitiveRect
(
reader
,
length
)
{
strVmlType
=
L"v:rect"
;
//strVmlType = L"v:shape";
}
DrawingPrimitiveCTextBox
::
DrawingPrimitiveCTextBox
(
VirtualStreamReader
*
reader
,
int
length
)
:
DrawingPrimitive
(
reader
,
length
)
{
strVmlType
=
L"v:shape"
;
strVmlType
=
L"v:rect"
;
txbx
=
NULL
;
polyline
=
NULL
;
unsigned
short
f
=
reader
->
ReadUInt16
();
dzaOffset
=
reader
->
ReadUInt16
();
dzaDescent
=
reader
->
ReadUInt16
();
dzaLength
=
reader
->
ReadUInt16
();
unsigned
short
dpk_txbx
=
reader
->
ReadUInt16
();
unsigned
short
cb_txbx
=
reader
->
ReadUInt16
();
txbx
=
new
DrawingPrimitiveTextBox
(
reader
,
cb_txbx
);
unsigned
short
dpk_polyline
=
reader
->
ReadUInt16
();
unsigned
short
cb_polyline
=
reader
->
ReadUInt16
();
polyline
=
new
DrawingPrimitivePolyline
(
reader
,
cb_polyline
);
}
DrawingPrimitiveCTextBox
::~
DrawingPrimitiveCTextBox
()
{
}
DrawingPrimitivePolyline
::
DrawingPrimitivePolyline
(
VirtualStreamReader
*
reader
,
int
length
)
:
DrawingPrimitiveLine
(
reader
,
length
,
false
)
...
...
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.h
View file @
3e44b5d8
...
...
@@ -121,21 +121,6 @@ namespace DocFileFormat
};
class
DrawingPrimitiveCTextBox
:
public
DrawingPrimitive
{
public:
DrawingPrimitiveCTextBox
(
VirtualStreamReader
*
reader
,
int
length
);
};
class
DrawingPrimitiveArc
:
public
DrawingPrimitive
{
public:
DrawingPrimitiveArc
(
VirtualStreamReader
*
reader
,
int
length
);
bool
fLeft
;
bool
fUp
;
};
class
DrawingPrimitiveElipse
:
public
DrawingPrimitive
{
public:
...
...
@@ -153,6 +138,30 @@ namespace DocFileFormat
std
::
vector
<
std
::
pair
<
short
,
short
>>
arPoints
;
};
class
DrawingPrimitiveCTextBox
:
public
DrawingPrimitive
{
public:
DrawingPrimitiveCTextBox
(
VirtualStreamReader
*
reader
,
int
length
);
virtual
~
DrawingPrimitiveCTextBox
();
unsigned
short
dzaOffset
;
unsigned
short
dzaDescent
;
unsigned
short
dzaLength
;
DrawingPrimitiveTextBox
*
txbx
;
DrawingPrimitivePolyline
*
polyline
;
};
class
DrawingPrimitiveArc
:
public
DrawingPrimitive
{
public:
DrawingPrimitiveArc
(
VirtualStreamReader
*
reader
,
int
length
);
bool
fLeft
;
bool
fUp
;
};
//-------------------------------------------------------------------------------------
class
DrawingPrimitives
:
public
IVisitable
,
public
std
::
vector
<
DrawingPrimitive
*>
{
...
...
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h
View file @
3e44b5d8
...
...
@@ -70,6 +70,12 @@ public:
public:
CMetaHeader
()
{
cbSize
=
cbSave
=
0
;
filter
=
compression
=
0
;
ptSize
.
x
=
ptSize
.
y
=
0
;
rcBounds
.
bottom
=
rcBounds
.
left
=
rcBounds
.
right
=
rcBounds
.
top
=
0
;
}
...
...
ASCOfficeDocFile/DocDocxConverter/PictureDescriptor.cpp
View file @
3e44b5d8
...
...
@@ -48,7 +48,7 @@ namespace DocFileFormat
:
dxaGoal
(
0
),
dyaGoal
(
0
),
mx
(
0
),
my
(
0
),
Type
(
jpg
),
mfp
(),
dxaCropLeft
(
0
),
dyaCropTop
(
0
),
dxaCropRight
(
0
),
dyaCropBottom
(
0
),
brcTop
(
NULL
),
brcLeft
(
NULL
),
brcBottom
(
NULL
),
brcRight
(
NULL
),
dxaOrigin
(
0
),
dyaOrigin
(
0
),
cProps
(
0
),
shapeContainer
(
NULL
),
blipStoreEntry
(
NULL
),
embeddedData
(
NULL
),
embeddedDataSize
(
0
)
cProps
(
0
),
shapeContainer
(
NULL
),
blipStoreEntry
(
NULL
),
embeddedData
(
NULL
),
embeddedDataSize
(
0
)
,
embeddedDataHeader
(
NULL
)
{
//Get start and length of the PICT
int
fc
=
GetFcPic
(
chpx
);
...
...
@@ -62,7 +62,7 @@ namespace DocFileFormat
:
dxaGoal
(
0
),
dyaGoal
(
0
),
mx
(
0
),
my
(
0
),
Type
(
jpg
),
mfp
(),
dxaCropLeft
(
0
),
dyaCropTop
(
0
),
dxaCropRight
(
0
),
dyaCropBottom
(
0
),
brcTop
(
NULL
),
brcLeft
(
NULL
),
brcBottom
(
NULL
),
brcRight
(
NULL
),
dxaOrigin
(
0
),
dyaOrigin
(
0
),
cProps
(
0
),
shapeContainer
(
NULL
),
blipStoreEntry
(
NULL
),
embeddedData
(
NULL
),
embeddedDataSize
(
0
)
cProps
(
0
),
shapeContainer
(
NULL
),
blipStoreEntry
(
NULL
),
embeddedData
(
NULL
),
embeddedDataSize
(
0
)
,
embeddedDataHeader
(
NULL
)
{
}
PictureDescriptor
::~
PictureDescriptor
()
...
...
@@ -80,6 +80,7 @@ namespace DocFileFormat
RELEASEOBJECT
(
blipStoreEntry
);
RELEASEARRAYOBJECTS
(
embeddedData
);
RELEASEARRAYOBJECTS
(
embeddedDataHeader
);
}
void
PictureDescriptor
::
parse
(
POLE
::
Stream
*
stream
,
int
fc
,
int
sz
,
bool
oldVersion
)
{
...
...
@@ -91,6 +92,8 @@ namespace DocFileFormat
int
lcb
=
reader
.
ReadInt32
();
int
pos_start
=
reader
.
GetPosition
();
if
(
lcb
>
10000000
)
return
;
...
...
@@ -104,104 +107,111 @@ namespace DocFileFormat
return
;
}
if
(
lcb
>=
10
)
{
int
cbHeader
=
reader
.
ReadUInt16
();
if
(
lcb
<
10
)
return
;
int
cbHeader
=
reader
.
ReadUInt16
();
mfp
.
mm
=
reader
.
ReadInt16
();
mfp
.
xExt
=
reader
.
ReadInt16
();
mfp
.
yExt
=
reader
.
ReadInt16
();
mfp
.
hMf
=
reader
.
ReadInt16
();
mfp
.
mm
=
reader
.
ReadInt16
();
mfp
.
xExt
=
reader
.
ReadInt16
();
mfp
.
yExt
=
reader
.
ReadInt16
();
mfp
.
hMf
=
reader
.
ReadInt16
();
if
(
mfp
.
mm
==
MM_ISOTROPIC
||
mfp
.
mm
==
MM_ANISOTROPIC
)
{
Type
=
wmf
;
unsigned
char
*
bytes
=
reader
.
ReadBytes
(
14
,
true
);
rcWinMf
=
std
::
vector
<
unsigned
char
>
(
bytes
,
(
bytes
+
14
));
RELEASEARRAYOBJECTS
(
bytes
)
;
mx
=
my
=
200
;
dxaGoal
=
mfp
.
xExt
;
dyaGoal
=
mfp
.
yExt
;
//dimensions
dxaGoal
=
reader
.
ReadInt16
();
dyaGoal
=
reader
.
ReadInt16
();
mx
=
reader
.
ReadUInt16
();
my
=
reader
.
ReadUInt16
();
embeddedDataSize
=
lcb
-
20
;
//reader.GetSize() - reader.GetPosition(); //lcb ?
embeddedData
=
reader
.
ReadBytes
(
embeddedDataSize
,
true
);
//cropping
dxaCropLeft
=
reader
.
ReadInt16
();
dyaCropTop
=
reader
.
ReadInt16
();
dxaCropRight
=
reader
.
ReadInt16
();
dyaCropBottom
=
reader
.
ReadInt16
();
WmfPlaceableFileHeader
*
header
=
(
WmfPlaceableFileHeader
*
)
embeddedData
;
int
brcl
=
reader
.
ReadInt16
()
;
if
(
header
)
{
}
}
else
if
(
mfp
.
mm
>=
98
)
{
unsigned
char
*
bytes
=
reader
.
ReadBytes
(
14
,
true
);
rcWinMf
=
std
::
vector
<
unsigned
char
>
(
bytes
,
(
bytes
+
14
));
RELEASEARRAYOBJECTS
(
bytes
);
//dimensions
dxaGoal
=
reader
.
ReadInt16
();
dyaGoal
=
reader
.
ReadInt16
();
mx
=
reader
.
ReadUInt16
();
my
=
reader
.
ReadUInt16
();
//cropping
dxaCropLeft
=
reader
.
ReadInt16
();
dyaCropTop
=
reader
.
ReadInt16
();
dxaCropRight
=
reader
.
ReadInt16
();
dyaCropBottom
=
reader
.
ReadInt16
();
short
brcl
=
reader
.
ReadInt16
();
// borders
int
bytesCount
=
4
;
bytes
=
reader
.
ReadBytes
(
bytesCount
,
true
);
brcTop
=
new
BorderCode
(
bytes
,
bytesCount
);
RELEASEARRAYOBJECTS
(
bytes
);
// borders
int
bytesCount
=
oldVersion
?
2
:
4
;
bytes
=
reader
.
ReadBytes
(
bytesCount
,
true
);
brcTop
=
new
BorderCode
(
bytes
,
bytesCount
);
RELEASEARRAYOBJECTS
(
bytes
);
bytes
=
reader
.
ReadBytes
(
bytesCount
,
true
);
brcLeft
=
new
BorderCode
(
bytes
,
4
);
RELEASEARRAYOBJECTS
(
bytes
);
bytes
=
reader
.
ReadBytes
(
bytesCount
,
true
);
brcLeft
=
new
BorderCode
(
bytes
,
bytesCount
);
RELEASEARRAYOBJECTS
(
bytes
);
bytes
=
reader
.
ReadBytes
(
bytesCount
,
true
);
brcBottom
=
new
BorderCode
(
bytes
,
4
);
RELEASEARRAYOBJECTS
(
bytes
);
bytes
=
reader
.
ReadBytes
(
bytesCount
,
true
);
brcBottom
=
new
BorderCode
(
bytes
,
bytesCount
);
RELEASEARRAYOBJECTS
(
bytes
);
bytes
=
reader
.
ReadBytes
(
bytesCount
,
true
);
brcRight
=
new
BorderCode
(
bytes
,
4
);
RELEASEARRAYOBJECTS
(
bytes
);
bytes
=
reader
.
ReadBytes
(
bytesCount
,
true
);
brcRight
=
new
BorderCode
(
bytes
,
bytesCount
);
RELEASEARRAYOBJECTS
(
bytes
);
dxaOrigin
=
reader
.
ReadInt16
();
dyaOrigin
=
reader
.
ReadInt16
();
cProps
=
reader
.
ReadInt16
();
dxaOrigin
=
reader
.
ReadInt16
();
dyaOrigin
=
reader
.
ReadInt16
();
if
(
mfp
.
mm
==
MM_SHAPEFILE
)
int
pos_end
=
reader
.
GetPosition
();
if
(
oldVersion
)
{
int
flag
=
brcl
;
brcl
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x000F
);
//( 0 single 1 thick 2 double 3 shadow )
bool
fFrameEmpty
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x0010
);
// picture consists of a single frame
bool
fBitmap
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x0020
);
// ==1, when picture is just a bitmap
bool
fDrawHatch
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x0040
);
// ==1, when picture is an active OLE object
bool
fError
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x0080
);
// ==1, when picture is just an error message
short
bpp
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x8000
);
// bits per pixel
//(0 unknown 1 monochrome 4 VGA)
int
sz_hdr
=
pos_end
-
pos_start
;
int
header_size
=
114
;
embeddedDataSize
=
lcb
-
sz_hdr
-
header_size
;
embeddedDataHeader
=
reader
.
ReadBytes
(
header_size
,
true
);
embeddedData
=
reader
.
ReadBytes
(
embeddedDataSize
,
true
);
}
else
{
cProps
=
reader
.
ReadInt16
();
if
(
mfp
.
mm
==
MM_SHAPEFILE
)
{
unsigned
char
cchPicName
=
reader
.
ReadByte
();
unsigned
char
*
stPicName
=
reader
.
ReadBytes
(
cchPicName
,
true
);
if
(
stPicName
!=
NULL
)
{
unsigned
char
cchPicName
=
reader
.
ReadByte
();
unsigned
char
*
stPicName
=
reader
.
ReadBytes
(
cchPicName
,
true
);
if
(
stPicName
!=
NULL
)
{
std
::
wstring
picName
;
FormatUtils
::
GetSTLCollectionFromBytes
<
std
::
wstring
>
(
&
picName
,
stPicName
,
cchPicName
,
ENCODING_WINDOWS_1250
);
RELEASEARRAYOBJECTS
(
stPicName
);
}
std
::
wstring
picName
;
FormatUtils
::
GetSTLCollectionFromBytes
<
std
::
wstring
>
(
&
picName
,
stPicName
,
cchPicName
,
ENCODING_WINDOWS_1250
);
RELEASEARRAYOBJECTS
(
stPicName
);
}
}
shapeContainer
=
dynamic_cast
<
ShapeContainer
*>
(
RecordFactory
::
ReadRecord
(
&
reader
,
0
));
shapeContainer
=
dynamic_cast
<
ShapeContainer
*>
(
RecordFactory
::
ReadRecord
(
&
reader
,
0
)
);
long
pos
=
reader
.
GetPosition
(
);
long
pos
=
reader
.
GetPosition
();
if
(
pos
<
(
fc
+
lcb
))
{
Record
*
rec
=
RecordFactory
::
ReadRecord
(
&
reader
,
0
);
if
(
pos
<
(
fc
+
lcb
))
if
((
rec
)
&&
(
typeid
(
*
rec
)
==
typeid
(
BlipStoreEntry
)
))
{
blipStoreEntry
=
dynamic_cast
<
BlipStoreEntry
*>
(
rec
);
}
else
{
Record
*
rec
=
RecordFactory
::
ReadRecord
(
&
reader
,
0
);
if
((
rec
)
&&
(
typeid
(
*
rec
)
==
typeid
(
BlipStoreEntry
)
))
{
blipStoreEntry
=
dynamic_cast
<
BlipStoreEntry
*>
(
rec
);
}
else
{
RELEASEOBJECT
(
rec
);
}
RELEASEOBJECT
(
rec
);
}
}
}
...
...
ASCOfficeDocFile/DocDocxConverter/PictureDescriptor.h
View file @
3e44b5d8
...
...
@@ -129,6 +129,7 @@ namespace DocFileFormat
ShapeContainer
*
shapeContainer
;
BlipStoreEntry
*
blipStoreEntry
;
unsigned
char
*
embeddedDataHeader
;
unsigned
char
*
embeddedData
;
int
embeddedDataSize
;
};
...
...
ASCOfficeDocFile/DocDocxConverter/PropertyExceptions.cpp
View file @
3e44b5d8
...
...
@@ -71,6 +71,11 @@ namespace DocFileFormat
unsigned
short
code
=
oldVersion
?
FormatUtils
::
BytesToUChar
(
bytes
,
sprmStart
,
size
)
:
FormatUtils
::
BytesToUInt16
(
bytes
,
sprmStart
,
size
)
;
if
(
oldVersion
&&
code
==
0
)
{
sprmStart
++
;
continue
;
}
OperationCode
opCode
=
(
OperationCode
)
code
;
short
opSize
=
-
1
;
...
...
@@ -137,7 +142,6 @@ namespace DocFileFormat
}
}
//copy sprm to array
//length is 2byte for the opCode, lenByte for the length, opSize for the length of the operand
int
sprmBytesSize
=
opCodeSize
+
lenByte
+
opSize
;
unsigned
char
*
sprmBytes
=
NULL
;
...
...
@@ -148,7 +152,6 @@ namespace DocFileFormat
{
memcpy
(
sprmBytes
,
(
bytes
+
sprmStart
),
sprmBytesSize
);
//parse
SinglePropertyModifier
sprm
(
sprmBytes
,
sprmBytesSize
,
oldVersion
);
grpprl
->
push_back
(
sprm
);
...
...
ASCOfficeDocFile/DocDocxConverter/SinglePropertyModifier.cpp
View file @
3e44b5d8
...
...
@@ -51,7 +51,14 @@ namespace DocFileFormat
opCodeSize
=
1
;
//first 1 byte are the operation code ...
OpCode
=
(
OperationCode
)
FormatUtils
::
BytesToUChar
(
bytes
,
0
,
size
);
opSize
=
GetOldOperandSize
(
(
unsigned
char
)
OpCode
);
if
(
OpCode
==
0
&&
size
==
4
)
{
//так записывается rgb цвет (
OpCode
=
sprmCCv
;
opSize
=
3
;
}
else
opSize
=
GetOldOperandSize
(
(
unsigned
char
)
OpCode
);
}
else
{
...
...
@@ -208,7 +215,9 @@ namespace DocFileFormat
}
static
const
unsigned
char
OldOperandSizeTable
[]
=
{
0
,
0
,
2
,
255
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
255
,
1
,
1
,
255
,
2
,
2
,
2
,
2
,
4
,
2
,
2
,
255
,
1
,
1
,
2
,
2
,
2
,
1
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
1
,
2
,
2
,
2
,
2
,
2
,
2
,
1
,
2
,
2
,
2
,
2
,
2
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
255
,
2
,
4
,
1
,
2
,
3
,
255
,
1
,
0
,
0
,
0
,
0
,
2
,
255
,
255
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
3
,
2
,
2
,
1
,
1
,
1
,
1
,
1
,
255
,
1
,
255
,
255
,
2
,
255
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
255
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
255
,
0
,
0
,
3
,
3
,
1
,
1
,
2
,
2
,
1
,
1
,
2
,
2
,
1
,
1
,
2
,
2
,
1
,
1
,
1
,
1
,
2
,
2
,
2
,
2
,
1
,
1
,
2
,
2
,
1
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
2
,
2
,
2
,
1
,
1
,
12
,
255
,
2
,
255
,
255
,
4
,
5
,
4
,
2
,
4
,
2
,
2
,
5
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
// 0,0,2,255,1,1,1,1,1,1,1,1,255,1,1,255,2,2,2,2,4,2,2,255,1,1,2,2,2,1,2,2,2,2,2,2,2,1,2,2,2,2,2,2,1,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,255,2,4,1,2,3,255,1,0,0,0,0,2,255,255,0,0,1,1,1,1,1,1,1,1,2,1,3,2,2,1,1,1,1,1,255,1,255,255,2,255,2,2,0,0,0,0,0,0,1,1,1,255,2,2,2,2,0,0,0,0,0,0,1,1,255,0,0,3,3,1,1,2,2,1,1,2,2,1,1,2,2,1,1,1,1,2,2,2,2,1,1,2,2,1,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,12,255,2,255,255,4,5,4,2,4,2,2,5,4,0,0,0,0,0,0,0,0
0
,
0
,
2
,
255
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
255
,
1
,
1
,
255
,
2
,
2
,
2
,
2
,
4
,
2
,
2
,
255
,
1
,
1
,
2
,
2
,
2
,
1
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
1
,
2
,
2
,
2
,
2
,
2
,
2
,
1
,
2
,
2
,
2
,
2
,
2
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
255
,
2
,
4
,
1
,
2
,
3
,
255
,
1
,
0
,
2
,
0
,
0
,
2
,
255
,
255
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
2
,
1
,
3
,
2
,
2
,
1
,
1
,
1
,
1
,
1
,
255
,
1
,
255
,
255
,
2
,
255
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
255
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
255
,
0
,
0
,
3
,
3
,
1
,
1
,
2
,
2
,
1
,
1
,
2
,
2
,
1
,
1
,
2
,
2
,
1
,
1
,
1
,
1
,
2
,
2
,
2
,
2
,
1
,
1
,
2
,
2
,
1
,
0
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
2
,
2
,
2
,
1
,
1
,
12
,
255
,
2
,
255
,
255
,
4
,
5
,
4
,
2
,
4
,
2
,
2
,
5
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
unsigned
char
SinglePropertyModifier
::
GetOldOperandSize
(
unsigned
char
code
)
...
...
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
View file @
3e44b5d8
...
...
@@ -130,7 +130,8 @@ namespace DocFileFormat
}
else
if
(
m_nTBIndex
+
1
<
m_document
->
TextboxIndividualPlex
->
CharacterPositions
.
size
())
{
cp
=
m_document
->
TextboxIndividualPlex
->
CharacterPositions
[
m_nTBIndex
];
//todooo сделать чище
cp
=
m_document
->
TextboxIndividualPlex
->
CharacterPositions
[
m_nTBIndex
]
+
2
;
cpEnd
=
m_document
->
TextboxIndividualPlex
->
CharacterPositions
[
m_nTBIndex
+
1
];
}
}
...
...
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
View file @
3e44b5d8
...
...
@@ -34,10 +34,13 @@
#include "OfficeDrawing/GeometryBooleanProperties.h"
#include "OfficeDrawing/GeometryTextBooleanProperties.h"
#include "OfficeDrawing/MetafilePictBlip.h"
#include "../../DesktopEditor/common/String.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
typedef
struct
{
...
...
@@ -64,6 +67,73 @@ typedef struct
namespace
DocFileFormat
{
struct
__BITMAPINFOHEADER
{
DWORD
biSize
;
LONG
biWidth
;
LONG
biHeight
;
WORD
biPlanes
;
WORD
biBitCount
;
DWORD
biCompression
;
DWORD
biSizeImage
;
LONG
biXPelsPerMeter
;
LONG
biYPelsPerMeter
;
DWORD
biClrUsed
;
DWORD
biClrImportant
;
};
struct
__BITMAPCOREHEADER
{
DWORD
bcSize
;
/* used to get to color table */
WORD
bcWidth
;
WORD
bcHeight
;
WORD
bcPlanes
;
WORD
bcBitCount
;
};
Global
::
BlipType
GetFormatPict
(
unsigned
char
*
data
,
int
size
)
{
Global
::
BlipType
btWin32
=
Global
::
msoblipDIB
;
int
offset
=
0
,
biSizeImage
=
0
;
__BITMAPINFOHEADER
*
header
=
(
__BITMAPINFOHEADER
*
)
data
;
if
(
!
header
)
return
btWin32
;
if
(
header
->
biWidth
>
100000
||
header
->
biHeight
>
100000
||
header
->
biSize
!=
40
)
{
__BITMAPCOREHEADER
*
header_core
=
(
__BITMAPCOREHEADER
*
)
data
;
if
(
header_core
->
bcSize
!=
12
)
{
btWin32
=
Global
::
msoblipWMF
;
}
else
{
offset
=
12
;
//sizeof(BITMAPCOREHEADER)
int
stride
=
(
size
-
offset
)
/
header_core
->
bcHeight
;
biSizeImage
=
size
-
offset
;
if
(
stride
>=
header_core
->
bcWidth
&&
header_core
->
bcBitCount
>=
24
)
{
btWin32
=
Global
::
msoblipPNG
;
}
}
}
else
{
offset
=
40
;
//sizeof(BITMAPINFOHEADER)
int
sz_bitmap
=
header
->
biHeight
*
header
->
biWidth
*
header
->
biBitCount
/
8
;
int
stride
=
(
size
-
offset
)
/
header
->
biHeight
;
if
(
stride
>=
header
->
biWidth
&&
header
->
biBitCount
>=
24
)
{
btWin32
=
Global
::
msoblipPNG
;
}
}
return
btWin32
;
}
bool
ParseEmbeddedEquation
(
const
std
::
string
&
xmlString
,
std
::
wstring
&
newXmlString
)
{
newXmlString
.
clear
();
...
...
@@ -307,7 +377,6 @@ namespace DocFileFormat
return
m_ShapeId
;
}
/// Writes a border element
void
VMLPictureMapping
::
writePictureBorder
(
const
std
::
wstring
&
name
,
const
BorderCode
*
brc
)
{
if
(
!
brc
||
name
.
empty
())
return
;
...
...
@@ -318,8 +387,6 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
""
),
true
);
}
/// Copies the picture from the binary stream to the zip archive
/// and creates the relationships for the image.
bool
VMLPictureMapping
::
CopyPicture
(
PictureDescriptor
*
pict
)
{
if
(
!
pict
)
return
false
;
...
...
@@ -329,57 +396,45 @@ namespace DocFileFormat
if
(
pict
->
embeddedData
&&
pict
->
embeddedDataSize
>
0
)
{
ENHMETAHEADER3
oHeader
;
int
w
=
0
,
h
=
0
;
oHeader
.
iType
=
0x00000001
;
oHeader
.
nSize
=
sizeof
(
oHeader
);
Global
::
BlipType
btWin32
=
GetFormatPict
(
pict
->
embeddedData
,
pict
->
embeddedDataSize
);
oHeader
.
rclBounds
.
left
=
0
;
oHeader
.
rclBounds
.
top
=
0
;
oHeader
.
rclBounds
.
right
=
w
;
oHeader
.
rclBounds
.
bottom
=
h
;
oHeader
.
rclFrame
.
left
=
0
;
oHeader
.
rclFrame
.
top
=
0
;
oHeader
.
rclFrame
.
right
=
w
;
oHeader
.
rclFrame
.
bottom
=
h
;
oHeader
.
dSignature
=
0x464D4520
;
oHeader
.
nVersion
=
0x00010000
;
oHeader
.
nBytes
=
pict
->
embeddedDataSize
-
176
;
oHeader
.
nRecords
=
1
;
oHeader
.
nHandles
=
0
;
oHeader
.
sReserved
=
0
;
if
(
btWin32
==
Global
::
msoblipWMF
)
{
CMetaHeader
oMetaHeader
;
oMetaHeader
.
rcBounds
.
right
=
pict
->
mfp
.
xExt
;
oMetaHeader
.
rcBounds
.
bottom
=
pict
->
mfp
.
yExt
;
oHeader
.
nDescription
=
0
;
oHeader
.
offDescription
=
0
;
WmfPlaceableFileHeader
oWmfHeader
=
{};
oMetaHeader
.
ToWMFHeader
(
&
oWmfHeader
);
int
lLenHeader
=
114
+
22
;
oHeader
.
nPalEntries
=
0
;
unsigned
char
*
newData
=
new
unsigned
char
[
pict
->
embeddedDataSize
+
lLenHeader
];
memcpy
(
newData
,
(
unsigned
char
*
)(
&
oWmfHeader
),
22
);
memcpy
(
newData
+
22
,
pict
->
embeddedDataHeader
,
114
);
memcpy
(
newData
+
lLenHeader
,
pict
->
embeddedData
,
pict
->
embeddedDataSize
);
oHeader
.
szlDevice
.
cx
=
200
;
oHeader
.
szlDevice
.
cy
=
200
;
pict
->
embeddedDataSize
+=
lLenHeader
;
delete
[]
pict
->
embeddedData
;
pict
->
embeddedData
=
newData
;
oHeader
.
szlMillimeters
.
cx
=
100
;
oHeader
.
szlMillimeters
.
cy
=
100
;
}
m_ctx
->
_docx
->
ImagesList
.
push_back
(
ImageFileStructure
(
GetTargetExt
(
Global
::
msoblipDIB
),
std
::
vector
<
unsigned
char
>
(
pict
->
embeddedData
,
(
pict
->
embeddedData
+
pict
->
embeddedDataSize
)),
Global
::
msoblipDIB
));
memcpy
(
pict
->
embeddedData
,
&
oHeader
,
sizeof
(
oHeader
));
m_ctx
->
_docx
->
ImagesList
.
push_back
(
ImageFileStructure
(
GetTargetExt
(
Global
::
msoblipWMF
),
std
::
vector
<
unsigned
char
>
(
pict
->
embeddedData
,
pict
->
embeddedData
+
pict
->
embeddedDataSize
)));
m_nImageId
=
m_ctx
->
_docx
->
RegisterImage
(
m_caller
,
Global
::
msoblipWMF
);
result
=
true
;
m_nImageId
=
m_ctx
->
_docx
->
RegisterImage
(
m_caller
,
btWin32
);
result
=
true
;
}
else
if
((
oBlipEntry
!=
NULL
)
&&
(
oBlipEntry
->
Blip
!=
NULL
))
{
switch
(
oBlipEntry
->
btWin32
)
{
case
Global
:
:
msoblipEMF
:
case
Global
:
:
msoblipWMF
:
case
Global
:
:
msoblipEMF
:
case
Global
:
:
msoblipWMF
:
{
//it's a meta image
MetafilePictBlip
*
metaBlip
=
static_cast
<
MetafilePictBlip
*>
(
oBlipEntry
->
Blip
);
if
(
metaBlip
)
{
//decompress inside MetafilePictBlip
...
...
@@ -393,11 +448,11 @@ namespace DocFileFormat
}
break
;
case
Global
:
:
msoblipJPEG
:
case
Global
:
:
msoblipCMYKJPEG
:
case
Global
:
:
msoblipPNG
:
case
Global
:
:
msoblipTIFF
:
case
Global
:
:
msoblipDIB
:
case
Global
:
:
msoblipJPEG
:
case
Global
:
:
msoblipCMYKJPEG
:
case
Global
:
:
msoblipPNG
:
case
Global
:
:
msoblipTIFF
:
case
Global
:
:
msoblipDIB
:
{
BitmapBlip
*
bitBlip
=
static_cast
<
BitmapBlip
*>
(
oBlipEntry
->
Blip
);
if
(
bitBlip
)
...
...
@@ -405,19 +460,16 @@ namespace DocFileFormat
m_ctx
->
_docx
->
ImagesList
.
push_back
(
ImageFileStructure
(
GetTargetExt
(
oBlipEntry
->
btWin32
),
std
::
vector
<
unsigned
char
>
(
bitBlip
->
m_pvBits
,
(
bitBlip
->
m_pvBits
+
bitBlip
->
pvBitsSize
)),
oBlipEntry
->
btWin32
));
}
}
break
;
}
break
;
default:
default:
{
return
false
;
}
break
;
}
break
;
}
m_nImageId
=
m_ctx
->
_docx
->
RegisterImage
(
m_caller
,
oBlipEntry
->
btWin32
);
result
=
true
;
result
=
true
;
}
return
result
;
...
...
@@ -430,28 +482,16 @@ namespace DocFileFormat
{
switch
(
nType
)
{
//case Global::msoblipDIB:
// return std::wstring( _T( ".bmp" ) );
//case msoblipBMP:
// return wstring( _T( ".bmp" ) );
case
Global
:
:
msoblipDIB
:
return
std
::
wstring
(
_T
(
".bmp"
));
case
Global
:
:
msoblipEMF
:
return
std
::
wstring
(
_T
(
".emf"
));
//case msoblipGIF:
// return wstring( _T( ".gif" ) );
//case msoblipICON:
// return wstring( _T( ".ico" ) );
case
Global
:
:
msoblipJPEG
:
case
Global
:
:
msoblipCMYKJPEG
:
return
std
::
wstring
(
_T
(
".jpg"
));
//case msoblipPCX:
// return wstring( _T( ".pcx" ) );
case
Global
:
:
msoblipPNG
:
return
std
::
wstring
(
_T
(
".png"
));
...
...
@@ -470,9 +510,6 @@ namespace DocFileFormat
{
switch
(
nType
)
{
//case msoblipBMP:
// return wstring( _T( "image/bmp" ) );
case
Global
:
:
msoblipEMF
:
return
std
::
wstring
(
OpenXmlContentTypes
::
Emf
);
...
...
@@ -498,6 +535,9 @@ namespace DocFileFormat
case
Global
:
:
msoblipWMF
:
return
std
::
wstring
(
OpenXmlContentTypes
::
Wmf
);
case
Global
:
:
msoblipDIB
:
return
std
::
wstring
(
OpenXmlContentTypes
::
Bmp
);
default:
return
std
::
wstring
(
OpenXmlContentTypes
::
Png
);
}
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
View file @
3e44b5d8
This diff is collapsed.
Click to expand it.
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
View file @
3e44b5d8
...
...
@@ -65,8 +65,10 @@ namespace DocFileFormat
private:
void
ApplyPrimitives
(
DrawingPrimitives
*
primitives
);
int
ApplyPrimitive
(
DrawingPrimitives
*
primitives
,
int
index
);
void
ApplyPrimitives
(
DrawingPrimitives
*
primitives
);
int
ApplyPrimitive
(
DrawingPrimitives
*
primitives
,
int
index
);
void
WritePrimitiveProps
(
DrawingPrimitive
*
primitive
,
bool
root
);
// Converts a group of shapes
void
WriteGroup
(
const
GroupContainer
*
pContainer
);
...
...
@@ -135,12 +137,5 @@ namespace DocFileFormat
XMLTools
::
XMLElement
<
wchar_t
>
m_imagedata
;
XMLTools
::
XMLElement
<
wchar_t
>
m_3dstyle
;
XMLTools
::
XMLElement
<
wchar_t
>
m_textpath
;
//----------------------------------------------------------------
std
::
vector
<
double
>
m_offset_x
;
std
::
vector
<
double
>
m_offset_y
;
std
::
vector
<
double
>
m_scale_x
;
std
::
vector
<
double
>
m_scale_y
;
};
}
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
View file @
3e44b5d8
...
...
@@ -49,6 +49,7 @@ namespace DocFileFormat
EndnoteReferenceCharactersPlex
(
NULL
),
FieldsPlex
(
NULL
),
FootnoteDocumentFieldsPlex
(
NULL
),
EndnoteDocumentFieldsPlex
(
NULL
),
HeadersAndFootersDocumentFieldsPlex
(
NULL
),
HeaderStoriesPlex
(
NULL
),
AnnotationsReferencePlex
(
NULL
),
IndividualCommentsPlex
(
NULL
),
TextboxBreakPlex
(
NULL
),
TextboxBreakPlexHeader
(
NULL
),
TextboxIndividualPlex
(
NULL
),
OfficeDrawingPlex
(
NULL
),
OfficeDrawingPlexHeader
(
NULL
),
SectionPlex
(
NULL
),
BookmarkStartPlex
(
NULL
),
BookmarkEndPlex
(
NULL
),
AutoTextPlex
(
NULL
),
AllPapxFkps
(
NULL
),
AllChpxFkps
(
NULL
),
AllPapx
(
NULL
),
AllPapxVector
(
NULL
),
AllSepx
(
NULL
),
Styles
(
NULL
),
listTable
(
NULL
),
AnnotationOwners
(
NULL
),
DocProperties
(
NULL
),
listFormatOverrideTable
(
NULL
),
headerAndFooterTable
(
NULL
),
encryptionHeader
(
NULL
)
...
...
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
View file @
3e44b5d8
...
...
@@ -39,7 +39,7 @@
namespace
ImageHelper
{
typedef
struct
___tag
BITMAPINFOHEADER
struct
__
BITMAPINFOHEADER
{
DWORD
biSize
;
LONG
biWidth
;
...
...
@@ -52,44 +52,117 @@ namespace ImageHelper
LONG
biYPelsPerMeter
;
DWORD
biClrUsed
;
DWORD
biClrImportant
;
}
___BITMAPINFOHEADER
;
};
inline
static
int
CompareStrings
(
const
wchar_t
*
str1
,
const
wchar_t
*
str2
)
struct
__BITMAPCOREHEADER
{
CString
cstr1
;
cstr1
=
str1
;
CString
cstr2
;
cstr2
=
str2
;
DWORD
bcSize
;
/* used to get to color table */
WORD
bcWidth
;
WORD
bcHeight
;
WORD
bcPlanes
;
WORD
bcBitCount
;
};
if
(
cstr1
==
cstr2
)
return
0
;
return
1
;
}
inline
bool
SaveImageToFileFromDIB
(
unsigned
char
*
buffer
,
int
size
,
const
std
::
wstring
&
file
)
inline
Global
::
_BlipType
SaveImageToFileFromDIB
(
unsigned
char
*
data
,
int
size
,
const
std
::
wstring
&
file_name
)
//without ext
{
bool
result
=
false
;
const
___BITMAPINFOHEADER
*
info
=
(
___BITMAPINFOHEADER
*
)
buffer
;
Global
::
_BlipType
result
=
Global
::
msoblipERROR
;
CBgraFrame
oFrame
;
int
offset
=
0
,
biSizeImage
=
0
;
__BITMAPINFOHEADER
*
header
=
(
__BITMAPINFOHEADER
*
)
data
;
if
(
!
header
)
return
result
;
result
==
Global
::
msoblipDIB
;
if
(
NULL
!=
info
&&
info
->
biSize
=
=
40
)
if
(
header
->
biWidth
>
100000
||
header
->
biHeight
>
100000
||
header
->
biSize
!
=
40
)
{
unsigned
char
*
pBgraData
=
buffer
+
sizeof
(
___BITMAPINFOHEADER
);
__BITMAPCOREHEADER
*
header_core
=
(
__BITMAPCOREHEADER
*
)
data
;
if
(
header_core
->
bcSize
!=
12
)
{
result
=
Global
::
msoblipWMF
;
}
else
{
offset
=
12
;
//sizeof(BITMAPCOREHEADER)
int
nWidth
=
info
->
biWidth
;
int
nHeight
=
info
->
biHeight
;
oFrame
.
put_Height
(
header_core
->
bcHeight
);
oFrame
.
put_Width
(
header_core
->
bcWidth
);
int
sz_bitmap
=
header_core
->
bcHeight
*
header_core
->
bcWidth
*
header_core
->
bcBitCount
/
8
;
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
// header_core->bcWidth++;
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
int
stride
=
-
(
size
-
offset
)
/
header_core
->
bcHeight
;
oFrame
.
put_Stride
(
stride
/*header_core->bcBitCount * header_core->bcWidth /8 */
);
CBgraFrame
oFrame
;
oFrame
.
put_Data
(
pBgraData
);
oFrame
.
put_Width
(
nWidth
);
oFrame
.
put_Height
(
nHeight
);
biSizeImage
=
size
-
offset
;
if
(
-
stride
>=
header_core
->
bcWidth
&&
header_core
->
bcBitCount
>=
24
)
{
result
=
Global
::
msoblipPNG
;
}
}
}
else
{
offset
=
40
;
//sizeof(BITMAPINFOHEADER)
int
nStride
=
info
->
biSizeImage
/
nHeight
;
oFrame
.
put_Stride
(
-
nStride
);
oFrame
.
put_Height
(
header
->
biHeight
);
oFrame
.
put_Width
(
header
->
biWidth
);
int
sz_bitmap
=
header
->
biHeight
*
header
->
biWidth
*
header
->
biBitCount
/
8
;
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
// header->biWidth++;
int
stride
=
-
(
size
-
offset
)
/
header
->
biHeight
;
result
=
oFrame
.
SaveFile
(
file
,
4
);
if
(
-
stride
>=
header
->
biWidth
&&
header
->
biBitCount
>=
24
)
{
result
=
Global
::
msoblipPNG
;
}
oFrame
.
put_Stride
(
stride
/*header->biBitCount * header->biWidth /8*/
);
biSizeImage
=
header
->
biSizeImage
>
0
?
header
->
biSizeImage
:
(
size
-
offset
);
}
//------------------------------------------------------------------------------------------
oFrame
.
put_Data
(
NULL
);
if
(
result
==
Global
::
msoblipPNG
)
{
oFrame
.
put_Data
((
unsigned
char
*
)
data
+
offset
);
if
(
!
oFrame
.
SaveFile
(
file_name
+
_T
(
".png"
),
4
/*CXIMAGE_FORMAT_PNG*/
))
result
=
Global
::
msoblipERROR
;
oFrame
.
put_Data
(
NULL
);
}
else
if
(
result
==
Global
::
msoblipWMF
)
{
NSFile
::
CFileBinary
file
;
if
(
file
.
CreateFileW
(
file_name
+
_T
(
".wmf"
)))
{
file
.
WriteFile
((
BYTE
*
)
data
,
size
);
file
.
CloseFile
();
}
}
else
if
(
biSizeImage
>
0
)
{
NSFile
::
CFileBinary
file
;
if
(
file
.
CreateFileW
(
file_name
+
_T
(
".bmp"
)))
{
WORD
vtType
=
0x4D42
;
file
.
WriteFile
((
BYTE
*
)
&
vtType
,
2
);
DWORD
dwLen
=
biSizeImage
;
file
.
WriteFile
((
BYTE
*
)
&
dwLen
,
4
);
DWORD
dwRes
=
0
;
file
.
WriteFile
((
BYTE
*
)
&
dwRes
,
4
);
DWORD
dwOffset
=
2
;
file
.
WriteFile
((
BYTE
*
)
&
dwOffset
,
4
);
file
.
WriteFile
((
BYTE
*
)
data
,
size
);
file
.
CloseFile
();
}
}
return
result
;
}
}
...
...
@@ -120,11 +193,11 @@ namespace DocFileFormat
//Write main content. (word directory)
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"document.xml"
)
),
DocumentXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"fontTable.xml"
)
),
FontTableXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"fontTable.xml"
)
),
FontTableXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"styles.xml"
)
),
StyleSheetXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"footnotes.xml"
)
),
FootnotesXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"footnotes.xml"
)
),
FootnotesXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"endnotes.xml"
)
),
EndnotesXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"numbering.xml"
)
),
NumberingXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"numbering.xml"
)
),
NumberingXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"comments.xml"
)
),
CommentsXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"settings.xml"
)
),
SettingsXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
()),
std
::
wstring
(
_T
(
"customizations.xml"
)
),
CommandTableXML
);
...
...
@@ -147,8 +220,8 @@ namespace DocFileFormat
if
(
Global
::
msoblipDIB
==
iter
->
blipType
)
{
//user_manual_v52.doc
std
::
wstring
file_name
=
string2std_string
(
pathMedia
.
GetPath
())
+
FILE_SEPARATOR_STR
+
_T
(
"image"
)
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
;
ImageHelper
::
SaveImageToFileFromDIB
(
bytes
,
iter
->
data
.
size
(),
file_name
);
std
::
wstring
file_name
=
string2std_string
(
pathMedia
.
GetPath
())
+
FILE_SEPARATOR_STR
+
_T
(
"image"
)
+
FormatUtils
::
IntToWideString
(
i
++
);
iter
->
blipType
=
ImageHelper
::
SaveImageToFileFromDIB
(
bytes
,
iter
->
data
.
size
(),
file_name
);
}
else
{
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
View file @
3e44b5d8
...
...
@@ -657,7 +657,7 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
if
(
file
.
CreateFileW
(
xlsx_context
->
get_mediaitems
().
media_path
()
+
file_name
))
{
WORD
vtType
=
0x4D42
;
file
.
WriteFile
((
BYTE
*
)
&
vtType
,
2
);
DWORD
dwLen
=
biSizeImage
;
file
.
WriteFile
((
BYTE
*
)
&
dwLen
,
4
);
DWORD
dwLen
=
biSizeImage
;
file
.
WriteFile
((
BYTE
*
)
&
dwLen
,
4
);
DWORD
dwRes
=
0
;
file
.
WriteFile
((
BYTE
*
)
&
dwRes
,
4
);
DWORD
dwOffset
=
2
;
file
.
WriteFile
((
BYTE
*
)
&
dwOffset
,
4
);
...
...
X2tConverter/build/Qt/X2tConverter.pro
View file @
3e44b5d8
...
...
@@ -7,7 +7,7 @@
QT
-=
core
QT
-=
gui
VERSION
=
2.0
.
2.3
78
VERSION
=
2.0
.
2.3
80
DEFINES
+=
INTVER
=
$$
VERSION
mac
{
...
...
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