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