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