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 : #ifndef INCLUDED_FILTER_SOURCE_MSFILTER_ESCHESDO_HXX
20 : #define INCLUDED_FILTER_SOURCE_MSFILTER_ESCHESDO_HXX
21 : #include <filter/msfilter/escherex.hxx>
22 : #include <svx/unopage.hxx>
23 : #include <vcl/mapmod.hxx>
24 :
25 :
26 : // fractions of Draw PPTWriter etc.
27 :
28 : enum ImplEESdrPageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 };
29 :
30 : class ImplEESdrWriter;
31 : class ImplEscherExSdr;
32 :
33 : class ImplEESdrObject
34 : {
35 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXShape;
36 : // XTextRef mXText; // TextRef des globalen Text
37 : ::com::sun::star::uno::Any mAny;
38 : Rectangle maRect;
39 : OUString mType;
40 : sal_uInt32 mnShapeId;
41 : sal_uInt32 mnTextSize;
42 : sal_Int32 mnAngle;
43 : sal_Bool mbValid : 1;
44 : sal_Bool mbPresObj : 1;
45 : sal_Bool mbEmptyPresObj : 1;
46 : bool mbOOXML;
47 :
48 : void Init( ImplEESdrWriter& rEx );
49 : public:
50 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPropSet;
51 :
52 : ImplEESdrObject( ImplEscherExSdr& rEx, const SdrObject& rObj, bool bOOXML = false );
53 : ImplEESdrObject( ImplEESdrWriter& rEx, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape );
54 : ~ImplEESdrObject();
55 :
56 : sal_Bool ImplGetPropertyValue( const sal_Unicode* pString );
57 0 : sal_Bool ImplGetPropertyValue( const OUString& rString ) { return ImplGetPropertyValue(rString.getStr()); }
58 :
59 0 : sal_Int32 ImplGetInt32PropertyValue( const sal_Unicode* pStr, sal_uInt32 nDef = 0 )
60 0 : { return ImplGetPropertyValue( pStr ) ? *(sal_Int32*)mAny.getValue() : nDef; }
61 0 : sal_Int32 ImplGetInt32PropertyValue( const OUString& rStr, sal_uInt32 nDef = 0 )
62 0 : { return ImplGetInt32PropertyValue(rStr.getStr(), nDef); }
63 :
64 0 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& GetShapeRef() const { return mXShape; }
65 0 : const ::com::sun::star::uno::Any& GetUsrAny() const { return mAny; }
66 0 : const OUString& GetType() const { return mType; }
67 0 : void SetType( const OUString& rS ) { mType = rS; }
68 :
69 0 : const Rectangle& GetRect() const { return maRect; }
70 : void SetRect( const Point& rPos, const Size& rSz );
71 0 : void SetRect( const Rectangle& rRect )
72 0 : { maRect = rRect; }
73 :
74 0 : sal_Int32 GetAngle() const { return mnAngle; }
75 0 : void SetAngle( sal_Int32 nVal ) { mnAngle = nVal; }
76 :
77 : sal_uInt32 GetTextSize() const { return mnTextSize; }
78 :
79 0 : sal_Bool IsValid() const { return mbValid; }
80 : sal_Bool IsPresObj() const { return mbPresObj; }
81 0 : sal_Bool IsEmptyPresObj() const { return mbEmptyPresObj; }
82 0 : sal_uInt32 GetShapeId() const { return mnShapeId; }
83 0 : void SetShapeId( sal_uInt32 nVal ) { mnShapeId = nVal; }
84 :
85 : const SdrObject* GetSdrObject() const;
86 :
87 : sal_uInt32 ImplGetText();
88 : sal_Bool ImplHasText() const;
89 : bool GetOOXML() const;
90 : void SetOOXML(bool bOOXML);
91 : };
92 :
93 :
94 :
95 :
96 : // fractions of the Draw PPTWriter
97 :
98 : class EscherEx;
99 : namespace com { namespace sun { namespace star {
100 : namespace drawing {
101 : class XDrawPage;
102 : class XShape;
103 : }
104 : namespace task {
105 : class XStatusIndicator;
106 : }
107 : }}}
108 : class EscherExHostAppData;
109 :
110 0 : class ImplEESdrWriter
111 : {
112 : protected:
113 : EscherEx* mpEscherEx;
114 : MapMode maMapModeSrc;
115 : MapMode maMapModeDest;
116 :
117 : ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mXStatusIndicator;
118 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mXDrawPage;
119 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mXShapes;
120 :
121 : SvStream* mpPicStrm;
122 :
123 : // own extensions
124 :
125 : EscherExHostAppData* mpHostAppData;
126 :
127 : sal_uInt32 mnPagesWritten;
128 :
129 : sal_uInt32 mnShapeMasterTitle;
130 : sal_uInt32 mnShapeMasterBody;
131 :
132 : // per page values
133 : sal_uInt32 mnIndices;
134 : sal_uInt32 mnOutlinerCount;
135 : sal_uInt32 mnPrevTextStyle;
136 : sal_uInt32 mnStatMaxValue;
137 :
138 : sal_uInt16 mnEffectCount;
139 :
140 : sal_Bool mbIsTitlePossible;
141 : sal_Bool mbStatusIndicator;
142 : sal_Bool mbStatus;
143 :
144 :
145 : ImplEESdrWriter( EscherEx& rEx );
146 :
147 : sal_Bool ImplInitPageValues();
148 :
149 : void ImplWritePage(
150 : EscherSolverContainer& rSolver,
151 : ImplEESdrPageType ePageType,
152 : sal_Bool bBackGround = sal_False );
153 :
154 : sal_uInt32 ImplWriteShape( ImplEESdrObject& rObj,
155 : EscherSolverContainer& rSolver,
156 : ImplEESdrPageType ePageType, const sal_Bool bOOxmlExport = false ); // returns ShapeID
157 :
158 : void ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt );
159 : sal_Bool ImplGetText( ImplEESdrObject& rObj );
160 : void ImplWriteAdditionalText(
161 : ImplEESdrObject& rObj,
162 : const Point& rTextRefPoint );
163 : sal_uInt32 ImplEnterAdditionalTextGroup(
164 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape,
165 : const Rectangle* pBoundRect = NULL );
166 :
167 :
168 : public:
169 : Point ImplMapPoint( const Point& rPoint );
170 : Size ImplMapSize( const Size& rSize );
171 0 : EscherExHostAppData* ImplGetHostData() { return mpHostAppData; }
172 : void MapRect(ImplEESdrObject& rObj);
173 : };
174 :
175 :
176 :
177 :
178 : class SdrObject;
179 : class SdrPage;
180 :
181 : class ImplEscherExSdr : public ImplEESdrWriter
182 : {
183 : private:
184 : const SdrPage* mpSdrPage;
185 : EscherSolverContainer* mpSolverContainer;
186 :
187 : public:
188 : ImplEscherExSdr( EscherEx& rEx );
189 : virtual ~ImplEscherExSdr();
190 :
191 : bool ImplInitPage( const SdrPage& rPage );
192 : bool ImplInitUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
193 : void ImplWriteCurrentPage();
194 :
195 : sal_uInt32 ImplWriteTheShape( ImplEESdrObject& rObj, bool ooxmlExport = false );
196 :
197 : void ImplExitPage();
198 : void ImplFlushSolverContainer();
199 : };
200 :
201 :
202 :
203 : #endif // INCLUDED_FILTER_SOURCE_MSFILTER_ESCHESDO_HXX
204 :
205 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|