Branch data 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 : :
31 : : class Graphic;
32 : : class String;
33 : :
34 : : namespace com { namespace sun { namespace star {
35 : : namespace beans {
36 : : class XPropertySet;
37 : : class XPropertyState;
38 : : }
39 : : namespace drawing {
40 : : class XShape;
41 : : }
42 : : namespace style {
43 : : struct LineSpacing;
44 : : }
45 : : namespace text {
46 : : class XTextContent;
47 : : class XTextRange;
48 : : }
49 : : namespace io {
50 : : class XOutputStream;
51 : : }
52 : : }}}
53 : :
54 : : namespace oox {
55 : : namespace core {
56 : : class XmlFilterBase;
57 : : }
58 : :
59 : : namespace drawingml {
60 : :
61 [ + - ]: 57 : class OOX_DLLPUBLIC DrawingML {
62 : : public:
63 : : enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
64 : :
65 : : private:
66 : : static int mnImageCounter;
67 : :
68 : : /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
69 : : DocumentType meDocumentType;
70 : :
71 : : protected:
72 : : ::com::sun::star::uno::Any mAny;
73 : : ::sax_fastparser::FSHelperPtr mpFS;
74 : : ::oox::core::XmlFilterBase* mpFB;
75 : :
76 : : bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String aName );
77 : : bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
78 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState,
79 : : String aName, ::com::sun::star::beans::PropertyState& eState );
80 : : const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, sal_Bool& bIsField );
81 : :
82 : : rtl::OUString WriteImage( const rtl::OUString& rURL );
83 : :
84 : : public:
85 [ + - ]: 57 : DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {}
86 : 0 : void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
87 : 0 : ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
88 : 0 : ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
89 : 0 : DocumentType GetDocumentType() { return meDocumentType; }
90 : :
91 : : rtl::OUString WriteImage( const Graphic &rGraphic );
92 : :
93 : : void WriteColor( sal_uInt32 nColor );
94 : : void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor );
95 : : void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, sal_Bool bLineStart );
96 : : void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID );
97 : :
98 : : void WriteSolidFill( sal_uInt32 nColor );
99 : : void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
100 : : void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
101 : : void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String sURLPropName, sal_Int32 nXmlNamespace );
102 : : void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String sURLPropName );
103 : : void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
104 : : void WriteStretch();
105 : : void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
106 : :
107 : : ::rtl::OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, ::rtl::OUString& rURL );
108 : : void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
109 : :
110 : : void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
111 : : sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 );
112 : : void WriteTransformation( const Rectangle& rRectangle,
113 : : sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 );
114 : :
115 : : void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface );
116 : : void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
117 : : void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
118 : : void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
119 : : sal_Int16 nLevel );
120 : : void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
121 : : void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rRun, sal_Bool bIsField );
122 : :
123 : : void WritePresetShape( const char* pShape );
124 : : void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
125 : : void WritePolyPolygon( const PolyPolygon& rPolyPolygon );
126 : : void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
127 : :
128 : : static void ResetCounters();
129 : :
130 : : void GetUUID( ::rtl::OStringBuffer& rBuffer );
131 : :
132 : : static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc );
133 : :
134 : : sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
135 : :
136 : : static const char* GetAlignment( sal_Int32 nAlignment );
137 : :
138 : : sax_fastparser::FSHelperPtr CreateOutputStream (
139 : : const ::rtl::OUString& sFullStream,
140 : : const ::rtl::OUString& sRelativeStream,
141 : : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation,
142 : : const char* sContentType,
143 : : const char* sRelationshipType,
144 : : ::rtl::OUString* pRelationshipId = NULL );
145 : :
146 : : };
147 : :
148 : : }
149 : : }
150 : :
151 : : #endif
152 : :
153 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|