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
5e9d676e
Commit
5e9d676e
authored
Aug 02, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormatReader - fix bugs
parent
6c01725f
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
136 additions
and
97 deletions
+136
-97
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
+7
-3
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
+1
-0
ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp
ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp
+5
-1
ASCOfficeDocFile/DocDocxConverter/Spa.cpp
ASCOfficeDocFile/DocDocxConverter/Spa.cpp
+2
-4
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
+3
-0
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
+61
-11
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
+5
-4
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
+37
-60
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
+8
-7
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp
+5
-5
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h
+2
-2
No files found.
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
View file @
5e9d676e
...
...
@@ -52,6 +52,7 @@ namespace DocFileFormat
_writeWebHidden
=
false
;
_writeInstrText
=
false
;
_isSectionPageBreak
=
0
;
_isTextBoxContent
=
false
;
}
DocumentMapping
::
DocumentMapping
(
ConversionContext
*
context
,
XmlUtils
::
CXmlWriter
*
writer
,
IMapping
*
caller
)
:
_skipRuns
(
0
),
_lastValidPapx
(
NULL
),
_lastValidSepx
(
NULL
),
_writeInstrText
(
false
),
...
...
@@ -65,6 +66,7 @@ namespace DocFileFormat
_writeWebHidden
=
false
;
_writeInstrText
=
false
;
_isSectionPageBreak
=
0
;
_isTextBoxContent
=
false
;
}
DocumentMapping
::~
DocumentMapping
()
...
...
@@ -813,11 +815,13 @@ namespace DocFileFormat
{
PictureDescriptor
oPicture
(
chpx
,
m_document
->
bOlderVersion
?
m_document
->
WordDocumentStream
:
m_document
->
DataStream
,
0x7fffffff
,
m_document
->
bOlderVersion
);
bool
isInline
=
_isTextBoxContent
;
if
(
oPicture
.
embeddedData
&&
oPicture
.
embeddedDataSize
>
0
)
{
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"w:pict"
));
VMLPictureMapping
oVmlMapper
(
m_context
,
m_pXmlWriter
,
false
,
_caller
);
VMLPictureMapping
oVmlMapper
(
m_context
,
m_pXmlWriter
,
false
,
_caller
,
isInline
);
oPicture
.
Convert
(
&
oVmlMapper
);
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
"w:pict"
));
...
...
@@ -837,7 +841,7 @@ namespace DocFileFormat
if
(
picture
)
{
VMLPictureMapping
oVmlMapper
(
m_context
,
m_pXmlWriter
,
false
,
_caller
);
VMLPictureMapping
oVmlMapper
(
m_context
,
m_pXmlWriter
,
false
,
_caller
,
isInline
);
oPicture
.
Convert
(
&
oVmlMapper
);
if
(
oVmlMapper
.
m_isEmbedded
)
...
...
@@ -853,7 +857,7 @@ namespace DocFileFormat
}
}
else
{
VMLShapeMapping
oVmlMapper
(
m_context
,
m_pXmlWriter
,
NULL
,
&
oPicture
,
_caller
);
VMLShapeMapping
oVmlMapper
(
m_context
,
m_pXmlWriter
,
NULL
,
&
oPicture
,
_caller
,
isInline
);
oPicture
.
shapeContainer
->
Convert
(
&
oVmlMapper
);
}
...
...
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
View file @
5e9d676e
...
...
@@ -142,6 +142,7 @@ namespace DocFileFormat
int
_footnoteNr
;
int
_endnoteNr
;
int
_commentNr
;
bool
_isTextBoxContent
;
int
_isSectionPageBreak
;
//0 - not set, 1 -page break, 2 - continues
bool
_writeInstrText
;
bool
_writeWebHidden
;
...
...
ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp
View file @
5e9d676e
...
...
@@ -642,14 +642,18 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
""
),
TRUE
,
FALSE
);
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"w:pict"
)
);
//inline picture + bullete props
if
(
pict
.
blipStoreEntry
!=
NULL
)
{
VMLPictureMapping
oPicture
(
m_context
,
m_pXmlWriter
,
false
,
this
,
true
);
oPicture
.
m_isBullete
=
true
;
pict
.
Convert
(
&
oPicture
);
}
else
{
VMLShapeMapping
oShape
(
m_context
,
m_pXmlWriter
,
NULL
,
&
pict
,
this
,
true
);
VMLShapeMapping
oShape
(
m_context
,
m_pXmlWriter
,
NULL
,
&
pict
,
this
,
true
);
oShape
.
m_isBullete
=
true
;
pict
.
shapeContainer
->
Convert
(
&
oShape
);
}
...
...
ASCOfficeDocFile/DocDocxConverter/Spa.cpp
View file @
5e9d676e
...
...
@@ -134,10 +134,8 @@ namespace DocFileFormat
unsigned
short
flag
=
reader
->
ReadUInt16
();
pSpa
->
fHdr
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x0001
);
int
bx
=
FormatUtils
::
BitmaskToInt
(
flag
,
0x0006
);
int
by
=
FormatUtils
::
BitmaskToInt
(
flag
,
0x0018
);
pSpa
->
bx
=
(
AnchorType
)
bx
;
pSpa
->
by
=
(
AnchorType
)
by
;
pSpa
->
bx
=
(
AnchorType
)
FormatUtils
::
BitmaskToInt
(
flag
,
0x0006
);
pSpa
->
by
=
(
AnchorType
)
FormatUtils
::
BitmaskToInt
(
flag
,
0x0018
);
pSpa
->
wr
=
(
unsigned
short
)
FormatUtils
::
BitmaskToInt
(
flag
,
0x01E0
);
pSpa
->
wrk
=
(
unsigned
short
)
FormatUtils
::
BitmaskToInt
(
flag
,
0x1E00
);
pSpa
->
fRcaSimple
=
FormatUtils
::
BitmaskToBool
(
flag
,
0x2000
);
...
...
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
View file @
5e9d676e
...
...
@@ -145,6 +145,8 @@ namespace DocFileFormat
cpEnd
=
txtbxSubdocStart
+
m_document
->
TextboxBreakPlexHeader
->
CharacterPositions
[
m_nTBIndex
+
1
];
}
_isTextBoxContent
=
true
;
//convert the textbox text
_lastValidPapx
=
(
*
(
m_document
->
AllPapxFkps
->
begin
()))
->
grppapx
[
0
];
...
...
@@ -175,6 +177,7 @@ namespace DocFileFormat
cp
=
writeParagraph
(
cp
);
}
}
_isTextBoxContent
=
false
;
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
"w:txbxContent"
)
);
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
"v:textbox"
)
);
...
...
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
View file @
5e9d676e
...
...
@@ -31,9 +31,11 @@
*/
#include "VMLPictureMapping.h"
#include "VMLShapeMapping.h"
#include "OfficeDrawing/GeometryBooleanProperties.h"
#include "OfficeDrawing/GeometryTextBooleanProperties.h"
#include "OfficeDrawing/GroupShapeBooleanProperties.h"
#include "OfficeDrawing/MetafilePictBlip.h"
#include "../../DesktopEditor/common/String.h"
...
...
@@ -199,15 +201,16 @@ namespace DocFileFormat
}
}
VMLPictureMapping
::
VMLPictureMapping
(
ConversionContext
*
ctx
,
XmlUtils
::
CXmlWriter
*
writer
,
bool
olePreview
,
IMapping
*
caller
,
bool
is
Bullet
Picture
)
:
PropertiesMapping
(
writer
)
VMLPictureMapping
::
VMLPictureMapping
(
ConversionContext
*
ctx
,
XmlUtils
::
CXmlWriter
*
writer
,
bool
olePreview
,
IMapping
*
caller
,
bool
is
Inline
Picture
)
:
PropertiesMapping
(
writer
)
{
m_ctx
=
ctx
;
m_isOlePreview
=
olePreview
;
m_imageData
=
NULL
;
m_nImageId
=
0
;
m_caller
=
caller
;
m_is
BulletPicture
=
isBullet
Picture
;
m_is
InlinePicture
=
isInline
Picture
;
m_isBullete
=
false
;
m_isEquation
=
false
;
m_isEmbedded
=
false
;
...
...
@@ -232,8 +235,9 @@ namespace DocFileFormat
TwipsValue
width
(
(
pict
->
dxaGoal
-
(
pict
->
dxaCropLeft
+
pict
->
dxaCropRight
)
)
*
xScaling
);
TwipsValue
height
(
(
pict
->
dyaGoal
-
(
pict
->
dyaCropTop
+
pict
->
dyaCropBottom
)
)
*
yScaling
);
std
::
wstring
widthString
=
FormatUtils
::
DoubleToWideString
(
width
.
ToPoints
()
);
std
::
wstring
heightString
=
FormatUtils
::
DoubleToWideString
(
height
.
ToPoints
()
);
std
::
wstring
strWidth
=
FormatUtils
::
DoubleToWideString
(
width
.
ToPoints
()
);
std
::
wstring
strHeight
=
FormatUtils
::
DoubleToWideString
(
height
.
ToPoints
()
);
std
::
wstring
strStyle
;
std
::
list
<
OptionEntry
>
options
;
...
...
@@ -246,7 +250,8 @@ namespace DocFileFormat
//v:shapetype
type
.
SetType
(
shape
->
Instance
);
VMLShapeTypeMapping
*
vmlShapeTypeMapping
=
new
VMLShapeTypeMapping
(
m_pXmlWriter
,
m_isBulletPicture
);
VMLShapeTypeMapping
*
vmlShapeTypeMapping
=
new
VMLShapeTypeMapping
(
m_pXmlWriter
,
m_isInlinePicture
);
type
.
Convert
(
vmlShapeTypeMapping
);
RELEASEOBJECT
(
vmlShapeTypeMapping
);
}
...
...
@@ -258,21 +263,18 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteAttribute
(
_T
(
"type"
),
std
::
wstring
(
_T
(
"#"
)
+
VMLShapeTypeMapping
::
GenerateTypeId
(
&
type
)).
c_str
());
std
::
wstring
style
=
std
::
wstring
(
_T
(
"width:"
)
)
+
widthString
+
std
::
wstring
(
_T
(
"pt;"
)
)
+
std
::
wstring
(
_T
(
"height:"
)
)
+
heightString
+
std
::
wstring
(
_T
(
"pt;"
)
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"style"
),
style
.
c_str
()
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"id"
),
m_ShapeId
.
c_str
()
);
if
(
m_isOlePreview
)
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"o:ole"
),
_T
(
""
)
);
}
else
if
(
m_isBullet
Pictur
e
)
else
if
(
m_isBullete
)
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"o:bullet"
),
_T
(
"1"
)
);
}
//todooo oбъединить с shape_mapping
std
::
list
<
OptionEntry
>::
iterator
end
=
options
.
end
();
for
(
std
::
list
<
OptionEntry
>::
iterator
iter
=
options
.
begin
();
iter
!=
end
;
++
iter
)
{
...
...
@@ -350,9 +352,57 @@ namespace DocFileFormat
appendValueAttribute
(
m_imageData
,
_T
(
"croptop"
),
(
FormatUtils
::
IntToWideString
(
cropTop
)
+
std
::
wstring
(
_T
(
"f"
)
)
).
c_str
());
}
break
;
//------------------------------------------------------------
case
PropertyId_rotation
:
{
double
dAngle
=
(
double
)((
int
)
iter
->
op
)
/
65535.0
;
if
(
dAngle
<
-
360.0
)
dAngle
+=
360.0
;
std
::
wstring
v
=
strHeight
;
strHeight
=
strWidth
;
strWidth
=
v
;
appendStyleProperty
(
&
strStyle
,
_T
(
"rotation"
),
FormatUtils
::
DoubleToWideString
(
dAngle
));
}
break
;
case
posh
:
{
appendStyleProperty
(
&
strStyle
,
_T
(
"mso-position-horizontal"
),
VMLShapeMapping
::
mapHorizontalPosition
((
PositionHorizontal
)
iter
->
op
));
}
break
;
case
posrelh
:
{
appendStyleProperty
(
&
strStyle
,
_T
(
"mso-position-horizontal-relative"
),
VMLShapeMapping
::
mapHorizontalPositionRelative
((
PositionHorizontalRelative
)
iter
->
op
));
}
break
;
case
posv
:
{
appendStyleProperty
(
&
strStyle
,
_T
(
"mso-position-vertical"
),
VMLShapeMapping
::
mapVerticalPosition
((
PositionVertical
)
iter
->
op
));
}
break
;
case
posrelv
:
{
appendStyleProperty
(
&
strStyle
,
_T
(
"mso-position-vertical-relative"
),
VMLShapeMapping
::
mapVerticalPositionRelative
((
PositionVerticalRelative
)
iter
->
op
));
}
break
;
case
groupShapeBooleans
:
{
GroupShapeBooleanProperties
groupShapeBooleans
(
iter
->
op
);
if
(
groupShapeBooleans
.
fUsefBehindDocument
&&
groupShapeBooleans
.
fBehindDocument
)
{
//m_isInlineShape ???
//The shape is behind the text, so the z-index must be negative.
appendStyleProperty
(
&
strStyle
,
_T
(
"z-index"
),
_T
(
"-1"
)
);
}
if
(
groupShapeBooleans
.
fHidden
&&
groupShapeBooleans
.
fUsefHidden
)
{
appendStyleProperty
(
&
strStyle
,
_T
(
"visibility"
),
_T
(
"hidden"
));
}
}
break
;
}
}
strStyle
+=
_T
(
"width:"
)
+
strWidth
+
_T
(
"pt;"
)
+
_T
(
"height:"
)
+
strHeight
+
_T
(
"pt;"
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"style"
),
strStyle
.
c_str
()
);
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
""
),
TRUE
,
FALSE
);
if
(
CopyPicture
(
pict
))
...
...
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
View file @
5e9d676e
...
...
@@ -51,7 +51,7 @@ namespace DocFileFormat
class
VMLPictureMapping
:
public
PropertiesMapping
,
public
IMapping
{
public:
VMLPictureMapping
(
ConversionContext
*
ctx
,
XmlUtils
::
CXmlWriter
*
writer
,
bool
olePreview
,
IMapping
*
caller
,
bool
is
Bullet
Picture
=
false
);
VMLPictureMapping
(
ConversionContext
*
ctx
,
XmlUtils
::
CXmlWriter
*
writer
,
bool
olePreview
,
IMapping
*
caller
,
bool
is
Inline
Picture
=
false
);
virtual
~
VMLPictureMapping
();
virtual
void
Apply
(
IVisitable
*
visited
);
std
::
wstring
GetShapeId
()
const
;
...
...
@@ -70,6 +70,7 @@ namespace DocFileFormat
static
std
::
wstring
GetTargetExt
(
Global
::
BlipType
nType
);
static
std
::
wstring
GetContentType
(
Global
::
BlipType
nType
);
bool
m_isBullete
;
bool
m_isEquation
;
bool
m_isEmbedded
;
std
::
string
m_embeddedData
;
...
...
@@ -81,9 +82,9 @@ namespace DocFileFormat
int
m_nImageId
;
std
::
wstring
m_ShapeId
;
bool
m_isOlePreview
;
bool
m_isBulletPicture
;
bool
m_isOlePreview
;
bool
m_isInlinePicture
;
XMLTools
::
XMLElement
<
wchar_t
>*
m_imageData
;
};
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
View file @
5e9d676e
...
...
@@ -58,9 +58,10 @@
namespace
DocFileFormat
{
VMLShapeMapping
::
VMLShapeMapping
(
ConversionContext
*
pConv
,
XmlUtils
::
CXmlWriter
*
pWriter
,
Spa
*
pSpa
,
PictureDescriptor
*
pPicture
,
IMapping
*
pCaller
,
bool
bullet
)
:
PropertiesMapping
(
pWriter
)
VMLShapeMapping
::
VMLShapeMapping
(
ConversionContext
*
pConv
,
XmlUtils
::
CXmlWriter
*
pWriter
,
Spa
*
pSpa
,
PictureDescriptor
*
pPicture
,
IMapping
*
pCaller
,
bool
isInlineShape
)
:
PropertiesMapping
(
pWriter
)
{
m_bBullet
=
bullet
;
m_isInlineShape
=
isInlineShape
;
m_isBullete
=
false
;
m_pSpa
=
pSpa
;
m_pCaller
=
pCaller
;
...
...
@@ -242,7 +243,7 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteAttribute
(
_T
(
"to"
),
GetLineTo
(
pAnchor
).
c_str
());
}
if
(
m_
bBullet
)
if
(
m_
isBullete
)
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"o:bullet"
),
_T
(
"t"
));
}
...
...
@@ -1086,7 +1087,7 @@ namespace DocFileFormat
WriteEndShapeNode
(
pShape
);
//ShapeType
if
(
NULL
!=
pShape
->
GetShapeType
()
&&
!
m_
bBullet
)
if
(
NULL
!=
pShape
->
GetShapeType
()
&&
!
m_
isInlineShape
)
//bullete only???
{
VMLShapeTypeMapping
oXmlMapper
(
m_pXmlWriter
);
pShape
->
GetShapeType
()
->
Convert
(
&
oXmlMapper
);
...
...
@@ -1482,7 +1483,7 @@ namespace DocFileFormat
}
}
std
::
wstring
VMLShapeMapping
::
mapVerticalPosition
(
PositionVertical
vPos
)
const
std
::
wstring
VMLShapeMapping
::
mapVerticalPosition
(
static
const
PositionVertical
&
vPos
)
{
switch
(
vPos
)
{
...
...
@@ -1497,7 +1498,7 @@ namespace DocFileFormat
}
}
std
::
wstring
VMLShapeMapping
::
mapVerticalPositionRelative
(
int
vRel_
)
const
std
::
wstring
VMLShapeMapping
::
mapVerticalPositionRelative
(
const
int
&
vRel_
)
{
PositionVerticalRelative
vRel
=
(
PositionVerticalRelative
)
vRel_
;
switch
(
vRel
)
...
...
@@ -1511,7 +1512,7 @@ namespace DocFileFormat
}
}
std
::
wstring
VMLShapeMapping
::
mapHorizontalPosition
(
PositionHorizontal
hPos
)
const
std
::
wstring
VMLShapeMapping
::
mapHorizontalPosition
(
const
PositionHorizontal
&
hPos
)
{
switch
(
hPos
)
{
...
...
@@ -1526,7 +1527,7 @@ namespace DocFileFormat
}
}
std
::
wstring
VMLShapeMapping
::
mapHorizontalPositionRelative
(
int
hRel_
)
const
std
::
wstring
VMLShapeMapping
::
mapHorizontalPositionRelative
(
const
int
&
hRel_
)
{
PositionHorizontalRelative
hRel
=
(
PositionHorizontalRelative
)
hRel_
;
switch
(
hRel
)
...
...
@@ -1553,37 +1554,28 @@ namespace DocFileFormat
{
switch
(
iter
->
pid
)
{
// POSITIONING
// POSITIONING
case
posh
:
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-position-horizontal"
),
mapHorizontalPosition
((
PositionHorizontal
)
iter
->
op
));
bPosH
=
true
;
}
break
;
}
break
;
case
posrelh
:
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-position-horizontal-relative"
),
mapHorizontalPositionRelative
((
PositionHorizontalRelative
)
iter
->
op
));
bRelH
=
true
;
}
break
;
}
break
;
case
posv
:
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-position-vertical"
),
mapVerticalPosition
((
PositionVertical
)
iter
->
op
));
bPosV
=
true
;
}
break
;
}
break
;
case
posrelv
:
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-position-vertical-relative"
),
mapVerticalPositionRelative
((
PositionVerticalRelative
)
iter
->
op
));
bRelV
=
true
;
}
break
;
// BOOLEANS
}
break
;
// BOOLEANS
case
groupShapeBooleans
:
{
GroupShapeBooleanProperties
groupShapeBooleans
(
iter
->
op
);
...
...
@@ -1598,11 +1590,8 @@ namespace DocFileFormat
{
appendStyleProperty
(
oStyle
,
_T
(
"visibility"
),
_T
(
"hidden"
));
}
}
break
;
// GEOMETRY
}
break
;
// GEOMETRY
case
PropertyId_rotation
:
{
double
dAngle
=
(
double
)((
int
)
iter
->
op
)
/
65535.0
;
...
...
@@ -1610,45 +1599,30 @@ namespace DocFileFormat
if
(
dAngle
<
-
360.0
)
dAngle
+=
360.0
;
// //ATLTRACE (L"angle : %f\n", dAngle);
appendStyleProperty
(
oStyle
,
_T
(
"rotation"
),
FormatUtils
::
DoubleToWideString
(
dAngle
));
}
break
;
// TEXTBOX
}
break
;
// TEXTBOX
case
anchorText
:
{
appendStyleProperty
(
oStyle
,
_T
(
"v-text-anchor"
),
getTextboxAnchor
(
iter
->
op
));
}
break
;
// WRAP DISTANCE
}
break
;
// WRAP DISTANCE
case
dxWrapDistLeft
:
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-wrap-distance-left"
),
(
FormatUtils
::
DoubleToWideString
(
EmuValue
((
int
)
iter
->
op
).
ToPoints
())
+
std
::
wstring
(
_T
(
"pt"
))));
}
break
;
}
break
;
case
dxWrapDistRight
:
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-wrap-distance-right"
),
(
FormatUtils
::
DoubleToWideString
(
EmuValue
((
int
)
iter
->
op
).
ToPoints
())
+
std
::
wstring
(
_T
(
"pt"
))));
}
break
;
}
break
;
case
dyWrapDistBottom
:
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-wrap-distance-bottom"
),
(
FormatUtils
::
DoubleToWideString
(
EmuValue
((
int
)
iter
->
op
).
ToPoints
())
+
std
::
wstring
(
_T
(
"pt"
))));
}
break
;
}
break
;
case
dyWrapDistTop
:
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-wrap-distance-top"
),
(
FormatUtils
::
DoubleToWideString
(
EmuValue
((
int
)
iter
->
op
).
ToPoints
())
+
std
::
wstring
(
_T
(
"pt"
))));
}
break
;
}
break
;
}
}
...
...
@@ -1661,14 +1635,14 @@ namespace DocFileFormat
appendStyleProperty
(
oStyle
,
_T
(
"mso-position-vertical-relative"
),
mapVerticalPositionRelative
(
m_pSpa
->
bx
));
}
if
(
!
bPosH
)
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-position-horizontal"
),
_T
(
"absolute"
));
}
if
(
!
bPosV
)
{
appendStyleProperty
(
oStyle
,
_T
(
"mso-position-vertical"
),
_T
(
"absolute"
));
}
//
if (!bPosH)
//
{
//
appendStyleProperty(oStyle, _T("mso-position-horizontal"), _T( "absolute" ));
//
}
//
if (!bPosV)
//
{
//
appendStyleProperty(oStyle, _T("mso-position-vertical"), _T( "absolute" ));
//
}
}
//
...
...
@@ -1762,7 +1736,10 @@ namespace DocFileFormat
AppendOptionsToStyle
(
&
style
,
options
);
if
(
!
this
->
m_bBullet
)
appendStyleProperty
(
&
style
,
_T
(
"z-index"
),
FormatUtils
::
IntToWideString
(
zIndex
+
0x7ffff
));
if
(
!
m_isInlineShape
)
{
appendStyleProperty
(
&
style
,
_T
(
"z-index"
),
FormatUtils
::
IntToWideString
(
zIndex
+
0x7ffff
));
}
return
style
;
}
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
View file @
5e9d676e
...
...
@@ -63,6 +63,12 @@ namespace DocFileFormat
virtual
~
VMLShapeMapping
();
virtual
void
Apply
(
IVisitable
*
visited
);
static
std
::
wstring
mapVerticalPosition
(
static
const
PositionVertical
&
vPos
);
static
std
::
wstring
mapVerticalPositionRelative
(
static
const
int
&
vRel
);
static
std
::
wstring
mapHorizontalPosition
(
static
const
PositionHorizontal
&
hPos
);
static
std
::
wstring
mapHorizontalPositionRelative
(
static
const
int
&
hRel
);
bool
m_isBullete
;
private:
void
ApplyPrimitives
(
DrawingPrimitives
*
primitives
);
...
...
@@ -90,12 +96,7 @@ namespace DocFileFormat
void
appendStyleProperty
(
std
::
wstring
*
b
,
const
std
::
wstring
&
propName
,
const
std
::
wstring
&
propValue
)
const
;
std
::
wstring
getTextboxAnchor
(
unsigned
int
anchor
)
const
;
std
::
wstring
mapVerticalPosition
(
PositionVertical
vPos
)
const
;
std
::
wstring
mapVerticalPositionRelative
(
int
vRel
)
const
;
std
::
wstring
mapHorizontalPosition
(
PositionHorizontal
hPos
)
const
;
std
::
wstring
mapHorizontalPositionRelative
(
int
hRel
)
const
;
void
AppendOptionsToStyle
(
std
::
wstring
*
style
,
const
std
::
list
<
OptionEntry
>&
options
)
const
;
std
::
wstring
buildStyle
(
const
Shape
*
shape
,
const
ChildAnchor
*
anchor
,
const
std
::
list
<
OptionEntry
>&
options
,
int
zIndex
)
const
;
...
...
@@ -122,7 +123,7 @@ namespace DocFileFormat
std
::
vector
<
CString
>
GetTextRectangles
(
const
OptionEntry
&
inscribe
)
const
;
private:
bool
m_
bBullet
;
bool
m_
isInlineShape
;
Spa
*
m_pSpa
;
IMapping
*
m_pCaller
;
BlipStoreContainer
*
m_pBlipStore
;
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp
View file @
5e9d676e
...
...
@@ -35,7 +35,7 @@
namespace
DocFileFormat
{
VMLShapeTypeMapping
::
VMLShapeTypeMapping
(
XmlUtils
::
CXmlWriter
*
pWriter
,
bool
is
BulletPicture
)
:
PropertiesMapping
(
pWriter
),
_lock
(
NULL
),
_isBulletPicture
(
isBulletPictur
e
)
VMLShapeTypeMapping
::
VMLShapeTypeMapping
(
XmlUtils
::
CXmlWriter
*
pWriter
,
bool
is
InlineShape
)
:
PropertiesMapping
(
pWriter
),
_lock
(
NULL
),
_isInlineShape
(
isInlineShap
e
)
{
this
->
_lock
=
new
XMLTools
::
XMLElement
<
wchar_t
>
(
_T
(
"o:lock"
)
);
appendValueAttribute
(
this
->
_lock
,
_T
(
"v:ext"
),
_T
(
"edit"
)
);
...
...
@@ -72,7 +72,7 @@ namespace DocFileFormat
// Path
if
(
!
pShape
->
Path
.
empty
())
m_pXmlWriter
->
WriteAttribute
(
_T
(
"path"
),
pShape
->
Path
.
c_str
()
);
else
if
(
_is
BulletPictur
e
)
else
if
(
_is
InlineShap
e
)
m_pXmlWriter
->
WriteAttribute
(
_T
(
"path"
),
_T
(
"m@4@5l@4@11@9@11@9@5xe"
));
...
...
@@ -87,7 +87,7 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteAttribute
(
_T
(
"stroked"
),
_T
(
"f"
)
);
}
if
(
_is
BulletPictur
e
)
if
(
_is
InlineShap
e
)
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"o:preferrelative"
),
_T
(
"t"
)
);
}
...
...
@@ -120,7 +120,7 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
"v:formulas"
)
);
}
else
if
(
_is
BulletPictur
e
)
else
if
(
_is
InlineShap
e
)
{
m_pXmlWriter
->
WriteString
(
_T
(
"<v:formulas><v:f eqn=
\"
if lineDrawn pixelLineWidth 0
\"
/>\
<v:f eqn=
\"
sum @0 1 0
\"
/><v:f eqn=
\"
sum 0 0 @1
\"
/>\
...
...
@@ -134,7 +134,7 @@ namespace DocFileFormat
// Path
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"v:path"
),
true
);
if
(
_is
BulletPictur
e
)
if
(
_is
InlineShap
e
)
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"o:extrusionok"
),
_T
(
"f"
)
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"gradientshapeok"
),
_T
(
"t"
)
);
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h
View file @
5e9d676e
...
...
@@ -41,10 +41,10 @@ namespace DocFileFormat
{
private:
XMLTools
::
XMLElement
<
wchar_t
>
*
_lock
;
bool
_is
BulletPictur
e
;
bool
_is
InlineShap
e
;
public:
VMLShapeTypeMapping
(
XmlUtils
::
CXmlWriter
*
writer
,
bool
is
BulletPictur
e
=
false
);
VMLShapeTypeMapping
(
XmlUtils
::
CXmlWriter
*
writer
,
bool
is
InlineShap
e
=
false
);
virtual
~
VMLShapeTypeMapping
();
virtual
void
Apply
(
IVisitable
*
visited
);
/// Returns the id of the referenced type
...
...
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