LibreOffice Module sc (master)  1
xcl97esc.hxx
Go to the documentation of this file.
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 INCLUDED_SC_SOURCE_FILTER_INC_XCL97ESC_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XCL97ESC_HXX
22 
23 #include <memory>
24 #include <stack>
26 #include "xeroot.hxx"
27 #include <unotools/tempfile.hxx>
28 
29 namespace com::sun::star::awt { class XControlModel; }
30 
31 class XclEscherExGlobal : public EscherExGlobal, protected XclExpRoot
32 {
33 public:
34  explicit XclEscherExGlobal( const XclExpRoot& rRoot );
35 
36 private:
38  virtual SvStream* ImplQueryPictureStream() override;
39 
40 private:
41  ::std::unique_ptr< ::utl::TempFile > mxPicTempFile;
42  ::std::unique_ptr< SvStream > mxPicStrm;
43 };
44 
45 class XclObj;
52 class XclExpShapeObj;
54 {
55 public:
56  static XclExpShapeObj* CreateShapeObj( XclExpObjectManager& rObjMgr, const css::uno::Reference<
57  css::drawing::XShape >& xShape, ScDocument* pDoc );
58  static void PopulateShapeInteractionInfo( const XclExpObjectManager& rObjMgr, const css::uno::Reference< css::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
59 };
60 
61 class XclEscherEx : public EscherEx, protected XclExpRoot
62 {
63 public:
64  explicit XclEscherEx(
65  const XclExpRoot& rRoot,
66  XclExpObjectManager& rObjMgr,
67  SvStream& rStrm,
68  const XclEscherEx* pParent = nullptr );
69  virtual ~XclEscherEx() override;
70 
73  sal_uInt32 InitNextDffFragment();
76  void UpdateDffFragmentEnd();
77 
79  sal_uInt32 GetDffFragmentPos( sal_uInt32 nFragmentKey );
81  sal_uInt32 GetDffFragmentSize( sal_uInt32 nFragmentKey );
84  bool HasPendingDffData();
85 
88  XclExpDffAnchorBase* CreateDffAnchor( const SdrObject& rSdrObj ) const;
89 
91  const css::uno::Reference< css::drawing::XShape>& rxShape,
92  const tools::Rectangle* pChildAnchor ) override;
93  virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID ) override;
95 
97  void EndDocument();
100  std::unique_ptr<XclExpOcxControlObj> CreateOCXCtrlObj(
101  css::uno::Reference< css::drawing::XShape > const & xShape,
102  const tools::Rectangle* pChildAnchor );
103 
104 private:
106 
107  std::unique_ptr<XclExpTbxControlObj> CreateTBXCtrlObj(
108  css::uno::Reference< css::drawing::XShape > const & xShape,
109  const tools::Rectangle* pChildAnchor );
110 
111 private:
113  void ConvertTbxMacro(
114  XclExpTbxControlObj& rTbxCtrlObj,
115  css::uno::Reference< css::awt::XControlModel > const & xCtrlModel );
116 
117  void DeleteCurrAppData();
118 
119 private:
121  std::stack< std::pair< XclObj*, std::unique_ptr<XclEscherHostAppData> > > aStack;
123  std::unique_ptr<XclEscherHostAppData> pCurrAppData;
124  std::unique_ptr<XclEscherClientData> pTheClientData; // always the same
126  sal_uInt16 nAdditionalText;
127  sal_uInt32 mnNextKey;
129 };
130 
131 // --- class XclEscherHostAppData ------------------------------------
132 
134 {
135 private:
137 
138 public:
139  XclEscherHostAppData() : bStackedGroup( false )
140  {}
141  void SetStackedGroup( bool b ) { bStackedGroup = b; }
142  bool IsStackedGroup() const { return bStackedGroup; }
143 };
144 
145 // --- class XclEscherClientData -------------------------------------
146 
148 {
149 public:
151  virtual void WriteData( EscherEx& rEx ) const override;
152 };
153 
154 // --- class XclEscherClientTextbox ----------------------------------
155 
156 class SdrTextObj;
157 
159 {
160 private:
163 
164 public:
166  const XclExpRoot& rRoot,
167  const SdrTextObj& rObj,
168  XclObj* pObj );
169 
171  void SetXclObj( XclObj* p ) { pXclObj = p; }
172 
173  virtual void WriteData( EscherEx& rEx ) const override;
174 };
175 
176 #endif // _XCL97ESC_HXX
177 
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void PopulateShapeInteractionInfo(const XclExpObjectManager &rObjMgr, const css::uno::Reference< css::drawing::XShape > &xShape, EscherExHostAppData &rHostAppData)
Definition: xcl97esc.cxx:544
std::unique_ptr< XclEscherClientData > pTheClientData
Definition: xcl97esc.hxx:124
::std::unique_ptr< SvStream > mxPicStrm
Definition: xcl97esc.hxx:42
sal_uInt32 mnNextKey
Definition: xcl97esc.hxx:127
std::stack< std::pair< XclObj *, std::unique_ptr< XclEscherHostAppData > > > aStack
Definition: xcl97esc.hxx:121
XclExpDffAnchorBase * CreateDffAnchor(const SdrObject &rSdrObj) const
Creates a new DFF client anchor object and calculates the anchor position of the passed object...
Definition: xcl97esc.cxx:155
const SdrTextObj & rTextObj
Definition: xcl97esc.hxx:161
void SetStackedGroup(bool b)
Definition: xcl97esc.hxx:141
XclObj * pCurrXclObj
Definition: xcl97esc.hxx:122
virtual EscherExHostAppData * StartShape(const css::uno::Reference< css::drawing::XShape > &rxShape, const tools::Rectangle *pChildAnchor) override
Definition: xcl97esc.cxx:182
XclEscherEx(const XclExpRoot &rRoot, XclExpObjectManager &rObjMgr, SvStream &rStrm, const XclEscherEx *pParent=nullptr)
Definition: xcl97esc.cxx:88
Access to global data from other classes.
Definition: xeroot.hxx:113
XclEscherClientTextbox * pAdditionalText
Definition: xcl97esc.hxx:125
Represents an OBJ record for an OCX form control.
Definition: xeescher.hxx:226
sal_uInt32 GetDffFragmentSize(sal_uInt32 nFragmentKey)
Returns the size of the specified DFF stream fragment.
Definition: xcl97esc.cxx:141
XclEscherExGlobal(const XclExpRoot &rRoot)
Definition: xcl97esc.cxx:70
std::unique_ptr< XclExpTbxControlObj > CreateTBXCtrlObj(css::uno::Reference< css::drawing::XShape > const &xShape, const tools::Rectangle *pChildAnchor)
The 'Ctls' stream.
Definition: xcl97esc.cxx:432
void UpdateDffFragmentEnd()
Called after some data has been written to the DFF stream, to update the end position of the DFF frag...
Definition: xcl97esc.cxx:128
std::unique_ptr< XclEscherHostAppData > pCurrAppData
Definition: xcl97esc.hxx:123
sal_uInt16 nAdditionalText
Definition: xcl97esc.hxx:126
virtual ~XclEscherEx() override
Definition: xcl97esc.cxx:102
bool mbIsRootDff
Definition: xcl97esc.hxx:128
Base class for DFF client anchor atoms used in spreadsheets.
Definition: xeescher.hxx:42
XclExpObjectManager & mrObjMgr
Definition: xcl97esc.hxx:120
std::unique_ptr< XclExpOcxControlObj > CreateOCXCtrlObj(css::uno::Reference< css::drawing::XShape > const &xShape, const tools::Rectangle *pChildAnchor)
Creates an OCX form control OBJ record from the passed form control.
Definition: xcl97esc.cxx:402
void EndDocument()
Flush and merge PicStream into EscherStream.
Definition: xcl97esc.cxx:393
Represents an OBJ record for a TBX form control.
Definition: xeescher.hxx:248
virtual void EndShape(sal_uInt16 nShapeType, sal_uInt32 nShapeID) override
Definition: xcl97esc.cxx:339
void ConvertTbxMacro(XclExpTbxControlObj &rTbxCtrlObj, css::uno::Reference< css::awt::XControlModel > const &xCtrlModel)
Tries to get the name of a Basic macro from a control.
Definition: xcl97esc.cxx:447
void DeleteCurrAppData()
Definition: xcl97esc.cxx:502
void SetXclObj(XclObj *p)
ONLY for the AdditionalText mimic.
Definition: xcl97esc.hxx:171
virtual EscherExHostAppData * EnterAdditionalTextGroup() override
Definition: xcl97esc.cxx:385
sal_uInt32 GetDffFragmentPos(sal_uInt32 nFragmentKey)
Returns the position of the specified DFF stream fragment.
Definition: xcl97esc.cxx:134
virtual void WriteData(EscherEx &rEx) const override
Definition: xcl97esc.cxx:516
XclEscherClientTextbox(const XclExpRoot &rRoot, const SdrTextObj &rObj, XclObj *pObj)
Definition: xcl97esc.cxx:523
virtual void WriteData(EscherEx &rEx) const override
Definition: xcl97esc.cxx:532
static XclExpShapeObj * CreateShapeObj(XclExpObjectManager &rObjMgr, const css::uno::Reference< css::drawing::XShape > &xShape, ScDocument *pDoc)
Definition: xcl97esc.cxx:538
bool HasPendingDffData()
Returns true, if there is more data left in the DFF stream than owned by the last MSODRAWING record...
Definition: xcl97esc.cxx:148
tools::SvRef< SotStorageStream > mxCtlsStrm
Definition: xcl97esc.hxx:105
bool IsStackedGroup() const
Definition: xcl97esc.hxx:142
void SvStream & rStrm
virtual SvStream * ImplQueryPictureStream() override
Override to create a new temporary file and return its stream.
Definition: xcl97esc.cxx:76
sal_uInt32 InitNextDffFragment()
Called by MSODRAWING record constructors to initialize the DFF stream fragment they will own...
Definition: xcl97esc.cxx:109
::std::unique_ptr< ::utl::TempFile > mxPicTempFile
Definition: xcl97esc.hxx:41