LibreOffice Module sc (master)  1
drawvie4.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 <svx/svditer.hxx>
21 #include <svx/svdograf.hxx>
22 #include <svx/svdogrp.hxx>
23 #include <svx/svdoole2.hxx>
24 #include <svx/svdundo.hxx>
25 #include <sfx2/docfile.hxx>
26 #include <tools/urlobj.hxx>
28 #include <sal/log.hxx>
29 
30 #include <drawview.hxx>
31 #include <global.hxx>
32 #include <drwlayer.hxx>
33 #include <viewdata.hxx>
34 #include <document.hxx>
35 #include <docsh.hxx>
36 #include <drwtrans.hxx>
37 #include <transobj.hxx>
38 #include <drawutil.hxx>
39 #include <scmod.hxx>
40 #include <globstr.hrc>
41 #include <scresid.hxx>
42 #include <gridwin.hxx>
43 #include <userdat.hxx>
44 
45 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
46 #include <com/sun/star/embed/Aspects.hpp>
47 #include <com/sun/star/embed/XEmbeddedObject.hpp>
48 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
49 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
50 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
51 #include <com/sun/star/chart2/XChartDocument.hpp>
52 
53 using namespace com::sun::star;
54 
56 
57 void ScDrawView::BeginDrag( vcl::Window* pWindow, const Point& rStartPos )
58 {
59  if ( !AreObjectsMarked() )
60  return;
61 
62  BrkAction();
63 
64  tools::Rectangle aMarkedRect = GetAllMarkedRect();
65 
66  aDragStartDiff = rStartPos - aMarkedRect.TopLeft();
67 
68  bool bAnyOle, bOneOle;
69  const SdrMarkList& rMarkList = GetMarkedObjectList();
70  CheckOle( rMarkList, bAnyOle, bOneOle );
71 
72  ScDocShellRef aDragShellRef;
73  if (bAnyOle)
74  {
75  aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
76  aDragShellRef->DoInitNew();
77  }
78  ScDrawLayer::SetGlobalDrawPersist( aDragShellRef.get() );
79  std::unique_ptr<SdrModel> pModel(CreateMarkedObjModel());
81 
82  // Charts now always copy their data in addition to the source reference, so
83  // there's no need to call SchDLL::Update for the charts in the clipboard doc.
84  // Update with the data (including NumberFormatter) from the live document would
85  // also store the NumberFormatter in the clipboard chart (#88749#)
86 
87  ScDocShell* pDocSh = pViewData->GetDocShell();
88 
90  pDocSh->FillTransferableObjectDescriptor( aObjDesc );
91  aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
92  // maSize is set in ScDrawTransferObj ctor
93 
94  rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( std::move(pModel), pDocSh, aObjDesc );
95 
96  pTransferObj->SetDrawPersist( aDragShellRef.get() ); // keep persist for ole objects alive
97  pTransferObj->SetDragSource( this ); // copies selection
98 
99  SC_MOD()->SetDragObject( nullptr, pTransferObj.get() ); // for internal D&D
100  pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
101 }
102 
103 namespace {
104 
105 void getRangeFromDataSource( uno::Reference< chart2::data::XDataSource > const & xDataSource, std::vector<OUString>& rRangeRep)
106 {
107  const uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence> > xSeqs = xDataSource->getDataSequences();
108  for (const uno::Reference<chart2::data::XLabeledDataSequence>& xLS : xSeqs)
109  {
110  uno::Reference<chart2::data::XDataSequence> xSeq = xLS->getValues();
111  if (xSeq.is())
112  {
113  OUString aRep = xSeq->getSourceRangeRepresentation();
114  rRangeRep.push_back(aRep);
115  }
116  xSeq = xLS->getLabel();
117  if (xSeq.is())
118  {
119  OUString aRep = xSeq->getSourceRangeRepresentation();
120  rRangeRep.push_back(aRep);
121  }
122  }
123 }
124 
125 void getRangeFromErrorBar(const uno::Reference< chart2::XChartDocument >& rChartDoc, std::vector<OUString>& rRangeRep)
126 {
127  uno::Reference <chart2::XDiagram > xDiagram = rChartDoc->getFirstDiagram();
128  if(!xDiagram.is())
129  return;
130 
131  uno::Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY);
132  if(!xCooSysContainer.is())
133  return;
134 
135  const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
136  for(const auto& rCooSys : xCooSysSequence)
137  {
138  uno::Reference< chart2::XChartTypeContainer > xChartTypeContainer( rCooSys, uno::UNO_QUERY);
139  if(!xChartTypeContainer.is())
140  continue;
141 
142  const uno::Sequence< uno::Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
143  for(const auto& rChartType : xChartTypeSequence)
144  {
145  uno::Reference< chart2::XDataSeriesContainer > xDataSequenceContainer( rChartType, uno::UNO_QUERY);
146  if(!xDataSequenceContainer.is())
147  continue;
148 
149  const uno::Sequence< uno::Reference< chart2::XDataSeries > > xSeriesSequence( xDataSequenceContainer->getDataSeries() );
150  for(const uno::Reference<chart2::XDataSeries>& xSeries : xSeriesSequence)
151  {
152  uno::Reference< beans::XPropertySet > xPropSet( xSeries, uno::UNO_QUERY);
153  uno::Reference< chart2::data::XDataSource > xErrorBarY;
154  xPropSet->getPropertyValue("ErrorBarY") >>= xErrorBarY;
155  if(xErrorBarY.is())
156  getRangeFromDataSource(xErrorBarY, rRangeRep);
157  uno::Reference< chart2::data::XDataSource > xErrorBarX;
158  xPropSet->getPropertyValue("ErrorBarX") >>= xErrorBarX;
159  if(xErrorBarX.is())
160  getRangeFromDataSource(xErrorBarX, rRangeRep);
161  }
162  }
163  }
164 }
165 
166 void getRangeFromOle2Object(const SdrOle2Obj& rObj, std::vector<OUString>& rRangeRep)
167 {
168  if (!rObj.IsChart())
169  // not a chart object.
170  return;
171 
172  const uno::Reference<embed::XEmbeddedObject>& xObj = rObj.GetObjRef();
173  if (!xObj.is())
174  return;
175 
176  uno::Reference<chart2::XChartDocument> xChartDoc(xObj->getComponent(), uno::UNO_QUERY);
177  if (!xChartDoc.is())
178  return;
179 
180  if(xChartDoc->hasInternalDataProvider())
181  return;
182 
183  getRangeFromErrorBar(xChartDoc, rRangeRep);
184 
185  uno::Reference<chart2::data::XDataSource> xDataSource(xChartDoc, uno::UNO_QUERY);
186  if (!xDataSource.is())
187  return;
188 
189  // Get all data sources used in this chart.
190  getRangeFromDataSource(xDataSource, rRangeRep);
191 
192  return;
193 }
194 
195 // Get all cell ranges that are referenced by the selected chart objects.
196 void getOleSourceRanges(const SdrMarkList& rMarkList, bool& rAnyOle, bool& rOneOle, std::vector<ScRange>* pRanges = nullptr, const ScDocument* pDoc = nullptr )
197 {
198  bool bCalcSourceRanges = pRanges && pDoc;
199  std::vector<OUString> aRangeReps;
200  rAnyOle = rOneOle = false;
201  const size_t nCount = rMarkList.GetMarkCount();
202  for (size_t i=0; i<nCount; ++i)
203  {
204  SdrMark* pMark = rMarkList.GetMark(i);
205  if ( !pMark )
206  continue;
207 
208  SdrObject* pObj = pMark->GetMarkedSdrObj();
209  if ( !pObj )
210  continue;
211 
212  sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
213  if (nSdrObjKind == OBJ_OLE2)
214  {
215  rAnyOle = true;
216  rOneOle = (nCount == 1);
217  if ( bCalcSourceRanges )
218  getRangeFromOle2Object( static_cast<const SdrOle2Obj&>( *pObj ), aRangeReps );
219  else
220  break;
221  }
222  else if ( dynamic_cast<const SdrObjGroup*>( pObj) != nullptr )
223  {
224  SdrObjListIter aIter( *pObj, SdrIterMode::DeepNoGroups );
225  SdrObject* pSubObj = aIter.Next();
226  while (pSubObj)
227  {
228  if ( pSubObj->GetObjIdentifier() == OBJ_OLE2 )
229  {
230  rAnyOle = true;
231  // rOneOle remains false - a group isn't treated like a single OLE object
232  if ( !bCalcSourceRanges )
233  return;
234 
235  getRangeFromOle2Object( static_cast<const SdrOle2Obj&>( *pSubObj ), aRangeReps );
236  }
237  pSubObj = aIter.Next();
238  }
239  }
240  }
241 
242  if (!bCalcSourceRanges)
243  return;
244 
245  // Compile all range representation strings into ranges.
246  for (const auto& rRangeRep : aRangeReps)
247  {
248  ScRangeList aRange;
249  ScAddress aAddr;
250  if (aRange.Parse(rRangeRep, *pDoc, pDoc->GetAddressConvention()) & ScRefFlags::VALID)
251  {
252  for(size_t i = 0; i < aRange.size(); ++i)
253  pRanges->push_back(aRange[i]);
254  }
255  else if (aAddr.Parse(rRangeRep, *pDoc, pDoc->GetAddressConvention()) & ScRefFlags::VALID)
256  pRanges->push_back(aAddr);
257  }
258 
259  return;
260 }
261 
262 class InsertTabIndex
263 {
264  std::vector<SCTAB>& mrTabs;
265 public:
266  explicit InsertTabIndex(std::vector<SCTAB>& rTabs) : mrTabs(rTabs) {}
267  void operator() (const ScRange& rRange)
268  {
269  mrTabs.push_back(rRange.aStart.Tab());
270  }
271 };
272 
273 class CopyRangeData
274 {
275  ScDocument& mrSrc;
276  ScDocument& mrDest;
277 public:
278  CopyRangeData(ScDocument& rSrc, ScDocument& rDest) : mrSrc(rSrc), mrDest(rDest) {}
279 
280  void operator() (const ScRange& rRange)
281  {
282  OUString aTabName;
283  mrSrc.GetName(rRange.aStart.Tab(), aTabName);
284 
285  SCTAB nTab;
286  if (!mrDest.GetTable(aTabName, nTab))
287  // Sheet by this name doesn't exist.
288  return;
289 
290  mrSrc.CopyStaticToDocument(rRange, nTab, mrDest);
291  }
292 };
293 
294 void copyChartRefDataToClipDoc(ScDocument& rSrcDoc, ScDocument& rClipDoc, const std::vector<ScRange>& rRanges)
295 {
296  // Get a list of referenced table indices.
297  std::vector<SCTAB> aTabs;
298  std::for_each(rRanges.begin(), rRanges.end(), InsertTabIndex(aTabs));
299  std::sort(aTabs.begin(), aTabs.end());
300  aTabs.erase(std::unique(aTabs.begin(), aTabs.end()), aTabs.end());
301 
302  // Get table names.
303  if (aTabs.empty())
304  return;
305 
306  // Create sheets only for referenced source sheets.
307  OUString aName;
308  std::vector<SCTAB>::const_iterator it = aTabs.begin(), itEnd = aTabs.end();
309  if (!rSrcDoc.GetName(*it, aName))
310  return;
311 
312  rClipDoc.SetTabNameOnLoad(0, aName); // document initially has one sheet.
313 
314  for (++it; it != itEnd; ++it)
315  {
316  if (!rSrcDoc.GetName(*it, aName))
317  return;
318 
319  rClipDoc.AppendTabOnLoad(aName);
320  }
321 
322  std::for_each(rRanges.begin(), rRanges.end(), CopyRangeData(rSrcDoc, rClipDoc));
323 }
324 
325 }
326 
327 void ScDrawView::CheckOle( const SdrMarkList& rMarkList, bool& rAnyOle, bool& rOneOle )
328 {
329  getOleSourceRanges( rMarkList, rAnyOle, rOneOle );
330 }
331 
333 {
334  const SdrMarkList& rMarkList = GetMarkedObjectList();
335  std::vector<ScRange> aRanges;
336  bool bAnyOle = false, bOneOle = false;
337  getOleSourceRanges( rMarkList, bAnyOle, bOneOle, &aRanges, &rDoc );
338 
339  // update ScGlobal::xDrawClipDocShellRef
341  if (ScGlobal::xDrawClipDocShellRef.is() && !aRanges.empty())
342  {
343  // Copy data referenced by the chart objects to the draw clip
344  // document. We need to do this before CreateMarkedObjModel() below.
346  ScDocument& rClipDoc = xDocSh->GetDocument();
347  copyChartRefDataToClipDoc(rDoc, rClipDoc, aRanges);
348  }
349  std::unique_ptr<SdrModel> pModel(CreateMarkedObjModel());
351 
352  // Charts now always copy their data in addition to the source reference, so
353  // there's no need to call SchDLL::Update for the charts in the clipboard doc.
354  // Update with the data (including NumberFormatter) from the live document would
355  // also store the NumberFormatter in the clipboard chart (#88749#)
356 
357  ScDocShell* pDocSh = pViewData->GetDocShell();
358 
360  pDocSh->FillTransferableObjectDescriptor( aObjDesc );
361  aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
362  // maSize is set in ScDrawTransferObj ctor
363 
364  rtl::Reference<ScDrawTransferObj> pTransferObj(new ScDrawTransferObj( std::move(pModel), pDocSh, aObjDesc ));
365 
367  {
368  pTransferObj->SetDrawPersist( ScGlobal::xDrawClipDocShellRef.get() ); // keep persist for ole objects alive
369  }
370 
371  pTransferObj->CopyToClipboard( pViewData->GetActiveWin() ); // system clipboard
372 }
373 
374 uno::Reference<datatransfer::XTransferable> ScDrawView::CopyToTransferable()
375 {
376  bool bAnyOle, bOneOle;
377  const SdrMarkList& rMarkList = GetMarkedObjectList();
378  CheckOle( rMarkList, bAnyOle, bOneOle );
379 
380  // update ScGlobal::xDrawClipDocShellRef
382  std::unique_ptr<SdrModel> pModel( CreateMarkedObjModel() );
384 
385  // Charts now always copy their data in addition to the source reference, so
386  // there's no need to call SchDLL::Update for the charts in the clipboard doc.
387  // Update with the data (including NumberFormatter) from the live document would
388  // also store the NumberFormatter in the clipboard chart (#88749#)
389  // lcl_RefreshChartData( pModel, pViewData->GetDocument() );
390 
391  ScDocShell* pDocSh = pViewData->GetDocShell();
392 
394  pDocSh->FillTransferableObjectDescriptor( aObjDesc );
395  aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
396  // maSize is set in ScDrawTransferObj ctor
397 
398  rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( std::move(pModel), pDocSh, aObjDesc );
399 
401  {
402  pTransferObj->SetDrawPersist( ScGlobal::xDrawClipDocShellRef.get() ); // keep persist for ole objects alive
403  }
404 
405  return pTransferObj;
406 }
407 
408 // Calculate correction for 100%, regardless of current settings
409 
410 void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const
411 {
412  double nPPTX = ScGlobal::nScreenPPTX;
413  double nPPTY = ScGlobal::nScreenPPTY;
414 
415  if (pViewData)
416  nPPTX /= pViewData->GetDocShell()->GetOutputFactor();
417 
418  SCCOL nEndCol = 0;
419  SCROW nEndRow = 0;
420  rDoc.GetTableArea( nTab, nEndCol, nEndRow );
421  if (nEndCol<20)
422  nEndCol = 20;
423  if (nEndRow<20)
424  nEndRow = 1000;
425 
426  Fraction aZoom(1,1);
427  ScDrawUtil::CalcScale( rDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom,
428  nPPTX, nPPTY, rFractX,rFractY );
429 }
430 
432 {
433  std::unique_ptr<SdrUndoGroup> pUndoGroup(new SdrUndoGroup(*GetModel()));
434 
435  const SdrMarkList& rMarkList = GetMarkedObjectList();
436  tools::Long nDone = 0;
437  const size_t nCount = rMarkList.GetMarkCount();
438  for (size_t i=0; i<nCount; ++i)
439  {
440  SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
441  sal_uInt16 nIdent = pObj->GetObjIdentifier();
442  bool bDo = false;
443  Size aOriginalSize;
444  if (nIdent == OBJ_OLE2)
445  {
446  // TODO/LEAN: working with visual area can switch object to running state
447  uno::Reference < embed::XEmbeddedObject > xObj = static_cast<SdrOle2Obj*>(pObj)->GetObjRef();
448  if ( xObj.is() ) // NULL for an invalid object that couldn't be loaded
449  {
450  sal_Int64 nAspect = static_cast<SdrOle2Obj*>(pObj)->GetAspect();
451 
452  if ( nAspect == embed::Aspects::MSOLE_ICON )
453  {
454  MapMode aMapMode( MapUnit::Map100thMM );
455  aOriginalSize = static_cast<SdrOle2Obj*>(pObj)->GetOrigObjSize( &aMapMode );
456  bDo = true;
457  }
458  else
459  {
460  MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( static_cast<SdrOle2Obj*>(pObj)->GetAspect() ) );
461  try
462  {
463  awt::Size aSz = xObj->getVisualAreaSize( static_cast<SdrOle2Obj*>(pObj)->GetAspect() );
464  aOriginalSize = OutputDevice::LogicToLogic(
465  Size( aSz.Width, aSz.Height ),
466  MapMode(aUnit),
467  MapMode(MapUnit::Map100thMM));
468  bDo = true;
469  } catch( embed::NoVisualAreaSizeException& )
470  {
471  OSL_ENSURE( false, "Can't get the original size of the object!" );
472  }
473  }
474  }
475  }
476  else if (nIdent == OBJ_GRAF)
477  {
478  const Graphic& rGraphic = static_cast<SdrGrafObj*>(pObj)->GetGraphic();
479 
480  MapMode aSourceMap = rGraphic.GetPrefMapMode();
481  MapMode aDestMap( MapUnit::Map100thMM );
482  if (aSourceMap.GetMapUnit() == MapUnit::MapPixel)
483  {
484  // consider pixel correction, so that the bitmap is correct on the screen
485  Fraction aNormScaleX, aNormScaleY;
486  CalcNormScale( aNormScaleX, aNormScaleY );
487  aDestMap.SetScaleX(aNormScaleX);
488  aDestMap.SetScaleY(aNormScaleY);
489  }
490  if (pViewData)
491  {
492  vcl::Window* pActWin = pViewData->GetActiveWin();
493  if (pActWin)
494  {
495  aOriginalSize = pActWin->LogicToLogic(
496  rGraphic.GetPrefSize(), &aSourceMap, &aDestMap );
497  bDo = true;
498  }
499  }
500  }
501 
502  if ( bDo )
503  {
504  tools::Rectangle aDrawRect = pObj->GetLogicRect();
505 
506  pUndoGroup->AddAction( std::make_unique<SdrUndoGeoObj>( *pObj ) );
507  pObj->Resize( aDrawRect.TopLeft(), Fraction( aOriginalSize.Width(), aDrawRect.GetWidth() ),
508  Fraction( aOriginalSize.Height(), aDrawRect.GetHeight() ) );
509  ++nDone;
510  }
511  }
512 
513  if (nDone && pViewData)
514  {
515  pUndoGroup->SetComment(ScResId( STR_UNDO_ORIGINALSIZE ));
516  ScDocShell* pDocSh = pViewData->GetDocShell();
517  pDocSh->GetUndoManager()->AddUndoAction(std::move(pUndoGroup));
518  pDocSh->SetDrawModified();
519  }
520 }
521 
523 {
524  const SdrMarkList& rMarkList = GetMarkedObjectList();
525 
526  if (rMarkList.GetMarkCount() != 1)
527  {
528  SAL_WARN("sc.ui", "Fit to cell only works with one graphic!");
529  return;
530  }
531 
532  SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
533 
534  ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObj);
535  if (aAnchorType != SCA_CELL && aAnchorType != SCA_CELL_RESIZE)
536  {
537  SAL_WARN("sc.ui", "Fit to cell only works with cell anchored graphics!");
538  return;
539  }
540 
541  ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObj);
542  if (!pObjData)
543  {
544  SAL_WARN("sc.ui", "Missing ScDrawObjData!");
545  return;
546  }
547 
548  std::unique_ptr<SdrUndoGroup> pUndoGroup(new SdrUndoGroup(*GetModel()));
549  tools::Rectangle aGraphicRect = pObj->GetSnapRect();
550  tools::Rectangle aCellRect = ScDrawLayer::GetCellRect( rDoc, pObjData->maStart, true);
551 
552  // For graphic objects, we want to keep the aspect ratio
553  if (pObj->shouldKeepAspectRatio())
554  {
555  tools::Long nWidth = aGraphicRect.GetWidth();
556  assert(nWidth && "div-by-zero");
557  double fScaleX = static_cast<double>(aCellRect.GetWidth()) / static_cast<double>(nWidth);
558  tools::Long nHeight = aGraphicRect.GetHeight();
559  assert(nHeight && "div-by-zero");
560  double fScaleY = static_cast<double>(aCellRect.GetHeight()) / static_cast<double>(nHeight);
561  double fScaleMin = std::min(fScaleX, fScaleY);
562 
563  aCellRect.setWidth(static_cast<double>(aGraphicRect.GetWidth()) * fScaleMin);
564  aCellRect.setHeight(static_cast<double>(aGraphicRect.GetHeight()) * fScaleMin);
565  }
566 
567  pUndoGroup->AddAction( std::make_unique<SdrUndoGeoObj>( *pObj ) );
568  if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
569  pObj->AdjustToMaxRect(aCellRect);
570  else
571  pObj->SetSnapRect(aCellRect);
572 
573  pUndoGroup->SetComment(ScResId( STR_UNDO_FITCELLSIZE ));
574  ScDocShell* pDocSh = pViewData->GetDocShell();
575  pDocSh->GetUndoManager()->AddUndoAction(std::move(pUndoGroup));
576 
577 }
578 
579 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
bool IsChart() const
constexpr double nPPTY
ScAddress aStart
Definition: address.hxx:499
size_t GetMarkCount() const
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true)
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
void CalcNormScale(Fraction &rFractX, Fraction &rFractY) const
Definition: drawvie4.cxx:410
static SfxObjectShell * SetDrawClipDoc(bool bAnyOle)
Definition: transobj.cxx:812
long Long
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2590
#define DND_ACTION_COPYMOVE
tools::Long GetWidth() const
SdrMark * GetMark(size_t nNum) const
static tools::Rectangle GetCellRect(const ScDocument &rDoc, const ScAddress &rPos, bool bMergedCell)
Returns the rectangle for the passed cell address in 1/100 mm.
Definition: drwlayer.cxx:2093
virtual SdrObjKind GetObjIdentifier() const
void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc) const
ScAddress maStart
Definition: userdat.hxx:36
virtual const tools::Rectangle & GetSnapRect() const
SC_DLLPUBLIC void CopyStaticToDocument(const ScRange &rSrcRange, SCTAB nDestTab, ScDocument &rDestDoc)
Copy only raw cell values to another document.
Definition: document.cxx:2237
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2806
static void SetGlobalDrawPersist(SfxObjectShell *pPersist)
Definition: drwlayer.cxx:2643
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
int nCount
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:258
SCTAB Tab() const
Definition: address.hxx:270
void BeginDrag(vcl::Window *pWindow, const Point &rStartPos)
Definition: drawvie4.cxx:57
constexpr double nPPTX
void SetTabNameOnLoad(SCTAB nTab, const OUString &rName)
Definition: document.cxx:482
SdrObject * GetMarkedSdrObj() const
ScAnchorType
Definition: global.hxx:382
T * get() const
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
void SetScaleX(const Fraction &rScaleX)
static void CheckOle(const SdrMarkList &rMarkList, bool &rAnyOle, bool &rOneOle)
Definition: drawvie4.cxx:327
int i
static ScAnchorType GetAnchorType(const SdrObject &)
Definition: drwlayer.cxx:2434
sal_Int16 SCCOL
Definition: types.hxx:21
static tools::SvRef< ScDocShell > xDrawClipDocShellRef
Definition: global.hxx:580
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:578
#define SC_MOD()
Definition: scmod.hxx:249
virtual void AdjustToMaxRect(const tools::Rectangle &rMaxRect, bool bShrinkOnly=false)
OBJ_GRAF
tools::Long Width() const
ScRefFlags Parse(const OUString &, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, SCTAB nDefaultTab=0, sal_Unicode cDelimiter=0)
Definition: rangelst.cxx:104
size_t size() const
Definition: rangelst.hxx:89
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
void SetScaleY(const Fraction &rScaleY)
MapUnit GetMapUnit() const
#define DND_ACTION_LINK
Size GetPrefSize() const
sal_Int32 SCROW
Definition: types.hxx:17
void SetMarkedOriginalSize()
Definition: drawvie4.cxx:431
void AppendTabOnLoad(const OUString &rName)
Definition: document.cxx:470
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
MapMode GetPrefMapMode() const
void setWidth(tools::Long n)
OUString aName
bool DoInitNew(SfxMedium *pMedium=nullptr)
tools::Long Height() const
const INetURLObject & GetURLObject() const
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
Definition: global.hxx:576
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
OBJ_CUSTOMSHAPE
OUString GetURLNoPass(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
css::uno::Reference< css::datatransfer::XTransferable > CopyToTransferable()
Definition: drawvie4.cxx:374
tools::Long GetHeight() const
virtual void SetSnapRect(const tools::Rectangle &rRect)
virtual bool shouldKeepAspectRatio() const
MapUnit
#define SAL_WARN(area, stream)
void SetDrawModified()
SetDrawModified - without Formula update.
Definition: docsh.cxx:2884
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1548
virtual const tools::Rectangle & GetLogicRect() const
void DoCopy()
Definition: drawvie4.cxx:332
static void CalcScale(const ScDocument &rDoc, SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const OutputDevice *pDev, const Fraction &rZoomX, const Fraction &rZoomY, double nPPTX, double nPPTY, Fraction &rScaleX, Fraction &rScaleY)
Definition: drawutil.cxx:30
OBJ_OLE2
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:211
void FitToCellSize()
Definition: drawvie4.cxx:522
Point aDragStartDiff
Definition: drawvie4.cxx:55
void setHeight(tools::Long n)
sal_Int16 SCTAB
Definition: types.hxx:22
SfxMedium * GetMedium() const