LibreOffice Module sc (master)  1
transobj.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 <scitems.hxx>
21 #include <editeng/justifyitem.hxx>
22 
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <com/sun/star/embed/XTransactedObject.hpp>
25 
26 #include <osl/diagnose.h>
27 #include <unotools/tempfile.hxx>
29 #include <comphelper/fileformat.h>
32 #include <sot/storage.hxx>
33 #include <vcl/gdimtf.hxx>
34 #include <vcl/jobset.hxx>
35 #include <vcl/svapp.hxx>
36 #include <vcl/virdev.hxx>
37 #include <sfx2/docfile.hxx>
38 
39 #include <transobj.hxx>
40 #include <patattr.hxx>
41 #include <cellvalue.hxx>
42 #include <cellform.hxx>
43 #include <document.hxx>
44 #include <viewopti.hxx>
45 #include <editutil.hxx>
46 #include <impex.hxx>
47 #include <formulacell.hxx>
48 #include <printfun.hxx>
49 #include <docfunc.hxx>
50 #include <scmod.hxx>
51 #include <dragdata.hxx>
52 
53 #include <editeng/paperinf.hxx>
54 #include <editeng/sizeitem.hxx>
55 #include <formula/errorcodes.hxx>
56 #include <docsh.hxx>
57 #include <markdata.hxx>
58 #include <stlpool.hxx>
59 #include <viewdata.hxx>
60 #include <dociter.hxx>
61 #include <cellsuno.hxx>
62 #include <stringutil.hxx>
63 #include <formulaiter.hxx>
64 
65 using namespace com::sun::star;
66 
67 constexpr sal_uInt32 SCTRANS_TYPE_IMPEX = 1;
68 constexpr sal_uInt32 SCTRANS_TYPE_EDIT_RTF = 2;
69 constexpr sal_uInt32 SCTRANS_TYPE_EDIT_BIN = 3;
70 constexpr sal_uInt32 SCTRANS_TYPE_EMBOBJ = 4;
71 constexpr sal_uInt32 SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT = 5;
72 
73 void ScTransferObj::GetAreaSize( const ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol )
74 {
75  SCCOL nMaxCol = 0;
76  SCROW nMaxRow = 0;
77  for( SCTAB nTab = nTab1; nTab <= nTab2; nTab++ )
78  {
79  SCCOL nLastCol = 0;
80  SCROW nLastRow = 0;
81  // GetPrintArea instead of GetCellArea - include drawing objects
82  if( pDoc->GetPrintArea( nTab, nLastCol, nLastRow ) )
83  {
84  if( nLastCol > nMaxCol )
85  nMaxCol = nLastCol;
86  if( nLastRow > nMaxRow )
87  nMaxRow = nLastRow;
88  }
89  }
90  nRow = nMaxRow;
91  nCol = nMaxCol;
92 }
93 
94 void ScTransferObj::PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor,
95  const ScRange& rBlock )
96 {
97  if (!pDoc)
98  return;
99 
100  tools::Rectangle aBound( Point(), pDev->GetOutputSize() );
101 
102  ScViewData aViewData(nullptr,nullptr);
103  aViewData.InitData( pDoc );
104 
105  aViewData.SetTabNo( rBlock.aEnd.Tab() );
106  aViewData.SetScreen( rBlock.aStart.Col(), rBlock.aStart.Row(),
107  rBlock.aEnd.Col(), rBlock.aEnd.Row() );
108 
109  ScPrintFunc::DrawToDev( pDoc, pDev, nPrintFactor, aBound, &aViewData, false/*bMetaFile*/ );
110 }
111 
113  m_pDoc( std::move(pClipDoc ) ),
114  m_nNonFiltered(0),
115  m_aObjDesc( rDesc ),
116  m_nDragHandleX( 0 ),
117  m_nDragHandleY( 0 ),
118  m_nSourceCursorX( m_pDoc->MaxCol() + 1 ),
119  m_nSourceCursorY( m_pDoc->MaxRow() + 1 ),
120  m_nDragSourceFlags( ScDragSrc::Undefined ),
121  m_bDragWasInternal( false ),
122  m_bUsedForLink( false ),
123  m_bUseInApi( false )
124 {
125  OSL_ENSURE(m_pDoc->IsClipboard(), "wrong document");
126 
127  // get aBlock from clipboard doc
128 
129  SCCOL nCol1;
130  SCROW nRow1;
131  SCCOL nCol2;
132  SCROW nRow2;
133  m_pDoc->GetClipStart( nCol1, nRow1 );
134  m_pDoc->GetClipArea( nCol2, nRow2, true ); // real source area - include filtered rows
135  nCol2 = sal::static_int_cast<SCCOL>( nCol2 + nCol1 );
136  nRow2 = sal::static_int_cast<SCROW>( nRow2 + nRow1 );
137 
138  SCCOL nDummy;
139  m_pDoc->GetClipArea( nDummy, m_nNonFiltered, false );
140  m_bHasFiltered = (m_nNonFiltered < (nRow2 - nRow1));
141  ++m_nNonFiltered; // to get count instead of diff
142 
143  SCTAB nTab1=0;
144  SCTAB nTab2=0;
145  bool bFirst = true;
146  for (SCTAB i=0; i< m_pDoc->GetTableCount(); i++)
147  if (m_pDoc->HasTable(i))
148  {
149  if (bFirst)
150  nTab1 = i;
151  nTab2 = i;
152  bFirst = false;
153  }
154  OSL_ENSURE(!bFirst, "no sheet selected");
155 
156  // only limit to used cells if whole sheet was marked
157  // (so empty cell areas can be copied)
158  if ( nCol2>=m_pDoc->MaxCol() && nRow2>=m_pDoc->MaxRow() )
159  {
160  SCROW nMaxRow;
161  SCCOL nMaxCol;
162  GetAreaSize( m_pDoc.get(), nTab1, nTab2, nMaxRow, nMaxCol );
163  if( nMaxRow < nRow2 )
164  nRow2 = nMaxRow;
165  if( nMaxCol < nCol2 )
166  nCol2 = nMaxCol;
167  }
168 
169  m_aBlock = ScRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
170  m_nVisibleTab = nTab1; // valid table as default
171 
172  tools::Rectangle aMMRect = m_pDoc->GetMMRect( nCol1,nRow1, nCol2,nRow2, nTab1 );
173  m_aObjDesc.maSize = aMMRect.GetSize();
175 }
176 
178 {
179  SolarMutexGuard aSolarGuard;
180 
181  ScModule* pScMod = SC_MOD();
182  if (pScMod && pScMod->GetDragData().pCellTransfer == this)
183  {
184  OSL_FAIL("ScTransferObj wasn't released");
185  pScMod->ResetDragObject();
186  }
187 
188  m_pDoc.reset(); // ScTransferObj is owner of clipboard document
189 
190  m_aDocShellRef.clear(); // before releasing the mutex
191 
192  m_aDrawPersistRef.clear(); // after the model
193 
194 }
195 
196 ScTransferObj* ScTransferObj::GetOwnClipboard(const uno::Reference<datatransfer::XTransferable2>& xTransferable)
197 {
198  ScTransferObj* pObj = nullptr;
199  if (xTransferable.is())
200  {
201  uno::Reference<XUnoTunnel> xTunnel( xTransferable, uno::UNO_QUERY );
202  if ( xTunnel.is() )
203  {
204  sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() );
205  if ( nHandle )
206  pObj = dynamic_cast<ScTransferObj*>(reinterpret_cast<TransferableHelper*>( static_cast<sal_IntPtr>(nHandle) ));
207  }
208  }
209 
210  return pObj;
211 }
212 
214 {
215  AddFormat( SotClipboardFormatId::EMBED_SOURCE );
216  AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
217  AddFormat( SotClipboardFormatId::GDIMETAFILE );
218  AddFormat( SotClipboardFormatId::PNG );
219  AddFormat( SotClipboardFormatId::BITMAP );
220 
221  // ScImportExport formats
222  AddFormat( SotClipboardFormatId::HTML );
223  AddFormat( SotClipboardFormatId::SYLK );
224  AddFormat( SotClipboardFormatId::LINK );
225  AddFormat( SotClipboardFormatId::DIF );
226  AddFormat( SotClipboardFormatId::STRING );
227  AddFormat( SotClipboardFormatId::STRING_TSVC );
228 
229  AddFormat( SotClipboardFormatId::RTF );
230  AddFormat( SotClipboardFormatId::RICHTEXT );
231  if ( m_aBlock.aStart == m_aBlock.aEnd )
232  {
233  AddFormat( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT );
234  }
235 }
236 
237 static ScRange lcl_reduceBlock(const ScDocumentUniquePtr &pDoc, ScRange aReducedBlock, bool bIncludeVisual = false)
238 {
239  if ((aReducedBlock.aEnd.Col() == pDoc->MaxCol() || aReducedBlock.aEnd.Row() == pDoc->MaxRow()) &&
240  aReducedBlock.aStart.Tab() == aReducedBlock.aEnd.Tab())
241  {
242  // Shrink the block here so we don't waste time creating huge
243  // output when whole columns or rows are selected.
244 
245  SCCOL nPrintAreaEndCol = 0;
246  SCROW nPrintAreaEndRow = 0;
247  if (bIncludeVisual)
248  pDoc->GetPrintArea( aReducedBlock.aStart.Tab(), nPrintAreaEndCol, nPrintAreaEndRow, true );
249 
250  // Shrink the area to allow pasting to external applications.
251  // Shrink to real data area for HTML, RTF and RICHTEXT, but include
252  // all objects and top-left area for BITMAP and PNG.
253  SCCOL nStartCol = aReducedBlock.aStart.Col();
254  SCROW nStartRow = aReducedBlock.aStart.Row();
255  SCCOL nEndCol = aReducedBlock.aEnd.Col();
256  SCROW nEndRow = aReducedBlock.aEnd.Row();
257  bool bShrunk = false;
258  pDoc->ShrinkToUsedDataArea( bShrunk, aReducedBlock.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow,
259  false, bIncludeVisual /*bStickyTopRow*/, bIncludeVisual /*bStickyLeftCol*/,
260  bIncludeVisual /*bConsiderCellNotes*/, bIncludeVisual /*bConsiderCellDrawObjects*/);
261 
262  if ( nPrintAreaEndRow > nEndRow )
263  nEndRow = nPrintAreaEndRow;
264 
265  if ( nPrintAreaEndCol > nEndCol )
266  nEndCol = nPrintAreaEndCol;
267 
268  aReducedBlock = ScRange(nStartCol, nStartRow, aReducedBlock.aStart.Tab(), nEndCol, nEndRow, aReducedBlock.aEnd.Tab());
269  }
270  return aReducedBlock;
271 }
272 
273 bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
274 {
275  SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor );
276  bool bOK = false;
277 
278  if( HasFormat( nFormat ) )
279  {
280  ScRange aReducedBlock = m_aBlock;
281 
282  bool bReduceBlockFormat =
283  nFormat == SotClipboardFormatId::HTML
284  || nFormat == SotClipboardFormatId::RTF
285  || nFormat == SotClipboardFormatId::RICHTEXT
286  || nFormat == SotClipboardFormatId::BITMAP
287  || nFormat == SotClipboardFormatId::PNG;
288 
289  const bool bIncludeVisual = (nFormat == SotClipboardFormatId::BITMAP ||
290  nFormat == SotClipboardFormatId::PNG);
291 
292  if (bReduceBlockFormat)
293  aReducedBlock = lcl_reduceBlock(m_pDoc, m_aBlock, bIncludeVisual);
294 
295  if ( nFormat == SotClipboardFormatId::LINKSRCDESCRIPTOR || nFormat == SotClipboardFormatId::OBJECTDESCRIPTOR )
296  {
298  }
299  else if ( ( nFormat == SotClipboardFormatId::RTF || nFormat == SotClipboardFormatId::RICHTEXT ||
300  nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ) && m_aBlock.aStart == m_aBlock.aEnd )
301  {
302  // RTF from a single cell is handled by EditEngine
303 
304  SCCOL nCol = m_aBlock.aStart.Col();
305  SCROW nRow = m_aBlock.aStart.Row();
306  SCTAB nTab = m_aBlock.aStart.Tab();
307  ScAddress aPos(nCol, nRow, nTab);
308 
309  const ScPatternAttr* pPattern = m_pDoc->GetPattern( nCol, nRow, nTab );
310  ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool(), m_pDoc.get() );
311  ScRefCellValue aCell(*m_pDoc, aPos);
312  if (aCell.meType == CELLTYPE_EDIT)
313  {
314  const EditTextObject* pObj = aCell.mpEditText;
315  aEngine.SetTextCurrentDefaults(*pObj);
316  }
317  else
318  {
319  SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable();
320  sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter);
321  OUString aText;
322  Color* pColor;
323  ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, m_pDoc.get());
324  if (!aText.isEmpty())
325  aEngine.SetTextCurrentDefaults(aText);
326  }
327 
328  bOK = SetObject( &aEngine,
329  ((nFormat == SotClipboardFormatId::RTF) ? SCTRANS_TYPE_EDIT_RTF :
330  ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) ?
332  rFlavor );
333  }
334  else if ( ScImportExport::IsFormatSupported( nFormat ) || nFormat == SotClipboardFormatId::RTF
335  || nFormat == SotClipboardFormatId::RICHTEXT )
336  {
337  // if this transfer object was used to create a DDE link, filtered rows
338  // have to be included for subsequent calls (to be consistent with link data)
339  if ( nFormat == SotClipboardFormatId::LINK )
340  m_bUsedForLink = true;
341 
342  bool bIncludeFiltered = m_pDoc->IsCutMode() || m_bUsedForLink;
343 
344  ScImportExport aObj( m_pDoc.get(), aReducedBlock );
345  // Plain text ("Unformatted text") may contain embedded tabs and
346  // line breaks but is not enclosed in quotes. Which makes it
347  // unsuitable for multiple cells, especially if one of them is
348  // multi-line, but otherwise is expected behavior for plain text.
349  // For multiple cells replace embedded line breaks (and tabs) with
350  // space character, otherwise pasting would yield odd results.
351  /* XXX: it's debatable whether this is actually expected, but
352  * there's no way to satisfy all possible requirements when
353  * copy/pasting unformatted text. */
354  const bool bPlainMulti = (nFormat == SotClipboardFormatId::STRING &&
355  aReducedBlock.aStart != aReducedBlock.aEnd);
356  // Add quotes only for STRING_TSVC.
357  /* TODO: a possible future STRING_TSV should not contain embedded
358  * line breaks nor tab (separator) characters and not be quoted.
359  * A possible STRING_CSV should. */
361  (nFormat == SotClipboardFormatId::STRING_TSVC));
362  if ( bPlainMulti || m_bUsedForLink )
363  {
364  // For a DDE link or plain text multiple cells, convert line
365  // breaks and separators to space.
367  aTextOptions.mcSeparatorConvertTo = ' ';
368  aTextOptions.mbAddQuotes = false;
369  }
370  aObj.SetExportTextOptions(aTextOptions);
371  aObj.SetFormulas( m_pDoc->GetViewOptions().GetOption( VOPT_FORMULAS ) );
372  aObj.SetIncludeFiltered( bIncludeFiltered );
373 
374  // DataType depends on format type:
375 
376  if ( rFlavor.DataType.equals( ::cppu::UnoType<OUString>::get() ) )
377  {
378  OUString aString;
379  if ( aObj.ExportString( aString, nFormat ) )
380  bOK = SetString( aString, rFlavor );
381  }
382  else if ( rFlavor.DataType.equals( cppu::UnoType<uno::Sequence< sal_Int8 >>::get() ) )
383  {
384  // SetObject converts a stream into an Int8-Sequence
385  bOK = SetObject( &aObj, SCTRANS_TYPE_IMPEX, rFlavor );
386  }
387  else
388  {
389  OSL_FAIL("unknown DataType");
390  }
391  }
392  else if ( nFormat == SotClipboardFormatId::BITMAP || nFormat == SotClipboardFormatId::PNG )
393  {
394  tools::Rectangle aMMRect = m_pDoc->GetMMRect( aReducedBlock.aStart.Col(), aReducedBlock.aStart.Row(),
395  aReducedBlock.aEnd.Col(), aReducedBlock.aEnd.Row(),
396  aReducedBlock.aStart.Tab() );
398  pVirtDev->SetOutputSizePixel(pVirtDev->LogicToPixel(aMMRect.GetSize(), MapMode(MapUnit::Map100thMM)));
399 
400  PaintToDev( pVirtDev, m_pDoc.get(), 1.0, aReducedBlock );
401 
402  pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel ) );
403  BitmapEx aBmp = pVirtDev->GetBitmapEx( Point(), pVirtDev->GetOutputSize() );
404  bOK = SetBitmapEx( aBmp, rFlavor );
405  }
406  else if ( nFormat == SotClipboardFormatId::GDIMETAFILE )
407  {
408  // #i123405# Do not limit visual size calculation for metafile creation.
409  // It seems unlikely that removing the limitation causes problems since
410  // metafile creation means that no real pixel device in the needed size is
411  // created.
412  InitDocShell(false);
413 
414  SfxObjectShell* pEmbObj = m_aDocShellRef.get();
415 
416  // like SvEmbeddedTransfer::GetData:
417  GDIMetaFile aMtf;
419  MapMode aMapMode( pEmbObj->GetMapUnit() );
420  tools::Rectangle aVisArea( pEmbObj->GetVisArea( ASPECT_CONTENT ) );
421 
422  pVDev->EnableOutput( false );
423  pVDev->SetMapMode( aMapMode );
424  aMtf.SetPrefSize( aVisArea.GetSize() );
425  aMtf.SetPrefMapMode( aMapMode );
426  aMtf.Record( pVDev );
427 
428  pEmbObj->DoDraw( pVDev, Point(), aVisArea.GetSize(), JobSetup() );
429 
430  aMtf.Stop();
431  aMtf.WindStart();
432 
433  bOK = SetGDIMetaFile( aMtf );
434  }
435  else if ( nFormat == SotClipboardFormatId::EMBED_SOURCE )
436  {
437  //TODO/LATER: differentiate between formats?!
438  // #i123405# Do limit visual size calculation to PageSize
439  InitDocShell(true); // set aDocShellRef
440 
441  SfxObjectShell* pEmbObj = m_aDocShellRef.get();
442  bOK = SetObject( pEmbObj, SCTRANS_TYPE_EMBOBJ, rFlavor );
443  }
444  }
445  return bOK;
446 }
447 
448 bool ScTransferObj::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
449  const datatransfer::DataFlavor& rFlavor )
450 {
451  // called from SetObject, put data into stream
452 
453  bool bRet = false;
454  switch (nUserObjectId)
455  {
456  case SCTRANS_TYPE_IMPEX:
457  {
458  ScImportExport* pImpEx = static_cast<ScImportExport*>(pUserObject);
459 
460  SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor );
461  // mba: no BaseURL for data exchange
462  if ( pImpEx->ExportStream( *rxOStm, OUString(), nFormat ) )
463  bRet = ( rxOStm->GetError() == ERRCODE_NONE );
464  }
465  break;
466 
469  {
470  ScTabEditEngine* pEngine = static_cast<ScTabEditEngine*>(pUserObject);
471  if ( nUserObjectId == SCTRANS_TYPE_EDIT_RTF )
472  {
473  pEngine->Write( *rxOStm, EETextFormat::Rtf );
474  bRet = ( rxOStm->GetError() == ERRCODE_NONE );
475  }
476  else
477  {
478  // can't use Write for EditEngine format because that would
479  // write old format without support for unicode characters.
480  // Get the data from the EditEngine's transferable instead.
481 
482  sal_Int32 nParCnt = pEngine->GetParagraphCount();
483  if ( nParCnt == 0 )
484  nParCnt = 1;
485  ESelection aSel( 0, 0, nParCnt-1, pEngine->GetTextLen(nParCnt-1) );
486 
487  uno::Reference<datatransfer::XTransferable> xEditTrans = pEngine->CreateTransferable( aSel );
488  TransferableDataHelper aEditHelper( xEditTrans );
489 
490  bRet = aEditHelper.GetSotStorageStream( rFlavor, rxOStm );
491  }
492  }
493  break;
494 
496  {
497  ScTabEditEngine* pEngine = static_cast<ScTabEditEngine*>(pUserObject);
498  pEngine->Write(*rxOStm, EETextFormat::Xml);
499  bRet = (rxOStm->GetError() == ERRCODE_NONE);
500  }
501  break;
502 
503  case SCTRANS_TYPE_EMBOBJ:
504  {
505  // TODO/MBA: testing
506  SfxObjectShell* pEmbObj = static_cast<SfxObjectShell*>(pUserObject);
507  ::utl::TempFile aTempFile;
508  aTempFile.EnableKillingFile();
509  uno::Reference< embed::XStorage > xWorkStore =
510  ::comphelper::OStorageHelper::GetStorageFromURL( aTempFile.GetURL(), embed::ElementModes::READWRITE );
511 
512  // write document storage
513  pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false );
514 
515  // mba: no relative URLs for clipboard!
516  SfxMedium aMedium( xWorkStore, OUString() );
517  pEmbObj->DoSaveObjectAs( aMedium, false );
518  pEmbObj->DoSaveCompleted();
519 
520  uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
521  if ( xTransact.is() )
522  xTransact->commit();
523 
524  std::unique_ptr<SvStream> pSrcStm = ::utl::UcbStreamHelper::CreateStream( aTempFile.GetURL(), StreamMode::READ );
525  if( pSrcStm )
526  {
527  rxOStm->SetBufferSize( 0xff00 );
528  rxOStm->WriteStream( *pSrcStm );
529  pSrcStm.reset();
530  }
531 
532  bRet = true;
533 
534  xWorkStore->dispose();
535  xWorkStore.clear();
536  rxOStm->Commit();
537  }
538  break;
539 
540  default:
541  OSL_FAIL("unknown object id");
542  }
543  return bRet;
544 }
545 
547 {
548  ScRange aReduced = lcl_reduceBlock(m_pDoc, m_aBlock);
549  size_t nCells = (aReduced.aEnd.Col() - aReduced.aStart.Col() + 1) *
550  (aReduced.aEnd.Row() - aReduced.aStart.Row() + 1) *
551  (aReduced.aEnd.Tab() - aReduced.aStart.Tab() + 1);
552  return nCells > 1000;
553 }
554 
556 {
558  {
559  // move: delete source data
560  ScDocShell* pSourceSh = GetSourceDocShell();
561  if (pSourceSh)
562  {
563  ScMarkData aMarkData = GetSourceMarkData();
564  // external drag&drop doesn't copy objects, so they also aren't deleted:
565  // bApi=TRUE, don't show error messages from drag&drop
566  pSourceSh->GetDocFunc().DeleteContents( aMarkData, InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS, true, true );
567  }
568  }
569 
570  ScModule* pScMod = SC_MOD();
571  if ( pScMod->GetDragData().pCellTransfer == this )
572  pScMod->ResetDragObject();
573 
574  m_xDragSourceRanges = nullptr; // don't keep source after dropping
575 
577 }
578 
580 {
581  m_nDragHandleX = nX;
582  m_nDragHandleY = nY;
583 }
584 
586 {
587  m_nSourceCursorX = nX;
588  m_nSourceCursorY = nY;
589 }
590 
592 {
593  return
596 }
597 
599 {
600  m_nVisibleTab = nNew;
601 }
602 
604 {
605  m_aDrawPersistRef = rRef;
606 }
607 
608 void ScTransferObj::SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark )
609 {
610  ScRangeList aRanges;
611  rMark.FillRangeListWithMarks( &aRanges, false );
612  m_xDragSourceRanges = new ScCellRangesObj( pSourceShell, aRanges );
613 }
614 
616 {
617  m_nDragSourceFlags = nFlags;
618 }
619 
621 {
622  m_bDragWasInternal = true;
623 }
624 
625 void ScTransferObj::SetUseInApi( bool bSet )
626 {
627  m_bUseInApi = bSet;
628 }
629 
631 {
632  ScDocShell* pSourceDocSh = GetSourceDocShell();
633  if (pSourceDocSh)
634  return &pSourceDocSh->GetDocument();
635  return nullptr;
636 }
637 
639 {
640  ScCellRangesBase* pRangesObj = comphelper::getUnoTunnelImplementation<ScCellRangesBase>( m_xDragSourceRanges );
641  if (pRangesObj)
642  return pRangesObj->GetDocShell();
643 
644  return nullptr; // none set
645 }
646 
648 {
649  ScMarkData aMarkData(m_pDoc->GetSheetLimits());
650  ScCellRangesBase* pRangesObj = comphelper::getUnoTunnelImplementation<ScCellRangesBase>( m_xDragSourceRanges );
651  if (pRangesObj)
652  {
653  const ScRangeList& rRanges = pRangesObj->GetRangeList();
654  aMarkData.MarkFromRangeList( rRanges, false );
655  }
656  return aMarkData;
657 }
658 
659 // initialize aDocShellRef with a live document from the ClipDoc
660 
661 // #i123405# added parameter to allow size calculation without limitation
662 // to PageSize, e.g. used for Metafile creation for clipboard.
663 
664 void ScTransferObj::InitDocShell(bool bLimitToPageSize)
665 {
666  if ( m_aDocShellRef.is() )
667  return;
668 
669  ScDocShell* pDocSh = new ScDocShell;
670  m_aDocShellRef = pDocSh; // ref must be there before InitNew
671 
672  pDocSh->DoInitNew();
673 
674  ScDocument& rDestDoc = pDocSh->GetDocument();
675  ScMarkData aDestMark(rDestDoc.GetSheetLimits());
676  aDestMark.SelectTable( 0, true );
677 
678  rDestDoc.SetDocOptions( m_pDoc->GetDocOptions() ); // #i42666#
679 
680  OUString aTabName;
681  m_pDoc->GetName( m_aBlock.aStart.Tab(), aTabName );
682  rDestDoc.RenameTab( 0, aTabName );
683 
684  rDestDoc.CopyStdStylesFrom( m_pDoc.get() );
685 
686  SCCOL nStartX = m_aBlock.aStart.Col();
687  SCROW nStartY = m_aBlock.aStart.Row();
688  SCCOL nEndX = m_aBlock.aEnd.Col();
689  SCROW nEndY = m_aBlock.aEnd.Row();
690 
691  // widths / heights
692  // (must be copied before CopyFromClip, for drawing objects)
693 
694  SCCOL nCol;
695  SCTAB nSrcTab = m_aBlock.aStart.Tab();
696  rDestDoc.SetLayoutRTL(0, m_pDoc->IsLayoutRTL(nSrcTab));
697  for (nCol=nStartX; nCol<=nEndX; nCol++)
698  if ( m_pDoc->ColHidden(nCol, nSrcTab) )
699  rDestDoc.ShowCol( nCol, 0, false );
700  else
701  rDestDoc.SetColWidth( nCol, 0, m_pDoc->GetColWidth( nCol, nSrcTab ) );
702 
703  if (nStartY > 0)
704  {
705  // Set manual height for all previous rows so we can ensure
706  // that visible area will not change due to autoheight
707  rDestDoc.SetManualHeight(0, nStartY - 1, 0, true);
708  }
709  for (SCROW nRow = nStartY; nRow <= nEndY; ++nRow)
710  {
711  if ( m_pDoc->RowHidden(nRow, nSrcTab) )
712  rDestDoc.ShowRow( nRow, 0, false );
713  else
714  {
715  rDestDoc.SetRowHeight( nRow, 0, m_pDoc->GetOriginalHeight( nRow, nSrcTab ) );
716 
717  // if height was set manually, that flag has to be copied, too
718  bool bManual = m_pDoc->IsManualRowHeight(nRow, nSrcTab);
719  rDestDoc.SetManualHeight(nRow, nRow, 0, bManual);
720  }
721  }
722 
723  if (m_pDoc->GetDrawLayer() || m_pDoc->HasNotes())
724  pDocSh->MakeDrawLayer();
725 
726  // cell range is copied to the original position, but on the first sheet
727  // -> bCutMode must be set
728  // pDoc is always a Clipboard-document
729 
730  ScRange aDestRange( nStartX,nStartY,0, nEndX,nEndY,0 );
731  bool bWasCut = m_pDoc->IsCutMode();
732  if (!bWasCut)
733  m_pDoc->SetClipArea( aDestRange, true ); // Cut
734  rDestDoc.CopyFromClip( aDestRange, aDestMark, InsertDeleteFlags::ALL, nullptr, m_pDoc.get(), false );
735  m_pDoc->SetClipArea( aDestRange, bWasCut );
736 
737  StripRefs( m_pDoc.get(), nStartX,nStartY, nEndX,nEndY, &rDestDoc );
738 
739  ScRange aMergeRange = aDestRange;
740  rDestDoc.ExtendMerge( aMergeRange, true );
741 
742  m_pDoc->CopyDdeLinks( &rDestDoc ); // copy values of DDE Links
743 
744  // page format (grid etc) and page size (maximum size for ole object)
745 
746  Size aPaperSize = SvxPaperInfo::GetPaperSize( PAPER_A4 ); // Twips
747  ScStyleSheetPool* pStylePool = m_pDoc->GetStyleSheetPool();
748  OUString aStyleName = m_pDoc->GetPageStyle( m_aBlock.aStart.Tab() );
749  SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SfxStyleFamily::Page );
750  if (pStyleSheet)
751  {
752  const SfxItemSet& rSourceSet = pStyleSheet->GetItemSet();
753  aPaperSize = rSourceSet.Get(ATTR_PAGE_SIZE).GetSize();
754 
755  // CopyStyleFrom copies SetItems with correct pool
756  ScStyleSheetPool* pDestPool = rDestDoc.GetStyleSheetPool();
757  pDestPool->CopyStyleFrom( pStylePool, aStyleName, SfxStyleFamily::Page );
758  }
759 
760  ScViewData aViewData( pDocSh, nullptr );
761  aViewData.SetScreen( nStartX,nStartY, nEndX,nEndY );
762  aViewData.SetCurX( nStartX );
763  aViewData.SetCurY( nStartY );
764 
765  rDestDoc.SetViewOptions( m_pDoc->GetViewOptions() );
766 
767  // Size
769 
770  long nPosX = 0;
771  long nPosY = 0;
772 
773  for (nCol=0; nCol<nStartX; nCol++)
774  nPosX += rDestDoc.GetColWidth( nCol, 0 );
775  nPosY += rDestDoc.GetRowHeight( 0, nStartY-1, 0 );
776  nPosX = static_cast<long>( nPosX * HMM_PER_TWIPS );
777  nPosY = static_cast<long>( nPosY * HMM_PER_TWIPS );
778 
779  aPaperSize.setWidth( aPaperSize.Width() * 2 ); // limit OLE object to double of page size
780  aPaperSize.setHeight( aPaperSize.Height() * 2 );
781 
782  long nSizeX = 0;
783  long nSizeY = 0;
784  for (nCol=nStartX; nCol<=nEndX; nCol++)
785  {
786  long nAdd = rDestDoc.GetColWidth( nCol, 0 );
787  if ( bLimitToPageSize && nSizeX+nAdd > aPaperSize.Width() && nSizeX ) // above limit?
788  break;
789  nSizeX += nAdd;
790  }
791  for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
792  {
793  long nAdd = rDestDoc.GetRowHeight( nRow, 0 );
794  if ( bLimitToPageSize && nSizeY+nAdd > aPaperSize.Height() && nSizeY ) // above limit?
795  break;
796  nSizeY += nAdd;
797  }
798  nSizeX = static_cast<long>( nSizeX * HMM_PER_TWIPS );
799  nSizeY = static_cast<long>( nSizeY * HMM_PER_TWIPS );
800 
801 // pDocSh->SetVisAreaSize( Size(nSizeX,nSizeY) );
802 
803  tools::Rectangle aNewArea( Point(nPosX,nPosY), Size(nSizeX,nSizeY) );
804  //TODO/LATER: why twice?!
805  //pDocSh->SvInPlaceObject::SetVisArea( aNewArea );
806  pDocSh->SetVisArea( aNewArea );
807 
808  pDocSh->UpdateOle(&aViewData, true);
809 
811  if ( rDestDoc.IsChartListenerCollectionNeedsUpdate() )
813 }
814 
816 {
817  // update ScGlobal::xDrawClipDocShellRef
818 
820  if (bAnyOle)
821  {
822  ScGlobal::xDrawClipDocShellRef = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS); // there must be a ref
825  }
826  else
827  {
829  return nullptr;
830  }
831 }
832 
834  SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY,
835  ScDocument* pDestDoc )
836 {
837  if (!pDestDoc)
838  {
839  pDestDoc = pDoc;
840  }
841 
842  // In a clipboard doc the data don't have to be on the first sheet
843 
844  SCTAB nSrcTab = 0;
845  while (nSrcTab<pDoc->GetTableCount() && !pDoc->HasTable(nSrcTab))
846  ++nSrcTab;
847  SCTAB nDestTab = 0;
848  while (nDestTab<pDestDoc->GetTableCount() && !pDestDoc->HasTable(nDestTab))
849  ++nDestTab;
850 
851  if (!pDoc->HasTable(nSrcTab) || !pDestDoc->HasTable(nDestTab))
852  {
853  OSL_FAIL("Sheet not found in ScTransferObj::StripRefs");
854  return;
855  }
856 
857  ScRange aRef;
858 
859  ScCellIterator aIter( pDoc, ScRange(nStartX, nStartY, nSrcTab, nEndX, nEndY, nSrcTab) );
860  for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
861  {
862  if (aIter.getType() != CELLTYPE_FORMULA)
863  continue;
864 
865  ScFormulaCell* pFCell = aIter.getFormulaCell();
866  bool bOut = false;
867  ScDetectiveRefIter aRefIter( pDoc, pFCell );
868  while ( !bOut && aRefIter.GetNextRef( aRef ) )
869  {
870  if ( aRef.aStart.Tab() != nSrcTab || aRef.aEnd.Tab() != nSrcTab ||
871  aRef.aStart.Col() < nStartX || aRef.aEnd.Col() > nEndX ||
872  aRef.aStart.Row() < nStartY || aRef.aEnd.Row() > nEndY )
873  bOut = true;
874  }
875  if (bOut)
876  {
877  SCCOL nCol = aIter.GetPos().Col();
878  SCROW nRow = aIter.GetPos().Row();
879 
880  FormulaError nErrCode = pFCell->GetErrCode();
881  ScAddress aPos(nCol, nRow, nDestTab);
882  if (nErrCode != FormulaError::NONE)
883  {
884  if ( pDestDoc->GetAttr( nCol,nRow,nDestTab, ATTR_HOR_JUSTIFY)->GetValue() ==
885  SvxCellHorJustify::Standard )
886  pDestDoc->ApplyAttr( nCol,nRow,nDestTab,
887  SvxHorJustifyItem(SvxCellHorJustify::Right, ATTR_HOR_JUSTIFY) );
888 
889  ScSetStringParam aParam;
890  aParam.setTextInput();
891  pDestDoc->SetString(aPos, ScGlobal::GetErrorString(nErrCode), &aParam);
892  }
893  else if (pFCell->IsValue())
894  {
895  pDestDoc->SetValue(aPos, pFCell->GetValue());
896  }
897  else
898  {
899  OUString aStr = pFCell->GetString().getString();
900  if ( pFCell->IsMultilineResult() )
901  {
902  ScFieldEditEngine& rEngine = pDestDoc->GetEditEngine();
903  rEngine.SetTextCurrentDefaults(aStr);
904  pDestDoc->SetEditText(ScAddress(nCol,nRow,nDestTab), rEngine.CreateTextObject());
905  }
906  else
907  {
908  ScSetStringParam aParam;
909  aParam.setTextInput();
910  pDestDoc->SetString(aPos, aStr, &aParam);
911  }
912  }
913  }
914  }
915 }
916 
917 namespace
918 {
919  class theScTransferUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTransferUnoTunnelId> {};
920 }
921 
922 const css::uno::Sequence< sal_Int8 >& ScTransferObj::getUnoTunnelId()
923 {
924  return theScTransferUnoTunnelId::get().getSeq();
925 }
926 
927 sal_Int64 SAL_CALL ScTransferObj::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
928 {
929  sal_Int64 nRet;
930  if( isUnoTunnelId<ScTransferObj>(rId) )
931  {
932  nRet = reinterpret_cast< sal_Int64 >( this );
933  }
934  else
936  return nRet;
937 }
938 
939 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC bool GetPrintArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow, bool bNotes=true) const
Definition: documen2.cxx:573
long Width() const
bool is() const
SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow)
Definition: document.cxx:4300
static const com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: transobj.cxx:922
constexpr sal_uInt32 SCTRANS_TYPE_EMBOBJ
Definition: transobj.cxx:70
OUString getString() const
ScAddress aStart
Definition: address.hxx:500
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
Store parameters used in the ScDocument::SetString() method.
Definition: stringutil.hxx:35
void SetCurX(SCCOL nNewCurX)
Definition: viewdata.hxx:431
constexpr TypedWhichId< SvxSizeItem > ATTR_PAGE_SIZE(161)
bool SetBitmapEx(const BitmapEx &rBitmap, const css::datatransfer::DataFlavor &rFlavor)
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
SC_DLLPUBLIC bool DeleteContents(const ScMarkData &rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi)
Definition: docfunc.cxx:566
SCROW Row() const
Definition: address.hxx:262
ScDocShell * GetDocShell() const
Definition: cellsuno.hxx:242
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is...
Definition: stringutil.cxx:38
virtual void DragFinished(sal_Int8 nDropAction) override
Definition: transobj.cxx:555
void CopyFromClip(const ScRange &rDestRange, const ScMarkData &rMark, InsertDeleteFlags nInsFlag, ScDocument *pRefUndoDoc, ScDocument *pClipDoc, bool bResetCut=true, bool bAsLink=false, bool bIncludeFiltered=true, bool bSkipAttrForEmpty=false, const ScRangeList *pDestRanges=nullptr)
If pDestRanges is given it overrides rDestRange, rDestRange in this case is the overall encompassing ...
Definition: document.cxx:2800
long Height() const
signed char sal_Int8
static void StripRefs(ScDocument *pDoc, SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY, ScDocument *pDestDoc)
Definition: transobj.cxx:833
static void GetString(const ScRefCellValue &rCell, sal_uInt32 nFormat, OUString &rString, Color **ppColor, SvNumberFormatter &rFormatter, const ScDocument *pDoc, bool bNullVals=true, bool bFormula=false, bool bUseStarFormat=false)
Definition: cellform.cxx:33
static bool IsFormatSupported(SotClipboardFormatId nFormat)
Definition: impex.cxx:218
static SfxObjectShell * SetDrawClipDoc(bool bAnyOle)
Definition: transobj.cxx:815
These options control how multi-line cells are converted during export in certain lossy formats (such...
Definition: impex.hxx:36
void SetDragSource(ScDocShell *pSourceShell, const ScMarkData &rMark)
Definition: transobj.cxx:608
SfxObjectShellRef m_aDocShellRef
Definition: transobj.hxx:46
void SetDragSourceFlags(ScDragSrc nFlags)
Definition: transobj.cxx:615
bool SetTransferableObjectDescriptor(const TransferableObjectDescriptor &rDesc)
#define SOFFICE_FILEFORMAT_CURRENT
static void DrawToDev(ScDocument *pDoc, OutputDevice *pDev, double nPrintFactor, const tools::Rectangle &rBound, ScViewData *pViewData, bool bMetaFile)
Definition: printfun.cxx:443
virtual void DragFinished(sal_Int8 nDropAction) override
bool HasFormat(SotClipboardFormatId nFormat)
void SetPrefSize(const Size &rSize)
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
Definition: markdata.cxx:387
void InitDocShell(bool bLimitToPageSize)
Definition: transobj.cxx:664
ScAddress aEnd
Definition: address.hxx:501
SC_DLLPUBLIC void SetLayoutRTL(SCTAB nTab, bool bRTL)
Definition: document.cxx:949
bool WasSourceCursorInSelection() const
Definition: transobj.cxx:591
static ScRange lcl_reduceBlock(const ScDocumentUniquePtr &pDoc, ScRange aReducedBlock, bool bIncludeVisual=false)
Definition: transobj.cxx:237
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
Definition: document.cxx:3460
virtual SfxItemSet & GetItemSet()
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:104
virtual bool WriteObject(tools::SvRef< SotStorageStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor) override
Definition: transobj.cxx:448
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
Definition: document.cxx:4759
const ScDragData & GetDragData() const
Definition: scmod.hxx:144
ScFormulaCell * getFormulaCell()
Definition: dociter.hxx:239
bool IsMultilineResult()
Determines whether or not the result string contains more than one paragraph.
ScTransferObj * pCellTransfer
Definition: dragdata.hxx:21
bool SetObject(void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
void SetSourceCursorPos(SCCOL nX, SCROW nY)
Definition: transobj.cxx:585
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4163
void SetDragHandlePos(SCCOL nX, SCROW nY)
Definition: transobj.cxx:579
ScDocument * GetSourceDocument()
Definition: transobj.cxx:630
#define DND_ACTION_MOVE
CellType getType() const
Definition: dociter.hxx:236
SwDoc * m_pDoc
void AddFormat(SotClipboardFormatId nFormat)
void Record(OutputDevice *pOutDev)
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
Definition: document.cxx:852
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
void UpdateOle(const ScViewData *pViewData, bool bSnapSize=false)
Definition: docsh6.cxx:152
NewlineConversion meNewlineConversion
Definition: impex.hxx:42
SCCOL m_nSourceCursorX
Definition: transobj.hxx:51
SC_DLLPUBLIC void SetColWidth(SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth)
Definition: document.cxx:4085
constexpr sal_uInt32 SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT
Definition: transobj.cxx:71
double GetValue()
FormulaError GetErrCode()
css::uno::Reference< css::sheet::XSheetCellRanges > m_xDragSourceRanges
Definition: transobj.hxx:48
PAPER_A4
Walk through all cells in an area.
Definition: dociter.hxx:208
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:190
#define HMM_PER_TWIPS
Definition: global.hxx:91
SCTAB Tab() const
Definition: address.hxx:271
SotClipboardFormatId
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:166
bool m_bHasFiltered
Definition: transobj.hxx:57
sal_Int32 nHandle
SCROW m_nSourceCursorY
Definition: transobj.hxx:52
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4716
SC_DLLPUBLIC bool SetEditText(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
This method manages the lifecycle of the passed edit text object.
Definition: document.cxx:3396
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3365
T * get() const
void SetDrawPersist(const SfxObjectShellRef &rRef)
Definition: transobj.cxx:603
bool IsChartListenerCollectionNeedsUpdate() const
Definition: document.hxx:2152
ScDragSrc
Definition: viewdata.hxx:92
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:559
int i
void SetDragWasInternal()
Definition: transobj.cxx:620
OUString const & GetURL() const
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
sal_uInt32 GetTextLen() const
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2618
sal_Int16 SCCOL
Definition: types.hxx:22
static tools::SvRef< ScDocShell > xDrawClipDocShellRef
Definition: global.hxx:584
void SetCurY(SCROW nNewCurY)
Definition: viewdata.hxx:432
Iterator for references in a formula cell.
Definition: formulaiter.hxx:32
TransferableObjectDescriptor m_aObjDesc
Definition: transobj.hxx:45
#define SC_MOD()
Definition: scmod.hxx:253
ScRange m_aBlock
Definition: transobj.hxx:43
SC_DLLPUBLIC void SetViewOptions(const ScViewOptions &rOpt)
Definition: documen3.cxx:1924
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:877
virtual ~ScTransferObj() override
Definition: transobj.cxx:177
Size GetOutputSize() const
SCCOL m_nDragHandleX
Definition: transobj.hxx:49
std::unique_ptr< EditTextObject > CreateTextObject()
unsigned char sal_Bool
constexpr sal_uInt32 SCTRANS_TYPE_EDIT_BIN
Definition: transobj.cxx:69
SC_DLLPUBLIC void SetRowHeight(SCROW nRow, SCTAB nTab, sal_uInt16 nNewHeight)
Definition: document.cxx:4097
void PrepareOLE(const TransferableObjectDescriptor &rObjDesc)
ScMarkData GetSourceMarkData() const
Definition: transobj.cxx:647
static css::uno::Reference< css::embed::XStorage > GetStorageFromURL(const OUString &aURL, sal_Int32 nStorageMode, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
sal_uInt32 GetNumberFormat(SvNumberFormatter *) const
Definition: patattr.cxx:1256
bool m_bUseInApi
Definition: transobj.hxx:58
virtual void AddSupportedFormats() override
Definition: transobj.cxx:213
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
SCTAB m_nVisibleTab
Definition: transobj.hxx:53
bool m_bDragWasInternal
Definition: transobj.hxx:55
void WindStart()
ScDragSrc m_nDragSourceFlags
Definition: transobj.hxx:54
sal_Unicode mcSeparatorConvertTo
Definition: impex.hxx:43
bool ExportStream(SvStream &, const OUString &rBaseURL, SotClipboardFormatId)
Definition: impex.cxx:419
#define ASPECT_CONTENT
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5570
Size GetSize() const
FormulaError
SCCOL Col() const
Definition: address.hxx:267
void SetVisibleTab(SCTAB nNew)
Definition: transobj.cxx:598
sal_Int32 GetParagraphCount() const
static void GetAreaSize(const ScDocument *pDoc, SCTAB nTab1, SCTAB nTab2, SCROW &nRow, SCCOL &nCol)
Definition: transobj.cxx:73
bool GetSotStorageStream(SotClipboardFormatId nFormat, tools::SvRef< SotStorageStream > &rStreamRef)
ScDocumentUniquePtr m_pDoc
Definition: transobj.hxx:42
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rId) override
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
Definition: transobj.cxx:273
const ScAddress & GetPos() const
Definition: dociter.hxx:234
svl::SharedString GetString()
sal_Int32 SCROW
Definition: types.hxx:18
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
SCROW m_nDragHandleY
Definition: transobj.hxx:50
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
Definition: documen3.cxx:1910
bool GetNextRef(ScRange &rRange)
Definition: formulaiter.cxx:52
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define ERRCODE_NONE
void CopyStyleFrom(ScStyleSheetPool *pSrcPool, const OUString &rName, SfxStyleFamily eFamily)
Definition: stlpool.cxx:126
bool m_bUsedForLink
Definition: transobj.hxx:56
SC_DLLPUBLIC void SetUseInApi(bool bSet)
Definition: transobj.cxx:625
css::uno::Reference< css::datatransfer::XTransferable > CreateTransferable(const ESelection &rSelection) const
MapUnit GetMapUnit() const
bool DoInitNew(SfxMedium *pMedium=nullptr)
void DoDraw(OutputDevice *, const Point &rObjPos, const Size &rSize, const JobSetup &rSetup, sal_uInt16 nAspect=ASPECT_CONTENT)
static SC_DLLPUBLIC ScTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: transobj.cxx:196
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
SC_DLLPUBLIC void SetManualHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bManual)
Definition: document.cxx:4116
void Write(SvStream &rOutput, EETextFormat)
SfxObjectShellRef m_aDrawPersistRef
Definition: transobj.hxx:47
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
SC_DLLPUBLIC void UpdateChartListenerCollection()
Definition: documen5.cxx:569
virtual sal_Bool SAL_CALL isComplex() override
Definition: transobj.cxx:546
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6068
static void PaintToDev(OutputDevice *pDev, ScDocument *pDoc, double nPrintFactor, const ScRange &rBlock)
Definition: transobj.cxx:94
SC_DLLPUBLIC void CopyStdStylesFrom(const ScDocument *pSrcDoc)
Definition: documen8.cxx:288
constexpr sal_uInt32 SCTRANS_TYPE_IMPEX
Definition: transobj.cxx:67
ScTransferObj(ScDocumentUniquePtr pClipDoc, const TransferableObjectDescriptor &rDesc)
Definition: transobj.cxx:112
constexpr sal_uInt32 SCTRANS_TYPE_EDIT_RTF
Definition: transobj.cxx:68
bool DoSaveObjectAs(SfxMedium &rNewStor, bool bCommit)
void SetupStorage(const css::uno::Reference< css::embed::XStorage > &xStorage, sal_Int32 nVersion, bool bTemplate) const
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:218
virtual void SetVisArea(const tools::Rectangle &rVisArea) override
Definition: docsh6.cxx:57
void SetScreen(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
Definition: viewdata.cxx:2940
void ResetDragObject()
Definition: scmod.cxx:583
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4122
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual sal_Int64 SAL_CALL getSomething(const com::sun::star::uno::Sequence< sal_Int8 > &rId) override
Definition: transobj.cxx:927
void setWidth(long nWidth)
bool SetString(const OUString &rString, const css::datatransfer::DataFlavor &rFlavor)
SCROW m_nNonFiltered
Definition: transobj.hxx:44
aStr
static OUString GetErrorString(FormulaError nErrNumber)
Definition: global.cxx:305
void EnableKillingFile(bool bEnable=true)
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
Definition: documen2.cxx:454
SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, bool bShow)
Definition: document.cxx:4306
sal_Int16 SCTAB
Definition: types.hxx:23
bool SetGDIMetaFile(const GDIMetaFile &rMtf)
virtual tools::Rectangle GetVisArea(sal_uInt16 nAspect) const
ScDocShell * GetSourceDocShell()
Definition: transobj.cxx:638
void SetPrefMapMode(const MapMode &rMapMode)
void setHeight(long nHeight)