summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorAttila Bakos <bakos.attilakaroly@nisz.hu>2020-09-04 11:48:16 +0200
committerLászló Németh <nemeth@numbertext.org>2020-09-11 17:27:24 +0200
commit65bc6e12ef8a681ec4597635d0b3d86e9ac355d3 (patch)
tree9223b1d84c4178ca92aa768a40289878f689fd7e /oox/source
parent4fa53470339d8813cc40e32d2ac60483a10cf2df (diff)
tdf#135667 DOCX export: fix border line of OLE objects
which wasn't exported. Note: the enlarged monolithic export function was split in the following new functions: - WriteOLEShape() exports the replacement shape of the OLE object. - GetOLEStyle() returns the string value of the style attribute. - ExportOLESurround() handles the surround settings. Also add GetVMLShapeTypeDefinition() to reuse picture frame VML formula string used by VMLExport. Co-authored-by: Arató Dániel (NISZ) Change-Id: I29800a50c60a824a14849ac286a18e5e2f97c689 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102034 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/export/vmlexport.cxx78
1 files changed, 42 insertions, 36 deletions
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 0a0a634708bf..dea03c552cee 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1219,6 +1219,46 @@ sal_uInt32 VMLExport::GenerateShapeId()
return m_nShapeIDCounter++;
}
+OString VMLExport::GetVMLShapeTypeDefinition( const OString& sShapeID, const bool bIsPictureFrame )
+{
+ OString sShapeType;
+ if ( !bIsPictureFrame )
+ // We don't have a shape definition for host control in presetShapeDefinitions.xml
+ // So use a definition copied from DOCX file created with MSO
+ sShapeType = "<v:shapetype id=\"shapetype_" + sShapeID +
+ "\" coordsize=\"21600,21600\" o:spt=\"" + sShapeID +
+ "\" path=\"m,l,21600l21600,21600l21600,xe\">\n"
+ "<v:stroke joinstyle=\"miter\"/>\n"
+ "<v:path shadowok=\"f\" o:extrusionok=\"f\" strokeok=\"f\" fillok=\"f\" o:connecttype=\"rect\"/>\n"
+ "<o:lock v:ext=\"edit\" shapetype=\"t\"/>\n"
+ "</v:shapetype>";
+ else
+ // We don't have a shape definition for picture frame in presetShapeDefinitions.xml
+ // So use a definition copied from DOCX file created with MSO
+ sShapeType = "<v:shapetype id=\"shapetype_" + sShapeID +
+ "\" coordsize=\"21600,21600\" o:spt=\"" + sShapeID +
+ "\" o:preferrelative=\"t\" path=\"m@4@5l@4@11@9@11@9@5xe\" filled=\"f\" stroked=\"f\">\n"
+ "<v:stroke joinstyle=\"miter\"/>\n"
+ "<v:formulas>\n"
+ "<v:f eqn=\"if lineDrawn pixelLineWidth 0\"/>\n"
+ "<v:f eqn=\"sum @0 1 0\"/>\n"
+ "<v:f eqn=\"sum 0 0 @1\"/>\n"
+ "<v:f eqn=\"prod @2 1 2\"/>\n"
+ "<v:f eqn=\"prod @3 21600 pixelWidth\"/>\n"
+ "<v:f eqn=\"prod @3 21600 pixelHeight\"/>\n"
+ "<v:f eqn=\"sum @0 0 1\"/>\n"
+ "<v:f eqn=\"prod @6 1 2\"/>\n"
+ "<v:f eqn=\"prod @7 21600 pixelWidth\"/>\n"
+ "<v:f eqn=\"sum @8 21600 0\"/>\n"
+ "<v:f eqn=\"prod @7 21600 pixelHeight\"/>\n"
+ "<v:f eqn=\"sum @10 21600 0\"/>\n"
+ "</v:formulas>\n"
+ "<v:path o:extrusionok=\"f\" gradientshapeok=\"t\" o:connecttype=\"rect\"/>\n"
+ "<o:lock v:ext=\"edit\" aspectratio=\"t\"/>\n"
+ "</v:shapetype>";
+ return sShapeType;
+}
+
sal_Int32 VMLExport::StartShape()
{
if ( m_nShapeType == ESCHER_ShpInst_Nil )
@@ -1237,56 +1277,22 @@ sal_Int32 VMLExport::StartShape()
case ESCHER_ShpInst_Line: nShapeElement = XML_line; break;
case ESCHER_ShpInst_HostControl:
{
- // We don't have a shape definition for host control in presetShapeDefinitions.xml
- // So use a definition copied from DOCX file created with MSO
bReferToShapeType = true;
nShapeElement = XML_shape;
if ( !m_aShapeTypeWritten[ m_nShapeType ] )
{
- OString sShapeType =
- "<v:shapetype id=\"shapetype_" + OString::number(m_nShapeType) +
- "\" coordsize=\"21600,21600\" o:spt=\"" + OString::number(m_nShapeType) +
- "\" path=\"m,l,21600l21600,21600l21600,xe\">\n"
- "<v:stroke joinstyle=\"miter\"/>\n"
- "<v:path shadowok=\"f\" o:extrusionok=\"f\" strokeok=\"f\" fillok=\"f\" o:connecttype=\"rect\"/>\n"
- "<o:lock v:ext=\"edit\" shapetype=\"t\"/>\n"
- "</v:shapetype>";
- m_pSerializer->write(sShapeType);
+ m_pSerializer->write(GetVMLShapeTypeDefinition(OString::number(m_nShapeType), false));
m_aShapeTypeWritten[ m_nShapeType ] = true;
}
break;
}
case ESCHER_ShpInst_PictureFrame:
{
- // We don't have a shape definition for picture frame in presetShapeDefinitions.xml
- // So use a definition copied from DOCX file created with MSO
bReferToShapeType = true;
nShapeElement = XML_shape;
if ( !m_aShapeTypeWritten[ m_nShapeType ] )
{
- OString sShapeType =
- "<v:shapetype id=\"shapetype_" + OString::number(m_nShapeType) +
- "\" coordsize=\"21600,21600\" o:spt=\"" + OString::number(m_nShapeType) +
- "\" o:preferrelative=\"t\" path=\"m@4@5l@4@11@9@11@9@5xe\" filled=\"f\" stroked=\"f\">\n"
- "<v:stroke joinstyle=\"miter\"/>\n"
- "<v:formulas>\n"
- "<v:f eqn=\"if lineDrawn pixelLineWidth 0\"/>\n"
- "<v:f eqn=\"sum @0 1 0\"/>\n"
- "<v:f eqn=\"sum 0 0 @1\"/>\n"
- "<v:f eqn=\"prod @2 1 2\"/>\n"
- "<v:f eqn=\"prod @3 21600 pixelWidth\"/>\n"
- "<v:f eqn=\"prod @3 21600 pixelHeight\"/>\n"
- "<v:f eqn=\"sum @0 0 1\"/>\n"
- "<v:f eqn=\"prod @6 1 2\"/>\n"
- "<v:f eqn=\"prod @7 21600 pixelWidth\"/>\n"
- "<v:f eqn=\"sum @8 21600 0\"/>\n"
- "<v:f eqn=\"prod @7 21600 pixelHeight\"/>\n"
- "<v:f eqn=\"sum @10 21600 0\"/>\n"
- "</v:formulas>\n"
- "<v:path o:extrusionok=\"f\" gradientshapeok=\"t\" o:connecttype=\"rect\"/>\n"
- "<o:lock v:ext=\"edit\" aspectratio=\"t\"/>\n"
- "</v:shapetype>";
- m_pSerializer->write(sShapeType);
+ m_pSerializer->write(GetVMLShapeTypeDefinition(OString::number(m_nShapeType), true));
m_aShapeTypeWritten[ m_nShapeType ] = true;
}
break;