xref: /trunk/main/filter/source/msfilter/eschesdo.hxx (revision 24c56ab9)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _ESCHESDO_HXX
24 #define _ESCHESDO_HXX
25 #include <filter/msfilter/escherex.hxx>
26 #include <svx/unopage.hxx>
27 #include <vcl/mapmod.hxx>
28 
29 // ===================================================================
30 // fractions of Draw PPTWriter etc.
31 
32 enum ImplEESdrPageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 };
33 
34 class ImplEESdrWriter;
35 class ImplEscherExSdr;
36 
37 class ImplEESdrObject
38 {
39 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >			mXShape;
40 //	XTextRef			mXText;	// TextRef des globalen Text
41 	::com::sun::star::uno::Any				mAny;
42 	Rectangle			maRect;
43 	String				mType;
44 	sal_uInt32				mnShapeId;
45 	sal_uInt32				mnTextSize;
46 	sal_Int32				mnAngle;
47 	sal_Bool 				mbValid : 1;
48 	sal_Bool				mbPresObj : 1;
49 	sal_Bool				mbEmptyPresObj : 1;
50 
51 	void Init( ImplEESdrWriter& rEx );
52 public:
53 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > 	mXPropSet;
54 
55 	ImplEESdrObject( ImplEscherExSdr& rEx, const SdrObject& rObj );
56 	ImplEESdrObject( ImplEESdrWriter& rEx, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape );
57 	~ImplEESdrObject();
58 
59 	sal_Bool ImplGetPropertyValue( const sal_Unicode* pString );
60 
ImplGetInt32PropertyValue(const sal_Unicode * pStr,sal_uInt32 nDef=0)61 	sal_Int32 ImplGetInt32PropertyValue( const sal_Unicode* pStr, sal_uInt32 nDef = 0 )
62 	{ return ImplGetPropertyValue( pStr ) ? *(sal_Int32*)mAny.getValue() : nDef; }
63 
ImplGetPropertyValue(const rtl::OUString & rStr)64 	sal_Bool ImplGetPropertyValue( const rtl::OUString& rStr ) { return ImplGetPropertyValue( rStr.getStr() ); }
ImplGetInt32PropertyValue(const rtl::OUString & rStr)65 	sal_Bool ImplGetInt32PropertyValue( const rtl::OUString& rStr ) { return ImplGetInt32PropertyValue( rStr.getStr() ); }
66 
GetShapeRef() const67 	const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&	GetShapeRef() const 	{ return mXShape; }
GetUsrAny() const68 	const ::com::sun::star::uno::Any&		GetUsrAny() const		{ return mAny; }
GetType() const69 	const String&		GetType() const 		{ return mType; }
SetType(const String & rS)70 	void				SetType( const String& rS ) { mType = rS; }
71 
GetRect() const72 	const Rectangle&	GetRect() const 		{ return maRect; }
73 	void				SetRect( const Point& rPos, const Size& rSz );
SetRect(const Rectangle & rRect)74 	void				SetRect( const Rectangle& rRect )
75 							{ maRect = rRect; }
76 
GetAngle() const77 	sal_Int32				GetAngle() const 		{ return mnAngle; }
SetAngle(sal_Int32 nVal)78 	void				SetAngle( sal_Int32 nVal ) 	{ mnAngle = nVal; }
79 
GetTextSize() const80 	sal_uInt32				GetTextSize() const 	{ return mnTextSize; }
81 
IsValid() const82 	sal_Bool 				IsValid() const 		{ return mbValid; }
IsPresObj() const83 	sal_Bool				IsPresObj() const 		{ return mbPresObj; }
IsEmptyPresObj() const84 	sal_Bool				IsEmptyPresObj() const 	{ return mbEmptyPresObj; }
GetShapeId() const85 	sal_uInt32				GetShapeId() const 		{ return mnShapeId; }
SetShapeId(sal_uInt32 nVal)86 	void 				SetShapeId( sal_uInt32 nVal ) { mnShapeId = nVal; }
87 
88 	const SdrObject*	GetSdrObject() const;
89 
90 	sal_uInt32 				ImplGetText();
91 	sal_Bool 				ImplHasText() const;
92 };
93 
94 
95 
96 // -------------------------------------------------------------------
97 // fractions of the Draw PPTWriter
98 
99 class EscherEx;
100 namespace com { namespace sun { namespace star {
101 	namespace drawing {
102 		class XDrawPage;
103 		class XShape;
104 	}
105 	namespace task {
106 		class XStatusIndicator;
107 	}
108 }}}
109 class EscherExHostAppData;
110 class Polygon;
111 
112 class ImplEESdrWriter
113 {
114 protected:
115 		EscherEx*			mpEscherEx;
116 		MapMode				maMapModeSrc;
117 		MapMode				maMapModeDest;
118 
119 		::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >	mXStatusIndicator;
120 		::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >		mXDrawPage;
121 		::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >			mXShapes;
122 
123 		SvStream*			mpPicStrm;
124 
125 		// own extensions
126 
127 		EscherExHostAppData*	mpHostAppData;
128 
129 		sal_uInt32				mnPagesWritten;
130 
131 		sal_uInt32				mnShapeMasterTitle;
132 		sal_uInt32				mnShapeMasterBody;
133 
134 		// per page values
135 		sal_uInt32				mnIndices;
136 		sal_uInt32				mnOutlinerCount;
137 		sal_uInt32				mnPrevTextStyle;
138 		sal_uInt32				mnStatMaxValue;
139 
140 		sal_uInt16				mnEffectCount;
141 
142 		sal_Bool				mbIsTitlePossible;
143 		sal_Bool				mbStatusIndicator;
144 		sal_Bool				mbStatus;
145 
146 
147 								ImplEESdrWriter( EscherEx& rEx );
148 
149 			sal_Bool				ImplInitPageValues();
150 
151 			void				ImplWritePage(
152 									EscherSolverContainer& rSolver,
153 									ImplEESdrPageType ePageType,
154 									sal_Bool bBackGround = sal_False );
155 
156 			sal_uInt32				ImplWriteShape( ImplEESdrObject& rObj,
157 									EscherSolverContainer& rSolver,
158 									ImplEESdrPageType ePageType );	// returns ShapeID
159 
160 			void				ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt );
161 			sal_Bool				ImplGetText( ImplEESdrObject& rObj );
162 			void				ImplWriteAdditionalText(
163 												ImplEESdrObject& rObj,
164 												const Point& rTextRefPoint );
165 			sal_uInt32				ImplEnterAdditionalTextGroup(
166 										const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape,
167 										const Rectangle* pBoundRect = NULL );
168 
169 
170 public:
171 			Point				ImplMapPoint( const Point& rPoint );
172 			Size				ImplMapSize( const Size& rSize );
ImplGetHostData()173 			EscherExHostAppData* ImplGetHostData() { return mpHostAppData; }
174             void MapRect(ImplEESdrObject& rObj);
175 };
176 
177 
178 // ===================================================================
179 
180 class SdrObject;
181 class SdrPage;
182 
183 class ImplEscherExSdr : public ImplEESdrWriter
184 {
185 private:
186 		const SdrPage*			mpSdrPage;
187 		EscherSolverContainer*	mpSolverContainer;
188 
189 public:
190 								ImplEscherExSdr( EscherEx& rEx );
191 	virtual						~ImplEscherExSdr();
192 
193             bool                ImplInitPage( const SdrPage& rPage );
194             bool                ImplInitUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
195 			void				ImplWriteCurrentPage();
196 
197 			sal_uInt32				ImplWriteTheShape( ImplEESdrObject& rObj );
198 
199 			void				ImplExitPage();
200 			void				ImplFlushSolverContainer();
201 };
202 
203 
204 
205 #endif // _ESCHESDO_HXX
206