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