1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _OOX_EXPORT_DRAWINGML_HXX_
21 #define _OOX_EXPORT_DRAWINGML_HXX_
23 #include <oox/dllapi.h>
24 #include <sax/fshelper.hxx>
25 #include <rtl/strbuf.hxx>
26 #include <com/sun/star/awt/FontDescriptor.hpp>
27 #include <com/sun/star/uno/XReference.hpp>
28 #include <tools/poly.hxx>
29 #include <filter/msfilter/escherex.hxx>
30 #ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY
31 #define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000)
37 namespace com
{ namespace sun
{ namespace star
{
64 class OOX_DLLPUBLIC DrawingML
{
66 enum DocumentType
{ DOCUMENT_DOCX
, DOCUMENT_PPTX
, DOCUMENT_XLSX
};
69 static int mnImageCounter
;
71 /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
72 DocumentType meDocumentType
;
75 ::com::sun::star::uno::Any mAny
;
76 ::sax_fastparser::FSHelperPtr mpFS
;
77 ::oox::core::XmlFilterBase
* mpFB
;
79 bool GetProperty( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
, OUString aName
);
80 bool GetPropertyAndState( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
,
81 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyState
> rXPropState
,
82 String aName
, ::com::sun::star::beans::PropertyState
& eState
);
83 const char* GetFieldType( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> rRun
, sal_Bool
& bIsField
);
85 OUString
WriteImage( const OUString
& rURL
);
87 const char* GetComponentDir();
88 const char* GetRelationCompPrefix();
91 DrawingML( ::sax_fastparser::FSHelperPtr pFS
, ::oox::core::XmlFilterBase
* pFB
= NULL
, DocumentType eDocumentType
= DOCUMENT_PPTX
) : meDocumentType( eDocumentType
), mpFS( pFS
), mpFB( pFB
) {}
92 void SetFS( ::sax_fastparser::FSHelperPtr pFS
) { mpFS
= pFS
; }
93 ::sax_fastparser::FSHelperPtr
GetFS() { return mpFS
; }
94 ::oox::core::XmlFilterBase
* GetFB() { return mpFB
; }
95 DocumentType
GetDocumentType() { return meDocumentType
; }
97 OUString
WriteImage( const Graphic
&rGraphic
);
99 void WriteColor( sal_uInt32 nColor
);
100 void WriteGradientStop( sal_uInt16 nStop
, sal_uInt32 nColor
);
101 void WriteLineArrow( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
, sal_Bool bLineStart
);
102 void WriteConnectorConnections( EscherConnectorListEntry
& rConnectorEntry
, sal_Int32 nStartID
, sal_Int32 nEndID
);
104 void WriteSolidFill( sal_uInt32 nColor
);
105 void WriteSolidFill( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
);
106 void WriteGradientFill( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
);
107 void WriteBlipFill( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
, OUString sURLPropName
, sal_Int32 nXmlNamespace
);
108 void WriteBlipFill( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
, OUString sURLPropName
);
109 void WriteSrcRect( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>, const OUString
& );
110 void WriteOutline( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
);
112 void WriteLinespacing( ::com::sun::star::style::LineSpacing
& rLineSpacing
);
114 OUString
WriteBlip( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
, OUString
& rURL
, const Graphic
*pGraphic
=NULL
);
115 void WriteBlipMode( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
);
117 void WriteShapeTransformation( ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> rXShape
,
118 sal_Int32 nXmlNamespace
, sal_Bool bFlipH
= false, sal_Bool bFlipV
= false, sal_Bool bSuppressRotation
= false );
119 void WriteTransformation( const Rectangle
& rRectangle
,
120 sal_Int32 nXmlNamespace
, sal_Bool bFlipH
= false, sal_Bool bFlipV
= false, sal_Int32 nRotation
= 0 );
122 void WriteText( ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> rXIface
);
123 void WriteParagraph( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextContent
> rParagraph
);
124 void WriteParagraphProperties( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextContent
> rParagraph
);
125 void WriteParagraphNumbering( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rXPropSet
,
127 void WriteRun( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> rRun
);
128 void WriteRunProperties( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> rRun
, sal_Bool bIsField
);
130 void WritePresetShape( const char* pShape
);
131 void WritePresetShape( const char* pShape
, MSO_SPT eShapeType
, sal_Bool bPredefinedHandlesUsed
, sal_Int32 nAdjustmentsWhichNeedsToBeConverted
, const ::com::sun::star::beans::PropertyValue
& rProp
);
132 void WritePolyPolygon( const PolyPolygon
& rPolyPolygon
);
133 void WriteFill( ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> xPropSet
);
135 static void ResetCounters();
137 void GetUUID( OStringBuffer
& rBuffer
);
139 static sal_Unicode
SubstituteBullet( sal_Unicode cBulletId
, ::com::sun::star::awt::FontDescriptor
& rFontDesc
);
141 sal_uInt32
ColorWithIntensity( sal_uInt32 nColor
, sal_uInt32 nIntensity
);
143 static const char* GetAlignment( sal_Int32 nAlignment
);
145 sax_fastparser::FSHelperPtr
CreateOutputStream (
146 const OUString
& sFullStream
,
147 const OUString
& sRelativeStream
,
148 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
>& xParentRelation
,
149 const char* sContentType
,
150 const char* sRelationshipType
,
151 OUString
* pRelationshipId
= NULL
);
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */