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
ea5ebe72
Commit
ea5ebe72
authored
Dec 15, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormatReader - another ole objects(pictureId)
parent
50224310
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
831 additions
and
1083 deletions
+831
-1083
ASCOfficeDocFile/Common/FormatUtils.h
ASCOfficeDocFile/Common/FormatUtils.h
+2
-30
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
+47
-46
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
+2
-2
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeContainer.h
...ceDocFile/DocDocxConverter/OfficeDrawing/ShapeContainer.h
+14
-0
ASCOfficeDocFile/DocDocxConverter/OleObject.h
ASCOfficeDocFile/DocDocxConverter/OleObject.h
+10
-268
ASCOfficeDocFile/DocDocxConverter/Tbkd.h
ASCOfficeDocFile/DocDocxConverter/Tbkd.h
+2
-2
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
+742
-726
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/WordDocument.h
ASCOfficeDocFile/DocDocxConverter/WordDocument.h
+1
-1
ASCOfficeDocFile/DocFormatLib/Win32/DocFormatLib.vcproj
ASCOfficeDocFile/DocFormatLib/Win32/DocFormatLib.vcproj
+4
-0
ASCOfficeOdfFileW/linux/OdfFileWriterLib.pro
ASCOfficeOdfFileW/linux/OdfFileWriterLib.pro
+4
-5
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
+1
-1
No files found.
ASCOfficeDocFile/Common/FormatUtils.h
View file @
ea5ebe72
...
...
@@ -766,18 +766,11 @@ namespace DocFormatUtils
static
inline
std
::
wstring
IntToWideString
(
int
value
)
{
#if defined(_WIN32) || defined (_WIN64)
wchar_t
buff
[
33
]
=
{};
_itow
(
value
,
buff
,
10
);
return
std
::
wstring
(
buff
);
#else
return
(
std
::
to_wstring
(
value
));
#endif
}
static
inline
std
::
wstring
DoubleToWideString
(
double
value
)
{
std
::
wstringstream
src
;
std
::
wstringstream
src
;
src
<<
value
;
return
std
::
wstring
(
src
.
str
());
...
...
@@ -785,8 +778,7 @@ namespace DocFormatUtils
static
inline
std
::
string
DoubleToString
(
double
value
)
{
std
::
stringstream
src
;
std
::
stringstream
src
;
src
<<
value
;
return
std
::
string
(
src
.
str
());
...
...
@@ -813,36 +805,16 @@ namespace DocFormatUtils
static
inline
std
::
wstring
IntToFormattedWideString
(
int
value
,
const
wchar_t
*
format
)
{
// const int size = 33;
// wchar_t strValue[size] = L"\0";
if
(
format
==
NULL
)
return
L""
;
// swprintf_s( strValue, size, format, value );
//// }
// CString format_str;
// format_str.Format(format , value);
std
::
wstringstream
sstream
;
sstream
<<
boost
::
wformat
(
format
)
%
value
;
return
sstream
.
str
();
//return string2std_string( format_str );
}
static
inline
std
::
wstring
DoubleToFormattedWideString
(
double
value
,
wchar_t
*
format
)
{
if
(
format
==
NULL
)
return
L""
;
//std::wstring wstr;
//if ( format != NULL )
//{
// CString strValue;
// strValue.Format(format, value);
// wstr = string2std_string( strValue );
//}
//return wstr;
std
::
wstringstream
sstream
;
sstream
<<
boost
::
wformat
(
format
)
%
value
;
return
sstream
.
str
();
...
...
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
View file @
ea5ebe72
This diff is collapsed.
Click to expand it.
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
View file @
ea5ebe72
...
...
@@ -125,9 +125,9 @@ namespace DocFileFormat
int
searchNextTextMark
(
std
::
vector
<
wchar_t
>*
chars
,
int
initialCp
,
wchar_t
mark
);
private:
Symbol
getSymbol
(
const
CharacterPropertyExceptions
*
chpx
);
bool
m_bInternalXmlWriter
;
Symbol
getSymbol
(
const
CharacterPropertyExceptions
*
chpx
);
bool
m_bInternalXmlWriter
;
protected:
WordDocument
*
m_document
;
...
...
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeContainer.h
View file @
ea5ebe72
...
...
@@ -83,6 +83,20 @@ namespace DocFileFormat
}
return
false
;
}
bool
isOLE
()
{
int
ret
=
0
;
for
(
std
::
vector
<
Record
*>::
const_iterator
iter
=
this
->
Children
.
begin
();
iter
!=
this
->
Children
.
end
();
iter
++
)
{
Shape
*
sh
=
dynamic_cast
<
Shape
*>
(
*
iter
);
if
(
sh
)
{
return
sh
->
fOleShape
;
}
}
return
false
;
}
virtual
~
ShapeContainer
()
{
}
...
...
ASCOfficeDocFile/DocDocxConverter/OleObject.h
View file @
ea5ebe72
...
...
@@ -68,276 +68,18 @@ namespace DocFileFormat
PictureDescriptor
pictureDesciptor
;
OleObject
(
const
CharacterPropertyExceptions
*
chpx
,
StructuredStorageReader
*
docStorage
,
bool
bOlderVersion_
)
:
bLinked
(
false
),
updateMode
(
NoLink
),
bOlderVersion
(
bOlderVersion_
)
{
isEquation
=
isEmbedded
=
false
;
oleStorage
=
docStorage
->
GetStorage
();
if
(
(
chpx
!=
NULL
)
&&
(
docStorage
!=
NULL
)
)
{
HRESULT
res
=
S_OK
;
POLE
::
Stream
*
ObjectPoolStorage
=
new
POLE
::
Stream
(
oleStorage
,
"ObjectPool"
);
if
(
ObjectPoolStorage
)
{
ObjectId
=
getOleEntryName
(
chpx
);
std
::
string
sObjectId
(
ObjectId
.
begin
(),
ObjectId
.
end
()
);
{
std
::
string
name
=
"ObjectPool/"
+
sObjectId
+
"/"
;
processOleStream
(
name
+
"Ole"
);
if
(
bLinked
)
{
processLinkInfoStream
(
name
+
"LinkInfo"
);
}
else
{
processCompObjStream
(
name
+
"CompObj"
);
}
processPICStream
(
name
+
"PIC"
);
processEquationNativeStream
(
name
+
"Equation Native"
);
}
delete
ObjectPoolStorage
;
}
}
}
virtual
~
OleObject
()
{
}
OleObject
(
const
CharacterPropertyExceptions
*
chpx
,
StructuredStorageReader
*
docStorage
,
bool
bOlderVersion_
);
virtual
~
OleObject
()
{}
private:
POLE
::
Storage
*
oleStorage
;
void
processLinkInfoStream
(
const
std
::
string
&
linkStream
)
{
try
{
POLE
::
Stream
*
pLinkStream
=
NULL
;
HRESULT
res
=
S_OK
;
pLinkStream
=
//oleStorage->stream(linkStream);
new
POLE
::
Stream
(
oleStorage
,
linkStream
);
if
(
pLinkStream
)
{
VirtualStreamReader
reader
(
pLinkStream
,
0
,
false
);
//there are two versions of the Link string, one contains ANSI characters, the other contains
//unicode characters.
//Both strings seem not to be standardized:
//The length prefix is a character count EXCLUDING the terminating zero
//Read the ANSI version
short
cch
=
reader
.
ReadInt16
();
unsigned
char
*
str
=
reader
.
ReadBytes
(
cch
,
true
);
FormatUtils
::
GetSTLCollectionFromBytes
<
std
::
wstring
>
(
&
this
->
Link
,
str
,
cch
,
ENCODING_WINDOWS_1250
);
RELEASEARRAYOBJECTS
(
str
);
//skip the terminating zero of the ANSI string
//even if the characters are ANSI chars, the terminating zero has 2 bytes
reader
.
ReadBytes
(
2
,
false
);
//skip the next 4 bytes (flags?)
reader
.
ReadBytes
(
4
,
false
);
//Read the Unicode version
this
->
Link
.
clear
();
cch
=
reader
.
ReadInt16
();
str
=
reader
.
ReadBytes
(
(
cch
*
2
),
true
);
FormatUtils
::
GetSTLCollectionFromBytes
<
std
::
wstring
>
(
&
this
->
Link
,
str
,
(
cch
*
2
),
ENCODING_UTF16
);
RELEASEARRAYOBJECTS
(
str
);
//skip the terminating zero of the Unicode string
reader
.
ReadBytes
(
2
,
false
);
delete
pLinkStream
;
}
}
catch
(...)
{
}
}
void
processEquationNativeStream
(
const
std
::
string
&
eqStream
)
{
try
{
POLE
::
Stream
*
pCompStream
=
NULL
;
HRESULT
res
=
S_OK
;
pCompStream
=
new
POLE
::
Stream
(
oleStorage
,
eqStream
);
if
(
pCompStream
)
{
VirtualStreamReader
reader
(
pCompStream
,
0
,
false
);
int
sz
=
reader
.
GetSize
();
unsigned
char
*
Buffer
=
reader
.
ReadBytes
(
sz
,
true
);
if
(
Buffer
&&
sz
>
0
)
{
isEquation
=
true
;
delete
[]
Buffer
;
}
delete
pCompStream
;
}
}
catch
(...)
{
}
}
void
processPICStream
(
const
std
::
string
&
picStream
)
{
try
{
HRESULT
res
=
S_OK
;
POLE
::
Stream
*
pPICStream
=
new
POLE
::
Stream
(
oleStorage
,
picStream
);
if
(
pPICStream
)
{
VirtualStreamReader
reader
(
pPICStream
,
0
,
false
);
int
sz
=
reader
.
GetSize
();
int
cbHeader
=
reader
.
ReadUInt32
();
reader
.
ReadBytes
(
4
,
false
);
int
x
=
reader
.
ReadUInt32
();
int
y
=
reader
.
ReadUInt32
();
pictureDesciptor
.
dyaGoal
=
reader
.
ReadUInt32
();
pictureDesciptor
.
dxaGoal
=
reader
.
ReadUInt32
();
reader
.
ReadBytes
(
20
,
false
);
pictureDesciptor
.
mx
=
reader
.
ReadUInt32
();
pictureDesciptor
.
my
=
reader
.
ReadUInt32
();
}
}
catch
(...)
{
}
}
void
processCompObjStream
(
const
std
::
string
&
compStream
)
{
try
{
HRESULT
res
=
S_OK
;
POLE
::
Stream
*
pCompStream
=
new
POLE
::
Stream
(
oleStorage
,
compStream
);
if
(
pCompStream
)
{
VirtualStreamReader
reader
(
pCompStream
,
0
,
false
);
//skip the CompObjHeader
reader
.
ReadBytes
(
28
,
false
);
int
sz_obj
=
reader
.
GetSize
()
-
reader
.
GetPosition
();
if
(
sz_obj
>
4
)
{
UserType
=
reader
.
ReadLengthPrefixedAnsiString
(
sz_obj
);
sz_obj
=
reader
.
GetSize
()
-
reader
.
GetPosition
();
if
(
sz_obj
>
4
)
ClipboardFormat
=
reader
.
ReadLengthPrefixedAnsiString
(
sz_obj
);
sz_obj
=
reader
.
GetSize
()
-
reader
.
GetPosition
();
if
(
sz_obj
>
4
)
Program
=
reader
.
ReadLengthPrefixedAnsiString
(
sz_obj
);
}
delete
pCompStream
;
}
}
catch
(...)
{
}
}
void
processOleStream
(
const
std
::
string
&
oleStreamName
)
{
try
{
POLE
::
Stream
*
pOleStream
;
HRESULT
res
=
S_OK
;
pOleStream
=
new
POLE
::
Stream
(
oleStorage
,
oleStreamName
);
if
(
pOleStream
)
{
VirtualStreamReader
reader
(
pOleStream
,
0
,
false
);
//skip version
reader
.
ReadBytes
(
4
,
false
);
//read the embedded/linked flag
int
flag
=
reader
.
ReadInt32
();
bLinked
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x1
);
//Link update option
this
->
updateMode
=
(
LinkUpdateOption
)
reader
.
ReadInt32
();
switch
(
this
->
updateMode
)
{
case
NoLink
:
{
this
->
UpdateMode
=
_T
(
"NoLink"
);
}
break
;
case
Always
:
{
this
->
UpdateMode
=
_T
(
"Always"
);
}
break
;
case
OnCall
:
{
this
->
UpdateMode
=
_T
(
"OnCall"
);
}
break
;
}
delete
pOleStream
;
}
}
catch
(...)
{
}
}
std
::
wstring
getOleEntryName
(
const
CharacterPropertyExceptions
*
chpx
)
{
std
::
wstring
ret
;
if
(
chpx
!=
NULL
)
{
for
(
std
::
list
<
SinglePropertyModifier
>::
const_iterator
iter
=
chpx
->
grpprl
->
begin
();
iter
!=
chpx
->
grpprl
->
end
();
iter
++
)
{
if
(
iter
->
OpCode
==
sprmCPicLocation
||
iter
->
OpCode
==
sprmOldCPicLocation
)
{
ret
=
(
_T
(
"_"
)
+
FormatUtils
::
IntToWideString
(
FormatUtils
::
BytesToUInt32
(
iter
->
Arguments
,
0
,
iter
->
argumentsSize
)
)
);
break
;
}
}
}
return
ret
;
}
};
void
processLinkInfoStream
(
const
std
::
string
&
linkStream
);
void
processEquationNativeStream
(
const
std
::
string
&
eqStream
);
void
processPICStream
(
const
std
::
string
&
picStream
);
void
processCompObjStream
(
const
std
::
string
&
compStream
);
void
processOleStream
(
const
std
::
string
&
oleStreamName
);
std
::
wstring
getOleEntryName
(
const
CharacterPropertyExceptions
*
chpx
);
};
}
ASCOfficeDocFile/DocDocxConverter/Tbkd.h
View file @
ea5ebe72
...
...
@@ -96,6 +96,8 @@ namespace DocFileFormat
{
friend
class
TextboxMapping
;
public:
static
const
int
STRUCTURE_SIZE
=
22
;
struct
FTXBXSReusable
{
int
iNextReuse
;
...
...
@@ -108,8 +110,6 @@ namespace DocFileFormat
int
cTxbxEdit
;
// This value MUST be zero and MUST be ignored.
};
static
const
int
STRUCTURE_SIZE
=
22
;
FTXBXS
()
{
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
View file @
ea5ebe72
This diff is collapsed.
Click to expand it.
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
View file @
ea5ebe72
...
...
@@ -129,7 +129,7 @@ namespace DocFileFormat
BlipStoreContainer
*
m_pBlipStore
;
int
m_nImageId
;
std
::
wstring
m_textPathStyle
;
ConversionContext
*
m_c
tx
;
ConversionContext
*
m_c
ontext
;
PictureDescriptor
*
m_pict
;
XMLTools
::
XMLElement
<
wchar_t
>
m_fill
;
...
...
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
View file @
ea5ebe72
...
...
@@ -268,7 +268,7 @@ namespace DocFileFormat
OfficeDrawingPlex
=
new
Plex
<
Spa
>
(
Spa
::
GetSize
(
bOlderVersion
),
TableStream
,
FIB
->
m_FibWord97
.
fcPlcSpaMom
,
FIB
->
m_FibWord97
.
lcbPlcSpaMom
,
bOlderVersion
);
OfficeDrawingPlexHeader
=
new
Plex
<
Spa
>
(
Spa
::
GetSize
(
bOlderVersion
),
TableStream
,
FIB
->
m_FibWord97
.
fcPlcSpaHdr
,
FIB
->
m_FibWord97
.
lcbPlcSpaHdr
,
bOlderVersion
);
TextboxIndividualPlex
=
new
Plex
<
EmptyStructure
>
(
EmptyStructure
::
STRUCTURE_SIZE
,
TableStream
,
FIB
->
m_FibWord97
.
fcPlcftxbxTxt
,
FIB
->
m_FibWord97
.
lcbPlcftxbxTxt
,
bOlderVersion
);
TextboxIndividualPlex
=
new
Plex
<
FTXBXS
>
(
FTXBXS
::
STRUCTURE_SIZE
,
TableStream
,
FIB
->
m_FibWord97
.
fcPlcftxbxTxt
,
FIB
->
m_FibWord97
.
lcbPlcftxbxTxt
,
bOlderVersion
);
SectionPlex
=
new
Plex
<
SectionDescriptor
>
(
SectionDescriptor
::
STRUCTURE_SIZE
,
TableStream
,
FIB
->
m_FibWord97
.
fcPlcfSed
,
FIB
->
m_FibWord97
.
lcbPlcfSed
,
bOlderVersion
);
BookmarkStartPlex
=
new
Plex
<
BookmarkFirst
>
(
BookmarkFirst
::
STRUCTURE_SIZE
,
TableStream
,
FIB
->
m_FibWord97
.
fcPlcfBkf
,
FIB
->
m_FibWord97
.
lcbPlcfBkf
,
bOlderVersion
);
...
...
ASCOfficeDocFile/DocDocxConverter/WordDocument.h
View file @
ea5ebe72
...
...
@@ -187,7 +187,7 @@ namespace DocFileFormat
Plex
<
EmptyStructure
>
*
HeaderStoriesPlex
;
//A plex of the header document
Plex
<
EmptyStructure
>
*
IndividualCommentsPlex
;
// A plex with all ATRDPre10 structs
Plex
<
EmptyStructure
>
*
TextboxIndividualPlex
;
Plex
<
FTXBXS
>
*
TextboxIndividualPlex
;
Plex
<
Tbkd
>
*
TextboxBreakPlex
;
// Describes the breaks inside the textbox subdocument
Plex
<
Tbkd
>
*
TextboxBreakPlexHeader
;
// Describes the breaks inside the header textbox subdocument
...
...
ASCOfficeDocFile/DocFormatLib/Win32/DocFormatLib.vcproj
View file @
ea5ebe72
...
...
@@ -555,6 +555,10 @@
RelativePath=
"..\..\DocDocxConverter\OfficeArtContent.h"
>
</File>
<File
RelativePath=
"..\..\DocDocxConverter\OleObject.cpp"
>
</File>
<File
RelativePath=
"..\..\DocDocxConverter\OleObject.h"
>
...
...
ASCOfficeOdfFileW/linux/OdfFileWriterLib.pro
View file @
ea5ebe72
...
...
@@ -98,7 +98,10 @@ SOURCES += \
..
/
source
/
Oox2OdfConverter
/
ConverterChart
.
cpp
\
..
/
source
/
Oox2OdfConverter
/
ConvertVml
.
cpp
\
..
/
source
/
Oox2OdfConverter
/
DocxConverter
.
cpp
\
..
/
source
/
Oox2OdfConverter
/
XlsxConverter
.
cpp
..
/
source
/
Oox2OdfConverter
/
XlsxConverter
.
cpp
\
..
/
source
/
OdfFormat
/
odf_settings_context
.
cpp
\
..
/
source
/
OdfFormat
/
office_settings
.
cpp
\
..
/
source
/
OdfFormat
/
mediaitems_utils
.
cpp
}
...
...
@@ -183,7 +186,3 @@ HEADERS += \
..
/
source
/
OdfFormat
/
Shapes
/
oox_shapeWordArt
.
h
\
..
/
source
/
OdfFormat
/
odf_settings_context
.
h
\
..
/
source
/
OdfFormat
/
office_settings
.
h
SOURCES
+=
\
..
/
source
/
OdfFormat
/
odf_settings_context
.
cpp
\
..
/
source
/
OdfFormat
/
office_settings
.
cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
View file @
ea5ebe72
...
...
@@ -1218,7 +1218,7 @@ CString RtfStyle::RenderToOOXBegin(RenderParameter oRenderParameter)
if
(
PROP_DEF
!=
m_bPersonal
)
sResult
+=
L"<w:personal w:val=
\"
true
\"
/>"
;
if
(
PROP_DEF
!=
m_bCompose
)
sResult
+=
L"<w:personalCompose w:val=
\"
true
\"
/>"
;
if
(
PROP_DEF
!=
m_bReply
)
sResult
+=
L"<w:personalReply w:val=
\"
true
\"
/>"
;
if
(
PROP_DEF
==
m_nSemiHidden
)
sResult
+=
L"<w:semiHidden/>"
;
if
(
1
==
m_nSemiHidden
)
sResult
+=
L"<w:semiHidden/>"
;
if
(
PROP_DEF
!=
m_bQFormat
)
sResult
+=
L"<w:qformat/>"
;
if
(
PROP_DEF
!=
m_nPriority
)
sResult
.
AppendFormat
(
L"<w:uiPriority w:val=
\"
%d
\"
/>"
,
m_nPriority
);
if
(
PROP_DEF
!=
m_bUnhiddenWhenUse
)
sResult
+=
L"<w:unhideWhenUsed/>"
;
...
...
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