Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _ESCHESDO_HXX
29 : : #define _ESCHESDO_HXX
30 : : #include <filter/msfilter/escherex.hxx>
31 : : #include <svx/unopage.hxx>
32 : : #include <vcl/mapmod.hxx>
33 : :
34 : : // ===================================================================
35 : : // fractions of Draw PPTWriter etc.
36 : :
37 : : enum ImplEESdrPageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 };
38 : :
39 : : class ImplEESdrWriter;
40 : : class ImplEscherExSdr;
41 : :
42 : : class ImplEESdrObject
43 : : {
44 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXShape;
45 : : // XTextRef mXText; // TextRef des globalen Text
46 : : ::com::sun::star::uno::Any mAny;
47 : : Rectangle maRect;
48 : : String mType;
49 : : sal_uInt32 mnShapeId;
50 : : sal_uInt32 mnTextSize;
51 : : sal_Int32 mnAngle;
52 : : sal_Bool mbValid : 1;
53 : : sal_Bool mbPresObj : 1;
54 : : sal_Bool mbEmptyPresObj : 1;
55 : :
56 : : void Init( ImplEESdrWriter& rEx );
57 : : public:
58 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPropSet;
59 : :
60 : : ImplEESdrObject( ImplEscherExSdr& rEx, const SdrObject& rObj );
61 : : ImplEESdrObject( ImplEESdrWriter& rEx, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape );
62 : : ~ImplEESdrObject();
63 : :
64 : : sal_Bool ImplGetPropertyValue( const sal_Unicode* pString );
65 : 6 : sal_Bool ImplGetPropertyValue( const rtl::OUString& rString ) { return ImplGetPropertyValue(rString.getStr()); }
66 : :
67 : 3 : sal_Int32 ImplGetInt32PropertyValue( const sal_Unicode* pStr, sal_uInt32 nDef = 0 )
68 [ + - ]: 3 : { return ImplGetPropertyValue( pStr ) ? *(sal_Int32*)mAny.getValue() : nDef; }
69 : 3 : sal_Int32 ImplGetInt32PropertyValue( const rtl::OUString& rStr, sal_uInt32 nDef = 0 )
70 : 3 : { return ImplGetInt32PropertyValue(rStr.getStr(), nDef); }
71 : :
72 : 21 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& GetShapeRef() const { return mXShape; }
73 : 3 : const ::com::sun::star::uno::Any& GetUsrAny() const { return mAny; }
74 : 9 : const String& GetType() const { return mType; }
75 : 0 : void SetType( const String& rS ) { mType = rS; }
76 : :
77 : 6 : const Rectangle& GetRect() const { return maRect; }
78 : : void SetRect( const Point& rPos, const Size& rSz );
79 : 3 : void SetRect( const Rectangle& rRect )
80 : 3 : { maRect = rRect; }
81 : :
82 : 3 : sal_Int32 GetAngle() const { return mnAngle; }
83 : 3 : void SetAngle( sal_Int32 nVal ) { mnAngle = nVal; }
84 : :
85 : : sal_uInt32 GetTextSize() const { return mnTextSize; }
86 : :
87 : 3 : sal_Bool IsValid() const { return mbValid; }
88 : : sal_Bool IsPresObj() const { return mbPresObj; }
89 : 0 : sal_Bool IsEmptyPresObj() const { return mbEmptyPresObj; }
90 : 0 : sal_uInt32 GetShapeId() const { return mnShapeId; }
91 : 3 : void SetShapeId( sal_uInt32 nVal ) { mnShapeId = nVal; }
92 : :
93 : : const SdrObject* GetSdrObject() const;
94 : :
95 : : sal_uInt32 ImplGetText();
96 : : sal_Bool ImplHasText() const;
97 : : };
98 : :
99 : :
100 : :
101 : : // -------------------------------------------------------------------
102 : : // fractions of the Draw PPTWriter
103 : :
104 : : class EscherEx;
105 : : namespace com { namespace sun { namespace star {
106 : : namespace drawing {
107 : : class XDrawPage;
108 : : class XShape;
109 : : }
110 : : namespace task {
111 : : class XStatusIndicator;
112 : : }
113 : : }}}
114 : : class EscherExHostAppData;
115 : :
116 [ + - ]: 141 : class ImplEESdrWriter
117 : : {
118 : : protected:
119 : : EscherEx* mpEscherEx;
120 : : MapMode maMapModeSrc;
121 : : MapMode maMapModeDest;
122 : :
123 : : ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mXStatusIndicator;
124 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mXDrawPage;
125 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mXShapes;
126 : :
127 : : SvStream* mpPicStrm;
128 : :
129 : : // own extensions
130 : :
131 : : EscherExHostAppData* mpHostAppData;
132 : :
133 : : sal_uInt32 mnPagesWritten;
134 : :
135 : : sal_uInt32 mnShapeMasterTitle;
136 : : sal_uInt32 mnShapeMasterBody;
137 : :
138 : : // per page values
139 : : sal_uInt32 mnIndices;
140 : : sal_uInt32 mnOutlinerCount;
141 : : sal_uInt32 mnPrevTextStyle;
142 : : sal_uInt32 mnStatMaxValue;
143 : :
144 : : sal_uInt16 mnEffectCount;
145 : :
146 : : sal_Bool mbIsTitlePossible;
147 : : sal_Bool mbStatusIndicator;
148 : : sal_Bool mbStatus;
149 : :
150 : :
151 : : ImplEESdrWriter( EscherEx& rEx );
152 : :
153 : : sal_Bool ImplInitPageValues();
154 : :
155 : : void ImplWritePage(
156 : : EscherSolverContainer& rSolver,
157 : : ImplEESdrPageType ePageType,
158 : : sal_Bool bBackGround = sal_False );
159 : :
160 : : sal_uInt32 ImplWriteShape( ImplEESdrObject& rObj,
161 : : EscherSolverContainer& rSolver,
162 : : ImplEESdrPageType ePageType ); // returns ShapeID
163 : :
164 : : void ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt );
165 : : sal_Bool ImplGetText( ImplEESdrObject& rObj );
166 : : void ImplWriteAdditionalText(
167 : : ImplEESdrObject& rObj,
168 : : const Point& rTextRefPoint );
169 : : sal_uInt32 ImplEnterAdditionalTextGroup(
170 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape,
171 : : const Rectangle* pBoundRect = NULL );
172 : :
173 : :
174 : : public:
175 : : Point ImplMapPoint( const Point& rPoint );
176 : : Size ImplMapSize( const Size& rSize );
177 : 0 : EscherExHostAppData* ImplGetHostData() { return mpHostAppData; }
178 : : void MapRect(ImplEESdrObject& rObj);
179 : : };
180 : :
181 : :
182 : : // ===================================================================
183 : :
184 : : class SdrObject;
185 : : class SdrPage;
186 : :
187 : : class ImplEscherExSdr : public ImplEESdrWriter
188 : : {
189 : : private:
190 : : const SdrPage* mpSdrPage;
191 : : EscherSolverContainer* mpSolverContainer;
192 : :
193 : : public:
194 : : ImplEscherExSdr( EscherEx& rEx );
195 : : virtual ~ImplEscherExSdr();
196 : :
197 : : bool ImplInitPage( const SdrPage& rPage );
198 : : bool ImplInitUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
199 : : void ImplWriteCurrentPage();
200 : :
201 : : sal_uInt32 ImplWriteTheShape( ImplEESdrObject& rObj );
202 : :
203 : : void ImplExitPage();
204 : : void ImplFlushSolverContainer();
205 : : };
206 : :
207 : :
208 : :
209 : : #endif // _ESCHESDO_HXX
210 : :
211 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|