LibreOffice Module sc (master)  1
xeescher.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 <xeescher.hxx>
21 
22 #include <com/sun/star/lang/XServiceInfo.hpp>
23 #include <com/sun/star/form/FormComponentType.hpp>
24 #include <com/sun/star/awt/VisualEffect.hpp>
25 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
26 #include <com/sun/star/awt/XControlModel.hpp>
27 #include <com/sun/star/drawing/XShape.hpp>
28 #include <com/sun/star/form/binding/XBindableValue.hpp>
29 #include <com/sun/star/form/binding/XListEntrySink.hpp>
30 #include <com/sun/star/awt/Size.hpp>
31 #include <com/sun/star/chart/XChartDocument.hpp>
32 
33 #include <set>
34 #include <vcl/BitmapReadAccess.hxx>
35 #include <svx/svdoole2.hxx>
36 #include <svx/svdocapt.hxx>
37 #include <editeng/outlobj.hxx>
38 #include <unotools/tempfile.hxx>
40 #include <svtools/embedhlp.hxx>
41 
42 #include <unonames.hxx>
43 #include <convuno.hxx>
44 #include <postit.hxx>
45 
46 #include <fapihelper.hxx>
47 #include <xcl97esc.hxx>
48 #include <xechart.hxx>
49 #include <xeformula.hxx>
50 #include <xehelper.hxx>
51 #include <xelink.hxx>
52 #include <xename.hxx>
53 #include <xestyle.hxx>
54 #include <xllink.hxx>
55 #include <xltools.hxx>
56 #include <userdat.hxx>
57 #include <drwlayer.hxx>
58 #include <svl/itemset.hxx>
59 #include <svx/sdtaitm.hxx>
60 #include <document.hxx>
61 #include <svx/xfillit0.hxx>
62 #include <svx/xflclit.hxx>
63 
64 #include <comphelper/sequence.hxx>
65 #include <oox/token/tokens.hxx>
67 #include <oox/export/drawingml.hxx>
69 #include <oox/export/utils.hxx>
70 #include <oox/token/namespaces.hxx>
71 #include <oox/export/vmlexport.hxx>
72 #include <memory>
73 
74 using namespace com::sun::star;
75 using ::com::sun::star::uno::UNO_QUERY;
76 using ::com::sun::star::uno::Reference;
77 using ::com::sun::star::uno::Sequence;
78 using ::com::sun::star::lang::XServiceInfo;
79 using ::com::sun::star::beans::XPropertySet;
80 using ::com::sun::star::drawing::XShape;
81 using ::com::sun::star::drawing::XShapes;
82 using ::com::sun::star::frame::XModel;
83 using ::com::sun::star::awt::XControlModel;
84 using ::com::sun::star::form::binding::XBindableValue;
85 using ::com::sun::star::form::binding::XListEntrySink;
86 using ::com::sun::star::script::ScriptEventDescriptor;
87 using ::com::sun::star::table::CellAddress;
88 using ::com::sun::star::table::CellRangeAddress;
89 using ::oox::drawingml::DrawingML;
90 using ::oox::drawingml::ChartExport;
91 using namespace oox;
92 
93 namespace
94 {
95 
96 const char *ToHorizAlign( SdrTextHorzAdjust eAdjust )
97 {
98  switch( eAdjust )
99  {
101  return "center";
103  return "right";
105  return "justify";
107  default:
108  return "left";
109  }
110 }
111 
112 const char *ToVertAlign( SdrTextVertAdjust eAdjust )
113 {
114  switch( eAdjust )
115  {
117  return "center";
119  return "bottom";
121  return "justify";
123  default:
124  return "top";
125  }
126 }
127 
128 void lcl_WriteAnchorVertex( sax_fastparser::FSHelperPtr const & rComments, const tools::Rectangle &aRect )
129 {
130  rComments->startElement(FSNS(XML_xdr, XML_col));
131  rComments->writeEscaped( OUString::number( aRect.Left() ) );
132  rComments->endElement( FSNS( XML_xdr, XML_col ) );
133  rComments->startElement(FSNS(XML_xdr, XML_colOff));
134  rComments->writeEscaped( OUString::number( aRect.Top() ) );
135  rComments->endElement( FSNS( XML_xdr, XML_colOff ) );
136  rComments->startElement(FSNS(XML_xdr, XML_row));
137  rComments->writeEscaped( OUString::number( aRect.Right() ) );
138  rComments->endElement( FSNS( XML_xdr, XML_row ) );
139  rComments->startElement(FSNS(XML_xdr, XML_rowOff));
140  rComments->writeEscaped( OUString::number( aRect.Bottom() ) );
141  rComments->endElement( FSNS( XML_xdr, XML_rowOff ) );
142 }
143 
144 tools::Long lcl_hmm2output(tools::Long value, bool bInEMU)
145 {
147 }
148 
149 void lcl_GetFromTo( const XclExpRoot& rRoot, const tools::Rectangle &aRect, sal_Int32 nTab, tools::Rectangle &aFrom, tools::Rectangle &aTo, bool bInEMU = false )
150 {
151  sal_Int32 nCol = 0, nRow = 0;
152  sal_Int32 nColOff = 0, nRowOff= 0;
153 
154  const bool bRTL = rRoot.GetDoc().IsNegativePage( nTab );
155  if (!bRTL)
156  {
157  while(true)
158  {
159  tools::Rectangle r = rRoot.GetDoc().GetMMRect( nCol,nRow,nCol,nRow,nTab );
160  if( r.Left() <= aRect.Left() )
161  {
162  nCol++;
163  nColOff = aRect.Left() - r.Left();
164  }
165  if( r.Top() <= aRect.Top() )
166  {
167  nRow++;
168  nRowOff = aRect.Top() - r.Top();
169  }
170  if( r.Left() > aRect.Left() && r.Top() > aRect.Top() )
171  {
172  aFrom = tools::Rectangle( nCol-1, lcl_hmm2output( nColOff, bInEMU ),
173  nRow-1, lcl_hmm2output( nRowOff, bInEMU ) );
174  break;
175  }
176  }
177  }
178  else
179  {
180  while(true)
181  {
182  tools::Rectangle r = rRoot.GetDoc().GetMMRect( nCol,nRow,nCol,nRow,nTab );
183  if( r.Left() >= aRect.Left() )
184  {
185  nCol++;
186  nColOff = r.Left() - aRect.Left();
187  }
188  if( r.Top() <= aRect.Top() )
189  {
190  nRow++;
191  nRowOff = aRect.Top() - r.Top();
192  }
193  if( r.Left() < aRect.Left() && r.Top() > aRect.Top() )
194  {
195  aFrom = tools::Rectangle( nCol-1, lcl_hmm2output( nColOff, bInEMU ),
196  nRow-1, lcl_hmm2output( nRowOff, bInEMU ) );
197  break;
198  }
199  }
200  }
201  if (!bRTL)
202  {
203  while(true)
204  {
205  tools::Rectangle r = rRoot.GetDoc().GetMMRect( nCol,nRow,nCol,nRow,nTab );
206  if( r.Right() < aRect.Right() )
207  nCol++;
208  if( r.Bottom() < aRect.Bottom() )
209  nRow++;
210  if( r.Right() >= aRect.Right() && r.Bottom() >= aRect.Bottom() )
211  {
212  aTo = tools::Rectangle( nCol, lcl_hmm2output( aRect.Right() - r.Left(), bInEMU ),
213  nRow, lcl_hmm2output( aRect.Bottom() - r.Top(), bInEMU ));
214  break;
215  }
216  }
217  }
218  else
219  {
220  while(true)
221  {
222  tools::Rectangle r = rRoot.GetDoc().GetMMRect( nCol,nRow,nCol,nRow,nTab );
223  if( r.Right() >= aRect.Right() )
224  nCol++;
225  if( r.Bottom() < aRect.Bottom() )
226  nRow++;
227  if( r.Right() < aRect.Right() && r.Bottom() >= aRect.Bottom() )
228  {
229  aTo = tools::Rectangle( nCol, lcl_hmm2output( r.Left() - aRect.Right(), bInEMU ),
230  nRow, lcl_hmm2output( aRect.Bottom() - r.Top(), bInEMU ));
231  break;
232  }
233  }
234  }
235 }
236 
237 } // namespace
238 
239 // Escher client anchor =======================================================
240 
241 XclExpDffAnchorBase::XclExpDffAnchorBase( const XclExpRoot& rRoot, sal_uInt16 nFlags ) :
242  XclExpRoot( rRoot ),
243  mnFlags( nFlags )
244 {
245 }
246 
248 {
249  ImplSetFlags( rSdrObj );
250 }
251 
253 {
254  ImplSetFlags( rSdrObj );
255  ImplCalcAnchorRect( rSdrObj.GetCurrentBoundRect(), MapUnit::Map100thMM );
256 }
257 
259 {
260  rEscherEx.AddAtom( 18, ESCHER_ClientAnchor );
261  rEscherEx.GetStream().WriteUInt16( mnFlags );
262  WriteXclObjAnchor( rEscherEx.GetStream(), maAnchor );
263 }
264 
266 {
267  // the passed rectangle is in twips
268  ImplCalcAnchorRect( rRect, MapUnit::MapTwip );
269  WriteDffData( rEscherEx );
270 }
271 
273 {
274  OSL_FAIL( "XclExpDffAnchorBase::ImplSetFlags - not implemented" );
275 }
276 
278 {
279  OSL_FAIL( "XclExpDffAnchorBase::ImplCalcAnchorRect - not implemented" );
280 }
281 
283  XclExpDffAnchorBase( rRoot ),
284  mnScTab( rRoot.GetCurrScTab() )
285 {
286 }
287 
289 {
290  // set flags for cell/page anchoring
291  if ( ScDrawLayer::GetAnchorType( rSdrObj ) == SCA_CELL )
292  mnFlags = 0;
293  else
295 }
296 
298 {
299  maAnchor.SetRect( GetRoot(), mnScTab, rRect, eMapUnit );
300 }
301 
303  const Size& rPageSize, sal_Int32 nScaleX, sal_Int32 nScaleY ) :
304  XclExpDffAnchorBase( rRoot ),
305  maPageSize( rPageSize ),
306  mnScaleX( nScaleX ),
307  mnScaleY( nScaleY )
308 {
309 }
310 
312 {
313  // TODO (unsupported feature): fixed size
314 }
315 
317 {
318  maAnchor.SetRect( maPageSize, mnScaleX, mnScaleY, rRect, eMapUnit );
319 }
320 
323 {
324  maAnchor.SetRect( rRoot, rRoot.GetCurrScTab(), rRect, MapUnit::Map100thMM );
325 }
326 
329 {
334 }
335 
336 // MSODRAWING* records ========================================================
337 
338 XclExpMsoDrawingBase::XclExpMsoDrawingBase( XclEscherEx& rEscherEx, sal_uInt16 nRecId ) :
339  XclExpRecord( nRecId ),
340  mrEscherEx( rEscherEx ),
341  mnFragmentKey( rEscherEx.InitNextDffFragment() )
342 {
343 }
344 
346 {
348  "XclExpMsoDrawingBase::WriteBody - DFF stream position mismatch" );
350 }
351 
354 {
355  SvStream& rDffStrm = mrEscherEx.GetStream();
356 
357  // write the DGGCONTAINER with some default settings
359 
360  // TODO: stuff the OPT atom with our own document defaults?
361  static const sal_uInt8 spnDffOpt[] = {
362  0xBF, 0x00, 0x08, 0x00, 0x08, 0x00, 0x81, 0x01,
363  0x09, 0x00, 0x00, 0x08, 0xC0, 0x01, 0x40, 0x00,
364  0x00, 0x08
365  };
366  mrEscherEx.AddAtom( sizeof( spnDffOpt ), ESCHER_OPT, 3, 3 );
367  rDffStrm.WriteBytes(spnDffOpt, sizeof(spnDffOpt));
368 
369  // SPLITMENUCOLORS contains colors in toolbar
370  static const sal_uInt8 spnDffSplitMenuColors[] = {
371  0x0D, 0x00, 0x00, 0x08, 0x0C, 0x00, 0x00, 0x08,
372  0x17, 0x00, 0x00, 0x08, 0xF7, 0x00, 0x00, 0x10
373  };
374  mrEscherEx.AddAtom( sizeof( spnDffSplitMenuColors ), ESCHER_SplitMenuColors, 0, 4 );
375  rDffStrm.WriteBytes(spnDffSplitMenuColors, sizeof(spnDffSplitMenuColors));
376 
377  // close the DGGCONTAINER
380 }
381 
384 {
385 }
386 
387 XclExpImgData::XclExpImgData( const Graphic& rGraphic, sal_uInt16 nRecId ) :
388  maGraphic( rGraphic ),
389  mnRecId( nRecId )
390 {
391 }
392 
394 {
397  aBmp.Convert( BmpConversion::N24Bit );
398 
399  Bitmap::ScopedReadAccess pAccess(aBmp);
400  if( !pAccess )
401  return;
402 
403  sal_Int32 nWidth = ::std::min< sal_Int32 >( pAccess->Width(), 0xFFFF );
404  sal_Int32 nHeight = ::std::min< sal_Int32 >( pAccess->Height(), 0xFFFF );
405  if( (nWidth <= 0) || (nHeight <= 0) )
406  return;
407 
408  sal_uInt8 nPadding = static_cast< sal_uInt8 >( nWidth & 0x03 );
409  sal_uInt32 nTmpSize = static_cast< sal_uInt32 >( (nWidth * 3 + nPadding) * nHeight + 12 );
410 
411  rStrm.StartRecord( mnRecId, nTmpSize + 4 );
412 
413  rStrm << EXC_IMGDATA_BMP // BMP format
414  << EXC_IMGDATA_WIN // Windows
415  << nTmpSize // size after _this_ field
416  << sal_uInt32( 12 ) // BITMAPCOREHEADER size
417  << static_cast< sal_uInt16 >( nWidth ) // width
418  << static_cast< sal_uInt16 >( nHeight ) // height
419  << sal_uInt16( 1 ) // planes
420  << sal_uInt16( 24 ); // bits per pixel
421 
422  for( sal_Int32 nY = nHeight - 1; nY >= 0; --nY )
423  {
424  Scanline pScanline = pAccess->GetScanline( nY );
425  for( sal_Int32 nX = 0; nX < nWidth; ++nX )
426  {
427  const BitmapColor& rBmpColor = pAccess->GetPixelFromData( pScanline, nX );
428  rStrm << rBmpColor.GetBlue() << rBmpColor.GetGreen() << rBmpColor.GetRed();
429  }
430  rStrm.WriteZeroBytes( nPadding );
431  }
432 
433  rStrm.EndRecord();
434 }
435 
437 {
438  sax_fastparser::FSHelperPtr pWorksheet = rStrm.GetCurrentStream();
439 
440  DrawingML aDML(pWorksheet, &rStrm, drawingml::DOCUMENT_XLSX);
441  OUString rId = aDML.WriteImage( maGraphic );
442  pWorksheet->singleElement(XML_picture, FSNS(XML_r, XML_id), rId);
443 }
444 
446  XclExpRoot( rRoot ),
447  mnEntryCount( 0 )
448 {
449 }
450 
452 {
453 }
454 
455 void XclExpControlHelper::ConvertSheetLinks( Reference< XShape > const & xShape )
456 {
457  mxCellLink.reset();
459  mxSrcRange.reset();
460  mnEntryCount = 0;
461 
462  // get control model
463  Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( xShape );
464  if( !xCtrlModel.is() )
465  return;
466 
467  // *** cell link *** ------------------------------------------------------
468 
469  Reference< XBindableValue > xBindable( xCtrlModel, UNO_QUERY );
470  if( xBindable.is() )
471  {
472  Reference< XServiceInfo > xServInfo( xBindable->getValueBinding(), UNO_QUERY );
473  if( xServInfo.is() && xServInfo->supportsService( SC_SERVICENAME_VALBIND ) )
474  {
475  ScfPropertySet aBindProp( xServInfo );
476  CellAddress aApiAddress;
477  if( aBindProp.GetProperty( aApiAddress, SC_UNONAME_BOUNDCELL ) )
478  {
480  if( GetTabInfo().IsExportTab( mxCellLinkAddress.Tab() ) )
482  }
483  }
484  }
485 
486  // *** source range *** ---------------------------------------------------
487 
488  Reference< XListEntrySink > xEntrySink( xCtrlModel, UNO_QUERY );
489  if( !xEntrySink.is() )
490  return;
491 
492  Reference< XServiceInfo > xServInfo( xEntrySink->getListEntrySource(), UNO_QUERY );
493  if( !(xServInfo.is() && xServInfo->supportsService( SC_SERVICENAME_LISTSOURCE )) )
494  return;
495 
496  ScfPropertySet aSinkProp( xServInfo );
497  CellRangeAddress aApiRange;
498  if( aSinkProp.GetProperty( aApiRange, SC_UNONAME_CELLRANGE ) )
499  {
500  ScRange aSrcRange;
501  ScUnoConversion::FillScRange( aSrcRange, aApiRange );
502  if( (aSrcRange.aStart.Tab() == aSrcRange.aEnd.Tab()) && GetTabInfo().IsExportTab( aSrcRange.aStart.Tab() ) )
504  mnEntryCount = static_cast< sal_uInt16 >( aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1 );
505  }
506 }
507 
509 {
510  sal_uInt16 nFmlaSize = rTokArr.GetSize();
511  rStrm << nFmlaSize << sal_uInt32( 0 );
512  rTokArr.WriteArray( rStrm );
513  if( nFmlaSize & 1 ) // pad to 16-bit
514  rStrm << sal_uInt8( 0 );
515 }
516 
517 void XclExpControlHelper::WriteFormulaSubRec( XclExpStream& rStrm, sal_uInt16 nSubRecId, const XclTokenArray& rTokArr )
518 {
519  rStrm.StartRecord( nSubRecId, (rTokArr.GetSize() + 5) & ~1 );
520  WriteFormula( rStrm, rTokArr );
521  rStrm.EndRecord();
522 }
523 
524 //delete for exporting OCX
525 //#if EXC_EXP_OCX_CTRL
526 
527 XclExpOcxControlObj::XclExpOcxControlObj( XclExpObjectManager& rObjMgr, Reference< XShape > const & xShape,
528  const tools::Rectangle* pChildAnchor, const OUString& rClassName, sal_uInt32 nStrmStart, sal_uInt32 nStrmSize ) :
529  XclObj( rObjMgr, EXC_OBJTYPE_PICTURE, true ),
530  XclExpControlHelper( rObjMgr.GetRoot() ),
531  maClassName( rClassName ),
532  mnStrmStart( nStrmStart ),
533  mnStrmSize( nStrmSize )
534 {
535  ScfPropertySet aCtrlProp( XclControlHelper::GetControlModel( xShape ) );
536 
537  // OBJ record flags
538  SetLocked( true );
539  SetPrintable( aCtrlProp.GetBoolProperty( "Printable" ) );
540  SetAutoFill( false );
541  SetAutoLine( false );
542 
543  // fill DFF property set
546  ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor | ShapeFlag::OLEShape );
547  tools::Rectangle aDummyRect;
549  aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 ); // bool field
550  aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x08000040 );
551  aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080000 ); // bool field
552 
553  // #i51348# name of the control, may overwrite shape name
554  OUString aCtrlName;
555  if( aCtrlProp.GetProperty( aCtrlName, "Name" ) && !aCtrlName.isEmpty() )
556  aPropOpt.AddOpt( ESCHER_Prop_wzName, aCtrlName );
557 
558  // meta file
559  //TODO - needs check
560  Reference< XPropertySet > xShapePS( xShape, UNO_QUERY );
561  if( xShapePS.is() && aPropOpt.CreateGraphicProperties( xShapePS, "MetaFile", false ) )
562  {
563  sal_uInt32 nBlipId;
564  if( aPropOpt.GetOpt( ESCHER_Prop_pib, nBlipId ) )
565  aPropOpt.AddOpt( ESCHER_Prop_pictureId, nBlipId );
566  }
567 
568  // write DFF property set to stream
569  aPropOpt.Commit( mrEscherEx.GetStream() );
570 
571  // anchor
572  ImplWriteAnchor( SdrObject::getSdrObjectFromXShape( xShape ), pChildAnchor );
573 
574  mrEscherEx.AddAtom( 0, ESCHER_ClientData ); // OBJ record
575  mrEscherEx.CloseContainer(); // ESCHER_SpContainer
577 
578  // spreadsheet links
579  ConvertSheetLinks( xShape );
580 }
581 
583 {
584  // OBJCF - clipboard format
585  rStrm.StartRecord( EXC_ID_OBJCF, 2 );
586  rStrm << sal_uInt16( 2 );
587  rStrm.EndRecord();
588 
589  // OBJFLAGS
590  rStrm.StartRecord( EXC_ID_OBJFLAGS, 2 );
591  rStrm << sal_uInt16( 0x0031 );
592  rStrm.EndRecord();
593 
594  // OBJPICTFMLA
595  XclExpString aClass( maClassName );
596  sal_uInt16 nClassNameSize = static_cast< sal_uInt16 >( aClass.GetSize() );
597  sal_uInt16 nClassNamePad = nClassNameSize & 1;
598  sal_uInt16 nFirstPartSize = 12 + nClassNameSize + nClassNamePad;
599 
600  const XclTokenArray* pCellLink = GetCellLinkTokArr();
601  sal_uInt16 nCellLinkSize = pCellLink ? ((pCellLink->GetSize() + 7) & 0xFFFE) : 0;
602 
603  const XclTokenArray* pSrcRange = GetSourceRangeTokArr();
604  sal_uInt16 nSrcRangeSize = pSrcRange ? ((pSrcRange->GetSize() + 7) & 0xFFFE) : 0;
605 
606  sal_uInt16 nPictFmlaSize = nFirstPartSize + nCellLinkSize + nSrcRangeSize + 18;
607  rStrm.StartRecord( EXC_ID_OBJPICTFMLA, nPictFmlaSize );
608 
609  rStrm << nFirstPartSize // size of first part
610  << sal_uInt16( 5 ) // formula size
611  << sal_uInt32( 0 ) // unknown ID
612  << sal_uInt8( 0x02 ) << sal_uInt32( 0 ) // tTbl token with unknown ID
613  << sal_uInt8( 3 ) // pad to word
614  << aClass; // "Forms.***.1"
615  rStrm.WriteZeroBytes( nClassNamePad ); // pad to word
616  rStrm << mnStrmStart // start in 'Ctls' stream
617  << mnStrmSize // size in 'Ctls' stream
618  << sal_uInt32( 0 ); // class ID size
619  // cell link
620  rStrm << nCellLinkSize;
621  if( pCellLink )
622  WriteFormula( rStrm, *pCellLink );
623  // list source range
624  rStrm << nSrcRangeSize;
625  if( pSrcRange )
626  WriteFormula( rStrm, *pSrcRange );
627 
628  rStrm.EndRecord();
629 }
630 
631 //#else
632 
633 XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< XShape > const & xShape , const tools::Rectangle* pChildAnchor ) :
634  XclObj( rRoot, EXC_OBJTYPE_UNKNOWN, true ),
635  XclMacroHelper( rRoot ),
636  mxShape( xShape ),
637  meEventType( EXC_TBX_EVENT_ACTION ),
638  mnHeight( 0 ),
639  mnState( 0 ),
640  mnLineCount( 0 ),
641  mnSelEntry( 0 ),
642  mnScrollValue( 0 ),
643  mnScrollMin( 0 ),
644  mnScrollMax( 100 ),
645  mnScrollStep( 1 ),
646  mnScrollPage( 10 ),
647  mbFlatButton( false ),
648  mbFlatBorder( false ),
649  mbMultiSel( false ),
650  mbScrollHor( false ),
651  mbPrint( false ),
652  mbVisible( false ),
653  mnShapeId( 0 ),
654  mrRoot(rRoot)
655 {
656  namespace FormCompType = css::form::FormComponentType;
657  namespace AwtVisualEffect = css::awt::VisualEffect;
658  namespace AwtScrollOrient = css::awt::ScrollBarOrientation;
659 
660  ScfPropertySet aCtrlProp( XclControlHelper::GetControlModel( xShape ) );
661  if( !xShape.is() || !aCtrlProp.Is() )
662  return;
663 
664  mnHeight = xShape->getSize().Height;
665  if( mnHeight <= 0 )
666  return;
667 
668  // control type
669  sal_Int16 nClassId = 0;
670  if( aCtrlProp.GetProperty( nClassId, "ClassId" ) )
671  {
672  switch( nClassId )
673  {
674  case FormCompType::COMMANDBUTTON: mnObjType = EXC_OBJTYPE_BUTTON; meEventType = EXC_TBX_EVENT_ACTION; break;
675  case FormCompType::RADIOBUTTON: mnObjType = EXC_OBJTYPE_OPTIONBUTTON; meEventType = EXC_TBX_EVENT_ACTION; break;
676  case FormCompType::CHECKBOX: mnObjType = EXC_OBJTYPE_CHECKBOX; meEventType = EXC_TBX_EVENT_ACTION; break;
677  case FormCompType::LISTBOX: mnObjType = EXC_OBJTYPE_LISTBOX; meEventType = EXC_TBX_EVENT_CHANGE; break;
678  case FormCompType::COMBOBOX: mnObjType = EXC_OBJTYPE_DROPDOWN; meEventType = EXC_TBX_EVENT_CHANGE; break;
679  case FormCompType::GROUPBOX: mnObjType = EXC_OBJTYPE_GROUPBOX; meEventType = EXC_TBX_EVENT_MOUSE; break;
680  case FormCompType::FIXEDTEXT: mnObjType = EXC_OBJTYPE_LABEL; meEventType = EXC_TBX_EVENT_MOUSE; break;
681  case FormCompType::SCROLLBAR: mnObjType = EXC_OBJTYPE_SCROLLBAR; meEventType = EXC_TBX_EVENT_VALUE; break;
682  case FormCompType::SPINBUTTON: mnObjType = EXC_OBJTYPE_SPIN; meEventType = EXC_TBX_EVENT_VALUE; break;
683  }
684  }
686  return;
687 
688  // OBJ record flags
689  SetLocked( true );
690  mbPrint = aCtrlProp.GetBoolProperty( "Printable" );
692  SetAutoFill( false );
693  SetAutoLine( false );
694 
695  // fill DFF property set
697  mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty );
698  EscherPropertyContainer aPropOpt;
699  mbVisible = aCtrlProp.GetBoolProperty( "EnableVisible" );
700  aPropOpt.AddOpt( ESCHER_Prop_fPrint, mbVisible ? 0x00080000 : 0x00080002 ); // visible flag
701 
702  aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x01000100 ); // bool field
703  aPropOpt.AddOpt( ESCHER_Prop_lTxid, 0 ); // Text ID
704  aPropOpt.AddOpt( ESCHER_Prop_WrapText, 0x00000001 );
705  aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x001A0008 ); // bool field
706  aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00100000 ); // bool field
707  aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080000 ); // bool field
708 
709  // #i51348# name of the control, may overwrite shape name
710  if( aCtrlProp.GetProperty( msCtrlName, "Name" ) && !msCtrlName.isEmpty() )
711  aPropOpt.AddOpt( ESCHER_Prop_wzName, msCtrlName );
712 
713  //Export description as alt text
714  if( SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape( xShape ) )
715  {
716  OUString aAltTxt;
717  OUString aDescrText = pSdrObj->GetDescription();
718  if(!aDescrText.isEmpty())
719  aAltTxt = aDescrText.copy( 0, std::min<sal_Int32>(MSPROP_DESCRIPTION_MAX_LEN, aDescrText.getLength()) );
720  aPropOpt.AddOpt( ESCHER_Prop_wzDescription, aAltTxt );
721  }
722 
723  // write DFF property set to stream
724  aPropOpt.Commit( mrEscherEx.GetStream() );
725 
726  // anchor
727  ImplWriteAnchor( SdrObject::getSdrObjectFromXShape( xShape ), pChildAnchor );
728 
729  mrEscherEx.AddAtom( 0, ESCHER_ClientData ); // OBJ record
731 
732  // control label
733  if( aCtrlProp.GetProperty( msLabel, "Label" ) )
734  {
735  /* Be sure to construct the MSODRAWING record containing the
736  ClientTextbox atom after the base OBJ's MSODRAWING record data is
737  completed. */
739  mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record
741 
742  sal_uInt16 nXclFont = EXC_FONT_APP;
743  if( !msLabel.isEmpty() )
744  {
745  XclFontData aFontData;
747  if( (!aFontData.maName.isEmpty() ) && (aFontData.mnHeight > 0) )
748  nXclFont = GetFontBuffer().Insert( aFontData, EXC_COLOR_CTRLTEXT );
749  }
750 
751  pTxo.reset( new XclTxo( msLabel, nXclFont ) );
753  pTxo->SetVerAlign( EXC_OBJ_VER_CENTER );
754  }
755 
756  mrEscherEx.CloseContainer(); // ESCHER_SpContainer
757 
758  // other properties
759  aCtrlProp.GetProperty( mnLineCount, "LineCount" );
760 
761  // border style
762  sal_Int16 nApiButton = AwtVisualEffect::LOOK3D;
763  sal_Int16 nApiBorder = AwtVisualEffect::LOOK3D;
764  switch( nClassId )
765  {
766  case FormCompType::LISTBOX:
767  case FormCompType::COMBOBOX:
768  aCtrlProp.GetProperty( nApiBorder, "Border" );
769  break;
770  case FormCompType::CHECKBOX:
771  case FormCompType::RADIOBUTTON:
772  aCtrlProp.GetProperty( nApiButton, "VisualEffect" );
773  nApiBorder = AwtVisualEffect::NONE;
774  break;
775  // Push button cannot be set to flat in Excel
776  case FormCompType::COMMANDBUTTON:
777  nApiBorder = AwtVisualEffect::LOOK3D;
778  break;
779  // Label does not support a border in Excel
780  case FormCompType::FIXEDTEXT:
781  nApiBorder = AwtVisualEffect::NONE;
782  break;
783  /* Scroll bar and spin button have a "Border" property, but it is
784  really used for a border, and not for own 3D/flat look (#i34712#). */
785  case FormCompType::SCROLLBAR:
786  case FormCompType::SPINBUTTON:
787  nApiButton = AwtVisualEffect::LOOK3D;
788  nApiBorder = AwtVisualEffect::NONE;
789  break;
790  // Group box does not support flat style (#i34712#)
791  case FormCompType::GROUPBOX:
792  nApiBorder = AwtVisualEffect::LOOK3D;
793  break;
794  }
795  mbFlatButton = nApiButton != AwtVisualEffect::LOOK3D;
796  mbFlatBorder = nApiBorder != AwtVisualEffect::LOOK3D;
797 
798  // control state
799  sal_Int16 nApiState = 0;
800  if( aCtrlProp.GetProperty( nApiState, "State" ) )
801  {
802  switch( nApiState )
803  {
804  case 0: mnState = EXC_OBJ_CHECKBOX_UNCHECKED; break;
805  case 1: mnState = EXC_OBJ_CHECKBOX_CHECKED; break;
806  case 2: mnState = EXC_OBJ_CHECKBOX_TRISTATE; break;
807  }
808  }
809 
810  // special control contents
811  switch( nClassId )
812  {
813  case FormCompType::LISTBOX:
814  {
815  mbMultiSel = aCtrlProp.GetBoolProperty( "MultiSelection" );
816  Sequence< sal_Int16 > aSelection;
817  if( aCtrlProp.GetProperty( aSelection, "SelectedItems" ) )
818  {
819  if( aSelection.hasElements() )
820  {
821  mnSelEntry = aSelection[ 0 ] + 1;
823  }
824  }
825 
826  // convert listbox with dropdown button to Excel dropdown
827  if( aCtrlProp.GetBoolProperty( "Dropdown" ) )
829  }
830  break;
831 
832  case FormCompType::COMBOBOX:
833  {
835  OUString aDefText;
836  if( aCtrlProp.GetProperty( aStringList, "StringItemList" ) &&
837  aCtrlProp.GetProperty( aDefText, "Text" ) &&
838  aStringList.hasElements() && !aDefText.isEmpty() )
839  {
840  auto nIndex = comphelper::findValue(aStringList, aDefText);
841  if( nIndex != -1 )
842  mnSelEntry = static_cast< sal_Int16 >( nIndex + 1 ); // 1-based
843  if( mnSelEntry > 0 )
844  maMultiSel.resize( 1, mnSelEntry - 1 );
845  }
846 
847  // convert combobox without dropdown button to Excel listbox
848  if( !aCtrlProp.GetBoolProperty( "Dropdown" ) )
850  }
851  break;
852 
853  case FormCompType::SCROLLBAR:
854  {
855  sal_Int32 nApiValue = 0;
856  if( aCtrlProp.GetProperty( nApiValue, "ScrollValueMin" ) )
857  mnScrollMin = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
858  if( aCtrlProp.GetProperty( nApiValue, "ScrollValueMax" ) )
859  mnScrollMax = limit_cast< sal_uInt16 >( nApiValue, mnScrollMin, EXC_OBJ_SCROLLBAR_MAX );
860  if( aCtrlProp.GetProperty( nApiValue, "ScrollValue" ) )
861  mnScrollValue = limit_cast< sal_uInt16 >( nApiValue, mnScrollMin, mnScrollMax );
862  if( aCtrlProp.GetProperty( nApiValue, "LineIncrement" ) )
863  mnScrollStep = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
864  if( aCtrlProp.GetProperty( nApiValue, "BlockIncrement" ) )
865  mnScrollPage = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
866  if( aCtrlProp.GetProperty( nApiValue, "Orientation" ) )
867  mbScrollHor = nApiValue == AwtScrollOrient::HORIZONTAL;
868  }
869  break;
870 
871  case FormCompType::SPINBUTTON:
872  {
873  sal_Int32 nApiValue = 0;
874  if( aCtrlProp.GetProperty( nApiValue, "SpinValueMin" ) )
875  mnScrollMin = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
876  if( aCtrlProp.GetProperty( nApiValue, "SpinValueMax" ) )
877  mnScrollMax = limit_cast< sal_uInt16 >( nApiValue, mnScrollMin, EXC_OBJ_SCROLLBAR_MAX );
878  if( aCtrlProp.GetProperty( nApiValue, "SpinValue" ) )
879  mnScrollValue = limit_cast< sal_uInt16 >( nApiValue, mnScrollMin, mnScrollMax );
880  if( aCtrlProp.GetProperty( nApiValue, "SpinIncrement" ) )
881  mnScrollStep = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
882  if( aCtrlProp.GetProperty( nApiValue, "Orientation" ) )
883  mbScrollHor = nApiValue == AwtScrollOrient::HORIZONTAL;
884  }
885  break;
886  }
887 
888  {
889  Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( xShape );
890  if( xCtrlModel.is() )
891  {
892  Reference< XBindableValue > xBindable( xCtrlModel, UNO_QUERY );
893  if( xBindable.is() )
894  {
895  Reference< XServiceInfo > xServInfo( xBindable->getValueBinding(), UNO_QUERY );
896  if( xServInfo.is() && xServInfo->supportsService( SC_SERVICENAME_VALBIND ) )
897  {
898  ScfPropertySet aBindProp( xServInfo );
899  CellAddress aApiAddress;
900  if( aBindProp.GetProperty( aApiAddress, SC_UNONAME_BOUNDCELL ) )
901  {
903  if( SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape( xShape ) )
904  lcl_GetFromTo( rRoot, pSdrObj->GetLogicRect(), mxCellLinkAddress.Tab(), maAreaFrom, maAreaTo, true );
905  }
906  }
907  }
908  }
909  }
910 
911  // spreadsheet links
912  ConvertSheetLinks( xShape );
913 }
914 
915 bool XclExpTbxControlObj::SetMacroLink( const ScriptEventDescriptor& rEvent )
916 {
917  return XclMacroHelper::SetMacroLink( rEvent, meEventType );
918 }
919 
921 {
922  switch( mnObjType )
923  {
924  // *** Push buttons, labels ***
925 
926  case EXC_OBJTYPE_BUTTON:
927  case EXC_OBJTYPE_LABEL:
928  // ftMacro - macro link
929  WriteMacroSubRec( rStrm );
930  break;
931 
932  // *** Check boxes, option buttons ***
933 
936  {
937  // ftCbls - box properties
938  sal_uInt16 nStyle = 0;
940 
941  rStrm.StartRecord( EXC_ID_OBJCBLS, 12 );
942  rStrm << mnState;
943  rStrm.WriteZeroBytes( 8 );
944  rStrm << nStyle;
945  rStrm.EndRecord();
946 
947  // ftMacro - macro link
948  WriteMacroSubRec( rStrm );
949  // ftCblsFmla subrecord - cell link
951 
952  // ftCblsData subrecord - box properties, again
953  rStrm.StartRecord( EXC_ID_OBJCBLS, 8 );
954  rStrm << mnState;
955  rStrm.WriteZeroBytes( 4 );
956  rStrm << nStyle;
957  rStrm.EndRecord();
958  }
959  break;
960 
961  // *** List boxes, combo boxes ***
962 
963  case EXC_OBJTYPE_LISTBOX:
965  {
966  sal_uInt16 nEntryCount = GetSourceEntryCount();
967 
968  // ftSbs subrecord - Scroll bars
969  sal_Int32 nLineHeight = XclTools::GetHmmFromTwips( 200 ); // always 10pt
971  mnLineCount = static_cast< sal_uInt16 >( mnHeight / nLineHeight );
972  mnScrollValue = 0;
973  mnScrollMin = 0;
974  sal_uInt16 nInvisLines = (nEntryCount >= mnLineCount) ? (nEntryCount - mnLineCount) : 0;
975  mnScrollMax = limit_cast< sal_uInt16 >( nInvisLines, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
976  mnScrollStep = 1;
978  mbScrollHor = false;
979  WriteSbs( rStrm );
980 
981  // ftMacro - macro link
982  WriteMacroSubRec( rStrm );
983  // ftSbsFmla subrecord - cell link
985 
986  // ftLbsData - source data range and box properties
987  sal_uInt16 nStyle = 0;
990 
991  rStrm.StartRecord( EXC_ID_OBJLBSDATA, 0 );
992 
993  if( const XclTokenArray* pSrcRange = GetSourceRangeTokArr() )
994  {
995  rStrm << static_cast< sal_uInt16 >( (pSrcRange->GetSize() + 7) & 0xFFFE );
996  WriteFormula( rStrm, *pSrcRange );
997  }
998  else
999  rStrm << sal_uInt16( 0 );
1000 
1001  rStrm << nEntryCount << mnSelEntry << nStyle << sal_uInt16( 0 );
1003  {
1004  if( nEntryCount )
1005  {
1006  ScfUInt8Vec aSelEx( nEntryCount, 0 );
1007  for( const auto& rItem : maMultiSel )
1008  if( rItem < nEntryCount )
1009  aSelEx[ rItem ] = 1;
1010  rStrm.Write( aSelEx.data(), aSelEx.size() );
1011  }
1012  }
1013  else if( mnObjType == EXC_OBJTYPE_DROPDOWN )
1014  {
1015  rStrm << sal_uInt16( 0 ) << mnLineCount << sal_uInt16( 0 ) << sal_uInt16( 0 );
1016  }
1017 
1018  rStrm.EndRecord();
1019  }
1020  break;
1021 
1022  // *** Spin buttons, scrollbars ***
1023 
1024  case EXC_OBJTYPE_SPIN:
1025  case EXC_OBJTYPE_SCROLLBAR:
1026  {
1027  // ftSbs subrecord - scroll bars
1028  WriteSbs( rStrm );
1029  // ftMacro - macro link
1030  WriteMacroSubRec( rStrm );
1031  // ftSbsFmla subrecord - cell link
1033  }
1034  break;
1035 
1036  // *** Group boxes ***
1037 
1038  case EXC_OBJTYPE_GROUPBOX:
1039  {
1040  // ftMacro - macro link
1041  WriteMacroSubRec( rStrm );
1042 
1043  // ftGboData subrecord - group box properties
1044  sal_uInt16 nStyle = 0;
1046 
1047  rStrm.StartRecord( EXC_ID_OBJGBODATA, 6 );
1048  rStrm << sal_uInt32( 0 )
1049  << nStyle;
1050  rStrm.EndRecord();
1051  }
1052  break;
1053  }
1054 }
1055 
1056 void XclExpTbxControlObj::WriteCellLinkSubRec( XclExpStream& rStrm, sal_uInt16 nSubRecId )
1057 {
1058  if( const XclTokenArray* pCellLink = GetCellLinkTokArr() )
1059  WriteFormulaSubRec( rStrm, nSubRecId, *pCellLink );
1060 }
1061 
1063 {
1064  sal_uInt16 nOrient = 0;
1066  sal_uInt16 nStyle = EXC_OBJ_SCROLLBAR_DEFFLAGS;
1068 
1069  rStrm.StartRecord( EXC_ID_OBJSBS, 20 );
1070  rStrm << sal_uInt32( 0 ) // reserved
1071  << mnScrollValue // thumb position
1072  << mnScrollMin // thumb min pos
1073  << mnScrollMax // thumb max pos
1074  << mnScrollStep // line increment
1075  << mnScrollPage // page increment
1076  << nOrient // 0 = vertical, 1 = horizontal
1077  << sal_uInt16( 15 ) // thumb width
1078  << nStyle; // flags/style
1079  rStrm.EndRecord();
1080 }
1081 
1082 void XclExpTbxControlObj::setShapeId(sal_Int32 aShapeId)
1083 {
1084  mnShapeId = aShapeId;
1085 }
1086 
1087 namespace
1088 {
1090 class VmlFormControlExporter : public oox::vml::VMLExport
1091 {
1092  sal_uInt16 m_nObjType;
1093  tools::Rectangle m_aAreaFrom;
1094  tools::Rectangle m_aAreaTo;
1095  OUString m_aLabel;
1096  OUString m_aMacroName;
1097 
1098 public:
1099  VmlFormControlExporter(const sax_fastparser::FSHelperPtr& p, sal_uInt16 nObjType,
1100  const tools::Rectangle& rAreaFrom, const tools::Rectangle& rAreaTo,
1101  const OUString& rLabel, const OUString& rMacroName);
1102 
1103 protected:
1104  using VMLExport::StartShape;
1105  sal_Int32 StartShape() override;
1106  using VMLExport::EndShape;
1107  void EndShape(sal_Int32 nShapeElement) override;
1108 };
1109 
1110 VmlFormControlExporter::VmlFormControlExporter(const sax_fastparser::FSHelperPtr& p,
1111  sal_uInt16 nObjType,
1112  const tools::Rectangle& rAreaFrom,
1113  const tools::Rectangle& rAreaTo,
1114  const OUString& rLabel, const OUString& rMacroName)
1115  : VMLExport(p)
1116  , m_nObjType(nObjType)
1117  , m_aAreaFrom(rAreaFrom)
1118  , m_aAreaTo(rAreaTo)
1119  , m_aLabel(rLabel)
1120  , m_aMacroName(rMacroName)
1121 {
1122 }
1123 
1124 sal_Int32 VmlFormControlExporter::StartShape()
1125 {
1126  // Host control.
1127  AddShapeAttribute(XML_type, "#_x0000_t201");
1128  return VMLExport::StartShape();
1129 }
1130 
1131 void VmlFormControlExporter::EndShape(sal_Int32 nShapeElement)
1132 {
1133  sax_fastparser::FSHelperPtr pVmlDrawing = GetFS();
1134 
1135  pVmlDrawing->startElement(FSNS(XML_v, XML_textbox));
1136  pVmlDrawing->startElement(XML_div);
1137  pVmlDrawing->write(m_aLabel);
1138  pVmlDrawing->endElement(XML_div);
1139  pVmlDrawing->endElement(FSNS(XML_v, XML_textbox));
1140 
1141  OString aObjectType;
1142  switch (m_nObjType)
1143  {
1144  case EXC_OBJTYPE_CHECKBOX:
1145  aObjectType = "Checkbox";
1146  break;
1147  case EXC_OBJTYPE_BUTTON:
1148  aObjectType = "Button";
1149  break;
1150  }
1151  pVmlDrawing->startElement(FSNS(XML_x, XML_ClientData), XML_ObjectType, aObjectType);
1152  OString aAnchor
1153  = OString::number(m_aAreaFrom.Left()) + ", " + OString::number(m_aAreaFrom.Top()) + ", "
1154  + OString::number(m_aAreaFrom.Right()) + ", " + OString::number(m_aAreaFrom.Bottom()) + ", "
1155  + OString::number(m_aAreaTo.Left()) + ", " + OString::number(m_aAreaTo.Top()) + ", "
1156  + OString::number(m_aAreaTo.Right()) + ", " + OString::number(m_aAreaTo.Bottom());
1157  XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_Anchor), aAnchor);
1158 
1159  if (!m_aMacroName.isEmpty())
1160  {
1161  XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_FmlaMacro), m_aMacroName);
1162  }
1163 
1164  // XclExpOcxControlObj::WriteSubRecs() has the same fixed values.
1165  if (m_nObjType == EXC_OBJTYPE_BUTTON)
1166  {
1167  XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_TextHAlign), "Center");
1168  }
1169  XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_TextVAlign), "Center");
1170 
1171  pVmlDrawing->endElement(FSNS(XML_x, XML_ClientData));
1172  VMLExport::EndShape(nShapeElement);
1173 }
1174 
1175 }
1176 
1179 {
1181  tools::Rectangle aAreaFrom;
1182  tools::Rectangle aAreaTo;
1183  // Unlike XclExpTbxControlObj::SaveXml(), this is not calculated in EMUs.
1184  lcl_GetFromTo(mrRoot, pObj->GetLogicRect(), GetTab(), aAreaFrom, aAreaTo);
1185  VmlFormControlExporter aFormControlExporter(rStrm.GetCurrentStream(), GetObjType(), aAreaFrom,
1186  aAreaTo, msLabel, GetMacroName());
1187  aFormControlExporter.AddSdrObject(*pObj, /*bIsFollowingTextFlow=*/false, /*eHOri=*/-1,
1188  /*eVOri=*/-1, /*eHRel=*/-1, /*eVRel=*/-1,
1189  /*pWrapAttrList=*/nullptr, /*bOOxmlExport=*/true);
1190 }
1191 
1192 // save into xl\drawings\drawing1.xml
1194 {
1195  sax_fastparser::FSHelperPtr& pDrawing = rStrm.GetCurrentStream();
1196 
1197  pDrawing->startElement(FSNS(XML_mc, XML_AlternateContent),
1198  FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)));
1199  pDrawing->startElement(FSNS(XML_mc, XML_Choice),
1200  FSNS(XML_xmlns, XML_a14), rStrm.getNamespaceURL(OOX_NS(a14)),
1201  XML_Requires, "a14");
1202 
1203  pDrawing->startElement(FSNS(XML_xdr, XML_twoCellAnchor), XML_editAs, "oneCell");
1204  {
1205  pDrawing->startElement(FSNS(XML_xdr, XML_from));
1206  lcl_WriteAnchorVertex(pDrawing, maAreaFrom);
1207  pDrawing->endElement(FSNS(XML_xdr, XML_from));
1208  pDrawing->startElement(FSNS(XML_xdr, XML_to));
1209  lcl_WriteAnchorVertex(pDrawing, maAreaTo);
1210  pDrawing->endElement(FSNS(XML_xdr, XML_to));
1211 
1212  pDrawing->startElement(FSNS(XML_xdr, XML_sp));
1213  {
1214  // xdr:nvSpPr
1215  pDrawing->startElement(FSNS(XML_xdr, XML_nvSpPr));
1216  {
1217  pDrawing->singleElement(FSNS(XML_xdr, XML_cNvPr),
1218  XML_id, OString::number(mnShapeId).getStr(),
1219  XML_name, msCtrlName, // control name
1220  XML_descr, msLabel, // description as alt text
1221  XML_hidden, mbVisible ? "0" : "1");
1222  pDrawing->singleElement(FSNS(XML_xdr, XML_cNvSpPr));
1223  }
1224  pDrawing->endElement(FSNS(XML_xdr, XML_nvSpPr));
1225 
1226  // xdr:spPr
1227  pDrawing->startElement(FSNS(XML_xdr, XML_spPr));
1228  {
1229  // a:xfrm
1230  pDrawing->startElement(FSNS(XML_a, XML_xfrm));
1231  {
1232  pDrawing->singleElement(FSNS(XML_a, XML_off),
1233  XML_x, "0",
1234  XML_y, "0");
1235  pDrawing->singleElement(FSNS(XML_a, XML_ext),
1236  XML_cx, "0",
1237  XML_cy, "0");
1238  }
1239  pDrawing->endElement(FSNS(XML_a, XML_xfrm));
1240 
1241  // a:prstGeom
1242  pDrawing->startElement(FSNS(XML_a, XML_prstGeom), XML_prst, "rect");
1243  {
1244  pDrawing->singleElement(FSNS(XML_a, XML_avLst));
1245  }
1246  pDrawing->endElement(FSNS(XML_a, XML_prstGeom));
1247  }
1248  pDrawing->endElement(FSNS(XML_xdr, XML_spPr));
1249 
1250  // xdr:txBody
1251  {
1252  pDrawing->startElement(FSNS(XML_xdr, XML_txBody));
1253 
1254 #define DEFLRINS 254
1255 #define DEFTBINS 127
1256  sal_Int32 nLeft, nRight, nTop, nBottom;
1257  nLeft = nRight = DEFLRINS;
1258  nTop = nBottom = DEFTBINS;
1259 
1260  // top inset looks a bit different compared to ppt export
1261  // check if something related doesn't work as expected
1262  Reference< XPropertySet > rXPropSet(mxShape, UNO_QUERY);
1263 
1264  try
1265  {
1266  css::uno::Any mAny;
1267 
1268  mAny = rXPropSet->getPropertyValue("TextLeftDistance");
1269  if (mAny.hasValue())
1270  mAny >>= nLeft;
1271 
1272  mAny = rXPropSet->getPropertyValue("TextRightDistance");
1273  if (mAny.hasValue())
1274  mAny >>= nRight;
1275 
1276  mAny = rXPropSet->getPropertyValue("TextUpperDistance");
1277  if (mAny.hasValue())
1278  mAny >>= nTop;
1279 
1280  mAny = rXPropSet->getPropertyValue("TextLowerDistance");
1281  if (mAny.hasValue())
1282  mAny >>= nBottom;
1283  }
1284  catch (...)
1285  {
1286  }
1287 
1288  // Specifies the inset of the bounding rectangle.
1289  // Insets are used just as internal margins for text boxes within shapes.
1290  // If this attribute is omitted, then a value of 45720 or 0.05 inches is implied.
1291  pDrawing->startElementNS(XML_a, XML_bodyPr,
1292  XML_lIns, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeft)), nLeft != DEFLRINS),
1293  XML_rIns, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nRight)), nRight != DEFLRINS),
1294  XML_tIns, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nTop)), nTop != DEFTBINS),
1295  XML_bIns, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nBottom)), nBottom != DEFTBINS),
1296  XML_anchor, "ctr");
1297 
1298  {
1299  bool bTextAutoGrowHeight = false;
1300 
1301  try
1302  {
1303  css::uno::Any mAny;
1304 
1305  mAny = rXPropSet->getPropertyValue("TextAutoGrowHeight");
1306  if (mAny.hasValue())
1307  mAny >>= bTextAutoGrowHeight;
1308  }
1309  catch (...)
1310  {
1311  }
1312 
1313  pDrawing->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit : XML_noAutofit));
1314  }
1315 
1316  pDrawing->endElementNS(XML_a, XML_bodyPr);
1317 
1318  {
1319  pDrawing->startElementNS(XML_a, XML_p);
1320  pDrawing->startElementNS(XML_a, XML_r);
1321  pDrawing->startElementNS(XML_a, XML_t);
1322  pDrawing->write(msLabel);
1323  pDrawing->endElementNS(XML_a, XML_t);
1324  pDrawing->endElementNS(XML_a, XML_r);
1325  pDrawing->endElementNS(XML_a, XML_p);
1326  }
1327 
1328  pDrawing->endElement(FSNS(XML_xdr, XML_txBody));
1329  }
1330  }
1331  pDrawing->endElement(FSNS(XML_xdr, XML_sp));
1332  pDrawing->singleElement(FSNS(XML_xdr, XML_clientData));
1333  }
1334  pDrawing->endElement(FSNS(XML_xdr, XML_twoCellAnchor));
1335  pDrawing->endElement( FSNS( XML_mc, XML_Choice ) );
1336  pDrawing->endElement( FSNS( XML_mc, XML_AlternateContent ) );
1337 }
1338 
1339 // output into ctrlProp1.xml
1341 {
1342  OUString sIdFormControlPr;
1343 
1344  switch (mnObjType)
1345  {
1346  case EXC_OBJTYPE_CHECKBOX:
1347  {
1348  const sal_Int32 nDrawing = DrawingML::getNewDrawingUniqueId();
1349  sax_fastparser::FSHelperPtr pFormControl = rStrm.CreateOutputStream(
1350  XclXmlUtils::GetStreamName( "xl/", "ctrlProps/ctrlProps", nDrawing ),
1351  XclXmlUtils::GetStreamName( "../", "ctrlProps/ctrlProps", nDrawing ),
1352  rStrm.GetCurrentStream()->getOutputStream(),
1353  "application/vnd.ms-excel.controlproperties+xml",
1354  oox::getRelationship(Relationship::CTRLPROP),
1355  &sIdFormControlPr );
1356 
1357  rStrm.PushStream( pFormControl );
1358  // checkbox
1359  // <formControlPr
1360  // xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
1361  // objectType="CheckBox" checked="Checked" lockText="1" noThreeD="1"/>
1362  //
1363  pFormControl->write("<formControlPr xmlns=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\" objectType=\"CheckBox\"");
1365  pFormControl->write(" checked=\"Checked\"");
1366 
1367  pFormControl->write(" autoLine=\"false\"");
1368 
1369  if (mbPrint)
1370  pFormControl->write(" print=\"true\"");
1371  else
1372  pFormControl->write(" print=\"false\"");
1373 
1374  if (mxCellLinkAddress.IsValid())
1375  {
1376  OUString aCellLink = mxCellLinkAddress.Format(ScRefFlags::ADDR_ABS,
1377  &GetDoc(),
1379 
1380  // "Sheet1!$C$5"
1381  pFormControl->write(" fmlaLink=\"");
1382  if (aCellLink.indexOf('!') < 0)
1383  {
1384  pFormControl->write(GetTabInfo().GetScTabName(mxCellLinkAddress.Tab()));
1385  pFormControl->write("!");
1386  }
1387  pFormControl->write(aCellLink);
1388  pFormControl->write("\"");
1389  }
1390 
1391  pFormControl->write(" lockText=\"1\" noThreeD=\"1\"/>");
1392  rStrm.PopStream();
1393 
1394  break;
1395  }
1396  case EXC_OBJTYPE_BUTTON:
1397  {
1398  sal_Int32 nDrawing = DrawingML::getNewDrawingUniqueId();
1399  sax_fastparser::FSHelperPtr pFormControl = rStrm.CreateOutputStream(
1400  XclXmlUtils::GetStreamName("xl/", "ctrlProps/ctrlProps", nDrawing),
1401  XclXmlUtils::GetStreamName("../", "ctrlProps/ctrlProps", nDrawing),
1402  rStrm.GetCurrentStream()->getOutputStream(),
1403  "application/vnd.ms-excel.controlproperties+xml",
1404  oox::getRelationship(Relationship::CTRLPROP), &sIdFormControlPr);
1405 
1406  pFormControl->singleElement(XML_formControlPr, XML_xmlns,
1407  rStrm.getNamespaceURL(OOX_NS(xls14Lst)), XML_objectType,
1408  "Button", XML_lockText, "1");
1409  break;
1410  }
1411  }
1412 
1413  return sIdFormControlPr;
1414 }
1415 
1416 // output into sheet1.xml
1417 void XclExpTbxControlObj::SaveSheetXml(XclExpXmlStream& rStrm, const OUString& aIdFormControlPr) const
1418 {
1419  switch (mnObjType)
1420  {
1421  case EXC_OBJTYPE_CHECKBOX:
1422  {
1423  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1424 
1425  rWorksheet->startElement(FSNS(XML_mc, XML_AlternateContent),
1426  FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)));
1427  rWorksheet->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, "x14");
1428 
1429  rWorksheet->startElement(
1430  XML_control,
1431  XML_shapeId, OString::number(mnShapeId).getStr(),
1432  FSNS(XML_r, XML_id), aIdFormControlPr,
1433  XML_name, msLabel); // text to display with checkbox button
1434 
1435  rWorksheet->write("<controlPr defaultSize=\"0\" locked=\"1\" autoFill=\"0\" autoLine=\"0\" autoPict=\"0\"");
1436 
1437  if (mbPrint)
1438  rWorksheet->write(" print=\"true\"");
1439  else
1440  rWorksheet->write(" print=\"false\"");
1441 
1442  if (!msCtrlName.isEmpty())
1443  {
1444  rWorksheet->write(" altText=\"");
1445  rWorksheet->write(msCtrlName); // alt text
1446  rWorksheet->write("\"");
1447  }
1448 
1449  rWorksheet->write(">");
1450 
1451  rWorksheet->startElement(XML_anchor, XML_moveWithCells, "true", XML_sizeWithCells, "false");
1452  rWorksheet->startElement(XML_from);
1453  lcl_WriteAnchorVertex(rWorksheet, maAreaFrom);
1454  rWorksheet->endElement(XML_from);
1455  rWorksheet->startElement(XML_to);
1456  lcl_WriteAnchorVertex(rWorksheet, maAreaTo);
1457  rWorksheet->endElement(XML_to);
1458  rWorksheet->endElement( XML_anchor );
1459 
1460  rWorksheet->write("</controlPr>");
1461 
1462  rWorksheet->endElement(XML_control);
1463  rWorksheet->endElement( FSNS( XML_mc, XML_Choice ) );
1464  rWorksheet->endElement( FSNS( XML_mc, XML_AlternateContent ) );
1465 
1466  break;
1467  }
1468  case EXC_OBJTYPE_BUTTON:
1469  {
1470  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1471 
1472  rWorksheet->startElement(FSNS(XML_mc, XML_AlternateContent), FSNS(XML_xmlns, XML_mc),
1473  rStrm.getNamespaceURL(OOX_NS(mce)));
1474  rWorksheet->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, "x14");
1475 
1476  rWorksheet->startElement(XML_control, XML_shapeId, OString::number(mnShapeId).getStr(),
1477  FSNS(XML_r, XML_id), aIdFormControlPr, XML_name, msCtrlName);
1478 
1479  OString aMacroName = GetMacroName().toUtf8();
1480  // Omit the macro attribute if it would be empty.
1481  const char* pMacroName = aMacroName.isEmpty() ? nullptr : aMacroName.getStr();
1482  rWorksheet->startElement(XML_controlPr, XML_defaultSize, "0", XML_print,
1483  mbPrint ? "true" : "false", XML_autoFill, "0", XML_autoPict,
1484  "0", XML_macro, pMacroName);
1485 
1486  rWorksheet->startElement(XML_anchor, XML_moveWithCells, "true", XML_sizeWithCells,
1487  "false");
1488 
1490  tools::Rectangle aAreaFrom;
1491  tools::Rectangle aAreaTo;
1492  lcl_GetFromTo(mrRoot, pObj->GetLogicRect(), GetTab(), aAreaFrom, aAreaTo,
1493  /*bInEMU=*/true);
1494 
1495  rWorksheet->startElement(XML_from);
1496  lcl_WriteAnchorVertex(rWorksheet, aAreaFrom);
1497  rWorksheet->endElement(XML_from);
1498  rWorksheet->startElement(XML_to);
1499  lcl_WriteAnchorVertex(rWorksheet, aAreaTo);
1500  rWorksheet->endElement(XML_to);
1501  rWorksheet->endElement(XML_anchor);
1502 
1503  rWorksheet->endElement(XML_controlPr);
1504 
1505  rWorksheet->endElement(XML_control);
1506  rWorksheet->endElement(FSNS(XML_mc, XML_Choice));
1507  rWorksheet->endElement(FSNS(XML_mc, XML_AlternateContent));
1508  break;
1509  }
1510  }
1511 }
1512 
1513 //#endif
1514 
1515 XclExpChartObj::XclExpChartObj( XclExpObjectManager& rObjMgr, Reference< XShape > const & xShape, const tools::Rectangle* pChildAnchor, ScDocument* pDoc ) :
1516  XclObj( rObjMgr, EXC_OBJTYPE_CHART ),
1517  XclExpRoot( rObjMgr.GetRoot() ), mxShape( xShape ),
1518  mpDoc(pDoc)
1519 {
1520  // create the MSODRAWING record contents for the chart object
1522  mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty );
1523  EscherPropertyContainer aPropOpt;
1524  aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x01040104 );
1525  aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 );
1526  aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0x0800004E );
1527  aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x0800004D );
1528  aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00110010 );
1529  aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x0800004D );
1530  aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080008 );
1531  aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured, 0x00020000 );
1532  aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080000 );
1533  aPropOpt.Commit( mrEscherEx.GetStream() );
1534 
1535  // anchor
1536  SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape( xShape );
1537  ImplWriteAnchor( pSdrObj, pChildAnchor );
1538 
1539  // client data (the following OBJ record)
1541  mrEscherEx.CloseContainer(); // ESCHER_SpContainer
1543 
1544  // load the chart OLE object
1545  if( SdrOle2Obj* pSdrOleObj = dynamic_cast< SdrOle2Obj* >( pSdrObj ) )
1546  svt::EmbeddedObjectRef::TryRunningState( pSdrOleObj->GetObjRef() );
1547 
1548  // create the chart substream object
1549  ScfPropertySet aShapeProp( xShape );
1550  css::awt::Rectangle aBoundRect;
1551  aShapeProp.GetProperty( aBoundRect, "BoundRect" );
1552  tools::Rectangle aChartRect( Point( aBoundRect.X, aBoundRect.Y ), Size( aBoundRect.Width, aBoundRect.Height ) );
1553  mxChart = std::make_shared<XclExpChart>(GetRoot(), GetChartDoc(), aChartRect);
1554 }
1555 
1557 {
1558 }
1559 
1561 {
1562  // content of OBJ record
1563  XclObj::Save( rStrm );
1564  // chart substream
1565  mxChart->Save( rStrm );
1566 }
1567 
1569 {
1570  sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream();
1571 
1572  // FIXME: two cell? it seems the two cell anchor is incorrect.
1573  pDrawing->startElement( FSNS( XML_xdr, XML_twoCellAnchor ), // OOXTODO: oneCellAnchor, absoluteAnchor
1574  XML_editAs, "oneCell" );
1575  Reference< XPropertySet > xPropSet( mxShape, UNO_QUERY );
1576  if (xPropSet.is())
1577  {
1578  XclObjAny::WriteFromTo( rStrm, mxShape, GetTab() );
1579  ChartExport aChartExport(XML_xdr, pDrawing, GetChartDoc(), &rStrm, drawingml::DOCUMENT_XLSX);
1580  auto pURLTransformer = std::make_shared<ScURLTransformer>(*mpDoc);
1581  aChartExport.SetURLTranslator(pURLTransformer);
1582  static sal_Int32 nChartCount = 0;
1583  nChartCount++;
1584  sal_Int32 nID = rStrm.GetUniqueId();
1585  aChartExport.WriteChartObj( mxShape, nID, nChartCount );
1586  // TODO: get the correcto chart number
1587  }
1588 
1589  pDrawing->singleElement( FSNS( XML_xdr, XML_clientData)
1590  // OOXTODO: XML_fLocksWithSheet
1591  // OOXTODO: XML_fPrintsWithSheet
1592  );
1593  pDrawing->endElement( FSNS( XML_xdr, XML_twoCellAnchor ) );
1594 }
1595 
1596 css::uno::Reference<css::chart::XChartDocument> XclExpChartObj::GetChartDoc() const
1597 {
1599  if (!pObj || pObj->GetObjIdentifier() != SdrObjKind::OLE2)
1600  return {};
1601  // May load here - makes sure that we are working with actually loaded OLE object
1602  return css::uno::Reference<css::chart::XChartDocument>(
1603  static_cast<SdrOle2Obj*>(pObj)->getXModel(), css::uno::UNO_QUERY);
1604 }
1605 
1606 XclExpNote::XclExpNote(const XclExpRoot& rRoot, const ScAddress& rScPos,
1607  const ScPostIt* pScNote, std::u16string_view rAddText)
1609  , mrRoot(rRoot)
1610  , maScPos(rScPos)
1611  , mnObjId(EXC_OBJ_INVALID_ID)
1612  , mbVisible(pScNote && pScNote->IsCaptionShown())
1613  , meTHA(SDRTEXTHORZADJUST_LEFT)
1614  , meTVA(SDRTEXTVERTADJUST_TOP)
1615  , mbAutoScale(false)
1616  , mbLocked(false)
1617  , mbAutoFill(false)
1618  , mbColHidden(false)
1619  , mbRowHidden(false)
1620 {
1621  // get the main note text
1622  OUString aNoteText;
1623  if( pScNote )
1624  {
1625  aNoteText = pScNote->GetText();
1626  const EditTextObject *pEditObj = pScNote->GetEditTextObject();
1627  if( pEditObj )
1628  mpNoteContents = XclExpStringHelper::CreateString( rRoot, *pEditObj );
1629  }
1630  // append additional text
1631  aNoteText = ScGlobal::addToken( aNoteText, rAddText, '\n', 2 );
1632 
1633  // initialize record dependent on BIFF type
1634  switch( rRoot.GetBiff() )
1635  {
1636  case EXC_BIFF5:
1637  maNoteText = OUStringToOString(aNoteText, rRoot.GetTextEncoding());
1638  break;
1639 
1640  case EXC_BIFF8:
1641  {
1642  // TODO: additional text
1643  if( pScNote )
1644  {
1645  if( SdrCaptionObj* pCaption = pScNote->GetOrCreateCaption( maScPos ) )
1646  {
1647  lcl_GetFromTo( rRoot, pCaption->GetLogicRect(), maScPos.Tab(), maCommentFrom, maCommentTo );
1648  if( const OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
1649  mnObjId = rRoot.GetObjectManager().AddObj( std::make_unique<XclObjComment>( rRoot.GetObjectManager(), pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible, maScPos, maCommentFrom, maCommentTo ) );
1650 
1651  SfxItemSet aItemSet = pCaption->GetMergedItemSet();
1652  meTVA = pCaption->GetTextVerticalAdjust();
1653  meTHA = pCaption->GetTextHorizontalAdjust();
1654  mbAutoScale = pCaption->GetFitToSize() != drawing::TextFitToSizeType_NONE;
1655  mbLocked = pCaption->IsMoveProtect() || pCaption->IsResizeProtect();
1656 
1657  // AutoFill style would change if Postit.cxx object creation values are changed
1658  OUString aCol(aItemSet.Get(XATTR_FILLCOLOR).GetValue());
1659  mbAutoFill = aCol.isEmpty() && (aItemSet.Get(XATTR_FILLSTYLE).GetValue() == drawing::FillStyle_SOLID);
1660  mbRowHidden = (rRoot.GetDoc().RowHidden(maScPos.Row(),maScPos.Tab()));
1661  mbColHidden = (rRoot.GetDoc().ColHidden(maScPos.Col(),maScPos.Tab()));
1662  }
1663  // stAuthor (variable): An XLUnicodeString that specifies the name of the comment
1664  // author. String length MUST be greater than or equal to 1 and less than or equal
1665  // to 54.
1666  if( pScNote->GetAuthor().isEmpty() )
1667  maAuthor = XclExpString( " " );
1668  else
1669  maAuthor = XclExpString( pScNote->GetAuthor(), XclStrFlags::NONE, 54 );
1670  }
1671 
1672  SetRecSize( 9 + maAuthor.GetSize() );
1673  }
1674  break;
1675 
1676  default: DBG_ERROR_BIFF();
1677  }
1678 }
1679 
1681 {
1682  switch( rStrm.GetRoot().GetBiff() )
1683  {
1684  case EXC_BIFF5:
1685  {
1686  // write the NOTE record directly, there may be the need to create more than one
1687  const char* pcBuffer = maNoteText.getStr();
1688  sal_uInt16 nCharsLeft = static_cast< sal_uInt16 >( maNoteText.getLength() );
1689 
1690  while( nCharsLeft )
1691  {
1692  sal_uInt16 nWriteChars = ::std::min( nCharsLeft, EXC_NOTE5_MAXLEN );
1693 
1694  rStrm.StartRecord( EXC_ID_NOTE, 6 + nWriteChars );
1695  if( pcBuffer == maNoteText.getStr() )
1696  {
1697  // first record: row, col, length of complete text
1698  rStrm << static_cast< sal_uInt16 >( maScPos.Row() )
1699  << static_cast< sal_uInt16 >( maScPos.Col() )
1700  << nCharsLeft; // still contains full length
1701  }
1702  else
1703  {
1704  // next records: -1, 0, length of current text segment
1705  rStrm << sal_uInt16( 0xFFFF )
1706  << sal_uInt16( 0 )
1707  << nWriteChars;
1708  }
1709  rStrm.Write( pcBuffer, nWriteChars );
1710  rStrm.EndRecord();
1711 
1712  pcBuffer += nWriteChars;
1713  nCharsLeft = nCharsLeft - nWriteChars;
1714  }
1715  }
1716  break;
1717 
1718  case EXC_BIFF8:
1719  if( mnObjId != EXC_OBJ_INVALID_ID )
1720  XclExpRecord::Save( rStrm );
1721  break;
1722 
1723  default: DBG_ERROR_BIFF();
1724  }
1725 }
1726 
1728 {
1729  // BIFF5/BIFF7 is written separately
1730  OSL_ENSURE_BIFF( rStrm.GetRoot().GetBiff() == EXC_BIFF8 );
1731 
1732  sal_uInt16 nFlags = 0;
1734 
1735  rStrm << static_cast< sal_uInt16 >( maScPos.Row() )
1736  << static_cast< sal_uInt16 >( maScPos.Col() )
1737  << nFlags
1738  << mnObjId
1739  << maAuthor
1740  << sal_uInt8( 0 );
1741 }
1742 
1743 void XclExpNote::WriteXml( sal_Int32 nAuthorId, XclExpXmlStream& rStrm )
1744 {
1745  sax_fastparser::FSHelperPtr rComments = rStrm.GetCurrentStream();
1746 
1747  rComments->startElement( XML_comment,
1749  XML_authorId, OString::number(nAuthorId)
1750  // OOXTODO: XML_guid
1751  );
1752  rComments->startElement(XML_text);
1753  // OOXTODO: phoneticPr, rPh, r
1754  if( mpNoteContents )
1755  mpNoteContents->WriteXml( rStrm );
1756  rComments->endElement( XML_text );
1757 
1758 /*
1759  Export of commentPr is disabled, since the current (Oct 2010)
1760  version of MSO 2010 doesn't yet support commentPr
1761  */
1762 #if 1//def XLSX_OOXML_FUTURE
1763  if( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 )
1764  {
1765  rComments->startElement(FSNS(XML_mc, XML_AlternateContent));
1766  rComments->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, "v2");
1767  rComments->startElement( XML_commentPr,
1768  XML_autoFill, ToPsz( mbAutoFill ),
1769  XML_autoScale, ToPsz( mbAutoScale ),
1770  XML_colHidden, ToPsz( mbColHidden ),
1771  XML_locked, ToPsz( mbLocked ),
1772  XML_rowHidden, ToPsz( mbRowHidden ),
1773  XML_textHAlign, ToHorizAlign( meTHA ),
1774  XML_textVAlign, ToVertAlign( meTVA ) );
1775  rComments->startElement(XML_anchor, XML_moveWithCells, "false", XML_sizeWithCells, "false");
1776  rComments->startElement(FSNS(XML_xdr, XML_from));
1777  lcl_WriteAnchorVertex( rComments, maCommentFrom );
1778  rComments->endElement( FSNS( XML_xdr, XML_from ) );
1779  rComments->startElement(FSNS(XML_xdr, XML_to));
1780  lcl_WriteAnchorVertex( rComments, maCommentTo );
1781  rComments->endElement( FSNS( XML_xdr, XML_to ) );
1782  rComments->endElement( XML_anchor );
1783  rComments->endElement( XML_commentPr );
1784 
1785  rComments->endElement( FSNS( XML_mc, XML_Choice ) );
1786  rComments->startElement(FSNS(XML_mc, XML_Fallback));
1787  // Any fallback code ?
1788  rComments->endElement( FSNS( XML_mc, XML_Fallback ) );
1789  rComments->endElement( FSNS( XML_mc, XML_AlternateContent ) );
1790  }
1791 #endif
1792  rComments->endElement( XML_comment );
1793 }
1794 
1796  XclExpControlHelper( rRoot )
1797 {
1798 }
1799 
1801 {
1802 }
1803 
1805 {
1806  if( mxMacroLink )
1808 }
1809 
1810 const OUString& XclMacroHelper::GetMacroName() const { return maMacroName; }
1811 
1812 bool
1813 XclMacroHelper::SetMacroLink( const ScriptEventDescriptor& rEvent, const XclTbxEventType& nEventType )
1814 {
1816  if (!maMacroName.isEmpty())
1817  {
1818  return SetMacroLink(maMacroName);
1819  }
1820  return false;
1821 }
1822 
1823 bool
1824 XclMacroHelper::SetMacroLink( const OUString& rMacroName )
1825 {
1826  // OOXML documents do not store any defined name for VBA macros (while BIFF documents do).
1827  bool bOOXML = GetOutput() == EXC_OUTPUT_XML_2007;
1828  if (!rMacroName.isEmpty() && !bOOXML)
1829  {
1830  sal_uInt16 nExtSheet = GetLocalLinkManager().FindExtSheet( EXC_EXTSH_OWNDOC );
1831  sal_uInt16 nNameIdx
1832  = GetNameManager().InsertMacroCall(rMacroName, /*bVBasic=*/true, /*bFunc=*/false);
1833  mxMacroLink = GetFormulaCompiler().CreateNameXFormula( nExtSheet, nNameIdx );
1834  return true;
1835  }
1836  return false;
1837 }
1838 
1839 XclExpShapeObj::XclExpShapeObj( XclExpObjectManager& rRoot, css::uno::Reference< css::drawing::XShape > const & xShape, ScDocument* pDoc ) :
1840  XclObjAny( rRoot, xShape, pDoc ),
1841  XclMacroHelper( rRoot )
1842 {
1843  if (SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape(xShape))
1844  {
1845  ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pSdrObj );
1846  if ( pInfo && !pInfo->GetMacro().isEmpty() )
1847 // FIXME ooo330-m2: XclControlHelper::GetXclMacroName was removed in upstream sources; they started to call XclTools::GetXclMacroName instead; is this enough? it has only one parameter
1848 // SetMacroLink( XclControlHelper::GetXclMacroName( pInfo->GetMacro(), rRoot.GetDocShell() ) );
1850  }
1851 }
1852 
1854 {
1855 }
1856 
1858 {
1859  XclObjAny::WriteSubRecs( rStrm );
1860  WriteMacroSubRec( rStrm );
1861 }
1862 
1864  : mnTab( nTab ), mrNotes( rNotes )
1865 {
1866 }
1867 
1869 {
1870  if( mrNotes.IsEmpty() )
1871  return;
1872 
1874  XclXmlUtils::GetStreamName( "xl/", "comments", mnTab + 1 ),
1875  XclXmlUtils::GetStreamName( "../", "comments", mnTab + 1 ),
1876  rStrm.GetCurrentStream()->getOutputStream(),
1877  "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
1878  oox::getRelationship(Relationship::COMMENTS));
1879  rStrm.PushStream( rComments );
1880 
1881  if( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 )
1882  rComments->startElement( XML_comments,
1883  XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)),
1884  FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)),
1885  FSNS(XML_xmlns, XML_xdr), rStrm.getNamespaceURL(OOX_NS(dmlSpreadDr)),
1886  FSNS(XML_xmlns, XML_v2), rStrm.getNamespaceURL(OOX_NS(mceTest)),
1887  FSNS( XML_mc, XML_Ignorable ), "v2" );
1888  else
1889  rComments->startElement( XML_comments,
1890  XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)),
1891  FSNS(XML_xmlns, XML_xdr), rStrm.getNamespaceURL(OOX_NS(dmlSpreadDr)) );
1892 
1893  rComments->startElement(XML_authors);
1894 
1895  typedef std::set<OUString> Authors;
1896  Authors aAuthors;
1897 
1898  size_t nNotes = mrNotes.GetSize();
1899  for( size_t i = 0; i < nNotes; ++i )
1900  {
1901  aAuthors.insert( XclXmlUtils::ToOUString( mrNotes.GetRecord( i )->GetAuthor() ) );
1902  }
1903 
1904  for( const auto& rAuthor : aAuthors )
1905  {
1906  rComments->startElement(XML_author);
1907  rComments->writeEscaped( rAuthor );
1908  rComments->endElement( XML_author );
1909  }
1910 
1911  rComments->endElement( XML_authors );
1912  rComments->startElement(XML_commentList);
1913 
1914  Authors::const_iterator aAuthorsBegin = aAuthors.begin();
1915  for( size_t i = 0; i < nNotes; ++i )
1916  {
1918  Authors::const_iterator aAuthor = aAuthors.find(
1919  XclXmlUtils::ToOUString( xNote->GetAuthor() ) );
1920  sal_Int32 nAuthorId = distance( aAuthorsBegin, aAuthor );
1921  xNote->WriteXml( nAuthorId, rStrm );
1922  }
1923 
1924  rComments->endElement( XML_commentList );
1925  rComments->endElement( XML_comments );
1926 
1927  rStrm.PopStream();
1928 }
1929 
1930 // object manager =============================================================
1931 
1933  XclExpRoot( rRoot )
1934 {
1935  InitStream( true );
1936  mxEscherEx = std::make_shared<XclEscherEx>( GetRoot(), *this, *mxDffStrm );
1937 }
1938 
1940  XclExpRoot( rParent.GetRoot() )
1941 {
1942  InitStream( false );
1943  mxEscherEx = std::make_shared<XclEscherEx>( GetRoot(), *this, *mxDffStrm, rParent.mxEscherEx.get() );
1944 }
1945 
1947 {
1948 }
1949 
1951 {
1952  return new XclExpDffSheetAnchor( GetRoot() );
1953 }
1954 
1956 {
1957  return new XclExpMsoDrawingGroup( *mxEscherEx );
1958 }
1959 
1961 {
1963 }
1964 
1966 {
1967  if( pSdrPage )
1968  mxEscherEx->AddSdrPage( *pSdrPage, GetOutput() != EXC_OUTPUT_BINARY );
1969  // the first dummy object may still be open
1970  OSL_ENSURE( mxEscherEx->GetGroupLevel() <= 1, "XclExpObjectManager::ProcessDrawing - still groups open?" );
1971  while( mxEscherEx->GetGroupLevel() )
1972  mxEscherEx->LeaveGroup();
1973  mxObjList->EndSheet();
1974  return mxObjList;
1975 }
1976 
1977 rtl::Reference< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const Reference< XShapes >& rxShapes )
1978 {
1979  if( rxShapes.is() )
1980  mxEscherEx->AddUnoShapes( rxShapes, GetOutput() != EXC_OUTPUT_BINARY );
1981  // the first dummy object may still be open
1982  OSL_ENSURE( mxEscherEx->GetGroupLevel() <= 1, "XclExpObjectManager::ProcessDrawing - still groups open?" );
1983  while( mxEscherEx->GetGroupLevel() )
1984  mxEscherEx->LeaveGroup();
1985  mxObjList->EndSheet();
1986  return mxObjList;
1987 }
1988 
1990 {
1991  mxEscherEx->EndDocument();
1992 }
1993 
1995 {
1996  return mxObjList->GetMsodrawingPerSheet();
1997 }
1998 
2000 {
2001  return !mxObjList->empty();
2002 }
2003 
2004 sal_uInt16 XclExpObjectManager::AddObj( std::unique_ptr<XclObj> pObjRec )
2005 {
2006  return mxObjList->Add( std::move(pObjRec) );
2007 }
2008 
2009 std::unique_ptr<XclObj> XclExpObjectManager::RemoveLastObj()
2010 {
2011  return mxObjList->pop_back();
2012 }
2013 
2014 void XclExpObjectManager::InitStream( bool bTempFile )
2015 {
2016  if( bTempFile )
2017  {
2018  mxTempFile = std::make_shared<::utl::TempFile>();
2019  if( mxTempFile->IsValid() )
2020  {
2021  mxTempFile->EnableKillingFile();
2022  mxDffStrm = ::utl::UcbStreamHelper::CreateStream( mxTempFile->GetURL(), StreamMode::STD_READWRITE );
2023  }
2024  }
2025 
2026  if( !mxDffStrm )
2027  mxDffStrm = std::make_unique<SvMemoryStream>();
2028 
2029  mxDffStrm->SetEndian( SvStreamEndian::LITTLE );
2030 }
2031 
2033  const XclExpObjectManager& rParent, const Size& rPageSize, sal_Int32 nScaleX, sal_Int32 nScaleY ) :
2034  XclExpObjectManager( rParent ),
2035  maPageSize( rPageSize ),
2036  mnScaleX( nScaleX ),
2037  mnScaleY( nScaleY )
2038 {
2039 }
2040 
2042 {
2044 }
2045 
2046 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvStream & WriteXclObjAnchor(SvStream &rStrm, const XclObjAnchor &rAnchor)
Definition: xlescher.hxx:341
XclFontPropSetHelper & GetFontPropSetHelper() const
Returns the property set helper for fonts.
Definition: xlroot.cxx:418
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:47
double mnHeight
const sal_uInt16 EXC_NOTE5_MAXLEN
Definition: xlescher.hxx:40
bool mbRowHidden
Column containing the comment is hidden.
Definition: xeescher.hxx:381
virtual void WriteData(EscherEx &rEscherEx, const tools::Rectangle &rRect) override
Called from SVX DFF converter.
Definition: xeescher.cxx:265
SdrTextHorzAdjust meTHA
true = permanently visible.
Definition: xeescher.hxx:375
XclExpDffAnchorBase(const XclExpRoot &rRoot, sal_uInt16 nFlags=0)
Constructs a dummy client anchor.
Definition: xeescher.cxx:241
#define DBG_ERROR_BIFF()
Definition: xltools.hxx:33
::std::vector< sal_uInt8 > ScfUInt8Vec
Definition: ftools.hxx:253
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2074
std::size_t Write(const void *pData, std::size_t nBytes)
Writes nBytes bytes from memory.
Definition: xestream.cxx:220
static OString ToOString(const Color &rColor)
Definition: xestream.cxx:709
ScAddress maScPos
Text and formatting data (OOXML)
Definition: xeescher.hxx:372
SDRTEXTVERTADJUST_TOP
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xeescher.cxx:345
const sal_uInt16 EXC_ID_OBJSBS
Radio button group data.
Definition: xlescher.hxx:215
tools::Long Height() const
rtl_TextEncoding GetTextEncoding() const
Returns the text encoding to import/export byte strings.
Definition: xlroot.hxx:147
sal_Int32 nIndex
void WriteCellLinkSubRec(XclExpStream &rStrm, sal_uInt16 nSubRecId)
Writes a subrecord containing a cell link, or nothing, if no link present.
Definition: xeescher.cxx:1056
ScAddress aStart
Definition: address.hxx:497
sal_uInt16 mnScrollMin
Scrollbar: Current value.
Definition: xeescher.hxx:287
The MSODRAWINGGROUP record contains the DGGCONTAINER with global DFF data such as the picture contain...
Definition: xeescher.hxx:132
virtual const tools::Rectangle & GetCurrentBoundRect() const
sal_uInt32 mnStrmStart
Class name of the control.
Definition: xeescher.hxx:242
const XclExpString & GetAuthor() const
Definition: xeescher.hxx:362
#define ESCHER_Prop_fshadowObscured
bool IsExportTab(SCTAB nScTab) const
Returns true, if the specified Calc sheet will be exported.
Definition: xelink.cxx:773
MS Excel binary .xls.
Definition: xlconst.hxx:43
void SetAutoLine(bool b)
Definition: xcl97rec.hxx:135
XclExpChartRef mxChart
Definition: xeescher.hxx:328
static sax_fastparser::FSHelperPtr WriteElement(sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const T &value)
Definition: xestream.hxx:273
std::unique_ptr< XclExpMsoDrawing > pClientTextbox
Definition: xcl97rec.hxx:101
virtual void Save(XclExpStream &rStrm) override
Writes the BITMAP record.
Definition: xeescher.cxx:393
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
Definition: document.cxx:997
SvStream & WriteUInt16(sal_uInt16 nUInt16)
const OUString & GetMacro() const
Definition: userdat.hxx:82
const sal_uInt16 EXC_OBJTYPE_UNKNOWN
Definition: xlescher.hxx:71
This class is used to export Excel record streams.
Definition: xestream.hxx:72
SCROW Row() const
Definition: address.hxx:274
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xeescher.cxx:1568
#define ESCHER_Prop_pictureId
const sal_uInt16 EXC_OBJ_SCROLLBAR_DEFFLAGS
Definition: xlescher.hxx:184
const sal_uInt16 EXC_ID_NOTE
Definition: xlescher.hxx:38
sal_uInt16 mnRX
Y offset in top row (1/256 of row height).
Definition: xlescher.hxx:287
sal_uInt16 mnObjId
Calc cell address of the note.
Definition: xeescher.hxx:373
constexpr tools::Long Left() const
const sal_uInt16 EXC_OBJ_INVALID_ID
Definition: xlescher.hxx:46
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
#define ESCHER_OPT
XclExpLinkManager & GetLocalLinkManager() const
Returns the local link manager for the current sheet.
Definition: xeroot.cxx:135
static OUString ToOUString(const char *s)
Definition: xestream.cxx:785
rtl::Reference< XclExpRecordBase > CreateDrawingGroup()
Creates and returns the MSODRAWINGGROUP record containing global DFF data in the DGGCONTAINER.
Definition: xeescher.cxx:1955
XclTokenArrayRef mxMacroLink
Definition: xeescher.hxx:196
const sal_uInt16 EXC_ID_OBJPICTFMLA
Option flags.
Definition: xlescher.hxx:212
SdrTextHorzAdjust
std::unique_ptr< XclObj > RemoveLastObj()
Definition: xeescher.cxx:2009
const OUString & GetAuthor() const
Returns the author date of this note.
Definition: postit.hxx:214
XclObjAnchor maAnchor
Definition: xeescher.hxx:64
void ConvertSheetLinks(css::uno::Reference< css::drawing::XShape > const &xShape)
Tries to get spreadsheet cell link and source range link from the passed shape.
Definition: xeescher.cxx:455
static ScMacroInfo * GetMacroInfo(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2641
long Long
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
sal_uInt16 Insert(const XclFontData &rFontData, XclExpColorType eColorType, bool bAppFont=false)
Inserts a new font with the passed font data into the buffer if not present.
Definition: xestyle.cxx:1192
const sal_uInt8 EXC_OBJ_LISTBOX_MULTI
Single selection.
Definition: xlescher.hxx:189
const sal_uInt16 EXC_ID_MSODRAWINGGROUP
Definition: xlescher.hxx:259
OoxmlVersion getVersion() const
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
virtual void WriteSubRecs(XclExpStream &rStrm) override
Definition: xeescher.cxx:582
const sal_uInt16 EXC_OBJ_SCROLLBAR_HOR
Definition: xlescher.hxx:182
This struct helps reading and writing Excel fonts.
Definition: xlstyle.hxx:285
virtual void Save(XclExpStream &rStrm) override
Writes the NOTE record, if the respective Escher object is present.
Definition: xeescher.cxx:1680
void Commit(SvStream &rSt, sal_uInt16 nVersion=3, sal_uInt16 nRecType=ESCHER_OPT)
#define ESCHER_Prop_pib
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
XclEscherEx & mrEscherEx
Definition: xeescher.hxx:125
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
Definition: xeroot.cxx:87
void SetRecSize(std::size_t nRecSize)
Sets a new record size prediction.
Definition: xerecord.hxx:163
void EndDocument()
Finalizes the object manager after conversion of all sheets.
Definition: xeescher.cxx:1989
#define ESCHER_ClientAnchor
bool mbAutoFill
Position & Size locked.
Definition: xeescher.hxx:379
virtual ~XclExpObjectManager() override
Definition: xeescher.cxx:1946
sal_uInt16 mnScrollPage
Scrollbar: Single step.
Definition: xeescher.hxx:290
sal_uInt16 mnHeight
Font color.
Definition: xlstyle.hxx:290
bool GetBoolProperty(const OUString &rPropName) const
Gets the specified Boolean property from the property set.
Definition: fapihelper.cxx:188
std::shared_ptr< XclEscherEx > mxEscherEx
Definition: xeescher.hxx:442
SDRTEXTVERTADJUST_BLOCK
XclTokenArrayRef CreateNameXFormula(sal_uInt16 nExtSheet, sal_uInt16 nExtName)
Creates a single tNameXR token for a reference to an external name.
Definition: xeformula.cxx:2693
ScAddress aEnd
Definition: address.hxx:498
bool mbFlatButton
Scrollbar: Page step.
Definition: xeescher.hxx:291
#define SC_UNONAME_BOUNDCELL
Definition: unonames.hxx:659
void set_flag(Type &rnBitField, Type nMask, bool bSet=true)
Sets or clears (according to bSet) all set bits of nMask in rnBitField.
Definition: ftools.hxx:95
XclAddress maLast
Definition: xladdress.hxx:61
sal_uInt32 mnRow
Definition: xladdress.hxx:32
const sal_uInt16 EXC_IMGDATA_BMP
Definition: xlescher.hxx:245
sal_uInt16 GetSize() const
Returns the size of the token array in bytes.
Definition: xlformula.cxx:735
ReturnType limit_cast(Type nValue, ReturnType nMin, ReturnType nMax)
Returns the value, if it is not less than nMin and not greater than nMax, otherwise one of the limits...
Definition: ftools.hxx:63
XclAddress maFirst
Definition: xladdress.hxx:60
void FindExtSheet(sal_uInt16 &rnExtSheet, sal_uInt16 &rnXclTab, SCTAB nScTab, XclExpRefLogEntry *pRefLogEntry=nullptr)
Searches for an EXTERNSHEET index for the given Calc sheet.
Definition: xelink.cxx:2578
virtual void AddShape(sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID=0)
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:285
XclExpShapeObj(XclExpObjectManager &rRoot, css::uno::Reference< css::drawing::XShape > const &xShape, ScDocument *pDoc)
Definition: xeescher.cxx:1839
virtual SdrObjKind GetObjIdentifier() const
virtual void ImplSetFlags(const SdrObject &rSdrObj) override
Definition: xeescher.cxx:288
void SetSdrObject(const SdrObject &rSdrObj)
Sets the anchor position and flags according to the passed SdrObject.
Definition: xeescher.cxx:252
bool SetMacroLink(const css::script::ScriptEventDescriptor &rEvent)
Sets the name of a macro attached to this control.
Definition: xeescher.cxx:915
#define ESCHER_ClientTextbox
void SetPrintable(bool b)
Definition: xcl97rec.hxx:133
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xcl97rec.cxx:489
void StartSheet()
Initializes the object manager for a new sheet.
Definition: xeescher.cxx:1960
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xeescher.cxx:1868
void SetFlags(const SdrObject &rSdrObj)
Sets the flags according to the passed SdrObject.
Definition: xeescher.cxx:247
virtual ~XclExpControlHelper() override
Definition: xeescher.cxx:451
const sal_uInt16 EXC_ID_OBJFLAGS
Clipboard format.
Definition: xlescher.hxx:211
const sal_uInt16 EXC_ID_OBJSBSFMLA
Note data.
Definition: xlescher.hxx:217
XAdjustmentListener.adjustmentValueChanged.
Definition: xlescher.hxx:411
XTextListener.textChanged.
Definition: xlescher.hxx:410
sal_Int16 mnLineCount
Checked/unchecked state.
Definition: xeescher.hxx:284
uno::Reference< drawing::XShape > const mxShape
FuncFlags mnFlags
Information about all parameters.
XclExpOcxControlObj(XclExpObjectManager &rObjMgr, css::uno::Reference< css::drawing::XShape > const &xShape, const tools::Rectangle *pChildAnchor, const OUString &rClassName, sal_uInt32 nStrmStart, sal_uInt32 nStrmSize)
Definition: xeescher.cxx:527
SvStream & GetStream() const
DstType sequenceToContainer(const css::uno::Sequence< SrcType > &i_Sequence)
Access to global data from other classes.
Definition: xeroot.hxx:112
const sal_uInt16 EXC_FONT_APP
Definition: xlstyle.hxx:76
#define ESCHER_Prop_wzName
const sal_uInt16 EXC_OBJ_LISTBOX_FLAT
Definition: xlescher.hxx:193
static void WriteFormulaSubRec(XclExpStream &rStrm, sal_uInt16 nSubRecId, const XclTokenArray &rTokArr)
Writes a formula subrecord with special style only valid in OBJ records.
Definition: xeescher.cxx:517
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
const sal_uInt16 EXC_OBJTYPE_SCROLLBAR
Definition: xlescher.hxx:65
OUString getNamespaceURL(sal_Int32 nNSID) const
const sal_uInt8 EXC_OBJ_LISTBOX_SINGLE
Definition: xlescher.hxx:188
MS Excel 4.0.
Definition: xlconst.hxx:34
Additional class containing cell annotation data.
Definition: postit.hxx:160
bool SetMacroLink(const css::script::ScriptEventDescriptor &rEvent, const XclTbxEventType &nEventType)
Sets the name of a macro for object of passed type.
Scanline GetScanline(tools::Long nY) const
XclExpDffEmbeddedAnchor(const XclExpRoot &rRoot, const Size &rPageSize, sal_Int32 nScaleX, sal_Int32 nScaleY)
Definition: xeescher.cxx:302
bool HasObj() const
Definition: xeescher.cxx:1999
sal_uInt16 GetSourceEntryCount() const
Returns the number of entries in the source range, or 0, if no source set.
Definition: xeescher.hxx:179
XclTbxEventType
Definition: xlescher.hxx:405
SCTAB GetTab() const
Definition: xcl97rec.hxx:130
void ImplWriteAnchor(const SdrObject *pSdrObj, const tools::Rectangle *pChildAnchor)
Definition: xcl97rec.cxx:407
static OUString GetXclMacroName(const OUString &rSbMacroUrl)
Returns the Excel macro name from a full StarBasic macro URL.
Definition: xltools.cxx:714
void WriteArray(XclExpStream &rStrm) const
Writes the tokens of the token array (without size field).
Definition: xlformula.cxx:781
sal_uInt32 GetDffFragmentSize(sal_uInt32 nFragmentKey)
Returns the size of the specified DFF stream fragment.
Definition: xcl97esc.cxx:140
#define ESCHER_Prop_wzDescription
void PushStream(sax_fastparser::FSHelperPtr const &aStream)
Definition: xestream.cxx:918
const ::basegfx::B2DSize maPageSize
void SaveSheetXml(XclExpXmlStream &rStrm, const OUString &aIdFormControlPr) const
Definition: xeescher.cxx:1417
#define ESCHER_ShpInst_HostControl
const sal_uInt16 EXC_IMGDATA_WIN
Definition: xlescher.hxx:247
css::uno::Reference< css::chart::XChartDocument > GetChartDoc() const
Definition: xeescher.cxx:1596
SDRTEXTHORZADJUST_CENTER
SCTAB Tab() const
Definition: address.hxx:283
#define ESCHER_Prop_LockAgainstGrouping
const sal_uInt16 EXC_ESC_ANCHOR_POSLOCKED
Definition: xlescher.hxx:266
void SetAutoFill(bool b)
Definition: xcl97rec.hxx:134
Base class for records holding DFF stream fragments.
Definition: xeescher.hxx:116
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
sal_uInt16 mnScrollStep
Scrollbar: Maximum value.
Definition: xeescher.hxx:289
OString maNoteText
Name of the author.
Definition: xeescher.hxx:370
sax_fastparser::FSHelperPtr & GetCurrentStream()
Definition: xestream.cxx:912
OUString getRelationship(Relationship eRelationship)
tools::Rectangle maAreaTo
Definition: xeescher.hxx:301
void PopStream()
Definition: xestream.cxx:923
virtual void ImplCalcAnchorRect(const tools::Rectangle &rRect, MapUnit eMapUnit) override
Definition: xeescher.cxx:297
SvStream * QueryPictureStream()
Represents the position (anchor) of a shape in an embedded draw page.
Definition: xeescher.hxx:83
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the NOTE record.
Definition: xeescher.cxx:1727
bool mbPrint
Scrollbar: true = horizontal.
Definition: xeescher.hxx:295
XclExpMsoDrawingGroup(XclEscherEx &rEscherEx)
Definition: xeescher.cxx:352
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:127
bool mbAutoScale
text vertical adjust
Definition: xeescher.hxx:377
void WriteXml(sal_Int32 nAuthorId, XclExpXmlStream &rStrm)
Definition: xeescher.cxx:1743
double distance
const sal_uInt16 EXC_OBJ_SCROLLBAR_FLAT
Definition: xlescher.hxx:185
const XclTokenArray * GetCellLinkTokArr() const
Returns the Excel token array of the cell link, or 0, if no link present.
Definition: xeescher.hxx:175
#define ESCHER_Prop_fNoLineDrawDash
bool IsValid() const
Definition: address.hxx:305
sal_uInt32 mnBY
X offset in right column (1/1024 of column width).
Definition: xlescher.hxx:288
static sal_Int32 GetHmmFromTwips(sal_Int32 nTwips)
Returns the length in 1/100 mm calculated from a length in twips.
Definition: xltools.cxx:302
void WriteSbs(XclExpStream &rStrm)
Writes the ftSbs sub structure containing scrollbar data.
Definition: xeescher.cxx:1062
void SetLocked(bool b)
Definition: xcl97rec.hxx:132
SDRTEXTVERTADJUST_BOTTOM
static void WriteFormula(XclExpStream &rStrm, const XclTokenArray &rTokArr)
Writes a formula with special style only valid in OBJ records.
Definition: xeescher.cxx:508
SDRTEXTHORZADJUST_BLOCK
const sal_uInt16 EXC_OBJTYPE_DROPDOWN
Definition: xlescher.hxx:68
SDRTEXTHORZADJUST_LEFT
const sal_uInt16 EXC_OBJTYPE_GROUPBOX
Definition: xlescher.hxx:67
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4495
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xeescher.cxx:1193
sal_uInt8 * Scanline
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:35
const sal_uInt16 EXC_ID_MSODRAWING
Definition: xlescher.hxx:263
vcl::PixelFormat getPixelFormat() const
XclOutput GetOutput() const
Returns the current output format of the importer/exporter.
Definition: xlroot.hxx:143
const sal_uInt16 EXC_OBJ_GROUPBOX_FLAT
Dropdown style: filtered.
Definition: xlescher.hxx:203
static OUString ExtractFromMacroDescriptor(const css::script::ScriptEventDescriptor &rDescriptor, XclTbxEventType eEventType)
Tries to extract an Excel macro name from the passed macro descriptor.
Definition: xlescher.cxx:324
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
Definition: xeroot.cxx:81
tools::Rectangle maCommentFrom
Row containing the comment is hidden.
Definition: xeescher.hxx:382
sal_uInt16 mnLX
Definition: xlescher.hxx:285
ScAddress mxCellLinkAddress
Number of entries in source range.
Definition: xeescher.hxx:191
int i
XclExpDffDropDownAnchor(const XclExpRoot &rRoot, const ScAddress &rScPos)
Definition: xeescher.cxx:327
const sal_uInt8 EXC_OBJ_VER_CENTER
Definition: xlescher.hxx:128
Graphic maGraphic
Definition: xeescher.hxx:158
#define ESCHER_Prop_WrapText
Base class for DFF client anchor atoms used in spreadsheets.
Definition: xeescher.hxx:41
static ScAnchorType GetAnchorType(const SdrObject &)
Definition: drwlayer.cxx:2446
const sal_uInt16 EXC_OBJ_CHECKBOX_FLAT
Definition: xlescher.hxx:169
bool mbMultiSel
False = 3D border style; True = Flat border style.
Definition: xeescher.hxx:293
sax_fastparser::FSHelperPtr CreateOutputStream(const OUString &sFullStream, std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream > &xParentRelation, const char *sContentType, std::u16string_view sRelationshipType, OUString *pRelationshipId=nullptr)
Definition: xestream.cxx:941
virtual void ImplCalcAnchorRect(const tools::Rectangle &rRect, MapUnit eMapUnit) override
Definition: xeescher.cxx:316
const sal_uInt16 EXC_OBJ_SCROLLBAR_MAX
Definition: xlescher.hxx:180
const sal_uInt16 EXC_OBJTYPE_LABEL
Definition: xlescher.hxx:62
XclEscherEx & mrEscherEx
Definition: xcl97rec.hxx:99
const sal_uInt8 EXC_OBJ_HOR_CENTER
Definition: xlescher.hxx:123
#define SC_UNONAME_CELLRANGE
Definition: unonames.hxx:661
sal_uInt16 mnEntryCount
Formula for source data range.
Definition: xeescher.hxx:189
sal_Int64 convertHmmToEmu(sal_Int32 nValue)
const sal_uInt16 EXC_ESC_ANCHOR_LOCKED
Definition: xlescher.hxx:268
constexpr tools::Long Right() const
tools::Long Width() const
void InitStream(bool bTempFile)
Definition: xeescher.cxx:2014
std::size_t WriteBytes(const void *pData, std::size_t nSize)
virtual void WriteSubRecs(XclExpStream &rStrm) override
Definition: xcl97rec.cxx:1071
virtual void EndShape(sal_Int32 nShapeElement)
static void WriteFromTo(XclExpXmlStream &rStrm, const XclObjAny &rObj)
Definition: xcl97rec.cxx:1161
OUString GetText() const
Returns the caption text of this note.
Definition: postit.cxx:916
void EndRecord()
Checks and corrects real record length.
Definition: xestream.cxx:125
const sal_uInt16 EXC_ID_OBJGBODATA
Scroll bar/list box/combo box cell link.
Definition: xlescher.hxx:218
XclExpStringRef mpNoteContents
Main text of the note (<=BIFF7).
Definition: xeescher.hxx:371
const sal_uInt16 EXC_NOTE_VISIBLE
Definition: xlescher.hxx:39
constexpr tools::Long Top() const
SdrCaptionObj * GetOrCreateCaption(const ScAddress &rPos) const
Returns the caption object of this note.
Definition: postit.cxx:953
sal_uInt16 GetObjType() const
Definition: xcl97rec.hxx:125
std::unique_ptr< SvStream > mxDffStrm
Definition: xeescher.hxx:441
XclExpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
Definition: xeroot.cxx:141
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
Definition: xeroot.cxx:75
Reference< XModel > getXModel(const Reference< XInterface > &_rxComponent)
#define ESCHER_Prop_FitTextToShape
sal_uInt16 mnScrollMax
Scrollbar: Minimum value.
Definition: xeescher.hxx:288
virtual ~XclExpShapeObj() override
Definition: xeescher.cxx:1853
sal_uInt16 mnState
Height of the control.
Definition: xeescher.hxx:283
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1996
sal_uInt16 mnCol
Definition: xladdress.hxx:31
XclExpRecordList< XclExpNote > & mrNotes
Definition: xeescher.hxx:395
XclExpTbxControlObj(XclExpObjectManager &rObjMgr, css::uno::Reference< css::drawing::XShape > const &xShape, const tools::Rectangle *pChildAnchor)
Definition: xeescher.cxx:633
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
virtual void ImplSetFlags(const SdrObject &rSdrObj)
Definition: xeescher.cxx:272
virtual void ImplCalcAnchorRect(const tools::Rectangle &rRect, MapUnit eMapUnit)
Definition: xeescher.cxx:277
#define MSPROP_DESCRIPTION_MAX_LEN
tools::Rectangle maAreaFrom
Definition: xeescher.hxx:300
void CopyFromStream(SvStream &rInStrm, sal_uInt64 nBytes=STREAM_SEEK_TO_END)
Copies nBytes bytes from current position of the stream rInStrm.
Definition: xestream.cxx:288
XclExpImgData(const Graphic &rGraphic, sal_uInt16 nRecId)
Definition: xeescher.cxx:387
const XclTokenArray * GetSourceRangeTokArr() const
Returns the Excel token array of the source range, or 0, if no link present.
Definition: xeescher.hxx:177
std::shared_ptr< FastSerializerHelper > FSHelperPtr
virtual void ImplSetFlags(const SdrObject &rSdrObj) override
Definition: xeescher.cxx:311
const sal_uInt16 EXC_ID_OBJCBLS
OLE link formula.
Definition: xlescher.hxx:213
const sal_uInt16 EXC_OBJ_CHECKBOX_CHECKED
Definition: xlescher.hxx:167
static void FillScAddress(ScAddress &rScAddress, const css::table::CellAddress &rApiAddress)
Definition: convuno.hxx:63
const XclExpRoot & mrRoot
Definition: xeescher.hxx:368
sal_uInt16 mnObjType
Definition: xcl97rec.hxx:103
sal_Int16 mnSelEntry
Combobox dropdown line count.
Definition: xeescher.hxx:285
const sal_uInt16 EXC_OBJ_CHECKBOX_TRISTATE
Definition: xlescher.hxx:168
SCCOL Col() const
Definition: address.hxx:279
virtual ~XclExpChartObj() override
Definition: xeescher.cxx:1556
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:118
std::unique_ptr< XclTxo > pTxo
Definition: xcl97rec.hxx:102
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
Definition: xlroot.hxx:162
sal_uInt32 mnFragmentKey
Reference to the DFF converter containing the DFF stream.
Definition: xeescher.hxx:126
#define ESCHER_Prop_fillBackColor
bool Is() const
Returns true, if the contained XPropertySet interface is valid.
Definition: fapihelper.hxx:128
void SaveVml(XclExpXmlStream &rStrm)
Save into xl/drawings/vmlDrawing1.vml.
Definition: xeescher.cxx:1178
void ReadFontProperties(XclFontData &rFontData, const ScfPropertySet &rPropSet, XclFontPropSetType eType, sal_Int16 nScript=-1)
Reads all font properties from the passed property set.
Definition: xlstyle.cxx:625
constexpr tools::Long Bottom() const
Bitmap GetBitmap(Color aTransparentReplaceColor) const
XclMacroHelper(const XclExpRoot &rRoot)
Definition: xeescher.cxx:1795
sal_uInt16 mnFlags
The client anchor data.
Definition: xeescher.hxx:65
static OUString GetStreamName(const char *sStreamDir, const char *sStream, sal_Int32 nId)
Definition: xestream.cxx:694
sal_uInt32 GetDffFragmentPos(sal_uInt32 nFragmentKey)
Returns the position of the specified DFF stream fragment.
Definition: xcl97esc.cxx:133
XclExpComments(SCTAB nTab, XclExpRecordList< XclExpNote > &rNotes)
Definition: xeescher.cxx:1863
One or more MSODRAWING records contain the DFF stream data for a drawing shape.
Definition: xeescher.hxx:141
SdrTextVertAdjust meTVA
text horizontal adjust
Definition: xeescher.hxx:376
const sal_uInt16 EXC_OBJTYPE_CHECKBOX
Definition: xlescher.hxx:59
#define ESCHER_Prop_fillColor
XclTbxEventType meEventType
Indexes of all selected entries in a multi selection.
Definition: xeescher.hxx:281
SDRTEXTHORZADJUST_RIGHT
RecType * GetRecord(size_t nPos) const
Returns reference to an existing record or empty reference on error.
Definition: xerecord.hxx:333
#define ESCHER_DggContainer
Binary representation of an Excel token array.
Definition: xlformula.hxx:376
const sal_uInt16 EXC_OBJ_CHECKBOX_UNCHECKED
Definition: xlescher.hxx:166
XclTokenArrayRef mxSrcRange
Formula for linked cell.
Definition: xeescher.hxx:188
A wrapper for a UNO property set.
Definition: fapihelper.hxx:103
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
rtl::Reference< XclExpRecordBase > ProcessDrawing(const SdrPage *pSdrPage)
Processes a drawing page and returns the record block containing all related records (MSODRAWING...
Definition: xeescher.cxx:1965
OUString maClassName
Definition: xeescher.hxx:241
#define ESCHER_SpContainer
XclExpNote(const XclExpRoot &rRoot, const ScAddress &rScPos, const ScPostIt *pScNote, std::u16string_view rAddText)
Constructs a NOTE record from the passed note object and/or the text.
Definition: xeescher.cxx:1606
OUString SaveControlPropertiesXml(XclExpXmlStream &rStrm) const
Definition: xeescher.cxx:1340
OUString maMacroName
Token array containing a link to an attached macro.
Definition: xeescher.hxx:197
const sal_uInt16 EXC_OBJTYPE_SPIN
Definition: xlescher.hxx:64
virtual void CloseContainer()
static SC_DLLPUBLIC OUString addToken(std::u16string_view rTokenList, std::u16string_view rToken, sal_Unicode cSep, sal_Int32 nSepCount=1, bool bForceSep=false)
Adds the string rToken to rTokenList, using a list separator character.
Definition: global.cxx:665
bool mbVisible
sal_uInt16 mnRecId
The VCL graphic.
Definition: xeescher.hxx:159
constexpr OUStringLiteral SC_SERVICENAME_LISTSOURCE
Definition: unonames.hxx:27
#define OSL_ENSURE_BIFF(c)
Definition: xltools.hxx:34
const sal_uInt16 EXC_ESC_ANCHOR_SIZELOCKED
Definition: xlescher.hxx:267
virtual sal_Int32 StartShape()
void AddAtom(sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion=0, int nRecInstance=0)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 InsertMacroCall(const OUString &rMacroName, bool bVBasic, bool bFunc, bool bHidden=false)
Searches or inserts a defined name describing a macro name.
Definition: xename.cxx:837
unsigned char sal_uInt8
#define ESCHER_Prop_lineColor
XclExpControlHelper(const XclExpRoot &rRoot)
Definition: xeescher.cxx:445
rtl::Reference< XclExpObjList > mxObjList
Definition: xeescher.hxx:443
std::size_t GetSize() const
Returns the byte count the whole string will take on export.
Definition: xestring.cxx:248
#define ESCHER_Prop_fNoFillHitTest
bool Convert(BmpConversion eConversion)
bool mbFlatBorder
False = 3D button style; True = Flat button style.
Definition: xeescher.hxx:292
void setShapeId(sal_Int32 aShapeId)
Definition: xeescher.cxx:1082
virtual void OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance=0)
#define DEFTBINS
const css::uno::Reference< css::drawing::XShape > mxShape
Definition: xeescher.hxx:279
bool mbScrollHor
true = Multi selection in listbox.
Definition: xeescher.hxx:294
virtual void WriteSubRecs(XclExpStream &rStrm) override
Definition: xeescher.cxx:1857
std::shared_ptr< ::utl::TempFile > mxTempFile
Definition: xeescher.hxx:440
const sal_uInt16 EXC_ID_OBJLBSDATA
Check box/radio button data.
Definition: xlescher.hxx:222
bool mbVisible
Escher object ID (BIFF8).
Definition: xeescher.hxx:374
virtual XclExpDffAnchorBase * CreateDffAnchor() const
Creates a new DFF client anchor object.
Definition: xeescher.cxx:1950
void WriteDffData(EscherEx &rEscherEx) const
Writes the DFF client anchor structure with the current anchor position.
Definition: xeescher.cxx:258
css::uno::Reference< css::drawing::XShape > mxShape
The chart itself (BOF/EOF substream data).
Definition: xeescher.hxx:329
XclTokenArrayRef CreateFormula(XclFormulaType eType, const ScTokenArray &rScTokArr, const ScAddress *pScBasePos=nullptr, XclExpRefLog *pRefLog=nullptr)
Creates and returns the token array of a formula.
Definition: xeformula.cxx:2643
void insert_value(Type &rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount)
Inserts a value into a bitfield.
Definition: ftools.hxx:102
const sal_uInt16 EXC_ID_OBJCBLSFMLA
List box/combo box data.
Definition: xlescher.hxx:223
const sal_uInt16 EXC_OBJTYPE_LISTBOX
Definition: xlescher.hxx:66
void AddOpt(sal_uInt16 nPropID, bool bBlib, sal_uInt32 nSizeReduction, SvMemoryStream &rStream)
virtual void Save(XclExpStream &rStrm) override
Writes the OBJ record and the entire chart substream.
Definition: xeescher.cxx:1560
XclExpObjectManager & GetObjectManager() const
Returns the drawing object manager.
Definition: xeroot.cxx:147
XActionListener.actionPerformed.
Definition: xlescher.hxx:408
sal_Int32 mnShapeId
Definition: xeescher.hxx:299
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xeescher.cxx:436
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:122
sal_Int32 mnHeight
Type of supported macro event.
Definition: xeescher.hxx:282
const sal_uInt16 EXC_OBJTYPE_CHART
Definition: xlescher.hxx:54
void SetInvalid()
Definition: address.hxx:299
BitmapColor GetPixelFromData(const sal_uInt8 *pData, tools::Long nX) const
sal_uInt32 mnTY
X offset in left column (1/1024 of column width).
Definition: xlescher.hxx:286
const OUString & GetMacroName() const
Definition: xeescher.cxx:1810
virtual XclExpDffAnchorBase * CreateDffAnchor() const override
Creates a new DFF client anchor object for embedded objects according to the scaling data passed to t...
Definition: xeescher.cxx:2041
sal_uInt16 mnScrollValue
Selected entry in combobox (1-based).
Definition: xeescher.hxx:286
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
size_t GetSize() const
Definition: xerecord.hxx:327
constexpr OUStringLiteral SC_SERVICENAME_VALBIND
Definition: unonames.hxx:25
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4479
sal_uInt64 GetStreamPos() const
tools::Rectangle maCommentTo
From and From Offset.
Definition: xeescher.hxx:383
const std::u16string_view aStringList[]
Definition: vbadialog.cxx:31
void StartRecord(sal_uInt16 nRecId, std::size_t nRecSize)
Starts a new record: writes header data, stores calculated record size.
Definition: xestream.cxx:113
#define ESCHER_SplitMenuColors
Represents the position (anchor) of an object in a Calc sheet.
Definition: xeescher.hxx:69
const EditTextObject * GetEditTextObject() const
Returns the pointer to the current edit text object, or null.
Definition: postit.cxx:910
static XclExpStringRef CreateString(const XclExpRoot &rRoot, const OUString &rString, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Creates a new unformatted string from the passed string.
Definition: xehelper.cxx:525
MapUnit
XclExpObjectManager & mrRoot
Definition: xeescher.hxx:302
XclExpObjectManager(const XclExpRoot &rRoot)
Definition: xeescher.cxx:1932
sal_uInt32 mnStrmSize
Start position in 'Ctls' stream.
Definition: xeescher.hxx:243
XclExpDffSheetAnchor(const XclExpRoot &rRoot)
Definition: xeescher.cxx:282
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
#define DEFLRINS
virtual const tools::Rectangle & GetLogicRect() const
XclExpDffNoteAnchor(const XclExpRoot &rRoot, const tools::Rectangle &rRect)
Definition: xeescher.cxx:321
XclExpMsoDrawing(XclEscherEx &rEscherEx)
Definition: xeescher.cxx:382
#define ESCHER_Prop_fPrint
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:87
virtual ~XclMacroHelper() override
Definition: xeescher.cxx:1800
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:79
virtual void WriteSubRecs(XclExpStream &rStrm) override
Definition: xeescher.cxx:920
Area in a chart.
Definition: xestyle.hxx:53
const sal_uInt16 EXC_OBJTYPE_PICTURE
Definition: xlescher.hxx:57
void WriteMacroSubRec(XclExpStream &rStrm)
Writes an ftMacro subrecord containing a macro link, or nothing, if no macro present.
Definition: xeescher.cxx:1804
bool IsEmpty() const
Definition: xerecord.hxx:326
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
Chart source ranges.
Definition: xlformula.hxx:168
const char * UseIf(const char *s, bool bUse)
XclExpFontBuffer & GetFontBuffer() const
Returns the font buffer.
Definition: xeroot.cxx:111
const sal_uInt16 EXC_OBJ_SCROLLBAR_MIN
Definition: xlescher.hxx:179
XclExpChartObj(XclExpObjectManager &rObjMgr, css::uno::Reference< css::drawing::XShape > const &xShape, const tools::Rectangle *pChildAnchor, ScDocument *pDoc)
Definition: xeescher.cxx:1515
XclExpEmbeddedObjectManager(const XclExpObjectManager &rParent, const Size &rPageSize, sal_Int32 nScaleX, sal_Int32 nScaleY)
Definition: xeescher.cxx:2032
bool GetProperty(Type &rValue, const OUString &rPropName) const
Gets the specified property from the property set.
Definition: fapihelper.hxx:148
const sal_uInt16 EXC_ID_OBJMACRO
End of OBJ.
Definition: xlescher.hxx:207
XclExpString maAuthor
Definition: xeescher.hxx:369
const sal_uInt16 EXC_OBJTYPE_BUTTON
Definition: xlescher.hxx:56
XclExpMsoDrawing * GetMsodrawingPerSheet()
Definition: xeescher.cxx:1994
Helper class for form controls to manage spreadsheet links .
Definition: xeescher.hxx:163
bool mbLocked
Auto scale text.
Definition: xeescher.hxx:378
SdrTextVertAdjust
const sal_uInt16 EXC_OBJTYPE_OPTIONBUTTON
Definition: xlescher.hxx:60
ScfInt16Vec maMultiSel
Definition: xeescher.hxx:280
bool ConvertAddress(XclAddress &rXclPos, const ScAddress &rScPos, bool bWarn)
Converts the passed Calc cell address to an Excel cell address.
Definition: xehelper.cxx:186
XclTokenArrayRef mxCellLink
Definition: xeescher.hxx:187
const Graphic maGraphic
sal_uInt16 AddObj(std::unique_ptr< XclObj > pObjRec)
Definition: xeescher.cxx:2004
All text objects in charts.
Definition: xlstyle.hxx:398
const sal_uInt16 EXC_ID_OBJCF
Group marker.
Definition: xlescher.hxx:210
Base class for single records with any content.
Definition: xerecord.hxx:142
sal_Int16 SCTAB
Definition: types.hxx:22
#define ESCHER_Prop_lTxid
EscherGraphicProvider & GetGraphicProvider()
void SetRect(const XclRoot &rRoot, SCTAB nScTab, const tools::Rectangle &rRect, MapUnit eMapUnit)
Initializes the anchor coordinates for a sheet.
Definition: xlescher.cxx:154
#define ESCHER_ClientData
XclExpMsoDrawingBase(XclEscherEx &rEscherEx, sal_uInt16 nRecId)
Definition: xeescher.cxx:338
SDRTEXTVERTADJUST_CENTER
static css::uno::Reference< css::awt::XControlModel > GetControlModel(css::uno::Reference< css::drawing::XShape > const &xShape)
Returns the API control model from the passed API shape object.
Definition: xlescher.cxx:282
void WriteZeroBytes(std::size_t nBytes)
Writes a sequence of nBytes zero bytes (respects slice setting).
Definition: xestream.cxx:261
OUString maName
Definition: xlstyle.hxx:287
bool m_bDetectedRangeSegmentation false
bool mbColHidden
Auto Fill Style.
Definition: xeescher.hxx:380