shapeexport2.cxx (1f882ec4) | shapeexport2.cxx (2f8a4d94) |
---|---|
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 --- 940 unchanged lines hidden (view full) --- 949 950 // export end angle 951 SvXMLUnitConverter::convertDouble( sStringBuffer, dEndAngle ); 952 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() ); 953 } 954 955 sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 956 | 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 --- 940 unchanged lines hidden (view full) --- 949 950 // export end angle 951 SvXMLUnitConverter::convertDouble( sStringBuffer, dEndAngle ); 952 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() ); 953 } 954 955 sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 956 |
957 if(bCircle) 958 { 959 // write circle 960 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True); | 957 // prepare name (with most used) 958 enum ::xmloff::token::XMLTokenEnum eName(XML_CIRCLE); |
961 | 959 |
962 ImpExportDescription( xShape ); // #i68101# 963 ImpExportEvents( xShape ); 964 ImpExportGluePoints( xShape ); 965 ImpExportText( xShape ); 966 } 967 else 968 { 969 // write ellipse 970 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True); | 960 if(bCircle) 961 { 962 // name already set 963 } 964 else 965 { 966 // set name 967 eName = XML_ELLIPSE; 968 } |
971 | 969 |
972 ImpExportDescription( xShape ); // #i68101# 973 ImpExportEvents( xShape ); 974 ImpExportGluePoints( xShape ); 975 ImpExportText( xShape ); 976 } 977 } | 970 // write ellipse or circle 971 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, eName, bCreateNewline, sal_True); 972 973 ImpExportDescription( xShape ); // #i68101# 974 ImpExportEvents( xShape ); 975 ImpExportGluePoints( xShape ); 976 ImpExportText( xShape ); 977 } |
978} 979 980////////////////////////////////////////////////////////////////////////////// 981 982void XMLShapeExport::ImpExportPolygonShape( 983 const uno::Reference< drawing::XShape >& xShape, 984 XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 985{ --- 22 unchanged lines hidden (view full) --- 1008 // create and export ViewBox 1009 awt::Point aPoint(0, 0); 1010 awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY())); 1011 SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height); 1012 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString()); 1013 1014 sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1015 | 978} 979 980////////////////////////////////////////////////////////////////////////////// 981 982void XMLShapeExport::ImpExportPolygonShape( 983 const uno::Reference< drawing::XShape >& xShape, 984 XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 985{ --- 22 unchanged lines hidden (view full) --- 1008 // create and export ViewBox 1009 awt::Point aPoint(0, 0); 1010 awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY())); 1011 SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height); 1012 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString()); 1013 1014 sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1015 |
1016 // prepare name (with most used) 1017 enum ::xmloff::token::XMLTokenEnum eName(XML_PATH); 1018 |
|
1016 if(bBezier) 1017 { 1018 // get PolygonBezier 1019 uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); 1020 const basegfx::B2DPolyPolygon aPolyPolygon( 1021 basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*(drawing::PolyPolygonBezierCoords*)aAny.getValue())); 1022 1023 if(aPolyPolygon.count()) 1024 { 1025 // complex polygon shape, write as svg:d 1026 const ::rtl::OUString aPolygonString( 1027 basegfx::tools::exportToSvgD( 1028 aPolyPolygon, 1029 true, // bUseRelativeCoordinates 1030 false, // bDetectQuadraticBeziers: not used in old, but maybe activated now 1031 true)); // bHandleRelativeNextPointCompatible 1032 1033 // write point array 1034 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); | 1019 if(bBezier) 1020 { 1021 // get PolygonBezier 1022 uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); 1023 const basegfx::B2DPolyPolygon aPolyPolygon( 1024 basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*(drawing::PolyPolygonBezierCoords*)aAny.getValue())); 1025 1026 if(aPolyPolygon.count()) 1027 { 1028 // complex polygon shape, write as svg:d 1029 const ::rtl::OUString aPolygonString( 1030 basegfx::tools::exportToSvgD( 1031 aPolyPolygon, 1032 true, // bUseRelativeCoordinates 1033 false, // bDetectQuadraticBeziers: not used in old, but maybe activated now 1034 true)); // bHandleRelativeNextPointCompatible 1035 1036 // write point array 1037 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); |
1035 1036 // write object now 1037 SvXMLElementExport aOBJ( 1038 mrExport, 1039 XML_NAMESPACE_DRAW, 1040 XML_PATH, 1041 bCreateNewline, 1042 sal_True); | |
1043 } 1044 } 1045 else 1046 { 1047 // get non-bezier polygon 1048 uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); 1049 const basegfx::B2DPolyPolygon aPolyPolygon( 1050 basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*(drawing::PointSequenceSequence*)aAny.getValue())); 1051 1052 if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count()) 1053 { 1054 // simple polygon shape, can be written as svg:points sequence 1055 const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0)); 1056 const ::rtl::OUString aPointString(basegfx::tools::exportToSvgPoints(aPolygon)); 1057 1058 // write point array 1059 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString); 1060 | 1038 } 1039 } 1040 else 1041 { 1042 // get non-bezier polygon 1043 uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); 1044 const basegfx::B2DPolyPolygon aPolyPolygon( 1045 basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*(drawing::PointSequenceSequence*)aAny.getValue())); 1046 1047 if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count()) 1048 { 1049 // simple polygon shape, can be written as svg:points sequence 1050 const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0)); 1051 const ::rtl::OUString aPointString(basegfx::tools::exportToSvgPoints(aPolygon)); 1052 1053 // write point array 1054 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString); 1055 |
1061 // write object now 1062 SvXMLElementExport aOBJ( 1063 mrExport, 1064 XML_NAMESPACE_DRAW, 1065 aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE, 1066 bCreateNewline, 1067 sal_True); | 1056 // set name 1057 eName = aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE; |
1068 } 1069 else 1070 { 1071 // complex polygon shape, write as svg:d 1072 const ::rtl::OUString aPolygonString( 1073 basegfx::tools::exportToSvgD( 1074 aPolyPolygon, 1075 true, // bUseRelativeCoordinates 1076 false, // bDetectQuadraticBeziers: not used in old, but maybe activated now 1077 true)); // bHandleRelativeNextPointCompatible 1078 1079 // write point array 1080 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); | 1058 } 1059 else 1060 { 1061 // complex polygon shape, write as svg:d 1062 const ::rtl::OUString aPolygonString( 1063 basegfx::tools::exportToSvgD( 1064 aPolyPolygon, 1065 true, // bUseRelativeCoordinates 1066 false, // bDetectQuadraticBeziers: not used in old, but maybe activated now 1067 true)); // bHandleRelativeNextPointCompatible 1068 1069 // write point array 1070 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); |
1081 1082 // write object now 1083 SvXMLElementExport aOBJ( 1084 mrExport, 1085 XML_NAMESPACE_DRAW, 1086 XML_PATH, 1087 bCreateNewline, 1088 sal_True); | |
1089 } 1090 } 1091 | 1071 } 1072 } 1073 |
1074 // write object, but after attributes are added since the destructor will 1075 // consume all of these added attributes. Also before text is added; this may 1076 // open another SvXMLElementExport scope which needs to be inside this one 1077 SvXMLElementExport aOBJ( 1078 mrExport, 1079 XML_NAMESPACE_DRAW, 1080 eName, 1081 bCreateNewline, 1082 sal_True); 1083 |
|
1092 ImpExportDescription( xShape ); // #i68101# 1093 ImpExportEvents( xShape ); 1094 ImpExportGluePoints( xShape ); 1095 ImpExportText( xShape ); 1096 } 1097} 1098 1099////////////////////////////////////////////////////////////////////////////// --- 930 unchanged lines hidden --- | 1084 ImpExportDescription( xShape ); // #i68101# 1085 ImpExportEvents( xShape ); 1086 ImpExportGluePoints( xShape ); 1087 ImpExportText( xShape ); 1088 } 1089} 1090 1091////////////////////////////////////////////////////////////////////////////// --- 930 unchanged lines hidden --- |