20 #ifndef INCLUDED_OOX_EXPORT_DRAWINGML_HXX
21 #define INCLUDED_OOX_EXPORT_DRAWINGML_HXX
25 #include <string_view>
26 #include <unordered_map>
29 #include <com/sun/star/beans/PropertyState.hpp>
30 #include <com/sun/star/uno/Any.hxx>
31 #include <com/sun/star/uno/Reference.hxx>
32 #include <com/sun/star/uno/Sequence.hxx>
33 #include <com/sun/star/style/ParagraphAdjust.hpp>
34 #include <com/sun/star/drawing/Hatch.hpp>
35 #include <com/sun/star/i18n/ScriptType.hpp>
38 #include <oox/token/tokens.hxx>
40 #include <rtl/string.hxx>
41 #include <rtl/ustring.hxx>
59 struct FontDescriptor;
69 struct EnhancedCustomShapeParameterPair;
70 struct EnhancedCustomShapeParameter;
107 namespace drawingml {
114 virtual OUString getTransformedString(
const OUString& rURL)
const;
116 virtual bool isExternalURL(
const OUString& rURL)
const;
123 return ((21600000 - input.
get() * 600) % 21600000);
132 virtual void WriteTextBox(css::uno::Reference<css::drawing::XShape> xShape) = 0;
134 virtual css::uno::Reference<css::text::XTextFrame> GetUnoTextFrame(
135 css::uno::Reference<css::drawing::XShape> xShape) = 0;
166 bool GetProperty(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
const OUString& aName );
167 bool GetPropertyAndState(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
168 const css::uno::Reference< css::beans::XPropertyState >& rXPropState,
169 const OUString& aName, css::beans::PropertyState& eState );
170 OUString GetFieldValue(
const css::uno::Reference< css::text::XTextRange >& rRun,
bool& bIsURLField );
175 static OUString GetDatetimeTypeFromDate(
SvxDateFormat eDate);
180 static OUString GetDatetimeTypeFromTime(
SvxTimeFormat eTime);
189 void WriteMediaNonVisualProperties(
const css::uno::Reference<css::drawing::XShape>& xShape);
191 void WriteStyleProperties( sal_Int32 nTokenId,
const css::uno::Sequence< css::beans::PropertyValue >& aProperties );
193 const char* GetComponentDir()
const;
194 const char* GetRelationCompPrefix()
const;
196 static bool EqualGradients( css::awt::Gradient aGradient1, css::awt::Gradient aGradient2 );
197 bool IsFontworkShape(
const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
199 void WriteGlowEffect(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
200 void WriteSoftEdgeEffect(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
201 void WriteCustomGeometryPoint(
const css::drawing::EnhancedCustomShapeParameterPair& rParamPair,
203 const bool bReplaceGeoWidth,
const bool bReplaceGeoHeight);
204 bool WriteCustomGeometrySegment(
205 const sal_Int16 eCommand,
const sal_Int32
nCount,
206 const css::uno::Sequence<css::drawing::EnhancedCustomShapeParameterPair>& rPairs,
207 sal_Int32& rnPairIndex,
double& rfCurrentX,
double& rfCurrentY,
bool& rbCurrentValid,
209 const bool bReplaceGeoWidth,
const bool bReplaceGeoHeight);
213 : meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS( pFS ), mpFB( pFB ), mbIsBackgroundDark(
false ) {}
215 const ::sax_fastparser::FSHelperPtr&
GetFS()
const {
return mpFS; }
223 OUString WriteImage(
const Graphic &rGraphic ,
bool bRelPathToMedia =
false );
226 void WriteColor(
const OUString& sColorSchemeName,
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
227 void WriteColor( const ::Color nColor,
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
228 void WriteColorTransformations(
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
229 void WriteGradientStop(sal_uInt16 nStop, ::
Color nColor, sal_Int32 nAlpha =
MAX_PERCENT);
230 void WriteLineArrow(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
bool bLineStart );
233 bool WriteCharColor(
const css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
234 bool WriteFillColor(
const css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
237 void WriteSolidFill(
const OUString& sSchemeName,
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
238 void WriteSolidFill( const ::Color nColor,
const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha =
MAX_PERCENT );
239 void WriteSolidFill(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
240 void WriteGradientFill(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
242 void WriteGradientFill( css::awt::Gradient rGradient, css::awt::Gradient rTransparenceGradient,
243 const css::uno::Reference<css::beans::XPropertySet>& rXPropSet = css::uno::Reference<css::beans::XPropertySet>());
245 void WriteGrabBagGradientFill(
const css::uno::Sequence< css::beans::PropertyValue >& aGradientStops, css::awt::Gradient rGradient);
247 void WriteBlipOrNormalFill(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
248 const OUString& rURLPropName );
249 void WriteBlipFill(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
250 const OUString& sURLPropName );
251 void WriteBlipFill(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
252 const OUString& sURLPropName, sal_Int32 nXmlNamespace );
254 void WriteXGraphicBlipFill(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet,
255 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic,
256 sal_Int32 nXmlNamespace,
bool bWriteMode,
bool bRelPathToMedia =
false);
258 void WritePattFill(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
259 void WritePattFill(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
260 const css::drawing::Hatch& rHatch);
262 void WriteGraphicCropProperties(css::uno::Reference<css::beans::XPropertySet>
const & rxPropertySet,
263 Size const & rOriginalSize,
MapMode const & rMapMode);
265 void WriteSrcRectXGraphic(css::uno::Reference<css::beans::XPropertySet>
const & rxPropertySet,
266 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic);
268 void WriteOutline(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
269 css::uno::Reference< css::frame::XModel>
const & xModel =
nullptr );
271 void WriteXGraphicStretch(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet,
272 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic);
274 void WriteLinespacing(
const css::style::LineSpacing& rLineSpacing,
float fFirstCharHeight);
276 OUString WriteXGraphicBlip(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet,
277 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic,
278 bool bRelPathToMedia);
280 void WriteImageBrightnessContrastTransparence(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet);
282 void WriteXGraphicBlipMode(css::uno::Reference<css::beans::XPropertySet>
const & rXPropSet,
283 css::uno::Reference<css::graphic::XGraphic>
const & rxGraphic);
285 void WriteShapeTransformation(
const css::uno::Reference< css::drawing::XShape >& rXShape,
286 sal_Int32 nXmlNamespace,
bool bFlipH =
false,
bool bFlipV =
false,
bool bSuppressRotation =
false,
bool bSuppressFlipping =
false,
bool bFlippedBeforeRotation =
false);
287 void WriteTransformation(
const css::uno::Reference< css::drawing::XShape >& xShape,
const tools::Rectangle& rRectangle,
288 sal_Int32 nXmlNamespace,
bool bFlipH =
false,
bool bFlipV =
false, sal_Int32 nRotation = 0,
bool bIsGroupShape =
false);
290 void WriteText(
const css::uno::Reference< css::uno::XInterface >& rXIface,
bool bBodyPr,
bool bText =
true, sal_Int32 nXmlNamespace = 0,
bool bWritePropertiesAsLstStyles =
false);
293 void WriteLstStyles(
const css::uno::Reference<css::text::XTextContent>& rParagraph,
294 bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
295 const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet);
296 void WriteParagraph(
const css::uno::Reference< css::text::XTextContent >& rParagraph,
297 bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
302 bool WriteParagraphProperties(
const css::uno::Reference< css::text::XTextContent >& rParagraph,
float fFirstCharHeight, sal_Int32 nElement);
303 void WriteParagraphNumbering(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
float fFirstCharHeight,
305 void WriteParagraphTabStops(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
306 void WriteRun(
const css::uno::Reference< css::text::XTextRange >& rRun,
307 bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
308 const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
309 void WriteRunProperties(
const css::uno::Reference< css::beans::XPropertySet >& rRun,
bool bIsField, sal_Int32 nElement,
bool bCheckDirect,
310 bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
311 sal_Int16 nScriptType = css::i18n::ScriptType::LATIN,
312 const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet = {});
314 void WritePresetShape(
const OString& pShape , std::vector< std::pair<sal_Int32,sal_Int32>> & rAvList );
315 void WritePresetShape(
const OString& pShape );
316 void WritePresetShape(
const OString& pShape,
MSO_SPT eShapeType,
bool bPredefinedHandlesUsed,
const css::beans::PropertyValue& rProp );
317 bool WriteCustomGeometry(
318 const css::uno::Reference<css::drawing::XShape>& rXShape,
320 void WriteEmptyCustomGeometry();
321 void WritePolyPolygon(
const css::uno::Reference<css::drawing::XShape>& rXShape,
323 void WriteFill(
const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
324 void WriteShapeStyle(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
325 void WriteShapeEffects(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
326 void WriteShapeEffect( std::u16string_view
sName,
const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps );
331 void Write3DEffects(
const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
bool bIsText);
332 void WriteArtisticEffect(
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
333 OString WriteWdpPicture(
const OUString& rFileId,
const css::uno::Sequence< sal_Int8 >& rPictureData );
334 void WriteDiagram(
const css::uno::Reference<css::drawing::XShape>& rXShape,
int nDiagramId);
335 void writeDiagramRels(
const css::uno::Sequence<css::uno::Sequence<css::uno::Any>>& xRelSeq,
336 const css::uno::Reference<css::io::XOutputStream>& xOutStream,
337 std::u16string_view sGrabBagProperyName,
int nDiagramId);
338 static void WriteFromTo(
const css::uno::Reference<css::drawing::XShape>& rXShape,
const css::awt::Size& aPageSize,
341 static bool IsGroupShape(
const css::uno::Reference< css::drawing::XShape >& rXShape );
342 sal_Int32 getBulletMarginIndentation (
const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName);
344 static void ResetCounters();
345 static void ResetMlCounters();
347 static void PushExportGraphics();
348 static void PopExportGraphics();
354 static sal_Int16 GetScriptType(
const OUString& rStr);
358 static ::Color ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
360 static const char* GetAlignment( css::style::ParagraphAdjust nAlignment );
363 const OUString& sFullStream,
364 std::u16string_view sRelativeStream,
365 const css::uno::Reference< css::io::XOutputStream >& xParentRelation,
366 const char* sContentType,
367 const char* sRelationshipType,
368 OUString* pRelationshipId );
Interface to be implemented by the parent exporter that knows how to handle shape text...
UNOTOOLS_DLLPUBLIC css::uno::Any GetProperty(OUString const &url, OUString const &property)
sal_Int32 ExportRotateClockwisify(Degree100 input)
exports com.sun.star. awt
exports com.sun.star. graphic
::sax_fastparser::FSHelperPtr mpFS
static sal_Int32 mnVmlCount
static std::map< OUString, OUString > maWdpCache
DrawingML(::sax_fastparser::FSHelperPtr pFS,::oox::core::XmlFilterBase *pFB, DocumentType eDocumentType=DOCUMENT_PPTX, DMLTextExport *pTextExport=nullptr)
exports com.sun.star. frame
exports com.sun.star. drawing
const ::sax_fastparser::FSHelperPtr & GetFS() const
exports com.sun.star. text
static sal_Int32 getNewVMLUniqueId()
DocumentType GetDocumentType() const
UNDERLYING_TYPE get() const
class SAL_NO_VTABLE XPropertySet
const sal_Int32 MAX_PERCENT
static std::stack< std::unordered_map< BitmapChecksum, OUString > > maExportGraphics
static sal_Int32 getNewDrawingUniqueId()
static int mnImageCounter
std::shared_ptr< FastSerializerHelper > FSHelperPtr
exports com.sun.star. style
exports com.sun.star. beans
css::uno::Reference< css::drawing::XShape > m_xParent
If set, this is the parent of the currently handled shape.
void SetFS(::sax_fastparser::FSHelperPtr pFS)
::oox::core::XmlFilterBase * GetFB()
DocumentType meDocumentType
To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC)...
DMLTextExport * GetTextExport()
The application-specific text exporter callback, if there is one.
void SetBackgroundDark(bool bIsDark)
::oox::core::XmlFilterBase * mpFB
static sal_Int32 mnDrawingMLCount
static int mnWdpImageCounter
DMLTextExport * mpTextExport
Parent exporter, used for text callback.
bool m_bDetectedRangeSegmentation false