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 #pragma once
21 
22 #include <memory>
23 #include <stack>
25 #include "xeroot.hxx"
26 #include <unotools/tempfile.hxx>
27 
28 namespace com::sun::star::awt { class XControlModel; }
29 
30 class XclEscherExGlobal : public EscherExGlobal, protected XclExpRoot
31 {
32 public:
33  explicit XclEscherExGlobal( const XclExpRoot& rRoot );
34 
35 private:
37  virtual SvStream* ImplQueryPictureStream() override;
38 
39 private:
40  ::std::unique_ptr< ::utl::TempFile > mxPicTempFile;
41  ::std::unique_ptr< SvStream > mxPicStrm;
42 };
43 
44 class XclObj;
51 class XclExpShapeObj;
53 {
54 public:
55  static XclExpShapeObj* CreateShapeObj( XclExpObjectManager& rObjMgr, const css::uno::Reference<
56  css::drawing::XShape >& xShape, ScDocument* pDoc );
57  static void PopulateShapeInteractionInfo( const XclExpObjectManager& rObjMgr, const css::uno::Reference< css::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
58 };
59 
60 class XclEscherEx : public EscherEx, protected XclExpRoot
61 {
62 public:
63  explicit XclEscherEx(
64  const XclExpRoot& rRoot,
65  XclExpObjectManager& rObjMgr,
66  SvStream& rStrm,
67  const XclEscherEx* pParent = nullptr );
68  virtual ~XclEscherEx() override;
69 
72  sal_uInt32 InitNextDffFragment();
75  void UpdateDffFragmentEnd();
76 
78  sal_uInt32 GetDffFragmentPos( sal_uInt32 nFragmentKey );
80  sal_uInt32 GetDffFragmentSize( sal_uInt32 nFragmentKey );
83  bool HasPendingDffData();
84 
87  XclExpDffAnchorBase* CreateDffAnchor( const SdrObject& rSdrObj ) const;
88 
90  const css::uno::Reference< css::drawing::XShape>& rxShape,
91  const tools::Rectangle* pChildAnchor ) override;
92  virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID ) override;
94 
96  void EndDocument();
99  std::unique_ptr<XclExpOcxControlObj> CreateOCXCtrlObj(
100  css::uno::Reference< css::drawing::XShape > const & xShape,
101  const tools::Rectangle* pChildAnchor );
102 
103 private:
105 
106  std::unique_ptr<XclExpTbxControlObj> CreateTBXCtrlObj(
107  css::uno::Reference< css::drawing::XShape > const & xShape,
108  const tools::Rectangle* pChildAnchor );
109 
110 private:
112  void ConvertTbxMacro(
113  XclExpTbxControlObj& rTbxCtrlObj,
114  css::uno::Reference< css::awt::XControlModel > const & xCtrlModel );
115 
116  void DeleteCurrAppData();
117 
118 private:
120  std::stack< std::pair< XclObj*, std::unique_ptr<XclEscherHostAppData> > > aStack;
122  std::unique_ptr<XclEscherHostAppData> pCurrAppData;
123  std::unique_ptr<XclEscherClientData> pTheClientData; // always the same
125  sal_uInt16 nAdditionalText;
126  sal_uInt32 mnNextKey;
128 };
129 
130 // --- class XclEscherHostAppData ------------------------------------
131 
133 {
134 private:
136 
137 public:
138  XclEscherHostAppData() : bStackedGroup( false )
139  {}
140  void SetStackedGroup( bool b ) { bStackedGroup = b; }
141  bool IsStackedGroup() const { return bStackedGroup; }
142 };
143 
144 // --- class XclEscherClientData -------------------------------------
145 
147 {
148 public:
150  virtual void WriteData( EscherEx& rEx ) const override;
151 };
152 
153 // --- class XclEscherClientTextbox ----------------------------------
154 
155 class SdrTextObj;
156 
158 {
159 private:
162 
163 public:
165  const XclExpRoot& rRoot,
166  const SdrTextObj& rObj,
167  XclObj* pObj );
168 
170  void SetXclObj( XclObj* p ) { pXclObj = p; }
171 
172  virtual void WriteData( EscherEx& rEx ) const override;
173 };
174 
175 /* 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:123
::std::unique_ptr< SvStream > mxPicStrm
Definition: xcl97esc.hxx:41
sal_uInt32 mnNextKey
Definition: xcl97esc.hxx:126
std::stack< std::pair< XclObj *, std::unique_ptr< XclEscherHostAppData > > > aStack
Definition: xcl97esc.hxx:120
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:160
void SetStackedGroup(bool b)
Definition: xcl97esc.hxx:140
XclObj * pCurrXclObj
Definition: xcl97esc.hxx:121
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:112
XclEscherClientTextbox * pAdditionalText
Definition: xcl97esc.hxx:124
Represents an OBJ record for an OCX form control.
Definition: xeescher.hxx:225
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:122
sal_uInt16 nAdditionalText
Definition: xcl97esc.hxx:125
virtual ~XclEscherEx() override
Definition: xcl97esc.cxx:102
bool mbIsRootDff
Definition: xcl97esc.hxx:127
Base class for DFF client anchor atoms used in spreadsheets.
Definition: xeescher.hxx:41
XclExpObjectManager & mrObjMgr
Definition: xcl97esc.hxx:119
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:247
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:170
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:104
bool IsStackedGroup() const
Definition: xcl97esc.hxx:141
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:40