Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _OOX_EXPORT_DRAWINGML_HXX_
21 : #define _OOX_EXPORT_DRAWINGML_HXX_
22 :
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)
32 : #endif
33 :
34 : class Graphic;
35 : class String;
36 :
37 : namespace com { namespace sun { namespace star {
38 : namespace beans {
39 : class XPropertySet;
40 : class XPropertyState;
41 : }
42 : namespace drawing {
43 : class XShape;
44 : }
45 : namespace style {
46 : struct LineSpacing;
47 : }
48 : namespace text {
49 : class XTextContent;
50 : class XTextRange;
51 : }
52 : namespace io {
53 : class XOutputStream;
54 : }
55 : }}}
56 :
57 : namespace oox {
58 : namespace core {
59 : class XmlFilterBase;
60 : }
61 :
62 : namespace drawingml {
63 :
64 24 : class OOX_DLLPUBLIC DrawingML {
65 : public:
66 : enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
67 :
68 : private:
69 : static int mnImageCounter;
70 :
71 : /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
72 : DocumentType meDocumentType;
73 :
74 : protected:
75 : ::com::sun::star::uno::Any mAny;
76 : ::sax_fastparser::FSHelperPtr mpFS;
77 : ::oox::core::XmlFilterBase* mpFB;
78 :
79 : bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String 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 );
84 :
85 : rtl::OUString WriteImage( const rtl::OUString& rURL );
86 :
87 : const char* GetComponentDir();
88 : const char* GetRelationCompPrefix();
89 :
90 : public:
91 24 : DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {}
92 1 : void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
93 0 : ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
94 0 : ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
95 0 : DocumentType GetDocumentType() { return meDocumentType; }
96 :
97 : rtl::OUString WriteImage( const Graphic &rGraphic );
98 :
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 );
103 :
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, String sURLPropName, sal_Int32 nXmlNamespace );
108 : void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String sURLPropName );
109 : void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
110 : void WriteStretch();
111 : void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
112 :
113 : ::rtl::OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, ::rtl::OUString& rURL, Graphic *pGraphic=NULL );
114 : void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
115 :
116 : void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
117 : sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Bool bSuppressRotation = false );
118 : void WriteTransformation( const Rectangle& rRectangle,
119 : sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 );
120 :
121 : void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface );
122 : void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
123 : void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
124 : void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
125 : sal_Int16 nLevel );
126 : void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
127 : void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rRun, sal_Bool bIsField );
128 :
129 : void WritePresetShape( const char* pShape );
130 : void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
131 : void WritePolyPolygon( const PolyPolygon& rPolyPolygon );
132 : void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
133 :
134 : static void ResetCounters();
135 :
136 : void GetUUID( ::rtl::OStringBuffer& rBuffer );
137 :
138 : static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc );
139 :
140 : sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
141 :
142 : static const char* GetAlignment( sal_Int32 nAlignment );
143 :
144 : sax_fastparser::FSHelperPtr CreateOutputStream (
145 : const ::rtl::OUString& sFullStream,
146 : const ::rtl::OUString& sRelativeStream,
147 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation,
148 : const char* sContentType,
149 : const char* sRelationshipType,
150 : ::rtl::OUString* pRelationshipId = NULL );
151 :
152 : };
153 :
154 : }
155 : }
156 :
157 : #endif
158 :
159 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|