Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SC_XCL97ESC_HXX
21 : #define SC_XCL97ESC_HXX
22 :
23 : #include <memory>
24 : #include <stack>
25 : #include <filter/msfilter/escherex.hxx>
26 : #include "xlescher.hxx"
27 : #include "xeroot.hxx"
28 : #include <vector>
29 :
30 : namespace utl { class TempFile; }
31 :
32 : // ============================================================================
33 :
34 : class SvStream;
35 :
36 18 : class XclEscherExGlobal : public EscherExGlobal, protected XclExpRoot
37 : {
38 : public:
39 : explicit XclEscherExGlobal( const XclExpRoot& rRoot );
40 :
41 : private:
42 : /** Overloaded to create a new temporary file and return its stream. */
43 : virtual SvStream* ImplQueryPictureStream();
44 :
45 : private:
46 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
47 : ::std::auto_ptr< ::utl::TempFile > mxPicTempFile;
48 : ::std::auto_ptr< SvStream > mxPicStrm;
49 : SAL_WNODEPRECATED_DECLARATIONS_POP
50 : };
51 :
52 : // ============================================================================
53 :
54 : class XclObj;
55 : class XclExpDffAnchorBase;
56 : class XclEscherHostAppData;
57 : class XclEscherClientData;
58 : class XclEscherClientTextbox;
59 : class XclExpOcxControlObj;
60 : class XclExpTbxControlObj;
61 : class XclExpShapeObj;
62 : class EscherExHostAppData;
63 : class ShapeInteractionHelper
64 : {
65 : public:
66 : static XclExpShapeObj* CreateShapeObj( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference<
67 : ::com::sun::star::drawing::XShape >& xShape );
68 : static void PopulateShapeInteractionInfo( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
69 : };
70 :
71 : class XclEscherEx : public EscherEx, protected XclExpRoot
72 : {
73 : public:
74 : explicit XclEscherEx(
75 : const XclExpRoot& rRoot,
76 : XclExpObjectManager& rObjMgr,
77 : SvStream& rStrm,
78 : const XclEscherEx* pParent = 0 );
79 : virtual ~XclEscherEx();
80 :
81 : /** Called by MSODRAWING record constructors to initialize the DFF stream
82 : fragment they will own. returns the DFF fragment identifier. */
83 : sal_uInt32 InitNextDffFragment();
84 : /** Called after some data has been written to the DFF stream, to update
85 : the end position of the DFF fragment owned by an MSODRAWING record. */
86 : void UpdateDffFragmentEnd();
87 :
88 : /** Returns the position of the specified DFF stream fragment. */
89 : sal_uInt32 GetDffFragmentPos( sal_uInt32 nFragmentKey );
90 : /** Returns the size of the specified DFF stream fragment. */
91 : sal_uInt32 GetDffFragmentSize( sal_uInt32 nFragmentKey );
92 : /** Returns true, if there is more data left in the DFF stream than owned
93 : by the last MSODRAWING record. */
94 : bool HasPendingDffData();
95 :
96 : /** Creates a new DFF client anchor object and calculates the anchor
97 : position of the passed object. Caller takes ownership! */
98 : XclExpDffAnchorBase* CreateDffAnchor( const SdrObject& rSdrObj ) const;
99 :
100 : virtual EscherExHostAppData* StartShape(
101 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape,
102 : const Rectangle* pChildAnchor );
103 : virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
104 : virtual EscherExHostAppData* EnterAdditionalTextGroup();
105 :
106 : /// Flush and merge PicStream into EscherStream
107 : void EndDocument();
108 : /** Creates an OCX form control OBJ record from the passed form control.
109 : @descr Writes the form control data to the 'Ctls' stream. */
110 : XclExpOcxControlObj* CreateOCXCtrlObj(
111 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape,
112 : const Rectangle* pChildAnchor );
113 :
114 : private:
115 : SotStorageStreamRef mxCtlsStrm; /// The 'Ctls' stream.
116 : /** Creates a TBX form control OBJ record from the passed form control. */
117 : XclExpTbxControlObj* CreateTBXCtrlObj(
118 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape,
119 : const Rectangle* pChildAnchor );
120 :
121 : private:
122 : /** Tries to get the name of a Basic macro from a control. */
123 : void ConvertTbxMacro(
124 : XclExpTbxControlObj& rTbxCtrlObj,
125 : ::com::sun::star::uno::Reference<
126 : ::com::sun::star::awt::XControlModel > xCtrlModel );
127 :
128 : void DeleteCurrAppData();
129 :
130 : private:
131 : XclExpObjectManager& mrObjMgr;
132 : std::stack< std::pair< XclObj*, XclEscherHostAppData* > > aStack;
133 : XclObj* pCurrXclObj;
134 : XclEscherHostAppData* pCurrAppData;
135 : XclEscherClientData* pTheClientData; // always the same
136 : XclEscherClientTextbox* pAdditionalText;
137 : sal_uInt16 nAdditionalText;
138 : sal_uInt32 mnNextKey;
139 : bool mbIsRootDff;
140 : };
141 :
142 : // --- class XclEscherHostAppData ------------------------------------
143 :
144 : class XclEscherHostAppData : public EscherExHostAppData
145 : {
146 : private:
147 : sal_Bool bStackedGroup;
148 :
149 : public:
150 2 : XclEscherHostAppData() : bStackedGroup( false )
151 2 : {}
152 0 : inline void SetStackedGroup( sal_Bool b ) { bStackedGroup = b; }
153 0 : inline sal_Bool IsStackedGroup() const { return bStackedGroup; }
154 : };
155 :
156 :
157 :
158 : // ============================================================================
159 :
160 : // --- class XclEscherClientData -------------------------------------
161 :
162 18 : class XclEscherClientData : public EscherExClientRecord_Base
163 : {
164 : public:
165 9 : XclEscherClientData() {}
166 : virtual void WriteData( EscherEx& rEx ) const;
167 : };
168 :
169 :
170 : // --- class XclEscherClientTextbox ----------------------------------
171 :
172 : class SdrTextObj;
173 :
174 0 : class XclEscherClientTextbox : public EscherExClientRecord_Base, protected XclExpRoot
175 : {
176 : private:
177 : const SdrTextObj& rTextObj;
178 : XclObj* pXclObj;
179 :
180 : public:
181 : XclEscherClientTextbox(
182 : const XclExpRoot& rRoot,
183 : const SdrTextObj& rObj,
184 : XclObj* pObj );
185 :
186 : //! ONLY for the AdditionalText mimic
187 0 : inline void SetXclObj( XclObj* p ) { pXclObj = p; }
188 :
189 : virtual void WriteData( EscherEx& rEx ) const;
190 : };
191 :
192 :
193 :
194 : #endif // _XCL97ESC_HXX
195 :
196 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|