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