20#ifndef INCLUDED_OOX_EXPORT_DRAWINGML_HXX
21#define INCLUDED_OOX_EXPORT_DRAWINGML_HXX
26#include <unordered_map>
30#include <com/sun/star/beans/PropertyState.hpp>
31#include <com/sun/star/uno/Any.hxx>
32#include <com/sun/star/uno/Reference.hxx>
33#include <com/sun/star/uno/Sequence.hxx>
34#include <com/sun/star/style/ParagraphAdjust.hpp>
35#include <com/sun/star/drawing/Hatch.hpp>
36#include <com/sun/star/i18n/ScriptType.hpp>
39#include <oox/token/tokens.hxx>
41#include <rtl/string.hxx>
42#include <rtl/ustring.hxx>
60 struct FontDescriptor;
70 struct EnhancedCustomShapeParameterPair;
71 struct EnhancedCustomShapeParameter;
115 virtual OUString getTransformedString(
const OUString& rURL)
const;
117 virtual bool isExternalURL(
const OUString& rURL)
const;
124 return ((21600000 - input.
get() * 600) % 21600000);
133 virtual void WriteTextBox(css::uno::Reference<css::drawing::XShape> xShape) = 0;
136 css::uno::Reference<css::drawing::XShape> xShape) = 0;
170 bool GetProperty(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
const OUString& aName );
171 bool GetPropertyAndState(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
172 const css::uno::Reference< css::beans::XPropertyState >& rXPropState,
173 const OUString& aName, css::beans::PropertyState& eState );
174 OUString GetFieldValue(
const css::uno::Reference< css::text::XTextRange >& rRun,
bool& bIsURLField );
179 static OUString GetDatetimeTypeFromDate(
SvxDateFormat eDate);
184 static OUString GetDatetimeTypeFromTime(
SvxTimeFormat eTime);
193 void WriteMediaNonVisualProperties(
const css::uno::Reference<css::drawing::XShape>& xShape);
195 void WriteStyleProperties( sal_Int32 nTokenId,
const css::uno::Sequence< css::beans::PropertyValue >& aProperties );
197 const char* GetComponentDir()
const;
198 const char* GetRelationCompPrefix()
const;
200 static bool EqualGradients( css::awt::Gradient aGradient1, css::awt::Gradient aGradient2 );
201 bool IsFontworkShape(
const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
203 void WriteGlowEffect(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
204 void WriteSoftEdgeEffect(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
205 void WriteCustomGeometryPoint(
const css::drawing::EnhancedCustomShapeParameterPair& rParamPair,
207 const bool bReplaceGeoWidth,
const bool bReplaceGeoHeight);
208 bool WriteCustomGeometrySegment(
209 const sal_Int16 eCommand,
const sal_Int32
nCount,
210 const css::uno::Sequence<css::drawing::EnhancedCustomShapeParameterPair>& rPairs,
211 sal_Int32& rnPairIndex,
double& rfCurrentX,
double& rfCurrentY,
bool& rbCurrentValid,
213 const bool bReplaceGeoWidth,
const bool bReplaceGeoHeight);
217 : meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS(
std::move( pFS )), mpFB( pFB ), mbIsBackgroundDark( false ), mbPlaceholder(false) {}
219 const ::sax_fastparser::FSHelperPtr&
GetFS()
const {
return mpFS; }
227 OUString WriteImage(
const Graphic &rGraphic ,
bool bRelPathToMedia =
false );
230 void WriteColor(
const OUString& sColorSchemeName,
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
231 void WriteColor( const ::Color nColor,
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
232 void WriteColorTransformations(
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
233 void WriteGradientStop(sal_uInt16 nStop,
::Color nColor, sal_Int32 nAlpha =
MAX_PERCENT);
234 void WriteLineArrow(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
bool bLineStart );
235 void WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
237 bool WriteCharColor(
const css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
238 bool WriteSchemeColor(OUString
const& rPropertyName,
const css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
241 void WriteSolidFill(
const OUString& sSchemeName,
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
242 void WriteSolidFill( const ::Color nColor,
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
243 void WriteSolidFill(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
247 const css::uno::Reference<css::beans::XPropertySet>& rXPropSet = css::uno::Reference<css::beans::XPropertySet>());
249 void WriteGrabBagGradientFill(
const css::uno::Sequence< css::beans::PropertyValue >& aGradientStops, css::awt::Gradient rGradient);
251 void WriteBlipOrNormalFill(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
252 const OUString& rURLPropName,
const css::awt::Size& rSize = {});
253 void WriteBlipFill(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
254 const OUString& sURLPropName,
const css::awt::Size& rSize = {});
255 void WriteBlipFill(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
256 const css::awt::Size& rSize,
const OUString& sURLPropName,
257 sal_Int32 nXmlNamespace);
259 void WriteXGraphicBlipFill(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet,
260 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic,
261 sal_Int32 nXmlNamespace,
bool bWriteMode,
262 bool bRelPathToMedia =
false, css::awt::Size
const& rSize = {});
264 void WritePattFill(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
265 void WritePattFill(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
266 const css::drawing::Hatch& rHatch);
268 void WriteGraphicCropProperties(css::uno::Reference<css::beans::XPropertySet>
const & rxPropertySet,
269 Size const & rOriginalSize,
MapMode const & rMapMode);
271 void WriteSrcRectXGraphic(css::uno::Reference<css::beans::XPropertySet>
const & rxPropertySet,
272 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic);
274 void WriteOutline(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
275 css::uno::Reference< css::frame::XModel>
const & xModel =
nullptr );
277 void WriteXGraphicStretch(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet,
278 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic);
280 void WriteXGraphicTile(css::uno::Reference<css::beans::XPropertySet>
const& rXPropSet,
281 css::uno::Reference<css::graphic::XGraphic>
const& rxGraphic,
282 css::awt::Size
const& rSize);
284 void WriteLinespacing(
const css::style::LineSpacing& rLineSpacing,
float fFirstCharHeight);
286 OUString WriteXGraphicBlip(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet,
287 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic,
288 bool bRelPathToMedia);
290 void WriteImageBrightnessContrastTransparence(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet);
292 void WriteXGraphicBlipMode(css::uno::Reference<css::beans::XPropertySet>
const& rXPropSet,
293 css::uno::Reference<css::graphic::XGraphic>
const& rxGraphic,
294 css::awt::Size
const& rSize);
296 void WriteShapeTransformation(
const css::uno::Reference< css::drawing::XShape >& rXShape,
297 sal_Int32 nXmlNamespace,
bool bFlipH =
false,
bool bFlipV =
false,
bool bSuppressRotation =
false,
bool bSuppressFlipping =
false,
bool bFlippedBeforeRotation =
false);
298 void WriteTransformation(
const css::uno::Reference< css::drawing::XShape >& xShape,
const tools::Rectangle& rRectangle,
299 sal_Int32 nXmlNamespace,
bool bFlipH =
false,
bool bFlipV =
false, sal_Int32 nRotation = 0,
bool bIsGroupShape =
false);
301 void WriteText(
const css::uno::Reference< css::uno::XInterface >& rXIface,
bool bBodyPr,
bool bText =
true, sal_Int32 nXmlNamespace = 0,
bool bWritePropertiesAsLstStyles =
false);
304 void WriteLstStyles(
const css::uno::Reference<css::text::XTextContent>& rParagraph,
305 bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
306 const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet);
307 void WriteParagraph(
const css::uno::Reference< css::text::XTextContent >& rParagraph,
308 bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
313 bool WriteParagraphProperties(
const css::uno::Reference< css::text::XTextContent >& rParagraph,
const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet,
float fFirstCharHeight, sal_Int32 nElement);
314 void WriteParagraphNumbering(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
float fFirstCharHeight,
316 void WriteParagraphTabStops(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
317 void WriteRun(
const css::uno::Reference< css::text::XTextRange >& rRun,
318 bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
319 const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
320 void WriteRunProperties(
const css::uno::Reference< css::beans::XPropertySet >& rRun,
bool bIsField, sal_Int32 nElement,
bool bCheckDirect,
321 bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
322 sal_Int16 nScriptType = css::i18n::ScriptType::LATIN,
323 const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet = {});
325 void WritePresetShape(
const OString& pShape , std::vector< std::pair<sal_Int32,sal_Int32>> & rAvList );
326 void WritePresetShape(
const OString& pShape );
327 void WritePresetShape(
const OString& pShape,
MSO_SPT eShapeType,
bool bPredefinedHandlesUsed,
const css::beans::PropertyValue& rProp );
328 bool WriteCustomGeometry(
329 const css::uno::Reference<css::drawing::XShape>& rXShape,
331 void WriteEmptyCustomGeometry();
332 void WritePolyPolygon(
const css::uno::Reference<css::drawing::XShape>& rXShape,
334 void WriteFill(
const css::uno::Reference<css::beans::XPropertySet>& xPropSet,
335 const css::awt::Size& rSize = {});
336 void WriteShapeStyle(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
337 void WriteShapeEffects(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
338 void WriteShapeEffect( std::u16string_view
sName,
const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps );
343 void Write3DEffects(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
bool bIsText);
344 void WriteArtisticEffect(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
345 OString WriteWdpPicture(
const OUString& rFileId,
const css::uno::Sequence< sal_Int8 >& rPictureData );
346 void WriteDiagram(
const css::uno::Reference<css::drawing::XShape>& rXShape,
int nDiagramId);
347 void writeDiagramRels(
const css::uno::Sequence<css::uno::Sequence<css::uno::Any>>& xRelSeq,
348 const css::uno::Reference<css::io::XOutputStream>& xOutStream,
349 std::u16string_view sGrabBagProperyName,
int nDiagramId);
350 static void WriteFromTo(
const css::uno::Reference<css::drawing::XShape>& rXShape,
const css::awt::Size& aPageSize,
353 static bool IsGroupShape(
const css::uno::Reference< css::drawing::XShape >& rXShape );
354 sal_Int32 getBulletMarginIndentation (
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName);
356 static void ResetMlCounters();
358 static void PushExportGraphics();
359 static void PopExportGraphics();
365 static sal_Int16 GetScriptType(
const OUString& rStr);
369 static ::Color ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
371 static const char* GetAlignment( css::style::ParagraphAdjust nAlignment );
374 const OUString& sFullStream,
375 std::u16string_view sRelativeStream,
376 const css::uno::Reference< css::io::XOutputStream >& xParentRelation,
377 const char* sContentType,
378 const char* sRelationshipType,
379 OUString* pRelationshipId );
Interface to be implemented by the parent exporter that knows how to handle shape text.
virtual void WriteTextBox(css::uno::Reference< css::drawing::XShape > xShape)=0
Write the contents of the textbox that is associated to this shape.
virtual css::uno::Reference< css::text::XTextFrame > GetUnoTextFrame(css::uno::Reference< css::drawing::XShape > xShape)=0
Get textbox which belongs to the shape.
virtual void WriteOutliner(const OutlinerParaObject &rParaObj)=0
DrawingML(::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase *pFB, DocumentType eDocumentType=DOCUMENT_PPTX, DMLTextExport *pTextExport=nullptr)
static sal_Int32 getNewDrawingUniqueId()
::oox::core::XmlFilterBase * mpFB
bool WriteCharColor(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet)
static sal_Int32 mnDrawingMLCount
void WriteGradientFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
void WriteSolidFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
DMLTextExport * GetTextExport()
The application-specific text exporter callback, if there is one.
void WritePresetShape(const OString &pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, const css::beans::PropertyValue &rProp)
::sax_fastparser::FSHelperPtr mpFS
static sal_Int32 mnVmlCount
DocumentType meDocumentType
To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
void SetFS(::sax_fastparser::FSHelperPtr pFS)
void WriteBlipFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const OUString &sURLPropName, const css::awt::Size &rSize={})
void WriteGradientFill(css::awt::Gradient rGradient, css::awt::Gradient rTransparenceGradient, const css::uno::Reference< css::beans::XPropertySet > &rXPropSet=css::uno::Reference< css::beans::XPropertySet >())
const ::sax_fastparser::FSHelperPtr & GetFS() const
::oox::core::XmlFilterBase * GetFB()
DocumentType GetDocumentType() const
void WriteColor(const ::Color nColor, const css::uno::Sequence< css::beans::PropertyValue > &aTransformations, sal_Int32 nAlpha=MAX_PERCENT)
static sal_Int32 getNewVMLUniqueId()
css::uno::Reference< css::drawing::XShape > m_xParent
If set, this is the parent of the currently handled shape.
void WriteSolidFill(const ::Color nColor, const css::uno::Sequence< css::beans::PropertyValue > &aTransformations, sal_Int32 nAlpha=MAX_PERCENT)
static std::stack< sal_Int32 > mnWdpImageCounter
void WriteBlipFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const css::awt::Size &rSize, const OUString &sURLPropName, sal_Int32 nXmlNamespace)
void WriteColor(const OUString &sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue > &aTransformations, sal_Int32 nAlpha=MAX_PERCENT)
void WritePattFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
void WritePattFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const css::drawing::Hatch &rHatch)
bool mbPlaceholder
True when exporting presentation placeholder shape.
static std::stack< sal_Int32 > mnImageCounter
void SetBackgroundDark(bool bIsDark)
static std::stack< std::unordered_map< BitmapChecksum, OUString > > maExportGraphics
void WriteSolidFill(const OUString &sSchemeName, const css::uno::Sequence< css::beans::PropertyValue > &aTransformations, sal_Int32 nAlpha=MAX_PERCENT)
static std::stack< std::map< OUString, OUString > > maWdpCache
DMLTextExport * mpTextExport
Parent exporter, used for text callback.
class SAL_NO_VTABLE XPropertySet
sal_Int32 ExportRotateClockwisify(Degree100 input)
const sal_Int32 MAX_PERCENT
std::shared_ptr< FastSerializerHelper > FSHelperPtr
UNOTOOLS_DLLPUBLIC css::uno::Any GetProperty(OUString const &url, OUString const &property)
UNDERLYING_TYPE get() const