xref: /aoo41x/main/sc/source/filter/inc/xiescher.hxx (revision 0154edad)
138d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
338d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
438d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
538d50f7bSAndrew Rist  * distributed with this work for additional information
638d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
738d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
838d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
938d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
1038d50f7bSAndrew Rist  *
1138d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1238d50f7bSAndrew Rist  *
1338d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1438d50f7bSAndrew Rist  * software distributed under the License is distributed on an
1538d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1638d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
1738d50f7bSAndrew Rist  * specific language governing permissions and limitations
1838d50f7bSAndrew Rist  * under the License.
1938d50f7bSAndrew Rist  *
2038d50f7bSAndrew Rist  *************************************************************/
2138d50f7bSAndrew Rist 
2238d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_XIESCHER_HXX
25cdf0e10cSrcweir #define SC_XIESCHER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vector>
28cdf0e10cSrcweir #include <map>
29cdf0e10cSrcweir #include <filter/msfilter/msdffimp.hxx>
30cdf0e10cSrcweir #include <filter/msfilter/msocximex.hxx>
31cdf0e10cSrcweir #include <vcl/graph.hxx>
32cdf0e10cSrcweir #include "xlescher.hxx"
33cdf0e10cSrcweir #include "xiroot.hxx"
34cdf0e10cSrcweir #include "xistring.hxx"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace com { namespace sun { namespace star {
37cdf0e10cSrcweir     namespace drawing { class XShape; }
38cdf0e10cSrcweir     namespace form { class XForm; }
39cdf0e10cSrcweir } } }
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class SdrObjList;
42cdf0e10cSrcweir class ScfProgressBar;
43cdf0e10cSrcweir class ScfPropertySet;
44cdf0e10cSrcweir class XclImpChart;
45cdf0e10cSrcweir class XclImpDffConverter;
46cdf0e10cSrcweir class XclImpDrawing;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir // Drawing objects ============================================================
49cdf0e10cSrcweir 
50cdf0e10cSrcweir class XclImpDrawObjBase;
51cdf0e10cSrcweir typedef ScfRef< XclImpDrawObjBase > XclImpDrawObjRef;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir /** Base class for drawing objects (OBJ records). */
54cdf0e10cSrcweir class XclImpDrawObjBase : protected XclImpRoot
55cdf0e10cSrcweir {
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir     explicit            XclImpDrawObjBase( const XclImpRoot& rRoot );
58cdf0e10cSrcweir     virtual             ~XclImpDrawObjBase();
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     /** Reads the BIFF3 OBJ record, returns a new drawing object. */
61cdf0e10cSrcweir     static XclImpDrawObjRef ReadObj3( const XclImpRoot& rRoot, XclImpStream& rStrm );
62cdf0e10cSrcweir     /** Reads the BIFF4 OBJ record, returns a new drawing object. */
63cdf0e10cSrcweir     static XclImpDrawObjRef ReadObj4( const XclImpRoot& rRoot, XclImpStream& rStrm );
64cdf0e10cSrcweir     /** Reads the BIFF5 OBJ record, returns a new drawing object. */
65cdf0e10cSrcweir     static XclImpDrawObjRef ReadObj5( const XclImpRoot& rRoot, XclImpStream& rStrm );
66cdf0e10cSrcweir     /** Reads the BIFF8 OBJ record, returns a new drawing object. */
67cdf0e10cSrcweir     static XclImpDrawObjRef ReadObj8( const XclImpRoot& rRoot, XclImpStream& rStrm );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     /** Sets whether this is an area object (then its width and height must be greater than 0). */
SetAreaObj(bool bAreaObj)70cdf0e10cSrcweir     inline void         SetAreaObj( bool bAreaObj ) { mbAreaObj = bAreaObj; }
71cdf0e10cSrcweir     /** If set to true, a new SdrObject will be created while in DFF import. */
SetSimpleMacro(bool bMacro)72cdf0e10cSrcweir     inline void         SetSimpleMacro( bool bMacro ) { mbSimpleMacro = bMacro; }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     /** Sets the object anchor explicitly. */
75cdf0e10cSrcweir     void                SetAnchor( const XclObjAnchor& rAnchor );
76cdf0e10cSrcweir     /** Sets shape data from DFF stream. */
77cdf0e10cSrcweir     void                SetDffData( const DffObjData& rDffObjData, const String& rObjName, const String& rHyperlink, bool bVisible, bool bAutoMargin );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     /** If set to false, the SdrObject will not be created, processed, or inserted into the draw page. */
SetProcessSdrObj(bool bProcess)80cdf0e10cSrcweir     inline void         SetProcessSdrObj( bool bProcess ) { mbProcessSdr = bProcess; }
81cdf0e10cSrcweir     /** If set to false, the SdrObject will be created or processed, but not be inserted into the draw page. */
SetInsertSdrObj(bool bInsert)82cdf0e10cSrcweir     inline void         SetInsertSdrObj( bool bInsert ) { mbInsertSdr = bInsert; }
83cdf0e10cSrcweir     /** If set to true, a new SdrObject will be created while in DFF import. */
SetCustomDffObj(bool bCustom)84cdf0e10cSrcweir     inline void         SetCustomDffObj( bool bCustom ) { mbCustomDff = bCustom; }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     /** Returns the sheet index and Excel object identifier from OBJ record. */
GetObjId() const87cdf0e10cSrcweir     inline sal_uInt16   GetObjId() const { return mnObjId; }
88cdf0e10cSrcweir     /** Returns the Excel object type from OBJ record. */
GetObjType() const89cdf0e10cSrcweir     inline sal_uInt16   GetObjType() const { return mnObjType; }
90cdf0e10cSrcweir     /** Returns the name of this object, may generate a default name. */
91cdf0e10cSrcweir     String              GetObjName() const;
92cdf0e10cSrcweir     /** Returns associated macro name, if set, otherwise zero length string. */
GetMacroName() const93cdf0e10cSrcweir     inline const String& GetMacroName() const { return maMacroName; }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     /** Returns the shape identifier used in the DFF stream. */
GetDffShapeId() const96cdf0e10cSrcweir     inline sal_uInt32   GetDffShapeId() const { return mnDffShapeId; }
97cdf0e10cSrcweir     /** Returns the shape flags from the DFF stream. */
GetDffFlags() const98cdf0e10cSrcweir     inline sal_uInt32   GetDffFlags() const { return mnDffFlags; }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     /** Returns true, if the object is hidden. */
IsHidden() const101cdf0e10cSrcweir     inline bool         IsHidden() const { return mbHidden; }
102cdf0e10cSrcweir     /** Returns true, if the object is visible. */
IsVisible() const103cdf0e10cSrcweir     inline bool         IsVisible() const { return mbVisible; }
104cdf0e10cSrcweir     /** Returns true, if the object is printable. */
IsPrintable() const105cdf0e10cSrcweir     inline bool         IsPrintable() const { return mbPrintable; }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     /** Returns the object anchor if existing, null otherwise. */
108cdf0e10cSrcweir     const XclObjAnchor* GetAnchor() const;
109cdf0e10cSrcweir     /** Returns true, if the passed size is valid for this object. */
110cdf0e10cSrcweir     bool                IsValidSize( const Rectangle& rAnchorRect ) const;
111cdf0e10cSrcweir     /** Returns the range in the sheet covered by this object. */
112cdf0e10cSrcweir     ScRange             GetUsedArea( SCTAB nScTab ) const;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     /** Returns true, if the object is valid and will be processed. */
IsProcessSdrObj() const115cdf0e10cSrcweir     inline bool         IsProcessSdrObj() const { return mbProcessSdr && !mbHidden; }
116cdf0e10cSrcweir     /** Returns true, if the SdrObject will be created or processed, but not be inserted into the draw page. */
IsInsertSdrObj() const117cdf0e10cSrcweir     inline bool         IsInsertSdrObj() const { return mbInsertSdr; }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     /** Returns the needed size on the progress bar (calls virtual DoGetProgressSize() function). */
120cdf0e10cSrcweir     sal_Size            GetProgressSize() const;
121cdf0e10cSrcweir     /** Creates and returns an SdrObject from the contained data. Caller takes ownership! */
122cdf0e10cSrcweir     SdrObject*          CreateSdrObject( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect, bool bIsDff ) const;
123cdf0e10cSrcweir     /** Additional processing for the passed SdrObject before insertion into
124cdf0e10cSrcweir         the drawing page (calls virtual DoPreProcessSdrObj() function). */
125cdf0e10cSrcweir     void                PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
126cdf0e10cSrcweir     /** Additional processing for the passed SdrObject after insertion into the
127cdf0e10cSrcweir         drawing page (calls virtual DoPostProcessSdrObj() function). */
128cdf0e10cSrcweir     void                PostProcessSdrObject( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir protected:
131cdf0e10cSrcweir     /** Reads the object name in a BIFF5 OBJ record. */
132cdf0e10cSrcweir     void                ReadName5( XclImpStream& rStrm, sal_uInt16 nNameLen );
133cdf0e10cSrcweir     /** Reads the macro link in a BIFF3 OBJ record. */
134cdf0e10cSrcweir     void                ReadMacro3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
135cdf0e10cSrcweir     /** Reads the macro link in a BIFF4 OBJ record. */
136cdf0e10cSrcweir     void                ReadMacro4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
137cdf0e10cSrcweir     /** Reads the macro link in a BIFF5 OBJ record. */
138cdf0e10cSrcweir     void                ReadMacro5( XclImpStream& rStrm, sal_uInt16 nMacroSize );
139cdf0e10cSrcweir     /** Reads the contents of the ftMacro sub structure in an OBJ record. */
140cdf0e10cSrcweir     void                ReadMacro8( XclImpStream& rStrm );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     /** Converts the passed line formatting to the passed SdrObject. */
143cdf0e10cSrcweir     void                ConvertLineStyle( SdrObject& rSdrObj, const XclObjLineData& rLineData ) const;
144cdf0e10cSrcweir     /** Converts the passed fill formatting to the passed SdrObject. */
145cdf0e10cSrcweir     void                ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillData& rFillData ) const;
146cdf0e10cSrcweir     /** Converts the passed frame flags to the passed SdrObject. */
147cdf0e10cSrcweir     void                ConvertFrameStyle( SdrObject& rSdrObj, sal_uInt16 nFrameFlags ) const;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     /** Returns a solid line color from the passed line data struct. */
150cdf0e10cSrcweir     Color               GetSolidLineColor( const XclObjLineData& rLineData ) const;
151cdf0e10cSrcweir     /** Returns a solid fill color from the passed fill data struct. */
152cdf0e10cSrcweir     Color               GetSolidFillColor( const XclObjFillData& rFillData ) const;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     /** Derived classes read the contents of the a BIFF3 OBJ record from the passed stream. */
155cdf0e10cSrcweir     virtual void        DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
156cdf0e10cSrcweir     /** Derived classes read the contents of the a BIFF4 OBJ record from the passed stream. */
157cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
158cdf0e10cSrcweir     /** Derived classes read the contents of the a BIFF5 OBJ record from the passed stream. */
159cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
160cdf0e10cSrcweir     /** Derived classes read the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
161cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     /** Derived classes may return a progress bar size different from 1. */
164cdf0e10cSrcweir     virtual sal_Size    DoGetProgressSize() const;
165cdf0e10cSrcweir     /** Derived classes create and return a new SdrObject from the contained data. Caller takes ownership! */
166cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
167cdf0e10cSrcweir     /** Derived classes may perform additional processing for the passed SdrObject before insertion. */
168cdf0e10cSrcweir     virtual void        DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
169cdf0e10cSrcweir     /** Derived classes may perform additional processing for the passed SdrObject after insertion. */
170cdf0e10cSrcweir     virtual void        DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir private:
173cdf0e10cSrcweir     /** Reads the contents of a BIFF3 OBJ record. */
174cdf0e10cSrcweir     void                ImplReadObj3( XclImpStream& rStrm );
175cdf0e10cSrcweir     /** Reads the contents of a BIFF4 OBJ record. */
176cdf0e10cSrcweir     void                ImplReadObj4( XclImpStream& rStrm );
177cdf0e10cSrcweir     /** Reads the contents of a BIFF5 OBJ record. */
178cdf0e10cSrcweir     void                ImplReadObj5( XclImpStream& rStrm );
179cdf0e10cSrcweir     /** Reads the contents of a BIFF8 OBJ record. */
180cdf0e10cSrcweir     void                ImplReadObj8( XclImpStream& rStrm );
181cdf0e10cSrcweir 
182cdf0e10cSrcweir private:
183cdf0e10cSrcweir     XclObjAnchor        maAnchor;       /// The position of the object in its parent.
184cdf0e10cSrcweir     sal_uInt16          mnObjId;        /// The object identifier (unique per drawing).
185cdf0e10cSrcweir     sal_uInt16          mnObjType;      /// The Excel object type from OBJ record.
186cdf0e10cSrcweir     sal_uInt32          mnDffShapeId;   /// Shape ID from DFF stream.
187cdf0e10cSrcweir     sal_uInt32          mnDffFlags;     /// Shape flags from DFF stream.
188cdf0e10cSrcweir     String              maObjName;      /// Name of the object.
189cdf0e10cSrcweir     String              maMacroName;    /// Name of an attached macro.
190cdf0e10cSrcweir     String              maHyperlink;    /// On-click hyperlink URL.
191cdf0e10cSrcweir     bool                mbHasAnchor;    /// true = maAnchor is initialized.
192cdf0e10cSrcweir     bool                mbHidden;       /// true = Object is hidden.
193cdf0e10cSrcweir     bool                mbVisible;      /// true = Object is visible.
194cdf0e10cSrcweir     bool                mbPrintable;    /// true = Object is printable.
195cdf0e10cSrcweir     bool                mbAreaObj;      /// true = Width and height must be greater than 0.
196cdf0e10cSrcweir     bool                mbAutoMargin;   /// true = Set automatic text margin.
197cdf0e10cSrcweir     bool                mbSimpleMacro;  /// true = Create simple macro link and hyperlink.
198cdf0e10cSrcweir     bool                mbProcessSdr;   /// true = Object is valid, do processing and insertion.
199cdf0e10cSrcweir     bool                mbInsertSdr;    /// true = Insert the SdrObject into draw page.
200cdf0e10cSrcweir     bool                mbCustomDff;    /// true = Recreate SdrObject in DFF import.
201cdf0e10cSrcweir };
202cdf0e10cSrcweir 
203cdf0e10cSrcweir // ----------------------------------------------------------------------------
204cdf0e10cSrcweir 
205cdf0e10cSrcweir class XclImpDrawObjVector : public ::std::vector< XclImpDrawObjRef >
206cdf0e10cSrcweir {
207cdf0e10cSrcweir public:
XclImpDrawObjVector()208cdf0e10cSrcweir     inline explicit     XclImpDrawObjVector() {}
209cdf0e10cSrcweir 
210cdf0e10cSrcweir     /** Tries to insert the passed object into the last group or appends it. */
211cdf0e10cSrcweir     void                InsertGrouped( XclImpDrawObjRef xDrawObj );
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     /** Returns the needed size on the progress bar for all contained objects. */
214cdf0e10cSrcweir     sal_Size            GetProgressSize() const;
215cdf0e10cSrcweir };
216cdf0e10cSrcweir 
217cdf0e10cSrcweir // ----------------------------------------------------------------------------
218cdf0e10cSrcweir 
219cdf0e10cSrcweir /** A placeholder object for unknown object types. */
220cdf0e10cSrcweir class XclImpPhObj : public XclImpDrawObjBase
221cdf0e10cSrcweir {
222cdf0e10cSrcweir public:
223cdf0e10cSrcweir     explicit            XclImpPhObj( const XclImpRoot& rRoot );
224cdf0e10cSrcweir };
225cdf0e10cSrcweir 
226cdf0e10cSrcweir // ----------------------------------------------------------------------------
227cdf0e10cSrcweir 
228cdf0e10cSrcweir /** A group object. */
229cdf0e10cSrcweir class XclImpGroupObj : public XclImpDrawObjBase
230cdf0e10cSrcweir {
231cdf0e10cSrcweir public:
232cdf0e10cSrcweir     explicit            XclImpGroupObj( const XclImpRoot& rRoot );
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     /** Tries to insert the drawing object into this or a nested group. */
235cdf0e10cSrcweir     bool                TryInsert( XclImpDrawObjRef xDrawObj );
236cdf0e10cSrcweir 
237cdf0e10cSrcweir protected:
238cdf0e10cSrcweir     /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
239cdf0e10cSrcweir     virtual void        DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
240cdf0e10cSrcweir     /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
241cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
242cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
243cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
244cdf0e10cSrcweir     /** Returns a progress bar size that takes all group children into account. */
245cdf0e10cSrcweir     virtual sal_Size    DoGetProgressSize() const;
246cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
247cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
248cdf0e10cSrcweir 
249cdf0e10cSrcweir protected:
250cdf0e10cSrcweir     XclImpDrawObjVector maChildren;         /// Grouped objects.
251cdf0e10cSrcweir     sal_uInt16          mnFirstUngrouped;   /// Object identfier of first object not grouped into this group.
252cdf0e10cSrcweir };
253cdf0e10cSrcweir 
254cdf0e10cSrcweir // ----------------------------------------------------------------------------
255cdf0e10cSrcweir 
256cdf0e10cSrcweir /** A line object. */
257cdf0e10cSrcweir class XclImpLineObj : public XclImpDrawObjBase
258cdf0e10cSrcweir {
259cdf0e10cSrcweir public:
260cdf0e10cSrcweir     explicit            XclImpLineObj( const XclImpRoot& rRoot );
261cdf0e10cSrcweir 
262cdf0e10cSrcweir protected:
263cdf0e10cSrcweir     /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
264cdf0e10cSrcweir     virtual void        DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
265cdf0e10cSrcweir     /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
266cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
267cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
268cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
269cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
270cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
271cdf0e10cSrcweir 
272cdf0e10cSrcweir protected:
273cdf0e10cSrcweir     XclObjLineData      maLineData;     /// BIFF5 line formatting.
274cdf0e10cSrcweir     sal_uInt16          mnArrows;       /// Line arrows.
275cdf0e10cSrcweir     sal_uInt8           mnStartPoint;   /// Starting point.
276cdf0e10cSrcweir };
277cdf0e10cSrcweir 
278cdf0e10cSrcweir // ----------------------------------------------------------------------------
279cdf0e10cSrcweir 
280cdf0e10cSrcweir /** A rectangle or oval object. */
281cdf0e10cSrcweir class XclImpRectObj : public XclImpDrawObjBase
282cdf0e10cSrcweir {
283cdf0e10cSrcweir public:
284cdf0e10cSrcweir     explicit            XclImpRectObj( const XclImpRoot& rRoot );
285cdf0e10cSrcweir 
286cdf0e10cSrcweir protected:
287cdf0e10cSrcweir     /** Reads fil data, line data, and frame flags. */
288cdf0e10cSrcweir     void                ReadFrameData( XclImpStream& rStrm );
289cdf0e10cSrcweir 
290cdf0e10cSrcweir     /** Converts fill formatting, line formattind, and frame style. */
291cdf0e10cSrcweir     void                ConvertRectStyle( SdrObject& rSdrObj ) const;
292cdf0e10cSrcweir 
293cdf0e10cSrcweir     /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
294cdf0e10cSrcweir     virtual void        DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
295cdf0e10cSrcweir     /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
296cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
297cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
298cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
299cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
300cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir protected:
303cdf0e10cSrcweir     XclObjFillData      maFillData;     /// BIFF5 fill formatting.
304cdf0e10cSrcweir     XclObjLineData      maLineData;     /// BIFF5 line formatting.
305cdf0e10cSrcweir     sal_uInt16          mnFrameFlags;   /// Additional flags.
306cdf0e10cSrcweir };
307cdf0e10cSrcweir 
308cdf0e10cSrcweir // ----------------------------------------------------------------------------
309cdf0e10cSrcweir 
310cdf0e10cSrcweir /** An oval object. */
311cdf0e10cSrcweir class XclImpOvalObj : public XclImpRectObj
312cdf0e10cSrcweir {
313cdf0e10cSrcweir public:
314cdf0e10cSrcweir     explicit            XclImpOvalObj( const XclImpRoot& rRoot );
315cdf0e10cSrcweir 
316cdf0e10cSrcweir protected:
317cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
318cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
319cdf0e10cSrcweir };
320cdf0e10cSrcweir 
321cdf0e10cSrcweir // ----------------------------------------------------------------------------
322cdf0e10cSrcweir 
323cdf0e10cSrcweir /** An arc object. */
324cdf0e10cSrcweir class XclImpArcObj : public XclImpDrawObjBase
325cdf0e10cSrcweir {
326cdf0e10cSrcweir public:
327cdf0e10cSrcweir     explicit            XclImpArcObj( const XclImpRoot& rRoot );
328cdf0e10cSrcweir 
329cdf0e10cSrcweir protected:
330cdf0e10cSrcweir     /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
331cdf0e10cSrcweir     virtual void        DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
332cdf0e10cSrcweir     /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
333cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
334cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
335cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
336cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
337cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
338cdf0e10cSrcweir 
339cdf0e10cSrcweir protected:
340cdf0e10cSrcweir     XclObjFillData      maFillData;     /// BIFF5 fill formatting.
341cdf0e10cSrcweir     XclObjLineData      maLineData;     /// BIFF5 line formatting.
342cdf0e10cSrcweir     sal_uInt8           mnQuadrant;     /// Visible quadrant of the circle.
343cdf0e10cSrcweir };
344cdf0e10cSrcweir 
345cdf0e10cSrcweir // ----------------------------------------------------------------------------
346cdf0e10cSrcweir 
347cdf0e10cSrcweir /** A polygon object. */
348cdf0e10cSrcweir class XclImpPolygonObj : public XclImpRectObj
349cdf0e10cSrcweir {
350cdf0e10cSrcweir public:
351cdf0e10cSrcweir     explicit            XclImpPolygonObj( const XclImpRoot& rRoot );
352cdf0e10cSrcweir 
353cdf0e10cSrcweir protected:
354cdf0e10cSrcweir     /** Reads the COORDLIST record following the OBJ record. */
355cdf0e10cSrcweir     void                ReadCoordList( XclImpStream& rStrm );
356cdf0e10cSrcweir 
357cdf0e10cSrcweir     /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
358cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
359cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
360cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
361cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
362cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
363cdf0e10cSrcweir 
364cdf0e10cSrcweir protected:
365cdf0e10cSrcweir     typedef ::std::vector< Point > PointVector;
366cdf0e10cSrcweir     PointVector         maCoords;       /// Coordinates relative to bounding rectangle.
367cdf0e10cSrcweir     sal_uInt16          mnPolyFlags;    /// Additional flags.
368cdf0e10cSrcweir     sal_uInt16          mnPointCount;   /// Polygon point count.
369cdf0e10cSrcweir };
370cdf0e10cSrcweir 
371cdf0e10cSrcweir // ----------------------------------------------------------------------------
372cdf0e10cSrcweir 
373cdf0e10cSrcweir struct XclImpObjTextData
374cdf0e10cSrcweir {
375cdf0e10cSrcweir     XclObjTextData      maData;         /// BIFF5 text data.
376cdf0e10cSrcweir     XclImpStringRef     mxString;       /// Plain or rich string.
377cdf0e10cSrcweir 
378cdf0e10cSrcweir     /** Reads a byte string from the passed stream. */
379cdf0e10cSrcweir     void                ReadByteString( XclImpStream& rStrm );
380cdf0e10cSrcweir     /** Reads text formatting from the passed stream. */
381cdf0e10cSrcweir     void                ReadFormats( XclImpStream& rStrm );
382cdf0e10cSrcweir };
383cdf0e10cSrcweir 
384cdf0e10cSrcweir // ----------------------------------------------------------------------------
385cdf0e10cSrcweir 
386cdf0e10cSrcweir /** A drawing object supporting text contents. Used for all simple objects in BIFF8. */
387cdf0e10cSrcweir class XclImpTextObj : public XclImpRectObj
388cdf0e10cSrcweir {
389cdf0e10cSrcweir public:
390cdf0e10cSrcweir     explicit            XclImpTextObj( const XclImpRoot& rRoot );
391cdf0e10cSrcweir 
392cdf0e10cSrcweir     /** Stores the passed textbox data. */
SetTextData(const XclImpObjTextData & rTextData)393cdf0e10cSrcweir     inline void         SetTextData( const XclImpObjTextData& rTextData ) { maTextData = rTextData; }
394cdf0e10cSrcweir 
395cdf0e10cSrcweir protected:
396cdf0e10cSrcweir     /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
397cdf0e10cSrcweir     virtual void        DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
398cdf0e10cSrcweir     /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
399cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
400cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
401cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
402cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
403cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
404cdf0e10cSrcweir     /** Inserts the contained text data at the passed object. */
405cdf0e10cSrcweir     virtual void        DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
406cdf0e10cSrcweir 
407cdf0e10cSrcweir protected:
408cdf0e10cSrcweir     XclImpObjTextData   maTextData;     /// Textbox data from BIFF5 OBJ or BIFF8 TXO record.
409cdf0e10cSrcweir };
410cdf0e10cSrcweir 
411cdf0e10cSrcweir // ----------------------------------------------------------------------------
412cdf0e10cSrcweir 
413cdf0e10cSrcweir /** A chart object. This is the drawing object wrapper for the chart data. */
414cdf0e10cSrcweir class XclImpChartObj : public XclImpRectObj
415cdf0e10cSrcweir {
416cdf0e10cSrcweir public:
417cdf0e10cSrcweir     /** @param bOwnTab  True = chart is on an own sheet; false = chart is an embedded object. */
418cdf0e10cSrcweir     explicit            XclImpChartObj( const XclImpRoot& rRoot, bool bOwnTab = false );
419cdf0e10cSrcweir 
420cdf0e10cSrcweir     /** Reads the complete chart substream (BOF/EOF block). */
421cdf0e10cSrcweir     void                ReadChartSubStream( XclImpStream& rStrm );
422cdf0e10cSrcweir 
423cdf0e10cSrcweir protected:
424cdf0e10cSrcweir     /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
425cdf0e10cSrcweir     virtual void        DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
426cdf0e10cSrcweir     /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
427cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
428cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
429cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
430cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
431cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
432cdf0e10cSrcweir     /** Returns the needed size on the progress bar. */
433cdf0e10cSrcweir     virtual sal_Size    DoGetProgressSize() const;
434cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
435cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
436cdf0e10cSrcweir     /** Converts the chart document. */
437cdf0e10cSrcweir     virtual void        DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
438cdf0e10cSrcweir 
439cdf0e10cSrcweir private:
440cdf0e10cSrcweir     /** Calculates the object anchor of a sheet chart (chart fills one page). */
441cdf0e10cSrcweir     void                FinalizeTabChart();
442cdf0e10cSrcweir 
443cdf0e10cSrcweir private:
444cdf0e10cSrcweir     typedef ScfRef< XclImpChart > XclImpChartRef;
445cdf0e10cSrcweir 
446cdf0e10cSrcweir     XclImpChartRef      mxChart;        /// The chart itself (BOF/EOF substream data).
447cdf0e10cSrcweir     bool                mbOwnTab;       /// true = own sheet; false = embedded object.
448cdf0e10cSrcweir };
449cdf0e10cSrcweir 
450cdf0e10cSrcweir // ----------------------------------------------------------------------------
451cdf0e10cSrcweir 
452cdf0e10cSrcweir /** A note object, which is a specialized text box objext. */
453cdf0e10cSrcweir class XclImpNoteObj : public XclImpTextObj
454cdf0e10cSrcweir {
455cdf0e10cSrcweir public:
456cdf0e10cSrcweir     explicit            XclImpNoteObj( const XclImpRoot& rRoot );
457cdf0e10cSrcweir 
458cdf0e10cSrcweir     /** Sets note flags and the note position in the Calc sheet. */
459cdf0e10cSrcweir     void                SetNoteData( const ScAddress& rScPos, sal_uInt16 nNoteFlags );
460cdf0e10cSrcweir 
461cdf0e10cSrcweir protected:
462cdf0e10cSrcweir     /** Inserts the note into the document, sets visibility. */
463cdf0e10cSrcweir     virtual void        DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
464cdf0e10cSrcweir 
465cdf0e10cSrcweir private:
466cdf0e10cSrcweir     ScAddress           maScPos;        /// Cell position of the note object.
467cdf0e10cSrcweir     sal_uInt16          mnNoteFlags;    /// Flags from NOTE record.
468cdf0e10cSrcweir };
469cdf0e10cSrcweir 
470cdf0e10cSrcweir // ----------------------------------------------------------------------------
471cdf0e10cSrcweir 
472cdf0e10cSrcweir /** Helper base class for TBX and OCX form controls to manage spreadsheet links. */
473cdf0e10cSrcweir class XclImpControlHelper
474cdf0e10cSrcweir {
475cdf0e10cSrcweir public:
476cdf0e10cSrcweir     explicit            XclImpControlHelper( const XclImpRoot& rRoot, XclCtrlBindMode eBindMode );
477cdf0e10cSrcweir     virtual             ~XclImpControlHelper();
478cdf0e10cSrcweir 
479cdf0e10cSrcweir     /** Returns true, if a linked cell address is present. */
HasCellLink() const480cdf0e10cSrcweir     inline bool         HasCellLink() const { return mxCellLink.is(); }
481cdf0e10cSrcweir     /** Returns true, if a linked source cell range is present. */
HasSourceRange() const482cdf0e10cSrcweir     inline bool         HasSourceRange() const { return mxSrcRange.is(); }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir     /** Returns the SdrObject from the passed control shape and sets the bounding rectangle. */
485cdf0e10cSrcweir     SdrObject*          CreateSdrObjectFromShape(
486cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
487cdf0e10cSrcweir                             const Rectangle& rAnchorRect ) const;
488cdf0e10cSrcweir 
489cdf0e10cSrcweir     /** Sets additional properties to the form control model, calls virtual DoProcessControl(). */
490cdf0e10cSrcweir     void                ProcessControl( const XclImpDrawObjBase& rDrawObj ) const;
491cdf0e10cSrcweir 
492cdf0e10cSrcweir protected:
493cdf0e10cSrcweir     /** Reads the formula for the linked cell from the current position of the stream. */
494cdf0e10cSrcweir     void                ReadCellLinkFormula( XclImpStream& rStrm, bool bWithBoundSize );
495cdf0e10cSrcweir     /** Reads the formula for the source range from the current position of the stream. */
496cdf0e10cSrcweir     void                ReadSourceRangeFormula( XclImpStream& rStrm, bool bWithBoundSize );
497cdf0e10cSrcweir 
498cdf0e10cSrcweir     /** Derived classes will set additional properties for the current form control. */
499cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
500*0154edadSAndre Fischer     mutable ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
501*0154edadSAndre Fischer                         mxShape;        /// The UNO wrapper of the control shape.
502cdf0e10cSrcweir 
503cdf0e10cSrcweir private:
504cdf0e10cSrcweir     /** Reads a list of cell ranges from a formula at the current stream position. */
505cdf0e10cSrcweir     void                ReadRangeList( ScRangeList& rScRanges, XclImpStream& rStrm );
506cdf0e10cSrcweir     /** Reads leading formula size and a list of cell ranges from a formula if the leading size is not zero. */
507cdf0e10cSrcweir     void                ReadRangeList( ScRangeList& rScRanges, XclImpStream& rStrm, bool bWithBoundSize );
508cdf0e10cSrcweir 
509cdf0e10cSrcweir private:
510cdf0e10cSrcweir     const XclImpRoot&   mrRoot;         /// Not derived from XclImpRoot to allow multiple inheritance.
511cdf0e10cSrcweir     ScfRef< ScAddress > mxCellLink;     /// Linked cell in the Calc document.
512cdf0e10cSrcweir     ScfRef< ScRange >   mxSrcRange;     /// Source data range in the Calc document.
513cdf0e10cSrcweir     XclCtrlBindMode     meBindMode;     /// Value binding mode.
514cdf0e10cSrcweir };
515cdf0e10cSrcweir 
516cdf0e10cSrcweir // ----------------------------------------------------------------------------
517cdf0e10cSrcweir 
518cdf0e10cSrcweir /** Base class for textbox based form controls. */
519cdf0e10cSrcweir class XclImpTbxObjBase : public XclImpTextObj, public XclImpControlHelper
520cdf0e10cSrcweir {
521cdf0e10cSrcweir public:
522cdf0e10cSrcweir     explicit            XclImpTbxObjBase( const XclImpRoot& rRoot );
523cdf0e10cSrcweir 
524cdf0e10cSrcweir     /** Sets line and fill formatting from the passed DFF property set. */
525cdf0e10cSrcweir     void                SetDffProperties( const DffPropSet& rDffPropSet );
526cdf0e10cSrcweir 
527cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
GetServiceName() const528cdf0e10cSrcweir     inline ::rtl::OUString GetServiceName() const { return DoGetServiceName(); }
529cdf0e10cSrcweir     /** Fills the passed macro event descriptor. */
530cdf0e10cSrcweir     bool                FillMacroDescriptor(
531cdf0e10cSrcweir                             ::com::sun::star::script::ScriptEventDescriptor& rDescriptor ) const;
532cdf0e10cSrcweir 
533cdf0e10cSrcweir protected:
534cdf0e10cSrcweir     /** Sets control text formatting. */
535cdf0e10cSrcweir     void                ConvertFont( ScfPropertySet& rPropSet ) const;
536cdf0e10cSrcweir     /** Sets control label and text formatting. */
537cdf0e10cSrcweir     void                ConvertLabel( ScfPropertySet& rPropSet ) const;
538cdf0e10cSrcweir 
539cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
540cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
541cdf0e10cSrcweir     /** Additional processing on the SdrObject, calls new virtual function DoProcessControl(). */
542cdf0e10cSrcweir     virtual void        DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
543cdf0e10cSrcweir 
544cdf0e10cSrcweir     /** Derived classes return the service name of the control component to be created. */
545cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const = 0;
546cdf0e10cSrcweir     /** Derived classes return the type of the macro event to be created. */
547cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const = 0;
548cdf0e10cSrcweir };
549cdf0e10cSrcweir 
550cdf0e10cSrcweir // ----------------------------------------------------------------------------
551cdf0e10cSrcweir 
552cdf0e10cSrcweir /** A button control. */
553cdf0e10cSrcweir class XclImpButtonObj : public XclImpTbxObjBase
554cdf0e10cSrcweir {
555cdf0e10cSrcweir public:
556cdf0e10cSrcweir     explicit            XclImpButtonObj( const XclImpRoot& rRoot );
557cdf0e10cSrcweir 
558cdf0e10cSrcweir protected:
559cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
560cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
561cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
562cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
563cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
564cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
565cdf0e10cSrcweir };
566cdf0e10cSrcweir 
567cdf0e10cSrcweir // ----------------------------------------------------------------------------
568cdf0e10cSrcweir 
569cdf0e10cSrcweir /** A checkbox control. */
570cdf0e10cSrcweir class XclImpCheckBoxObj : public XclImpTbxObjBase
571cdf0e10cSrcweir {
572cdf0e10cSrcweir public:
573cdf0e10cSrcweir     explicit            XclImpCheckBoxObj( const XclImpRoot& rRoot );
574cdf0e10cSrcweir 
575cdf0e10cSrcweir protected:
576cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
577cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
578cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
579cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
580cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
581cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
582cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
583cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
584cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
585cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
586cdf0e10cSrcweir 
587cdf0e10cSrcweir protected:
588cdf0e10cSrcweir     sal_uInt16          mnState;
589cdf0e10cSrcweir     sal_uInt16          mnCheckBoxFlags;
590cdf0e10cSrcweir };
591cdf0e10cSrcweir 
592cdf0e10cSrcweir // ----------------------------------------------------------------------------
593cdf0e10cSrcweir 
594cdf0e10cSrcweir /** An option button control. */
595cdf0e10cSrcweir class XclImpOptionButtonObj : public XclImpCheckBoxObj
596cdf0e10cSrcweir {
597cdf0e10cSrcweir public:
598cdf0e10cSrcweir     explicit            XclImpOptionButtonObj( const XclImpRoot& rRoot );
599cdf0e10cSrcweir 
600cdf0e10cSrcweir protected:
601cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
602cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
603cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
604cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
605cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
606cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
607cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
608cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
609cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
610cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
611cdf0e10cSrcweir 
612cdf0e10cSrcweir protected:
613cdf0e10cSrcweir     sal_uInt16          mnNextInGroup;      /// Next option button in a group.
614cdf0e10cSrcweir     sal_uInt16          mnFirstInGroup;     /// 1 = Button is the first in a group.
615cdf0e10cSrcweir };
616cdf0e10cSrcweir 
617cdf0e10cSrcweir // ----------------------------------------------------------------------------
618cdf0e10cSrcweir 
619cdf0e10cSrcweir /** A label control. */
620cdf0e10cSrcweir class XclImpLabelObj : public XclImpTbxObjBase
621cdf0e10cSrcweir {
622cdf0e10cSrcweir public:
623cdf0e10cSrcweir     explicit            XclImpLabelObj( const XclImpRoot& rRoot );
624cdf0e10cSrcweir 
625cdf0e10cSrcweir protected:
626cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
627cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
628cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
629cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
630cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
631cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
632cdf0e10cSrcweir };
633cdf0e10cSrcweir 
634cdf0e10cSrcweir // ----------------------------------------------------------------------------
635cdf0e10cSrcweir 
636cdf0e10cSrcweir /** A groupbox control. */
637cdf0e10cSrcweir class XclImpGroupBoxObj : public XclImpTbxObjBase
638cdf0e10cSrcweir {
639cdf0e10cSrcweir public:
640cdf0e10cSrcweir     explicit            XclImpGroupBoxObj( const XclImpRoot& rRoot );
641cdf0e10cSrcweir 
642cdf0e10cSrcweir protected:
643cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
644cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
645cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
646cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
647cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
648cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
649cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
650cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
651cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
652cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
653cdf0e10cSrcweir 
654cdf0e10cSrcweir protected:
655cdf0e10cSrcweir     sal_uInt16          mnGroupBoxFlags;
656cdf0e10cSrcweir };
657cdf0e10cSrcweir 
658cdf0e10cSrcweir // ----------------------------------------------------------------------------
659cdf0e10cSrcweir 
660cdf0e10cSrcweir /** A dialog control. */
661cdf0e10cSrcweir class XclImpDialogObj : public XclImpTbxObjBase
662cdf0e10cSrcweir {
663cdf0e10cSrcweir public:
664cdf0e10cSrcweir     explicit            XclImpDialogObj( const XclImpRoot& rRoot );
665cdf0e10cSrcweir 
666cdf0e10cSrcweir protected:
667cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
668cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
669cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
670cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
671cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
672cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
673cdf0e10cSrcweir };
674cdf0e10cSrcweir 
675cdf0e10cSrcweir // ----------------------------------------------------------------------------
676cdf0e10cSrcweir 
677cdf0e10cSrcweir /** An edit control. */
678cdf0e10cSrcweir class XclImpEditObj : public XclImpTbxObjBase
679cdf0e10cSrcweir {
680cdf0e10cSrcweir public:
681cdf0e10cSrcweir     explicit            XclImpEditObj( const XclImpRoot& rRoot );
682cdf0e10cSrcweir 
683cdf0e10cSrcweir protected:
684cdf0e10cSrcweir     /** REturns true, if the field type is numeric. */
685cdf0e10cSrcweir     bool                IsNumeric() const;
686cdf0e10cSrcweir 
687cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
688cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
689cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
690cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
691cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
692cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
693cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
694cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
695cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
696cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
697cdf0e10cSrcweir 
698cdf0e10cSrcweir protected:
699cdf0e10cSrcweir     sal_uInt16          mnContentType;
700cdf0e10cSrcweir     sal_uInt16          mnMultiLine;
701cdf0e10cSrcweir     sal_uInt16          mnScrollBar;
702cdf0e10cSrcweir     sal_uInt16          mnListBoxObjId;
703cdf0e10cSrcweir };
704cdf0e10cSrcweir 
705cdf0e10cSrcweir // ----------------------------------------------------------------------------
706cdf0e10cSrcweir 
707cdf0e10cSrcweir /** Base class of scrollable form controls (spin button, scrollbar, listbox, dropdown). */
708cdf0e10cSrcweir class XclImpTbxObjScrollableBase : public XclImpTbxObjBase
709cdf0e10cSrcweir {
710cdf0e10cSrcweir public:
711cdf0e10cSrcweir     explicit            XclImpTbxObjScrollableBase( const XclImpRoot& rRoot );
712cdf0e10cSrcweir 
713cdf0e10cSrcweir protected:
714cdf0e10cSrcweir     /** Reads scrollbar data. */
715cdf0e10cSrcweir     void                ReadSbs( XclImpStream& rStrm );
716cdf0e10cSrcweir 
717cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
718cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
719cdf0e10cSrcweir 
720cdf0e10cSrcweir protected:
721cdf0e10cSrcweir     sal_uInt16          mnValue;
722cdf0e10cSrcweir     sal_uInt16          mnMin;
723cdf0e10cSrcweir     sal_uInt16          mnMax;
724cdf0e10cSrcweir     sal_uInt16          mnStep;
725cdf0e10cSrcweir     sal_uInt16          mnPageStep;
726cdf0e10cSrcweir     sal_uInt16          mnOrient;
727cdf0e10cSrcweir     sal_uInt16          mnThumbWidth;
728cdf0e10cSrcweir     sal_uInt16          mnScrollFlags;
729cdf0e10cSrcweir };
730cdf0e10cSrcweir 
731cdf0e10cSrcweir // ----------------------------------------------------------------------------
732cdf0e10cSrcweir 
733cdf0e10cSrcweir /** A spinbutton control. */
734cdf0e10cSrcweir class XclImpSpinButtonObj : public XclImpTbxObjScrollableBase
735cdf0e10cSrcweir {
736cdf0e10cSrcweir public:
737cdf0e10cSrcweir     explicit            XclImpSpinButtonObj( const XclImpRoot& rRoot );
738cdf0e10cSrcweir 
739cdf0e10cSrcweir protected:
740cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
741cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
742cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
743cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
744cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
745cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
746cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
747cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
748cdf0e10cSrcweir };
749cdf0e10cSrcweir 
750cdf0e10cSrcweir // ----------------------------------------------------------------------------
751cdf0e10cSrcweir 
752cdf0e10cSrcweir /** A scrollbar control. */
753cdf0e10cSrcweir class XclImpScrollBarObj : public XclImpTbxObjScrollableBase
754cdf0e10cSrcweir {
755cdf0e10cSrcweir public:
756cdf0e10cSrcweir     explicit            XclImpScrollBarObj( const XclImpRoot& rRoot );
757cdf0e10cSrcweir 
758cdf0e10cSrcweir protected:
759cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
760cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
761cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
762cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
763cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
764cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
765cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
766cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
767cdf0e10cSrcweir };
768cdf0e10cSrcweir 
769cdf0e10cSrcweir // ----------------------------------------------------------------------------
770cdf0e10cSrcweir 
771cdf0e10cSrcweir /** Base class for list controls (listbox, dropdown). */
772cdf0e10cSrcweir class XclImpTbxObjListBase : public XclImpTbxObjScrollableBase
773cdf0e10cSrcweir {
774cdf0e10cSrcweir public:
775cdf0e10cSrcweir     explicit            XclImpTbxObjListBase( const XclImpRoot& rRoot );
776cdf0e10cSrcweir 
777cdf0e10cSrcweir protected:
778cdf0e10cSrcweir     /** Reads common listbox settings. */
779cdf0e10cSrcweir     void                ReadLbsData( XclImpStream& rStrm );
780cdf0e10cSrcweir     /** Sets common listbox/dropdown formatting attributes. */
781cdf0e10cSrcweir     void                SetBoxFormatting( ScfPropertySet& rPropSet ) const;
782cdf0e10cSrcweir 
783cdf0e10cSrcweir protected:
784cdf0e10cSrcweir     sal_uInt16          mnEntryCount;
785cdf0e10cSrcweir     sal_uInt16          mnSelEntry;
786cdf0e10cSrcweir     sal_uInt16          mnListFlags;
787cdf0e10cSrcweir     sal_uInt16          mnEditObjId;
788cdf0e10cSrcweir     bool                mbHasDefFontIdx;
789cdf0e10cSrcweir };
790cdf0e10cSrcweir 
791cdf0e10cSrcweir // ----------------------------------------------------------------------------
792cdf0e10cSrcweir 
793cdf0e10cSrcweir /** A listbox control. */
794cdf0e10cSrcweir class XclImpListBoxObj : public XclImpTbxObjListBase
795cdf0e10cSrcweir {
796cdf0e10cSrcweir public:
797cdf0e10cSrcweir     explicit            XclImpListBoxObj( const XclImpRoot& rRoot );
798cdf0e10cSrcweir 
799cdf0e10cSrcweir protected:
800cdf0e10cSrcweir     /** Reads listbox settings and selection. */
801cdf0e10cSrcweir     void                ReadFullLbsData( XclImpStream& rStrm, sal_Size nRecLeft );
802cdf0e10cSrcweir 
803cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
804cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
805cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
806cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
807cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
808cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
809cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
810cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
811cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
812cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
813cdf0e10cSrcweir 
814cdf0e10cSrcweir protected:
815cdf0e10cSrcweir     ScfUInt8Vec         maSelection;
816cdf0e10cSrcweir };
817cdf0e10cSrcweir 
818cdf0e10cSrcweir // ----------------------------------------------------------------------------
819cdf0e10cSrcweir 
820cdf0e10cSrcweir /** A dropdown listbox control. */
821cdf0e10cSrcweir class XclImpDropDownObj : public XclImpTbxObjListBase
822cdf0e10cSrcweir {
823cdf0e10cSrcweir public:
824cdf0e10cSrcweir     explicit            XclImpDropDownObj( const XclImpRoot& rRoot );
825cdf0e10cSrcweir 
826cdf0e10cSrcweir protected:
827cdf0e10cSrcweir     /** Returns the type of the dropdown control. */
828cdf0e10cSrcweir     sal_uInt16          GetDropDownType() const;
829cdf0e10cSrcweir 
830cdf0e10cSrcweir     /** Reads dropdown box settings. */
831cdf0e10cSrcweir     void                ReadFullLbsData( XclImpStream& rStrm );
832cdf0e10cSrcweir 
833cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
834cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
835cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
836cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
837cdf0e10cSrcweir     /** Sets additional properties for the current form control. */
838cdf0e10cSrcweir     virtual void        DoProcessControl( ScfPropertySet& rPropSet ) const;
839cdf0e10cSrcweir     /** Returns the service name of the control component to be created. */
840cdf0e10cSrcweir     virtual ::rtl::OUString DoGetServiceName() const;
841cdf0e10cSrcweir     /** Returns the type of the macro event to be created. */
842cdf0e10cSrcweir     virtual XclTbxEventType DoGetEventType() const;
843cdf0e10cSrcweir 
844cdf0e10cSrcweir protected:
845cdf0e10cSrcweir     sal_uInt16          mnLeft;
846cdf0e10cSrcweir     sal_uInt16          mnTop;
847cdf0e10cSrcweir     sal_uInt16          mnRight;
848cdf0e10cSrcweir     sal_uInt16          mnBottom;
849cdf0e10cSrcweir     sal_uInt16          mnDropDownFlags;
850cdf0e10cSrcweir     sal_uInt16          mnLineCount;
851cdf0e10cSrcweir     sal_uInt16          mnMinWidth;
852cdf0e10cSrcweir };
853cdf0e10cSrcweir 
854cdf0e10cSrcweir // ----------------------------------------------------------------------------
855cdf0e10cSrcweir 
856cdf0e10cSrcweir /** A picture, an embedded or linked OLE object, or an OCX form control. */
857cdf0e10cSrcweir class XclImpPictureObj : public XclImpRectObj, public XclImpControlHelper
858cdf0e10cSrcweir {
859cdf0e10cSrcweir public:
860cdf0e10cSrcweir     explicit            XclImpPictureObj( const XclImpRoot& rRoot );
861cdf0e10cSrcweir 
862cdf0e10cSrcweir     /** Returns the graphic imported from the IMGDATA record. */
GetGraphic() const863cdf0e10cSrcweir     inline const Graphic& GetGraphic() const { return maGraphic; }
864cdf0e10cSrcweir     /** Returns the visible area of the imported graphic. */
GetVisArea() const865cdf0e10cSrcweir     inline const Rectangle& GetVisArea() const { return maVisArea; }
866cdf0e10cSrcweir 
867cdf0e10cSrcweir     /** Returns true, if the OLE object will be shown as symbol. */
IsSymbol() const868cdf0e10cSrcweir     inline bool         IsSymbol() const { return mbSymbol; }
869cdf0e10cSrcweir     /** Returns the storage name for the OLE object. */
870cdf0e10cSrcweir     String              GetOleStorageName() const;
871cdf0e10cSrcweir 
872cdf0e10cSrcweir     /** Returns true, if this object is an OCX form control. */
IsOcxControl() const873cdf0e10cSrcweir     inline bool         IsOcxControl() const { return mbEmbedded && mbControl && mbUseCtlsStrm; }
874cdf0e10cSrcweir     /** Returns the position in the 'Ctls' stream for additional form control data. */
GetCtlsStreamPos() const875cdf0e10cSrcweir     inline sal_Size     GetCtlsStreamPos() const { return mnCtlsStrmPos; }
876cdf0e10cSrcweir     /** Returns the size in the 'Ctls' stream for additional form control data. */
GetCtlsStreamSize() const877cdf0e10cSrcweir     inline sal_Size     GetCtlsStreamSize() const { return mnCtlsStrmSize; }
878cdf0e10cSrcweir 
879cdf0e10cSrcweir protected:
880cdf0e10cSrcweir     /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
881cdf0e10cSrcweir     virtual void        DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize );
882cdf0e10cSrcweir     /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
883cdf0e10cSrcweir     virtual void        DoReadObj4( XclImpStream& rStrm, sal_uInt16 nMacroSize );
884cdf0e10cSrcweir     /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
885cdf0e10cSrcweir     virtual void        DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
886cdf0e10cSrcweir     /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
887cdf0e10cSrcweir     virtual void        DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
888cdf0e10cSrcweir     /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
889cdf0e10cSrcweir     virtual SdrObject*  DoCreateSdrObj( XclImpDffConverter& rDffConv, const Rectangle& rAnchorRect ) const;
890cdf0e10cSrcweir     /** Overloaded to do additional processing on the SdrObject. */
891cdf0e10cSrcweir     virtual void        DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
892cdf0e10cSrcweir 
893cdf0e10cSrcweir private:
894cdf0e10cSrcweir     /** Reads and sets the picture flags from a BIFF3-BIFF5 OBJ picture record. */
895cdf0e10cSrcweir     void                ReadFlags3( XclImpStream& rStrm );
896cdf0e10cSrcweir     /** Reads the contents of the OBJFLAGS subrecord. */
897cdf0e10cSrcweir     void                ReadFlags8( XclImpStream& rStrm );
898cdf0e10cSrcweir     /** Reads the contents of the OBJPICTFMLA subrecord. */
899cdf0e10cSrcweir     void                ReadPictFmla( XclImpStream& rStrm, sal_uInt16 nLinkSize );
900cdf0e10cSrcweir 
901cdf0e10cSrcweir private:
902cdf0e10cSrcweir     Graphic             maGraphic;      /// Picture or OLE placeholder graphic.
903cdf0e10cSrcweir     Rectangle           maVisArea;      /// Size of graphic.
904cdf0e10cSrcweir     String              maClassName;    /// Class name of embedded OLE object.
905cdf0e10cSrcweir     sal_uInt32          mnStorageId;    /// Identifier of the storage for this object.
906cdf0e10cSrcweir     sal_Size            mnCtlsStrmPos;  /// Position in 'Ctls' stream for this control.
907cdf0e10cSrcweir     sal_Size            mnCtlsStrmSize; /// Size in 'Ctls' stream for this control.
908cdf0e10cSrcweir     bool                mbEmbedded;     /// true = Embedded OLE object.
909cdf0e10cSrcweir     bool                mbLinked;       /// true = Linked OLE object.
910cdf0e10cSrcweir     bool                mbSymbol;       /// true = Show as symbol.
911cdf0e10cSrcweir     bool                mbControl;      /// true = Form control, false = OLE object.
912cdf0e10cSrcweir     bool                mbUseCtlsStrm;  /// true = Form control data in 'Ctls' stream, false = Own storage.
913cdf0e10cSrcweir };
914cdf0e10cSrcweir 
915cdf0e10cSrcweir // DFF stream conversion ======================================================
916cdf0e10cSrcweir 
917cdf0e10cSrcweir /** The solver container collects all connector rules for connected objects. */
918cdf0e10cSrcweir class XclImpSolverContainer : public SvxMSDffSolverContainer
919cdf0e10cSrcweir {
920cdf0e10cSrcweir public:
921cdf0e10cSrcweir //UNUSED2009-05 /** Reads the entire solver container. Stream must point to begin of container header. */
922cdf0e10cSrcweir //UNUSED2009-05 void                ReadSolverContainer( SvStream& rDffStrm );
923cdf0e10cSrcweir 
924cdf0e10cSrcweir     /** Inserts information about a new SdrObject. */
925cdf0e10cSrcweir     void                InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 nDffShapeId, sal_uInt32 nDffFlags );
926cdf0e10cSrcweir     /** Removes inforamtion of an SdrObject (and all child objects if it is a group). */
927cdf0e10cSrcweir     void                RemoveSdrObjectInfo( SdrObject& rSdrObj );
928cdf0e10cSrcweir 
929cdf0e10cSrcweir     /** Inserts the SdrObject pointers into all connector rules. */
930cdf0e10cSrcweir     void                UpdateConnectorRules();
931cdf0e10cSrcweir     /** Removes all contained connector rules. */
932cdf0e10cSrcweir     void                RemoveConnectorRules();
933cdf0e10cSrcweir 
934cdf0e10cSrcweir private:
935cdf0e10cSrcweir     /** Returns the first connector rule from the internal list. */
936cdf0e10cSrcweir     SvxMSDffConnectorRule* GetFirstRule();
937cdf0e10cSrcweir     /** Returns the next connector rule from the internal list. */
938cdf0e10cSrcweir     SvxMSDffConnectorRule* GetNextRule();
939cdf0e10cSrcweir     /** Updates the data of a connected shape in a connector rule. */
940cdf0e10cSrcweir     void                UpdateConnection( sal_uInt32 nDffShapeId, SdrObject*& rpSdrObj, sal_uInt32* pnDffFlags = 0 );
941cdf0e10cSrcweir 
942cdf0e10cSrcweir private:
943cdf0e10cSrcweir     /** Stores data about an SdrObject processed during import. */
944cdf0e10cSrcweir     struct XclImpSdrInfo
945cdf0e10cSrcweir     {
946cdf0e10cSrcweir         SdrObject*          mpSdrObj;       /// Pointer to an SdrObject.
947cdf0e10cSrcweir         sal_uInt32          mnDffFlags;     /// Shape flags from DFF stream.
XclImpSdrInfoXclImpSolverContainer::XclImpSdrInfo948cdf0e10cSrcweir         inline explicit     XclImpSdrInfo() : mpSdrObj( 0 ), mnDffFlags( 0 ) {}
SetXclImpSolverContainer::XclImpSdrInfo949cdf0e10cSrcweir         inline void         Set( SdrObject* pSdrObj, sal_uInt32 nDffFlags )
950cdf0e10cSrcweir                                 { mpSdrObj = pSdrObj; mnDffFlags = nDffFlags; }
951cdf0e10cSrcweir     };
952cdf0e10cSrcweir     typedef ::std::map< sal_uInt32, XclImpSdrInfo > XclImpSdrInfoMap;
953cdf0e10cSrcweir     typedef ::std::map< SdrObject*, sal_uInt32 >    XclImpSdrObjMap;
954cdf0e10cSrcweir 
955cdf0e10cSrcweir     XclImpSdrInfoMap    maSdrInfoMap;   /// Maps shape IDs to SdrObjects and flags.
956cdf0e10cSrcweir     XclImpSdrObjMap     maSdrObjMap;    /// Maps SdrObjects to shape IDs.
957cdf0e10cSrcweir };
958cdf0e10cSrcweir 
959cdf0e10cSrcweir // ----------------------------------------------------------------------------
960cdf0e10cSrcweir 
961cdf0e10cSrcweir /** Simple implementation of the SVX DFF manager. Implements resolving palette
962cdf0e10cSrcweir     colors. Used by XclImpDffPropSet (as is), extended by XclImpDffConverter.
963cdf0e10cSrcweir  */
964cdf0e10cSrcweir class XclImpSimpleDffConverter : public SvxMSDffManager, protected XclImpRoot
965cdf0e10cSrcweir {
966cdf0e10cSrcweir public:
967cdf0e10cSrcweir     explicit            XclImpSimpleDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm );
968cdf0e10cSrcweir     virtual             ~XclImpSimpleDffConverter();
969cdf0e10cSrcweir 
970cdf0e10cSrcweir protected:
971cdf0e10cSrcweir     /** Returns a color from the Excel color palette. */
972cdf0e10cSrcweir     virtual FASTBOOL    GetColorFromPalette( sal_uInt16 nIndex, Color& rColor ) const;
973cdf0e10cSrcweir };
974cdf0e10cSrcweir 
975cdf0e10cSrcweir // ----------------------------------------------------------------------------
976cdf0e10cSrcweir 
977cdf0e10cSrcweir /** This is the central instance for converting binary DFF data into shape
978cdf0e10cSrcweir     objects. Used for all sheet shapes and shapes embedded in chart objects.
979cdf0e10cSrcweir 
980cdf0e10cSrcweir     The class derives from SvxMSDffManager and SvxMSConvertOCXControls and
981cdf0e10cSrcweir     contains core implementation of DFF stream import and OCX form control
982cdf0e10cSrcweir     import.
983cdf0e10cSrcweir  */
984cdf0e10cSrcweir class XclImpDffConverter : public XclImpSimpleDffConverter, private SvxMSConvertOCXControls
985cdf0e10cSrcweir {
986cdf0e10cSrcweir public:
987cdf0e10cSrcweir     explicit            XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm );
988cdf0e10cSrcweir     virtual             ~XclImpDffConverter();
989cdf0e10cSrcweir 
990cdf0e10cSrcweir     /** Initializes the internal progress bar with the passed size and starts it. */
991cdf0e10cSrcweir     void                StartProgressBar( sal_Size nProgressSize );
992cdf0e10cSrcweir     /** Increase the progress bar by the passed value. */
993cdf0e10cSrcweir     void                Progress( sal_Size nDelta = 1 );
994cdf0e10cSrcweir 
995cdf0e10cSrcweir     /** Initially called before the objects of the passed drawing manager are converted. */
996cdf0e10cSrcweir     void                InitializeDrawing( XclImpDrawing& rDrawing, SdrModel& rSdrModel, SdrPage& rSdrPage );
997cdf0e10cSrcweir     /** Processes BIFF5 drawing objects without DFF data, inserts into the passed object list. */
998cdf0e10cSrcweir     void                ProcessObject( SdrObjList& rObjList, const XclImpDrawObjBase& rDrawObj );
999cdf0e10cSrcweir     /** Processes all objects in the passed list. */
1000cdf0e10cSrcweir     void                ProcessDrawing( const XclImpDrawObjVector& rDrawObjs );
1001cdf0e10cSrcweir     /** Processes a drawing container in the passed DFF stream, converts all objects. */
1002cdf0e10cSrcweir     void                ProcessDrawing( SvStream& rDffStrm );
1003cdf0e10cSrcweir     /** Finally called after the objects of the passed drawing manager have been converted. */
1004cdf0e10cSrcweir     void                FinalizeDrawing();
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir     /** Creates the SdrObject for the passed Excel TBX form control object. */
1007cdf0e10cSrcweir     SdrObject*          CreateSdrObject( const XclImpTbxObjBase& rTbxObj, const Rectangle& rAnchorRect );
1008cdf0e10cSrcweir     /** Creates the SdrObject for the passed Excel OLE object or OCX form control object. */
1009cdf0e10cSrcweir     SdrObject*          CreateSdrObject( const XclImpPictureObj& rPicObj, const Rectangle& rAnchorRect );
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir     /** Returns true, if the conversion of OLE objects is supported. */
1012cdf0e10cSrcweir     bool                SupportsOleObjects() const;
1013cdf0e10cSrcweir     /** Returns the default text margin in drawing layer units. */
GetDefaultTextMargin() const1014cdf0e10cSrcweir     inline sal_Int32    GetDefaultTextMargin() const { return mnDefTextMargin; }
1015cdf0e10cSrcweir 
1016cdf0e10cSrcweir private:
1017cdf0e10cSrcweir     // virtual functions of SvxMSDffManager
1018cdf0e10cSrcweir 
1019cdf0e10cSrcweir     /** Reads the client anchor from the DFF stream and sets it at the correct object. */
1020cdf0e10cSrcweir     virtual void        ProcessClientAnchor2(
1021cdf0e10cSrcweir                             SvStream& rDffStrm,
1022cdf0e10cSrcweir                             DffRecordHeader& rHeader,
1023cdf0e10cSrcweir                             void* pClientData,
1024cdf0e10cSrcweir                             DffObjData& rObjData );
1025cdf0e10cSrcweir     /** Processes an DFF object, reads properties from DFF stream. */
1026cdf0e10cSrcweir     virtual SdrObject*  ProcessObj(
1027cdf0e10cSrcweir                             SvStream& rDffStrm,
1028cdf0e10cSrcweir                             DffObjData& rDffObjData,
1029cdf0e10cSrcweir                             void* pClientData,
1030cdf0e10cSrcweir                             Rectangle& rTextRect,
1031cdf0e10cSrcweir                             SdrObject* pOldSdrObj = 0 );
1032cdf0e10cSrcweir     /** Returns the BLIP stream position, based on the passed DFF stream position. */
1033cdf0e10cSrcweir     virtual sal_uLong       Calc_nBLIPPos( sal_uLong nOrgVal, sal_uLong nStreamPos ) const;
1034cdf0e10cSrcweir 
1035cdf0e10cSrcweir     // virtual functions of SvxMSConvertOCXControls
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir     /** Inserts the passed control rxFComp into the form. Needs call to SetCurrentForm() before. */
1038cdf0e10cSrcweir     virtual sal_Bool    InsertControl(
1039cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference<
1040cdf0e10cSrcweir                                 ::com::sun::star::form::XFormComponent >& rxFormComp,
1041cdf0e10cSrcweir                             const ::com::sun::star::awt::Size& rSize,
1042cdf0e10cSrcweir                             ::com::sun::star::uno::Reference<
1043cdf0e10cSrcweir                                 ::com::sun::star::drawing::XShape >* pxShape,
1044cdf0e10cSrcweir                             sal_Bool bFloatingCtrl );
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir private:
1047cdf0e10cSrcweir     /** Data per registered drawing manager, will be stacked for recursive calls. */
1048cdf0e10cSrcweir     struct XclImpDffConvData
1049cdf0e10cSrcweir     {
1050cdf0e10cSrcweir         XclImpDrawing&      mrDrawing;          /// Current drawing container with all drawing objects.
1051cdf0e10cSrcweir         SdrModel&           mrSdrModel;         /// The SdrModel of the drawing manager.
1052cdf0e10cSrcweir         SdrPage&            mrSdrPage;          /// The SdrPage of the drawing manager.
1053cdf0e10cSrcweir         XclImpSolverContainer maSolverCont;     /// The solver container for connector rules.
1054cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
1055cdf0e10cSrcweir                             mxCtrlForm;         /// Controls form of current drawing page.
1056cdf0e10cSrcweir         sal_Int32           mnLastCtrlIndex;    /// Last insertion index of a form control (for macro events).
1057cdf0e10cSrcweir         bool                mbHasCtrlForm;      /// True = mxCtrlForm is initialized (but maybe still null).
1058cdf0e10cSrcweir 
1059cdf0e10cSrcweir         explicit            XclImpDffConvData( XclImpDrawing& rDrawing,
1060cdf0e10cSrcweir                                 SdrModel& rSdrModel, SdrPage& rSdrPage );
1061cdf0e10cSrcweir     };
1062cdf0e10cSrcweir 
1063cdf0e10cSrcweir     /** Returns the current drawing manager data struct from top of the stack. */
1064cdf0e10cSrcweir     XclImpDffConvData&      GetConvData();
1065cdf0e10cSrcweir     /** Returns the current drawing manager data struct from top of the stack. */
1066cdf0e10cSrcweir     const XclImpDffConvData& GetConvData() const;
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir     /** Reads contents of a hyperlink property and returns the extracted URL. */
1069cdf0e10cSrcweir     String              ReadHlinkProperty( SvStream& rDffStrm ) const;
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir     /** Processes a drawing container (all drawing data of a sheet). */
1072cdf0e10cSrcweir     void                ProcessDgContainer( SvStream& rDffStrm, const DffRecordHeader& rDgHeader );
1073cdf0e10cSrcweir     /** Processes the global shape group container (all shapes of a sheet). */
1074cdf0e10cSrcweir     void                ProcessShGrContainer( SvStream& rDffStrm, const DffRecordHeader& rShGrHeader );
1075cdf0e10cSrcweir     /** Processes the solver container (connectors of a sheet). */
1076cdf0e10cSrcweir     void                ProcessSolverContainer( SvStream& rDffStrm, const DffRecordHeader& rSolverHeader );
1077cdf0e10cSrcweir     /** Processes a shape or shape group container (one top-level shape). */
1078cdf0e10cSrcweir     void                ProcessShContainer( SvStream& rDffStrm, const DffRecordHeader& rShHeader );
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir     /** Inserts the passed SdrObject into the document. This function takes ownership of pSdrObj! */
1081cdf0e10cSrcweir     void                InsertSdrObject( SdrObjList& rObjList, const XclImpDrawObjBase& rDrawObj, SdrObject* pSdrObj );
1082cdf0e10cSrcweir     /** Initializes the mxCtrlForm referring to the standard controls form. */
1083cdf0e10cSrcweir     void                InitControlForm();
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir private:
1086cdf0e10cSrcweir     typedef ScfRef< ScfProgressBar >                ScfProgressBarRef;
1087cdf0e10cSrcweir     typedef ScfRef< XclImpDffConvData >             XclImpDffConvDataRef;
1088cdf0e10cSrcweir     typedef ::std::vector< XclImpDffConvDataRef >   XclImpDffConvDataStack;
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir     const ::rtl::OUString maStdFormName;    /// Standard name of control forms.
1091cdf0e10cSrcweir     SotStorageStreamRef mxCtlsStrm;         /// The 'Ctls' stream for OCX form controls.
1092cdf0e10cSrcweir     ScfProgressBarRef   mxProgress;         /// The progress bar used in ProcessObj().
1093cdf0e10cSrcweir     XclImpDffConvDataStack maDataStack;     /// Stack for registered drawing managers.
1094cdf0e10cSrcweir     sal_uInt32          mnOleImpFlags;      /// Application OLE import settings.
1095cdf0e10cSrcweir     sal_Int32           mnDefTextMargin;    /// Default margin in text boxes.
1096cdf0e10cSrcweir };
1097cdf0e10cSrcweir 
1098cdf0e10cSrcweir // Drawing manager ============================================================
1099cdf0e10cSrcweir 
1100cdf0e10cSrcweir /** Base class for a container for all objects on a drawing (spreadsheet or
1101cdf0e10cSrcweir     embedded chart object). */
1102cdf0e10cSrcweir class XclImpDrawing : protected XclImpRoot
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir public:
1105cdf0e10cSrcweir     explicit            XclImpDrawing( const XclImpRoot& rRoot, bool bOleObjects );
1106cdf0e10cSrcweir     virtual             ~XclImpDrawing();
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir     /** Reads and returns a bitmap from the IMGDATA record. */
1109cdf0e10cSrcweir     static Graphic      ReadImgData( const XclImpRoot& rRoot, XclImpStream& rStrm );
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir     /** Reads a plain OBJ record (without leading DFF data). */
1112cdf0e10cSrcweir     void                ReadObj( XclImpStream& rStrm );
1113cdf0e10cSrcweir     /** Reads the MSODRAWING or MSODRAWINGSELECTION record. */
1114cdf0e10cSrcweir     void                ReadMsoDrawing( XclImpStream& rStrm );
1115cdf0e10cSrcweir 
1116cdf0e10cSrcweir     /** Returns true, if the conversion of OLE objects is supported. */
SupportsOleObjects() const1117cdf0e10cSrcweir     inline bool         SupportsOleObjects() const { return mbOleObjs; }
1118cdf0e10cSrcweir     /** Finds the OBJ record data related to the DFF shape at the passed position. */
1119cdf0e10cSrcweir     XclImpDrawObjRef    FindDrawObj( const DffRecordHeader& rHeader ) const;
1120cdf0e10cSrcweir     /** Finds the OBJ record data specified by the passed object identifier. */
1121cdf0e10cSrcweir     XclImpDrawObjRef    FindDrawObj( sal_uInt16 nObjId ) const;
1122cdf0e10cSrcweir     /** Finds the textbox data related to the DFF shape at the passed position. */
1123cdf0e10cSrcweir     const XclImpObjTextData* FindTextData( const DffRecordHeader& rHeader ) const;
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir     /** Sets the object with the passed identification to be skipped on import. */
1126cdf0e10cSrcweir     void                SetSkipObj( sal_uInt16 nObjId );
1127cdf0e10cSrcweir     /** Returns the size of the progress bar shown while processing all objects. */
1128cdf0e10cSrcweir     sal_Size            GetProgressSize() const;
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir     /** Derived classes calculate the resulting rectangle of the passed anchor. */
1131cdf0e10cSrcweir     virtual Rectangle   CalcAnchorRect( const XclObjAnchor& rAnchor, bool bDffAnchor ) const = 0;
1132cdf0e10cSrcweir     /** Called whenever an object has been inserted into the draw page. */
1133cdf0e10cSrcweir     virtual void        OnObjectInserted( const XclImpDrawObjBase& rDrawObj ) = 0;
1134cdf0e10cSrcweir 
1135cdf0e10cSrcweir protected:
1136cdf0e10cSrcweir     /** Appends a new drawing object to the list of raw objects (without DFF data). */
1137cdf0e10cSrcweir     void                AppendRawObject( const XclImpDrawObjRef& rxDrawObj );
1138cdf0e10cSrcweir     /** Converts all objects and inserts them into the current drawing page. */
1139cdf0e10cSrcweir     void                ImplConvertObjects( XclImpDffConverter& rDffConv, SdrModel& rSdrModel, SdrPage& rSdrPage );
1140cdf0e10cSrcweir 
1141cdf0e10cSrcweir private:
1142cdf0e10cSrcweir     /** Reads and returns a bitmap from WMF/PICT format. */
1143cdf0e10cSrcweir     static void         ReadWmf( Graphic& rGraphic, const XclImpRoot& rRoot, XclImpStream& rStrm );
1144cdf0e10cSrcweir     /** Reads and returns a bitmap from BMP format. */
1145cdf0e10cSrcweir     static void         ReadBmp( Graphic& rGraphic, const XclImpRoot& rRoot, XclImpStream& rStrm );
1146cdf0e10cSrcweir 
1147cdf0e10cSrcweir     /** Reads contents of an DFF record and append data to internal DFF stream. */
1148cdf0e10cSrcweir     void                ReadDffRecord( XclImpStream& rStrm );
1149cdf0e10cSrcweir     /** Reads a BIFF8 OBJ record following an MSODRAWING record. */
1150cdf0e10cSrcweir     void                ReadObj8( XclImpStream& rStrm );
1151cdf0e10cSrcweir     /** Reads the TXO record and following CONTINUE records containing string and formatting. */
1152cdf0e10cSrcweir     void                ReadTxo( XclImpStream& rStrm );
1153cdf0e10cSrcweir 
1154cdf0e10cSrcweir private:
1155cdf0e10cSrcweir     typedef ::std::map< sal_Size, XclImpDrawObjRef >    XclImpObjMap;
1156cdf0e10cSrcweir     typedef ::std::map< sal_uInt16, XclImpDrawObjRef >  XclImpObjMapById;
1157cdf0e10cSrcweir     typedef ScfRef< XclImpObjTextData >                 XclImpObjTextRef;
1158cdf0e10cSrcweir     typedef ::std::map< sal_Size, XclImpObjTextRef >    XclImpObjTextMap;
1159cdf0e10cSrcweir 
1160cdf0e10cSrcweir     XclImpDrawObjVector maRawObjs;          /// BIFF5 objects without DFF data.
1161cdf0e10cSrcweir     SvMemoryStream      maDffStrm;          /// Copy of the DFF page stream in memory.
1162cdf0e10cSrcweir     XclImpObjMap        maObjMap;           /// Maps BIFF8 drawing objects to DFF stream position.
1163cdf0e10cSrcweir     XclImpObjMapById    maObjMapId;         /// Maps BIFF8 drawing objects to object ID.
1164cdf0e10cSrcweir     XclImpObjTextMap    maTextMap;          /// Maps BIFF8 TXO textbox data to DFF stream position.
1165cdf0e10cSrcweir     ScfUInt16Vec        maSkipObjs;         /// IDs of all objects to be skipped.
1166cdf0e10cSrcweir     bool                mbOleObjs;          /// True = draw model supports OLE objects.
1167cdf0e10cSrcweir };
1168cdf0e10cSrcweir 
1169cdf0e10cSrcweir // ----------------------------------------------------------------------------
1170cdf0e10cSrcweir 
1171cdf0e10cSrcweir /** Drawing manager of a single sheet. */
1172cdf0e10cSrcweir class XclImpSheetDrawing : public XclImpDrawing
1173cdf0e10cSrcweir {
1174cdf0e10cSrcweir public:
1175cdf0e10cSrcweir     explicit            XclImpSheetDrawing( const XclImpRoot& rRoot, SCTAB nScTab );
1176cdf0e10cSrcweir 
1177cdf0e10cSrcweir     /** Reads the NOTE record. */
1178cdf0e10cSrcweir     void                ReadNote( XclImpStream& rStrm );
1179cdf0e10cSrcweir     /** Inserts a new chart object and reads the chart substream (BOF/EOF block).
1180cdf0e10cSrcweir         @descr  Used to import chart sheets, which do not have a corresponding OBJ record. */
1181cdf0e10cSrcweir     void                ReadTabChart( XclImpStream& rStrm );
1182cdf0e10cSrcweir 
1183cdf0e10cSrcweir     /** Returns the total cell range covered by any shapes in the sheet. */
GetUsedArea() const1184cdf0e10cSrcweir     inline const ScRange& GetUsedArea() const { return maScUsedArea; }
1185cdf0e10cSrcweir     /** Converts all objects and inserts them into the sheet drawing page. */
1186cdf0e10cSrcweir     void                ConvertObjects( XclImpDffConverter& rDffConv );
1187cdf0e10cSrcweir 
1188cdf0e10cSrcweir     /** Calculate the resulting rectangle of the passed anchor. */
1189cdf0e10cSrcweir     virtual Rectangle   CalcAnchorRect( const XclObjAnchor& rAnchor, bool bDffAnchor ) const;
1190cdf0e10cSrcweir     /** On call, updates the used area of the sheet. */
1191cdf0e10cSrcweir     virtual void        OnObjectInserted( const XclImpDrawObjBase& rDrawObj );
1192cdf0e10cSrcweir 
1193cdf0e10cSrcweir private:
1194cdf0e10cSrcweir     /** Reads a BIFF3-BIFF5 NOTE record. */
1195cdf0e10cSrcweir     void                ReadNote3( XclImpStream& rStrm );
1196cdf0e10cSrcweir     /** Reads a BIFF8 NOTE record. */
1197cdf0e10cSrcweir     void                ReadNote8( XclImpStream& rStrm );
1198cdf0e10cSrcweir 
1199cdf0e10cSrcweir private:
1200cdf0e10cSrcweir     ScRange             maScUsedArea;       /// Sheet index and used area in this sheet.
1201cdf0e10cSrcweir };
1202cdf0e10cSrcweir 
1203cdf0e10cSrcweir // The object manager =========================================================
1204cdf0e10cSrcweir 
1205cdf0e10cSrcweir /** Stores all drawing and OLE objects and additional data related to these objects. */
1206cdf0e10cSrcweir class XclImpObjectManager : protected XclImpRoot
1207cdf0e10cSrcweir {
1208cdf0e10cSrcweir public:
1209cdf0e10cSrcweir     explicit            XclImpObjectManager( const XclImpRoot& rRoot );
1210cdf0e10cSrcweir     virtual             ~XclImpObjectManager();
1211cdf0e10cSrcweir 
1212cdf0e10cSrcweir     /** Reads the MSODRAWINGGROUP record. */
1213cdf0e10cSrcweir     void                ReadMsoDrawingGroup( XclImpStream& rStrm );
1214cdf0e10cSrcweir 
1215cdf0e10cSrcweir     /** Returns (initially creates) the drawing manager of the specified sheet. */
1216cdf0e10cSrcweir     XclImpSheetDrawing& GetSheetDrawing( SCTAB nScTab );
1217cdf0e10cSrcweir     /** Inserts all objects into the Calc document. */
1218cdf0e10cSrcweir     void                ConvertObjects();
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir     /** Returns the default name for the passed object. */
1221cdf0e10cSrcweir     String              GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
1222cdf0e10cSrcweir     /** Returns the used area in the sheet with the passed index. */
1223cdf0e10cSrcweir     ScRange             GetUsedArea( SCTAB nScTab ) const;
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir     // ------------------------------------------------------------------------
1226cdf0e10cSrcweir private:
1227cdf0e10cSrcweir     typedef ::std::map< sal_uInt16, String >            DefObjNameMap;
1228cdf0e10cSrcweir     typedef ScfRef< XclImpSheetDrawing >                XclImpSheetDrawingRef;
1229cdf0e10cSrcweir     typedef ::std::map< SCTAB, XclImpSheetDrawingRef >  XclImpSheetDrawingMap;
1230cdf0e10cSrcweir 
1231cdf0e10cSrcweir     DefObjNameMap       maDefObjNames;      /// Default base names for all object types.
1232cdf0e10cSrcweir     SvMemoryStream      maDggStrm;          /// Copy of global DFF data (DGG container) in memory.
1233cdf0e10cSrcweir     XclImpSheetDrawingMap maSheetDrawings;  /// Drawing managers of all sheets.
1234cdf0e10cSrcweir };
1235cdf0e10cSrcweir 
1236cdf0e10cSrcweir // DFF property set helper ====================================================
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir /** This class reads an DFF property set (msofbtOPT record).
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir     It can return separate property values or an item set which contains items
1241cdf0e10cSrcweir     translated from these properties.
1242cdf0e10cSrcweir  */
1243cdf0e10cSrcweir class XclImpDffPropSet : protected XclImpRoot
1244cdf0e10cSrcweir {
1245cdf0e10cSrcweir public:
1246cdf0e10cSrcweir     explicit            XclImpDffPropSet( const XclImpRoot& rRoot );
1247cdf0e10cSrcweir 
1248cdf0e10cSrcweir     /** Reads an DFF property set from the stream.
1249cdf0e10cSrcweir         @descr  The stream must point to the start of an DFF record containing properties. */
1250cdf0e10cSrcweir     void                Read( XclImpStream& rStrm );
1251cdf0e10cSrcweir 
1252cdf0e10cSrcweir     /** Returns the specified property or the default value, if not extant. */
1253cdf0e10cSrcweir     sal_uInt32          GetPropertyValue( sal_uInt16 nPropId, sal_uInt32 nDefault = 0 ) const;
1254cdf0e10cSrcweir 
1255cdf0e10cSrcweir     /** Translates the properties and fills the item set. */
1256cdf0e10cSrcweir     void                FillToItemSet( SfxItemSet& rItemSet ) const;
1257cdf0e10cSrcweir 
1258cdf0e10cSrcweir private:
1259cdf0e10cSrcweir     typedef ::std::auto_ptr< SvMemoryStream > SvMemoryStreamPtr;
1260cdf0e10cSrcweir 
1261cdf0e10cSrcweir     SvMemoryStream      maDummyStrm;    /// Dummy DGG stream for DFF manager.
1262cdf0e10cSrcweir     XclImpSimpleDffConverter maDffConv; /// DFF converter used to resolve palette colors.
1263cdf0e10cSrcweir     SvMemoryStreamPtr   mxMemStrm;      /// Helper stream.
1264cdf0e10cSrcweir };
1265cdf0e10cSrcweir 
1266cdf0e10cSrcweir XclImpStream& operator>>( XclImpStream& rStrm, XclImpDffPropSet& rPropSet );
1267cdf0e10cSrcweir 
1268cdf0e10cSrcweir // ============================================================================
1269cdf0e10cSrcweir 
1270cdf0e10cSrcweir #endif
1271cdf0e10cSrcweir 
1272