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