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