45#include <com/sun/star/container/XEnumerationAccess.hpp>
46#include <com/sun/star/container/XIndexReplace.hpp>
47#include <com/sun/star/graphic/XGraphic.hpp>
48#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
49#include <com/sun/star/i18n/XBreakIterator.hpp>
50#include <com/sun/star/style/NumberingType.hpp>
51#include <com/sun/star/text/XTextField.hpp>
112 aPartialState.
meFlags = eFlags;
149 : mrExport( rExport )
150 , mrFontExport( rFontExport )
151 , mrCurrentState( rCurState )
163 return floor( fValue * pow( 10.0, 3 ) + 0.5 ) / pow( 10.0, 3 );
173 rColorStr =
"rgb(" + OUString::number(rColor.
GetRed()) +
"," + OUString::number(rColor.
GetGreen()) +
174 "," + OUString::number(rColor.
GetBlue()) +
")";
180 const OUString& pColorOpacityAttrName,
181 const Color& rColor )
183 OUString aColor, aColorOpacity;
201 if( pObjBoundRect && pFillGradient )
203 OUString aGradientId;
207 if( !aGradientId.isEmpty() )
209 OUString aGradientURL =
"url(#" + aGradientId +
")";
224 ( rGradient.
GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.
GetStyle() == css::awt::GradientStyle_AXIAL ||
225 rGradient.
GetStyle() == css::awt::GradientStyle_RADIAL || rGradient.
GetStyle() == css::awt::GradientStyle_ELLIPTICAL ) )
232 static sal_Int32 nCurGradientId = 1;
234 aPoly.
Rotate( aObjRectCenter, nAngle );
246 rGradientId =
"Gradient_" + OUString::number( nCurGradientId++ );
250 std::unique_ptr< SvXMLElementExport > apGradient;
253 if( rGradient.
GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.
GetStyle() == css::awt::GradientStyle_AXIAL )
257 aLinePoly[ 0 ] =
Point( aObjRectCenter.
X(), aRect.
Top() );
258 aLinePoly[ 1 ] =
Point( aObjRectCenter.
X(), aRect.
Bottom() );
260 aLinePoly.
Rotate( aObjRectCenter, nAngle );
271 double fBorder =
static_cast< double >( rGradient.
GetBorder() ) *
272 ( ( rGradient.
GetStyle() == css::awt::GradientStyle_AXIAL ) ? 0.005 : 0.01 );
274 ImplGetColorStr( ( rGradient.
GetStyle() == css::awt::GradientStyle_AXIAL ) ? aEndColor : aStartColor, aColorStr );
282 if( rGradient.
GetStyle() == css::awt::GradientStyle_AXIAL )
293 if( rGradient.
GetStyle() != css::awt::GradientStyle_AXIAL )
306 const double fCenterX = rObjRect.
Left() + rObjRect.
GetWidth() * rGradient.
GetOfsX() * 0.01;
307 const double fCenterY = rObjRect.
Top() + rObjRect.
GetHeight() * rGradient.
GetOfsY() * 0.01;
308 const double fRadius = std::hypot(rObjRect.
GetWidth(), rObjRect.
GetHeight()) * 0.5;
346 if( rFont == rCurFont )
350 sal_Int32 nFontWeight;
365 aFontStyle =
"oblique";
367 aFontStyle =
"italic";
370 aFontStyle =
"normal";
387 default: nFontWeight = 400;
break;
394 OUString aTextDecoration;
398 aTextDecoration =
"underline ";
401 aTextDecoration +=
"line-through ";
404 aTextDecoration =
"none";
444 OUString sFontFamily( rsFontName.getToken( 0,
';' ) );
448 sFontFamily +=
", monospace";
454 sFontFamily +=
", serif";
456 sFontFamily +=
", sans-serif";
464: mrExport( rExport ),
465 mrAttributeWriter( rAttributeWriter ),
466 mrActionWriter(rActionWriter),
468 mbIsTextShapeStarted( false ),
469 mpTextEmbeddedBitmapMtf( nullptr ),
470 mpTargetMapMode( nullptr ),
471 mnLeftTextPortionLength( 0 ),
474 mbPositioningNeeded( false ),
475 mbIsNewListItem( false ),
478 mbIsListLevelStyleImage( false ),
479 mbLineBreak( false ),
480 mbIsURLField( false ),
481 mbIsPlaceholderShape( false )
510 OSL_FAIL(
"SVGTextWriter::implMap: invalid virtual device or map mode." );
519 OSL_FAIL(
"SVGTextWriter::implMap: invalid virtual device or map mode." );
536 OSL_FAIL(
"SVGTextWriter::implSetCorrectFontHeight: invalid virtual device." );
541template<
typename SubType >
544 const SubType* pA =
static_cast<const SubType*
>(pAction);
545 sal_uInt16
nLength = pA->GetLen();
549 raPos = pA->GetPoint();
557bool SVGTextWriter::implGetTextPosition<MetaTextRectAction>(
const MetaAction* pAction,
Point& raPos,
bool& rbEmpty )
571template<
typename SubType >
574 const SubType* pA =
static_cast<const SubType*
>(pAction);
575 raPos = pA->GetPoint();
593 sal_uInt32 nWriteFlags)
600 bool bConfigured =
false;
603 size_t nActionIndex = nCurAction + 1;
604 for( ; nActionIndex <
nCount; ++nActionIndex )
611 case MetaActionType::TEXT:
613 bConfigured = implGetTextPosition<MetaTextAction>( pAction, aPos, bEmpty );
617 case MetaActionType::TEXTRECT:
619 bConfigured = implGetTextPosition<MetaTextRectAction>( pAction, aPos, bEmpty );
623 case MetaActionType::TEXTARRAY:
625 bConfigured = implGetTextPosition<MetaTextArrayAction>( pAction, aPos, bEmpty );
629 case MetaActionType::FLOATTRANSPARENT:
634 size_t nTmpAction = 0;
650 case MetaActionType::STRETCHTEXT:
652 bConfigured = implGetTextPosition<MetaStretchTextAction>( pAction, aPos, bEmpty );
656 case MetaActionType::BMPSCALE:
658 bConfigured = implGetTextPositionFromBitmap<MetaBmpScaleAction>( pAction, aPos, bEmpty );
662 case MetaActionType::BMPEXSCALE:
664 bConfigured = implGetTextPositionFromBitmap<MetaBmpExScaleAction>( pAction, aPos, bEmpty );
670 case MetaActionType::COMMENT:
674 if( rsComment.equalsIgnoreAsciiCase(
"XTEXT_EOL" ) )
678 else if( rsComment.equalsIgnoreAsciiCase(
"XTEXT_EOP" ) )
686 if( sContent.isEmpty() )
692 if( sContent ==
"\n" )
701 if( sContent.isEmpty() )
707 if( sContent ==
"\n" )
713 else if( rsComment.equalsIgnoreAsciiCase(
"XTEXT_PAINTSHAPE_END" ) )
721 if( bConfigured || bEOL || bEOP || bETS )
break;
727 nCurAction = nActionIndex;
728 return ( bEOL ? -2 : ( bEOP ? -1 : 0 ) );
741 bool bConfigured =
false;
742 for(
size_t nActionIndex = nCurAction + 1; nActionIndex <
nCount; ++nActionIndex )
748 case MetaActionType::TEXTLINECOLOR:
749 case MetaActionType::TEXTFILLCOLOR:
750 case MetaActionType::TEXTCOLOR:
751 case MetaActionType::TEXTALIGN:
752 case MetaActionType::FONT:
753 case MetaActionType::LAYOUTMODE:
759 case MetaActionType::TEXT:
766 case MetaActionType::TEXTRECT:
769 if( pA->
GetText().getLength() > 2 )
773 case MetaActionType::TEXTARRAY:
780 case MetaActionType::STRETCHTEXT:
789 case MetaActionType::COMMENT:
793 if( rsComment.equalsIgnoreAsciiCase(
"XTEXT_EOP" ) )
801 if( bConfigured || bEOP )
break;
825 if( rsCurFontName != rsParFontName )
831 if( nCurFontSize != nParFontSize )
834 OUString::number( nCurFontSize ) +
"px" );
838 if( eCurFontItalic != eParFontItalic )
844 sFontStyle =
"oblique";
846 sFontStyle =
"italic";
850 sFontStyle =
"normal";
856 if( eCurFontWeight != eParFontWeight )
858 sal_Int32 nFontWeight;
859 switch( eCurFontWeight )
871 default: nFontWeight = 400;
break;
885 OUString sTextDecoration;
886 bool bIsDecorationChanged =
false;
887 if( eCurFontLineStyle != eParFontLineStyle )
890 sTextDecoration =
"underline";
891 bIsDecorationChanged =
true;
893 if( eCurFontStrikeout != eParFontStrikeout )
897 if( !sTextDecoration.isEmpty() )
898 sTextDecoration +=
" ";
899 sTextDecoration +=
"line-through";
901 bIsDecorationChanged =
true;
904 if( !sTextDecoration.isEmpty() )
908 else if( bIsDecorationChanged )
910 sTextDecoration =
"none";
915 if( bIsTextContainer )
923 OUString sFontFamily( rsFontName.getToken( 0,
';' ) );
927 sFontFamily +=
", monospace";
933 sFontFamily +=
", serif";
935 sFontFamily +=
", sans-serif";
947 Reference< XEnumerationAccess > xEnumerationAccess(
mrTextShape, UNO_QUERY_THROW );
948 Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_SET_THROW );
949 if( xEnumeration.is() )
955 OSL_FAIL(
"SVGTextWriter::createParagraphEnumeration: no valid xEnumeration interface found." );
960 OSL_FAIL(
"SVGTextWriter::createParagraphEnumeration: no valid XText interface found." );
976 if( xTextContent.is() )
978 Reference< XServiceInfo > xServiceInfo( xTextContent, UNO_QUERY_THROW );
979#if OSL_DEBUG_LEVEL > 0
982 if( xServiceInfo->supportsService(
"com.sun.star.text.Paragraph" ) )
985 Reference< XPropertySet > xPropSet( xTextContent, UNO_QUERY_THROW );
986 Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
987 if( xPropSetInfo->hasPropertyByName(
"NumberingLevel" ) )
989 sal_Int16 nListLevel = 0;
990 if( xPropSet->getPropertyValue(
"NumberingLevel" ) >>= nListLevel )
993#if OSL_DEBUG_LEVEL > 0
994 sInfo =
"NumberingLevel: " + OUString::number( nListLevel );
997 Reference< XIndexReplace > xNumRules;
998 if( xPropSetInfo->hasPropertyByName(
"NumberingRules" ) )
1000 xPropSet->getPropertyValue(
"NumberingRules" ) >>= xNumRules;
1002 if( xNumRules.is() && ( nListLevel < xNumRules->getCount() ) )
1004 bool bIsNumbered =
true;
1005 OUString sNumberingIsNumber(
"NumberingIsNumber");
1006 if( xPropSetInfo->hasPropertyByName( sNumberingIsNumber ) )
1008 if( !(xPropSet->getPropertyValue( sNumberingIsNumber ) >>= bIsNumbered ) )
1010 OSL_FAIL(
"numbered paragraph without number info" );
1011 bIsNumbered =
false;
1013#if OSL_DEBUG_LEVEL > 0
1025 Sequence<PropertyValue> aProps;
1026 if( xNumRules->getByIndex( nListLevel ) >>= aProps )
1028 sal_Int16
eType = NumberingType::CHAR_SPECIAL;
1030 const sal_Int32
nCount = aProps.getLength();
1031 const PropertyValue* pPropArray = aProps.getConstArray();
1034 const PropertyValue& rProp = pPropArray[
i];
1035 if( rProp.Name ==
"NumberingType" )
1037 rProp.Value >>=
eType;
1039 else if( rProp.Name ==
"BulletChar" )
1042 rProp.Value >>= sValue;
1043 if( !sValue.isEmpty() )
1045 cBullet = sValue[0];
1057 cBullet = 0xF000 + 149;
1060#if OSL_DEBUG_LEVEL > 0
1061 sInfo = OUString::number(
static_cast<sal_Int32
>(cBullet) );
1074 Reference< XEnumerationAccess > xEnumerationAccess( xTextContent, UNO_QUERY_THROW );
1075 Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_SET_THROW );
1076 if( xEnumeration.is() && xEnumeration->hasMoreElements() )
1080#if OSL_DEBUG_LEVEL > 0
1081 sInfo =
"Paragraph";
1084 else if( xServiceInfo->supportsService(
"com.sun.star.text.Table" ) )
1086 OSL_FAIL(
"SVGTextWriter::nextParagraph: text tables are not handled." );
1087#if OSL_DEBUG_LEVEL > 0
1093 OSL_FAIL(
"SVGTextWriter::nextParagraph: Unknown text content." );
1096#if OSL_DEBUG_LEVEL > 0
1103 OSL_FAIL(
"SVGTextWriter::nextParagraph: no XServiceInfo interface available for text content." );
1108 if( !rParagraphId.isEmpty() )
1111 Reference < XTextRange > xRange( xTextContent, UNO_QUERY_THROW );
1112 if ( xRange.is() && xRange->getString().isEmpty() )
1137 Reference< XPropertySetInfo > xPortionPropInfo( xPortionPropSet->getPropertySetInfo() );
1138 Reference < XTextRange > xPortionTextRange( xPortionPropSet, UNO_QUERY);
1139 if( !xPortionPropSet || !xPortionPropInfo
1140 || !xPortionPropInfo->hasPropertyByName(
"TextPortionType" ) )
1143#if OSL_DEBUG_LEVEL > 0
1145 OUString sPortionType;
1146 if( xPortionPropSet->getPropertyValue(
"TextPortionType" ) >>= sPortionType )
1148 sInfo =
"type: " + sPortionType +
"; ";
1154 if( xPortionTextRange.is() )
1156#if OSL_DEBUG_LEVEL > 0
1157 sInfo +=
"content: " + xPortionTextRange->getString() +
"; ";
1161 Reference < XPropertySet > xRangePropSet( xPortionTextRange, UNO_QUERY );
1162 if( xRangePropSet.is() && xRangePropSet->getPropertySetInfo()->hasPropertyByName(
"TextField" ) )
1164 Reference < XTextField > xTextField( xRangePropSet->getPropertyValue(
"TextField" ), UNO_QUERY );
1165 if( xTextField.is() )
1167 static constexpr OUStringLiteral sServicePrefix(
u"com.sun.star.text.textfield.");
1168 static constexpr OUStringLiteral sPresentationServicePrefix(
u"com.sun.star.presentation.TextField.");
1170 Reference< XServiceInfo > xService( xTextField, UNO_QUERY );
1171 const Sequence< OUString > aServices = xService->getSupportedServiceNames();
1173 const OUString* pNames = aServices.getConstArray();
1174 sal_Int32
nCount = aServices.getLength();
1176 OUString sFieldName;
1181 if ( pNames->matchIgnoreAsciiCase( sServicePrefix ) )
1184 sFieldName = pNames->copy( sServicePrefix.getLength() );
1187 else if( pNames->startsWith( sPresentationServicePrefix ) )
1190 sFieldName = pNames->copy( sPresentationServicePrefix.getLength() );
1198#if OSL_DEBUG_LEVEL > 0
1199 sInfo +=
"text field type: " + sFieldName +
"; content: " + xTextField->getPresentation(
false ) +
"; ";
1203 if( sFieldName ==
"DateTime" )
1205 Reference<XPropertySet> xTextFieldPropSet(xTextField, UNO_QUERY);
1206 if( xTextFieldPropSet.is() )
1208 Reference<XPropertySetInfo> xPropSetInfo = xTextFieldPropSet->getPropertySetInfo();
1209 if( xPropSetInfo.is() )
1214 bool bIsFixed =
true;
1215 if( xPropSetInfo->hasPropertyByName(
"IsFixed") && ( ( xTextFieldPropSet->getPropertyValue(
"IsFixed" ) ) >>= bIsFixed ) && !bIsFixed )
1217 bool bIsDate =
true;
1218 if( xPropSetInfo->hasPropertyByName(
"IsDate") && ( ( xTextFieldPropSet->getPropertyValue(
"IsDate" ) ) >>= bIsDate ) )
1220 msDateTimeType = OUString::createFromAscii( bIsDate ?
"Date" :
"Time" );
1226 if( sFieldName ==
"DateTime" || sFieldName ==
"Header"
1227 || sFieldName ==
"Footer" || sFieldName ==
"PageNumber"
1228 || sFieldName ==
"PageName" )
1232 else if (sFieldName ==
"PageCount")
1234 msPageCount = xTextField->getPresentation(
false );
1242 Reference<XPropertySet> xTextFieldPropSet(xTextField, UNO_QUERY);
1243 if( xTextFieldPropSet.is() )
1246 if( ( xTextFieldPropSet->getPropertyValue( sFieldName ) ) >>= sURL )
1248#if OSL_DEBUG_LEVEL > 0
1252 if( !
msUrl.isEmpty() )
1257 if( !rTextPortionId.isEmpty() )
1269#if OSL_DEBUG_LEVEL > 0
1282 OSL_FAIL(
"SVGTextWriter::startTextShape: text shape already defined." );
1295 OUString aTransform =
"rotate(" +
1297 OUString::number( aRot.
X() ) +
" " +
1298 OUString::number( aRot.
Y() ) +
")";
1331 OUString sNumberingType;
1334 case NumberingType::CHAR_SPECIAL:
1335 sNumberingType =
"bullet-style";
1337 case NumberingType::BITMAP:
1338 sNumberingType =
"image-style";
1341 sNumberingType =
"number-style";
1414 OUString
sId, sPosition, sScaling, sRefId;
1420 sId =
"bullet-char-" + bulletListItem.first;
1430 sPosition =
"translate(" +
1431 OUString::number( rInfo.
aPos.
X() ) +
1432 "," + OUString::number( rInfo.
aPos.
Y() ) +
")";
1448 sRefId =
"#bullet-char-template-" +
1461 if (
mpVDev->GetTextOutline(aPolyPolygon,
aStr))
1477template<
typename MetaBitmapActionType >
1481 const Point& rPos = pAction->GetPoint();
1493 OUString
sId =
"bitmap-placeholder(" +
msShapeId +
"." +
1494 OUString::number(
nId ) +
")";
1519 for(
size_t nCurAction = 0; nCurAction <
nCount; nCurAction++ )
1527 case MetaActionType::BMPSCALE:
1540 case MetaActionType::BMPEXSCALE:
1555 OUString
sId =
"embedded-bitmap(" +
msShapeId +
"." + OUString::number(
nId ) +
")";
1564 OUString sRefId =
"#bitmap(" + OUString::number( nChecksum ) +
")";
1583 const OUString& rText )
1585 if( rText.isEmpty() )
1588 bool bStandAloneTextPortion =
false;
1591 bStandAloneTextPortion =
true;
1599 bool bNotSync =
true;
1601 sal_Int32 nStartPos;
1614 Reference < XTextField > xTextField( xPropSet->getPropertyValue(
"TextField" ), UNO_QUERY );
1615 sContent = xTextField->getPresentation(
false );
1616 if( sContent.isEmpty() )
1617 OSL_FAIL(
"SVGTextWriter::writeTextPortion: content of URL TextField is empty." );
1628 if( nStartPos < 0 ) nStartPos = 0;
1631 if( sContent.isEmpty() )
1633 if( sContent ==
"\n" )
1635 else if (sContent ==
"\t")
1641 if( sContent.match( rText, nStartPos ) )
1653 if(
true || !bTextSpecial )
1665 if( bStandAloneTextPortion )
1673 const OUString& rText,
1677 Point aBaseLinePos( rPos );
1725 if( !
sId.isEmpty() )
1729 aBulletListItemInfo.
aFont = rFont;
1730 aBulletListItemInfo.
aColor = aTextColor;
1744 if( !rTextPortionId.isEmpty() )
1751 OUString sClass =
"PlaceholderText";
1807 mnCurGradientId( 1 ),
1809 mnCurPatternId( 1 ),
1810 mnCurClipPathId( 1 ),
1811 mrExport( rExport ),
1813 mrCurrentState( maContextHandler.getCurrentState() ),
1814 maAttributeWriter( rExport, rFontExport, mrCurrentState ),
1815 maTextWriter(rExport, maAttributeWriter, *this),
1817 mbClipAttrChanged( false ),
1818 mbIsPlaceholderShape( false ),
1819 mpEmbeddedBitmapsMap( nullptr ),
1820 mbIsPreview( false )
1822 mpVDev->EnableOutput(
false );
1836 Size aSz( nVal, nVal );
1838 return ImplMap( aSz, aSz ).Width();
1869 for( sal_uInt16
i = 0, nSize = rPoly.
GetSize();
i < nSize; ++
i )
1890 return rDstPolyPoly;
1896 OUStringBuffer aPathData;
1897 static constexpr OUStringLiteral aBlank(
u" " );
1898 static constexpr OUStringLiteral aComma(
u"," );
1903 const tools::Polygon& rPoly = rPolyPoly[
static_cast<sal_uInt16
>(
i) ];
1904 sal_uInt16
n = 1, nSize = rPoly.
GetSize();
1908 aPolyPoint = rPoly[ 0 ];
1909 aPathData.append(
"M " +
1910 OUString::number( aPolyPoint.
X() ) +
1912 OUString::number( aPolyPoint.
Y() ));
1914 char nCurrentMode = 0;
1915 const bool bClose(!bLine || rPoly[0] == rPoly[nSize - 1]);
1918 aPathData.append(aBlank);
1920 if ( ( rPoly.
GetFlags(
n ) == PolyFlags::Control ) && ( (
n + 2 ) < nSize ) )
1922 if ( nCurrentMode !=
'C' )
1925 aPathData.append(
"C ");
1927 for (
int j = 0; j < 3; j++ )
1930 aPathData.append(aBlank);
1932 aPolyPoint = rPoly[
n++ ];
1933 aPathData.append( OUString::number(aPolyPoint.
X()) +
1935 OUString::number( aPolyPoint.
Y() ) );
1940 if ( nCurrentMode !=
'L' )
1943 aPathData.append(
"L ");
1946 aPolyPoint = rPoly[
n++ ];
1947 aPathData.append( OUString::number(aPolyPoint.
X()) +
1949 OUString::number(aPolyPoint.
Y()) );
1954 aPathData.append(
" Z");
1957 aPathData.append(aBlank);
1961 return aPathData.makeStringAndClear();
1974 if (pEmbeddedBitmapsMap)
1977 OSL_FAIL(
"SVGActionWriter::SetEmbeddedBitmapRefs: passed pointer is null" );
1981 const Color* pLineColor )
1996 OSL_FAIL(
"SVGActionWriter::ImplWriteLine: Line color not implemented" );
2050 OUString::number( nStrokeWidth ) );
2082 case css::drawing::LineCap_ROUND:
2087 case css::drawing::LineCap_SQUARE:
2098 bool bApplyMapping )
2103 ImplMap( rPolyPoly, aPolyPoly );
2105 aPolyPoly = rPolyPoly;
2123 const bool bLineOnly
2130 if( !rShape.
maId.isEmpty() )
2172 case css::drawing::LineCap_ROUND:
2177 case css::drawing::LineCap_SQUARE:
2186 OUStringBuffer aDashArrayStr;
2188 for(
size_t k = 0; k < rShape.
maDashArray.size(); ++k )
2193 aDashArrayStr.append(
",");
2195 aDashArrayStr.append( nDash );
2225 if (nClipPathId == 0)
2228 OUString aUrl = OUString::Concat(
"url(#") +
aPrefixClipPathId + OUString::number( nClipPathId ) +
")";
2245 if( rPolyPoly.
Count() == 0 )
2254 const Hatch* pHatch,
2256 sal_uInt32 nWriteFlags )
2258 if( !rPolyPoly.
Count() )
2263 OUString aPatternId =
"pattern" + OUString::number(
mnCurPatternId++ );
2285 OUString aTransform =
"translate(" +
2286 OUString::number( -aRect.
Left() ) +
2287 "," + OUString::number( -aRect.
Top() ) +
2297 mpVDev->AddHatchActions( rPolyPoly, *pHatch, aTmpMtf );
2299 else if ( pGradient )
2310 OUString aPatternStyle =
"fill:url(#" + aPatternId +
")";
2320 if ( rGradient.
GetStyle() == css::awt::GradientStyle_LINEAR ||
2321 rGradient.
GetStyle() == css::awt::GradientStyle_AXIAL )
2335 if( !rPolyPoly.
Count() )
2340 OUString aGradientId =
"gradient" + OUString::number(
mnCurGradientId++ );
2348 Point aTmpCenter, aCenter;
2352 ImplMap( aTmpCenter, aCenter );
2359 aPoly[ 0 ].setX( aCenter.
X() );
2360 aPoly[ 1 ].setX( aCenter.
X() );
2361 aPoly[ 0 ].setY( aRect.
Top() );
2362 aPoly[ 1 ].setY( aRect.
Bottom() );
2363 aPoly.
Rotate( aCenter, nAngle );
2371 OUString(
"userSpaceOnUse" ) );
2378 if (
nullptr != pColorStops && pColorStops->size() > 1)
2382 aColorStops = *pColorStops;
2420 Color(rCand.getStopColor()),
2421 rCand.getStopOffset());
2427 OUString aGradientStyle =
"fill:url(#" + aGradientId +
")";
2438 OUString aStyle, aColor;
2439 aStyle +=
"stop-color:";
2451 sal_uInt16 nIntensity )
2456 return Color( nNewRed, nNewGreen, nNewBlue);
2461 const Gradient& rGradient, sal_uInt32 nWriteFlags,
2469 const double fOpacity = 1.0 -
static_cast<double>(rColor.
GetLuminance()) / 255;
2470 if (pTextFillOpacity)
2473 *pTextFillOpacity = OUString::number(fOpacity);
2478 aStyle =
"opacity: " + OUString::number(fOpacity);
2483 OUString aMaskId =
"mask" + OUString::number(
mnCurMaskId++);
2508 if (
nullptr != pColorStops)
2510 aLocalColorStops = *pColorStops;
2512 pColorStops = &aLocalColorStops;
2519 aStyle =
"mask:url(#" + aMaskId +
")";
2529 const double fScaleX
2530 = aSrcSize.
Width() ?
static_cast<double>(rDestSize.
Width()) / aSrcSize.
Width() : 1.0;
2531 const double fScaleY
2532 = aSrcSize.
Height() ?
static_cast<double>(rDestSize.
Height()) / aSrcSize.
Height() : 1.0;
2535 if (fScaleX != 1.0 || fScaleY != 1.0)
2537 rMtf.
Scale(fScaleX, fScaleY);
2542 nMoveX = rDestPt.
X() - aSrcPt.
X();
2543 nMoveY = rDestPt.
Y() - aSrcPt.
Y();
2545 if (nMoveX || nMoveY)
2546 rMtf.
Move(nMoveX, nMoveY);
2549 std::unique_ptr<SvXMLElementExport> pElemG;
2552 StartMask(rDestPt, rDestSize, rGradient, nWriteFlags, pColorStops);
2577 if( aMetric.
GetRelief() != FontRelief::NONE )
2591 Point aOffset( 6, 6 );
2593 if ( aMetric.
GetRelief() == FontRelief::Engraved )
2602 ImplWriteText( aPos, rText, pDXArray, nWidth, aReliefColor );
2620 aPos +=
Point( nOff, nOff );
2621 ImplWriteText( aPos, rText, pDXArray, nWidth, aShadowColor );
2633 aPos = rPos +
Point( +6, +6);
2635 aPos = rPos +
Point( -6, +0);
2637 aPos = rPos +
Point( -6, +6);
2639 aPos = rPos +
Point( +0, +6);
2641 aPos = rPos +
Point( +0, -6);
2643 aPos = rPos +
Point( +6, -1);
2645 aPos = rPos +
Point( +6, +0);
2659 sal_Int32 nLen = rText.getLength();
2662 Point aBaseLinePos( rPos );
2675 if( !pDXArray.
empty() )
2677 aNormSize =
Size(
mpVDev->GetTextWidth( rText ), 0 );
2678 aTmpArray.
assign(pDXArray);
2682 aNormSize =
Size(
mpVDev->GetTextArray( rText, &aTmpArray ), 0 );
2689 OUString aTransform =
"rotate(" +
2691 OUString::number( aRot.
X() ) +
" " +
2692 OUString::number( aRot.
Y() ) +
")";
2702 bool bIsPlaceholderField =
false;
2708 if( bIsPlaceholderField )
2710 OUString sCleanTextContent;
2712 if( rText.getLength() > nFrom )
2714 sCleanTextContent = rText.copy( nFrom );
2727 if( !bIsPlaceholderField )
2731 aNormSize.
setWidth( aTmpArray[ nLen - 2 ] +
mpVDev->GetTextWidth( OUString(rText[nLen - 1]) ) );
2733 if( nWidth && aNormSize.
Width() && ( nWidth != aNormSize.
Width() ) )
2736 const double fFactor =
static_cast<double>(nWidth) / aNormSize.
Width();
2738 for(
i = 0;
i < ( nLen - 1 );
i++ )
2745 sal_Int32 nCurPos = 0, nLastPos = 0, nX = aPos.
X();
2748 for(
bool bCont =
true; bCont; )
2753 nCurPos = xBI->nextCharacters( rText, nCurPos, rLocale,
2754 css::i18n::CharacterIteratorMode::SKIPCELL,
2757 nCount = nCurPos - nLastPos;
2758 bCont = ( nCurPos < rText.getLength() ) &&
nCount;
2762 const OUString aGlyph( rText.copy( nLastPos,
nCount ) );
2775 sal_Int32 nDXWidth = aTmpArray[ nCurPos - 1 ];
2776 nDXWidth =
ImplMap( nDXWidth );
2777 nX = aPos.
X() + nDXWidth;
2809 aPoly[ 0 ].setX( aBaseLinePos.
X() ); aPoly[ 0 ].setY( nYLinePos - ( nLineHeight >> 1 ) );
2810 aPoly[ 1 ].setX( aBaseLinePos.
X() + aNormSize.
Width() - 1 ); aPoly[ 1 ].setY( aPoly[ 0 ].
Y() );
2811 aPoly[ 2 ].setX( aPoly[ 1 ].
X() ); aPoly[ 2 ].setY( aPoly[ 0 ].
Y() + nLineHeight - 1 );
2812 aPoly[ 3 ].setX( aPoly[ 0 ].
X() ); aPoly[ 3 ].setY( aPoly[ 2 ].
Y() );
2819 const tools::Long nYLinePos = aBaseLinePos.
Y() + ( nLineHeight << 1 );
2821 aPoly[ 0 ].setX( aBaseLinePos.
X() ); aPoly[ 0 ].setY( nYLinePos - ( nLineHeight >> 1 ) );
2822 aPoly[ 1 ].setX( aBaseLinePos.
X() + aNormSize.
Width() - 1 ); aPoly[ 1 ].setY( aPoly[ 0 ].
Y() );
2823 aPoly[ 2 ].setX( aPoly[ 1 ].
X() ); aPoly[ 2 ].setY( aPoly[ 0 ].
Y() + nLineHeight - 1 );
2824 aPoly[ 3 ].setX( aPoly[ 0 ].
X() ); aPoly[ 3 ].setY( aPoly[ 2 ].
Y() );
2832void GetGraphicFromXShape(
const css::uno::Reference<css::drawing::XShape>* pShape,
Graphic& rGraphic)
2839 uno::Reference<beans::XPropertySet> xPropertySet(*pShape, uno::UNO_QUERY);
2840 if (!xPropertySet.is())
2845 uno::Reference<graphic::XGraphic> xGraphic;
2846 if (xPropertySet->getPropertySetInfo()->hasPropertyByName(
"Graphic"))
2848 xPropertySet->getPropertyValue(
"Graphic") >>= xGraphic;
2856 const Point& rSrcPt,
const Size& rSrcSz,
2857 const css::uno::Reference<css::drawing::XShape>* pShape )
2867 OUString sTransform;
2871 if( aPoint.
X() != 0 || aPoint.
Y() != 0 )
2872 sTransform =
"translate(" + OUString::number( aPoint.
X() ) +
", " + OUString::number( aPoint.
Y() ) +
")";
2877 MapMode aSourceMode( MapUnit::MapPixel );
2881 double scaleX = rtl_math_round(
double(aFractionX), 3, rtl_math_RoundingMode::rtl_math_RoundingMode_Corrected );
2882 double scaleY = rtl_math_round(
double(aFractionY), 3, rtl_math_RoundingMode::rtl_math_RoundingMode_Corrected );
2883 if( !rtl_math_approxEqual( scaleX, 1.0 ) || !rtl_math_approxEqual( scaleY, 1.0 ) )
2884 sTransform +=
" scale(" + OUString::number(
double(aFractionX) ) +
", " + OUString::number(
double(aFractionY) ) +
")";
2886 if( !sTransform.isEmpty() )
2890 OUString sRefId =
"#bitmap(" + OUString::number( nChecksum ) +
")";
2902 if( aSrcRect != aBmpRect )
2903 aBmpEx.
Crop( aSrcRect );
2910 bool bCached =
false;
2915 GetGraphicFromXShape(pShape, aGraphic);
2916 if (aGraphic.
GetType() == GraphicType::Bitmap)
2923 if (aGfxLink.
GetType() == GfxLinkType::NativePng)
2927 else if (aGfxLink.
GetType() == GfxLinkType::NativeJpg)
2941 std::unique_ptr<BitmapEx> pNewBitmap;
2947 double fX =
static_cast<double>(aSize.
getWidth()) / 1280;
2948 double fY =
static_cast<double>(aSize.
getHeight()) / 720;
2949 double fFactor = fX > fY ? fX : fY;
2954 pNewBitmap = std::make_unique<BitmapEx>(rBmpEx);
2955 pNewBitmap->Scale(aSize);
2956 pBitmap = pNewBitmap.get();
2969 aBuffer.append(
"data:image/jpeg;base64,");
2973 aBuffer.append(
"data:image/png;base64,");
2989 const bool embedVideo = (pMediaObj && !pMediaObj->
getTempURL().isEmpty());
3033 sal_uInt32 nWriteFlags,
3034 const OUString& aElementId,
3035 const Reference< css::drawing::XShape >* pxShape,
3040 sal_Int32 nEntryCount(0);
3042 bool bUseElementId = !aElementId.isEmpty();
3044#if OSL_DEBUG_LEVEL > 0
3045 bool bIsTextShape =
false;
3047 && Reference< XText >( *pxShape, UNO_QUERY ).is() )
3049 bIsTextShape =
true;
3058 bUseElementId =
false;
3066#if OSL_DEBUG_LEVEL > 0
3073 OUStringBuffer
sType(OUString::number(
static_cast<sal_uInt16
>(
nType)));
3074 if (pAction && (
nType == MetaActionType::COMMENT))
3079 if (!sComment.isEmpty())
3081 sType.append(OStringToOUString(
3082 sComment, RTL_TEXTENCODING_UTF8));
3084 if (sComment.equalsIgnoreAsciiCase(
"FIELD_SEQ_BEGIN"))
3089 sal_uInt16 sz =
static_cast<sal_uInt16
>((pA->
GetDataSize()) / 2);
3092 sType.append(OUString::Concat(
"; ")
3093 + std::u16string_view(
3100 if (
sType.getLength())
3103 sType.makeStringAndClear());
3116 case MetaActionType::PIXEL:
3128 case MetaActionType::POINT:
3140 case MetaActionType::LINE:
3152 case MetaActionType::RECT:
3162 case MetaActionType::ROUNDRECT:
3174 case MetaActionType::ELLIPSE:
3187 case MetaActionType::ARC:
3188 case MetaActionType::PIE:
3189 case MetaActionType::CHORD:
3190 case MetaActionType::POLYGON:
3198 case MetaActionType::ARC:
3205 case MetaActionType::PIE:
3212 case MetaActionType::CHORD:
3219 case MetaActionType::POLYGON:
3234 case MetaActionType::POLYLINE:
3251 case MetaActionType::POLYPOLYGON:
3258 if( rPolyPoly.
Count() )
3267 case MetaActionType::GRADIENT:
3280 case MetaActionType::GRADIENTEX:
3290 case MetaActionType::HATCH:
3300 case MetaActionType::Transparent:
3307 if( rPolyPoly.
Count() )
3309 Color aNewLineColor(
mpVDev->GetLineColor() ), aNewFillColor(
mpVDev->GetFillColor() );
3314 if ( aNewLineColor.GetAlpha() > 0 )
3315 aNewLineColor.SetAlpha( 255 - sal::static_int_cast<sal_uInt8>(
FRound( pA->
GetTransparence() * 2.55 ) ) );
3325 case MetaActionType::FLOATTRANSPARENT:
3337 case MetaActionType::EPS:
3343 bool bFound =
false;
3345 for( sal_uInt32 k = 0, nCount2 = aGDIMetaFile.
GetActionSize(); ( k < nCount2 ) && !bFound; ++k )
3349 if( pSubstAct->
GetType() == MetaActionType::BMPSCALE )
3362 case MetaActionType::COMMENT:
3366 if (pA->
GetComment().equalsIgnoreAsciiCase(
"BGRAD_SEQ_BEGIN"))
3372 while (!bDone && (++nCurAction <
nCount))
3376 if (MetaActionType::GRADIENTEX == pAction->
GetType())
3381 else if (MetaActionType::COMMENT == pAction->
GetType()
3382 &&
static_cast<const MetaCommentAction*
>(pAction)->GetComment().equalsIgnoreAsciiCase(
"BGRAD_SEQ_END"))
3389 if (
nullptr != pGradAction)
3397 double fOff, fR, fG, fB;
3400 const size_t nMaxPossibleEntries = aMemStm.
remainingSize() / 4 *
sizeof(double);
3401 if (nTmp > nMaxPossibleEntries)
3403 SAL_WARN(
"filter.svg",
"gradient record claims to have: " << nTmp <<
" entries, but only " << nMaxPossibleEntries <<
" possible, clamping");
3404 nTmp = nMaxPossibleEntries;
3407 for (sal_uInt16
a(0);
a < nTmp;
a++)
3421 else if( ( pA->
GetComment().equalsIgnoreAsciiCase(
"XGRAD_SEQ_BEGIN") ) &&
3427 while( !bDone && ( ++nCurAction <
nCount ) )
3431 if( pAction->
GetType() == MetaActionType::GRADIENTEX )
3433 else if( ( pAction->
GetType() == MetaActionType::COMMENT ) &&
3444 else if( ( pA->
GetComment().equalsIgnoreAsciiCase(
"XPATHFILL_SEQ_BEGIN") ) &&
3469 aFill.
getPath( aShapePolyPoly );
3471 if( aShapePolyPoly.
Count() )
3477 mapCurShape->maId = aElementId +
"_" + OUString::number(nEntryCount++);
3488 && (++nCurAction <
nCount))
3492 if( ( pAction->
GetType() == MetaActionType::COMMENT ) &&
3498 else if( pAction->
GetType() == MetaActionType::GRADIENTEX )
3503 else if( pAction->
GetType() == MetaActionType::GRADIENT )
3516 while( bSkip && ( ++nCurAction <
nCount ) )
3520 if( ( pAction->
GetType() == MetaActionType::COMMENT ) &&
3528 else if( ( pA->
GetComment().equalsIgnoreAsciiCase(
"XPATHSTROKE_SEQ_BEGIN") ) &&
3549 || !
mapCurShape->maShapePolyPoly[0].IsEqual(aPoly))
3565 mapCurShape->maId = aElementId +
"_" + OUString::number(nEntryCount++);
3601 mapCurShape->maLineCap = css::drawing::LineCap_BUTT;
3606 mapCurShape->maLineCap = css::drawing::LineCap_ROUND;
3611 mapCurShape->maLineCap = css::drawing::LineCap_SQUARE;
3625 mapCurShape->maLineCap = css::drawing::LineCap_BUTT;
3627 if(aStartArrow.
Count())
3633 mapCurShape->maId = aElementId +
"_" + OUString::number(nEntryCount++);
3639 if(aEndArrow.
Count())
3645 mapCurShape->maId = aElementId +
"_" + OUString::number(nEntryCount++);
3664 while( bSkip && ( ++nCurAction <
nCount ) )
3668 if( ( pAction->
GetType() == MetaActionType::COMMENT ) &&
3678 if( pA->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_PAINTSHAPE_BEGIN" ) )
3682 Reference< XText > xText( *pxShape, UNO_QUERY );
3691 sal_Int32 nTextFound = -1;
3692 while( ( nTextFound < 0 ) && ( nCurAction <
nCount ) )
3698 if( nTextFound > 0 )
3714 else if( pA->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_PAINTSHAPE_END" ) )
3718 else if( pA->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_EOP" ) )
3721 if( !( ( pNextAction->
GetType() == MetaActionType::COMMENT ) &&
3727 sal_Int32 nTextFound = -1;
3728 while( ( nTextFound < 0 ) && ( nCurAction <
nCount ) )
3735 if( nTextFound > 0 )
3752 else if( pA->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_EOL" ) )
3755 if( !( ( pNextAction->
GetType() == MetaActionType::COMMENT ) &&
3761 sal_Int32 nTextFound = -2;
3762 while( ( nTextFound < -1 ) && ( nCurAction <
nCount ) )
3769 if( nTextFound > 0 )
3792 OUString sRefId =
"#" + OUString::fromUtf8(
o3tl::getToken(sComment, 1,
' ') );
3800 case MetaActionType::BMP:
3813 case MetaActionType::BMPSCALE:
3834 case MetaActionType::BMPSCALEPART:
3847 case MetaActionType::BMPEX:
3860 case MetaActionType::BMPEXSCALE:
3881 case MetaActionType::BMPEXSCALEPART:
3894 case MetaActionType::TEXT:
3899 sal_Int32 aLength = std::min( pA->
GetText().getLength(), pA->
GetLen() );
3902 if( !aText.isEmpty() )
3919 case MetaActionType::TEXTRECT:
3939 case MetaActionType::TEXTARRAY:
3944 sal_Int32 aLength = std::min( pA->
GetText().getLength(), pA->
GetLen() );
3947 if( !aText.isEmpty() )
3964 case MetaActionType::STRETCHTEXT:
3969 sal_Int32 aLength = std::min( pA->
GetText().getLength(), pA->
GetLen() );
3972 if( !aText.isEmpty() )
3989 case MetaActionType::CLIPREGION:
3990 case MetaActionType::ISECTRECTCLIPREGION:
3991 case MetaActionType::ISECTREGIONCLIPREGION:
3992 case MetaActionType::MOVECLIPREGION:
4002 case MetaActionType::PUSH:
4013 case MetaActionType::POP:
4029 case MetaActionType::REFPOINT:
4030 case MetaActionType::MAPMODE:
4031 case MetaActionType::LINECOLOR:
4032 case MetaActionType::FILLCOLOR:
4033 case MetaActionType::TEXTLINECOLOR:
4034 case MetaActionType::TEXTFILLCOLOR:
4035 case MetaActionType::TEXTCOLOR:
4036 case MetaActionType::TEXTALIGN:
4037 case MetaActionType::FONT:
4038 case MetaActionType::LAYOUTMODE:
4044 case MetaActionType::RASTEROP:
4045 case MetaActionType::MASK:
4046 case MetaActionType::MASKSCALE:
4047 case MetaActionType::MASKSCALEPART:
4048 case MetaActionType::WALLPAPER:
4049 case MetaActionType::TEXTLINE:
4050 case MetaActionType::TEXTLANGUAGE:
4057 SAL_WARN(
"filter.svg",
"SVGActionWriter::ImplWriteActions: unsupported MetaAction # " << sal_Int32(
nType));
4078 const Size& rSize100thmm,
4080 sal_uInt32 nWriteFlags,
4081 const OUString& aElementId,
4082 const Reference< css::drawing::XShape >* pXShape,
4102 mpVDev->SetMapMode( aMapMode );
4106 ImplWriteActions( rMtf, nWriteFlags, aElementId, pXShape, pTextEmbeddedBitmapMtf );
4124 if(
args.getLength()==1)
4135 const Sequence<sal_Int8>& rMtfSeq )
4137 SvMemoryStream aMemStm(
const_cast<sal_Int8 *
>(rMtfSeq.getConstArray()), rMtfSeq.getLength(), StreamMode::READ );
4141 aReader.
Read( aMtf );
4144 pWriter->writeMtf( aMtf );
4154 return "com.sun.star.comp.Draw.SVGWriter";
4158 return {
"com.sun.star.svg.SVGWriter" };
4161extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
4163 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& args)
constexpr OUStringLiteral sServiceName
sal_uInt64 BitmapChecksum
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
BitmapChecksum GetChecksum() const
bool Crop(const tools::Rectangle &rRectPixel)
const Size & GetSizePixel() const
Size GetSizePixel() const
sal_uInt8 GetLuminance() const
sal_uInt8 GetBlue() const
void SetGreen(sal_uInt8 nGreen)
void SetRed(sal_uInt8 nRed)
basegfx::BColor getBColor() const
sal_uInt8 GetAlpha() const
sal_uInt8 GetGreen() const
void SetAlpha(sal_uInt8 nAlpha)
void SetBlue(sal_uInt8 nBlue)
tools::Long GetLineHeight() const
tools::Long GetDescent() const
tools::Long GetAscent() const
const sal_uInt8 * GetData() const
sal_uInt32 GetDataSize() const
GfxLinkType GetType() const
sal_uInt16 GetStartIntensity() const
Degree10 GetAngle() const
sal_uInt16 GetEndIntensity() const
void SetStartIntensity(sal_uInt16 nIntens)
void AddGradientActions(tools::Rectangle const &rRect, GDIMetaFile &rMetaFile)
sal_uInt16 GetOfsX() const
sal_uInt16 GetBorder() const
const Color & GetEndColor() const
sal_uInt16 GetOfsY() const
const Color & GetStartColor() const
void SetStartColor(const Color &rColor)
css::awt::GradientStyle GetStyle() const
sal_uInt16 GetSteps() const
void GetBoundRect(const tools::Rectangle &rRect, tools::Rectangle &rBoundRect, Point &rCenter) const
void SetEndColor(const Color &rColor)
void SetEndIntensity(sal_uInt16 nIntens)
static ErrCode Export(SvStream &rOStm, const Graphic &rGraphic, ConvertDataFormat nFormat)
GraphicType GetType() const
GfxLink GetGfxLink() const
const BitmapEx & GetBitmapExRef() const
void assign(KernArraySpan other)
void set(size_t nIndex, sal_Int32 nValue)
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
basegfx::B2DLineJoin GetLineJoin() const
css::drawing::LineCap GetLineCap() const
void SetOrigin(const Point &rOrigin)
void SetScaleY(const Fraction &rScaleY)
const Fraction & GetScaleX() const
const Point & GetOrigin() const
const Fraction & GetScaleY() const
void SetScaleX(const Fraction &rScaleX)
sal_uInt32 GetWidth() const
sal_Int32 GetIndex() const
const OUString & GetText() const
const Point & GetPoint() const
const Point & GetPoint() const
const OUString & GetText() const
sal_Int32 GetIndex() const
sal_Int32 GetIndex() const
const KernArray & GetDXArray() const
const OUString & GetText() const
const Point & GetPoint() const
const tools::Rectangle & GetRect() const
const OUString & GetText() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
constexpr tools::Long X() const
const MetaBitmapActionMap * mpEmbeddedBitmapsMap
sal_Int32 mnCurClipPathId
tools::Long ImplMap(sal_Int32 nVal) const
void ImplWritePattern(const tools::PolyPolygon &rPolyPoly, const Hatch *pHatch, const Gradient *pGradient, sal_uInt32 nWriteFlags)
void ImplCreateClipPathDef(const tools::PolyPolygon &rPolyPoly)
static Color ImplGetColorWithIntensity(const Color &rColor, sal_uInt16 nIntensity)
::std::unique_ptr< SvXMLElementExport > mpCurrentClipRegionElem
void ImplWriteBmp(const BitmapEx &rBmpEx, const Point &rPt, const Size &rSz, const Point &rSrcPt, const Size &rSrcSz, const css::uno::Reference< css::drawing::XShape > *pShape)
SVGTextWriter maTextWriter
void ImplWriteGradientLinear(const tools::PolyPolygon &rPolyPoly, const Gradient &rGradient, const basegfx::BColorStops *pColorStops)
void ImplWriteText(const Point &rPos, const OUString &rText, KernArraySpan pDXArray, tools::Long nWidth)
void ImplWriteActions(const GDIMetaFile &rMtf, sal_uInt32 nWriteFlags, const OUString &aElementId, const Reference< css::drawing::XShape > *pXShape=nullptr, const GDIMetaFile *pTextEmbeddedBitmapMtf=nullptr)
void ImplWriteShape(const SVGShapeDescriptor &rShape)
void ImplWriteGradientStop(const Color &rColor, double fOffset)
void ImplWriteLine(const Point &rPt1, const Point &rPt2, const Color *pLineColor=nullptr)
void ImplStartClipRegion(sal_Int32 nClipPathId)
void WriteMetaFile(const Point &rPos100thmm, const Size &rSize100thmm, const GDIMetaFile &rMtf, sal_uInt32 nWriteFlags, const OUString &aElementId="", const Reference< css::drawing::XShape > *pXShape=nullptr, const GDIMetaFile *pTextEmbeddedBitmapMtf=nullptr)
void ImplAddLineAttr(const LineInfo &rAttrs)
void SetEmbeddedBitmapRefs(const MetaBitmapActionMap *pEmbeddedBitmapsMap)
sal_Int32 mnCurGradientId
void ImplWriteGradientEx(const tools::PolyPolygon &rPolyPoly, const Gradient &rGradient, sal_uInt32 nWriteFlags, const basegfx::BColorStops *pColorStops)
SVGContextHandler maContextHandler
static OUString GetPathString(const tools::PolyPolygon &rPolyPoly, bool bLine)
void ImplWritePolyPolygon(const tools::PolyPolygon &rPolyPoly, bool bLineOnly, bool bApplyMapping=true)
::std::unique_ptr< SVGShapeDescriptor > mapCurShape
void ImplWriteRect(const tools::Rectangle &rRect, tools::Long nRadX=0, tools::Long nRadY=0)
void ImplWriteMask(GDIMetaFile &rMtf, const Point &rDestPt, const Size &rDestSize, const Gradient &rGradient, sal_uInt32 nWriteFlags, const basegfx::BColorStops *pColorStops)
SVGActionWriter(SVGExport &rExport, SVGFontExport &rFontExport)
void StartMask(const Point &rDestPt, const Size &rDestSize, const Gradient &rGradient, sal_uInt32 nWriteFlags, const basegfx::BColorStops *pColorStops, OUString *pTextStyle=nullptr)
VclPtr< VirtualDevice > mpVDev
void ImplWriteEllipse(const Point &rCenter, tools::Long nRadX, tools::Long nRadY)
bool mbIsPlaceholderShape
SVGAttributeWriter maAttributeWriter
static BitmapChecksum GetChecksum(const MetaAction *pAction)
vcl::Font ImplSetCorrectFontHeight() const
SVGState & mrCurrentState
void ImplWriteClipPath(const tools::PolyPolygon &rPolyPoly)
static void ImplGetColorStr(const Color &rColor, OUString &rColorStr)
SVGAttributeWriter(SVGExport &rExport, SVGFontExport &rFontExport, SVGState &rCurState)
void SetFontAttr(const vcl::Font &rFont)
void AddPaintAttr(const Color &rLineColor, const Color &rFillColor, const tools::Rectangle *pObjBoundRect=nullptr, const Gradient *pFillGradient=nullptr)
void AddGradientDef(const tools::Rectangle &rObjRect, const Gradient &rGradient, OUString &rGradientId)
SVGFontExport & mrFontExport
void AddColorAttr(const OUString &pColorAttrName, const OUString &pColorOpacityAttrName, const Color &rColor)
SVGState & mrCurrentState
std::unique_ptr< SvXMLElementExport > mpElemFont
static double ImplRound(double fVal)
::std::stack< PartialState > maStateStack
SVGState & getCurrentState()
void pushState(vcl::PushFlags eFlags)
vcl::PushFlags getPushFlags() const
bool IsUseNativeTextDecoration() const
bool IsUseOpacity() const
bool IsEmbeddedBulletGlyph(sal_Unicode cBullet) const
bool IsUsePositionedCharacters() const
OUString GetMappedFontName(std::u16string_view rFontName) const
bool mbIsPlaceholderShape
std::unique_ptr< SvXMLElementExport > mpTextShapeElem
void setVirtualDevice(VirtualDevice *pVDev, MapMode &rTargetMapMode)
void implWriteTextPortion(const Point &rPos, const OUString &rText, Color aTextColor)
sal_Int32 mnLeftTextPortionLength
Reference< XEnumeration > mrTextPortionEnumeration
bool implGetTextPositionFromBitmap(const MetaAction *pAction, Point &raPos, bool &rbEmpty)
std::unique_ptr< SvXMLElementExport > mpTextParagraphElem
bool mbIsTextShapeStarted
const OUString & implGetValidIDFromInterface(const Reference< XInterface > &rxIf)
sal_Int32 setTextPosition(const GDIMetaFile &rMtf, size_t &nCurAction, sal_uInt32 nWriteFlags)
setTextPosition Set the start position of the next line of text.
bool hasTextOpacity() const
std::unique_ptr< SvXMLElementExport > mpTextPositionElem
void setTextShape(const Reference< XText > &rxText, const GDIMetaFile *pTextEmbeddedBitmapMtf)
bool mbIsListLevelStyleImage
void startTextPosition(bool bExportX=true, bool bExportY=true)
Reference< XTextContent > mrCurrentTextParagraph
SVGTextWriter(SVGExport &rExport, SVGAttributeWriter &rAttributeWriter, SVGActionWriter &mrActionWriter)
sal_Int16 meNumberingType
Reference< XText > mrTextShape
bool implGetTextPosition(const MetaAction *pAction, Point &raPos, bool &bEmpty)
OUString msHyperlinkIdList
void implWriteBulletChars()
void writeBitmapPlaceholder(const MetaBitmapActionType *pAction)
bool isTextShapeStarted() const
const GDIMetaFile * mpTextEmbeddedBitmapMtf
void startTextParagraph()
void implSetCurrentFont()
void writeTextPortion(const Point &rPos, const OUString &rText)
MapMode * mpTargetMapMode
Reference< XTextRange > mrCurrentTextPortion
VclPtr< VirtualDevice > mpVDev
void implWriteEmbeddedBitmaps()
void implRegisterInterface(const Reference< XInterface > &rxIf)
void implMap(const Size &rSz, Size &rDstSz) const
SVGActionWriter & mrActionWriter
void createParagraphEnumeration()
SVGAttributeWriter & mrAttributeWriter
void setTextProperties(const GDIMetaFile &rMtf, size_t nCurAction)
std::unordered_map< OUString, BulletListItemInfo > maBulletListItemMap
void implExportHyperlinkIds()
Reference< XEnumeration > mrParagraphEnumeration
void addFontAttributes(bool bIsTextContainer)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Sequence< css::beans::PropertyValue > maFilterData
SVGWriter(const Sequence< Any > &args, const Reference< XComponentContext > &rxCtx)
virtual OUString SAL_CALL getImplementationName() override
Reference< XComponentContext > mxContext
virtual ~SVGWriter() override
virtual void SAL_CALL write(const Reference< XDocumentHandler > &rxDocHandler, const Sequence< sal_Int8 > &rMtfSeq) override
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
SvStream & ReadDouble(double &rDouble)
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt64 remainingSize()
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
OUString GetRelativeReference(const OUString &rValue)
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
const css::uno::Reference< css::xml::sax::XDocumentHandler > & GetDocHandler() const
SvStream & Read(GDIMetaFile &rMetaFile, ImplMetaReadData *pData=nullptr)
static BitmapChecksum GetChecksum(const GDIMetaFile &rMetaFile)
double getTransparency() const
FillType getFillType() const
void getPath(tools::PolyPolygon &) const
GradientType getGradientType() const
const Color & getFillColor() const
void getPath(tools::Polygon &) const
void getStartArrow(tools::PolyPolygon &) const
JoinType getJoinType() const
void getEndArrow(tools::PolyPolygon &) const
void getDashArray(DashArray &) const
double getTransparency() const
CapType getCapType() const
double getStrokeWidth() const
void tryToApplyStartEndIntensity()
const basegfx::BColorStops & GetColorStops() const
static void encode(OUStringBuffer &aStrBuffer, const css::uno::Sequence< sal_Int8 > &aPass)
const OUString & getIdentifier(const css::uno::Reference< css::uno::XInterface > &rInterface) const
const OUString & registerReference(const css::uno::Reference< css::uno::XInterface > &rInterface)
tools::Long GetFontHeight() const
FontFamily GetFamilyType()
FontStrikeout GetStrikeout() const
FontRelief GetRelief() const
void SetFontHeight(tools::Long nHeight)
const OUString & GetFamilyName() const
TextAlign GetAlignment() const
FontLineStyle GetUnderline() const
Degree10 GetOrientation() const
tools::PolyPolygon GetAsPolyPolygon() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
tools::Long FRound(double fVal)
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
std::unique_ptr< sal_Int32[]> pData
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
const sal_uInt16 XML_NAMESPACE_NONE
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
VCL_DLLPUBLIC css::uno::Reference< css::i18n::XBreakIterator > CreateBreakIterator()
const vcl::Font & getFont(const vcl::Font &rDefaultFont) const
void setFont(const vcl::Font &rFont)
sal_Int32 mnRegionClipPathId
SvtGraphicStroke::DashArray maDashArray
::std::optional< Gradient > moShapeGradient
css::drawing::LineCap maLineCap
tools::PolyPolygon maShapePolyPoly
basegfx::B2DLineJoin maLineJoin
sal_Int32 nRegionClipPathId
UNDERLYING_TYPE get() const
constexpr OStringLiteral sTiledBackgroundTag
std::unordered_map< BitmapChecksum, std::unique_ptr< GDIMetaFile > > MetaBitmapActionMap
constexpr OUStringLiteral sPlaceholderTag
constexpr OUStringLiteral aXMLElemLinearGradient
constexpr OUStringLiteral aXMLAttrOffset
constexpr OUStringLiteral aXMLAttrWidth
constexpr OUStringLiteral aXMLElemText
constexpr OUStringLiteral aXMLAttrY1
constexpr OUStringLiteral aXMLAttrHeight
constexpr OUStringLiteral aXMLElemDefs
constexpr OUStringLiteral aXMLAttrFontWeight
constexpr OUStringLiteral aXMLAttrTransform
constexpr OUStringLiteral aXMLElemG
constexpr OUStringLiteral aXMLAttrStrokeWidth
constexpr OUStringLiteral aXMLAttrStyle
constexpr OUStringLiteral aXMLAttrStopColor
constexpr OUStringLiteral aXMLAttrX
constexpr OUStringLiteral aXMLAttrTextDecoration
constexpr OUStringLiteral aXMLAttrY2
constexpr OUStringLiteral aXMLAttrGradientUnits
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * filter_SVGWriter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &args)
constexpr OUStringLiteral aXMLAttrFontSize
constexpr OUStringLiteral aXMLAttrX1
constexpr OUStringLiteral aXMLAttrX2
constexpr OUStringLiteral aXMLAttrStrokeLinejoin
constexpr OUStringLiteral aXMLAttrCX
constexpr OUStringLiteral aXMLElemTspan
constexpr OUStringLiteral aXMLAttrFill
constexpr OUStringLiteral aXMLAttrFontStyle
constexpr OUStringLiteral aXMLAttrY
constexpr OUStringLiteral aXMLAttrRX
constexpr OUStringLiteral aXMLAttrCY
constexpr OUStringLiteral aXMLAttrFontFamily
constexpr OUStringLiteral aXMLAttrStrokeLinecap
constexpr OUStringLiteral aXMLAttrRY
constexpr OUStringLiteral aXMLElemStop
constexpr OUStringLiteral aPrefixClipPathId
constexpr OUStringLiteral aXMLAttrXLinkHRef
constexpr OUStringLiteral aXMLAttrId
#define SVGWRITER_WRITE_FILL
#define SVGWRITER_WRITE_TEXT
#define SVGWRITER_NO_SHAPE_COMMENTS
std::unique_ptr< char[]> aBuffer