LibreOffice Module sc (master)  1
xcl97rec.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 <svx/sdtaitm.hxx>
21 #include <svx/svdotext.hxx>
22 #include <editeng/editobj.hxx>
23 #include <svx/svdoole2.hxx>
24 #include <sot/storage.hxx>
25 #include <svl/itemset.hxx>
26 #include <svx/svdocapt.hxx>
27 #include <svx/unoapi.hxx>
29 #include <tools/urlobj.hxx>
30 
31 #include <rtl/math.hxx>
32 #include <rtl/uuid.h>
33 #include <sal/log.hxx>
34 #include <drwlayer.hxx>
35 
36 #include <root.hxx>
37 #include <xcl97rec.hxx>
38 #include <xcl97esc.hxx>
39 #include <xeescher.hxx>
40 #include <xehelper.hxx>
41 #include <xelink.hxx>
42 #include <xlcontent.hxx>
43 
44 #include <unotools/fltrcfg.hxx>
45 #include <editeng/adjustitem.hxx>
46 #include <editeng/eeitem.hxx>
48 
50 
51 #include <stdio.h>
52 
53 #include <document.hxx>
54 #include <rangelst.hxx>
55 #include <docoptio.hxx>
56 #include <tabprotection.hxx>
57 
58 #include <com/sun/star/embed/Aspects.hpp>
59 #include <com/sun/star/chart/XChartDocument.hpp>
60 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
61 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
62 #include <com/sun/star/chart2/XChartDocument.hpp>
63 
64 #include <sax/fastattribs.hxx>
65 #include <oox/token/tokens.hxx>
66 #include <oox/token/namespaces.hxx>
68 #include <oox/export/shapes.hxx>
69 #include <oox/export/utils.hxx>
70 #include <oox/export/vmlexport.hxx>
71 #include <detfunc.hxx>
72 
73 #include <memory>
74 
75 using namespace ::com::sun::star;
76 using ::com::sun::star::uno::Reference;
77 using ::com::sun::star::uno::UNO_QUERY;
78 using ::com::sun::star::beans::XPropertySet;
79 using ::com::sun::star::drawing::XShape;
80 using ::oox::drawingml::ShapeExport;
81 using ::oox::vml::VMLExport;
82 using namespace oox;
83 
86 
88  XclExpRoot( rRoot ),
89  mnScTab( rRoot.GetCurrScTab() ),
90  mrEscherEx( rEscherEx )
91 {
92  pMsodrawingPerSheet.reset( new XclExpMsoDrawing( rEscherEx ) );
93  // open the DGCONTAINER and the patriarch group shape
95  tools::Rectangle aRect( 0, 0, 0, 0 );
96  mrEscherEx.EnterGroup( &aRect );
98 }
99 
101 {
102  maObjs.clear();
103  pMsodrawingPerSheet.reset();
104  pSolverContainer.reset();
105 }
106 
107 sal_uInt16 XclExpObjList::Add( std::unique_ptr<XclObj> pObj )
108 {
109  OSL_ENSURE( maObjs.size() < 0xFFFF, "XclExpObjList::Add: too much for Xcl" );
110 
111  size_t nSize = maObjs.size();
112 
113  if ( nSize < 0xFFFF )
114  {
115  pObj->SetId( nSize+1 );
116  pObj->SetTab( mnScTab );
117  maObjs.push_back(std::move(pObj));
118  ++nSize;
119  }
120  else
121  {
122  nSize = 0;
123  }
124 
125  return nSize;
126 }
127 
128 std::unique_ptr<XclObj> XclExpObjList::pop_back ()
129 {
130  auto ret = std::move(maObjs.back());
131  maObjs.pop_back();
132  return ret;
133 }
134 
136 {
137  // Is there still something in the stream? -> The solver container
140 
141  // close the DGCONTAINER created by XclExpObjList ctor MSODRAWING
143 }
144 
146 {
148  pMsodrawingPerSheet->Save( rStrm );
149 
150  for ( const auto& rxObj : maObjs )
151  rxObj->Save( rStrm );
152 
153  if( pSolverContainer )
154  pSolverContainer->Save( rStrm );
155 }
156 
157 namespace {
158 
159 bool IsFormControlObject( const XclObj *rObj )
160 {
161  switch( rObj->GetObjType() )
162  {
164  return true;
165  default:
166  return false;
167  }
168 }
169 
170 bool IsVmlObject( const XclObj *rObj )
171 {
172  switch( rObj->GetObjType() )
173  {
174  case EXC_OBJTYPE_NOTE:
175  return true;
176  default:
177  return false;
178  }
179 }
180 
181 sal_Int32 GetVmlObjectCount( XclExpObjList& rList )
182 {
183  return static_cast<sal_Int32>(std::count_if(rList.begin(), rList.end(),
184  [](const std::unique_ptr<XclObj>& rxObj) { return IsVmlObject( rxObj.get() ); }));
185 }
186 
187 bool IsValidObject( const XclObj& rObj )
188 {
189  if (rObj.GetObjType() == EXC_OBJTYPE_CHART)
190  {
191  // Chart object. Make sure it's a valid chart object. We skip
192  // invalid chart objects from exporting to prevent Excel from
193  // complaining on load.
194 
195  const XclExpChartObj& rChartObj = static_cast<const XclExpChartObj&>(rObj);
196  uno::Reference<chart2::XChartDocument> xChartDoc(rChartObj.GetChartDoc(), uno::UNO_QUERY);
197  if (!xChartDoc.is())
198  return false;
199 
200  uno::Reference<chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram();
201  if (!xDiagram.is())
202  return false;
203 
204  uno::Reference<chart2::XCoordinateSystemContainer> xCooSysContainer(xDiagram, uno::UNO_QUERY);
205  if (!xCooSysContainer.is())
206  return false;
207 
208  const uno::Sequence<uno::Reference<chart2::XCoordinateSystem>> xCooSysSeq = xCooSysContainer->getCoordinateSystems();
209  for (const auto& rCooSys : xCooSysSeq)
210  {
211  Reference<chart2::XChartTypeContainer> xChartTypeCont(rCooSys, uno::UNO_QUERY);
212  if (!xChartTypeCont.is())
213  return false;
214 
215  uno::Sequence<uno::Reference<chart2::XChartType>> xChartTypeSeq = xChartTypeCont->getChartTypes();
216  if (!xChartTypeSeq.hasElements())
217  // No chart type. Not good.
218  return false;
219  }
220  }
221 
222  return true;
223 }
224 
225 void SaveDrawingMLObjects( XclExpObjList& rList, XclExpXmlStream& rStrm )
226 {
227  std::vector<XclObj*> aList;
228  aList.reserve(rList.size());
229  for (const auto& rxObj : rList)
230  {
231  if (IsVmlObject(rxObj.get()) || !IsValidObject(*rxObj))
232  continue;
233 
234  aList.push_back(rxObj.get());
235  }
236 
237  if (aList.empty())
238  return;
239 
240  sal_Int32 nDrawing = XclExpObjList::getNewDrawingUniqueId();
241  OUString sId;
243  XclXmlUtils::GetStreamName( "xl/", "drawings/drawing", nDrawing ),
244  XclXmlUtils::GetStreamName( "../", "drawings/drawing", nDrawing ),
245  rStrm.GetCurrentStream()->getOutputStream(),
246  "application/vnd.openxmlformats-officedocument.drawing+xml",
247  oox::getRelationship(Relationship::DRAWING),
248  &sId );
249 
250  rStrm.GetCurrentStream()->singleElement(XML_drawing, FSNS(XML_r, XML_id), sId.toUtf8());
251 
252  rStrm.PushStream( pDrawing );
253  pDrawing->startElement( FSNS( XML_xdr, XML_wsDr ),
254  FSNS(XML_xmlns, XML_xdr), rStrm.getNamespaceURL(OOX_NS(dmlSpreadDr)).toUtf8(),
255  FSNS(XML_xmlns, XML_a), rStrm.getNamespaceURL(OOX_NS(dml)).toUtf8(),
256  FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8() );
257 
258  sal_Int32 nShapeId = 1000; // unique id of the shape inside one worksheet (not the whole document)
259  for (const auto& rpObj : aList)
260  {
261  // validate shapeId
262  if ( IsFormControlObject( rpObj ) )
263  {
264  XclExpTbxControlObj* pXclExpTbxControlObj = dynamic_cast<XclExpTbxControlObj*>(rpObj);
265  if (pXclExpTbxControlObj)
266  {
267  pXclExpTbxControlObj->setShapeId(++nShapeId);
268  }
269  }
270 
271  rpObj->SaveXml(rStrm);
272  }
273 
274  pDrawing->endElement( FSNS( XML_xdr, XML_wsDr ) );
275 
276  rStrm.PopStream();
277 }
278 
279 void SaveFormControlObjects(XclExpObjList& rList, XclExpXmlStream& rStrm)
280 {
281  bool hasControls = false;
282  for (const auto& rxObj : rList)
283  {
284  if (IsFormControlObject(rxObj.get()))
285  {
286  hasControls = true;
287  break;
288  }
289  }
290 
291  if (!hasControls)
292  {
293  return;
294  }
295 
296  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
297 
298  rWorksheet->startElement(FSNS(XML_mc, XML_AlternateContent),
299  FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)).toUtf8());
300  rWorksheet->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, "x14");
301  rWorksheet->startElement(XML_controls);
302 
303  for (const auto& rxObj : rList)
304  {
305  if (IsFormControlObject(rxObj.get()))
306  {
307  XclExpTbxControlObj* pXclExpTbxControlObj = dynamic_cast<XclExpTbxControlObj*>(rxObj.get());
308  if (pXclExpTbxControlObj)
309  {
310  const OUString aIdFormControlPr = pXclExpTbxControlObj->SaveControlPropertiesXml(rStrm);
311  pXclExpTbxControlObj->SaveSheetXml(rStrm, aIdFormControlPr);
312  }
313  }
314  }
315 
316  rWorksheet->endElement(XML_controls);
317  rWorksheet->endElement(FSNS(XML_mc, XML_Choice));
318  rWorksheet->endElement(FSNS(XML_mc, XML_AlternateContent));
319 }
320 
321 void SaveVmlObjects( XclExpObjList& rList, XclExpXmlStream& rStrm, sal_Int32& nVmlCount )
322 {
323  if( GetVmlObjectCount( rList ) == 0 )
324  return;
325 
326  sal_Int32 nDrawing = ++nVmlCount;
327  OUString sId;
329  XclXmlUtils::GetStreamName( "xl/", "drawings/vmlDrawing", nDrawing ),
330  XclXmlUtils::GetStreamName( "../", "drawings/vmlDrawing", nDrawing ),
331  rStrm.GetCurrentStream()->getOutputStream(),
332  "application/vnd.openxmlformats-officedocument.vmlDrawing",
333  oox::getRelationship(Relationship::VMLDRAWING),
334  &sId );
335 
336  rStrm.GetCurrentStream()->singleElement(XML_legacyDrawing, FSNS(XML_r, XML_id), sId.toUtf8());
337 
338  rStrm.PushStream( pVmlDrawing );
339  pVmlDrawing->startElement( XML_xml,
340  FSNS(XML_xmlns, XML_v), rStrm.getNamespaceURL(OOX_NS(vml)).toUtf8(),
341  FSNS(XML_xmlns, XML_o), rStrm.getNamespaceURL(OOX_NS(vmlOffice)).toUtf8(),
342  FSNS(XML_xmlns, XML_x), rStrm.getNamespaceURL(OOX_NS(vmlExcel)).toUtf8(),
343  FSNS(XML_xmlns, XML_w10), rStrm.getNamespaceURL(OOX_NS(vmlWord)).toUtf8() );
344 
345  for ( const auto& rxObj : rList )
346  {
347  if( !IsVmlObject( rxObj.get() ) )
348  continue;
349  rxObj->SaveXml( rStrm );
350  }
351 
352  pVmlDrawing->endElement( XML_xml );
353 
354  rStrm.PopStream();
355 }
356 
357 }
358 
360 {
361  if( pSolverContainer )
362  pSolverContainer->SaveXml( rStrm );
363 
364  if( maObjs.empty())
365  return;
366 
367  SaveDrawingMLObjects( *this, rStrm );
368  SaveVmlObjects( *this, rStrm, mnVmlCount );
369  SaveFormControlObjects( *this, rStrm );
370 }
371 
373 {
374  mnDrawingMLCount = 0;
375  mnVmlCount = 0;
376 }
377 
378 // --- class XclObj --------------------------------------------------
379 
380 XclObj::XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher ) :
381  XclExpRecord( EXC_ID_OBJ, 26 ),
382  mrEscherEx( rObjMgr.GetEscherEx() ),
383  mnObjType( nObjType ),
384  nObjId(0),
385  nGrbit( 0x6011 ), // AutoLine, AutoFill, Printable, Locked
386  mnScTab(0),
387  bFirstOnSheet( !rObjMgr.HasObj() ),
388  mbOwnEscher( bOwnEscher )
389 {
391  if ( bFirstOnSheet )
393  else
395 }
396 
398 {
399  if ( !bFirstOnSheet )
400  delete pMsodrawing;
401  pClientTextbox.reset();
402  pTxo.reset();
403 }
404 
405 void XclObj::ImplWriteAnchor( const SdrObject* pSdrObj, const tools::Rectangle* pChildAnchor )
406 {
407  if( pChildAnchor )
408  {
409  mrEscherEx.AddChildAnchor( *pChildAnchor );
410  }
411  else if( pSdrObj )
412  {
413  std::unique_ptr< XclExpDffAnchorBase > xDffAnchor( mrEscherEx.CreateDffAnchor( *pSdrObj ) );
414  xDffAnchor->WriteDffData( mrEscherEx );
415  }
416 }
417 
419 {
420 //ToDo: what about the other defined or... types?
421  switch ( nType )
422  {
423  case ESCHER_ShpInst_Line :
425  break;
429  break;
432  break;
433  case ESCHER_ShpInst_Arc :
435  break;
438  break;
441  break;
442  default:
444  }
445 }
446 
447 void XclObj::SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj )
448 {
449  OSL_ENSURE( !pClientTextbox, "XclObj::SetText: already set" );
450  if ( !pClientTextbox )
451  {
454  mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record
456  pTxo.reset( new XclTxo( rRoot, rObj ) );
457  }
458 }
459 
461 {
462  OSL_ENSURE( mnObjType != EXC_OBJTYPE_UNKNOWN, "XclObj::WriteBody - unknown type" );
463 
464  // create a substream to be able to create subrecords
465  SvMemoryStream aMemStrm;
466  std::unique_ptr< XclExpStream > pXclStrm( new XclExpStream( aMemStrm, rStrm.GetRoot() ) );
467 
468  // write the ftCmo subrecord
469  pXclStrm->StartRecord( EXC_ID_OBJCMO, 18 );
470  *pXclStrm << mnObjType << nObjId << nGrbit;
471  pXclStrm->WriteZeroBytes( 12 );
472  pXclStrm->EndRecord();
473 
474  // write other subrecords
475  WriteSubRecs( *pXclStrm );
476 
477  // write the ftEnd subrecord
478  pXclStrm->StartRecord( EXC_ID_OBJEND, 0 );
479  pXclStrm->EndRecord();
480 
481  // copy the data to the OBJ record
482  pXclStrm.reset();
483  aMemStrm.Seek( 0 );
484  rStrm.CopyFromStream( aMemStrm );
485 }
486 
488 {
489  // MSODRAWING record (msofbtSpContainer)
490  if ( !bFirstOnSheet )
491  pMsodrawing->Save( rStrm );
492 
493  // OBJ
494  XclExpRecord::Save( rStrm );
495 
496  // second MSODRAWING record and TXO and CONTINUE records
497  SaveTextRecs( rStrm );
498 }
499 
501 {
502  if( mnObjType != EXC_OBJTYPE_NOTE )
503  return;
504 
505  // FtNts subrecord
506  AddRecSize( 26 );
507  // ft, cb
508  rStrm << EXC_ID_OBJNTS << sal_uInt16(0x0016);
509  sal_uInt8 aGUID[16];
510  rtl_createUuid( aGUID, nullptr, false );
511  // guid
512  rStrm.SetSliceSize( 16 );
513  for( int i = 0; i < 16; i++ )
514  rStrm << aGUID[i];
515  rStrm.SetSliceSize( 0 );
516  // fSharedNote
517  rStrm << sal_uInt16(0);
518  // unused
519  rStrm.WriteZeroBytes( 4 );
520 }
521 
523 {
524  // MSODRAWING record (msofbtClientTextbox)
525  if ( pClientTextbox )
526  pClientTextbox->Save( rStrm );
527  // TXO and CONTINUE records
528  if ( pTxo )
529  pTxo->Save( rStrm );
530 }
531 
532 // --- class XclObjComment ------------------------------------------
533 
534 // tdf#118662 static helper to allow single function access as friend in SdrCaptionObj
535 void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj* pSdrCaptionObj, bool bValue)
536 {
537  if(nullptr != pSdrCaptionObj)
538  {
539  pSdrCaptionObj->setSuppressGetBitmap(bValue);
540  }
541 }
542 
543 XclObjComment::XclObjComment( XclExpObjectManager& rObjMgr, const tools::Rectangle& rRect, const EditTextObject& rEditObj, SdrCaptionObj* pCaption, bool bVisible, const ScAddress& rAddress, const tools::Rectangle &rFrom, const tools::Rectangle &rTo ) :
544  XclObj( rObjMgr, EXC_OBJTYPE_NOTE, true )
545  , maScPos( rAddress )
546  , mpCaption( pCaption )
547  , mbVisible( bVisible )
548  , maFrom ( rFrom )
549  , maTo ( rTo )
550 {
551  // tdf#118662 due to no longer cloning the SdrCaptionObj an old 'hack' using the
552  // fact that no Graphics gets created when a SdrObject is not inserted in a SdrPage
553  // does not work anymore. In SvxShape::GetBitmap that info was used, and here the
554  // SdrCaptionObj was cloned for the only reason to have one not added to a SdrPage.
555  // To emulate old behaviour, use a boolean flag at the SdrCaptionObj.
557 
558  ProcessEscherObj( rObjMgr.GetRoot(), rRect, pCaption, bVisible);
559  // TXO
560  pTxo .reset(new XclTxo( rObjMgr.GetRoot(), rEditObj, pCaption ));
561 }
562 
563 static void lcl_FillProps( EscherPropertyContainer& rPropOpt, SdrObject* pCaption, bool bVisible )
564 {
565  if( pCaption )
566  {
567  Reference< XShape > aXShape = GetXShapeForSdrObject( pCaption );
568  Reference< XPropertySet > aXPropSet( aXShape, UNO_QUERY );
569  if( aXPropSet.is() )
570  {
571  rPropOpt.CreateFillProperties( aXPropSet, true);
572 
573  rPropOpt.AddOpt( ESCHER_Prop_lTxid, 0 ); // undocumented
574  rPropOpt.AddOpt( 0x0158, 0x00000000 ); // undocumented
575 
576  sal_uInt32 nValue = 0;
577  if( !rPropOpt.GetOpt( ESCHER_Prop_FitTextToShape, nValue ) )
578  rPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 ); // bool field
579 
580  // Maybe the colour is the same as the 'ToolTip' System colour, but the tooltip
581  // colour shouldn't have influence on the fill colour of the exported shape
582  if( !rPropOpt.GetOpt( ESCHER_Prop_fillColor, nValue ) )
583  rPropOpt.AddOpt( ESCHER_Prop_fillColor, 0x08000050 );
584  if( !rPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nValue ) )
585  rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x08000050 );
586  if( !rPropOpt.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) )
587  rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00110010 ); // bool field
588  if( !rPropOpt.GetOpt( ESCHER_Prop_shadowColor, nValue ) )
589  rPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x00000000 );
590  if( !rPropOpt.GetOpt( ESCHER_Prop_fshadowObscured, nValue ) ) // bool field
591  rPropOpt.AddOpt( ESCHER_Prop_fshadowObscured, 0x00030003 ); // bool field
592  }
593  }
594 
595  sal_uInt32 nFlags = 0x000A0000;
596  ::set_flag( nFlags, sal_uInt32(2), !bVisible );
597  rPropOpt.AddOpt( ESCHER_Prop_fPrint, nFlags ); // bool field
598 }
599 
600 void XclObjComment::ProcessEscherObj( const XclExpRoot& rRoot, const tools::Rectangle& rRect, SdrObject* pCaption, const bool bVisible )
601 {
602  EscherPropertyContainer aPropOpt;
603 
604  lcl_FillProps( aPropOpt, pCaption, bVisible );
605 
606  nGrbit = 0; // all off: AutoLine, AutoFill, Printable, Locked
608  mrEscherEx.AddShape( ESCHER_ShpInst_TextBox, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty );
609  aPropOpt.Commit( mrEscherEx.GetStream() );
610 
611  XclExpDffNoteAnchor( rRoot, rRect ).WriteDffData( mrEscherEx );
612 
613  mrEscherEx.AddAtom( 0, ESCHER_ClientData ); // OBJ record
615 
619  mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record
621  mrEscherEx.CloseContainer(); // ESCHER_SpContainer
622 }
623 
625 {
626  // tdf#118662 reset flag
628 }
629 
631 {
632  // content of this record
633  XclObj::Save( rStrm );
634 }
635 
636 namespace {
637 
638 class VmlCommentExporter : public VMLExport
639 {
640  ScAddress maScPos;
641  SdrCaptionObj* mpCaption;
642  bool mbVisible;
645 
646 public:
647  VmlCommentExporter ( const sax_fastparser::FSHelperPtr& p, const ScAddress& aScPos, SdrCaptionObj* pCaption, bool bVisible, const tools::Rectangle &aFrom, const tools::Rectangle &aTo );
648 protected:
649  virtual void Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rRect ) override;
650  using VMLExport::StartShape;
651  virtual sal_Int32 StartShape() override;
652  using VMLExport::EndShape;
653  virtual void EndShape( sal_Int32 nShapeElement ) override;
654 };
655 
656 }
657 
658 VmlCommentExporter::VmlCommentExporter( const sax_fastparser::FSHelperPtr& p, const ScAddress& aScPos, SdrCaptionObj* pCaption,
659  bool bVisible, const tools::Rectangle &aFrom, const tools::Rectangle &aTo )
660  : VMLExport( p )
661  , maScPos( aScPos )
662  , mpCaption( pCaption )
663  , mbVisible( bVisible )
664  , maFrom ( aFrom )
665  , maTo ( aTo )
666 {
667 }
668 
669 void VmlCommentExporter::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rRect )
670 {
671  lcl_FillProps( rProps, mpCaption, mbVisible );
672  rProps.AddOpt( ESCHER_Prop_fHidden, sal_uInt32(mbVisible) ); // bool field
673 
674  // shadow property value for comment ( set in lcl_FillProps [*] ) has been
675  // overwritten by new value ( 0x20000 ) in the generic part of the export
676  // ( see EscherPropertyContainer::CreateShadowProperties )
677  // Safer option here is to just force the needed value here for oox vml
678  // export alone ( and avoid potential problems with binary export )
679  // #TODO investigate value of ESCHER_Prop_fshadowObscured generally
680  // in binary export ( if indeed this value is good for binary export )
681  // we can change the heuristics and/or initialisation path and get
682  // rid of line below.
683  // [*] lcl_FillProps seems to be called twice when exporting to xlsx
684  // once from XclObjComment::ProcessEscherObj #TODO look into that also
685  rProps.AddOpt( ESCHER_Prop_fshadowObscured, 0x00030003 ); // force value for comments
686 
687  VMLExport::Commit( rProps, rRect );
688 }
689 
690 sal_Int32 VmlCommentExporter::StartShape()
691 {
692  AddShapeAttribute( XML_type, "#_x0000_t202" );
693 
694  sal_Int32 nId = VMLExport::StartShape();
695 
696  return nId;
697 }
698 
699 static const char* lcl_GetHorizAlignFromItemSetChar(const SfxItemSet& rItemSet)
700 {
701  switch (rItemSet.Get(EE_PARA_JUST).GetAdjust())
702  {
703  case SvxAdjust::Center:
704  return "Center";
705  case SvxAdjust::Right:
706  return "Right";
707  case SvxAdjust::Block:
708  return "Justify";
709  default:
710  return "Left";
711  }
712 }
713 
714 static const char* lcl_GetVertAlignFromItemSetChar( const SfxItemSet& rItemSet )
715 {
716  switch( rItemSet.Get( SDRATTR_TEXT_VERTADJUST ).GetValue() )
717  {
719  return "Center";
721  return "Bottom";
723  return "Justify";
725  default:
726  return "Top";
727  }
728 }
729 
730 void VmlCommentExporter::EndShape( sal_Int32 nShapeElement )
731 {
732  char pAnchor[100];
733  sax_fastparser::FSHelperPtr pVmlDrawing = GetFS();
734  snprintf( pAnchor, 100, "%" SAL_PRIdINT64 ", %" SAL_PRIdINT64 ", %" SAL_PRIdINT64 ", %" SAL_PRIdINT64 ", %" SAL_PRIdINT64 ", %" SAL_PRIdINT64 ", %" SAL_PRIdINT64 ", %" SAL_PRIdINT64,
735  sal_Int64(maFrom.Left()), sal_Int64(maFrom.Top()), sal_Int64(maFrom.Right()), sal_Int64(maFrom.Bottom()),
736  sal_Int64(maTo.Left()), sal_Int64(maTo.Top()), sal_Int64(maTo.Right()), sal_Int64(maTo.Bottom()) );
737 
738  // Getting comment text alignments
739  const char* pVertAlign = lcl_GetVertAlignFromItemSetChar(mpCaption->GetMergedItemSet());
740  const char* pHorizAlign = lcl_GetHorizAlignFromItemSetChar(mpCaption->GetMergedItemSet());
741 
742  pVmlDrawing->startElement(FSNS(XML_x, XML_ClientData), XML_ObjectType, "Note");
743  pVmlDrawing->singleElement(FSNS(XML_x, XML_MoveWithCells));
744  pVmlDrawing->singleElement(FSNS(XML_x, XML_SizeWithCells));
745  XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Anchor ), pAnchor );
746  XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_AutoFill ), "False" );
747  XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_TextVAlign ), pVertAlign );
748  XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_TextHAlign ), pHorizAlign );
749  XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Row ), maScPos.Row() );
750  XclXmlUtils::WriteElement( pVmlDrawing, FSNS(XML_x, XML_Column), sal_Int32(maScPos.Col()));
751  if(mbVisible)
752  pVmlDrawing->singleElement(FSNS(XML_x, XML_Visible));
753  pVmlDrawing->endElement( FSNS( XML_x, XML_ClientData ) );
754 
755  VMLExport::EndShape( nShapeElement );
756 }
757 
759 {
760  VmlCommentExporter aCommentExporter( rStrm.GetCurrentStream(), maScPos, mpCaption, mbVisible, maFrom, maTo );
761  aCommentExporter.AddSdrObject( *mpCaption );
762 }
763 
764 // --- class XclObjDropDown ------------------------------------------
765 
766 XclObjDropDown::XclObjDropDown( XclExpObjectManager& rObjMgr, const ScAddress& rPos, bool bFilt ) :
767  XclObj( rObjMgr, EXC_OBJTYPE_DROPDOWN, true ),
768  bIsFiltered( bFilt )
769 {
770  SetLocked( true );
771  SetPrintable( false );
772  SetAutoFill( true );
773  SetAutoLine( false );
774  nGrbit |= 0x0100; // undocumented
776  mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty );
777  EscherPropertyContainer aPropOpt;
778  aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x01040104 ); // bool field
779  aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 ); // bool field
780  aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00010000 ); // bool field
781  aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080000 ); // bool field
782  aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x000A0000 ); // bool field
783  aPropOpt.Commit( mrEscherEx.GetStream() );
784 
785  XclExpDffDropDownAnchor( rObjMgr.GetRoot(), rPos ).WriteDffData( mrEscherEx );
786 
787  mrEscherEx.AddAtom( 0, ESCHER_ClientData ); // OBJ record
789  mrEscherEx.CloseContainer(); // ESCHER_SpContainer
790 
791  // old size + ftSbs + ftLbsData
792  AddRecSize( 24 + 20 );
793 }
794 
796 {
797 }
798 
800 {
801  // ftSbs subrecord - Scroll bars (dummy)
802  rStrm.StartRecord( EXC_ID_OBJSBS, 20 );
803  rStrm.WriteZeroBytes( 20 );
804  rStrm.EndRecord();
805 
806  // ftLbsData subrecord - Listbox data
807  sal_uInt16 nDropDownFlags = 0;
808  ::insert_value( nDropDownFlags, EXC_OBJ_DROPDOWN_SIMPLE, 0, 2 );
810  rStrm.StartRecord( EXC_ID_OBJLBSDATA, 16 );
811  rStrm << sal_uInt32(0) << sal_uInt16(0) << sal_uInt16(0x0301) << sal_uInt16(0)
812  << nDropDownFlags << sal_uInt16( 20 ) << sal_uInt16( 130 );
813  rStrm.EndRecord();
814 }
815 
816 // --- class XclTxo --------------------------------------------------
817 
819 {
820  sal_uInt8 nHorAlign = EXC_OBJ_HOR_LEFT;
821 
822  switch( rItemSet.Get( EE_PARA_JUST ).GetAdjust() )
823  {
824  case SvxAdjust::Left: nHorAlign = EXC_OBJ_HOR_LEFT; break;
825  case SvxAdjust::Center: nHorAlign = EXC_OBJ_HOR_CENTER; break;
826  case SvxAdjust::Right: nHorAlign = EXC_OBJ_HOR_RIGHT; break;
827  case SvxAdjust::Block: nHorAlign = EXC_OBJ_HOR_JUSTIFY; break;
828  default:;
829  }
830  return nHorAlign;
831 }
832 
834 {
835  sal_uInt8 nVerAlign = EXC_OBJ_VER_TOP;
836 
837  switch( rItemSet.Get( SDRATTR_TEXT_VERTADJUST ).GetValue() )
838  {
839  case SDRTEXTVERTADJUST_TOP: nVerAlign = EXC_OBJ_VER_TOP; break;
840  case SDRTEXTVERTADJUST_CENTER: nVerAlign = EXC_OBJ_VER_CENTER; break;
841  case SDRTEXTVERTADJUST_BOTTOM: nVerAlign = EXC_OBJ_VER_BOTTOM; break;
842  case SDRTEXTVERTADJUST_BLOCK: nVerAlign = EXC_OBJ_VER_JUSTIFY; break;
843  default:;
844  }
845  return nVerAlign;
846 }
847 
848 XclTxo::XclTxo( const OUString& rString, sal_uInt16 nFontIx ) :
849  mpString( std::make_shared<XclExpString>( rString ) ),
850  mnRotation( EXC_OBJ_ORIENT_NONE ),
851  mnHorAlign( EXC_OBJ_HOR_LEFT ),
852  mnVerAlign( EXC_OBJ_VER_TOP )
853 {
854  if( mpString->Len() )
855  {
856  // If there is text, Excel *needs* the 2nd CONTINUE record with at least two format runs
857  mpString->AppendFormat( 0, nFontIx );
858  mpString->AppendFormat( mpString->Len(), EXC_FONT_APP );
859  }
860 }
861 
862 XclTxo::XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rTextObj ) :
863  mpString( XclExpStringHelper::CreateString( rRoot, rTextObj ) ),
864  mnRotation( EXC_OBJ_ORIENT_NONE ),
865  mnHorAlign( EXC_OBJ_HOR_LEFT ),
866  mnVerAlign( EXC_OBJ_VER_TOP )
867 {
868  // additional alignment and orientation items
869  const SfxItemSet& rItemSet = rTextObj.GetMergedItemSet();
870 
871  // horizontal alignment
873 
874  // vertical alignment
876 
877  // rotation
878  tools::Long nAngle = rTextObj.GetRotateAngle();
879  if( (4500 < nAngle) && (nAngle < 13500) )
881  else if( (22500 < nAngle) && (nAngle < 31500) )
883  else
885 }
886 
887 XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObject* pCaption ) :
888  mpString( XclExpStringHelper::CreateString( rRoot, rEditObj ) ),
889  mnRotation( EXC_OBJ_ORIENT_NONE ),
890  mnHorAlign( EXC_OBJ_HOR_LEFT ),
891  mnVerAlign( EXC_OBJ_VER_TOP )
892 {
893  if(!pCaption)
894  return;
895 
896  // Excel has one alignment per NoteObject while Calc supports
897  // one alignment per paragraph - use the first paragraph
898  // alignment (if set) as our overall alignment.
899  OUString aParaText( rEditObj.GetText( 0 ) );
900  if( !aParaText.isEmpty() )
901  {
902  const SfxItemSet& aSet( rEditObj.GetParaAttribs( 0));
903  const SfxPoolItem* pItem = nullptr;
904  if( aSet.GetItemState( EE_PARA_JUST, true, &pItem ) == SfxItemState::SET )
905  {
906  SvxAdjust eEEAlign = static_cast< const SvxAdjustItem& >( *pItem ).GetAdjust();
907  pCaption->SetMergedItem( SvxAdjustItem( eEEAlign, EE_PARA_JUST ) );
908  }
909  }
910  const SfxItemSet& rItemSet = pCaption->GetMergedItemSet();
911 
912  // horizontal alignment
914 
915  // vertical alignment
917 
918  // orientation alignment
919  const SvxWritingModeItem& rItem = rItemSet.Get( SDRATTR_TEXTDIRECTION );
920  if( rItem.GetValue() == css::text::WritingMode_TB_RL )
922 }
923 
925 {
926  OSL_ENSURE( mpString, "XclTxo::SaveCont - missing string" );
927 
928  // #i96858# do not save existing string formatting if text is empty
929  sal_uInt16 nRunLen = mpString->IsEmpty() ? 0 : (8 * mpString->GetFormatsCount());
930  // alignment
931  sal_uInt16 nFlags = 0;
932  ::insert_value( nFlags, mnHorAlign, 1, 3 );
933  ::insert_value( nFlags, mnVerAlign, 4, 3 );
934 
935  rStrm << nFlags << mnRotation;
936  rStrm.WriteZeroBytes( 6 );
937  rStrm << mpString->Len() << nRunLen << sal_uInt32( 0 );
938 }
939 
941 {
942  // Write the TXO part
943  ExcRecord::Save( rStrm );
944 
945  // CONTINUE records are only written if there is some text
946  if( mpString->IsEmpty() )
947  return;
948 
949  // CONTINUE for character array
950  rStrm.StartRecord( EXC_ID_CONT, mpString->GetBufferSize() + 1 );
951  rStrm << static_cast< sal_uInt8 >( mpString->GetFlagField() & EXC_STRF_16BIT ); // only Unicode flag
952  mpString->WriteBuffer( rStrm );
953  rStrm.EndRecord();
954 
955  // CONTINUE for formatting runs
956  rStrm.StartRecord( EXC_ID_CONT, 8 * mpString->GetFormatsCount() );
957  const XclFormatRunVec& rFormats = mpString->GetFormats();
958  for( const auto& rFormat : rFormats )
959  rStrm << rFormat.mnChar << rFormat.mnFontIdx << sal_uInt32( 0 );
960  rStrm.EndRecord();
961 }
962 
963 sal_uInt16 XclTxo::GetNum() const
964 {
965  return EXC_ID_TXO;
966 }
967 
968 std::size_t XclTxo::GetLen() const
969 {
970  return 18;
971 }
972 
973 // --- class XclObjOle -------------------------------------------
974 
976  XclObj( rObjMgr, EXC_OBJTYPE_PICTURE ),
977  rOleObj( rObj ),
978  pRootStorage( rObjMgr.GetRoot().GetRootStorage().get() )
979 {
980 }
981 
983 {
984 }
985 
987 {
988  // write only as embedded, not linked
989  OUString aStorageName( "MBD" );
990  char aBuf[ sizeof(sal_uInt32) * 2 + 1 ];
991  // FIXME Eeek! Is this just a way to get a unique id?
992  sal_uInt32 nPictureId = sal_uInt32(reinterpret_cast<sal_uIntPtr>(this) >> 2);
993  sprintf( aBuf, "%08X", static_cast< unsigned int >( nPictureId ) );
994  aStorageName += OUString::createFromAscii(aBuf);
995  tools::SvRef<SotStorage> xOleStg = pRootStorage->OpenSotStorage( aStorageName );
996  if( !xOleStg.is() )
997  return;
998 
999  uno::Reference < embed::XEmbeddedObject > xObj( static_cast<const SdrOle2Obj&>(rOleObj).GetObjRef() );
1000  if ( !xObj.is() )
1001  return;
1002 
1003  // set version to "old" version, because it must be
1004  // saved in MS notation.
1005  sal_uInt32 nFl = 0;
1006  const SvtFilterOptions& rFltOpts = SvtFilterOptions::Get();
1007  if( rFltOpts.IsMath2MathType() )
1008  nFl |= OLE_STARMATH_2_MATHTYPE;
1009 
1010  if( rFltOpts.IsWriter2WinWord() )
1011  nFl |= OLE_STARWRITER_2_WINWORD;
1012 
1013  if( rFltOpts.IsCalc2Excel() )
1014  nFl |= OLE_STARCALC_2_EXCEL;
1015 
1016  if( rFltOpts.IsImpress2PowerPoint() )
1018 
1019  SvxMSExportOLEObjects aOLEExpFilt( nFl );
1020  aOLEExpFilt.ExportOLEObject( xObj, *xOleStg );
1021 
1022  // OBJCF subrecord, undocumented as usual
1023  rStrm.StartRecord( EXC_ID_OBJCF, 2 );
1024  rStrm << sal_uInt16(0x0002);
1025  rStrm.EndRecord();
1026 
1027  // OBJFLAGS subrecord, undocumented as usual
1028  rStrm.StartRecord( EXC_ID_OBJFLAGS, 2 );
1029  sal_uInt16 nFlags = EXC_OBJ_PIC_MANUALSIZE;
1030  ::set_flag( nFlags, EXC_OBJ_PIC_SYMBOL, static_cast<const SdrOle2Obj&>(rOleObj).GetAspect() == embed::Aspects::MSOLE_ICON );
1031  rStrm << nFlags;
1032  rStrm.EndRecord();
1033 
1034  // OBJPICTFMLA subrecord, undocumented as usual
1035  XclExpString aName( xOleStg->GetUserName() );
1036  sal_uInt16 nPadLen = static_cast<sal_uInt16>(aName.GetSize() & 0x01);
1037  sal_uInt16 nFmlaLen = static_cast< sal_uInt16 >( 12 + aName.GetSize() + nPadLen );
1038  sal_uInt16 nSubRecLen = nFmlaLen + 6;
1039 
1040  rStrm.StartRecord( EXC_ID_OBJPICTFMLA, nSubRecLen );
1041  rStrm << nFmlaLen
1042  << sal_uInt16( 5 ) << sal_uInt32( 0 ) << sal_uInt8( 2 )
1043  << sal_uInt32( 0 ) << sal_uInt8( 3 )
1044  << aName;
1045  if( nPadLen )
1046  rStrm << sal_uInt8( 0 ); // pad byte
1047  rStrm << nPictureId;
1048  rStrm.EndRecord();
1049 }
1050 
1052 {
1053  // content of this record
1054  XclObj::Save( rStrm );
1055 }
1056 
1057 // --- class XclObjAny -------------------------------------------
1058 
1059 XclObjAny::XclObjAny( XclExpObjectManager& rObjMgr, const Reference< XShape >& rShape, ScDocument* pDoc )
1060  : XclObj( rObjMgr, EXC_OBJTYPE_UNKNOWN )
1061  , mxShape( rShape )
1062  , mpDoc(pDoc)
1063 {
1064 }
1065 
1067 {
1068 }
1069 
1071 {
1072  if( mnObjType == EXC_OBJTYPE_GROUP )
1073  // ftGmo subrecord
1074  rStrm << EXC_ID_OBJGMO << sal_uInt16(2) << sal_uInt16(0);
1075 }
1076 
1078 {
1079  if( mnObjType == EXC_OBJTYPE_GROUP )
1080  // old size + ftGmo
1081  AddRecSize( 6 );
1082 
1083  // content of this record
1084  XclObj::Save( rStrm );
1085 }
1086 
1087 // --- class ExcBof8_Base --------------------------------------------
1088 
1090 {
1091  nVers = 0x0600;
1092  nRupBuild = 0x0dbb;
1093  nRupYear = 0x07cc;
1094 }
1095 
1096 void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& rShape, SCTAB nTab )
1097 {
1098  sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream();
1099 
1100  awt::Point aTopLeft = rShape->getPosition();
1101  awt::Size aSize = rShape->getSize();
1102 
1103  uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW);
1104  uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xShapeProperties->getPropertySetInfo();
1105  if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
1106  {
1107  uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle");
1108  sal_Int32 nRot = nRotProp.get<sal_Int32>();
1109 
1110  if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100))
1111  {
1112  // MSO changes the anchor positions at these angles and that does an extra 90 degrees
1113  // rotation on our shapes, so we output it in such position that MSO
1114  // can draw this shape correctly.
1115 
1116  sal_Int16 nHalfWidth = aSize.Width / 2;
1117  sal_Int16 nHalfHeight = aSize.Height / 2;
1118  aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth;
1119  aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight;
1120 
1121  std::swap(aSize.Width, aSize.Height);
1122  }
1123  }
1124 
1125  tools::Rectangle aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height );
1126  ScRange aRange = rStrm.GetRoot().GetDoc().GetRange( nTab, aLocation );
1127  tools::Rectangle aRangeRect = rStrm.GetRoot().GetDoc().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(),
1128  aRange.aEnd.Col()-1, aRange.aEnd.Row()-1,
1129  nTab );
1130 
1131  pDrawing->startElement(FSNS(XML_xdr, XML_from));
1132  XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_col ), static_cast<sal_Int32>(aRange.aStart.Col()) );
1133  XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_colOff ),
1134  oox::drawingml::convertHmmToEmu( aLocation.Left() - aRangeRect.Left() ) );
1135  XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_row ), static_cast<sal_Int32>(aRange.aStart.Row()) );
1136  XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_rowOff ),
1137  oox::drawingml::convertHmmToEmu( aLocation.Top() - aRangeRect.Top() ) );
1138  pDrawing->endElement( FSNS( XML_xdr, XML_from ) );
1139 
1140  pDrawing->startElement(FSNS(XML_xdr, XML_to));
1141  XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_col ), static_cast<sal_Int32>(aRange.aEnd.Col()) );
1142  XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_colOff ),
1143  oox::drawingml::convertHmmToEmu( aLocation.Right() - aRangeRect.Right() ) );
1144  XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_row ), static_cast<sal_Int32>(aRange.aEnd.Row()) );
1145  XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_rowOff ),
1146  oox::drawingml::convertHmmToEmu( aLocation.Bottom() - aRangeRect.Bottom() ) );
1147  pDrawing->endElement( FSNS( XML_xdr, XML_to ) );
1148 }
1149 
1151 {
1152  WriteFromTo( rStrm, rObj.GetShape(), rObj.GetTab() );
1153 }
1154 
1155 static const char*
1156 GetEditAs( const XclObjAny& rObj )
1157 {
1158  if( const SdrObject* pShape = EscherEx::GetSdrObject( rObj.GetShape() ) )
1159  {
1160  switch( ScDrawLayer::GetAnchorType( *pShape ) )
1161  {
1162  case SCA_CELL:
1163  return "oneCell";
1164  case SCA_CELL_RESIZE:
1165  return "twoCell";
1166  default:
1167  case SCA_PAGE:
1168  break; // absolute
1169  }
1170  }
1171  return "absolute";
1172 }
1173 
1174 namespace {
1175 
1176 ScRefFlags parseRange(const OUString& rString, ScRange& rRange, const ScDocument& rDoc)
1177 {
1178  // start with the address convention set in the document
1180  ScRefFlags nResult = rRange.Parse(rString, rDoc, eConv);
1181  if ( nResult & ScRefFlags::VALID )
1182  return nResult;
1183 
1184  // try the default calc address convention
1185  nResult = rRange.Parse(rString, rDoc);
1186  if ( nResult & ScRefFlags::VALID )
1187  return nResult;
1188 
1189  // try excel a1
1190  nResult = rRange.Parse(rString, rDoc, formula::FormulaGrammar::CONV_XL_A1);
1191  if ( nResult & ScRefFlags::VALID )
1192  return nResult;
1193 
1194  // try r1c1
1195  return rRange.Parse(rString, rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
1196 }
1197 
1198 ScRefFlags parseAddress(const OUString& rString, ScAddress& rAddress, const ScDocument& rDoc)
1199 {
1200  // start with the address convention set in the document
1202  ScRefFlags nResult = rAddress.Parse(rString, rDoc, eConv);
1203  if ( nResult & ScRefFlags::VALID )
1204  return nResult;
1205 
1206  // try the default calc address convention
1207  nResult = rAddress.Parse(rString, rDoc);
1208  if ( nResult & ScRefFlags::VALID )
1209  return nResult;
1210 
1211  // try excel a1
1212  nResult = rAddress.Parse(rString, rDoc, formula::FormulaGrammar::CONV_XL_A1);
1213  if ( nResult & ScRefFlags::VALID )
1214  return nResult;
1215 
1216  // try r1c1
1217  return rAddress.Parse(rString, rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
1218 }
1219 
1220 void transformURL(const OUString& rOldURL, OUString& rNewURL, const ScDocument& rDoc)
1221 {
1222  if (rOldURL.startsWith("#"))
1223  {
1224  // URL has to be decoded for escaped characters (%20)
1225  OUString aURL = INetURLObject::decode( rOldURL,
1227  OUString aAddressString = aURL.copy(1);
1228 
1229  ScRange aRange;
1230  ScRefFlags nResult = parseRange(aAddressString, aRange, rDoc);
1231  if ( nResult & ScRefFlags::VALID )
1232  {
1233  OUString aString = aRange.Format(rDoc, nResult, formula::FormulaGrammar::CONV_XL_OOX);
1234  rNewURL = "#" + aString;
1235  return;
1236  }
1237  else
1238  {
1239  ScAddress aAddress;
1240  nResult = parseAddress(aAddressString, aAddress, rDoc);
1241  if( nResult & ScRefFlags::VALID )
1242  {
1243  OUString aString = aAddress.Format(nResult, &rDoc, formula::FormulaGrammar::CONV_XL_OOX);
1244  rNewURL = "#" + aString;
1245  return;
1246  }
1247  }
1248  }
1249 
1250  rNewURL = rOldURL;
1251 }
1252 
1253 }
1254 
1256  : mrDoc(rDoc)
1257 {
1258 }
1259 
1260 OUString ScURLTransformer::getTransformedString(const OUString& rURL) const
1261 {
1262  OUString aNewURL;
1263  transformURL(rURL, aNewURL, mrDoc);
1264  return aNewURL;
1265 }
1266 
1267 bool ScURLTransformer::isExternalURL(const OUString& rURL) const
1268 {
1269  return !rURL.startsWith("#");
1270 }
1271 
1273 {
1274  // ignore group shapes at the moment, we don't process them correctly
1275  // leading to ms2010 rejecting the content
1276  if( !mxShape.is() || mxShape->getShapeType() == "com.sun.star.drawing.GroupShape" )
1277  return;
1278 
1279  // Do not output any of the detective shapes and validation circles.
1281  if (pObject)
1282  {
1283  ScDocument& rDoc = rStrm.GetRoot().GetDoc();
1284  ScDetectiveFunc aDetFunc(rDoc, mnScTab);
1285  ScAddress aPosition;
1286  ScRange aSourceRange;
1287  bool bRedLine;
1288  ScDetectiveObjType eObjType
1289  = aDetFunc.GetDetectiveObjectType(pObject, mnScTab, aPosition, aSourceRange, bRedLine);
1290 
1291  if (eObjType != SC_DETOBJ_NONE)
1292  return;
1293  }
1294 
1295  sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream();
1296 
1297  ShapeExport aDML(XML_xdr, pDrawing, nullptr, &rStrm, drawingml::DOCUMENT_XLSX);
1298  auto pURLTransformer = std::make_shared<ScURLTransformer>(*mpDoc);
1299  aDML.SetURLTranslator(pURLTransformer);
1300 
1301  pDrawing->startElement( FSNS( XML_xdr, XML_twoCellAnchor ), // OOXTODO: oneCellAnchor, absoluteAnchor
1302  XML_editAs, GetEditAs( *this ) );
1303  Reference< XPropertySet > xPropSet( mxShape, UNO_QUERY );
1304  if (xPropSet.is())
1305  {
1306  WriteFromTo( rStrm, *this );
1307  aDML.WriteShape( mxShape );
1308  }
1309 
1310  pDrawing->singleElement( FSNS( XML_xdr, XML_clientData)
1311  // OOXTODO: XML_fLocksWithSheet
1312  // OOXTODO: XML_fPrintsWithSheet
1313  );
1314  pDrawing->endElement( FSNS( XML_xdr, XML_twoCellAnchor ) );
1315 }
1316 
1318 {
1319  rStrm.DisableEncryption();
1320  rStrm << nVers << nDocType << nRupBuild << nRupYear
1321  << sal_uInt32(0)/*nFileHistory*/
1322  << sal_uInt32(0x06) /*nLowestBiffVer = Biff8*/;
1323 }
1324 
1325 sal_uInt16 ExcBof8_Base::GetNum() const
1326 {
1327  return 0x0809;
1328 }
1329 
1330 std::size_t ExcBof8_Base::GetLen() const
1331 {
1332  return 16;
1333 }
1334 
1335 // --- class ExcBof8 -------------------------------------------------
1336 
1338 {
1339  nDocType = 0x0010;
1340 }
1341 
1342 // --- class ExcBofW8 ------------------------------------------------
1343 
1345 {
1346  nDocType = 0x0005;
1347 }
1348 
1349 // --- class ExcBundlesheet8 -----------------------------------------
1350 
1352  ExcBundlesheetBase( rRootData, static_cast<sal_uInt16>(_nTab) ),
1353  sUnicodeName( rRootData.pER->GetTabInfo().GetScTabName( _nTab ) )
1354 {
1355 }
1356 
1357 ExcBundlesheet8::ExcBundlesheet8( const OUString& rString ) :
1359  sUnicodeName( rString )
1360 {
1361 }
1362 
1364 {
1365  m_nOwnPos = rStrm.GetSvStreamPos();
1366  // write dummy position, real position comes later
1367  rStrm.DisableEncryption();
1368  rStrm << sal_uInt32(0);
1369  rStrm.EnableEncryption();
1370  rStrm << nGrbit << GetName();
1371 }
1372 
1373 std::size_t ExcBundlesheet8::GetLen() const
1374 { // Text max 255 chars
1375  return 8 + GetName().GetBufferSize();
1376 }
1377 
1379 {
1380  OUString sId;
1381  rStrm.CreateOutputStream(
1382  XclXmlUtils::GetStreamName( "xl/", "worksheets/sheet", nTab+1),
1383  XclXmlUtils::GetStreamName( nullptr, "worksheets/sheet", nTab+1),
1384  rStrm.GetCurrentStream()->getOutputStream(),
1385  "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
1386  oox::getRelationship(Relationship::WORKSHEET),
1387  &sId );
1388 
1389  rStrm.GetCurrentStream()->singleElement( XML_sheet,
1390  XML_name, sUnicodeName.toUtf8(),
1391  XML_sheetId, OString::number( ( nTab+1 ) ),
1392  XML_state, nGrbit == 0x0000 ? "visible" : "hidden",
1393  FSNS( XML_r, XML_id ), sId.toUtf8() );
1394 }
1395 
1396 // --- class XclObproj -----------------------------------------------
1397 
1398 sal_uInt16 XclObproj::GetNum() const
1399 {
1400  return 0x00D3;
1401 }
1402 
1403 std::size_t XclObproj::GetLen() const
1404 {
1405  return 0;
1406 }
1407 
1408 // ---- class XclCodename --------------------------------------------
1409 
1410 XclCodename::XclCodename( const OUString& r ) : aName( r )
1411 {
1412 }
1413 
1415 {
1416  rStrm << aName;
1417 }
1418 
1419 sal_uInt16 XclCodename::GetNum() const
1420 {
1421  return 0x01BA;
1422 }
1423 
1424 std::size_t XclCodename::GetLen() const
1425 {
1426  return aName.GetSize();
1427 }
1428 
1429 // ---- Scenarios ----------------------------------------------------
1430 
1431 ExcEScenarioCell::ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const OUString& rTxt ) :
1432  nCol( nC ),
1433  nRow( nR ),
1434  sText( rTxt, XclStrFlags::NONE, 255 )
1435 {
1436 }
1437 
1439 {
1440  rStrm << nRow << nCol;
1441 }
1442 
1444 {
1445  rStrm << sText;
1446 }
1447 
1449 {
1450  rStrm.GetCurrentStream()->singleElement( XML_inputCells,
1451  // OOXTODO: XML_deleted,
1452  // OOXTODO: XML_numFmtId,
1453  XML_r, XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), ScAddress( nCol, nRow, 0 ) ),
1454  // OOXTODO: XML_undone,
1455  XML_val, XclXmlUtils::ToOString( sText ) );
1456 }
1457 
1459 {
1460  OUString sTmpName;
1461  OUString sTmpComm;
1462  OUString aTmp;
1463  Color aDummyCol;
1464  ScScenarioFlags nFlags;
1465 
1466  ScDocument& rDoc = rRoot.GetDoc();
1467  rDoc.GetName(nTab, aTmp);
1468  sTmpName = aTmp;
1470  nRecLen = 8 + sName.GetBufferSize();
1471 
1472  rDoc.GetScenarioData( nTab, aTmp, aDummyCol, nFlags );
1473  sTmpComm = aTmp;
1474  sComment.Assign( sTmpComm, XclStrFlags::NONE, 255 );
1475  if( sComment.Len() )
1476  nRecLen += sComment.GetSize();
1478 
1479  sUserName.Assign( rRoot.GetUserName(), XclStrFlags::NONE, 255 );
1480  nRecLen += sUserName.GetSize();
1481 
1482  const ScRangeList* pRList = rDoc.GetScenarioRanges( nTab );
1483  if( !pRList )
1484  return;
1485 
1486  bool bContLoop = true;
1487  SCROW nRow;
1488  SCCOL nCol;
1489  OUString sText;
1490  double fVal;
1491 
1492  for( size_t nRange = 0; (nRange < pRList->size()) && bContLoop; nRange++ )
1493  {
1494  const ScRange & rRange = (*pRList)[nRange];
1495  for( nRow = rRange.aStart.Row(); (nRow <= rRange.aEnd.Row()) && bContLoop; nRow++ )
1496  for( nCol = rRange.aStart.Col(); (nCol <= rRange.aEnd.Col()) && bContLoop; nCol++ )
1497  {
1498  if( rDoc.HasValueData( nCol, nRow, nTab ) )
1499  {
1500  rDoc.GetValue( nCol, nRow, nTab, fVal );
1501  sText = ::rtl::math::doubleToUString( fVal,
1502  rtl_math_StringFormat_Automatic,
1503  rtl_math_DecimalPlaces_Max,
1504  ScGlobal::getLocaleDataPtr()->getNumDecimalSep()[0],
1505  true );
1506  }
1507  else
1508  sText = rDoc.GetString(nCol, nRow, nTab);
1509  bContLoop = Append( static_cast<sal_uInt16>(nCol),
1510  static_cast<sal_uInt16>(nRow), sText );
1511  }
1512  }
1513 }
1514 
1515 bool ExcEScenario::Append( sal_uInt16 nCol, sal_uInt16 nRow, const OUString& rTxt )
1516 {
1517  if( aCells.size() == EXC_SCEN_MAXCELL )
1518  return false;
1519 
1520  ExcEScenarioCell aCell(nCol, nRow, rTxt);
1521  aCells.push_back(aCell);
1522  nRecLen += 6 + aCell.GetStringBytes(); // 4 bytes address, 2 bytes ifmt
1523  return true;
1524 }
1525 
1527 {
1528  sal_uInt16 count = aCells.size();
1529 
1530  rStrm << count // number of cells
1531  << sal_uInt8(bProtected) // fProtection
1532  << sal_uInt8(0) // fHidden
1533  << static_cast<sal_uInt8>(sName.Len()) // length of scen name
1534  << static_cast<sal_uInt8>(sComment.Len()) // length of comment
1535  << static_cast<sal_uInt8>(sUserName.Len()); // length of user name
1536  sName.WriteFlagField( rStrm );
1537  sName.WriteBuffer( rStrm );
1538 
1539  rStrm << sUserName;
1540 
1541  if( sComment.Len() )
1542  rStrm << sComment;
1543 
1544  for( const auto& rCell : aCells )
1545  rCell.WriteAddress( rStrm ); // pos of cell
1546  for( const auto& rCell : aCells )
1547  rCell.WriteText( rStrm ); // string content
1548  rStrm.SetSliceSize( 2 );
1549  rStrm.WriteZeroBytes( 2 * count ); // date format
1550 }
1551 
1552 sal_uInt16 ExcEScenario::GetNum() const
1553 {
1554  return 0x00AF;
1555 }
1556 
1557 std::size_t ExcEScenario::GetLen() const
1558 {
1559  return nRecLen;
1560 }
1561 
1563 {
1564  sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
1565  rWorkbook->startElement( XML_scenario,
1566  XML_name, XclXmlUtils::ToOString( sName ).getStr(),
1567  XML_locked, ToPsz( bProtected ),
1568  // OOXTODO: XML_hidden,
1569  XML_count, OString::number( aCells.size() ).getStr(),
1570  XML_user, XESTRING_TO_PSZ( sUserName ),
1571  XML_comment, XESTRING_TO_PSZ( sComment ) );
1572 
1573  for( const auto& rCell : aCells )
1574  rCell.SaveXml( rStrm );
1575 
1576  rWorkbook->endElement( XML_scenario );
1577 }
1578 
1580  nActive( 0 )
1581 {
1582  ScDocument& rDoc = rRoot.GetDoc();
1583  if( rDoc.IsScenario( nTab ) )
1584  return;
1585 
1586  SCTAB nFirstTab = nTab + 1;
1587  SCTAB nNewTab = nFirstTab;
1588 
1589  while( rDoc.IsScenario( nNewTab ) )
1590  {
1591  aScenes.emplace_back( rRoot, nNewTab );
1592 
1593  if( rDoc.IsActiveScenario( nNewTab ) )
1594  nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
1595  nNewTab++;
1596  }
1597 }
1598 
1600 {
1601 }
1602 
1604 {
1605  rStrm << static_cast<sal_uInt16>(aScenes.size()) // number of scenarios
1606  << nActive // active scen
1607  << nActive // last displayed
1608  << sal_uInt16(0); // reference areas
1609 }
1610 
1612 {
1613  if( !aScenes.empty() )
1614  ExcRecord::Save( rStrm );
1615 
1616  for( ExcEScenario& rScenario : aScenes )
1617  rScenario.Save( rStrm );
1618 }
1619 
1621 {
1622  if( aScenes.empty() )
1623  return;
1624 
1625  sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
1626  rWorkbook->startElement( XML_scenarios,
1627  XML_current, OString::number( nActive ),
1628  XML_show, OString::number( nActive )
1629  // OOXTODO: XML_sqref
1630  );
1631 
1632  for( ExcEScenario& rScenario : aScenes )
1633  rScenario.SaveXml( rStrm );
1634 
1635  rWorkbook->endElement( XML_scenarios );
1636 }
1637 
1639 {
1640  return 0x00AE;
1641 }
1642 
1643 std::size_t ExcEScenarioManager::GetLen() const
1644 {
1645  return 8;
1646 }
1647 
1648 namespace {
1649 
1650 struct XclExpTabProtectOption
1651 {
1652  ScTableProtection::Option eOption;
1653  sal_uInt16 nMask;
1654 };
1655 
1656 }
1657 
1659  XclExpRecord( 0x0867, 23 )
1660 {
1661  static const XclExpTabProtectOption aTable[] =
1662  {
1663  { ScTableProtection::OBJECTS, 0x0001 },
1664  { ScTableProtection::SCENARIOS, 0x0002 },
1665  { ScTableProtection::FORMAT_CELLS, 0x0004 },
1667  { ScTableProtection::FORMAT_ROWS, 0x0010 },
1669  { ScTableProtection::INSERT_ROWS, 0x0040 },
1671 
1673  { ScTableProtection::DELETE_ROWS, 0x0200 },
1675  { ScTableProtection::SORT, 0x0800 },
1676  { ScTableProtection::AUTOFILTER, 0x1000 },
1677  { ScTableProtection::PIVOT_TABLES, 0x2000 },
1679 
1680  { ScTableProtection::NONE, 0x0000 }
1681  };
1682 
1683  mnOptions = 0x0000;
1684  ScTableProtection* pProtect = rRoot.GetDoc().GetTabProtection(nTab);
1685  if (!pProtect)
1686  return;
1687 
1688  for (int i = 0; aTable[i].nMask != 0x0000; ++i)
1689  {
1690  if ( pProtect->isOptionEnabled(aTable[i].eOption) )
1691  mnOptions |= aTable[i].nMask;
1692  }
1693 }
1694 
1696 {
1697  sal_uInt16 nBytes = 0x0867;
1698  rStrm << nBytes;
1699 
1700  for (int i = 0; i < 9; ++i)
1701  rStrm << static_cast<unsigned char>(0);
1702 
1703  nBytes = 0x0200;
1704  rStrm << nBytes;
1705  nBytes = 0x0100;
1706  rStrm << nBytes;
1707  nBytes = 0xFFFF;
1708  rStrm << nBytes << nBytes;
1709 
1710  rStrm << mnOptions;
1711  nBytes = 0;
1712  rStrm << nBytes;
1713 }
1714 
1716  const ScEnhancedProtection & rProt ) :
1717  XclExpRecord( 0x0868 ),
1718  mrRoot( rRoot ),
1719  maEnhancedProtection( rProt )
1720 {
1721 }
1722 
1724 {
1725  sal_uInt16 const nRecordType = 0x0868;
1726  rStrm << nRecordType; // frtHeader rt
1727  rStrm.WriteZeroBytesToRecord(10); // frtHeader unused
1728  rStrm << EXC_ISFPROTECTION; // isf
1729  rStrm.WriteZeroBytesToRecord(5); // reserved1 (1 bytes) and reserved2 (4 bytes)
1730 
1731  XclRangeList aRefs;
1734  sal_uInt16 nCref = ulimit_cast<sal_uInt16>(aRefs.size());
1735  rStrm << nCref; // cref
1736  rStrm.WriteZeroBytesToRecord(6); // cbFeatData if EXC_ISFFEC2 (4 bytes) and reserved3 (2 bytes)
1737  aRefs.Write( rStrm, true, nCref); // refs
1738 
1739  // FeatProtection structure
1740  rStrm << maEnhancedProtection.mnAreserved; // 1 bit A and 31 bits reserved
1741  rStrm << maEnhancedProtection.mnPasswordVerifier; // wPassword
1742  rStrm << XclExpString( maEnhancedProtection.maTitle); // stTitle
1743  bool bSDContainer = ((maEnhancedProtection.mnAreserved & 0x00000001) == 0x00000001);
1744  sal_uInt32 nCbSD = maEnhancedProtection.maSecurityDescriptor.size();
1745  SAL_WARN_IF( bSDContainer && nCbSD < 20, "sc.filter",
1746  "XclExpSheetEnhancedProtection A flag indicates container but cbSD < 20");
1747  SAL_WARN_IF( !bSDContainer && nCbSD > 0, "sc.filter",
1748  "XclExpSheetEnhancedProtection A flag indicates no container but cbSD > 0");
1749  if (bSDContainer)
1750  {
1751  rStrm << nCbSD;
1752  rStrm.Write( &maEnhancedProtection.maSecurityDescriptor.front(), nCbSD);
1753  }
1754 }
1755 
1757 {
1758  rStrm << nCount;
1759 }
1760 
1762 {
1763  nCount = rDoc.GetDocOptions().GetIterCount();
1764 }
1765 
1766 sal_uInt16 XclCalccount::GetNum() const
1767 {
1768  return 0x000C;
1769 }
1770 
1771 std::size_t XclCalccount::GetLen() const
1772 {
1773  return 2;
1774 }
1775 
1777 {
1778  rStrm.WriteAttributes(XML_iterateCount, OUString::number(nCount));
1779 }
1780 
1782 {
1783  rStrm << nIter;
1784 }
1785 
1787 {
1788  nIter = rDoc.GetDocOptions().IsIter()? 1 : 0;
1789 }
1790 
1791 sal_uInt16 XclIteration::GetNum() const
1792 {
1793  return 0x0011;
1794 }
1795 
1796 std::size_t XclIteration::GetLen() const
1797 {
1798  return 2;
1799 }
1800 
1802 {
1803  rStrm.WriteAttributes(XML_iterate, ToPsz(nIter == 1));
1804 }
1805 
1807 {
1808  rStrm << fDelta;
1809 }
1810 
1812 {
1813  fDelta = rDoc.GetDocOptions().GetIterEps();
1814 }
1815 
1816 sal_uInt16 XclDelta::GetNum() const
1817 {
1818  return 0x0010;
1819 }
1820 
1821 std::size_t XclDelta::GetLen() const
1822 {
1823  return 8;
1824 }
1825 
1827 {
1828  rStrm.WriteAttributes(XML_iterateDelta, OUString::number(fDelta));
1829 }
1830 
1832  XclExpRecord(0x002F, 54),
1833  mrRoot(rRoot)
1834 {
1835 }
1836 
1838 {
1839 }
1840 
1842 {
1843  // 0x0000 - neither standard nor strong encryption
1844  // 0x0001 - standard or strong encryption
1845  rStrm << static_cast<sal_uInt16>(0x0001);
1846 
1847  // 0x0000 - non standard encryption
1848  // 0x0001 - standard encryption
1849  sal_uInt16 nStdEnc = 0x0001;
1850  rStrm << nStdEnc << nStdEnc;
1851 
1852  sal_uInt8 pnDocId[16];
1853  sal_uInt8 pnSalt[16];
1854  sal_uInt8 pnSaltHash[16];
1855  XclExpEncrypterRef xEnc = std::make_shared<XclExpBiff8Encrypter>(mrRoot);
1856  xEnc->GetDocId(pnDocId);
1857  xEnc->GetSalt(pnSalt);
1858  xEnc->GetSaltDigest(pnSaltHash);
1859 
1860  rStrm.Write(pnDocId, 16);
1861  rStrm.Write(pnSalt, 16);
1862  rStrm.Write(pnSaltHash, 16);
1863 
1864  rStrm.SetEncrypter(xEnc);
1865 }
1866 
1869 {
1870 }
1871 
1873 {
1874  rStrm.DisableEncryption();
1875  rStrm << GetValue();
1876 }
1877 
1879  XclExpRecord(0x00E2, 0) {}
1880 
1882 
1884 {
1885  // Don't forget to re-enable encryption.
1886  rStrm.EnableEncryption();
1887 }
1888 
1890  XclExpRecord(0x005C, 112)
1891 {
1892 }
1893 
1895 {
1896 }
1897 
1899 {
1900  static const sal_uInt8 aData[] = {
1901  0x04, 0x00, 0x00, 'C', 'a', 'l', 'c', 0x20,
1902  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1903  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1904  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1905  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1906  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1907  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1908  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1909  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1910  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1911  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1912  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1913  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1914  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
1915 
1916  for (std::size_t i = 0; i < sizeof(aData); ++i)
1917  rStrm << aData[i];
1918 }
1919 
1920 XclExpFileSharing::XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash, bool bRecommendReadOnly ) :
1922  mnPasswordHash( nPasswordHash ),
1923  mbRecommendReadOnly( bRecommendReadOnly )
1924 {
1925  if( rRoot.GetBiff() <= EXC_BIFF5 )
1927  else
1928  maUserName.Assign( rRoot.GetUserName() );
1929 }
1930 
1932 {
1933  if( (mnPasswordHash != 0) || mbRecommendReadOnly )
1934  XclExpRecord::Save( rStrm );
1935 }
1936 
1938 {
1939  rStrm << sal_uInt16( mbRecommendReadOnly ? 1 : 0 ) << mnPasswordHash << maUserName;
1940 }
1941 
1943  XclExpRecord(0x01AF, 2)
1944 {
1945 }
1946 
1948 {
1949 }
1950 
1952 {
1953  rStrm << static_cast<sal_uInt16>(0x0000);
1954 }
1955 
1957  XclExpRecord(0x01BC, 2)
1958 {
1959 }
1960 
1962 {
1963 }
1964 
1966 {
1967  rStrm << static_cast<sal_uInt16>(0x0000);
1968 }
1969 
1971  0xC1, 0x01, 0x00, 0x00, 0x54, 0x8D, 0x01, 0x00
1972 };
1973 
1975  XclExpDummyRecord(0x01C1, nDataRecalcId, sizeof(nDataRecalcId))
1976 {
1977 }
1978 
1980  0x63, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1981  0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1982  0x02
1983 };
1984 
1986  XclExpDummyRecord(0x0863, nDataBookExt, sizeof(nDataBookExt))
1987 {
1988 }
1989 
1991  XclExpBoolRecord( 0x000F, rDoc.GetAddressConvention() != formula::FormulaGrammar::CONV_XL_R1C1 )
1992 {
1993 }
1994 
1996 {
1997  rStrm.WriteAttributes(XML_refMode, GetBool() ? "A1" : "R1C1");
1998 }
1999 
2000 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:460
sal_uInt16 nRupBuild
Definition: excrecds.hxx:103
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:1931
sal_uInt16 nActive
Definition: xcl97rec.hxx:412
void WriteAttributes(sal_Int32 nAttribute, Str &&value, Args &&...rest)
Definition: xestream.hxx:299
sal_uInt16 nObjId
Definition: xcl97rec.hxx:110
void ConvertRangeList(XclRangeList &rXclRanges, const ScRangeList &rScRanges, bool bWarn)
Converts the passed Calc cell range list to an Excel cell range list.
Definition: xehelper.cxx:265
bool is() const
#define ESCHER_DgContainer
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:43
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:1398
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:963
std::unique_ptr< XclObj > pop_back()
Remove last element in the list.
Definition: xcl97rec.cxx:128
OUString sUnicodeName
Definition: xcl97rec.hxx:322
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2116
std::size_t Write(const void *pData, std::size_t nBytes)
Writes nBytes bytes from memory.
Definition: xestream.cxx:215
static OString ToOString(const Color &rColor)
Definition: xestream.cxx:698
const size_t count(pCandidateA->getBorderLines().size())
URL aURL
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:1077
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:940
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:1272
SDRTEXTVERTADJUST_TOP
const sal_uInt16 EXC_ID_OBJSBS
Radio button group data.
Definition: xlescher.hxx:216
rtl_TextEncoding GetTextEncoding() const
Returns the text encoding to import/export byte strings.
Definition: xlroot.hxx:147
sal_uInt16 mnPasswordHash
Definition: xcl97rec.hxx:570
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:1841
XclIteration(const ScDocument &)
Definition: xcl97rec.cxx:1786
const sal_uInt16 EXC_ID_OBJEND
Definition: xlescher.hxx:207
ScAddress aStart
Definition: address.hxx:500
sal_uInt16 nGrbit
Definition: excrecds.hxx:240
const sal_uInt16 EXC_OBJ_ORIENT_90CCW
Stacked top to bottom.
Definition: xlescher.hxx:135
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record.
Definition: xcl97rec.cxx:1872
const sal_uInt16 EXC_ID_INTERFACEHDR
Definition: xlconst.hxx:220
#define ESCHER_Prop_fshadowObscured
XclEscherEx & mrEscherEx
Definition: xcl97rec.hxx:93
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:1419
void SetEncrypter(XclExpEncrypterRef const &xEncrypter)
Definition: xestream.cxx:348
void SetAutoLine(bool b)
Definition: xcl97rec.hxx:141
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:290
static sax_fastparser::FSHelperPtr WriteElement(sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const T &value)
Definition: xestream.hxx:272
tools::Rectangle maFrom
Definition: xcl97rec.hxx:181
std::unique_ptr< XclExpMsoDrawing > pClientTextbox
Definition: xcl97rec.hxx:107
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:1611
Represents the position (anchor) of a note object.
Definition: xeescher.hxx:101
SvxAdjust GetAdjust() const
size_t size() const
Definition: xcl97rec.hxx:71
const sal_uInt16 EXC_OBJTYPE_UNKNOWN
Definition: xlescher.hxx:72
This class is used to export Excel record streams.
Definition: xestream.hxx:71
SCROW Row() const
Definition: address.hxx:262
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
sal_uInt16 nCount
Definition: xcl97rec.hxx:462
const char aData[]
virtual tools::Long GetRotateAngle() const override
ScRangeListRef maRangeList
void WriteBuffer(XclExpStream &rStrm) const
Writes the raw character buffer.
Definition: xestring.cxx:304
XclStrFlags
Flags used to specify import/export mode of strings.
Definition: xlstring.hxx:29
sal_uInt8 mnHorAlign
Text rotation.
Definition: xcl97rec.hxx:236
tools::Rectangle maTo
Definition: xcl97rec.hxx:182
const sal_uInt16 EXC_OBJ_ORIENT_NONE
Definition: xlescher.hxx:133
#define OLE_STARIMPRESS_2_POWERPOINT
virtual ~XclExpProt4Rev() override
Definition: xcl97rec.cxx:1947
void SetVerAlign(sal_uInt8 nVerAlign)
Definition: xcl97rec.hxx:223
XclTxo(const OUString &rString, sal_uInt16 nFontIx)
Definition: xcl97rec.cxx:848
const sal_uInt16 EXC_OBJ_PIC_SYMBOL
Definition: xlescher.hxx:155
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1603
const sal_uInt16 EXC_ID_TXO
Definition: xlescher.hxx:277
SC_DLLPUBLIC bool IsActiveScenario(SCTAB nTab) const
Definition: documen3.cxx:872
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:1801
sheet protection state container
XclExpString GetName() const
Definition: xcl97rec.hxx:323
const Type & GetValue() const
Returns the value of the record.
Definition: xerecord.hxx:209
virtual void WriteSubRecs(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:799
SotStorage * pRootStorage
Definition: xcl97rec.hxx:247
ScScenarioFlags
Definition: global.hxx:237
const sal_uInt16 EXC_ID_OBJPICTFMLA
Option flags.
Definition: xlescher.hxx:213
XclExpFileEncryption(const XclExpRoot &rRoot)
Definition: xcl97rec.cxx:1831
long Long
void SetText(const XclExpRoot &rRoot, const SdrTextObj &rObj)
actually writes ESCHER_ClientTextbox
Definition: xcl97rec.cxx:447
void Commit(SvStream &rSt, sal_uInt16 nVersion=3, sal_uInt16 nRecType=ESCHER_OPT)
const sal_uInt16 EXC_ID_OBJCMO
Check box/radio button cell link.
Definition: xlescher.hxx:225
XclExpFileSharing(const XclExpRoot &rRoot, sal_uInt16 nPasswordHash, bool bRecommendReadOnly)
Definition: xcl97rec.cxx:1920
#define OLE_STARCALC_2_EXCEL
const sal_uInt16 EXC_OBJ_DROPDOWN_FILTERED
Definition: xlescher.hxx:201
aBuf
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1771
sal_Int16 nId
#define ESCHER_ShpInst_Ellipse
sal_uInt64 Seek(sal_uInt64 nPos)
ScAddress maScPos
Definition: xcl97rec.hxx:175
virtual OUString getTransformedString(const OUString &rURL) const override
Definition: xcl97rec.cxx:1260
std::shared_ptr< XclExpBiff8Encrypter > XclExpEncrypterRef
Definition: xestream.hxx:46
SDRTEXTVERTADJUST_BLOCK
virtual ~XclExpFileEncryption() override
Definition: xcl97rec.cxx:1837
ScAddress aEnd
Definition: address.hxx:501
void WriteAddress(XclExpStream &rStrm) const
Definition: xcl97rec.cxx:1438
bool IsIter() const
Definition: docoptio.hxx:60
void set_flag(Type &rnBitField, Type nMask, bool bSet=true)
Sets or clears (according to bSet) all set bits of nMask in rnBitField.
Definition: ftools.hxx:94
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:630
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:1562
void SetHorAlign(sal_uInt8 nHorAlign)
Definition: xcl97rec.hxx:222
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+15)
bool IsImpress2PowerPoint() const
static const char * GetEditAs(const XclObjAny &rObj)
Definition: xcl97rec.cxx:1156
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:1051
const sal_uInt16 EXC_OBJ_PIC_MANUALSIZE
Definition: xlescher.hxx:153
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:758
virtual void AddShape(sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID=0)
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
SC_DLLPUBLIC ScRange GetRange(SCTAB nTab, const tools::Rectangle &rMMRect, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1782
bool IsMath2MathType() const
XclExpMsoDrawing * pMsodrawing
Definition: xcl97rec.hxx:106
sal_uInt16 nRupYear
Definition: excrecds.hxx:104
EmbeddedObjectRef * pObject
void SaveTextRecs(XclExpStream &rStrm)
Definition: xcl97rec.cxx:522
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:1791
#define ESCHER_ClientTextbox
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:489
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:1766
void SetPrintable(bool b)
Definition: xcl97rec.hxx:139
sal_uInt16 GetIterCount() const
Definition: docoptio.hxx:62
iterator begin()
Definition: xcl97rec.hxx:73
XclExpStringRef mpString
Definition: xcl97rec.hxx:234
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:487
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1557
virtual void WriteSubRecs(XclExpStream &rStrm)
Definition: xcl97rec.cxx:500
size_t size() const
Definition: xladdress.hxx:109
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1317
ScURLTransformer(ScDocument &rDoc)
Definition: xcl97rec.cxx:1255
const sal_uInt16 EXC_ID_OBJNTS
Scroll bar data.
Definition: xlescher.hxx:217
sal_uInt16 mnRotation
Text and formatting data.
Definition: xcl97rec.hxx:235
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:1826
iterator end()
Definition: xcl97rec.hxx:75
void SetEscherShapeType(sal_uInt16 nType)
Definition: xcl97rec.cxx:418
const sal_uInt16 EXC_ID_OBJFLAGS
Clipboard format.
Definition: xlescher.hxx:212
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:1325
uno::Reference< drawing::XShape > const mxShape
static sal_Int32 mnDrawingMLCount
Definition: xcl97rec.hxx:90
const sal_uInt16 EXC_OBJTYPE_ARC
Definition: xlescher.hxx:54
SvStream & GetStream() const
XclExpInterfaceHdr(sal_uInt16 nCodePage)
Definition: xcl97rec.cxx:1867
Access to global data from other classes.
Definition: xeroot.hxx:113
const sal_uInt16 EXC_FONT_APP
Definition: xlstyle.hxx:77
void WriteText(XclExpStream &rStrm) const
Definition: xcl97rec.cxx:1443
bool isOptionEnabled(Option eOption) const
const css::uno::Reference< css::chart::XChartDocument > & GetChartDoc() const
Definition: xeescher.cxx:1445
SotStorage * OpenSotStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool transacted=true)
XclObjComment(XclExpObjectManager &rObjMgr, const tools::Rectangle &rRect, const EditTextObject &rEditObj, SdrCaptionObj *pCaption, bool bVisible, const ScAddress &rAddress, const tools::Rectangle &rFrom, const tools::Rectangle &To)
Definition: xcl97rec.cxx:543
OUString getNamespaceURL(sal_Int32 nNSID) const
tools::Long Left() const
MS Excel 4.0.
Definition: xlconst.hxx:35
Record which exports a memory data array.
Definition: xerecord.hxx:278
void CreateFillProperties(const css::uno::Reference< css::beans::XPropertySet > &, bool bEdge, bool bTransparentGradient=false)
sal_uInt16 nDocType
Definition: excrecds.hxx:101
ReturnType ulimit_cast(Type nValue, ReturnType nMax)
Returns the value, if it is not greater than nMax, otherwise nMax.
Definition: ftools.hxx:52
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:1378
const sal_uInt16 EXC_ID_CONT
Definition: xlstream.hxx:37
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:1965
#define ESCHER_ShpInst_RoundRectangle
SCTAB GetTab() const
Definition: xcl97rec.hxx:136
void ImplWriteAnchor(const SdrObject *pSdrObj, const tools::Rectangle *pChildAnchor)
Definition: xcl97rec.cxx:405
css::text::WritingMode GetValue() const
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3486
const sal_uInt16 EXC_OBJTYPE_GROUP
Definition: xlescher.hxx:50
tools::Long Bottom() const
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1373
void PushStream(sax_fastparser::FSHelperPtr const &aStream)
Definition: xestream.cxx:916
const OUString & GetUserName() const
Returns the current user name.
Definition: xlroot.hxx:175
void SaveSheetXml(XclExpXmlStream &rStrm, const OUString &aIdFormControlPr) const
Definition: xeescher.cxx:1305
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:1883
bool mbRecommendReadOnly
Definition: xcl97rec.hxx:571
#define ESCHER_ShpInst_HostControl
const OptionalValueType maFrom
bool IsCalc2Excel() const
const SfxItemSet & GetParaAttribs(sal_Int32 nPara) const
void AssignByte(const OUString &rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Assigns an unformatted string, converts this object to a BIFF2-BIFF7 byte string. ...
Definition: xestring.cxx:121
#define ESCHER_ShpInst_Line
#define ESCHER_Prop_LockAgainstGrouping
::std::vector< XclFormatRun > XclFormatRunVec
A vector with all formatting runs for a rich-string.
Definition: xlstring.hxx:85
void SetAutoFill(bool b)
Definition: xcl97rec.hxx:140
XclCalccount(const ScDocument &)
Definition: xcl97rec.cxx:1761
XclRefmode(const ScDocument &)
Definition: xcl97rec.cxx:1990
const sal_uInt8 EXC_OBJ_HOR_JUSTIFY
Definition: xlescher.hxx:126
sax_fastparser::FSHelperPtr & GetCurrentStream()
Definition: xestream.cxx:910
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1806
OUString getRelationship(Relationship eRelationship)
SdrCaptionObj * mpCaption
Definition: xcl97rec.hxx:178
bool bFirstOnSheet
Definition: xcl97rec.hxx:113
void PopStream()
Definition: xestream.cxx:921
OUString GetText(sal_Int32 nPara) const
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:1723
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:1620
virtual ~XclObjComment() override
Definition: xcl97rec.cxx:624
XclCodename(const OUString &)
Definition: xcl97rec.cxx:1410
const sal_uInt16 EXC_ISFPROTECTION
Definition: xlconst.hxx:260
void SetSliceSize(sal_uInt16 nSize)
Sets data slice length.
Definition: xestream.cxx:129
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< XclExpMsoDrawing > pSolverContainer
Definition: xcl97rec.hxx:95
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:145
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
Definition: document.cxx:3628
last item - used to resize the vector
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1923
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:1552
#define ESCHER_Prop_fNoLineDrawDash
ScDocument & mrDoc
Definition: xcl97rec.hxx:48
const sal_uInt8 EXC_OBJ_VER_JUSTIFY
Definition: xlescher.hxx:131
XclObjAny(XclExpObjectManager &rObjMgr, const css::uno::Reference< css::drawing::XShape > &rShape, ScDocument *pDoc)
Definition: xcl97rec.cxx:1059
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1781
static const char * lcl_GetHorizAlignFromItemSetChar(const SfxItemSet &rItemSet)
Definition: xcl97rec.cxx:699
void SetLocked(bool b)
Definition: xcl97rec.hxx:138
SDRTEXTVERTADJUST_BOTTOM
const sal_uInt16 EXC_OBJTYPE_DRAWING
Definition: xlescher.hxx:71
#define ESCHER_ShpInst_TextBox
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1414
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
void ProcessEscherObj(const XclExpRoot &rRoot, const tools::Rectangle &rRect, SdrObject *pCaption, bool bVisible)
c'tor process for formatted text objects above .
Definition: xcl97rec.cxx:600
static const SdrObject * GetSdrObject(const css::uno::Reference< css::drawing::XShape > &rXShape)
const sal_uInt16 EXC_OBJTYPE_DROPDOWN
Definition: xlescher.hxx:69
virtual ~XclExpProt4RevPass() override
Definition: xcl97rec.cxx:1961
const sal_uInt8 EXC_OBJ_HOR_RIGHT
Definition: xlescher.hxx:125
A record with a single value of type Type.
Definition: xerecord.hxx:199
const sal_uInt16 EXC_OBJ_DROPDOWN_SIMPLE
Dropdown listbox with editable text.
Definition: xlescher.hxx:199
ScEnhancedProtection maEnhancedProtection
Definition: xcl97rec.hxx:456
void Assign(const OUString &rString, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Assigns an unformatted string, converts this object to a BIFF8 Unicode string.
Definition: xestring.cxx:111
static SvtFilterOptions & Get()
static const char * lcl_GetVertAlignFromItemSetChar(const SfxItemSet &rItemSet)
Definition: xcl97rec.cxx:714
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
Definition: xeroot.cxx:81
sal_uInt64 GetSvStreamPos() const
Returns the absolute position of the system stream.
Definition: xestream.hxx:139
sal_uInt16 nIter
Definition: xcl97rec.hxx:477
SC_DLLPUBLIC const ScRangeList * GetScenarioRanges(SCTAB nTab) const
Definition: documen3.cxx:864
SvxAdjust
int i
const sal_uInt16 EXC_OBJ_ORIENT_90CW
90 degr. counterclockwise.
Definition: xlescher.hxx:136
SVXCORE_DLLPUBLIC SdrObject * GetSdrObjectFromXShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ScDetectiveObjType
Definition: detfunc.hxx:39
const sal_uInt16 EXC_OBJTYPE_NOTE
Definition: xlescher.hxx:70
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:968
const sal_uInt8 EXC_OBJ_VER_CENTER
Definition: xlescher.hxx:129
void SaveXml(XclExpXmlStream &rStrm) const
Definition: xcl97rec.cxx:1448
ExcEScenario(const XclExpRoot &rRoot, SCTAB nTab)
Definition: xcl97rec.cxx:1458
const OptionalValueType maTo
ExcEScenarioManager(const XclExpRoot &rRoot, SCTAB nTab)
Definition: xcl97rec.cxx:1579
static ScAnchorType GetAnchorType(const SdrObject &)
Definition: drwlayer.cxx:2321
sal_uInt16 nVers
Definition: excrecds.hxx:102
sal_Int16 SCCOL
Definition: types.hxx:22
bool bProtected
Definition: xcl97rec.hxx:391
const SdrObject & rOleObj
Definition: xcl97rec.hxx:246
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:924
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
SC_DLLPUBLIC OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2212
void setSuppressGetBitmap(bool bNew)
Represents an OBJ record for a TBX form control.
Definition: xeescher.hxx:248
XclEscherEx & mrEscherEx
Definition: xcl97rec.hxx:105
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1330
const sal_uInt8 EXC_OBJ_HOR_CENTER
Definition: xlescher.hxx:124
void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj *pSdrCaptionObj, bool bValue)
Definition: xcl97rec.cxx:535
sal_Int64 convertHmmToEmu(sal_Int32 nValue)
Represents the position (anchor) of a cell dropdown object.
Definition: xeescher.hxx:108
static void ResetCounters()
Definition: xcl97rec.cxx:372
A 2D cell range address list with Excel column and row indexes.
Definition: xladdress.hxx:101
size_t size() const
Definition: rangelst.hxx:90
virtual void WriteSubRecs(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1070
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1526
static void WriteFromTo(XclExpXmlStream &rStrm, const XclObjAny &rObj)
Definition: xcl97rec.cxx:1150
const sal_uInt8 nDataBookExt[]
Definition: xcl97rec.cxx:1979
void EndRecord()
Checks and corrects real record length.
Definition: xestream.cxx:120
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:359
XclExpSheetProtectOptions(const XclExpRoot &rRoot, SCTAB nTab)
Definition: xcl97rec.cxx:1658
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:1995
ExcBundlesheet8(const RootData &rRootData, SCTAB nTab)
Definition: xcl97rec.cxx:1351
const sal_uInt16 EXC_ID_OBJ
Definition: xlescher.hxx:45
sal_uInt16 GetObjType() const
Definition: xcl97rec.hxx:131
virtual ~XclExpObjList() override
Definition: xcl97rec.cxx:100
Container for the Excel EnhancedProtection feature.
void SetMergedItem(const SfxPoolItem &rItem)
#define ESCHER_Prop_FitTextToShape
bool Append(sal_uInt16 nCol, sal_uInt16 nRow, const OUString &rTxt)
Definition: xcl97rec.cxx:1515
virtual ~ExcEScenarioManager() override
Definition: xcl97rec.cxx:1599
sal_uInt8 mnVerAlign
Horizontal alignment.
Definition: xcl97rec.hxx:237
XclExpString sText
Definition: xcl97rec.hxx:369
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1972
SCTAB mnScTab
Definition: xcl97rec.hxx:112
const sal_uInt16 EXC_OBJTYPE_RECTANGLE
Definition: xlescher.hxx:52
const sal_uInt8 EXC_STRF_16BIT
Definition: xlstring.hxx:45
bool IsWriter2WinWord() const
XclObjOle(XclExpObjectManager &rObjMgr, const SdrObject &rObj)
Definition: xcl97rec.cxx:975
XclExpObjList(const XclExpRoot &rRoot, XclEscherEx &rEscherEx)
Definition: xcl97rec.cxx:87
#define XESTRING_TO_PSZ(s)
Definition: xestream.hxx:231
const sal_uInt8 EXC_OBJ_VER_BOTTOM
Definition: xlescher.hxx:130
XclExpString sName
Definition: xcl97rec.hxx:388
tools::Long Top() const
void CopyFromStream(SvStream &rInStrm, sal_uInt64 nBytes=STREAM_SEEK_TO_END)
Copies nBytes bytes from current position of the stream rInStrm.
Definition: xestream.cxx:283
SC_DLLPUBLIC bool HasValueData(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3765
XclDelta(const ScDocument &)
Definition: xcl97rec.cxx:1811
XclExpString maUserName
Definition: xcl97rec.hxx:569
virtual ~XclObjAny() override
Definition: xcl97rec.cxx:1066
std::shared_ptr< FastSerializerHelper > FSHelperPtr
std::vector< std::unique_ptr< XclObj > > maObjs
Definition: xcl97rec.hxx:97
sal_uInt16 mnObjType
Definition: xcl97rec.hxx:109
bool GetBool() const
Returns the Boolean value of the record.
Definition: xerecord.hxx:264
const XclExpRoot & mrRoot
Definition: xcl97rec.hxx:522
#define EXC_SCEN_MAXCELL
Definition: excdefs.hxx:58
SCCOL Col() const
Definition: address.hxx:267
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:119
#define ESCHER_Prop_shadowColor
std::unique_ptr< XclTxo > pTxo
Definition: xcl97rec.hxx:108
virtual void WriteSubRecs(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:986
#define ESCHER_Prop_fillBackColor
static OUString GetStreamName(const char *sStreamDir, const char *sStream, sal_Int32 nId)
Definition: xestream.cxx:683
SC_DLLPUBLIC void GetScenarioData(SCTAB nTab, OUString &rComment, Color &rColor, ScScenarioFlags &rFlags) const
Definition: documen3.cxx:463
One or more MSODRAWING records contain the DFF stream data for a drawing shape.
Definition: xeescher.hxx:142
const sal_uInt16 EXC_OBJTYPE_CHECKBOX
Definition: xlescher.hxx:60
#define ESCHER_Prop_fillColor
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1403
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:89
static SC_DLLPUBLIC const LocaleDataWrapper * getLocaleDataPtr()
Definition: global.cxx:1002
sal_Int32 SCROW
Definition: types.hxx:18
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:1898
#define ESCHER_SpContainer
SCTAB mnScTab
Definition: xcl97rec.hxx:91
static sal_uInt8 lcl_GetHorAlignFromItemSet(const SfxItemSet &rItemSet)
Definition: xcl97rec.cxx:818
OUString SaveControlPropertiesXml(XclExpXmlStream &rStrm) const
Definition: xeescher.cxx:1243
void WriteZeroBytesToRecord(std::size_t nBytes)
Definition: xestream.cxx:273
virtual void CloseContainer()
bool mbVisible
sal_uInt16 Len() const
Returns the character count of the string.
Definition: xestring.hxx:114
#define ESCHER_ShpInst_PictureFrame
sal_uInt16 nGrbit
Definition: xcl97rec.hxx:111
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:427
void AddAtom(sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion=0, int nRecInstance=0)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SAL_WARN_IF(condition, area, stream)
#define ESCHER_ShpInst_Rectangle
unsigned char sal_uInt8
const sal_uInt8 EXC_OBJ_VER_TOP
Definition: xlescher.hxx:128
sal_uInt16 Add(std::unique_ptr< XclObj >)
return: 1-based ObjId count>=0xFFFF: Obj will be deleted, return 0
Definition: xcl97rec.cxx:107
sal_uInt16 nRow
Definition: xcl97rec.hxx:368
std::size_t GetSize() const
Returns the byte count the whole string will take on export.
Definition: xestring.cxx:248
const sal_uInt16 EXC_ID_FILESHARING
Definition: xlcontent.hxx:29
#define ESCHER_Prop_fNoFillHitTest
void setShapeId(sal_Int32 aShapeId)
Definition: xeescher.cxx:1090
virtual void OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance=0)
void ExportOLEObject(svt::EmbeddedObjectRef const &rObj, SotStorage &rDestStg)
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1796
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:1937
sal_uInt32 mnPasswordVerifier
OUString aName
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:1638
const SfxItemSet & GetMergedItemSet() const
const sal_uInt16 EXC_ID_OBJLBSDATA
Check box/radio button data.
Definition: xlescher.hxx:223
Always use UCS-2 characters (default: try to compress). BIFF8 only.
sax_fastparser::FSHelperPtr CreateOutputStream(const OUString &sFullStream, const OUString &sRelativeStream, const css::uno::Reference< css::io::XOutputStream > &xParentRelation, const char *sContentType, std::u16string_view sRelationshipType, OUString *pRelationshipId=nullptr)
Definition: xestream.cxx:939
css::uno::Reference< css::drawing::XShape > mxShape
Definition: xcl97rec.hxx:281
::std::vector< sal_uInt8 > maSecurityDescriptor
virtual sal_uInt32 EnterGroup(const OUString &rShapeName, const tools::Rectangle *pBoundRect)
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1742
std::unique_ptr< XclExpMsoDrawing > pMsodrawingPerSheet
Definition: xcl97rec.hxx:94
void WriteDffData(EscherEx &rEscherEx) const
Writes the DFF client anchor structure with the current anchor position.
Definition: xeescher.cxx:267
XclExpString sComment
Definition: xcl97rec.hxx:389
virtual ~XclObj() override
Definition: xcl97rec.cxx:397
virtual sal_uInt16 GetNum() const override
Definition: xcl97rec.cxx:1816
double GetIterEps() const
Definition: docoptio.hxx:64
void insert_value(Type &rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount)
Inserts a value into a bitfield.
Definition: ftools.hxx:101
void AddOpt(sal_uInt16 nPropID, bool bBlib, sal_uInt32 nSizeReduction, SvMemoryStream &rStream)
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
XclExpString sUserName
Definition: xcl97rec.hxx:390
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
const sal_uInt8 EXC_OBJ_HOR_LEFT
Definition: xlescher.hxx:123
const sal_uInt16 EXC_OBJTYPE_CHART
Definition: xlescher.hxx:55
void DisableEncryption()
Definition: xestream.cxx:363
const sal_uInt8 nDataRecalcId[]
Definition: xcl97rec.cxx:1970
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:1695
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
SC_DLLPUBLIC ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1899
A chart object.
Definition: xeescher.hxx:306
virtual ~XclObjOle() override
Definition: xcl97rec.cxx:982
const sal_uInt16 EXC_OBJTYPE_LINE
Definition: xlescher.hxx:51
SVXCORE_DLLPUBLIC css::uno::Reference< css::drawing::XShape > GetXShapeForSdrObject(SdrObject *pObj)
This class provides methods to create an XclExpString.
Definition: xehelper.hxx:212
void StartRecord(sal_uInt16 nRecId, std::size_t nRecSize)
Starts a new record: writes header data, stores calculated record size.
Definition: xestream.cxx:108
OUString sId
static sal_uInt8 lcl_GetVerAlignFromItemSet(const SfxItemSet &rItemSet)
Definition: xcl97rec.cxx:833
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
double fDelta
Definition: xcl97rec.hxx:492
std::vector< ExcEScenario > aScenes
Definition: xcl97rec.hxx:413
const sal_uInt16 EXC_OBJTYPE_TEXT
Definition: xlescher.hxx:56
XclObj(XclExpObjectManager &rObjMgr, sal_uInt16 nObjType, bool bOwnEscher=false)
true = Escher part created on the fly.
Definition: xcl97rec.cxx:380
const sal_uInt16 EXC_OBJTYPE_OVAL
Definition: xlescher.hxx:53
void AddChildAnchor(const tools::Rectangle &rRectangle)
virtual ~XclExpWriteAccess() override
Definition: xcl97rec.cxx:1894
void EnableEncryption(bool bEnable=true)
Definition: xestream.cxx:358
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1548
virtual ~XclObjDropDown() override
Definition: xcl97rec.cxx:795
virtual ~XclExpInterfaceEnd() override
Definition: xcl97rec.cxx:1881
sal_uInt16 nCol
Definition: xcl97rec.hxx:367
std::size_t nRecLen
Definition: xcl97rec.hxx:387
ScRefFlags
Definition: address.hxx:145
#define OLE_STARMATH_2_MATHTYPE
#define ESCHER_Prop_fPrint
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:86
#define ESCHER_ShpInst_Arc
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xcl97rec.cxx:1776
bool GetOpt(sal_uInt16 nPropertyID, sal_uInt32 &rPropValue) const
static sal_Int32 getNewDrawingUniqueId()
Definition: xcl97rec.hxx:87
const css::uno::Reference< css::drawing::XShape > & GetShape() const
Definition: xcl97rec.hxx:272
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1756
const sal_uInt16 EXC_OBJTYPE_PICTURE
Definition: xlescher.hxx:58
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1821
XclExpString aName
Definition: xcl97rec.hxx:350
virtual bool isExternalURL(const OUString &rURL) const override
Definition: xcl97rec.cxx:1267
static void lcl_FillProps(EscherPropertyContainer &rPropOpt, SdrObject *pCaption, bool bVisible)
Definition: xcl97rec.cxx:563
void WriteFlagField(XclExpStream &rStrm) const
Writes the string flags field (1 byte).
Definition: xestring.cxx:279
XclExpSheetEnhancedProtection(const XclExpRoot &rRoot, const ScEnhancedProtection &rProt)
Definition: xcl97rec.cxx:1715
static sal_Int32 mnVmlCount
Definition: xcl97rec.hxx:90
XclExpMsoDrawing * GetMsodrawingPerSheet()
Definition: xeescher.cxx:1833
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:213
void EndSheet()
close groups and DgContainer opened in ctor
Definition: xcl97rec.cxx:135
std::size_t GetBufferSize() const
Returns the byte count the character buffer will take on export.
Definition: xestring.cxx:243
std::size_t GetStringBytes() const
Definition: xcl97rec.hxx:375
sal_uInt64 m_nOwnPos
Definition: excrecds.hxx:239
tools::Long Right() const
std::vector< ExcEScenarioCell > aCells
Definition: xcl97rec.hxx:393
ExcEScenarioCell(sal_uInt16 nC, sal_uInt16 nR, const OUString &rTxt)
Definition: xcl97rec.cxx:1431
const XclExpRoot & mrRoot
Definition: xcl97rec.hxx:455
#define OLE_STARWRITER_2_WINWORD
void Write(XclExpStream &rStrm, bool bCol16Bit=true, sal_uInt16 nCountInStream=0) const
Definition: xladdress.cxx:103
const sal_uInt16 EXC_ID_OBJCF
Group marker.
Definition: xlescher.hxx:211
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xcl97rec.cxx:1951
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1424
Base class for single records with any content.
Definition: xerecord.hxx:143
sal_Int16 SCTAB
Definition: types.hxx:23
#define ESCHER_Prop_lTxid
Record which contains a Boolean value.
Definition: xerecord.hxx:255
ScDetectiveObjType GetDetectiveObjectType(SdrObject *pObject, SCTAB nObjTab, ScAddress &rPosition, ScRange &rSource, bool &rRedLine)
Definition: detfunc.cxx:1625
const sal_uInt16 EXC_ID_OBJGMO
Button data.
Definition: xlescher.hxx:210
virtual std::size_t GetLen() const override
Definition: xcl97rec.cxx:1643
sal_Int16 nValue
#define ESCHER_ClientData
XclObjDropDown(XclExpObjectManager &rObjMgr, const ScAddress &rPos, bool bFilt)
Definition: xcl97rec.cxx:766
virtual void SaveCont(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1363
SDRTEXTVERTADJUST_CENTER
void WriteZeroBytes(std::size_t nBytes)
Writes a sequence of nBytes zero bytes (respects slice setting).
Definition: xestream.cxx:256
void AddRecSize(std::size_t nRecSize)
Adds a size value to the record size prediction.
Definition: xerecord.hxx:166
static OUString decode(OUString const &rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)