1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <filter/msfilter/escherex.hxx>
22 #include <svx/unopage.hxx>
23 #include <vcl/mapmod.hxx>
25 // ===================================================================
26 // fractions of Draw PPTWriter etc.
28 enum ImplEESdrPageType
{ NORMAL
= 0, MASTER
= 1, NOTICE
= 2, UNDEFINED
= 3 };
30 class ImplEESdrWriter
;
31 class ImplEscherExSdr
;
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
;
41 sal_uInt32 mnTextSize
;
44 sal_Bool mbPresObj
: 1;
45 sal_Bool mbEmptyPresObj
: 1;
47 void Init( ImplEESdrWriter
& rEx
);
49 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> mXPropSet
;
51 ImplEESdrObject( ImplEscherExSdr
& rEx
, const SdrObject
& rObj
);
52 ImplEESdrObject( ImplEESdrWriter
& rEx
, const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& rShape
);
55 sal_Bool
ImplGetPropertyValue( const sal_Unicode
* pString
);
56 sal_Bool
ImplGetPropertyValue( const OUString
& rString
) { return ImplGetPropertyValue(rString
.getStr()); }
58 sal_Int32
ImplGetInt32PropertyValue( const sal_Unicode
* pStr
, sal_uInt32 nDef
= 0 )
59 { return ImplGetPropertyValue( pStr
) ? *(sal_Int32
*)mAny
.getValue() : nDef
; }
60 sal_Int32
ImplGetInt32PropertyValue( const OUString
& rStr
, sal_uInt32 nDef
= 0 )
61 { return ImplGetInt32PropertyValue(rStr
.getStr(), nDef
); }
63 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& GetShapeRef() const { return mXShape
; }
64 const ::com::sun::star::uno::Any
& GetUsrAny() const { return mAny
; }
65 const String
& GetType() const { return mType
; }
66 void SetType( const String
& rS
) { mType
= rS
; }
68 const Rectangle
& GetRect() const { return maRect
; }
69 void SetRect( const Point
& rPos
, const Size
& rSz
);
70 void SetRect( const Rectangle
& rRect
)
73 sal_Int32
GetAngle() const { return mnAngle
; }
74 void SetAngle( sal_Int32 nVal
) { mnAngle
= nVal
; }
76 sal_uInt32
GetTextSize() const { return mnTextSize
; }
78 sal_Bool
IsValid() const { return mbValid
; }
79 sal_Bool
IsPresObj() const { return mbPresObj
; }
80 sal_Bool
IsEmptyPresObj() const { return mbEmptyPresObj
; }
81 sal_uInt32
GetShapeId() const { return mnShapeId
; }
82 void SetShapeId( sal_uInt32 nVal
) { mnShapeId
= nVal
; }
84 const SdrObject
* GetSdrObject() const;
86 sal_uInt32
ImplGetText();
87 sal_Bool
ImplHasText() const;
92 // -------------------------------------------------------------------
93 // fractions of the Draw PPTWriter
96 namespace com
{ namespace sun
{ namespace star
{
102 class XStatusIndicator
;
105 class EscherExHostAppData
;
107 class ImplEESdrWriter
110 EscherEx
* mpEscherEx
;
111 MapMode maMapModeSrc
;
112 MapMode maMapModeDest
;
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
;
122 EscherExHostAppData
* mpHostAppData
;
124 sal_uInt32 mnPagesWritten
;
126 sal_uInt32 mnShapeMasterTitle
;
127 sal_uInt32 mnShapeMasterBody
;
130 sal_uInt32 mnIndices
;
131 sal_uInt32 mnOutlinerCount
;
132 sal_uInt32 mnPrevTextStyle
;
133 sal_uInt32 mnStatMaxValue
;
135 sal_uInt16 mnEffectCount
;
137 sal_Bool mbIsTitlePossible
;
138 sal_Bool mbStatusIndicator
;
142 ImplEESdrWriter( EscherEx
& rEx
);
144 sal_Bool
ImplInitPageValues();
147 EscherSolverContainer
& rSolver
,
148 ImplEESdrPageType ePageType
,
149 sal_Bool bBackGround
= sal_False
);
151 sal_uInt32
ImplWriteShape( ImplEESdrObject
& rObj
,
152 EscherSolverContainer
& rSolver
,
153 ImplEESdrPageType ePageType
); // returns ShapeID
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
);
166 Point
ImplMapPoint( const Point
& rPoint
);
167 Size
ImplMapSize( const Size
& rSize
);
168 EscherExHostAppData
* ImplGetHostData() { return mpHostAppData
; }
169 void MapRect(ImplEESdrObject
& rObj
);
173 // ===================================================================
178 class ImplEscherExSdr
: public ImplEESdrWriter
181 const SdrPage
* mpSdrPage
;
182 EscherSolverContainer
* mpSolverContainer
;
185 ImplEscherExSdr( EscherEx
& rEx
);
186 virtual ~ImplEscherExSdr();
188 bool ImplInitPage( const SdrPage
& rPage
);
189 bool ImplInitUnoShapes( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
>& rxShapes
);
190 void ImplWriteCurrentPage();
192 sal_uInt32
ImplWriteTheShape( ImplEESdrObject
& rObj
);
195 void ImplFlushSolverContainer();
200 #endif // _ESCHESDO_HXX
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */