1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XCL97ESC_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XCL97ESC_HXX
25 #include <filter/msfilter/escherex.hxx>
26 #include "xlescher.hxx"
30 namespace utl
{ class TempFile
; }
34 class XclEscherExGlobal
: public EscherExGlobal
, protected XclExpRoot
37 explicit XclEscherExGlobal( const XclExpRoot
& rRoot
);
40 /** Override to create a new temporary file and return its stream. */
41 virtual SvStream
* ImplQueryPictureStream() SAL_OVERRIDE
;
44 ::std::unique_ptr
< ::utl::TempFile
> mxPicTempFile
;
45 ::std::unique_ptr
< SvStream
> mxPicStrm
;
49 class XclExpDffAnchorBase
;
50 class XclEscherHostAppData
;
51 class XclEscherClientData
;
52 class XclEscherClientTextbox
;
53 class XclExpOcxControlObj
;
54 class XclExpTbxControlObj
;
56 class EscherExHostAppData
;
57 class ShapeInteractionHelper
60 static XclExpShapeObj
* CreateShapeObj( XclExpObjectManager
& rObjMgr
, const ::com::sun::star::uno::Reference
<
61 ::com::sun::star::drawing::XShape
>& xShape
);
62 static void PopulateShapeInteractionInfo( XclExpObjectManager
& rObjMgr
, const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
, EscherExHostAppData
& rHostAppData
);
65 class XclEscherEx
: public EscherEx
, protected XclExpRoot
69 const XclExpRoot
& rRoot
,
70 XclExpObjectManager
& rObjMgr
,
72 const XclEscherEx
* pParent
= 0 );
73 virtual ~XclEscherEx();
75 /** Called by MSODRAWING record constructors to initialize the DFF stream
76 fragment they will own. returns the DFF fragment identifier. */
77 sal_uInt32
InitNextDffFragment();
78 /** Called after some data has been written to the DFF stream, to update
79 the end position of the DFF fragment owned by an MSODRAWING record. */
80 void UpdateDffFragmentEnd();
82 /** Returns the position of the specified DFF stream fragment. */
83 sal_uInt32
GetDffFragmentPos( sal_uInt32 nFragmentKey
);
84 /** Returns the size of the specified DFF stream fragment. */
85 sal_uInt32
GetDffFragmentSize( sal_uInt32 nFragmentKey
);
86 /** Returns true, if there is more data left in the DFF stream than owned
87 by the last MSODRAWING record. */
88 bool HasPendingDffData();
90 /** Creates a new DFF client anchor object and calculates the anchor
91 position of the passed object. Caller takes ownership! */
92 XclExpDffAnchorBase
* CreateDffAnchor( const SdrObject
& rSdrObj
) const;
94 virtual EscherExHostAppData
* StartShape(
95 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& rxShape
,
96 const Rectangle
* pChildAnchor
) SAL_OVERRIDE
;
97 virtual void EndShape( sal_uInt16 nShapeType
, sal_uInt32 nShapeID
) SAL_OVERRIDE
;
98 virtual EscherExHostAppData
* EnterAdditionalTextGroup() SAL_OVERRIDE
;
100 /// Flush and merge PicStream into EscherStream
102 /** Creates an OCX form control OBJ record from the passed form control.
103 @descr Writes the form control data to the 'Ctls' stream. */
104 XclExpOcxControlObj
* CreateOCXCtrlObj(
105 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> xShape
,
106 const Rectangle
* pChildAnchor
);
109 tools::SvRef
<SotStorageStream
> mxCtlsStrm
; /// The 'Ctls' stream.
110 /** Creates a TBX form control OBJ record from the passed form control. */
111 XclExpTbxControlObj
* CreateTBXCtrlObj(
112 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> xShape
,
113 const Rectangle
* pChildAnchor
);
116 /** Tries to get the name of a Basic macro from a control. */
117 void ConvertTbxMacro(
118 XclExpTbxControlObj
& rTbxCtrlObj
,
119 ::com::sun::star::uno::Reference
<
120 ::com::sun::star::awt::XControlModel
> xCtrlModel
);
122 void DeleteCurrAppData();
125 XclExpObjectManager
& mrObjMgr
;
126 std::stack
< std::pair
< XclObj
*, XclEscherHostAppData
* > > aStack
;
128 XclEscherHostAppData
* pCurrAppData
;
129 XclEscherClientData
* pTheClientData
; // always the same
130 XclEscherClientTextbox
* pAdditionalText
;
131 sal_uInt16 nAdditionalText
;
132 sal_uInt32 mnNextKey
;
136 // --- class XclEscherHostAppData ------------------------------------
138 class XclEscherHostAppData
: public EscherExHostAppData
144 XclEscherHostAppData() : bStackedGroup( false )
146 inline void SetStackedGroup( bool b
) { bStackedGroup
= b
; }
147 inline bool IsStackedGroup() const { return bStackedGroup
; }
150 // --- class XclEscherClientData -------------------------------------
152 class XclEscherClientData
: public EscherExClientRecord_Base
155 XclEscherClientData() {}
156 virtual void WriteData( EscherEx
& rEx
) const SAL_OVERRIDE
;
159 // --- class XclEscherClientTextbox ----------------------------------
163 class XclEscherClientTextbox
: public EscherExClientRecord_Base
, protected XclExpRoot
166 const SdrTextObj
& rTextObj
;
170 XclEscherClientTextbox(
171 const XclExpRoot
& rRoot
,
172 const SdrTextObj
& rObj
,
175 //! ONLY for the AdditionalText mimic
176 inline void SetXclObj( XclObj
* p
) { pXclObj
= p
; }
178 virtual void WriteData( EscherEx
& rEx
) const SAL_OVERRIDE
;
181 #endif // _XCL97ESC_HXX
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */