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
00f1f40a
Commit
00f1f40a
authored
Feb 10, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RtfFormat - add office digital signatures
parent
46c05a4c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
224 additions
and
74 deletions
+224
-74
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
+31
-3
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
...le/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
+2
-3
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
...ficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
+101
-51
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.h
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.h
+5
-5
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.cpp
+3
-7
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h
+4
-2
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp
+70
-3
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.h
+8
-0
No files found.
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
View file @
00f1f40a
...
...
@@ -1760,6 +1760,31 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt
m_oShape
.
m_sGtextFont
=
sValue
;
return
;
}
else
if
(
L"wzSigSetupId"
==
m_sPropName
)
{
m_oShape
.
m_sSigSetupId
=
sValue
;
return
;
}
else
if
(
L"wzSigSetupProvId"
==
m_sPropName
)
{
m_oShape
.
m_sSigSetupProvId
=
sValue
;
return
;
}
else
if
(
L"wzSigSetupSuggSigner"
==
m_sPropName
)
{
m_oShape
.
m_sSigSetupSuggSigner
=
sValue
;
return
;
}
else
if
(
L"wzSigSetupSuggSigner2"
==
m_sPropName
)
{
m_oShape
.
m_sSigSetupSuggSigner2
=
sValue
;
return
;
}
else
if
(
L"wzSigSetupSuggSignerEmail"
==
m_sPropName
)
{
m_oShape
.
m_sSigSetupSuggSignerEmail
=
sValue
;
return
;
}
//числовые
int
nValue
=
0
;
...
...
@@ -1965,8 +1990,11 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt
else
if
(
L"lineEndArrowLength"
==
m_sPropName
)
m_oShape
.
m_nLineEndArrowLength
=
nValue
;
else
if
(
L"lineWidth"
==
m_sPropName
)
m_oShape
.
m_nLineWidth
=
nValue
;
else
if
(
L"lineDashing"
==
m_sPropName
)
m_oShape
.
m_nLineDashing
=
nValue
;
else
if
(
L"cxstyle"
==
m_sPropName
)
m_oShape
.
m_nConnectorStyle
=
nValue
;
else
if
(
L"cxk"
==
m_sPropName
)
m_oShape
.
m_nConnectionType
=
nValue
;
else
if
(
L"cxstyle"
==
m_sPropName
)
m_oShape
.
m_nConnectorStyle
=
nValue
;
else
if
(
L"cxk"
==
m_sPropName
)
m_oShape
.
m_nConnectionType
=
nValue
;
//office signature
else
if
(
L"fIsSignatureLine"
==
m_sPropName
)
m_oShape
.
m_bIsSignatureLine
=
nValue
;
else
if
(
L"fSigSetupAllowComments"
==
m_sPropName
)
m_oShape
.
m_bSigSetupAllowComments
=
nValue
;
else
{
std
::
wstring
name
=
m_sPropName
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
View file @
00f1f40a
...
...
@@ -84,8 +84,7 @@ int OOXGraphicReader::Parse( ReaderParameter oParam , RtfShapePtr & pOutput)
pOutput
->
m_nShapeType
=
75
;
OOX
::
Drawing
::
CPicture
*
picture
=
dynamic_cast
<
OOX
::
Drawing
::
CPicture
*>
(
m_ooxGraphic
->
m_arrItems
[
i
]);
if
(
picture
)
if
(
OOXShapeReader
::
Parse
(
oParam
,
pOutput
,
&
picture
->
m_oBlipFill
))
OOXShapeReader
::
Parse
(
oParam
,
pOutput
,
&
picture
->
m_oBlipFill
);
// тут если false приходит - картинка-потеряшка
return
1
;
}
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
View file @
00f1f40a
...
...
@@ -92,7 +92,7 @@ SimpleTypes::Vml::SptType static PrstTx2ShapeType(SimpleTypes::ETextShapeType ty
}
bool
ParseStyle
(
RtfShapePtr
pShape
,
SimpleTypes
::
Vml
::
CCssProperty
*
prop
)
bool
Parse
Vml
Style
(
RtfShapePtr
pShape
,
SimpleTypes
::
Vml
::
CCssProperty
*
prop
)
{
if
(
pShape
==
NULL
)
return
false
;
if
(
prop
==
NULL
)
return
false
;
...
...
@@ -572,11 +572,46 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
}
if
(
text_path
->
m_oStyle
.
IsInit
())
{
ParseStyles
(
pOutput
,
text_path
->
m_oStyle
->
m_arrProperties
);
Parse
Vml
Styles
(
pOutput
,
text_path
->
m_oStyle
->
m_arrProperties
);
}
}
}
break
;
case
OOX
:
:
et_o_signatureline
:
{
OOX
::
VmlOffice
::
CSignatureLine
*
signature
=
dynamic_cast
<
OOX
::
VmlOffice
::
CSignatureLine
*>
(
m_arrElement
->
m_arrItems
[
i
]);
if
(
signature
)
{
if
(
signature
->
m_oIsSignatureLine
.
GetValue
()
==
SimpleTypes
::
booleanTrue
)
pOutput
->
m_bIsSignatureLine
=
1
;
if
(
signature
->
m_oAllowComments
.
GetValue
()
==
SimpleTypes
::
booleanTrue
)
pOutput
->
m_bSigSetupAllowComments
=
1
;
if
(
signature
->
m_oProvId
.
IsInit
())
pOutput
->
m_sSigSetupProvId
=
signature
->
m_oProvId
->
ToString
();
if
(
signature
->
m_oId
.
IsInit
())
pOutput
->
m_sSigSetupId
=
signature
->
m_oId
->
ToString
();
if
(
signature
->
m_sSuggestedSigner
.
IsInit
())
pOutput
->
m_sSigSetupSuggSigner
=
signature
->
m_sSuggestedSigner
.
get
();
if
(
signature
->
m_sSuggestedSigner2
.
IsInit
())
pOutput
->
m_sSigSetupSuggSigner2
=
signature
->
m_sSuggestedSigner2
.
get
();
if
(
signature
->
m_sSuggestedSignerEmail
.
IsInit
())
pOutput
->
m_sSigSetupSuggSignerEmail
=
signature
->
m_sSuggestedSignerEmail
.
get
();
//nullable<std::wstring> m_sAddXml;
//nullable<SimpleTypes::CExt<>> m_oExt;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oShowSignDate;
//nullable<std::wstring> m_sSigningInstructions;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oSigningInstructionsSet;
//nullable<std::wstring> m_sSigProvUrl;
}
}
break
;
default:
break
;
}
}
...
...
@@ -1309,7 +1344,7 @@ bool OOXShapeReader::ParseVml( ReaderParameter oParam , RtfShapePtr& pOutput)
if
(
m_vmlElement
->
m_oStyle
.
IsInit
())
{
if
(
false
==
ParseStyles
(
pOutput
,
m_vmlElement
->
m_oStyle
->
m_arrProperties
)
)
if
(
false
==
Parse
Vml
Styles
(
pOutput
,
m_vmlElement
->
m_oStyle
->
m_arrProperties
)
)
return
false
;
}
...
...
@@ -1382,7 +1417,7 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
if
(
m_vmlGroup
->
m_oStyle
.
IsInit
())
{
if
(
false
==
ParseStyles
(
pOutput
,
m_vmlGroup
->
m_oStyle
->
m_arrProperties
)
)
if
(
false
==
Parse
Vml
Styles
(
pOutput
,
m_vmlGroup
->
m_oStyle
->
m_arrProperties
)
)
return
false
;
}
...
...
@@ -1635,7 +1670,8 @@ bool OOXShapeReader::WriteDataToPicture( std::wstring sPath, RtfPicture& pOutput
//Выставляем тип картинки
pOutput
.
eDataType
=
RtfPicture
::
GetPictureType
(
sPath
);
//ecли тип не поддерживается rtf конвертируем в png
//ecли тип не поддерживается rtf конвертируем в png
if
(
RtfPicture
::
dt_none
==
pOutput
.
eDataType
)
{
//в туже папку что и исходная картинка
...
...
@@ -1656,9 +1692,7 @@ bool OOXShapeReader::WriteDataToPicture( std::wstring sPath, RtfPicture& pOutput
pOutput
.
m_bIsCopy
=
true
;
//выставляем флаг чтобы потом удалить файл
}
}
else
{
if
(
RtfPicture
::
dt_apm
==
pOutput
.
eDataType
)
else
if
(
RtfPicture
::
dt_apm
==
pOutput
.
eDataType
)
{
//убираем заголовок apm (22 byte)
CFile
file_inp
;
//mpa
...
...
@@ -1710,11 +1744,27 @@ bool OOXShapeReader::WriteDataToPicture( std::wstring sPath, RtfPicture& pOutput
}
else
{
typedef
enum
{
dt_none
,
dt_png
,
dt_jpg
,
dt_emf
,
dt_wmf
,
dt_apm
}
DataType
;
int
cxFormats
[
6
]
=
{
0
,
4
,
3
,
10
,
10
,
10
};
if
(
pOutput
.
eDataType
==
RtfPicture
::
dt_emf
||
pOutput
.
eDataType
==
RtfPicture
::
dt_wmf
)
{
MetaFile
::
CMetaFile
meta
(
NULL
);
if
(
meta
.
LoadFromFile
(
sPath
.
c_str
()))
{
double
dX
,
dY
,
dW
,
dH
;
meta
.
GetBounds
(
&
dX
,
&
dY
,
&
dW
,
&
dH
);
meta
.
Close
();
pOutput
.
m_nWidthGoal
=
dW
*
15
;
//pixels to twip
pOutput
.
m_nHeightGoal
=
dH
*
15
;
//pixels to twip;
}
//Запоминаем только имя
pOutput
.
m_sPicFilename
=
sPath
;
pOutput
.
m_bIsCopy
=
false
;
//не удалять
}
else
{
//png, jpeg
CBgraFrame
image
;
if
(
image
.
OpenFile
(
sPath
,
cxFormats
[
pOutput
.
eDataType
]
)
==
FALSE
)
return
false
;
if
(
image
.
OpenFile
(
sPath
,
0
)
==
FALSE
)
return
false
;
//правильно выставляем размеры
pOutput
.
m_nWidthGoal
=
image
.
get_Width
()
*
15
;
//pixels to twip
pOutput
.
m_nHeightGoal
=
image
.
get_Height
()
*
15
;
//pixels to twip;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.h
View file @
00f1f40a
...
...
@@ -39,7 +39,7 @@
#include "../../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Logic/Shape.h"
bool
ParseStyle
(
RtfShapePtr
pShape
,
SimpleTypes
::
Vml
::
CCssProperty
*
prop
);
bool
Parse
Vml
Style
(
RtfShapePtr
pShape
,
SimpleTypes
::
Vml
::
CCssProperty
*
prop
);
class
OOXShapeReader
{
...
...
@@ -88,11 +88,11 @@ private:
OOX
::
Logic
::
CShape
*
m_ooxShape
;
bool
ParseStyles
(
RtfShapePtr
pShape
,
std
::
vector
<
SimpleTypes
::
Vml
::
CCssPropertyPtr
>
&
props
)
bool
Parse
Vml
Styles
(
RtfShapePtr
pShape
,
std
::
vector
<
SimpleTypes
::
Vml
::
CCssPropertyPtr
>
&
props
)
{
for
(
size_t
i
=
0
;
i
<
props
.
size
();
i
++
)
{
ParseStyle
(
pShape
,
props
[
i
].
get
());
Parse
Vml
Style
(
pShape
,
props
[
i
].
get
());
}
return
true
;
}
...
...
@@ -115,11 +115,11 @@ public:
m_vmlGroup
=
NULL
;
m_ooxGroup
=
ooxGroup
;
}
bool
ParseStyles
(
RtfShapePtr
pGroupShape
,
std
::
vector
<
SimpleTypes
::
Vml
::
CCssPropertyPtr
>
&
props
)
bool
Parse
Vml
Styles
(
RtfShapePtr
pGroupShape
,
std
::
vector
<
SimpleTypes
::
Vml
::
CCssPropertyPtr
>
&
props
)
{
for
(
size_t
i
=
0
;
i
<
props
.
size
();
i
++
)
{
ParseStyle
(
pGroupShape
,
props
[
i
].
get
());
Parse
Vml
Style
(
pGroupShape
,
props
[
i
].
get
());
}
return
true
;
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.cpp
View file @
00f1f40a
...
...
@@ -81,13 +81,9 @@ std::wstring RtfPicture::RenderToRtf(RenderParameter oRenderParameter)
std
::
wstring
sResult
=
L"{
\\
pict"
;
//if(-1 != m_nShapeId)
//{
// sResult.AppendFormat(L"{\\*\\picprop\\shplid%d", m_nShapeId);
// sResult += m_oShapeProp.RenderToRtf( oRenderParameter ) + L"}";
//}
//else
// sResult.AppendFormat(L"{\\*\\picprop" + m_oShapeProp.RenderToRtf( oRenderParameter ) + L"}";
if
(
!
dump_shape_properties
.
empty
())
sResult
+=
L"{
\\
*
\\
picprop"
+
dump_shape_properties
+
L"}"
;
RENDER_RTF_INT
(
(
int
)
m_dScaleX
,
sResult
,
L"picscalex"
)
RENDER_RTF_INT
(
(
int
)
m_dScaleY
,
sResult
,
L"picscaley"
)
RENDER_RTF_INT
(
m_nCropL
,
sResult
,
L"piccropl"
)
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h
View file @
00f1f40a
...
...
@@ -62,6 +62,8 @@ public:
std
::
vector
<
std
::
wstring
>
m_aTempFiles
;
std
::
wstring
dump_shape_properties
;
RtfPicture
()
{
m_bIsCopy
=
false
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp
View file @
00f1f40a
...
...
@@ -131,9 +131,9 @@ void RtfShape::SetDefault()
DEFAULT_PROPERTY
(
m_nRelZOrder
)
//Rehydration
m_sMetroBlob
=
L""
;
m_sMetroBlobRels
=
L""
;
m_sMetroBlobData
=
L""
;
m_sMetroBlob
.
clear
()
;
m_sMetroBlobRels
.
clear
()
;
m_sMetroBlobData
.
clear
()
;
//Connectors
DEFAULT_PROPERTY
(
m_nConnectionType
)
DEFAULT_PROPERTY
(
m_nConnectorStyle
)
...
...
@@ -172,6 +172,9 @@ void RtfShape::SetDefault()
DEFAULT_PROPERTY
(
m_bGtextFShrinkFit
)
DEFAULT_PROPERTY
(
m_bGtextFBestFit
)
DEFAULT_PROPERTY
(
m_bIsSignatureLine
);
DEFAULT_PROPERTY
(
m_bSigSetupAllowComments
);
m_aTextItems
=
TextItemContainerPtr
();
m_oPicture
=
RtfPicturePtr
();
m_bBackground
=
false
;
...
...
@@ -233,7 +236,11 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
else
{
sResult
+=
L"{
\\
*
\\
shppict"
;
m_oPicture
->
dump_shape_properties
=
RenderToRtfShapeProperty
(
oRenderParameter
);
sResult
+=
m_oPicture
->
RenderToRtf
(
oRenderParameter
);
sResult
+=
L"}"
;
sResult
+=
L"{
\\
nonshppict"
;
sResult
+=
m_oPicture
->
GenerateWMF
(
oRenderParameter
);
...
...
@@ -610,7 +617,42 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
RENDER_RTF_SHAPE_PROP
(
L"gtextFShrinkFit"
,
sResult
,
m_bGtextFShrinkFit
);
RENDER_RTF_SHAPE_PROP
(
L"gtextFBestFit"
,
sResult
,
m_bGtextFBestFit
);
}
if
(
PROP_DEF
!=
m_bIsSignatureLine
)
{
RENDER_RTF_SHAPE_PROP
(
L"fIsSignatureLine"
,
sResult
,
m_bIsSignatureLine
);
RENDER_RTF_SHAPE_PROP
(
L"fSigSetupAllowComments"
,
sResult
,
m_bSigSetupAllowComments
);
if
(
!
m_sSigSetupId
.
empty
()
)
{
sResult
+=
L"{
\\
sp{
\\
sn wzSigSetupId}{
\\
sv "
;
sResult
+=
RtfChar
::
renderRtfText
(
m_sSigSetupId
,
oRenderParameter
.
poDocument
,
0
);
sResult
+=
L"}}"
;
}
if
(
!
m_sSigSetupProvId
.
empty
()
)
{
sResult
+=
L"{
\\
sp{
\\
sn wzSigSetupProvId}{
\\
sv "
;
sResult
+=
RtfChar
::
renderRtfText
(
m_sSigSetupProvId
,
oRenderParameter
.
poDocument
,
0
);
sResult
+=
L"}}"
;
}
if
(
!
m_sSigSetupSuggSigner
.
empty
()
)
{
sResult
+=
L"{
\\
sp{
\\
sn wzSigSetupSuggSigner}{
\\
sv "
;
sResult
+=
RtfChar
::
renderRtfText
(
m_sSigSetupSuggSigner
,
oRenderParameter
.
poDocument
,
0
);
sResult
+=
L"}}"
;
}
if
(
!
m_sSigSetupSuggSigner2
.
empty
()
)
{
sResult
+=
L"{
\\
sp{
\\
sn wzSigSetupSuggSigner2}{
\\
sv "
;
sResult
+=
RtfChar
::
renderRtfText
(
m_sSigSetupSuggSigner2
,
oRenderParameter
.
poDocument
,
0
);
sResult
+=
L"}}"
;
}
if
(
!
m_sSigSetupSuggSignerEmail
.
empty
()
)
{
sResult
+=
L"{
\\
sp{
\\
sn wzSigSetupSuggSignerEmail}{
\\
sv "
;
sResult
+=
RtfChar
::
renderRtfText
(
m_sSigSetupSuggSignerEmail
,
oRenderParameter
.
poDocument
,
0
);
sResult
+=
L"}}"
;
}
}
return
sResult
;
}
std
::
wstring
RtfShape
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
...
...
@@ -1346,6 +1388,31 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
sResult
+=
L" string=
\"
"
+
XmlUtils
::
EncodeXmlString
(
m_sGtextUNICODE
)
+
L"
\"
"
;
sResult
+=
L"/>"
;
}
if
(
PROP_DEF
!=
m_bIsSignatureLine
)
{
sResult
+=
L"<o:signatureline v:ext=
\"
edit
\"
"
;
if
(
!
m_sSigSetupId
.
empty
())
sResult
+=
L" id=
\"
"
+
m_sSigSetupId
+
L"
\"
"
;
if
(
!
m_sSigSetupProvId
.
empty
())
sResult
+=
L" provid=
\"
"
+
m_sSigSetupProvId
+
L"
\"
"
;
if
(
!
m_sSigSetupSuggSigner
.
empty
())
sResult
+=
L" o:suggestedsigner=
\"
"
+
m_sSigSetupSuggSigner
+
L"
\"
"
;
if
(
!
m_sSigSetupSuggSigner2
.
empty
())
sResult
+=
L" o:suggestedsigner2=
\"
"
+
m_sSigSetupSuggSigner2
+
L"
\"
"
;
if
(
!
m_sSigSetupSuggSignerEmail
.
empty
())
sResult
+=
L" o:suggestedsigneremail=
\"
"
+
m_sSigSetupSuggSignerEmail
+
L"
\"
"
;
if
(
m_bSigSetupAllowComments
==
1
)
sResult
+=
L" allowcomments=
\"
t
\"
"
;
sResult
+=
L" issignatureline=
\"
t
\"
/>"
;
}
return
sResult
;
}
std
::
wstring
RtfShape
::
RenderToOOXEnd
(
RenderParameter
oRenderParameter
)
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.h
View file @
00f1f40a
...
...
@@ -202,6 +202,14 @@ public:
int
m_bGtextFShrinkFit
;
int
m_bGtextFBestFit
;
int
m_bIsSignatureLine
;
int
m_bSigSetupAllowComments
;
std
::
wstring
m_sSigSetupId
;
std
::
wstring
m_sSigSetupProvId
;
std
::
wstring
m_sSigSetupSuggSigner
;
std
::
wstring
m_sSigSetupSuggSigner2
;
std
::
wstring
m_sSigSetupSuggSignerEmail
;
RtfCharProperty
m_oCharProperty
;
// тут могут быть track changes ....
//pWrapPolygonVertices Points of the text wrap polygon.
...
...
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