diff options
author | Michael Brauer <mib@openoffice.org> | 2001-05-04 08:49:55 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2001-05-04 08:49:55 +0000 |
commit | ca8b9e43d689938f9df624d5899c50268dd4f74f (patch) | |
tree | c05ae2224fe01a511d7300fd93e8274dcb9e81d8 | |
parent | 30bcabf7f2e84decb2805af40a42a8967278b2c8 (diff) |
Contour API properties added and fixed
-rw-r--r-- | xmloff/inc/xmlkywd.hxx | 5 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 50 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 52 |
4 files changed, 90 insertions, 22 deletions
diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx index 0c6066290032..b954fc4be517 100644 --- a/xmloff/inc/xmlkywd.hxx +++ b/xmloff/inc/xmlkywd.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlkywd.hxx,v $ * - * $Revision: 1.144 $ + * $Revision: 1.145 $ * - * last change: $Author: dvo $ $Date: 2001-05-02 16:19:18 $ + * last change: $Author: mib $ $Date: 2001-05-04 09:46:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1352,6 +1352,7 @@ XML_CONSTASCII_ACTION( sXML_radar, "radar" ); XML_CONSTASCII_ACTION( sXML_random, "random" ); XML_CONSTASCII_ACTION( sXML_range_address, "range-address"); XML_CONSTASCII_ACTION( sXML_range_usable_as, "range-usable-as"); +XML_CONSTASCII_ACTION( sXML_recreate_on_edit , "recreate-on-edit" ); XML_CONSTASCII_ACTION( sXML_rect , "rect" ); XML_CONSTASCII_ACTION( sXML_red , "red" ); XML_CONSTASCII_ACTION( sXML_ref_name, "ref-name" ); diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 1dab4ab9f6fe..f2765b1cbeb3 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLTextFrameContext.cxx,v $ * - * $Revision: 1.39 $ + * $Revision: 1.40 $ * - * last change: $Author: mib $ $Date: 2001-04-25 13:35:19 $ + * last change: $Author: mib $ $Date: 2001-05-04 09:49:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -257,6 +257,8 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( xPropSet( rPropSet ) { OUString sD, sPoints, sViewBox; + sal_Bool bPixelWidth = sal_False, bPixelHeight = sal_False; + sal_Bool bAuto = sal_False; sal_Int32 nWidth = 0; sal_Int32 nHeight = 0; @@ -287,25 +289,35 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( sPoints = rValue; break; case XML_TOK_TEXT_CONTOUR_WIDTH: - GetImport().GetMM100UnitConverter().convertMeasure( nWidth, + if( GetImport().GetMM100UnitConverter().convertMeasurePx( nWidth, + rValue) ) + bPixelWidth = sal_True; + else + GetImport().GetMM100UnitConverter().convertMeasure( nWidth, rValue); break; case XML_TOK_TEXT_CONTOUR_HEIGHT: - GetImport().GetMM100UnitConverter().convertMeasure( nHeight, - rValue); + if( GetImport().GetMM100UnitConverter().convertMeasurePx( nHeight, + rValue) ) + bPixelHeight = sal_True; + else + GetImport().GetMM100UnitConverter().convertMeasure( nHeight, + rValue); + break; + case XML_TOK_TEXT_CONTOUR_AUTO: + bAuto = rValue.equalsAsciiL( sXML_true, sizeof(sXML_true)-1 ); break; } } -#if SUPD < 628 - // HACK!!!! - delete (SvXMLTokenMap *)&rTokenMap; -#endif OUString sContourPolyPolygon( RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon") ); - if( rPropSet->getPropertySetInfo()->hasPropertyByName( + Reference < XPropertySetInfo > xPropSetInfo = + rPropSet->getPropertySetInfo(); + if( xPropSetInfo->hasPropertyByName( sContourPolyPolygon ) && - nWidth > 0 && nHeight > 0 && (bPath ? sD : sPoints).getLength() ) + nWidth > 0 && nHeight > 0 && bPixelWidth == bPixelHeight && + (bPath ? sD : sPoints).getLength() ) { awt::Point aPoint( 0, 0 ); awt::Size aSize( nWidth, nHeight ); @@ -325,7 +337,23 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( aAny <<= aPoints.GetPointSequenceSequence(); } + OUString sIsPixelContour( + RTL_CONSTASCII_USTRINGPARAM("IsPixelContour") ); xPropSet->setPropertyValue( sContourPolyPolygon, aAny ); + + if( xPropSetInfo->hasPropertyByName( sIsPixelContour ) ) + { + aAny.setValue( &bPixelWidth, ::getBooleanCppuType() ); + xPropSet->setPropertyValue( sIsPixelContour, aAny ); + } + + OUString sIsAutomaticContour( + RTL_CONSTASCII_USTRINGPARAM("IsAutomaticContour") ); + if( xPropSetInfo->hasPropertyByName( sIsAutomaticContour ) ) + { + aAny.setValue( &bAuto, ::getBooleanCppuType() ); + xPropSet->setPropertyValue( sIsAutomaticContour, aAny ); + } } } diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 99591c71065a..37f158de9f3e 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtimp.cxx,v $ * - * $Revision: 1.69 $ + * $Revision: 1.70 $ * - * last change: $Author: dvo $ $Date: 2001-05-02 16:19:18 $ + * last change: $Author: mib $ $Date: 2001-05-04 09:49:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -495,6 +495,7 @@ static __FAR_DATA SvXMLTokenMapEntry aTextContourAttrTokenMap[] = { XML_NAMESPACE_SVG, sXML_viewBox, XML_TOK_TEXT_CONTOUR_VIEWBOX }, { XML_NAMESPACE_SVG, sXML_d, XML_TOK_TEXT_CONTOUR_D }, { XML_NAMESPACE_DRAW,sXML_points, XML_TOK_TEXT_CONTOUR_POINTS }, + { XML_NAMESPACE_DRAW,sXML_recreate_on_edit, XML_TOK_TEXT_CONTOUR_AUTO }, XML_TOKEN_MAP_END }; diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index a890f3c31f4a..cc9ecc235b82 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtparae.cxx,v $ * - * $Revision: 1.75 $ + * $Revision: 1.76 $ * - * last change: $Author: mib $ $Date: 2001-04-30 13:37:27 $ + * last change: $Author: mib $ $Date: 2001-05-04 09:49:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -722,6 +722,8 @@ XMLTextParagraphExport::XMLTextParagraphExport( sDocumentIndexMark(RTL_CONSTASCII_USTRINGPARAM("DocumentIndexMark")), sActualSize(RTL_CONSTASCII_USTRINGPARAM("ActualSize")), sContourPolyPolygon(RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon")), + sIsPixelContour(RTL_CONSTASCII_USTRINGPARAM("IsPixelContour")), + sIsAutomaticContour(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticContour")), sAnchorCharStyleName(RTL_CONSTASCII_USTRINGPARAM("AnchorCharStyleName")), sServerMap(RTL_CONSTASCII_USTRINGPARAM("ServerMap")), sRedline(RTL_CONSTASCII_USTRINGPARAM("Redline")), @@ -1922,18 +1924,45 @@ void XMLTextParagraphExport::exportContour( return; awt::Point aPoint( 0, 0 ); - awt::Size aSize; - aAny = rPropSet->getPropertyValue( sActualSize ); - aAny >>= aSize; + 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++; + } + + sal_Bool bPixel = sal_False; + if( rPropSetInfo->hasPropertyByName( sIsPixelContour ) ) + { + aAny = rPropSet->getPropertyValue( sIsPixelContour ); + bPixel = *(sal_Bool *)aAny.getValue(); + } // svg: width OUStringBuffer aStringBuffer( 10 ); - GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Width); + if( bPixel ) + GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Width); + else + GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Width); GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_width, aStringBuffer.makeStringAndClear() ); // svg: height - GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Height); + if( bPixel ) + GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Height); + else + GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Height); GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_height, aStringBuffer.makeStringAndClear() ); @@ -1987,6 +2016,15 @@ void XMLTextParagraphExport::exportContour( } } + if( rPropSetInfo->hasPropertyByName( sIsAutomaticContour ) ) + { + aAny = rPropSet->getPropertyValue( sIsAutomaticContour ); + if( *(sal_Bool *)aAny.getValue() ) + GetExport().AddAttributeASCII( XML_NAMESPACE_DRAW, + sXML_recreate_on_edit, + sXML_true ); + } + // write object now SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, pElem, sal_True, sal_True ); |