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
2026d064
Commit
2026d064
authored
May 13, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormatReader - fix shape freeforms
parent
42257ca4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
393 additions
and
199 deletions
+393
-199
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
+38
-17
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeContainer.h
...ceDocFile/DocDocxConverter/OfficeDrawing/ShapeContainer.h
+6
-7
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h
...ficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h
+17
-25
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
+5
-5
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
+302
-118
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
+14
-14
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.cpp
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.cpp
+6
-0
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.vcproj
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.vcproj
+1
-9
ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/CustomGeomShape.h
...2/source/XlsXlsxConverter/ConvertShapes/CustomGeomShape.h
+4
-4
No files found.
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
View file @
2026d064
...
...
@@ -35,11 +35,23 @@
namespace
DocFileFormat
{
struct
_guides
{
unsigned
char
type
;
unsigned
char
param_type1
;
unsigned
char
param_type2
;
unsigned
char
param_type3
;
WORD
param1
;
WORD
param2
;
WORD
param3
;
};
class
PathParser
{
public:
PathParser
(
const
unsigned
char
*
pSegmentInfo
,
unsigned
int
pSegmentInfoSize
,
const
unsigned
char
*
pVertices
,
unsigned
int
pVerticesSize
)
PathParser
(
const
unsigned
char
*
pSegmentInfo
,
unsigned
int
pSegmentInfoSize
,
const
unsigned
char
*
pVertices
,
unsigned
int
pVerticesSize
,
std
::
vector
<
_guides
>
&
guides
)
{
if
((
pSegmentInfo
!=
NULL
)
&&
(
pSegmentInfoSize
>
0
))
{
...
...
@@ -105,31 +117,40 @@ namespace DocFileFormat
unsigned
short
nElemsAlloc
=
FormatUtils
::
BytesToUInt16
(
pVertices
,
2
,
pVerticesSize
);
unsigned
short
cb
=
FormatUtils
::
BytesToUInt16
(
pVertices
,
4
,
pVerticesSize
);
if
(
0xfff0
==
cb
)
{
cb
=
4
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
POINT
point
;
if
(
0xfff0
==
cb
)
{
POINT
point
;
cb
=
4
;
point
.
x
=
FormatUtils
::
BytesToInt16
(
pVertices
+
6
,
(
i
*
cb
),
pVerticesSize
);
point
.
y
=
FormatUtils
::
BytesToInt16
(
pVertices
+
6
,
(
i
*
cb
)
+
(
cb
/
2
),
pVerticesSize
);
m_arPoints
.
push_back
(
point
);
}
}
else
{
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
else
{
POINT
point
;
point
.
x
=
FormatUtils
::
BytesToInt32
(
pVertices
+
6
,
(
i
*
cb
),
pVerticesSize
);
point
.
y
=
FormatUtils
::
BytesToInt32
(
pVertices
+
6
,
(
i
*
cb
)
+
(
cb
/
2
),
pVerticesSize
);
}
m_arPoints
.
push_back
(
point
);
LONG
lMinF
=
(
LONG
)
0x80000000
;
if
(
lMinF
<=
point
.
x
)
{
int
index
=
(
DWORD
)
point
.
x
-
0x80000000
;
if
(
index
>=
0
&&
index
<
guides
.
size
())
{
point
.
x
=
guides
[
index
].
param3
;
}
}
if
(
lMinF
<=
point
.
y
)
{
int
index
=
(
DWORD
)
point
.
y
-
0x80000000
;
if
(
index
>=
0
&&
index
<
guides
.
size
())
{
point
.
y
=
guides
[
index
].
param3
;
}
}
m_arPoints
.
push_back
(
point
);
}
}
}
...
...
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeContainer.h
View file @
2026d064
...
...
@@ -106,21 +106,20 @@ namespace DocFileFormat
return
new
ShapeContainer
(
_reader
,
bodySize
,
typeCode
,
version
,
instance
);
}
std
::
list
<
OptionEntry
>
ExtractOptions
()
const
std
::
vector
<
OptionEntryPtr
>
ExtractOptions
()
const
{
std
::
list
<
OptionEntry
>
ret
;
std
::
vector
<
OptionEntryPtr
>
ret
;
//build the list of all option entries of this shape
for
(
std
::
vector
<
Record
*>::
const_iterator
iter
=
this
->
Children
.
begin
();
iter
!=
this
->
Children
.
end
();
iter
++
)
{
ShapeOptions
*
opt
=
dynamic_cast
<
ShapeOptions
*>
(
*
iter
);
if
(
opt
!=
NULL
)
if
(
opt
==
NULL
)
continue
;
for
(
size_t
i
=
0
;
i
<
opt
->
Options
.
size
();
i
++
)
{
for
(
std
::
vector
<
OptionEntry
>::
iterator
oeIter
=
opt
->
Options
.
begin
();
oeIter
!=
opt
->
Options
.
end
();
oeIter
++
)
{
ret
.
push_back
(
*
oeIter
);
}
ret
.
push_back
(
opt
->
Options
[
i
]);
}
}
...
...
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h
View file @
2026d064
...
...
@@ -568,18 +568,19 @@ namespace DocFileFormat
struct
OptionEntry
{
OptionEntry
()
:
pid
(
PropertyId_left
),
fBid
(
false
),
fComplex
(
false
),
op
(
0
)
,
opComplex
(
NULL
)
OptionEntry
()
:
pid
(
PropertyId_left
),
fBid
(
false
),
fComplex
(
false
),
op
(
0
)
{
}
PropertyId
pid
;
bool
fBid
;
bool
fComplex
;
unsigned
int
op
;
unsigned
char
*
opComplex
;
std
::
shared_ptr
<
unsigned
char
>
opComplex
;
};
typedef
std
::
shared_ptr
<
OptionEntry
>
OptionEntryPtr
;
class
ShapeOptions
:
public
Record
{
public:
...
...
@@ -587,8 +588,8 @@ namespace DocFileFormat
static
const
unsigned
short
TYPE_CODE_0xF121
=
0xF121
;
static
const
unsigned
short
TYPE_CODE_0xF122
=
0xF122
;
std
::
vector
<
OptionEntry
>
Options
;
std
::
map
<
PropertyId
,
OptionEntry
>
OptionsByID
;
std
::
vector
<
OptionEntry
Ptr
>
Options
;
std
::
map
<
PropertyId
,
OptionEntry
Ptr
>
OptionsByID
;
ShapeOptions
()
:
Record
()
{
...
...
@@ -596,8 +597,8 @@ namespace DocFileFormat
virtual
~
ShapeOptions
()
{
for
(
std
::
vector
<
OptionEntry
>::
iterator
iter
=
Options
.
begin
();
iter
!=
Options
.
end
();
++
iter
)
RELEASEARRAYOBJECTS
(
iter
->
opComplex
);
//
for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
//
RELEASEARRAYOBJECTS( iter->opComplex );
}
ShapeOptions
(
IBinaryReader
*
_reader
,
unsigned
int
size
,
unsigned
int
typeCode
,
unsigned
int
version
,
unsigned
int
instance
)
:
Record
(
_reader
,
size
,
typeCode
,
version
,
instance
)
...
...
@@ -606,16 +607,16 @@ namespace DocFileFormat
//instance is the count of properties stored in this record
OptionEntry
entry
;
//parse the flags and the simple values
for
(
unsigned
int
i
=
0
;
i
<
instance
;
++
i
)
{
OptionEntryPtr
entry
=
std
::
shared_ptr
<
OptionEntry
>
(
new
OptionEntry
());
unsigned
short
flag
=
Reader
->
ReadUInt16
();
entry
.
pid
=
(
PropertyId
)
FormatUtils
::
BitmaskToInt
(
flag
,
0x3FFF
);
entry
.
fBid
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x4000
);
entry
.
fComplex
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x8000
);
entry
.
op
=
Reader
->
ReadUInt32
();
entry
->
pid
=
(
PropertyId
)
FormatUtils
::
BitmaskToInt
(
flag
,
0x3FFF
);
entry
->
fBid
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x4000
);
entry
->
fComplex
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x8000
);
entry
->
op
=
Reader
->
ReadUInt32
();
Options
.
push_back
(
entry
);
}
...
...
@@ -625,21 +626,12 @@ namespace DocFileFormat
//of the OptionEntry arry, sorted by pid
for
(
unsigned
int
i
=
0
;
i
<
instance
;
++
i
)
{
if
(
Options
[
i
].
fComplex
)
{
int
read_size
=
(
int
)
Options
[
i
].
op
+
6
;
//????
//todooo !!!! проверить все остальные !! тут размер в зависимости от типа Complex!!!
switch
(
Options
[
i
].
pid
)
{
case
PropertyId
:
:
gtextUNICODE
:
case
PropertyId
:
:
gtextFont
:
read_size
=
(
int
)
Options
[
i
].
op
;
break
;
}
Options
[
i
].
opComplex
=
Reader
->
ReadBytes
(
read_size
,
true
);
if
(
Options
[
i
]
->
fComplex
&&
Options
[
i
]
->
op
>
0
)
{
Options
[
i
]
->
opComplex
=
std
::
shared_ptr
<
unsigned
char
>
(
Reader
->
ReadBytes
(
Options
[
i
]
->
op
,
true
));
}
OptionsByID
.
insert
(
std
::
pair
<
PropertyId
,
OptionEntry
>
(
Options
[
i
].
pid
,
Options
[
i
]));
OptionsByID
.
insert
(
std
::
make_pair
(
Options
[
i
]
->
pid
,
Options
[
i
]));
}
Reader
->
Seek
((
pos
+
size
),
0
/*STREAM_SEEK_SET*/
);
...
...
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
View file @
2026d064
...
...
@@ -241,7 +241,7 @@ namespace DocFileFormat
std
::
wstring
strHeight
=
FormatUtils
::
DoubleToWideString
(
height
.
ToPoints
()
);
std
::
wstring
strStyle
;
std
::
list
<
OptionEntry
>
options
;
std
::
vector
<
OptionEntryPtr
>
options
;
PictureFrameType
type
;
if
((
pict
->
shapeContainer
||
pict
->
blipStoreEntry
)
&&
pict
->
shapeContainer
->
Children
.
size
()
>
0
)
...
...
@@ -282,9 +282,9 @@ namespace DocFileFormat
}
//todooo oбъединить с shape_mapping
std
::
list
<
OptionEntry
>::
iterator
end
=
options
.
end
();
for
(
std
::
list
<
OptionEntry
>::
iterator
iter
=
options
.
begin
();
iter
!=
end
;
++
iter
)
for
(
size_t
i
=
0
;
i
<
options
.
size
();
i
++
)
{
OptionEntryPtr
&
iter
=
options
[
i
];
switch
(
iter
->
pid
)
{
case
wzEquationXML
:
...
...
@@ -292,7 +292,7 @@ namespace DocFileFormat
m_isEquation
=
true
;
m_isEmbedded
=
true
;
m_embeddedData
=
std
::
string
((
char
*
)
iter
->
opComplex
,
iter
->
op
);
m_embeddedData
=
std
::
string
((
char
*
)
iter
->
opComplex
.
get
()
,
iter
->
op
);
if
(
ParseEmbeddedEquation
(
m_embeddedData
,
m_equationXml
))
{
...
...
@@ -303,7 +303,7 @@ namespace DocFileFormat
{
//встроенная неведомая хуйня
m_isEmbedded
=
true
;
m_embeddedData
=
std
::
string
((
char
*
)
iter
->
opComplex
,
iter
->
op
);
m_embeddedData
=
std
::
string
((
char
*
)
iter
->
opComplex
.
get
()
,
iter
->
op
);
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
//{
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
View file @
2026d064
This diff is collapsed.
Click to expand it.
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
View file @
2026d064
...
...
@@ -77,17 +77,10 @@ namespace DocFileFormat
void
WritePrimitiveProps
(
DrawingPrimitive
*
primitive
,
bool
root
);
// Converts a group of shapes
void
WriteGroup
(
const
GroupContainer
*
pContainer
);
// Converts a single shape
void
WriteShape
(
const
ShapeContainer
*
pContainer
);
/// Generates a string id for the given shape
std
::
wstring
GenShapeId
(
const
Shape
*
pShape
)
const
;
/// Build the VML wrapcoords string for a given pWrapPolygonVertices
std
::
wstring
getWrapCoords
(
const
OptionEntry
&
pWrapPolygonVertices
)
const
;
/// Copies the picture from the binary stream to the zip archive
/// and creates the relationships for the image.
bool
copyPicture
(
const
BlipStoreEntry
*
bse
);
std
::
wstring
GetTargetExt
(
Global
::
BlipType
_type
)
const
;
...
...
@@ -98,21 +91,22 @@ namespace DocFileFormat
std
::
wstring
getTextboxAnchor
(
unsigned
int
anchor
)
const
;
void
AppendOptionsToStyle
(
std
::
wstring
*
style
,
const
std
::
list
<
OptionEntry
>&
options
,
int
zIndex
)
const
;
std
::
wstring
buildStyle
(
const
Shape
*
shape
,
const
ChildAnchor
*
anchor
,
const
std
::
vector
<
OptionEntryPtr
>&
options
,
int
zIndex
)
const
;
void
AppendOptionsToStyle
(
std
::
wstring
*
style
,
const
std
::
vector
<
OptionEntryPtr
>&
options
,
int
zIndex
)
const
;
std
::
wstring
buildStyle
(
const
Shape
*
shape
,
const
ChildAnchor
*
anchor
,
const
std
::
list
<
OptionEntry
>&
options
,
int
zIndex
)
const
;
int
UpdateFromGuides
(
const
int
val
)
const
;
std
::
wstring
getLineStyle
(
unsigned
int
p
)
const
;
std
::
wstring
getArrowStyle
(
unsigned
int
op
)
const
;
std
::
wstring
getArrowLength
(
unsigned
int
op
)
const
;
std
::
wstring
getArrowWidth
(
unsigned
int
op
)
const
;
std
::
wstring
getFillMethod
(
unsigned
int
p
)
const
;
std
::
wstring
getFillColorString
(
const
unsigned
char
*
p
,
unsigned
int
size
)
const
;
/// Returns the OpenXML fill type of a fill effect
std
::
wstring
getFillType
(
unsigned
int
p
)
const
;
std
::
wstring
getShadowType
(
unsigned
int
p
)
const
;
/// Returns the OpenXML wrap type of the shape
std
::
wstring
getWrapType
(
const
Spa
*
pSpa
)
const
;
std
::
wstring
ParsePath
(
const
std
::
list
<
OptionEntry
>&
options
)
const
;
void
WriteBeginShapeNode
(
const
Shape
*
pShape
);
void
WriteEndShapeNode
(
const
Shape
*
pShape
);
...
...
@@ -121,9 +115,15 @@ namespace DocFileFormat
std
::
wstring
GetLineFrom
(
const
ChildAnchor
*
pAnchor
)
const
;
std
::
wstring
GetLineTo
(
const
ChildAnchor
*
pAnchor
)
const
;
std
::
vector
<
std
::
wstring
>
GetTextRectangles
(
const
OptionEntry
&
inscribe
)
const
;
std
::
wstring
GetWrapCoords
(
const
OptionEntryPtr
&
pOpt
)
const
;
std
::
vector
<
std
::
wstring
>
GetTextRectangles
(
const
OptionEntryPtr
&
pOpt
)
const
;
std
::
wstring
GetConnectAngles
(
const
OptionEntryPtr
&
pOpt
)
const
;
std
::
wstring
GetConnectLocs
(
const
OptionEntryPtr
&
pOpt
)
const
;
void
GetGuides
(
const
OptionEntryPtr
&
pOpt
);
private:
int
m_nAdjValues
[
8
];
std
::
vector
<
_guides
>
m_arrGuides
;
bool
m_isInlineShape
;
Spa
*
m_pSpa
;
IMapping
*
m_pCaller
;
...
...
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.cpp
View file @
2026d064
...
...
@@ -45,6 +45,12 @@
#pragma comment(lib,"Shell32.lib")
#pragma comment(lib,"Advapi32.lib")
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
int
_tmain
(
int
argc
,
_TCHAR
*
argv
[])
{
HRESULT
hr
=
S_OK
;
...
...
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.vcproj
View file @
2026d064
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"8
.
00"
Version=
"8
,
00"
Name=
"XlsFormatTest"
ProjectGUID=
"{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
RootNamespace=
"ASCOfficeOdfFileTest"
...
...
@@ -367,14 +367,6 @@
</FileConfiguration>
</File>
</Filter>
<File
RelativePath=
"..\..\build\bin\icu\win_32\icudt.lib"
>
</File>
<File
RelativePath=
"..\..\build\bin\icu\win_32\icuuc.lib"
>
</File>
</Files>
<Globals>
</Globals>
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/CustomGeomShape.h
View file @
2026d064
...
...
@@ -312,7 +312,7 @@ namespace NSCustomShapesConvert
if
(
lMaxF
>
m_arVertices
[
nIndex
].
x
)
nGuideIndex_x
=
(
DWORD
)
m_arVertices
[
nIndex
].
x
-
(
DWORD
)
lMinF
;
if
(
lMaxF
>
m_arVertices
[
nIndex
].
y
)
nGuideIndex_y
=
(
DWORD
)
m_arVertices
[
nIndex
].
y
-
(
DWORD
)
lMinF
;
if
(
nGuideIndex_x
>=
0
)
if
(
nGuideIndex_x
>=
0
&&
nGuideIndex_x
<
m_arGuides
.
size
()
)
{
strPath
+=
std
::
to_wstring
(
m_arGuides
[
nGuideIndex_x
].
m_param_value1
)
+
L","
;
}
...
...
@@ -320,7 +320,7 @@ namespace NSCustomShapesConvert
{
strPath
+=
std
::
to_wstring
(
m_arVertices
[
nIndex
].
x
)
+
L","
;
}
if
(
nGuideIndex_y
>=
0
)
if
(
nGuideIndex_y
>=
0
&&
nGuideIndex_y
<
m_arGuides
.
size
()
)
{
strPath
+=
std
::
to_wstring
(
m_arGuides
[
nGuideIndex_y
].
m_param_value1
)
+
L","
;
}
...
...
@@ -388,7 +388,7 @@ namespace NSCustomShapesConvert
if
(
lMaxF
>
m_arVertices
[
nV
].
x
)
nGuideIndex_x
=
(
DWORD
)
m_arVertices
[
nV
].
x
-
(
DWORD
)
lMinF
;
if
(
lMaxF
>
m_arVertices
[
nV
].
y
)
nGuideIndex_y
=
(
DWORD
)
m_arVertices
[
nV
].
y
-
(
DWORD
)
lMinF
;
if
(
nGuideIndex_x
>=
0
)
if
(
nGuideIndex_x
>=
0
&&
nGuideIndex_x
<
m_arGuides
.
size
()
)
{
strPath
+=
std
::
to_wstring
(
m_arGuides
[
nGuideIndex_x
].
m_param_value1
)
+
L","
;
}
...
...
@@ -396,7 +396,7 @@ namespace NSCustomShapesConvert
{
strPath
+=
std
::
to_wstring
(
m_arVertices
[
nV
].
x
)
+
L","
;
}
if
(
nGuideIndex_y
>=
0
)
if
(
nGuideIndex_y
>=
0
&&
nGuideIndex_y
<
m_arGuides
.
size
()
)
{
strPath
+=
std
::
to_wstring
(
m_arGuides
[
nGuideIndex_y
].
m_param_value1
)
+
L","
;
}
...
...
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