shapeexport2.cxx (86e1cf34) | shapeexport2.cxx (f636aef8) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 1075 unchanged lines hidden (view full) --- 1084 ImpExportGluePoints( xShape ); 1085 ImpExportText( xShape ); 1086 } 1087} 1088 1089////////////////////////////////////////////////////////////////////////////// 1090 1091void XMLShapeExport::ImpExportGraphicObjectShape( | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 1075 unchanged lines hidden (view full) --- 1084 ImpExportGluePoints( xShape ); 1085 ImpExportText( xShape ); 1086 } 1087} 1088 1089////////////////////////////////////////////////////////////////////////////// 1090 1091void XMLShapeExport::ImpExportGraphicObjectShape( |
1092 const uno::Reference< drawing::XShape >& xShape, 1093 XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) | 1092 const uno::Reference< drawing::XShape >& xShape, 1093 XmlShapeType eShapeType, 1094 sal_Int32 nFeatures, 1095 awt::Point* pRefPoint ) |
1094{ | 1096{ |
1095 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1096 if(xPropSet.is()) 1097 { 1098 sal_Bool bIsEmptyPresObj = sal_False; 1099 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); | 1097 const uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); 1098 if ( xPropSet.is() ) 1099 { 1100 sal_Bool bIsEmptyPresObj = sal_False; 1101 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); |
1100 | 1102 |
1101 // Transformation 1102 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); | 1103 // Transformation 1104 ImpExportNewTrans( xPropSet, nFeatures, pRefPoint ); |
1103 | 1105 |
1104 OUString sImageURL; | 1106 OUString sImageURL; |
1105 | 1107 |
1106 if(eShapeType == XmlShapeTypePresGraphicObjectShape) 1107 bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) ); | 1108 if ( eShapeType == XmlShapeTypePresGraphicObjectShape ) 1109 bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken( XML_PRESENTATION_GRAPHIC ) ); |
1108 | 1110 |
1109 sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1110 SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, 1111 XML_FRAME, bCreateNewline, sal_True ); | 1111 sal_Bool bCreateNewline( ( nFeatures & SEF_EXPORT_NO_WS ) == 0 ); // #86116#/#92210# 1112 SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_FRAME, bCreateNewline, sal_True ); |
1112 | 1113 |
1113 const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ); | 1114 const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ); |
1114 | 1115 |
1115 if( !bIsEmptyPresObj || bSaveBackwardsCompatible ) 1116 { 1117 if( !bIsEmptyPresObj ) 1118 { | 1116 if ( !bIsEmptyPresObj || bSaveBackwardsCompatible ) 1117 { 1118 if ( !bIsEmptyPresObj ) 1119 { |
1119 OUString aReplacementUrl; 1120 xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("ReplacementGraphicURL"))) >>= aReplacementUrl; 1121 1122 // If there is no url, then then graphic is empty | 1120 OUString aReplacementUrl; 1121 xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("ReplacementGraphicURL"))) >>= aReplacementUrl; 1122 1123 // If there is no url, then then graphic is empty |
1123 if(aReplacementUrl.getLength()) | 1124 if ( aReplacementUrl.getLength() ) |
1124 { 1125 const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl); 1126 1127 if(aStr.getLength()) 1128 { 1129 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr); 1130 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1131 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1132 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1133 1134 // xlink:href for replacement, only written for Svg content 1135 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True); 1136 1137 // optional office:binary-data 1138 mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl); 1139 } 1140 } 1141 1142 OUString aStreamURL; | 1125 { 1126 const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl); 1127 1128 if(aStr.getLength()) 1129 { 1130 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr); 1131 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1132 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1133 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1134 1135 // xlink:href for replacement, only written for Svg content 1136 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True); 1137 1138 // optional office:binary-data 1139 mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl); 1140 } 1141 } 1142 1143 OUString aStreamURL; |
1143 OUString aStr; | 1144 xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStreamURL" ) ) ) >>= aStreamURL; 1145 xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ) ) >>= sImageURL; |
1144 | 1146 |
1145 xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL"))) >>= aStreamURL; 1146 xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))) >>= sImageURL; | 1147 OUString aResolveURL( sImageURL ); 1148 const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) ); |
1147 | 1149 |
1148 OUString aResolveURL( sImageURL ); 1149 const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") ); | 1150 // sj: trying to preserve the filename 1151 if ( aStreamURL.match( sPackageURL, 0 ) ) 1152 { 1153 rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) ); 1154 sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1; 1155 if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) ) 1156 sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex ); 1157 nLastIndex = sRequestedName.lastIndexOf( '.' ); 1158 if ( nLastIndex >= 0 ) 1159 sRequestedName = sRequestedName.copy( 0, nLastIndex ); 1160 if ( sRequestedName.getLength() ) 1161 { 1162 aResolveURL = aResolveURL.concat( OUString( RTL_CONSTASCII_USTRINGPARAM( "?requestedName=" ) ) ); 1163 aResolveURL = aResolveURL.concat( sRequestedName ); 1164 } 1165 } |
1150 | 1166 |
1151 // sj: trying to preserve the filename 1152 if ( aStreamURL.match( sPackageURL, 0 ) ) 1153 { 1154 rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) ); 1155 sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1; 1156 if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) ) 1157 sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex ); 1158 nLastIndex = sRequestedName.lastIndexOf( '.' ); 1159 if ( nLastIndex >= 0 ) 1160 sRequestedName = sRequestedName.copy( 0, nLastIndex ); 1161 if ( sRequestedName.getLength() ) 1162 { 1163 aResolveURL = aResolveURL.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("?requestedName="))); 1164 aResolveURL = aResolveURL.concat( sRequestedName ); 1165 } 1166 } | 1167 const OUString aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL ); 1168 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStr ); |
1167 | 1169 |
1168 aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL ); 1169 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr ); | 1170 if ( !aStr.isEmpty() ) 1171 { 1172 aStreamURL = sPackageURL; 1173 if ( aStr[0] == '#' ) 1174 { 1175 aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) ); 1176 } 1177 else 1178 { 1179 aStreamURL = aStreamURL.concat( aStr ); 1180 } |
1170 | 1181 |
1171 if( aStr.getLength() ) 1172 { 1173 if( aStr[ 0 ] == '#' ) 1174 { 1175 aStreamURL = sPackageURL; 1176 aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) ); 1177 } | 1182 // update stream URL for load on demand 1183 uno::Any aAny; 1184 aAny <<= aStreamURL; 1185 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStreamURL" ) ), aAny ); |
1178 | 1186 |
1179 // update stream URL for load on demand 1180 uno::Any aAny; 1181 aAny <<= aStreamURL; 1182 xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL")), aAny ); | 1187 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1188 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1189 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1190 } 1191 } 1192 else 1193 { 1194 OUString aStr; 1195 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStr ); 1196 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1197 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1198 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1199 } |
1183 | 1200 |
1184 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1185 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1186 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1187 } 1188 } 1189 else 1190 { 1191 OUString aStr; 1192 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr ); 1193 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1194 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1195 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1196 } | 1201 { 1202 SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True ); |
1197 | 1203 |
1198 { 1199 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True); | 1204 if ( sImageURL.getLength() ) 1205 { 1206 // optional office:binary-data 1207 mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL ); 1208 } 1209 if ( !bIsEmptyPresObj ) 1210 ImpExportText( xShape ); 1211 } 1212 } |
1200 | 1213 |
1201 if( sImageURL.getLength() ) 1202 { 1203 // optional office:binary-data 1204 mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL ); 1205 } 1206 if( !bIsEmptyPresObj ) 1207 ImpExportText( xShape ); 1208 } 1209 } | 1214 ImpExportEvents( xShape ); 1215 ImpExportGluePoints( xShape ); |
1210 | 1216 |
1211 ImpExportEvents( xShape ); 1212 ImpExportGluePoints( xShape ); 1213 1214 // image map 1215 GetExport().GetImageMapExport().Export( xPropSet ); 1216 ImpExportDescription( xShape ); // #i68101# 1217 } | 1217 // image map 1218 GetExport().GetImageMapExport().Export( xPropSet ); 1219 ImpExportDescription( xShape ); // #i68101# 1220 } |
1218} 1219 1220////////////////////////////////////////////////////////////////////////////// 1221 1222void XMLShapeExport::ImpExportChartShape( 1223 const uno::Reference< drawing::XShape >& xShape, 1224 XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint, 1225 SvXMLAttributeList* pAttrList ) --- 797 unchanged lines hidden --- | 1221} 1222 1223////////////////////////////////////////////////////////////////////////////// 1224 1225void XMLShapeExport::ImpExportChartShape( 1226 const uno::Reference< drawing::XShape >& xShape, 1227 XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint, 1228 SvXMLAttributeList* pAttrList ) --- 797 unchanged lines hidden --- |