summaryrefslogtreecommitdiff
path: root/xmloff/source/text/txtparae.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/text/txtparae.cxx')
-rw-r--r--xmloff/source/text/txtparae.cxx171
1 files changed, 98 insertions, 73 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 82068e7fb7ff..6a23dd514f70 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
#include "unointerfacetouniqueidentifiermapper.hxx"
@@ -32,11 +30,9 @@
#include <svl/svarray.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/types.h>
-
#include <vector>
#include <list>
#include <hash_map>
-
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
@@ -70,15 +66,12 @@
#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
#include <com/sun/star/document/XRedlinesSupplier.hpp>
-
#include <com/sun/star/text/XBookmarksSupplier.hpp>
#include <com/sun/star/text/XFormField.hpp>
-
#include <com/sun/star/text/XTextSection.hpp>
#include <com/sun/star/text/SectionFileLink.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/text/XTextShapesSupplier.hpp>
-
#include <com/sun/star/style/XAutoStylesSupplier.hpp>
#include <com/sun/star/style/XAutoStyleFamily.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
@@ -112,11 +105,11 @@
#include <xmloff/formlayerexport.hxx>
#include "XMLTextCharStyleNamesElementExport.hxx"
#include <comphelper/stlunosequence.hxx>
-
-// --> OD 2008-04-25 #refactorlists#
#include <txtlists.hxx>
-// <--
#include <com/sun/star/rdf/XMetadatable.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -2877,34 +2870,46 @@ void XMLTextParagraphExport::exportContour(
const Reference < XPropertySetInfo > & rPropSetInfo )
{
if( !rPropSetInfo->hasPropertyByName( sContourPolyPolygon ) )
+ {
return;
+ }
PointSequenceSequence aSourcePolyPolygon;
rPropSet->getPropertyValue( sContourPolyPolygon ) >>= aSourcePolyPolygon;
+ const basegfx::B2DPolyPolygon aPolyPolygon(
+ basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(
+ aSourcePolyPolygon));
+ const sal_uInt32 nPolygonCount(aPolyPolygon.count());
- if( !aSourcePolyPolygon.getLength() )
- return;
-
- awt::Point aPoint( 0, 0 );
- awt::Size aSize( 0, 0 );
- sal_Int32 nPolygons = aSourcePolyPolygon.getLength();
- const PointSequence *pPolygons = aSourcePolyPolygon.getConstArray();
- while( nPolygons-- )
+ if(!nPolygonCount)
{
- sal_Int32 nPoints = pPolygons->getLength();
- const awt::Point *pPoints = pPolygons->getConstArray();
- while( nPoints-- )
- {
- if( aSize.Width < pPoints->X )
- aSize.Width = pPoints->X;
- if( aSize.Height < pPoints->Y )
- aSize.Height = pPoints->Y;
- pPoints++;
- }
- pPolygons++;
+ return;
}
- sal_Bool bPixel = sal_False;
+ const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
+
+// TTTT:
+// awt::Point aPoint( 0, 0 );
+// awt::Size aSize( 0, 0 );
+// sal_Int32 nPolygons = aSourcePolyPolygon.getLength();
+// const PointSequence *pPolygons = aSourcePolyPolygon.getConstArray();
+// while( nPolygons-- )
+// {
+// sal_Int32 nPoints = pPolygons->getLength();
+// const awt::Point *pPoints = pPolygons->getConstArray();
+// while( nPoints-- )
+// {
+// if( aSize.Width < pPoints->X )
+// aSize.Width = pPoints->X;
+// if( aSize.Height < pPoints->Y )
+// aSize.Height = pPoints->Y;
+// pPoints++;
+// }
+// pPolygons++;
+// }
+
+ bool bPixel(false);
+
if( rPropSetInfo->hasPropertyByName( sIsPixelContour ) )
{
bPixel = *(sal_Bool *)rPropSet->getPropertyValue( sIsPixelContour ).getValue();
@@ -2912,67 +2917,87 @@ void XMLTextParagraphExport::exportContour(
// svg: width
OUStringBuffer aStringBuffer( 10 );
- if( bPixel )
- GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Width);
+
+ if(bPixel)
+ {
+ GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aPolyPolygonRange.getWidth());
+ }
else
- GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Width);
- GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
- aStringBuffer.makeStringAndClear() );
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aPolyPolygonRange.getWidth());
+ }
+
+ GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStringBuffer.makeStringAndClear());
// svg: height
- if( bPixel )
- GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Height);
+ if(bPixel)
+ {
+ GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aPolyPolygonRange.getHeight());
+ }
else
- GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Height);
- GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
- aStringBuffer.makeStringAndClear() );
-
- // svg:viewbox
- SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
- GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
- aViewBox.GetExportString());
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aPolyPolygonRange.getHeight());
+ }
- sal_Int32 nOuterCnt( aSourcePolyPolygon.getLength() );
+ GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStringBuffer.makeStringAndClear());
+ // svg:viewbox
+ SdXMLImExViewBox aViewBox(0.0, 0.0, aPolyPolygonRange.getWidth(), aPolyPolygonRange.getHeight());
+ GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
enum XMLTokenEnum eElem = XML_TOKEN_INVALID;
- if( 1L == nOuterCnt )
+
+ if(1 == nPolygonCount )
{
// simple polygon shape, can be written as svg:points sequence
- /*const*/ PointSequence* pSequence =
- (PointSequence*)aSourcePolyPolygon.getConstArray();
+ const ::rtl::OUString aPointString(
+ basegfx::tools::exportToSvgPoints(
+ aPolyPolygon.getB2DPolygon(0)));
- SdXMLImExPointsElement aPoints( pSequence, aViewBox, aPoint, aSize, true);
+ // TTTT
+ //PointSequence* pSequence = (PointSequence*)aSourcePolyPolygon.getConstArray();
+ //SdXMLImExPointsElement aPoints( pSequence, aViewBox, aPolyPolygonRange.getMinimum(), aPolyPolygonRange.getRange(), true);
// write point array
- GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS,
- aPoints.GetExportString());
+ GetExport().AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
eElem = XML_CONTOUR_POLYGON;
}
else
{
// polypolygon, needs to be written as a svg:path sequence
- /*const*/ PointSequence* pOuterSequence =
- (PointSequence*)aSourcePolyPolygon.getConstArray();
- if(pOuterSequence)
- {
- // prepare svx:d element export
- SdXMLImExSvgDElement aSvgDElement( aViewBox );
-
- for(sal_Int32 a(0L); a < nOuterCnt; a++)
- {
- /*const*/ PointSequence* pSequence = pOuterSequence++;
- if(pSequence)
- {
- aSvgDElement.AddPolygon(pSequence, 0L, aPoint,
- aSize, sal_True );
- }
- }
+ const ::rtl::OUString aPolygonString(
+ basegfx::tools::exportToSvgD(
+ aPolyPolygon,
+ true, // bUseRelativeCoordinates
+ false)); // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now
- // write point array
- GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D,
- aSvgDElement.GetExportString());
- eElem = XML_CONTOUR_PATH;
- }
+ // write point array
+ GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D, aPolygonString);
+ eElem = XML_CONTOUR_PATH;
+
+ // TTTT
+ ///*const*/ PointSequence* pOuterSequence =
+ // (PointSequence*)aSourcePolyPolygon.getConstArray();
+ //if(pOuterSequence)
+ //{
+ // // prepare svx:d element export
+ // SdXMLImExSvgDElement aSvgDElement( aViewBox );
+ //
+ // for(sal_Int32 a(0L); a < nPolygonCount; a++)
+ // {
+ // /*const*/ PointSequence* pSequence = pOuterSequence++;
+ // if(pSequence)
+ // {
+ // awt::Point aPoint(aPolyPolygonRange.getMinX(), aPolyPolygonRange.getMinY());
+ // awt::Size aSize(aPolyPolygonRange.getWidth(), aPolyPolygonRange.getHeight());
+ // aSvgDElement.AddPolygon(pSequence, 0L, aPoint, aSize, sal_True );
+ // }
+ // }
+ //
+ // // write point array
+ // GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D,
+ // aSvgDElement.GetExportString());
+ // eElem = XML_CONTOUR_PATH;
+ //}
}
if( rPropSetInfo->hasPropertyByName( sIsAutomaticContour ) )