LibreOffice Module sc (master)  1
xcl97esc.cxx
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 #include <memory>
21 #include <com/sun/star/awt/XControlModel.hpp>
22 #include <com/sun/star/embed/XClassifiedObject.hpp>
23 #include <com/sun/star/embed/XEmbeddedObject.hpp>
24 #include <com/sun/star/form/XFormsSupplier.hpp>
25 #include <com/sun/star/script/XEventAttacherManager.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 
28 #include <svx/svdpage.hxx>
29 #include <svx/svdotext.hxx>
30 #include <svx/svdobj.hxx>
31 #include <svx/svdoole2.hxx>
32 #include <svx/unoapi.hxx>
33 #include <unotools/tempfile.hxx>
35 #include <svx/sdasitm.hxx>
36 #include <sfx2/docfile.hxx>
37 #include <sal/log.hxx>
38 
39 #include <sot/exchange.hxx>
40 #include <sot/storage.hxx>
41 #include <xeescher.hxx>
42 
43 #include <drwlayer.hxx>
44 #include <xecontent.hxx>
45 #include <editeng/flditem.hxx>
46 #include <userdat.hxx>
47 #include <xcl97rec.hxx>
48 #include <xcl97esc.hxx>
49 #include <unotools/streamwrap.hxx>
50 #include <oox/ole/olehelper.hxx>
51 #include <sfx2/objsh.hxx>
52 
53 using ::com::sun::star::uno::Any;
54 using ::com::sun::star::uno::Exception;
55 using ::com::sun::star::uno::Reference;
56 using ::com::sun::star::uno::Sequence;
57 using ::com::sun::star::uno::UNO_QUERY;
58 using ::com::sun::star::uno::UNO_QUERY_THROW;
59 using ::com::sun::star::container::XIndexAccess;
60 using ::com::sun::star::embed::XClassifiedObject;
61 using ::com::sun::star::drawing::XShape;
62 using ::com::sun::star::awt::XControlModel;
63 using ::com::sun::star::beans::XPropertySet;
64 using ::com::sun::star::uno::Any;
65 using ::com::sun::star::form::XFormsSupplier;
66 using ::com::sun::star::io::XOutputStream;
67 using ::com::sun::star::script::ScriptEventDescriptor;
68 using ::com::sun::star::script::XEventAttacherManager;
69 
71  XclExpRoot( rRoot )
72 {
73  SetBaseURI( GetMedium().GetBaseURL( true ) );
74 }
75 
77 {
78  mxPicTempFile.reset( new ::utl::TempFile );
79  if( mxPicTempFile->IsValid() )
80  {
81  mxPicTempFile->EnableKillingFile();
82  mxPicStrm = ::utl::UcbStreamHelper::CreateStream( mxPicTempFile->GetURL(), StreamMode::STD_READWRITE );
83  mxPicStrm->SetEndian( SvStreamEndian::LITTLE );
84  }
85  return mxPicStrm.get();
86 }
87 
88 XclEscherEx::XclEscherEx( const XclExpRoot& rRoot, XclExpObjectManager& rObjMgr, SvStream& rStrm, const XclEscherEx* pParent ) :
89  EscherEx( pParent ? pParent->mxGlobal : std::make_shared<XclEscherExGlobal>( rRoot ), &rStrm ),
90  XclExpRoot( rRoot ),
91  mrObjMgr( rObjMgr ),
92  pCurrXclObj( nullptr ),
93  pTheClientData( new XclEscherClientData ),
94  pAdditionalText( nullptr ),
95  nAdditionalText( 0 ),
96  mnNextKey( 0 ),
97  mbIsRootDff( pParent == nullptr )
98 {
100 }
101 
103 {
104  OSL_ENSURE( aStack.empty(), "~XclEscherEx: stack not empty" );
106  pTheClientData.reset();
107 }
108 
110 {
111  /* Current value of mnNextKey will be used by caller to refer to the
112  starting point of the DFF fragment. The key exists already in the
113  PersistTable (has been inserted by c'tor of previous call of
114  InitNextDffFragment(), has been updated by UpdateDffFragmentEnd(). */
115  sal_uInt32 nPersistKey = mnNextKey;
116 
117  /* Prepare the next key that is used by caller as end point of the DFF
118  fragment. Will be updated by caller when writing to the DFF stream,
119  using the UpdateDffFragmentEnd() function. This is needed to find DFF
120  data written by the SVX base class implementation without interaction,
121  e.g. the solver container that will be written after the last shape. */
122  ++mnNextKey;
124 
125  return nPersistKey;
126 }
127 
129 {
130  // update existing fragment key with new stream position
132 }
133 
134 sal_uInt32 XclEscherEx::GetDffFragmentPos( sal_uInt32 nFragmentKey )
135 {
136  /* TODO: this function is non-const because PersistTable::PtGetOffsetByID()
137  is non-const due to tools/List usage. */
138  return GetPersistOffset( nFragmentKey );
139 }
140 
141 sal_uInt32 XclEscherEx::GetDffFragmentSize( sal_uInt32 nFragmentKey )
142 {
143  /* TODO: this function is non-const because PersistTable::PtGetOffsetByID()
144  is non-const due to tools/List usage. */
145  return GetDffFragmentPos( nFragmentKey + 1 ) - GetDffFragmentPos( nFragmentKey );
146 }
147 
149 {
150  /* TODO: this function is non-const because PersistTable::PtGetOffsetByID()
151  is non-const due to tools/List usage. */
153 }
154 
156 {
157  // the object manager creates the correct anchor type according to context
159  // pass the drawing object, that will calculate the anchor position
160  pAnchor->SetSdrObject( rSdrObj );
161  return pAnchor;
162 }
163 
164 namespace {
165 
166 bool lcl_IsFontwork( const SdrObject* pObj )
167 {
168  bool bIsFontwork = false;
169  if( pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE )
170  {
171  const OUString aTextPath = "TextPath";
172  const SdrCustomShapeGeometryItem& rGeometryItem =
173  pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
174  if( const Any* pAny = rGeometryItem.GetPropertyValueByName( aTextPath, aTextPath ) )
175  *pAny >>= bIsFontwork;
176  }
177  return bIsFontwork;
178 }
179 
180 } // namespace
181 
182 EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape, const tools::Rectangle* pChildAnchor )
183 {
184  if ( nAdditionalText )
185  nAdditionalText++;
186  bool bInGroup = ( pCurrXclObj != nullptr );
187  if ( bInGroup )
188  { // stacked recursive group object
189  if ( !pCurrAppData->IsStackedGroup() )
190  {
191  pCurrAppData->SetStackedGroup( true );
193  }
194  }
195  aStack.push( std::make_pair( pCurrXclObj, std::move(pCurrAppData) ) );
196  pCurrAppData.reset( new XclEscherHostAppData );
197  SdrObject* pObj = GetSdrObjectFromXShape( rxShape );
198  //added for exporting OCX control
199  sal_Int16 nMsCtlType = 0;
200  if ( !pObj )
201  pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDoc() ); // just what is it?!?
202  else
203  {
204  pCurrXclObj = nullptr;
205  sal_uInt16 nObjType = pObj->GetObjIdentifier();
206 
207  if( nObjType == OBJ_OLE2 )
208  {
209  // no OLE objects in embedded drawings (chart shapes)
210  if( mbIsRootDff )
211  {
213  Reference < XClassifiedObject > xObj( static_cast<SdrOle2Obj*>(pObj)->GetObjRef() );
214  if ( xObj.is() )
215  {
216  SvGlobalName aObjClsId( xObj->getClassID() );
217  if ( SotExchange::IsChart( aObjClsId ) )
218  { // yes, it's a chart diagram
219  mrObjMgr.AddObj( std::make_unique<XclExpChartObj>( mrObjMgr, rxShape, pChildAnchor, &GetDoc() ) );
220  pCurrXclObj = nullptr; // no metafile or whatsoever
221  }
222  else // metafile and OLE object
223  pCurrXclObj = new XclObjOle( mrObjMgr, *pObj );
224  }
225  else // just a metafile
226  pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDoc() );
227  }
228  else
229  pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDoc() );
230  }
231  else if( nObjType == OBJ_UNO )
232  {
233  //added for exporting OCX control
234  Reference< XPropertySet > xPropSet( rxShape, UNO_QUERY );
235  Any aAny;
236  try
237  {
238  aAny = xPropSet->getPropertyValue("ControlTypeinMSO");
239  aAny >>= nMsCtlType;
240  }
241  catch(const Exception&)
242  {
243  SAL_WARN("sc", "XclEscherEx::StartShape, this control can't get the property ControlTypeinMSO!");
244  }
245  if( nMsCtlType == 2 ) //OCX Form Control
246  pCurrXclObj = CreateOCXCtrlObj( rxShape, pChildAnchor ).release();
247  else //TBX Form Control
248  pCurrXclObj = CreateTBXCtrlObj( rxShape, pChildAnchor ).release();
249  if( !pCurrXclObj )
250  pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDoc() ); // just a metafile
251  }
252  else if( !ScDrawLayer::IsNoteCaption( pObj ) )
253  {
254  // ignore permanent note shapes
255  // #i12190# do not ignore callouts (do not filter by object type ID)
258  }
259  }
260  if ( pCurrXclObj )
261  {
262  if ( !mrObjMgr.AddObj( std::unique_ptr<XclObj>(pCurrXclObj) ) )
263  { // maximum count reached, object got deleted
264  pCurrXclObj = nullptr;
265  }
266  else
267  {
268  pCurrAppData->SetClientData( pTheClientData.get() );
269  if ( nAdditionalText == 0 )
270  {
271  if ( pObj )
272  {
273  if ( !bInGroup )
274  {
275  /* Create a dummy anchor carrying the flags. Real
276  coordinates are calculated later in virtual call of
277  WriteData(EscherEx&,const Rectangle&). */
279  pAnchor->SetFlags( *pObj );
280  pCurrAppData->SetClientAnchor( pAnchor );
281  }
282  const SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pObj );
283  if( pTextObj && !lcl_IsFontwork( pTextObj ) && (pObj->GetObjIdentifier() != OBJ_CAPTION) )
284  {
285  const OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
286  if( pParaObj )
287  pCurrAppData->SetClientTextbox(
288  new XclEscherClientTextbox( GetRoot(), *pTextObj, pCurrXclObj ) );
289  }
290  }
291  else
292  {
293  if ( !bInGroup )
294  pCurrAppData->SetClientAnchor( mrObjMgr.CreateDffAnchor() );
295  }
296  }
297  else if ( nAdditionalText == 3 )
298  {
299  if ( pAdditionalText )
300  {
302  pCurrAppData->SetClientTextbox( pAdditionalText );
303  }
304  }
305  }
306  }
307  if(pObj)
308  {
309  //add for exporting OCX control
310  //for OCX control import from MS office file,we need keep the id value as MS office file.
311  //GetOldRoot().pObjRecs->Add( pCurrXclObj ) statement has generated the id value as obj id rule;
312  //but we trick it here.
313  sal_uInt16 nObjType = pObj->GetObjIdentifier();
314  if( nObjType == OBJ_UNO && pCurrXclObj )
315  {
316  Reference< XPropertySet > xPropSet( rxShape, UNO_QUERY );
317  Any aAny;
318  try
319  {
320  aAny = xPropSet->getPropertyValue("ObjIDinMSO");
321  }
322  catch(const Exception&)
323  {
324  SAL_WARN("sc", "XclEscherEx::StartShape, this control can't get the property ObjIDinMSO!");
325  }
326  sal_uInt16 nObjIDinMSO = 0xFFFF;
327  aAny >>= nObjIDinMSO;
328  if( nObjIDinMSO != 0xFFFF && nMsCtlType == 2) //OCX
329  {
330  pCurrXclObj->SetId(nObjIDinMSO);
331  }
332  }
333  }
334  if ( !pCurrXclObj )
335  pCurrAppData->SetDontWriteShape( true );
336  return pCurrAppData.get();
337 }
338 
339 void XclEscherEx::EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID )
340 {
341  // own escher data created? -> never delete such objects
342  bool bOwnEscher = pCurrXclObj && pCurrXclObj->IsOwnEscher();
343 
344  // post process the current object - not for objects with own escher data
345  if( pCurrXclObj && !bOwnEscher )
346  {
347  // escher data of last shape not written? -> delete it from object list
348  if( nShapeID == 0 )
349  {
350  std::unique_ptr<XclObj> pLastObj = mrObjMgr.RemoveLastObj();
351  OSL_ENSURE( pLastObj.get() == pCurrXclObj, "XclEscherEx::EndShape - wrong object" );
352  pCurrXclObj = nullptr;
353  }
354 
355  if( pCurrXclObj )
356  {
357  // set shape type
358  if ( pCurrAppData->IsStackedGroup() )
360  else
361  {
362  pCurrXclObj->SetEscherShapeType( nShapeType );
364  }
365  }
366  }
367 
368  // get next object from stack
370  if (aStack.empty())
371  {
372  pCurrXclObj = nullptr;
373  pCurrAppData = nullptr;
374  }
375  else
376  {
377  pCurrXclObj = aStack.top().first;
378  pCurrAppData = std::move(aStack.top().second);
379  aStack.pop();
380  }
381  if( nAdditionalText == 3 )
382  nAdditionalText = 0;
383 }
384 
386 {
387  nAdditionalText = 1;
388  pAdditionalText = static_cast<XclEscherClientTextbox*>( pCurrAppData->GetClientTextbox() );
389  pCurrAppData->SetClientTextbox( nullptr );
390  return pCurrAppData.get();
391 }
392 
394 {
395  if( mbIsRootDff )
396  Flush( static_cast< XclEscherExGlobal& >( *mxGlobal ).GetPictureStream() );
397 
398  // seek back DFF stream to prepare saving the MSODRAWING[GROUP] records
399  mpOutStrm->Seek( 0 );
400 }
401 
402 std::unique_ptr<XclExpOcxControlObj> XclEscherEx::CreateOCXCtrlObj( Reference< XShape > const & xShape, const tools::Rectangle* pChildAnchor )
403 {
404  ::std::unique_ptr< XclExpOcxControlObj > xOcxCtrl;
405 
406  Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( xShape );
407  if( xCtrlModel.is() )
408  {
409  // output stream
410  if( !mxCtlsStrm.is() )
412  if( mxCtlsStrm.is() )
413  {
414  OUString aClassName;
415  sal_uInt32 nStrmStart = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() );
416 
417  // writes from xCtrlModel into mxCtlsStrm, raw class name returned in aClassName
418  Reference< XOutputStream > xOut( new utl::OSeekableOutputStreamWrapper( *mxCtlsStrm ) );
419  Reference< css::frame::XModel > xModel( GetDocShell() ? GetDocShell()->GetModel() : nullptr );
420  if( xModel.is() && xOut.is() && oox::ole::MSConvertOCXControls::WriteOCXExcelKludgeStream( xModel, xOut, xCtrlModel, xShape->getSize(), aClassName ) )
421  {
422  sal_uInt32 nStrmSize = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() - nStrmStart );
423  // adjust the class name to "Forms.***.1"
424  aClassName = "Forms." + aClassName + ".1";
425  xOcxCtrl.reset( new XclExpOcxControlObj( mrObjMgr, xShape, pChildAnchor, aClassName, nStrmStart, nStrmSize ) );
426  }
427  }
428  }
429  return xOcxCtrl;
430 }
431 
432 std::unique_ptr<XclExpTbxControlObj> XclEscherEx::CreateTBXCtrlObj( Reference< XShape > const & xShape, const tools::Rectangle* pChildAnchor )
433 {
434  ::std::unique_ptr< XclExpTbxControlObj > xTbxCtrl( new XclExpTbxControlObj( mrObjMgr, xShape, pChildAnchor ) );
435  if( xTbxCtrl->GetObjType() == EXC_OBJTYPE_UNKNOWN )
436  xTbxCtrl.reset();
437 
438  if (xTbxCtrl)
439  {
440  // find attached macro
441  Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( xShape );
442  ConvertTbxMacro( *xTbxCtrl, xCtrlModel );
443  }
444  return xTbxCtrl;
445 }
446 
447 void XclEscherEx::ConvertTbxMacro( XclExpTbxControlObj& rTbxCtrlObj, Reference< XControlModel > const & xCtrlModel )
448 {
449  SdrPage* pSdrPage = GetSdrPage( GetCurrScTab() );
450  if( !(xCtrlModel.is() && GetDocShell() && pSdrPage) )
451  return;
452 
453  try
454  {
455  Reference< XFormsSupplier > xFormsSupplier( pSdrPage->getUnoPage(), UNO_QUERY_THROW );
456  Reference< XIndexAccess > xFormsIA( xFormsSupplier->getForms(), UNO_QUERY_THROW );
457 
458  // 1) try to find the index of the processed control in the form
459 
460  Reference< XIndexAccess > xFormIA; // needed in step 2) below
461  sal_Int32 nFoundIdx = -1;
462 
463  // search all existing forms in the draw page
464  for( sal_Int32 nFormIdx = 0, nFormCount = xFormsIA->getCount();
465  (nFoundIdx < 0) && (nFormIdx < nFormCount); ++nFormIdx )
466  {
467  // get the XIndexAccess interface of the form with index nFormIdx
468  if( xFormIA.set( xFormsIA->getByIndex( nFormIdx ), UNO_QUERY ) )
469  {
470  // search all elements (controls) of the current form by index
471  for( sal_Int32 nCtrlIdx = 0, nCtrlCount = xFormIA->getCount();
472  (nFoundIdx < 0) && (nCtrlIdx < nCtrlCount); ++nCtrlIdx )
473  {
474  // compare implementation pointers of the control models
475  Reference< XControlModel > xCurrModel( xFormIA->getByIndex( nCtrlIdx ), UNO_QUERY );
476  if( xCtrlModel.get() == xCurrModel.get() )
477  nFoundIdx = nCtrlIdx;
478  }
479  }
480  }
481 
482  // 2) try to find an attached macro
483 
484  if( xFormIA.is() && (nFoundIdx >= 0) )
485  {
486  Reference< XEventAttacherManager > xEventMgr( xFormIA, UNO_QUERY_THROW );
487  // loop over all events attached to the found control
488  const Sequence< ScriptEventDescriptor > aEventSeq( xEventMgr->getScriptEvents( nFoundIdx ) );
489  for( const auto& rEvent : aEventSeq )
490  {
491  // try to set the event data at the Excel control object, returns true on success
492  if (rTbxCtrlObj.SetMacroLink( rEvent ))
493  break;
494  }
495  }
496  }
497  catch( Exception& )
498  {
499  }
500 }
501 
503 {
504  if ( pCurrAppData )
505  {
506  delete pCurrAppData->GetClientAnchor();
507 // delete pCurrAppData->GetClientData();
508  delete pCurrAppData->GetClientTextbox();
509  delete pCurrAppData->GetInteractionInfo();
510  pCurrAppData.reset();
511  }
512 }
513 
514 // --- class XclEscherClientData -------------------------------------
515 
517 { // actual data is in the following OBJ record
518  rEx.AddAtom( 0, ESCHER_ClientData );
519 }
520 
521 // --- class XclEscherClientTextbox -------------------------------------
522 
524  const SdrTextObj& rObj, XclObj* pObj )
525  :
526  XclExpRoot( rRoot ),
527  rTextObj( rObj ),
528  pXclObj( pObj )
529 {
530 }
531 
533 {
535 }
536 
538 ShapeInteractionHelper::CreateShapeObj( XclExpObjectManager& rObjMgr, const Reference< XShape >& xShape, ScDocument* pDoc )
539 {
540  return new XclExpShapeObj( rObjMgr, xShape, pDoc );
541 }
542 
543 void
544 ShapeInteractionHelper::PopulateShapeInteractionInfo( const XclExpObjectManager& rObjMgr, const Reference< XShape >& xShape, EscherExHostAppData& rHostAppData )
545 {
546  try
547  {
548  SvMemoryStream* pMemStrm = nullptr;
549  OUString sHyperLink;
550  OUString sMacro;
551  if ( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( ::GetSdrObjectFromXShape( xShape ) ) )
552  {
553  sHyperLink = pInfo->GetHlink();
554  sMacro = pInfo->GetMacro();
555  }
556  if ( !sHyperLink.isEmpty() )
557  {
558  pMemStrm = new SvMemoryStream();
559  XclExpStream tmpStream( *pMemStrm, rObjMgr.GetRoot() );
560  ScAddress dummyAddress;
561  SvxURLField aUrlField;
562  aUrlField.SetURL( sHyperLink );
563  XclExpHyperlink hExpHlink( rObjMgr.GetRoot(), aUrlField, dummyAddress );
564  hExpHlink.WriteEmbeddedData( tmpStream );
565  }
566  if ( !sHyperLink.isEmpty() || !sMacro.isEmpty() )
567  rHostAppData.SetInteractionInfo( new InteractionInfo( pMemStrm ) );
568  }
569  catch( Exception& )
570  {
571  }
572 }
573 
574 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void InsertPersistOffset(sal_uInt32 nKey, sal_uInt32 nOffset)
bool is() const
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
bool IsOwnEscher() const
If set to true, this object has created its own escher data.
Definition: xcl97rec.hxx:163
::std::unique_ptr< SvStream > mxPicStrm
Definition: xcl97esc.hxx:42
sal_uInt32 mnNextKey
Definition: xcl97esc.hxx:127
const sal_uInt16 EXC_OBJTYPE_UNKNOWN
Definition: xlescher.hxx:72
This class is used to export Excel record streams.
Definition: xestream.hxx:71
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
void SetEscherShapeTypeGroup()
Definition: xcl97rec.hxx:152
sal_uLong GetStreamPos() const
SvStream * mpOutStrm
const SdrTextObj & rTextObj
Definition: xcl97esc.hxx:161
std::unique_ptr< XclObj > RemoveLastObj()
Definition: xeescher.cxx:1848
static ScMacroInfo * GetMacroInfo(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2516
void SetText(const XclExpRoot &rRoot, const SdrTextObj &rObj)
actually writes ESCHER_ClientTextbox
Definition: xcl97rec.cxx:447
sal_uInt64 Seek(sal_uInt64 nPos)
std::shared_ptr< T > make_shared(Args &&...args)
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:276
virtual SdrObjKind GetObjIdentifier() const
void SetSdrObject(const SdrObject &rSdrObj)
Sets the anchor position and flags according to the passed SdrObject.
Definition: xeescher.cxx:261
XclObj * pCurrXclObj
Definition: xcl97esc.hxx:122
bool SetMacroLink(const css::script::ScriptEventDescriptor &rEvent)
Sets the name of a macro attached to this control.
Definition: xeescher.cxx:923
static sal_uInt16 IsChart(const SvGlobalName &rName)
void SetFlags(const SdrObject &rSdrObj)
Sets the flags according to the passed SdrObject.
Definition: xeescher.cxx:256
virtual EscherExHostAppData * StartShape(const css::uno::Reference< css::drawing::XShape > &rxShape, const tools::Rectangle *pChildAnchor) override
Definition: xcl97esc.cxx:182
void SetEscherShapeType(sal_uInt16 nType)
Definition: xcl97rec.cxx:418
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
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
void Flush(SvStream *pPicStreamMergeBSE=nullptr)
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
#define EXC_STREAM_CTLS
Definition: xlconst.hxx:85
sal_uInt16 nAdditionalText
Definition: xcl97esc.hxx:126
sal_uInt32 GetPersistOffset(sal_uInt32 nKey)
void SetBaseURI(const OUString &rBaseURI)
virtual ~XclEscherEx() override
Definition: xcl97esc.cxx:102
SVXCORE_DLLPUBLIC SdrObject * GetSdrObjectFromXShape(const css::uno::Reference< css::drawing::XShape > &xShape)
bool mbIsRootDff
Definition: xcl97esc.hxx:128
Base class for DFF client anchor atoms used in spreadsheets.
Definition: xeescher.hxx:42
void ReplacePersistOffset(sal_uInt32 nKey, sal_uInt32 nOffset)
XclExpObjectManager & mrObjMgr
Definition: xcl97esc.hxx:120
static bool WriteOCXExcelKludgeStream(const css::uno::Reference< css::frame::XModel > &rxModel, const css::uno::Reference< css::io::XOutputStream > &xOutStrm, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size &rSize, OUString &rName)
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
OBJ_CAPTION
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
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:119
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
Definition: xlroot.hxx:161
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
void SetId(sal_uInt16 nId)
Definition: xcl97rec.hxx:133
virtual void WriteData(EscherEx &rEx) const override
Definition: xcl97esc.cxx:516
void AddAtom(sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion=0, int nRecInstance=0)
virtual OutlinerParaObject * GetOutlinerParaObject() const override
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
XclEscherClientTextbox(const XclExpRoot &rRoot, const SdrTextObj &rObj, XclObj *pObj)
Definition: xcl97esc.cxx:523
virtual XclExpDffAnchorBase * CreateDffAnchor() const
Creates a new DFF client anchor object.
Definition: xeescher.cxx:1789
virtual void WriteData(EscherEx &rEx) const override
Definition: xcl97esc.cxx:532
sal_uInt64 Tell() const
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
OBJ_CUSTOMSHAPE
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
void SetInteractionInfo(InteractionInfo *p)
static bool IsNoteCaption(SdrObject *pObj)
Returns true, if the passed object is the caption of a cell note.
Definition: drwlayer.cxx:2504
#define SAL_WARN(area, stream)
Reference< XModel > xModel
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
Definition: xlroot.cxx:281
tools::SvRef< SotStorageStream > mxCtlsStrm
Definition: xcl97esc.hxx:105
OBJ_UNO
void SetURL(const OUString &rURL)
tools::SvRef< SotStorageStream > OpenStream(tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName) const
Tries to open a new stream in the specified storage for reading or writing.
Definition: xlroot.cxx:264
OBJ_OLE2
virtual SvStream * ImplQueryPictureStream() override
Override to create a new temporary file and return its stream.
Definition: xcl97esc.cxx:76
SfxMedium & GetMedium() const
Returns the medium to import from.
Definition: xlroot.hxx:169
sal_uInt16 AddObj(std::unique_ptr< XclObj > pObjRec)
Definition: xeescher.cxx:1843
SdrPage * GetSdrPage(SCTAB nScTab) const
Returns the drawing layer page of the passed sheet, if present.
Definition: xlroot.cxx:307
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
#define ESCHER_ClientData
static css::uno::Reference< css::awt::XControlModel > GetControlModel(css::uno::Reference< css::drawing::XShape > const &xShape)
Returns the API control model from the passed API shape object.
Definition: xlescher.cxx:292