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