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
8db0107a
Commit
8db0107a
authored
Aug 29, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RtfFormatReader - fix bug 5518
parent
6d83c2fc
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
243 additions
and
46 deletions
+243
-46
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
+115
-4
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
+101
-16
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
...le/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
+2
-2
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureAnchorReader.h
...fFile/RtfFormatLib/source/Reader/OOXPictureAnchorReader.h
+3
-3
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureGraphicReader.h
...File/RtfFormatLib/source/Reader/OOXPictureGraphicReader.h
+0
-1
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureInlineReader.h
...fFile/RtfFormatLib/source/Reader/OOXPictureInlineReader.h
+5
-5
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
...ficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
+2
-2
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.cpp
+8
-7
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h
+1
-1
ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.cpp
+1
-1
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp
+5
-4
No files found.
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
View file @
8db0107a
...
...
@@ -650,6 +650,104 @@ bool RtfShadingCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReade
return
false
;
return
true
;
}
bool
OldShapeReader
::
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
{
if
(
L"do"
==
sCommand
)
return
true
;
else
if
(
L"doinst"
==
sCommand
)
return
true
;
else
if
(
L"dorslt"
==
sCommand
)
return
false
;
else
if
(
L"picprop"
==
sCommand
)
return
true
;
//-------------------------------------------------------- type primitives
else
if
(
L"dprect"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptRectangle
;
else
if
(
L"dpline"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptLine
;
else
if
(
L"dpellipse"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptEllipse
;
else
if
(
L"dparc"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptArc
;
else
if
(
L"dppolyline"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptNotPrimitive
;
else
if
(
L"dppolygon"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptNotPrimitive
;
else
if
(
L"dpcallout"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptTextBox
;
else
if
(
L"dptxbx"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptTextBox
;
else
if
(
L"dproundr"
==
sCommand
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptRoundRectangle
;
else
if
(
L"dptxbxtext"
==
sCommand
)
{
if
(
PROP_DEF
==
m_oShape
.
m_nShapeType
)
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptTextBox
;
ParagraphReader
oParagraphReader
(
_T
(
"shptxt"
),
oReader
);
StartSubReader
(
oParagraphReader
,
oDocument
,
oReader
);
m_oShape
.
m_aTextItems
=
oParagraphReader
.
m_oParPropDest
.
m_oTextItems
;
}
//else if( L"shpbxignore" == sCommand )
// m_oShape.m_eXAnchor = RtfShape::ax_ignore;
else
if
(
L"dobxpage"
==
sCommand
)
m_oShape
.
m_eXAnchor
=
RtfShape
::
ax_page
;
else
if
(
L"dobxmargin"
==
sCommand
)
m_oShape
.
m_eXAnchor
=
RtfShape
::
ax_margin
;
else
if
(
L"dobxcolumn"
==
sCommand
)
m_oShape
.
m_eXAnchor
=
RtfShape
::
ax_column
;
//else if( L"shpbyignore" == sCommand )
// m_oShape.m_eYAnchor = RtfShape::ay_ignore;
else
if
(
L"dobypage"
==
sCommand
)
m_oShape
.
m_eYAnchor
=
RtfShape
::
ay_page
;
else
if
(
L"dobymargin"
==
sCommand
)
m_oShape
.
m_eYAnchor
=
RtfShape
::
ay_margin
;
else
if
(
L"dobypara"
==
sCommand
)
m_oShape
.
m_eYAnchor
=
RtfShape
::
ay_Para
;
else
if
(
L"dolockanchor"
==
sCommand
)
m_oShape
.
m_bLockAnchor
=
true
;
else
if
(
L"dplinehollow"
==
sCommand
)
m_oShape
.
m_bLine
=
false
;
else
if
(
true
==
hasParameter
)
{
if
(
L"dpx"
==
sCommand
)
m_oShape
.
m_nLeft
=
parameter
;
else
if
(
L"dpx"
==
sCommand
)
m_oShape
.
m_nLeft
=
parameter
;
else
if
(
L"dpy"
==
sCommand
)
m_oShape
.
m_nTop
=
parameter
;
else
if
(
L"dpysize"
==
sCommand
)
m_oShape
.
m_nBottom
=
parameter
+
m_oShape
.
m_nTop
;
else
if
(
L"dpxsize"
==
sCommand
)
m_oShape
.
m_nRight
=
parameter
+
m_oShape
.
m_nLeft
;
else
if
(
L"doz"
==
sCommand
)
m_oShape
.
m_nZOrder
=
parameter
;
else
if
(
L"dofhdr"
==
sCommand
)
m_oShape
.
m_nHeader
=
parameter
;
else
if
(
L"dowr"
==
sCommand
)
m_oShape
.
m_nWrapType
=
parameter
;
else
if
(
L"dowrk"
==
sCommand
)
m_oShape
.
m_nWrapSideType
=
parameter
;
else
if
(
L"dofblwtxt"
==
sCommand
)
m_oShape
.
m_nZOrderRelative
=
parameter
;
else
if
(
L"dplinew"
==
sCommand
)
m_oShape
.
m_nLineWidth
=
parameter
;
else
if
(
L"dodhgt"
==
sCommand
)
m_oShape
.
m_nZOrder
=
parameter
;
else
if
(
L"dpfillpat"
==
sCommand
)
{
m_oShape
.
m_nFillType
=
parameter
;
if
(
m_oShape
.
m_nFillType
==
0
)
m_oShape
.
m_bFilled
=
false
;
}
}
else
{
return
false
;
}
return
true
;
}
bool
ShapeReader
::
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
)
{
if
(
_T
(
"shp"
)
==
sCommand
)
...
...
@@ -1007,6 +1105,9 @@ bool PictureReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CS
m_oShape
.
m_oPicture
->
eDataType
=
RtfPicture
::
dt_png
;
else
if
(
_T
(
"jpegblip"
)
==
sCommand
)
m_oShape
.
m_oPicture
->
eDataType
=
RtfPicture
::
dt_jpg
;
else
if
(
_T
(
"macpict"
)
==
sCommand
)
m_oShape
.
m_oPicture
->
eDataType
=
RtfPicture
::
dt_macpict
;
else
if
(
_T
(
"wmetafile"
)
==
sCommand
)
{
if
(
true
==
hasParameter
&&
8
==
parameter
)
...
...
@@ -1887,6 +1988,14 @@ bool ParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfReader&
if
(
true
==
oNewShape
->
IsValid
()
)
m_oCurParagraph
->
AddItem
(
oNewShape
);
}
else
if
(
_T
(
"do"
)
==
sCommand
)
{
RtfShapePtr
oNewShape
(
new
RtfShape
()
);
OldShapeReader
oShapeReader
(
*
oNewShape
);
oAbstrReader
.
StartSubReader
(
oShapeReader
,
oDocument
,
oReader
);
if
(
true
==
oNewShape
->
IsValid
()
)
m_oCurParagraph
->
AddItem
(
oNewShape
);
}
else
if
(
_T
(
"shppict"
)
==
sCommand
)
{
RtfShapePtr
oNewShape
(
new
RtfShape
()
);
...
...
@@ -1898,15 +2007,17 @@ bool ParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfReader&
else
if
(
_T
(
"pict"
)
==
sCommand
)
{
RtfShapePtr
oNewShape
(
new
RtfShape
()
);
oNewShape
->
m_nShapeType
=
75
;
oNewShape
->
m_nWrapType
=
3
;
// none
oNewShape
->
m_nShapeType
=
NSOfficeDrawing
::
sptPictureFrame
;
oNewShape
->
m_nWrapType
=
3
;
// none
oNewShape
->
m_nPositionHRelative
=
3
;
//TCHAR
oNewShape
->
m_nPositionVRelative
=
3
;
//line
oNewShape
->
m_nPositionH
=
0
;
//absolute
oNewShape
->
m_nPositionV
=
0
;
//absolute
oNewShape
->
m_nPositionH
=
0
;
//absolute
oNewShape
->
m_nPositionV
=
0
;
//absolute
oNewShape
->
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
PictureReader
oPictureReader
(
oReader
,
*
oNewShape
);
oAbstrReader
.
StartSubReader
(
oPictureReader
,
oDocument
,
oReader
);
if
(
true
==
oNewShape
->
IsValid
()
)
m_oCurParagraph
->
AddItem
(
oNewShape
);
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
View file @
8db0107a
...
...
@@ -44,6 +44,8 @@
#include "Writer/OOXWriter.h"
#include "Writer/OOXRelsWriter.h"
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Enums.h"
#define COMMAND_RTF_BOOL( pattern, target, command, hasParameter, parameter )\
else
if
(
pattern
==
command
)
\
{
\
...
...
@@ -943,14 +945,16 @@ public:
class
ShapeReader
:
public
RtfAbstractReader
{
public:
class
ShapePropertyReader
:
public
RtfAbstractReader
{
public:
class
ShapePropertyValueReader
:
public
RtfAbstractReader
{
CString
&
m_sPropName
;
CString
m_sPropValue
;
RtfShape
&
m_oShape
;
public:
CString
m_sPropValue
;
ShapePropertyValueReader
(
CString
&
sPropName
,
RtfShape
&
oShape
)
:
m_sPropName
(
sPropName
),
m_oShape
(
oShape
)
{
}
...
...
@@ -1112,6 +1116,85 @@ public:
return
true
;
}
};
class
OldShapeReader
:
public
RtfAbstractReader
{
private:
RtfShape
&
m_oShape
;
public:
OldShapeReader
(
RtfShape
&
oShape
)
:
m_oShape
(
oShape
)
{
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
);
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
//если задан поворот, то надо повернуть и исходный rect, если угол от 45 до 135 и от 225 до 315
if
(
(
PROP_DEF
!=
m_oShape
.
m_nRotation
||
PROP_DEF
!=
m_oShape
.
m_nRelRotation
)
&&
((
PROP_DEF
!=
m_oShape
.
m_nLeft
&&
PROP_DEF
!=
m_oShape
.
m_nTop
&&
PROP_DEF
!=
m_oShape
.
m_nBottom
&&
PROP_DEF
!=
m_oShape
.
m_nRight
)
||
(
PROP_DEF
!=
m_oShape
.
m_nRelLeft
&&
PROP_DEF
!=
m_oShape
.
m_nRelTop
&&
PROP_DEF
!=
m_oShape
.
m_nRelRight
&&
PROP_DEF
!=
m_oShape
.
m_nRelBottom
)
)
)
{
int
nAngel
=
0
;
// в градусах
if
(
PROP_DEF
!=
m_oShape
.
m_nRotation
)
nAngel
=
m_oShape
.
m_nRotation
/
65536
;
else
nAngel
=
m_oShape
.
m_nRelRotation
/
65536
;
int
nSourceAngel
=
nAngel
;
// в градусах
bool
bRel
=
false
;
int
nLeft
;
int
nRight
;
int
nTop
;
int
nBottom
;
if
(
PROP_DEF
!=
m_oShape
.
m_nLeft
)
{
nLeft
=
m_oShape
.
m_nLeft
;
nRight
=
m_oShape
.
m_nRight
;
nTop
=
m_oShape
.
m_nTop
;
nBottom
=
m_oShape
.
m_nBottom
;
}
else
{
bRel
=
true
;
nLeft
=
m_oShape
.
m_nRelLeft
;
nRight
=
m_oShape
.
m_nRelRight
;
nTop
=
m_oShape
.
m_nRelTop
;
nBottom
=
m_oShape
.
m_nRelBottom
;
}
//поворачиваем на 45 градусов
nAngel
-=
45
;
//делаем угол от 0 до 360
nAngel
=
nAngel
%
360
;
if
(
nAngel
<
0
)
nAngel
+=
360
;
int
nQuater
=
nAngel
/
90
;
// определяем четверть
if
(
0
==
nQuater
||
2
==
nQuater
)
{
//поворачиваем относительно центра на 90 градусов обратно
int
nCenterX
=
(
nLeft
+
nRight
)
/
2
;
int
nCenterY
=
(
nTop
+
nBottom
)
/
2
;
int
nWidth
=
nRight
-
nLeft
;
int
nHeight
=
nBottom
-
nTop
;
if
(
true
==
bRel
)
{
m_oShape
.
m_nRelLeft
=
nCenterX
-
nHeight
/
2
;
m_oShape
.
m_nRelRight
=
nCenterX
+
nHeight
/
2
;
m_oShape
.
m_nRelTop
=
nCenterY
-
nWidth
/
2
;
m_oShape
.
m_nRelBottom
=
nCenterY
+
nWidth
/
2
;
}
else
{
m_oShape
.
m_nLeft
=
nCenterX
-
nHeight
/
2
;
m_oShape
.
m_nRight
=
nCenterX
+
nHeight
/
2
;
m_oShape
.
m_nTop
=
nCenterY
-
nWidth
/
2
;
m_oShape
.
m_nBottom
=
nCenterY
+
nWidth
/
2
;
}
}
}
}
};
class
ShppictReader
:
public
RtfAbstractReader
{
private:
...
...
@@ -1126,13 +1209,14 @@ public:
return
true
;
else
if
(
_T
(
"pict"
)
==
sCommand
)
{
m_oShape
.
m_eAnchorTypeShape
=
RtfShape
::
st_inline
;
m_oShape
.
m_nShapeType
=
75
;
m_oShape
.
m_nWrapType
=
3
;
// none
m_oShape
.
m_nPositionHRelative
=
3
;
//TCHAR
m_oShape
.
m_nPositionVRelative
=
3
;
//line
m_oShape
.
m_nPositionH
=
0
;
//absolute
m_oShape
.
m_nPositionV
=
0
;
//absolute
m_oShape
.
m_eAnchorTypeShape
=
RtfShape
::
st_inline
;
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptPictureFrame
;
m_oShape
.
m_nWrapType
=
3
;
// none
m_oShape
.
m_nPositionHRelative
=
3
;
//TCHAR
m_oShape
.
m_nPositionVRelative
=
3
;
//line
m_oShape
.
m_nPositionH
=
0
;
//absolute
m_oShape
.
m_nPositionV
=
0
;
//absolute
m_oShape
.
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
PictureReader
oPictureReader
(
oReader
,
m_oShape
);
StartSubReader
(
oPictureReader
,
oDocument
,
oReader
);
...
...
@@ -1165,14 +1249,15 @@ public:
}
else
if
(
_T
(
"pict"
)
==
sCommand
)
{
m_oShape
.
m_eAnchorTypeShape
=
RtfShape
::
st_inline
;
m_oShape
.
m_nShapeType
=
75
;
m_oShape
.
m_nWrapType
=
3
;
// none
m_oShape
.
m_nPositionHRelative
=
3
;
//TCHAR
m_oShape
.
m_nPositionVRelative
=
3
;
//line
m_oShape
.
m_nPositionH
=
0
;
//absolute
m_oShape
.
m_nPositionV
=
0
;
//absolute
m_oShape
.
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
m_oShape
.
m_eAnchorTypeShape
=
RtfShape
::
st_inline
;
m_oShape
.
m_nShapeType
=
NSOfficeDrawing
::
sptPictureFrame
;
m_oShape
.
m_nWrapType
=
3
;
// none
m_oShape
.
m_nPositionHRelative
=
3
;
//TCHAR
m_oShape
.
m_nPositionVRelative
=
3
;
//line
m_oShape
.
m_nPositionH
=
0
;
//absolute
m_oShape
.
m_nPositionV
=
0
;
//absolute
m_oShape
.
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
PictureReader
oPictureReader
(
oReader
,
m_oShape
);
StartSubReader
(
oPictureReader
,
oDocument
,
oReader
);
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
View file @
8db0107a
...
...
@@ -81,7 +81,7 @@ bool OOXPictureGraphicReader::Parse( ReaderParameter oParam , RtfShape& oOutput)
if
(
!
bTryPicture
)
{
return
false
;
//
return false;
//рисуем крест (todooo получать с редактора реплейсмент картинку)
oOutput
.
m_nShapeType
=
1
;
oOutput
.
m_nFillColor
=
0x967bdf
;
...
...
@@ -89,7 +89,7 @@ bool OOXPictureGraphicReader::Parse( ReaderParameter oParam , RtfShape& oOutput)
}
else
{
return
false
;
//
return false;
//convertDrawingML2Vml();
oOutput
.
m_nShapeType
=
1
;
oOutput
.
m_nFillColor
=
0x967bdf
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureAnchorReader.h
View file @
8db0107a
...
...
@@ -47,9 +47,9 @@ public:
{
if
(
m_ooxAnchor
==
NULL
)
return
false
;
oOutput
.
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
oOutput
.
m_eAnchorTypeShape
=
RtfShape
::
st_anchor
;
oOutput
.
m_nShapeType
=
75
;
oOutput
.
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
oOutput
.
m_eAnchorTypeShape
=
RtfShape
::
st_anchor
;
oOutput
.
m_nShapeType
=
75
;
//NSOfficeDrawing::sptPictureFrame
;
oOutput
.
m_bAllowOverlap
=
m_ooxAnchor
->
m_oAllowOverlap
.
IsInit
()
?
m_ooxAnchor
->
m_oAllowOverlap
->
ToBool
()
:
false
;
oOutput
.
m_nZOrderRelative
=
m_ooxAnchor
->
m_oBehindDoc
.
IsInit
()
?
m_ooxAnchor
->
m_oBehindDoc
->
ToBool
()
:
false
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureGraphicReader.h
View file @
8db0107a
...
...
@@ -36,7 +36,6 @@
#include "../RtfPicture.h"
#include "../../../../DesktopEditor/raster/BgraFrame.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Drawing/Drawing.h"
#define PICTURE_BUFFER_SIZE 1024
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureInlineReader.h
View file @
8db0107a
...
...
@@ -45,11 +45,11 @@ public:
{
if
(
m_ooxInline
==
NULL
)
return
false
;
oOutput
.
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
oOutput
.
m_eAnchorTypeShape
=
RtfShape
::
st_inline
;
oOutput
.
m_nShapeType
=
75
;
oOutput
.
m_nLeft
=
0
;
oOutput
.
m_nTop
=
0
;
oOutput
.
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
oOutput
.
m_eAnchorTypeShape
=
RtfShape
::
st_inline
;
oOutput
.
m_nShapeType
=
75
;
//NSOfficeDrawing::sptPictureFrame
;
oOutput
.
m_nLeft
=
0
;
oOutput
.
m_nTop
=
0
;
oOutput
.
m_nPositionHRelative
=
3
;
oOutput
.
m_nPositionVRelative
=
3
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
View file @
8db0107a
...
...
@@ -354,9 +354,9 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
if
(
oFile
.
IsInit
()
&&
(
OOX
::
FileTypes
::
Image
==
oFile
->
type
()))
{
oOutput
->
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
oOutput
->
m_oPicture
=
RtfPicturePtr
(
new
RtfPicture
()
);
oOutput
->
m_eAnchorTypeShape
=
RtfShape
::
st_none
;
oOutput
->
m_nShapeType
=
75
;
oOutput
->
m_nShapeType
=
NSOfficeDrawing
::
sptPictureFrame
;
OOX
::
Image
*
pImage
=
(
OOX
::
Image
*
)
oFile
.
operator
->
();
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.cpp
View file @
8db0107a
...
...
@@ -119,18 +119,19 @@ CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter)
if
(
false
==
IsValid
()
)
return
_T
(
""
);
OOXWriter
*
poOOXWriter
=
static_cast
<
OOXWriter
*>
(
oRenderParameter
.
poWriter
);
OOXRelsWriter
*
poRelsWriter
=
static_cast
<
OOXRelsWriter
*>
(
oRenderParameter
.
poRels
);
RtfDocument
*
poRtfDocument
=
static_cast
<
RtfDocument
*>
(
oRenderParameter
.
poDocument
);
OOXWriter
*
poOOXWriter
=
static_cast
<
OOXWriter
*>
(
oRenderParameter
.
poWriter
);
OOXRelsWriter
*
poRelsWriter
=
static_cast
<
OOXRelsWriter
*>
(
oRenderParameter
.
poRels
);
RtfDocument
*
poRtfDocument
=
static_cast
<
RtfDocument
*>
(
oRenderParameter
.
poDocument
);
CString
sExtension
;
CString
sMime
;
switch
(
eDataType
)
{
case
dt_png
:
sExtension
=
_T
(
"png"
);
sMime
=
_T
(
"image/png"
);
break
;
case
dt_jpg
:
sExtension
=
_T
(
"jpg"
);
sMime
=
_T
(
"image/jpg"
);
break
;
case
dt_wmf
:
sExtension
=
_T
(
"wmf"
);
sMime
=
_T
(
"image/x-wmf"
);
break
;
case
dt_emf
:
sExtension
=
_T
(
"emf"
);
sMime
=
_T
(
"image/x-emf"
);
break
;
case
dt_png
:
sExtension
=
_T
(
"png"
);
sMime
=
_T
(
"image/png"
);
break
;
case
dt_jpg
:
sExtension
=
_T
(
"jpg"
);
sMime
=
_T
(
"image/jpg"
);
break
;
case
dt_wmf
:
sExtension
=
_T
(
"wmf"
);
sMime
=
_T
(
"image/x-wmf"
);
break
;
case
dt_emf
:
sExtension
=
_T
(
"emf"
);
sMime
=
_T
(
"image/x-emf"
);
break
;
case
dt_macpict
:
sExtension
=
_T
(
"pct"
);
sMime
=
_T
(
"image/x-pict"
);
break
;
}
CString
sFilenameRels
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h
View file @
8db0107a
...
...
@@ -37,7 +37,7 @@
class
RtfPicture
:
public
IDocumentElement
{
public:
typedef
enum
{
dt_none
,
dt_png
,
dt_jpg
,
dt_emf
,
dt_wmf
,
dt_apm
}
DataType
;
typedef
enum
{
dt_none
,
dt_png
,
dt_jpg
,
dt_emf
,
dt_wmf
,
dt_apm
,
dt_macpict
}
DataType
;
// RtfShape m_oShapeProp;
DataType
eDataType
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.cpp
View file @
8db0107a
...
...
@@ -821,7 +821,7 @@ CString RtfSectionProperty::SaveFile( TextItemContainerPtr oTarget, RenderParame
sContent
+=
_T
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
standalone=
\"
yes
\"
?>
\n
"
);
sContent
+=
_T
(
"<"
);
sContent
+=
sRootName
;
sContent
+=
_T
(
"xmlns:ve=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
xmlns:o=
\"
urn:schemas-microsoft-com:office:office
\"
xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
xmlns:v=
\"
urn:schemas-microsoft-com:vml
\"
xmlns:wp=
\"
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing
\"
xmlns:w10=
\"
urn:schemas-microsoft-com:office:word
\"
xmlns:w=
\"
http://schemas.openxmlformats.org/wordprocessingml/2006/main
\"
xmlns:wne=
\"
http://schemas.microsoft.com/office/word/2006/wordml
\"
>"
);
sContent
+=
_T
(
"
xmlns:ve=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
xmlns:o=
\"
urn:schemas-microsoft-com:office:office
\"
xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
xmlns:v=
\"
urn:schemas-microsoft-com:vml
\"
xmlns:wp=
\"
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing
\"
xmlns:w10=
\"
urn:schemas-microsoft-com:office:word
\"
xmlns:w=
\"
http://schemas.openxmlformats.org/wordprocessingml/2006/main
\"
xmlns:wne=
\"
http://schemas.microsoft.com/office/word/2006/wordml
\"
>"
);
RenderParameter
oNewParameter
=
oRenderParameter
;
OOXRelsWriterPtr
oNewRelsWr
=
OOXRelsWriterPtr
(
new
OOXRelsWriter
(
sFilename
,
*
poRtfDocument
)
);
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp
View file @
8db0107a
...
...
@@ -194,7 +194,7 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
if
(
st_inline
==
m_eAnchorTypeShape
)
{
if
(
NULL
!=
m_oPicture
&&
m_nShapeType
==
75
)
if
(
NULL
!=
m_oPicture
&&
m_nShapeType
==
NSOfficeDrawing
::
sptPictureFrame
)
{
if
(
m_oPicture
->
m_nWidth
==
PROP_DEF
)
{
...
...
@@ -312,7 +312,7 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
//picture
if
(
0
!=
m_oPicture
)
{
if
(
m_nShapeType
==
75
)
if
(
m_nShapeType
==
NSOfficeDrawing
::
sptPictureFrame
)
{
sResult
+=
_T
(
"{
\\
sp{
\\
sn pib}{
\\
sv "
);
sResult
+=
m_oPicture
->
RenderToRtf
(
oRenderParameter
);
...
...
@@ -334,7 +334,7 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
sResult
+=
_T
(
"}"
);
}
sResult
+=
_T
(
"}"
);
if
(
m_oPicture
&&
m_nShapeType
==
75
)
if
(
m_oPicture
&&
m_nShapeType
==
NSOfficeDrawing
::
sptPictureFrame
)
{
sResult
+=
_T
(
"{
\\
shprslt
\\
par
\\
plain"
);
sResult
+=
m_oPicture
->
GenerateWMF
(
oRenderParameter
);
...
...
@@ -596,7 +596,8 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
}
CString
RtfShape
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
if
(
PROP_DEF
==
m_nShapeType
)
return
L""
;
if
(
PROP_DEF
==
m_nShapeType
)
return
L""
;
CString
sResult
;
RtfDocument
*
poDocument
=
static_cast
<
RtfDocument
*>
(
oRenderParameter
.
poDocument
);
...
...
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