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