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 : class SvStream;
33 :
34 0 : class XclEscherExGlobal : public EscherExGlobal, protected XclExpRoot
35 : {
36 : public:
37 : explicit XclEscherExGlobal( const XclExpRoot& rRoot );
38 :
39 : private:
40 : /** Overloaded to create a new temporary file and return its stream. */
41 : virtual SvStream* ImplQueryPictureStream() SAL_OVERRIDE;
42 :
43 : private:
44 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
45 : ::std::auto_ptr< ::utl::TempFile > mxPicTempFile;
46 : ::std::auto_ptr< SvStream > mxPicStrm;
47 : SAL_WNODEPRECATED_DECLARATIONS_POP
48 : };
49 :
50 : class XclObj;
51 : class XclExpDffAnchorBase;
52 : class XclEscherHostAppData;
53 : class XclEscherClientData;
54 : class XclEscherClientTextbox;
55 : class XclExpOcxControlObj;
56 : class XclExpTbxControlObj;
57 : class XclExpShapeObj;
58 : class EscherExHostAppData;
59 : class ShapeInteractionHelper
60 : {
61 : public:
62 : static XclExpShapeObj* CreateShapeObj( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference<
63 : ::com::sun::star::drawing::XShape >& xShape );
64 : static void PopulateShapeInteractionInfo( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
65 : };
66 :
67 : class XclEscherEx : public EscherEx, protected XclExpRoot
68 : {
69 : public:
70 : explicit XclEscherEx(
71 : const XclExpRoot& rRoot,
72 : XclExpObjectManager& rObjMgr,
73 : SvStream& rStrm,
74 : const XclEscherEx* pParent = 0 );
75 : virtual ~XclEscherEx();
76 :
77 : /** Called by MSODRAWING record constructors to initialize the DFF stream
78 : fragment they will own. returns the DFF fragment identifier. */
79 : sal_uInt32 InitNextDffFragment();
80 : /** Called after some data has been written to the DFF stream, to update
81 : the end position of the DFF fragment owned by an MSODRAWING record. */
82 : void UpdateDffFragmentEnd();
83 :
84 : /** Returns the position of the specified DFF stream fragment. */
85 : sal_uInt32 GetDffFragmentPos( sal_uInt32 nFragmentKey );
86 : /** Returns the size of the specified DFF stream fragment. */
87 : sal_uInt32 GetDffFragmentSize( sal_uInt32 nFragmentKey );
88 : /** Returns true, if there is more data left in the DFF stream than owned
89 : by the last MSODRAWING record. */
90 : bool HasPendingDffData();
91 :
92 : /** Creates a new DFF client anchor object and calculates the anchor
93 : position of the passed object. Caller takes ownership! */
94 : XclExpDffAnchorBase* CreateDffAnchor( const SdrObject& rSdrObj ) const;
95 :
96 : virtual EscherExHostAppData* StartShape(
97 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape,
98 : const Rectangle* pChildAnchor ) SAL_OVERRIDE;
99 : virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID ) SAL_OVERRIDE;
100 : virtual EscherExHostAppData* EnterAdditionalTextGroup() SAL_OVERRIDE;
101 :
102 : /// Flush and merge PicStream into EscherStream
103 : void EndDocument();
104 : /** Creates an OCX form control OBJ record from the passed form control.
105 : @descr Writes the form control data to the 'Ctls' stream. */
106 : XclExpOcxControlObj* CreateOCXCtrlObj(
107 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape,
108 : const Rectangle* pChildAnchor );
109 :
110 : private:
111 : SotStorageStreamRef mxCtlsStrm; /// The 'Ctls' stream.
112 : /** Creates a TBX form control OBJ record from the passed form control. */
113 : XclExpTbxControlObj* CreateTBXCtrlObj(
114 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape,
115 : const Rectangle* pChildAnchor );
116 :
117 : private:
118 : /** Tries to get the name of a Basic macro from a control. */
119 : void ConvertTbxMacro(
120 : XclExpTbxControlObj& rTbxCtrlObj,
121 : ::com::sun::star::uno::Reference<
122 : ::com::sun::star::awt::XControlModel > xCtrlModel );
123 :
124 : void DeleteCurrAppData();
125 :
126 : private:
127 : XclExpObjectManager& mrObjMgr;
128 : std::stack< std::pair< XclObj*, XclEscherHostAppData* > > aStack;
129 : XclObj* pCurrXclObj;
130 : XclEscherHostAppData* pCurrAppData;
131 : XclEscherClientData* pTheClientData; // always the same
132 : XclEscherClientTextbox* pAdditionalText;
133 : sal_uInt16 nAdditionalText;
134 : sal_uInt32 mnNextKey;
135 : bool mbIsRootDff;
136 : };
137 :
138 : // --- class XclEscherHostAppData ------------------------------------
139 :
140 : class XclEscherHostAppData : public EscherExHostAppData
141 : {
142 : private:
143 : bool bStackedGroup;
144 :
145 : public:
146 0 : XclEscherHostAppData() : bStackedGroup( false )
147 0 : {}
148 0 : inline void SetStackedGroup( bool b ) { bStackedGroup = b; }
149 0 : inline bool IsStackedGroup() const { return bStackedGroup; }
150 : };
151 :
152 :
153 :
154 : // --- class XclEscherClientData -------------------------------------
155 :
156 0 : class XclEscherClientData : public EscherExClientRecord_Base
157 : {
158 : public:
159 0 : XclEscherClientData() {}
160 : virtual void WriteData( EscherEx& rEx ) const SAL_OVERRIDE;
161 : };
162 :
163 :
164 : // --- class XclEscherClientTextbox ----------------------------------
165 :
166 : class SdrTextObj;
167 :
168 0 : class XclEscherClientTextbox : public EscherExClientRecord_Base, protected XclExpRoot
169 : {
170 : private:
171 : const SdrTextObj& rTextObj;
172 : XclObj* pXclObj;
173 :
174 : public:
175 : XclEscherClientTextbox(
176 : const XclExpRoot& rRoot,
177 : const SdrTextObj& rObj,
178 : XclObj* pObj );
179 :
180 : //! ONLY for the AdditionalText mimic
181 0 : inline void SetXclObj( XclObj* p ) { pXclObj = p; }
182 :
183 : virtual void WriteData( EscherEx& rEx ) const SAL_OVERRIDE;
184 : };
185 :
186 : #endif // _XCL97ESC_HXX
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|