LibreOffice Module sc (master) 1
docuno.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 <config_feature_opencl.h>
21
22#include <scitems.hxx>
23
26#include <editeng/brushitem.hxx>
27#include <editeng/editview.hxx>
28#include <editeng/memberids.h>
29#include <editeng/outliner.hxx>
30#include <o3tl/any.hxx>
31#include <o3tl/safeint.hxx>
32#include <svx/fmview.hxx>
33#include <svx/svditer.hxx>
34#include <svx/svdpage.hxx>
35#include <svx/svxids.hrc>
36
37#include <LibreOfficeKit/LibreOfficeKitEnums.h>
39#include <officecfg/Office/Common.hxx>
40#include <officecfg/Office/Calc.hxx>
41#include <svl/numuno.hxx>
42#include <svl/hint.hxx>
44#include <sfx2/bindings.hxx>
45#include <sfx2/dispatch.hxx>
46#include <sfx2/viewfrm.hxx>
47#include <svx/unopage.hxx>
49#include <vcl/print.hxx>
50#include <vcl/svapp.hxx>
51#include <tools/json_writer.hxx>
52#include <tools/multisel.hxx>
55
56#include <float.h>
57
58#include <com/sun/star/beans/PropertyAttribute.hpp>
59#include <com/sun/star/util/Date.hpp>
60#include <com/sun/star/sheet/XNamedRanges.hpp>
61#include <com/sun/star/sheet/XLabelRanges.hpp>
62#include <com/sun/star/sheet/XSelectedSheetsSupplier.hpp>
63#include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp>
64#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
65#include <com/sun/star/script/XLibraryContainer.hpp>
66#include <com/sun/star/lang/XInitialization.hpp>
67#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
68#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
69#include <com/sun/star/script/XInvocation.hpp>
70#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
71#include <com/sun/star/beans/XFastPropertySet.hpp>
73#include <comphelper/lok.hxx>
77#include <comphelper/string.hxx>
79#if HAVE_FEATURE_OPENCL
81#endif
82#include <sfx2/lokhelper.hxx>
85
86#include <cellsuno.hxx>
87#include <columnspanset.hxx>
88#include <convuno.hxx>
89#include <datauno.hxx>
90#include <docfunc.hxx>
91#include <docoptio.hxx>
92#include <docsh.hxx>
93#include <docuno.hxx>
94#include <drwlayer.hxx>
95#include <forbiuno.hxx>
96#include <formulagroup.hxx>
97#include <gridwin.hxx>
98#include <hints.hxx>
99#include <inputhdl.hxx>
100#include <inputopt.hxx>
101#include <interpre.hxx>
102#include <linkuno.hxx>
103#include <markdata.hxx>
104#include <miscuno.hxx>
105#include <nameuno.hxx>
106#include <notesuno.hxx>
107#include <optuno.hxx>
108#include <pfuncache.hxx>
109#include <postit.hxx>
110#include <printfun.hxx>
111#include <rangeutl.hxx>
112#include <scmod.hxx>
113#include <scresid.hxx>
114#include <servuno.hxx>
115#include <shapeuno.hxx>
116#include <sheetevents.hxx>
117#include <styleuno.hxx>
118#include <tabvwsh.hxx>
119#include <targuno.hxx>
120#include <unonames.hxx>
122#include <editsh.hxx>
123#include <drawsh.hxx>
124#include <drtxtob.hxx>
125#include <transobj.hxx>
126#include <chgtrack.hxx>
127#include <table.hxx>
128#include <appoptio.hxx>
129#include <formulaopt.hxx>
130
131#include <strings.hrc>
132
133using namespace com::sun::star;
134
135// #i111553# provides the name of the VBA constant for this document type (e.g. 'ThisExcelDoc' for Calc)
136constexpr OUStringLiteral SC_UNO_VBAGLOBNAME = u"VBAGlobalConstantName";
137
138// no Which-ID here, map only for PropertySetInfo
139
142{
143 static const SfxItemPropertyMapEntry aDocOptPropertyMap_Impl[] =
144 {
148 { SC_UNO_BASICLIBRARIES, 0, cppu::UnoType<script::XLibraryContainer>::get(), beans::PropertyAttribute::READONLY, 0},
149 { SC_UNO_DIALOGLIBRARIES, 0, cppu::UnoType<script::XLibraryContainer>::get(), beans::PropertyAttribute::READONLY, 0},
150 { SC_UNO_VBAGLOBNAME, 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0},
159 { SC_UNO_FORBIDDEN, 0, cppu::UnoType<i18n::XForbiddenCharacters>::get(), beans::PropertyAttribute::READONLY, 0},
160 { SC_UNO_HASDRAWPAGES, 0, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
176 { SC_UNO_RUNTIMEUID, 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0},
177 { SC_UNO_HASVALIDSIGNATURES, 0, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
181 { SC_UNO_ISRECORDCHANGESPROTECTED,0, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
185 { SC_UNO_REFERENCEDEVICE, 0, cppu::UnoType<awt::XDevice>::get(), beans::PropertyAttribute::READONLY, 0},
186 {u"BuildId", 0, ::cppu::UnoType<OUString>::get(), 0, 0},
189 };
190 return aDocOptPropertyMap_Impl;
191}
192
194
196{
197 static const SfxItemPropertyMapEntry aColumnsPropertyMap_Impl[] =
198 {
204 };
205 return aColumnsPropertyMap_Impl;
206}
207
209{
210 static const SfxItemPropertyMapEntry aRowsPropertyMap_Impl[] =
211 {
220 // not sorted, not used with SfxItemPropertyMapEntry::GetByName
221 };
222 return aRowsPropertyMap_Impl;
223}
224
225constexpr OUStringLiteral SCMODELOBJ_SERVICE = u"com.sun.star.sheet.SpreadsheetDocument";
226constexpr OUStringLiteral SCDOCSETTINGS_SERVICE = u"com.sun.star.sheet.SpreadsheetDocumentSettings";
227constexpr OUStringLiteral SCDOC_SERVICE = u"com.sun.star.document.OfficeDocument";
228
229SC_SIMPLE_SERVICE_INFO( ScAnnotationsObj, "ScAnnotationsObj", "com.sun.star.sheet.CellAnnotations" )
231SC_SIMPLE_SERVICE_INFO( ScScenariosObj, "ScScenariosObj", "com.sun.star.sheet.Scenarios" )
232SC_SIMPLE_SERVICE_INFO( ScSpreadsheetSettingsObj, "ScSpreadsheetSettingsObj", "com.sun.star.sheet.SpreadsheetDocumentSettings" )
233SC_SIMPLE_SERVICE_INFO( ScTableColumnsObj, "ScTableColumnsObj", "com.sun.star.table.TableColumns" )
234SC_SIMPLE_SERVICE_INFO( ScTableRowsObj, "ScTableRowsObj", "com.sun.star.table.TableRows" )
235SC_SIMPLE_SERVICE_INFO( ScTableSheetsObj, "ScTableSheetsObj", "com.sun.star.sheet.Spreadsheets" )
236
237class ScPrintUIOptions : public vcl::PrinterOptionsHelper
238{
239public:
241 void SetDefaults();
242};
243
245{
246 const ScPrintOptions& rPrintOpt = SC_MOD()->GetPrintOptions();
247 sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1;
248 bool bSuppress = rPrintOpt.GetSkipEmpty();
249
250 sal_Int32 nNumProps= 10, nIdx = 0;
251
252 m_aUIProperties.resize(nNumProps);
253
254 // load the writer PrinterOptions into the custom tab
255 m_aUIProperties[nIdx].Name = "OptionsUIFile";
256 m_aUIProperties[nIdx++].Value <<= OUString("modules/scalc/ui/printeroptions.ui");
257
258 // create Section for spreadsheet (results in an extra tab page in dialog)
259 SvtModuleOptions aOpt;
260 OUString aAppGroupname( ScResId( SCSTR_PRINTOPT_PRODNAME ) );
261 aAppGroupname = aAppGroupname.replaceFirst( "%s", aOpt.GetModuleName( SvtModuleOptions::EModule::CALC ) );
262 m_aUIProperties[nIdx++].Value = setGroupControlOpt("tabcontrol-page2", aAppGroupname, OUString());
263
264 // show subgroup for pages
265 m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("pages", ScResId( SCSTR_PRINTOPT_PAGES ), OUString());
266
267 // create a bool option for empty pages
268 m_aUIProperties[nIdx++].Value = setBoolControlOpt("suppressemptypages", ScResId( SCSTR_PRINTOPT_SUPPRESSEMPTY ),
269 ".HelpID:vcl:PrintDialog:IsSuppressEmptyPages:CheckBox",
270 "IsSuppressEmptyPages",
271 bSuppress);
272 // show Subgroup for print content
274 aPrintRangeOpt.maGroupHint = "PrintRange";
275 m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("printrange", ScResId( SCSTR_PRINTOPT_PAGES ),
276 OUString(),
277 aPrintRangeOpt);
278
279 // create a choice for the content to create
280 uno::Sequence< OUString > aChoices{
281 ScResId( SCSTR_PRINTOPT_ALLSHEETS ),
282 ScResId( SCSTR_PRINTOPT_SELECTEDSHEETS ),
283 ScResId( SCSTR_PRINTOPT_SELECTEDCELLS )};
284 uno::Sequence< OUString > aHelpIds{
285 ".HelpID:vcl:PrintDialog:PrintContent:ListBox"};
286 m_aUIProperties[nIdx++].Value = setChoiceListControlOpt( "printextrabox", OUString(),
287 aHelpIds, "PrintContent",
288 aChoices, nContent );
289
290 // show Subgroup for print range
291 aPrintRangeOpt.mbInternalOnly = true;
292 m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("fromwhich", ScResId( SCSTR_PRINTOPT_FROMWHICH ),
293 OUString(),
294 aPrintRangeOpt);
295
296 // create a choice for the range to print
297 OUString aPrintRangeName( "PrintRange" );
298 aChoices = { ScResId( SCSTR_PRINTOPT_PRINTALLPAGES ), ScResId( SCSTR_PRINTOPT_PRINTPAGES ) };
299 aHelpIds = { ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:0",
300 ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:1" };
301 uno::Sequence< OUString > aWidgetIds{ "rbAllPages", "rbRangePages" };
302 m_aUIProperties[nIdx++].Value = setChoiceRadiosControlOpt(aWidgetIds, OUString(),
303 aHelpIds,
304 aPrintRangeName,
305 aChoices,
306 0 );
307
308 // create an Edit dependent on "Pages" selected
309 vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, true );
310 m_aUIProperties[nIdx++].Value = setEditControlOpt("pagerange", OUString(),
311 ".HelpID:vcl:PrintDialog:PageRange:Edit",
312 "PageRange", OUString(), aPageRangeOpt);
313
314 vcl::PrinterOptionsHelper::UIControlOptions aEvenOddOpt(aPrintRangeName, 0, true);
315 m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("evenoddbox",
316 OUString(),
317 uno::Sequence<OUString>(),
318 "EvenOdd",
319 uno::Sequence<OUString>(),
320 0,
321 uno::Sequence< sal_Bool >(),
322 aEvenOddOpt);
323
324 assert(nIdx == nNumProps);
325}
326
328{
329 // re-initialize the default values from print options
330
331 const ScPrintOptions& rPrintOpt = SC_MOD()->GetPrintOptions();
332 sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1;
333 bool bSuppress = rPrintOpt.GetSkipEmpty();
334
335 for (beans::PropertyValue & rPropValue : m_aUIProperties)
336 {
337 uno::Sequence<beans::PropertyValue> aUIProp;
338 if ( rPropValue.Value >>= aUIProp )
339 {
340 for (auto& rProp : asNonConstRange(aUIProp))
341 {
342 OUString aName = rProp.Name;
343 if ( aName == "Property" )
344 {
345 beans::PropertyValue aPropertyValue;
346 if ( rProp.Value >>= aPropertyValue )
347 {
348 if ( aPropertyValue.Name == "PrintContent" )
349 {
350 aPropertyValue.Value <<= nContent;
351 rProp.Value <<= aPropertyValue;
352 }
353 else if ( aPropertyValue.Name == "IsSuppressEmptyPages" )
354 {
355 aPropertyValue.Value <<= bSuppress;
356 rProp.Value <<= aPropertyValue;
357 }
358 }
359 }
360 }
361 rPropValue.Value <<= aUIProp;
362 }
363 }
364}
365
367{
368 if (pDocSh)
369 pDocSh->SetBaseModel( new ScModelObj(pDocSh) );
370}
371
373{
375
376 if(!rDoc.GetDrawLayer())
377 {
378 rDoc.InitDrawLayer();
379 }
380
381 return *rDoc.GetDrawLayer(); // TTTT should be reference
382}
383
385 SfxBaseModel( pDocSh ),
386 aPropSet( lcl_GetDocOptPropertyMap() ),
387 pDocShell( pDocSh ),
388 maChangesListeners( m_aMutex )
389{
390 // pDocShell may be NULL if this is the base of a ScDocOptionsObj
391 if ( pDocShell )
392 {
393 pDocShell->GetDocument().AddUnoObject(*this); // SfxModel is derived from SfxListener
394 }
395}
396
398{
400
401 if (pDocShell)
403
404 if (xNumberAgg.is())
405 xNumberAgg->setDelegator(uno::Reference<uno::XInterface>());
406
407 pPrintFuncCache.reset();
408 pPrinterOptions.reset();
409}
410
411uno::Reference< uno::XAggregation> const & ScModelObj::GetFormatter()
412{
413 // pDocShell may be NULL if this is the base of a ScDocOptionsObj
414 if ( !xNumberAgg.is() && pDocShell )
415 {
416 // setDelegator changes RefCount, so we'd better hold the reference ourselves
417 // (directly in m_refCount, so we don't delete ourselves with release())
418 osl_atomic_increment( &m_refCount );
419 // we need a reference to SvNumberFormatsSupplierObj during queryInterface,
420 // otherwise it'll be deleted
421 uno::Reference<util::XNumberFormatsSupplier> xFormatter(
423 {
424 xNumberAgg.set(uno::Reference<uno::XAggregation>( xFormatter, uno::UNO_QUERY ));
425 // extra block to force deletion of the temporary before setDelegator
426 }
427
428 // during setDelegator no additional reference should exist
429 xFormatter = nullptr;
430
431 if (xNumberAgg.is())
432 xNumberAgg->setDelegator( getXWeak() );
433 osl_atomic_decrement( &m_refCount );
434 } // if ( !xNumberAgg.is() )
435 return xNumberAgg;
436}
437
439{
440 if (pDocShell)
441 return &pDocShell->GetDocument();
442 return nullptr;
443}
444
446{
447 return pDocShell;
448}
449
451{
452 if (pDocShell)
454}
455
457{
458 if (pDocShell)
460}
461
463{
464 if (pDocShell)
466}
467
469{
470 if (pDocShell)
471 return pDocShell->GetSheetSaveData();
472 return nullptr;
473}
474
476{
477 if (pDocShell)
479 return nullptr;
480}
481
483{
484 if (pDocShell)
486}
487
489{
490 if (pDocShell)
492}
493
495 const Fraction& rZoomY,
496 const SCTAB nTab,
497 const ViewShellDocId& rDocId)
498{
499 constexpr size_t nMaxIter = 5;
500 size_t nIter = 0;
501 for (SfxViewShell* pViewShell = SfxViewShell::GetFirst();
502 pViewShell && nIter < nMaxIter;
503 (pViewShell = SfxViewShell::GetNext(*pViewShell)), ++nIter)
504 {
505 if (pViewShell->GetDocId() != rDocId)
506 continue;
507
508 ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
509 if (!pTabViewShell)
510 continue;
511
512 ScViewData& rData = pTabViewShell->GetViewData();
513 if (rData.GetTabNo() == nTab && rData.GetZoomX() == rZoomX && rData.GetZoomY() == rZoomY)
514 return &rData;
515 }
516
517 return nullptr;
518}
519
521 int nOutputWidth, int nOutputHeight,
522 int nTilePosX, int nTilePosY,
523 tools::Long nTileWidth, tools::Long nTileHeight )
524{
525 ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false);
526
527 // FIXME: Can this happen? What should we do?
528 if (!pViewShell)
529 return;
530
531 ScViewData* pActiveViewData = &pViewShell->GetViewData();
532 Fraction aFracX(o3tl::toTwips(nOutputWidth, o3tl::Length::px), nTileWidth);
533 Fraction aFracY(o3tl::toTwips(nOutputHeight, o3tl::Length::px), nTileHeight);
534
535 // Try to find a view that matches the tile-zoom requested by iterating over
536 // first few shells. This is to avoid switching of zooms in ScGridWindow::PaintTile
537 // and hence avoid grid-offset recomputation on all shapes which is not cheap.
538 ScViewData* pViewData = lcl_getViewMatchingDocZoomTab(aFracX, aFracY,
539 pActiveViewData->GetTabNo(), pViewShell->GetDocId());
540 if (!pViewData)
541 pViewData = pActiveViewData;
542
543 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
544
545 // update the size of the area we are painting
546 // FIXME we want to use only the minimal necessary size, like the
547 // following; but for the moment there is too many problems with that and
548 // interaction with editeng used for the cell editing
549 //Size aTileSize(nOutputWidth, nOutputHeight);
550 //if (pGridWindow->GetOutputSizePixel() != aTileSize)
551 // pGridWindow->SetOutputSizePixel(Size(nOutputWidth, nOutputHeight));
552 // so instead for now, set the viewport size to document size
553
554 // Fetch the document size and the tiled rendering area together,
555 // because the tiled rendering area is not cheap to compute, and we want
556 // to pass it down to ScGridWindow::PaintFile to avoid computing twice.
557 SCCOL nTiledRenderingAreaEndCol = 0;
558 SCROW nTiledRenderingAreaEndRow = 0;
559 Size aDocSize = getDocumentSize(nTiledRenderingAreaEndCol, nTiledRenderingAreaEndRow);
560
561 pGridWindow->SetOutputSizePixel(Size(aDocSize.Width() * pViewData->GetPPTX(), aDocSize.Height() * pViewData->GetPPTY()));
562
563 pGridWindow->PaintTile( rDevice, nOutputWidth, nOutputHeight,
564 nTilePosX, nTilePosY, nTileWidth, nTileHeight,
565 nTiledRenderingAreaEndCol, nTiledRenderingAreaEndRow );
566
567 // Draw Form controls
569 SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(pViewData->GetTabNo()));
570 SdrView* pDrawView = pViewData->GetViewShell()->GetScDrawView();
571 tools::Rectangle aTileRect(Point(nTilePosX, nTilePosY), Size(nTileWidth, nTileHeight));
572 Size aOutputSize(nOutputWidth, nOutputHeight);
573 LokControlHandler::paintControlTile(pPage, pDrawView, *pGridWindow, rDevice, aOutputSize, aTileRect);
574}
575
576void ScModelObj::setPart( int nPart, bool /*bAllowChangeFocus*/ )
577{
578 ScViewData* pViewData = ScDocShell::GetViewData();
579 if (!pViewData)
580 return;
581
582 ScTabView* pTabView = pViewData->GetView();
583 if (!pTabView)
584 return;
585
586 if (SdrView* pDrawView = pViewData->GetViewShell()->GetScDrawView())
587 pDrawView->SetNegativeX(comphelper::LibreOfficeKit::isActive() &&
588 pViewData->GetDocument().IsLayoutRTL(nPart));
589
590 pTabView->SelectTabPage(nPart + 1);
591}
592
594{
596 return rDoc.GetTableCount();
597}
598
600{
601 ScViewData* pViewData = ScDocShell::GetViewData();
602 return pViewData ? pViewData->GetViewShell()->getPart() : 0;
603}
604
605OUString ScModelObj::getPartInfo( int nPart )
606{
607 ScViewData* pViewData = ScDocShell::GetViewData();
608 if (!pViewData)
609 return OUString();
610
611 const bool bIsVisible = pViewData->GetDocument().IsVisible(nPart);
612 //FIXME: Implement IsSelected().
613 const bool bIsSelected = false; //pViewData->GetDocument()->IsSelected(nPart);
614 const bool bIsRTLLayout = pViewData->GetDocument().IsLayoutRTL(nPart);
615
616 OUString aPartInfo = "{ \"visible\": \"" +
617 OUString::number(static_cast<unsigned int>(bIsVisible)) +
618 "\", \"selected\": \"" +
619 OUString::number(static_cast<unsigned int>(bIsSelected)) +
620 "\", \"rtllayout\": \"" +
621 OUString::number(static_cast<unsigned int>(bIsRTLLayout)) +
622 "\" }";
623 return aPartInfo;
624}
625
626OUString ScModelObj::getPartName( int nPart )
627{
628 ScViewData* pViewData = ScDocShell::GetViewData();
629 if (!pViewData)
630 return OUString();
631
632 OUString sTabName;
633 pViewData->GetDocument().GetName(nPart, sTabName);
634 return sTabName;
635}
636
637OUString ScModelObj::getPartHash( int nPart )
638{
639 ScViewData* pViewData = ScDocShell::GetViewData();
640 if (!pViewData)
641 return OUString();
642
643 sal_Int64 nHashCode;
644 return (pViewData->GetDocument().GetHashCode(nPart, nHashCode) ? OUString::number(nHashCode) : OUString());
645}
646
648{
649 SolarMutexGuard aGuard;
650
651 ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false);
652
653 // FIXME: Can this happen? What should we do?
654 if (!pViewShell)
655 return VclPtr<vcl::Window>();
656
658 return pWindow;
659
660 return pViewShell->GetViewData().GetActiveWin();
661}
662
664{
665 SCCOL nTiledRenderingAreaEndCol = 0;
666 SCROW nTiledRenderingAreaEndRow = 0;
667 return getDocumentSize(nTiledRenderingAreaEndCol, nTiledRenderingAreaEndRow);
668}
669
670Size ScModelObj::getDocumentSize(SCCOL& rnTiledRenderingAreaEndCol, SCROW& rnTiledRenderingAreaEndRow)
671{
672 Size aSize(10, 10); // minimum size
673
674 ScViewData* pViewData = ScDocShell::GetViewData();
675 if (!pViewData)
676 return aSize;
677
678 SCTAB nTab = pViewData->GetTabNo();
679 rnTiledRenderingAreaEndCol = 0;
680 rnTiledRenderingAreaEndRow = 0;
681 const ScDocument& rDoc = pDocShell->GetDocument();
682
683 rDoc.GetTiledRenderingArea(nTab, rnTiledRenderingAreaEndCol, rnTiledRenderingAreaEndRow);
684
685 const ScDocument* pThisDoc = &rDoc;
686 const double fPPTX = pViewData->GetPPTX();
687 const double fPPTY = pViewData->GetPPTY();
688
689 auto GetColWidthPx = [pThisDoc, fPPTX, nTab](SCCOL nCol) {
690 const sal_uInt16 nSize = pThisDoc->GetColWidth(nCol, nTab);
691 return ScViewData::ToPixel(nSize, fPPTX);
692 };
693
694 tools::Long nDocWidthPixel = pViewData->GetLOKWidthHelper().computePosition(rnTiledRenderingAreaEndCol, GetColWidthPx);
695 tools::Long nDocHeightPixel = pThisDoc->GetScaledRowHeight(0, rnTiledRenderingAreaEndRow, nTab, fPPTY);
696
697 if (nDocWidthPixel > 0 && nDocHeightPixel > 0)
698 {
699 // convert to twips
700 aSize.setWidth(nDocWidthPixel / fPPTX);
701 aSize.setHeight(nDocHeightPixel / fPPTY);
702 }
703 else
704 {
705 // convert to twips
706 aSize.setWidth(rDoc.GetColWidth(0, rnTiledRenderingAreaEndCol, nTab));
707 aSize.setHeight(rDoc.GetRowHeight(0, rnTiledRenderingAreaEndRow, nTab));
708 }
709
710 return aSize;
711}
712
714{
715 Size aSize(1, 1);
716
717 ScViewData* pViewData = ScDocShell::GetViewData();
718 if (!pViewData || !pDocShell)
719 return aSize;
720
721 SCTAB nTab = nPart;
722 SCCOL nEndCol = 0;
723 SCROW nEndRow = 0;
725
726 ScTable* pTab = rDoc.FetchTable(nTab);
727 if (!pTab)
728 return aSize;
729
730 pTab->GetCellArea(nEndCol, nEndRow);
731 aSize = Size(nEndCol, nEndRow);
732
733 return aSize;
734}
735
736void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode)
737{
738 SolarMutexGuard aGuard;
739 SfxLokHelper::postKeyEventAsync(getDocWindow(), nType, nCharCode, nKeyCode);
740}
741
742void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
743{
744 SolarMutexGuard aGuard;
745
746 ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false);
747
748 // FIXME: Can this happen? What should we do?
749 if (!pViewShell)
750 return;
751
752 ScViewData* pViewData = &pViewShell->GetViewData();
753
754 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
755
756 if (!pGridWindow)
757 return;
758
759 SCTAB nTab = pViewData->GetTabNo();
760 const ScDocument& rDoc = pDocShell->GetDocument();
761 bool bDrawNegativeX = rDoc.IsNegativePage(nTab);
763 nButtons, nModifier, pViewData->GetPPTX(),
764 pViewData->GetPPTY(), bDrawNegativeX))
765 return;
766
767 Point aPointTwip(nX, nY);
768
769 // Check if a control is hit
771 Point aPointHMMDraw(bDrawNegativeX ? -aPointHMM.X() : aPointHMM.X(), aPointHMM.Y());
773 SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(nTab));
774 SdrView* pDrawView = pViewData->GetViewShell()->GetScDrawView();
775 if (LokControlHandler::postMouseEvent(pPage, pDrawView, *pGridWindow, nType, aPointHMMDraw, nCount, nButtons, nModifier))
776 return;
777
778 if (!pGridWindow->HasChildPathFocus(true))
779 pGridWindow->GrabFocus();
780
781 // Calc operates in pixels...
782 const Point aPosition(nX * pViewData->GetPPTX() + pGridWindow->GetOutOffXPixel(),
783 nY * pViewData->GetPPTY() + pGridWindow->GetOutOffYPixel());
784
785 VclEventId aEvent = VclEventId::NONE;
786 MouseEvent aData(aPosition, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
787 aData.setLogicPosition(aPointHMM);
788 switch (nType)
789 {
790 case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
791 aEvent = VclEventId::WindowMouseButtonDown;
792 break;
793 case LOK_MOUSEEVENT_MOUSEBUTTONUP:
794 aEvent = VclEventId::WindowMouseButtonUp;
795 break;
796 case LOK_MOUSEEVENT_MOUSEMOVE:
797 aEvent = VclEventId::WindowMouseMove;
798 break;
799 default:
800 break;
801 }
802
804}
805
806void ScModelObj::setTextSelection(int nType, int nX, int nY)
807{
808 SolarMutexGuard aGuard;
809
810 ScViewData* pViewData = ScDocShell::GetViewData();
811 if (!pViewData)
812 return;
813
814 ScTabViewShell* pViewShell = pViewData->GetViewShell();
815
816 LokChartHelper aChartHelper(pViewShell);
817 if (aChartHelper.setTextSelection(nType, nX, nY))
818 return;
819
820 ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell);
821 ScDrawView* pDrawView = pViewData->GetScDrawView();
822
823 bool bHandled = false;
824
825 if (pInputHandler && pInputHandler->IsInputMode())
826 {
827 // forwarding to editeng - we are editing the cell content
828 EditView* pTableView = pInputHandler->GetTableView();
829 assert(pTableView);
830
832
833 if (pTableView->GetOutputArea().Contains(aPoint))
834 {
835 switch (nType)
836 {
837 case LOK_SETTEXTSELECTION_START:
838 pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/false, /*bClearMark=*/false);
839 break;
840 case LOK_SETTEXTSELECTION_END:
841 pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/false);
842 break;
843 case LOK_SETTEXTSELECTION_RESET:
844 pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/true);
845 break;
846 default:
847 assert(false);
848 break;
849 }
850 bHandled = true;
851 }
852 }
853 else if (pDrawView && pDrawView->IsTextEdit())
854 {
855 // forwarding to editeng - we are editing the text in shape
856 OutlinerView* pOutlinerView = pDrawView->GetTextEditOutlinerView();
857 EditView& rEditView = pOutlinerView->GetEditView();
858
860 switch (nType)
861 {
862 case LOK_SETTEXTSELECTION_START:
863 rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/false, /*bClearMark=*/false);
864 break;
865 case LOK_SETTEXTSELECTION_END:
866 rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/false);
867 break;
868 case LOK_SETTEXTSELECTION_RESET:
869 rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/true);
870 break;
871 default:
872 assert(false);
873 break;
874 }
875 bHandled = true;
876 }
877
878 if (!bHandled)
879 {
880 // just update the cell selection
881 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
882 if (!pGridWindow)
883 return;
884
885 // move the cell selection handles
886 pGridWindow->SetCellSelectionPixel(nType, nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY());
887 }
888}
889
890uno::Reference<datatransfer::XTransferable> ScModelObj::getSelection()
891{
892 SolarMutexGuard aGuard;
893
894 TransferableDataHelper aDataHelper;
895 uno::Reference<datatransfer::XTransferable> xTransferable;
896
897 if (ScViewData* pViewData = ScDocShell::GetViewData())
898 {
899 if ( ScEditShell * pShell = dynamic_cast<ScEditShell*>( pViewData->GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0) ) )
900 xTransferable = pShell->GetEditView()->GetTransferable();
901 else if ( nullptr != dynamic_cast<ScDrawTextObjectBar*>( pViewData->GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0) ))
902 {
903 ScDrawView* pView = pViewData->GetScDrawView();
904 OutlinerView* pOutView = pView->GetTextEditOutlinerView();
905 if (pOutView)
906 xTransferable = pOutView->GetEditView().GetTransferable();
907 }
908 else if ( ScDrawShell * pDrawShell = dynamic_cast<ScDrawShell*>( pViewData->GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0) ) )
909 xTransferable = pDrawShell->GetDrawView()->CopyToTransferable();
910 else
911 xTransferable = pViewData->GetViewShell()->CopyToTransferable();
912 }
913
914 if (!xTransferable.is())
915 xTransferable.set( aDataHelper.GetTransferable() );
916
917 return xTransferable;
918}
919
920void ScModelObj::setGraphicSelection(int nType, int nX, int nY)
921{
922 SolarMutexGuard aGuard;
923
924 ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false);
925
926 // FIXME: Can this happen? What should we do?
927 if (!pViewShell)
928 return;
929
930 ScViewData* pViewData = &pViewShell->GetViewData();
931
932 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
933
934 double fPPTX = pViewData->GetPPTX();
935 double fPPTY = pViewData->GetPPTY();
936
937 pViewShell = pViewData->GetViewShell();
938 LokChartHelper aChartHelper(pViewShell);
939 if (aChartHelper.setGraphicSelection(nType, nX, nY, fPPTX, fPPTY))
940 return;
941
942 int nPixelX = nX * fPPTX;
943 int nPixelY = nY * fPPTY;
944
945 switch (nType)
946 {
947 case LOK_SETGRAPHICSELECTION_START:
948 {
949 MouseEvent aClickEvent(Point(nPixelX, nPixelY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
950 pGridWindow->MouseButtonDown(aClickEvent);
951 MouseEvent aMoveEvent(Point(nPixelX, nPixelY), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT);
952 pGridWindow->MouseMove(aMoveEvent);
953 }
954 break;
955 case LOK_SETGRAPHICSELECTION_END:
956 {
957 MouseEvent aMoveEvent(Point(nPixelX, nPixelY), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT);
958 pGridWindow->MouseMove(aMoveEvent);
959 MouseEvent aClickEvent(Point(nPixelX, nPixelY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
960 pGridWindow->MouseButtonUp(aClickEvent);
961 }
962 break;
963 default:
964 assert(false);
965 break;
966 }
967}
968
970{
971 SolarMutexGuard aGuard;
972
973 ScViewData* pViewData = ScDocShell::GetViewData();
974 if (!pViewData)
975 return;
976
977 ScTabViewShell* pViewShell = pViewData->GetViewShell();
978
979 // deselect the shapes & texts
980 ScDrawView* pDrawView = pViewShell->GetScDrawView();
981 if (pDrawView)
982 {
983 pDrawView->ScEndTextEdit();
984 pDrawView->UnmarkAll();
985 }
986 else
987 pViewShell->Unmark();
988
989 // and hide the cell and text selection
990 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "");
991 SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "");
992}
993
994void ScModelObj::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard)
995{
996 SolarMutexGuard aGuard;
997
998 ScViewData* pViewData = ScDocShell::GetViewData();
999 if (!pViewData)
1000 return;
1001
1002 pViewData->GetActiveWin()->SetClipboard(xClipboard);
1003}
1004
1006{
1007 SolarMutexGuard aGuard;
1008
1009 ScViewData* pViewData = ScDocShell::GetViewData();
1010 if (!pViewData)
1011 return false;
1012
1013
1015 return EditEngine::HasValidData(aDataHelper.GetTransferable());
1016}
1017
1018static void lcl_sendLOKDocumentBackground(const ScViewData* pViewData)
1019{
1020 ScDocShell* pDocSh = pViewData->GetDocShell();
1021 ScDocument& rDoc = pDocSh->GetDocument();
1022 const ScPatternAttr *pAttr = rDoc.GetDefPattern();
1023 const SfxPoolItem& rItem = pAttr->GetItem(ATTR_BACKGROUND);
1024 const SvxBrushItem& rBackground = static_cast<const SvxBrushItem&>(rItem);
1025 const Color& rColor = rBackground.GetColor();
1026
1027 ScTabViewShell* pViewShell = pViewData->GetViewShell();
1028 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR, rColor.AsRGBHexString().toUtf8());
1029}
1030
1031void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int nTileTwipWidth_, int nTileTwipHeight_)
1032{
1033 ScViewData* pViewData = ScDocShell::GetViewData();
1034 if (!pViewData)
1035 return;
1036
1037 // Currently in LOK clients the doc background cannot be changed, so send this sparingly as possible but for every view.
1038 // FIXME: Find a better place to trigger this callback where it would be called just once per view creation.
1039 // Doing this in ScTabViewShell init code does not work because callbacks do not work at that point for the first view.
1041
1042 const Fraction newZoomX(o3tl::toTwips(nTilePixelWidth_, o3tl::Length::px), nTileTwipWidth_);
1043 const Fraction newZoomY(o3tl::toTwips(nTilePixelHeight_, o3tl::Length::px), nTileTwipHeight_);
1044
1045 double fDeltaPPTX = std::abs(ScGlobal::nScreenPPTX * static_cast<double>(newZoomX) - pViewData->GetPPTX());
1046 double fDeltaPPTY = std::abs(ScGlobal::nScreenPPTY * static_cast<double>(newZoomY) - pViewData->GetPPTY());
1047 constexpr double fEps = 1E-08;
1048
1049 if (pViewData->GetZoomX() == newZoomX && pViewData->GetZoomY() == newZoomY && fDeltaPPTX < fEps && fDeltaPPTY < fEps)
1050 return;
1051
1052 pViewData->SetZoom(newZoomX, newZoomY, true);
1053
1054 // refresh our view's take on other view's cursors & selections
1055 pViewData->GetActiveWin()->updateKitOtherCursors();
1056 pViewData->GetActiveWin()->updateOtherKitSelections();
1057
1058 if (ScDrawView* pDrawView = pViewData->GetScDrawView())
1059 pDrawView->resetGridOffsetsForAllSdrPageViews();
1060}
1061
1063{
1064 ScViewData* pViewData = ScDocShell::GetViewData();
1065 if (!pViewData)
1066 return;
1067
1068 ScTabView* pTabView = pViewData->GetView();
1069 if (!pTabView)
1070 return;
1071
1072 pTabView->getRowColumnHeaders(rRectangle, rJsonWriter);
1073}
1074
1075OString ScModelObj::getSheetGeometryData(bool bColumns, bool bRows, bool bSizes, bool bHidden,
1076 bool bFiltered, bool bGroups)
1077{
1078 ScViewData* pViewData = ScDocShell::GetViewData();
1079 if (!pViewData)
1080 return "";
1081
1082 ScTabView* pTabView = pViewData->GetView();
1083 if (!pTabView)
1084 return "";
1085
1086 return pTabView->getSheetGeometryData(bColumns, bRows, bSizes, bHidden, bFiltered, bGroups);
1087}
1088
1090{
1091 SolarMutexGuard aGuard;
1092
1093 ScViewData* pViewData = ScDocShell::GetViewData();
1094 if (!pViewData)
1095 return;
1096
1097 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
1098 if (!pGridWindow)
1099 return;
1100
1101 rJsonWriter.put("commandName", ".uno:CellCursor");
1102 rJsonWriter.put("commandValues", pGridWindow->getCellCursor());
1103}
1104
1106{
1107 SolarMutexGuard aGuard;
1108
1109 ScViewData* pViewData = ScDocShell::GetViewData();
1110 if (!pViewData)
1111 return PointerStyle::Arrow;
1112
1113 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
1114 if (!pGridWindow)
1115 return PointerStyle::Arrow;
1116
1117 return pGridWindow->GetPointer();
1118}
1119
1121{
1122 if (pDocShell)
1123 {
1124 if (ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack())
1125 pChangeTrack->GetChangeTrackInfo(rJson);
1126 }
1127}
1128
1130{
1131 ScViewData* pViewData = ScDocShell::GetViewData();
1132 if (!pViewData)
1133 return;
1134
1135 // set the PgUp/PgDown offset
1136 pViewData->ForcePageUpDownOffset(rRectangle.GetHeight());
1137
1138 // Store the visible area so that we can use at places like shape insertion
1139 pViewData->setLOKVisibleArea(rRectangle);
1140
1142 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1143 {
1144 ScTabView* pTabView = pViewData->GetView();
1145 if (pTabView)
1146 pTabView->extendTiledAreaIfNeeded();
1147 }
1148}
1149
1150void ScModelObj::setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
1151{
1152 ScViewData* pViewData = ScDocShell::GetViewData();
1153 if (!pViewData)
1154 return;
1155
1156 ScDBFunc* pFunc = pViewData->GetView();
1157
1158 if (pFunc)
1159 pFunc->SetOutlineState(bColumn, nLevel, nIndex, bHidden);
1160}
1161
1163{
1164 if (!pDocShell)
1165 return;
1166
1167 ScDocument& rDoc = pDocShell->GetDocument();
1168 std::vector<sc::NoteEntry> aNotes;
1169 rDoc.GetAllNoteEntries(aNotes);
1170
1171 auto commentsNode = rJsonWriter.startArray("comments");
1172 for (const sc::NoteEntry& aNote : aNotes)
1173 {
1174 auto commentNode = rJsonWriter.startStruct();
1175
1176 rJsonWriter.put("id", aNote.mpNote->GetId());
1177 rJsonWriter.put("tab", aNote.maPos.Tab());
1178 rJsonWriter.put("author", aNote.mpNote->GetAuthor());
1179 rJsonWriter.put("dateTime", aNote.mpNote->GetDate());
1180 rJsonWriter.put("text", aNote.mpNote->GetText());
1181
1182 // Calculating the cell cursor position
1183 if (ScViewData* pViewData = ScDocShell::GetViewData())
1184 {
1185 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
1186 if (pGridWindow)
1187 {
1188 SCCOL nX = aNote.maPos.Col();
1189 SCROW nY = aNote.maPos.Row();
1190 Point aScrPos = pViewData->GetScrPos(nX, nY, pViewData->GetActivePart(), true);
1191 tools::Long nSizeXPix;
1192 tools::Long nSizeYPix;
1193 pViewData->GetMergeSizePixel(nX, nY, nSizeXPix, nSizeYPix);
1194
1195 double fPPTX = pViewData->GetPPTX();
1196 double fPPTY = pViewData->GetPPTY();
1197 tools::Rectangle aRect(Point(aScrPos.getX() / fPPTX, aScrPos.getY() / fPPTY),
1198 Size(nSizeXPix / fPPTX, nSizeYPix / fPPTY));
1199
1200 rJsonWriter.put("cellPos", aRect.toString());
1201 }
1202 }
1203 }
1204}
1205
1207{
1208 if (!pDocShell)
1209 return;
1210
1211 ScDocument& rDoc = pDocShell->GetDocument();
1212 std::vector<sc::NoteEntry> aNotes;
1213 rDoc.GetAllNoteEntries(aNotes);
1214
1215 auto commentsNode = rJsonWriter.startArray("commentsPos");
1216 for (const sc::NoteEntry& aNote : aNotes)
1217 {
1218 auto commentNode = rJsonWriter.startStruct();
1219
1220 rJsonWriter.put("id", aNote.mpNote->GetId());
1221 rJsonWriter.put("tab", aNote.maPos.Tab());
1222
1223 // Calculating the cell cursor position
1224 if (ScViewData* pViewData = ScDocShell::GetViewData())
1225 {
1226 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
1227 if (pGridWindow)
1228 {
1229 SCCOL nX = aNote.maPos.Col();
1230 SCROW nY = aNote.maPos.Row();
1231 Point aScrPos = pViewData->GetScrPos(nX, nY, pViewData->GetActivePart(), true);
1232 tools::Long nSizeXPix;
1233 tools::Long nSizeYPix;
1234 pViewData->GetMergeSizePixel(nX, nY, nSizeXPix, nSizeYPix);
1235
1236 double fPPTX = pViewData->GetPPTX();
1237 double fPPTY = pViewData->GetPPTY();
1238 tools::Rectangle aRect(Point(aScrPos.getX() / fPPTX, aScrPos.getY() / fPPTY),
1239 Size(nSizeXPix / fPPTX, nSizeYPix / fPPTY));
1240
1241 rJsonWriter.put("cellPos", aRect.toString());
1242 }
1243 }
1244 }
1245}
1246
1247void ScModelObj::completeFunction(const OUString& rFunctionName)
1248{
1249 ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
1250 if (pHdl)
1251 {
1252 assert(!rFunctionName.isEmpty());
1253 pHdl->LOKPasteFunctionData(rFunctionName);
1254 }
1255}
1256
1258{
1259 OStringBuffer aState;
1260 ScViewData* pViewData = ScDocShell::GetViewData();
1261
1262 if (pViewData)
1263 {
1264 aState.append(';');
1265
1266 const ScViewOptions& aViewOptions = pViewData->GetOptions();
1267 OString aThemeName = OUStringToOString(aViewOptions.GetColorSchemeName(), RTL_TEXTENCODING_UTF8);
1268 aState.append(aThemeName);
1269 }
1270
1271 return aState.makeStringAndClear();
1272}
1273
1274void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
1275{
1276 SolarMutexGuard aGuard;
1277
1278 // enable word autocompletion
1279 ScAppOptions aAppOptions(SC_MOD()->GetAppOptions());
1280 aAppOptions.SetAutoComplete(true);
1281 SC_MOD()->SetAppOptions(aAppOptions);
1282
1283 for (const beans::PropertyValue& rValue : rArguments)
1284 {
1285 if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>())
1286 {
1287 ScDocOptions options = GetDocument()->GetDocOptions();
1288 options.SetAutoSpell(rValue.Value.get<bool>());
1289 GetDocument()->SetDocOptions(options);
1290 }
1291 }
1292
1293 // show us the text exactly
1294 ScInputOptions aInputOptions(SC_MOD()->GetInputOptions());
1295 aInputOptions.SetTextWysiwyg(true);
1296 aInputOptions.SetReplaceCellsWarn(false);
1297 SC_MOD()->SetInputOptions(aInputOptions);
1299
1300 // when the "This document may contain formatting or content that cannot
1301 // be saved..." dialog appears, it is auto-cancelled with tiled rendering,
1302 // causing 'Save' being disabled; so let's always save to the original
1303 // format
1305 officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, xChanges);
1306 xChanges->commit();
1307}
1308
1310{
1311 SC_QUERYINTERFACE( sheet::XSpreadsheetDocument )
1312 SC_QUERYINTERFACE( document::XActionLockable )
1313 SC_QUERYINTERFACE( sheet::XCalculatable )
1314 SC_QUERYINTERFACE( util::XProtectable )
1315 SC_QUERYINTERFACE( drawing::XDrawPagesSupplier )
1316 SC_QUERYINTERFACE( sheet::XGoalSeek )
1317 SC_QUERYINTERFACE( sheet::XConsolidatable )
1318 SC_QUERYINTERFACE( sheet::XDocumentAuditing )
1319 SC_QUERYINTERFACE( style::XStyleFamiliesSupplier )
1320 SC_QUERYINTERFACE( view::XRenderable )
1321 SC_QUERYINTERFACE( document::XLinkTargetSupplier )
1322 SC_QUERYINTERFACE( beans::XPropertySet )
1323 SC_QUERYINTERFACE( lang::XMultiServiceFactory )
1324 SC_QUERYINTERFACE( lang::XServiceInfo )
1325 SC_QUERYINTERFACE( util::XChangesNotifier )
1326 SC_QUERYINTERFACE( sheet::opencl::XOpenCLSelection )
1327 SC_QUERYINTERFACE( chart2::XDataProviderAccess )
1328
1330 if ( !aRet.hasValue()
1337 {
1338 GetFormatter();
1339 if ( xNumberAgg.is() )
1340 aRet = xNumberAgg->queryAggregation( rType );
1341 }
1342
1343 return aRet;
1344}
1345
1346void SAL_CALL ScModelObj::acquire() noexcept
1347{
1349}
1350
1351void SAL_CALL ScModelObj::release() noexcept
1352{
1354}
1355
1356uno::Sequence<uno::Type> SAL_CALL ScModelObj::getTypes()
1357{
1358 static const uno::Sequence<uno::Type> aTypes = [&]()
1359 {
1360 uno::Sequence<uno::Type> aAggTypes;
1361 if ( GetFormatter().is() )
1362 {
1364 uno::Any aNumProv(xNumberAgg->queryAggregation(rProvType));
1365 if(auto xNumProv
1366 = o3tl::tryAccess<uno::Reference<lang::XTypeProvider>>(aNumProv))
1367 {
1368 aAggTypes = (*xNumProv)->getTypes();
1369 }
1370 }
1373 aAggTypes,
1374 uno::Sequence<uno::Type>
1375 {
1392 } );
1393 }();
1394 return aTypes;
1395}
1396
1397uno::Sequence<sal_Int8> SAL_CALL ScModelObj::getImplementationId()
1398{
1399 return css::uno::Sequence<sal_Int8>();
1400}
1401
1403{
1404 // Not interested in reference update hints here
1405
1406 const SfxHintId nId = rHint.GetId();
1407 if ( nId == SfxHintId::Dying )
1408 {
1409 pDocShell = nullptr; // has become invalid
1410 if (xNumberAgg.is())
1411 {
1413 comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(
1414 uno::Reference<util::XNumberFormatsSupplier>(xNumberAgg, uno::UNO_QUERY) );
1415 if ( pNumFmt )
1416 pNumFmt->SetNumberFormatter( nullptr );
1417 }
1418
1419 pPrintFuncCache.reset(); // must be deleted because it has a pointer to the DocShell
1420 m_pPrintState.reset();
1421 }
1422 else if ( nId == SfxHintId::DataChanged )
1423 {
1424 // cached data for rendering become invalid when contents change
1425 // (if a broadcast is added to SetDrawModified, is has to be tested here, too)
1426
1427 pPrintFuncCache.reset();
1428 m_pPrintState.reset();
1429
1430 // handle "OnCalculate" sheet events (search also for VBA event handlers)
1431 if ( pDocShell )
1432 {
1433 ScDocument& rDoc = pDocShell->GetDocument();
1434 if ( rDoc.GetVbaEventProcessor().is() )
1435 {
1436 // If the VBA event processor is set, HasAnyCalcNotification is much faster than HasAnySheetEventScript
1439 }
1440 else
1441 {
1444 }
1445 }
1446 }
1447
1448 // always call parent - SfxBaseModel might need to handle the same hints again
1449 SfxBaseModel::Notify( rBC, rHint ); // SfxBaseModel is derived from SfxListener
1450}
1451
1452// XSpreadsheetDocument
1453
1454uno::Reference<sheet::XSpreadsheets> SAL_CALL ScModelObj::getSheets()
1455{
1456 SolarMutexGuard aGuard;
1457 if (pDocShell)
1458 return new ScTableSheetsObj(pDocShell);
1459 return nullptr;
1460}
1461
1462css::uno::Reference< ::css::chart2::data::XDataProvider > SAL_CALL ScModelObj::createDataProvider()
1463{
1464 if (pDocShell)
1465 {
1466 return css::uno::Reference< ::css::chart2::data::XDataProvider > (
1468 }
1469 return nullptr;
1470}
1471
1472// XStyleFamiliesSupplier
1473
1474uno::Reference<container::XNameAccess> SAL_CALL ScModelObj::getStyleFamilies()
1475{
1476 SolarMutexGuard aGuard;
1477 if (pDocShell)
1478 return new ScStyleFamiliesObj(pDocShell);
1479 return nullptr;
1480}
1481
1482// XRenderable
1483
1484static OutputDevice* lcl_GetRenderDevice( const uno::Sequence<beans::PropertyValue>& rOptions )
1485{
1486 OutputDevice* pRet = nullptr;
1487 for (const beans::PropertyValue& rProp : rOptions)
1488 {
1489 const OUString & rPropName = rProp.Name;
1490
1491 if (rPropName == SC_UNONAME_RENDERDEV)
1492 {
1493 uno::Reference<awt::XDevice> xRenderDevice(rProp.Value, uno::UNO_QUERY);
1494 if ( xRenderDevice.is() )
1495 {
1496 VCLXDevice* pDevice = dynamic_cast<VCLXDevice*>( xRenderDevice.get() );
1497 if ( pDevice )
1498 {
1499 pRet = pDevice->GetOutputDevice().get();
1501 }
1502 }
1503 }
1504 }
1505 return pRet;
1506}
1507
1508static bool lcl_ParseTarget( const OUString& rTarget, ScRange& rTargetRange, tools::Rectangle& rTargetRect,
1509 bool& rIsSheet, ScDocument& rDoc, SCTAB nSourceTab )
1510{
1511 // test in same order as in SID_CURRENTCELL execute
1512
1513 ScAddress aAddress;
1514 SCTAB nNameTab;
1515 sal_Int32 nNumeric = 0;
1516
1517 bool bRangeValid = false;
1518 bool bRectValid = false;
1519
1520 if ( rTargetRange.Parse( rTarget, rDoc ) & ScRefFlags::VALID )
1521 {
1522 bRangeValid = true; // range reference
1523 }
1524 else if ( aAddress.Parse( rTarget, rDoc ) & ScRefFlags::VALID )
1525 {
1526 rTargetRange = aAddress;
1527 bRangeValid = true; // cell reference
1528 }
1529 else if ( ScRangeUtil::MakeRangeFromName( rTarget, rDoc, nSourceTab, rTargetRange ) ||
1530 ScRangeUtil::MakeRangeFromName( rTarget, rDoc, nSourceTab, rTargetRange, RUTL_DBASE ) )
1531 {
1532 bRangeValid = true; // named range or database range
1533 }
1535 ( nNumeric = rTarget.toInt32() ) > 0 && nNumeric <= rDoc.MaxRow()+1 )
1536 {
1537 // row number is always mapped to cell A(row) on the same sheet
1538 rTargetRange = ScAddress( 0, static_cast<SCROW>(nNumeric-1), nSourceTab ); // target row number is 1-based
1539 bRangeValid = true; // row number
1540 }
1541 else if ( rDoc.GetTable( rTarget, nNameTab ) )
1542 {
1543 rTargetRange = ScAddress(0,0,nNameTab);
1544 bRangeValid = true; // sheet name
1545 rIsSheet = true; // needs special handling (first page of the sheet)
1546 }
1547 else
1548 {
1549 // look for named drawing object
1550
1551 ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
1552 if ( pDrawLayer )
1553 {
1554 SCTAB nTabCount = rDoc.GetTableCount();
1555 for (SCTAB i=0; i<nTabCount && !bRangeValid; i++)
1556 {
1557 SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(i));
1558 OSL_ENSURE(pPage,"Page ?");
1559 if (pPage)
1560 {
1561 SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
1562 SdrObject* pObject = aIter.Next();
1563 while (pObject && !bRangeValid)
1564 {
1566 {
1567 rTargetRect = pObject->GetLogicRect(); // 1/100th mm
1568 rTargetRange = rDoc.GetRange( i, rTargetRect ); // underlying cells
1569 bRangeValid = bRectValid = true; // rectangle is valid
1570 }
1571 pObject = aIter.Next();
1572 }
1573 }
1574 }
1575 }
1576 }
1577 if ( bRangeValid && !bRectValid )
1578 {
1579 // get rectangle for cell range
1580 rTargetRect = rDoc.GetMMRect( rTargetRange.aStart.Col(), rTargetRange.aStart.Row(),
1581 rTargetRange.aEnd.Col(), rTargetRange.aEnd.Row(),
1582 rTargetRange.aStart.Tab() );
1583 }
1584
1585 return bRangeValid;
1586}
1587
1589 const uno::Sequence< beans::PropertyValue >& rOptions,
1590 ScMarkData& rMark,
1591 ScPrintSelectionStatus& rStatus, OUString& rPagesStr,
1592 bool& rbRenderToGraphic ) const
1593{
1594 OSL_ENSURE( !rMark.IsMarked() && !rMark.IsMultiMarked(), "FillRenderMarkData: MarkData must be empty" );
1595 OSL_ENSURE( pDocShell, "FillRenderMarkData: DocShell must be set" );
1596
1597 bool bDone = false;
1598
1599 uno::Reference<frame::XController> xView;
1600
1601 // defaults when no options are passed: all sheets, include empty pages
1602 bool bSelectedSheetsOnly = false;
1603 bool bSuppressEmptyPages = true;
1604
1605 bool bHasPrintContent = false;
1606 sal_Int32 nPrintContent = 0; // all sheets / selected sheets / selected cells
1607 sal_Int32 nPrintRange = 0; // all pages / pages
1608 sal_Int32 nEOContent = 0; // even pages / odd pages
1609 OUString aPageRange; // "pages" edit value
1610
1611 for( const auto& rOption : rOptions )
1612 {
1613 if ( rOption.Name == "IsOnlySelectedSheets" )
1614 {
1615 rOption.Value >>= bSelectedSheetsOnly;
1616 }
1617 else if ( rOption.Name == "IsSuppressEmptyPages" )
1618 {
1619 rOption.Value >>= bSuppressEmptyPages;
1620 }
1621 else if ( rOption.Name == "PageRange" )
1622 {
1623 rOption.Value >>= aPageRange;
1624 }
1625 else if ( rOption.Name == "PrintRange" )
1626 {
1627 rOption.Value >>= nPrintRange;
1628 }
1629 else if ( rOption.Name == "EvenOdd" )
1630 {
1631 rOption.Value >>= nEOContent;
1632 }
1633 else if ( rOption.Name == "PrintContent" )
1634 {
1635 bHasPrintContent = true;
1636 rOption.Value >>= nPrintContent;
1637 }
1638 else if ( rOption.Name == "View" )
1639 {
1640 rOption.Value >>= xView;
1641 }
1642 else if ( rOption.Name == "RenderToGraphic" )
1643 {
1644 rOption.Value >>= rbRenderToGraphic;
1645 }
1646 }
1647
1648 // "Print Content" selection wins over "Selected Sheets" option
1649 if ( bHasPrintContent )
1650 bSelectedSheetsOnly = ( nPrintContent != 0 );
1651
1652 uno::Reference<uno::XInterface> xInterface(aSelection, uno::UNO_QUERY);
1653 if ( xInterface.is() )
1654 {
1655 ScCellRangesBase* pSelObj = dynamic_cast<ScCellRangesBase*>( xInterface.get() );
1656 uno::Reference< drawing::XShapes > xShapes( xInterface, uno::UNO_QUERY );
1657 if ( pSelObj && pSelObj->GetDocShell() == pDocShell )
1658 {
1659 bool bSheet = ( dynamic_cast<ScTableSheetObj*>( pSelObj ) != nullptr );
1660 bool bCursor = pSelObj->IsCursorOnly();
1661 const ScRangeList& rRanges = pSelObj->GetRangeList();
1662
1663 rMark.MarkFromRangeList( rRanges, false );
1664 rMark.MarkToSimple();
1665
1666 if ( rMark.IsMultiMarked() )
1667 {
1668 // #i115266# copy behavior of old printing:
1669 // treat multiple selection like a single selection with the enclosing range
1670 const ScRange& aMultiMarkArea = rMark.GetMultiMarkArea();
1671 rMark.ResetMark();
1672 rMark.SetMarkArea( aMultiMarkArea );
1673 }
1674
1675 if ( rMark.IsMarked() && !rMark.IsMultiMarked() )
1676 {
1677 // a sheet object is treated like an empty selection: print the used area of the sheet
1678
1679 if ( bCursor || bSheet ) // nothing selected -> use whole tables
1680 {
1681 rMark.ResetMark(); // doesn't change table selection
1683 }
1684 else
1686
1687 rStatus.SetRanges( rRanges );
1688 bDone = true;
1689 }
1690 // multi selection isn't supported
1691 }
1692 else if( xShapes.is() )
1693 {
1694 //print a selected ole object
1695 // multi selection isn't supported yet
1696 uno::Reference< drawing::XShape > xShape( xShapes->getByIndex(0), uno::UNO_QUERY );
1697 SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape( xShape );
1698 if( pSdrObj && pDocShell )
1699 {
1700 ScDocument& rDoc = pDocShell->GetDocument();
1701 tools::Rectangle aObjRect = pSdrObj->GetCurrentBoundRect();
1702 SCTAB nCurrentTab = ScDocShell::GetCurTab();
1703 ScRange aRange = rDoc.GetRange( nCurrentTab, aObjRect );
1704 rMark.SetMarkArea( aRange );
1705
1706 if( rMark.IsMarked() && !rMark.IsMultiMarked() )
1707 {
1709 bDone = true;
1710 }
1711 }
1712 }
1713 else if ( comphelper::getFromUnoTunnel<ScModelObj>( xInterface ) == this )
1714 {
1715 // render the whole document
1716 // -> no selection, all sheets
1717
1718 SCTAB nTabCount = pDocShell->GetDocument().GetTableCount();
1719 for (SCTAB nTab = 0; nTab < nTabCount; nTab++)
1720 rMark.SelectTable( nTab, true );
1722 bDone = true;
1723 }
1724 // other selection types aren't supported
1725 }
1726
1727 // restrict to selected sheets if a view is available
1728 uno::Reference<sheet::XSelectedSheetsSupplier> xSelectedSheets(xView, uno::UNO_QUERY);
1729 if (bSelectedSheetsOnly && pDocShell && xSelectedSheets.is())
1730 {
1731 const uno::Sequence<sal_Int32> aSelected = xSelectedSheets->getSelectedSheets();
1732 ScMarkData::MarkedTabsType aSelectedTabs;
1733 SCTAB nMaxTab = pDocShell->GetDocument().GetTableCount() -1;
1734 for (const auto& rSelected : aSelected)
1735 {
1736 SCTAB nSelected = static_cast<SCTAB>(rSelected);
1737 if (ValidTab(nSelected, nMaxTab))
1738 aSelectedTabs.insert(nSelected);
1739 }
1740 rMark.SetSelectedTabs(aSelectedTabs);
1741 }
1742
1743 ScPrintOptions aNewOptions;
1744 aNewOptions.SetSkipEmpty( bSuppressEmptyPages );
1745 aNewOptions.SetAllSheets( !bSelectedSheetsOnly );
1746 rStatus.SetOptions( aNewOptions );
1747
1748 // "PrintRange" enables (1) or disables (0) the "PageRange" edit
1749 if ( nPrintRange == 1 )
1750 rPagesStr = aPageRange;
1751 else
1752 rPagesStr.clear();
1753
1754 return bDone;
1755}
1756
1757sal_Int32 SAL_CALL ScModelObj::getRendererCount(const uno::Any& aSelection,
1758 const uno::Sequence<beans::PropertyValue>& rOptions)
1759{
1760 SolarMutexGuard aGuard;
1761 if (!pDocShell)
1762 {
1763 throw lang::DisposedException( OUString(),
1764 static_cast< sheet::XSpreadsheetDocument* >(this) );
1765 }
1766
1767 ScMarkData aMark(GetDocument()->GetSheetLimits());
1768 ScPrintSelectionStatus aStatus;
1769 OUString aPagesStr;
1770 bool bRenderToGraphic = false;
1771 if ( !FillRenderMarkData( aSelection, rOptions, aMark, aStatus, aPagesStr, bRenderToGraphic ) )
1772 return 0;
1773
1774 // The same ScPrintFuncCache object in pPrintFuncCache is used as long as
1775 // the same selection is used (aStatus) and the document isn't changed
1776 // (pPrintFuncCache is cleared in Notify handler)
1777
1778 if ( !pPrintFuncCache || !pPrintFuncCache->IsSameSelection( aStatus ) )
1779 {
1780 pPrintFuncCache.reset(new ScPrintFuncCache( pDocShell, aMark, aStatus ));
1781 }
1782 sal_Int32 nPages = pPrintFuncCache->GetPageCount();
1783
1784 m_pPrintState.reset();
1785 maValidPages.clear();
1786
1787 sal_Int32 nContent = 0;
1788 sal_Int32 nEOContent = 0;
1789 bool bSinglePageSheets = false;
1790 for ( const auto& rValue : rOptions)
1791 {
1792 if ( rValue.Name == "PrintRange" )
1793 {
1794 rValue.Value >>= nContent;
1795 }
1796 else if ( rValue.Name == "SinglePageSheets" )
1797 {
1798 rValue.Value >>= bSinglePageSheets;
1799 }
1800 else if ( rValue.Name == "EvenOdd" )
1801 {
1802 rValue.Value >>= nEOContent;
1803 }
1804 }
1805
1806 if (bSinglePageSheets)
1807 {
1809 }
1810
1811 bool bIsPrintEvenPages = (nEOContent != 1 && nContent == 0) || nContent != 0;
1812 bool bIsPrintOddPages = (nEOContent != 2 && nContent == 0) || nContent != 0;
1813
1814 for ( sal_Int32 nPage = 1; nPage <= nPages; nPage++ )
1815 {
1816 if ( (bIsPrintEvenPages && IsOnEvenPage( nPage )) || (bIsPrintOddPages && !IsOnEvenPage( nPage )) )
1817 maValidPages.push_back( nPage );
1818 }
1819
1820 sal_Int32 nSelectCount = static_cast<sal_Int32>( maValidPages.size() );
1821
1822 if ( nEOContent == 1 || nEOContent == 2 ) // even pages / odd pages
1823 return nSelectCount;
1824
1825 if ( !aPagesStr.isEmpty() )
1826 {
1827 StringRangeEnumerator aRangeEnum( aPagesStr, 0, nPages-1 );
1828 nSelectCount = aRangeEnum.size();
1829 }
1830 return (nSelectCount > 0) ? nSelectCount : 1;
1831}
1832
1833static sal_Int32 lcl_GetRendererNum( sal_Int32 nSelRenderer, std::u16string_view rPagesStr, sal_Int32 nTotalPages )
1834{
1835 if ( rPagesStr.empty() )
1836 return nSelRenderer;
1837
1838 StringRangeEnumerator aRangeEnum( rPagesStr, 0, nTotalPages-1 );
1839 StringRangeEnumerator::Iterator aIter = aRangeEnum.begin();
1840 StringRangeEnumerator::Iterator aEnd = aRangeEnum.end();
1841 for ( ; nSelRenderer > 0 && aIter != aEnd; --nSelRenderer )
1842 ++aIter;
1843
1844 return *aIter; // returns -1 if reached the end
1845}
1846
1847static bool lcl_renderSelectionToGraphic( bool bRenderToGraphic, const ScPrintSelectionStatus& rStatus )
1848{
1849 return bRenderToGraphic && rStatus.GetMode() == ScPrintSelectionMode::Range;
1850}
1851
1852uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 nSelRenderer,
1853 const uno::Any& aSelection, const uno::Sequence<beans::PropertyValue>& rOptions )
1854{
1855 SolarMutexGuard aGuard;
1856 if (!pDocShell)
1857 {
1858 throw lang::DisposedException( OUString(),
1859 static_cast< sheet::XSpreadsheetDocument* >(this) );
1860 }
1861
1863 ScPrintSelectionStatus aStatus;
1864 OUString aPagesStr;
1865 // #i115266# if FillRenderMarkData fails, keep nTotalPages at 0, but still handle getRenderer(0) below
1866 tools::Long nTotalPages = 0;
1867 bool bRenderToGraphic = false;
1868 bool bSinglePageSheets = false;
1869 if ( FillRenderMarkData( aSelection, rOptions, aMark, aStatus, aPagesStr, bRenderToGraphic ) )
1870 {
1871 if ( !pPrintFuncCache || !pPrintFuncCache->IsSameSelection( aStatus ) )
1872 {
1873 pPrintFuncCache.reset(new ScPrintFuncCache( pDocShell, aMark, aStatus ));
1874 }
1875 nTotalPages = pPrintFuncCache->GetPageCount();
1876 }
1877
1878 for ( const auto& rValue : rOptions)
1879 {
1880 if ( rValue.Name == "SinglePageSheets" )
1881 {
1882 rValue.Value >>= bSinglePageSheets;
1883 break;
1884 }
1885 }
1886
1887 if (bSinglePageSheets)
1888 nTotalPages = pDocShell->GetDocument().GetTableCount();
1889
1890 sal_Int32 nRenderer = lcl_GetRendererNum( nSelRenderer, aPagesStr, nTotalPages );
1891
1892 if ( nRenderer < 0 )
1893 {
1894 if ( nSelRenderer != 0 )
1895 throw lang::IllegalArgumentException();
1896
1897 // getRenderer(0) is used to query the settings, so it must always return something
1898
1899 awt::Size aPageSize;
1900 if (lcl_renderSelectionToGraphic( bRenderToGraphic, aStatus))
1901 {
1902 assert( aMark.IsMarked());
1903 const ScRange& aRange = aMark.GetMarkArea();
1905 aRange.aStart.Col(), aRange.aStart.Row(),
1906 aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab()));
1907 aPageSize.Width = aMMRect.GetWidth();
1908 aPageSize.Height = aMMRect.GetHeight();
1909 }
1910 else
1911 {
1912 SCTAB const nCurTab = 0;
1913 ScPrintFunc aDefaultFunc( pDocShell, pDocShell->GetPrinter(), nCurTab );
1914 Size aTwips = aDefaultFunc.GetPageSize();
1915 aPageSize.Width = convertTwipToMm100(aTwips.Width());
1916 aPageSize.Height = convertTwipToMm100(aTwips.Height());
1917 }
1918
1919 uno::Sequence<beans::PropertyValue> aSequence( comphelper::InitPropertySequence({
1920 { SC_UNONAME_PAGESIZE, uno::Any(aPageSize) }
1921 }));
1922
1923 if( ! pPrinterOptions )
1925 else
1926 pPrinterOptions->SetDefaults();
1927 pPrinterOptions->appendPrintUIOptions( aSequence );
1928 return aSequence;
1929
1930 }
1931
1932 // printer is used as device (just for page layout), draw view is not needed
1933
1934 SCTAB nTab;
1935 if (bSinglePageSheets)
1936 nTab = nSelRenderer;
1937 else if ( !maValidPages.empty() )
1938 nTab = pPrintFuncCache->GetTabForPage( maValidPages.at( nRenderer )-1 );
1939 else
1940 nTab = pPrintFuncCache->GetTabForPage( nRenderer );
1941
1942
1943 ScRange aRange;
1944 const ScRange* pSelRange = nullptr;
1945 if ( bSinglePageSheets )
1946 {
1947 SCCOL nStartCol;
1948 SCROW nStartRow;
1949 const ScDocument* pDocument = &pDocShell->GetDocument();
1950 pDocument->GetDataStart( nTab, nStartCol, nStartRow );
1951 SCCOL nEndCol;
1952 SCROW nEndRow;
1953 pDocument->GetPrintArea( nTab, nEndCol, nEndRow );
1954
1955 aRange.aStart = ScAddress(nStartCol, nStartRow, nTab);
1956 aRange.aEnd = ScAddress(nEndCol, nEndRow, nTab);
1957
1958 table::CellRangeAddress aRangeAddress( nTab,
1959 aRange.aStart.Col(), aRange.aStart.Row(),
1960 aRange.aEnd.Col(), aRange.aEnd.Row() );
1962 aRange.aStart.Col(), aRange.aStart.Row(),
1963 aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab()));
1964
1965 const awt::Size aPageSize(aMMRect.GetWidth(), aMMRect.GetHeight());
1966 const awt::Point aCalcPagePos(aMMRect.Left(), aMMRect.Top());
1967
1968 uno::Sequence<beans::PropertyValue> aSequence
1969 {
1971 // #i111158# all positions are relative to the whole page, including non-printable area
1974 comphelper::makePropertyValue(SC_UNONAME_CALCPAGESIZE, aPageSize), // TODO aPageSize too ?
1976 };
1977
1978 if( ! pPrinterOptions )
1980 else
1981 pPrinterOptions->SetDefaults();
1982 pPrinterOptions->appendPrintUIOptions( aSequence );
1983 return aSequence;
1984 }
1985 else if ( aMark.IsMarked() )
1986 {
1987 aRange = aMark.GetMarkArea();
1988 pSelRange = &aRange;
1989 }
1990
1991 awt::Size aPageSize;
1992 bool bWasCellRange = false;
1993 ScRange aCellRange;
1994 if (lcl_renderSelectionToGraphic( bRenderToGraphic, aStatus))
1995 {
1996 bWasCellRange = true;
1997 aCellRange = aRange;
1999 aRange.aStart.Col(), aRange.aStart.Row(),
2000 aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab()));
2001 aPageSize.Width = aMMRect.GetWidth();
2002 aPageSize.Height = aMMRect.GetHeight();
2003 }
2004 else
2005 {
2006 std::unique_ptr<ScPrintFunc, o3tl::default_delete<ScPrintFunc>> pPrintFunc;
2007 if (m_pPrintState && m_pPrintState->nPrintTab == nTab)
2008 pPrintFunc.reset(new ScPrintFunc(pDocShell, pDocShell->GetPrinter(), *m_pPrintState, &aStatus.GetOptions()));
2009 else
2010 pPrintFunc.reset(new ScPrintFunc(pDocShell, pDocShell->GetPrinter(), nTab,
2011 pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, &aStatus.GetOptions()));
2012 pPrintFunc->SetRenderFlag( true );
2013
2014 sal_Int32 nContent = 0;
2015 sal_Int32 nEOContent = 0;
2016 for ( const auto& rValue : rOptions)
2017 {
2018 if ( rValue.Name == "PrintRange" )
2019 {
2020 rValue.Value >>= nContent;
2021 }
2022 else if ( rValue.Name == "EvenOdd" )
2023 {
2024 rValue.Value >>= nEOContent;
2025 }
2026 }
2027
2028 MultiSelection aPage;
2029 aPage.SetTotalRange( Range(0,RANGE_MAX) );
2030
2031 bool bOddOrEven = (nContent == 0 && nEOContent == 1) || (nContent == 1 && nEOContent == 2); // even pages or odd pages
2032 // tdf#127682 when odd/even allow nRenderer of 0 even when maValidPages is empty
2033 // to allow PrinterController::abortJob to spool an empty page as part of
2034 // its abort procedure
2035 if (bOddOrEven && !maValidPages.empty())
2036 aPage.Select( maValidPages.at(nRenderer) );
2037 else
2038 aPage.Select( nRenderer+1 );
2039
2040 tools::Long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab );
2041 tools::Long nTabStart = pPrintFuncCache->GetTabStart( nTab );
2042
2043 (void)pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, false, nullptr );
2044
2045 bWasCellRange = pPrintFunc->GetLastSourceRange( aCellRange );
2046 Size aTwips = pPrintFunc->GetPageSize();
2047
2048 if (!m_pPrintState)
2049 {
2050 m_pPrintState.reset(new ScPrintState());
2051 pPrintFunc->GetPrintState(*m_pPrintState, true);
2052 }
2053
2054 aPageSize.Width = convertTwipToMm100(aTwips.Width());
2055 aPageSize.Height = convertTwipToMm100(aTwips.Height());
2056 }
2057
2058 tools::Long nPropCount = bWasCellRange ? 5 : 4;
2059 uno::Sequence<beans::PropertyValue> aSequence(nPropCount);
2060 beans::PropertyValue* pArray = aSequence.getArray();
2061 pArray[0].Name = SC_UNONAME_PAGESIZE;
2062 pArray[0].Value <<= aPageSize;
2063 // #i111158# all positions are relative to the whole page, including non-printable area
2064 pArray[1].Name = SC_UNONAME_INC_NP_AREA;
2065 pArray[1].Value <<= true;
2066 if ( bWasCellRange )
2067 {
2068 table::CellRangeAddress aRangeAddress( nTab,
2069 aCellRange.aStart.Col(), aCellRange.aStart.Row(),
2070 aCellRange.aEnd.Col(), aCellRange.aEnd.Row() );
2072 aCellRange.aStart.Col(), aCellRange.aStart.Row(),
2073 aCellRange.aEnd.Col(), aCellRange.aEnd.Row(), aCellRange.aStart.Tab()));
2074
2075 const awt::Size aCalcPageSize(aMMRect.GetWidth(), aMMRect.GetHeight());
2076 const awt::Point aCalcPagePos(aMMRect.Left(), aMMRect.Top());
2077
2078 pArray[2].Name = SC_UNONAME_SOURCERANGE;
2079 pArray[2].Value <<= aRangeAddress;
2080 pArray[3].Name = SC_UNONAME_CALCPAGESIZE;
2081 pArray[3].Value <<= aCalcPageSize;
2082 pArray[4].Name = SC_UNONAME_CALCPAGEPOS;
2083 pArray[4].Value <<= aCalcPagePos;
2084 }
2085
2086 if( ! pPrinterOptions )
2088 else
2089 pPrinterOptions->SetDefaults();
2090 pPrinterOptions->appendPrintUIOptions( aSequence );
2091 return aSequence;
2092}
2093
2094void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelection,
2095 const uno::Sequence<beans::PropertyValue>& rOptions )
2096{
2097 SolarMutexGuard aGuard;
2098 if (!pDocShell)
2099 {
2100 throw lang::DisposedException( OUString(),
2101 static_cast< sheet::XSpreadsheetDocument* >(this) );
2102 }
2103
2105 ScPrintSelectionStatus aStatus;
2106 OUString aPagesStr;
2107 bool bRenderToGraphic = false;
2108 bool bSinglePageSheets = false;
2109 if ( !FillRenderMarkData( aSelection, rOptions, aMark, aStatus, aPagesStr, bRenderToGraphic ) )
2110 throw lang::IllegalArgumentException();
2111
2112 if ( !pPrintFuncCache || !pPrintFuncCache->IsSameSelection( aStatus ) )
2113 {
2114 pPrintFuncCache.reset(new ScPrintFuncCache( pDocShell, aMark, aStatus ));
2115 }
2116 tools::Long nTotalPages = pPrintFuncCache->GetPageCount();
2117
2118 for ( const auto& rValue : rOptions)
2119 {
2120 if ( rValue.Name == "SinglePageSheets" )
2121 {
2122 rValue.Value >>= bSinglePageSheets;
2123 break;
2124 }
2125 }
2126
2127 if (bSinglePageSheets)
2128 nTotalPages = pDocShell->GetDocument().GetTableCount();
2129
2130 sal_Int32 nRenderer = lcl_GetRendererNum( nSelRenderer, aPagesStr, nTotalPages );
2131 if ( nRenderer < 0 )
2132 throw lang::IllegalArgumentException();
2133
2134 OutputDevice* pDev = lcl_GetRenderDevice( rOptions );
2135 if ( !pDev )
2136 throw lang::IllegalArgumentException();
2137
2138 ScDocument& rDoc = pDocShell->GetDocument();
2139
2140 ScRange aRange;
2141 const ScRange* pSelRange = nullptr;
2142 if ( bSinglePageSheets )
2143 {
2144 awt::Size aPageSize;
2145 SCCOL nStartCol;
2146 SCROW nStartRow;
2147 rDoc.GetDataStart( nSelRenderer, nStartCol, nStartRow );
2148 SCCOL nEndCol;
2149 SCROW nEndRow;
2150 rDoc.GetPrintArea( nSelRenderer, nEndCol, nEndRow );
2151
2152 aRange.aStart = ScAddress(nStartCol, nStartRow, nSelRenderer);
2153 aRange.aEnd = ScAddress(nEndCol, nEndRow, nSelRenderer);
2154
2156 aRange.aStart.Col(), aRange.aStart.Row(),
2157 aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab()));
2158
2159 aPageSize.Width = aMMRect.GetWidth();
2160 aPageSize.Height = aMMRect.GetHeight();
2161
2162 //Set visible tab
2163 SCTAB nVisTab = rDoc.GetVisibleTab();
2164 if (nVisTab != nSelRenderer)
2165 {
2166 nVisTab = nSelRenderer;
2167 rDoc.SetVisibleTab(nVisTab);
2168 }
2169
2170 pDocShell->DoDraw(pDev, Point(0,0), Size(aPageSize.Width, aPageSize.Height), JobSetup());
2171
2172 return;
2173 }
2174 else if ( aMark.IsMarked() )
2175 {
2176 aRange = aMark.GetMarkArea();
2177 pSelRange = &aRange;
2178 }
2179
2180 if (lcl_renderSelectionToGraphic( bRenderToGraphic, aStatus))
2181 {
2182 // Similar to as in and when calling ScTransferObj::PaintToDev()
2183
2184 tools::Rectangle aBound( Point(), pDev->GetOutputSize());
2185
2186 ScViewData aViewData(rDoc);
2187
2188 aViewData.SetTabNo( aRange.aStart.Tab() );
2189 aViewData.SetScreen( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() );
2190
2191 const double nPrintFactor = 1.0; /* XXX: currently (2017-08-28) is not evaluated */
2192 // The bMetaFile argument maybe could be
2193 // pDev->GetConnectMetaFile() != nullptr
2194 // but for some yet unknown reason does not draw cell content if true.
2195 ScPrintFunc::DrawToDev( rDoc, pDev, nPrintFactor, aBound, &aViewData, false /*bMetaFile*/ );
2196
2197 return;
2198 }
2199
2200 struct DrawViewKeeper
2201 {
2202 std::unique_ptr<FmFormView> mpDrawView;
2203 DrawViewKeeper() {}
2204 ~DrawViewKeeper()
2205 {
2206 if (mpDrawView)
2207 {
2208 mpDrawView->HideSdrPage();
2209 mpDrawView.reset();
2210 }
2211 }
2212 } aDrawViewKeeper;
2213
2214 SCTAB nTab;
2215 if ( !maValidPages.empty() )
2216 nTab = pPrintFuncCache->GetTabForPage( maValidPages.at( nRenderer )-1 );
2217 else
2218 nTab = pPrintFuncCache->GetTabForPage( nRenderer );
2219
2220 ScDrawLayer* pModel = rDoc.GetDrawLayer();
2221
2222 if( pModel )
2223 {
2224 aDrawViewKeeper.mpDrawView.reset( new FmFormView(
2225 *pModel,
2226 pDev) );
2227 aDrawViewKeeper.mpDrawView->ShowSdrPage(aDrawViewKeeper.mpDrawView->GetModel().GetPage(nTab));
2228 aDrawViewKeeper.mpDrawView->SetPrintPreview();
2229 }
2230
2231 // to increase performance, ScPrintState might be used here for subsequent
2232 // pages of the same sheet
2233
2234
2235 std::unique_ptr<ScPrintFunc, o3tl::default_delete<ScPrintFunc>> pPrintFunc;
2236 if (m_pPrintState && m_pPrintState->nPrintTab == nTab
2237 && ! pSelRange) // tdf#120161 use selection to set required printed area
2238 pPrintFunc.reset(new ScPrintFunc(pDev, pDocShell, *m_pPrintState, &aStatus.GetOptions()));
2239 else
2240 pPrintFunc.reset(new ScPrintFunc(pDev, pDocShell, nTab, pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, &aStatus.GetOptions()));
2241
2242 pPrintFunc->SetDrawView( aDrawViewKeeper.mpDrawView.get() );
2243 pPrintFunc->SetRenderFlag( true );
2245 pPrintFunc->SetExclusivelyDrawOleAndDrawObjects();
2246
2247 sal_Int32 nContent = 0;
2248 sal_Int32 nEOContent = 0;
2249 for ( const auto& rValue : rOptions)
2250 {
2251 if ( rValue.Name == "PrintRange" )
2252 {
2253 rValue.Value >>= nContent;
2254 }
2255 else if ( rValue.Name == "EvenOdd" )
2256 {
2257 rValue.Value >>= nEOContent;
2258 }
2259 }
2260
2261 MultiSelection aPage;
2262 aPage.SetTotalRange( Range(0,RANGE_MAX) );
2263
2264 bool bOddOrEven = (nContent == 0 && nEOContent == 1) || (nContent == 0 && nEOContent == 2); // even pages or odd pages
2265 // tdf#127682 when odd/even allow nRenderer of 0 even when maValidPages is empty
2266 // to allow PrinterController::abortJob to spool an empty page as part of
2267 // its abort procedure
2268 if (bOddOrEven && !maValidPages.empty())
2269 aPage.Select( maValidPages.at( nRenderer ) );
2270 else
2271 aPage.Select( nRenderer+1 );
2272
2273 tools::Long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab );
2274 tools::Long nTabStart = pPrintFuncCache->GetTabStart( nTab );
2275
2276 vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >(pDev->GetExtOutDevData() );
2277 if ( nRenderer == nTabStart )
2278 {
2279 if (pPDFData)
2280 {
2281 css::lang::Locale const docLocale(Application::GetSettings().GetLanguageTag().getLocale());
2282 pPDFData->SetDocumentLocale(docLocale);
2283 }
2284
2285 // first page of a sheet: add outline item for the sheet name
2286
2287 if ( pPDFData && pPDFData->GetIsExportBookmarks() )
2288 {
2289 // the sheet starts at the top of the page
2290 tools::Rectangle aArea( pDev->PixelToLogic( tools::Rectangle( 0,0,0,0 ) ) );
2291 sal_Int32 nDestID = pPDFData->CreateDest( aArea );
2292 OUString aTabName;
2293 rDoc.GetName( nTab, aTabName );
2294 // top-level
2295 pPDFData->CreateOutlineItem( -1/*nParent*/, aTabName, nDestID );
2296 }
2297 // #i56629# add the named destination stuff
2298 if( pPDFData && pPDFData->GetIsExportNamedDestinations() )
2299 {
2300 tools::Rectangle aArea( pDev->PixelToLogic( tools::Rectangle( 0,0,0,0 ) ) );
2301 OUString aTabName;
2302 rDoc.GetName( nTab, aTabName );
2303 //need the PDF page number here
2304 pPDFData->CreateNamedDest( aTabName, aArea );
2305 }
2306 }
2307
2308 (void)pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, true, nullptr );
2309
2310 if (!m_pPrintState)
2311 {
2312 m_pPrintState.reset(new ScPrintState());
2313 pPrintFunc->GetPrintState(*m_pPrintState, true);
2314 }
2315
2316 // resolve the hyperlinks for PDF export
2317
2318 if ( !pPDFData || pPDFData->GetBookmarks().empty() )
2319 return;
2320
2321 // iterate over the hyperlinks that were output for this page
2322
2323 std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFData->GetBookmarks();
2324 for ( const auto& rBookmark : rBookmarks )
2325 {
2326 OUString aBookmark = rBookmark.aBookmark;
2327 if ( aBookmark.toChar() == '#' )
2328 {
2329 // try to resolve internal link
2330
2331 OUString aTarget( aBookmark.copy( 1 ) );
2332
2333 ScRange aTargetRange;
2334 tools::Rectangle aTargetRect; // 1/100th mm
2335 bool bIsSheet = false;
2336 bool bValid = lcl_ParseTarget( aTarget, aTargetRange, aTargetRect, bIsSheet, rDoc, nTab );
2337
2338 if ( bValid )
2339 {
2340 sal_Int32 nPage = -1;
2341 tools::Rectangle aArea;
2342 if ( bIsSheet )
2343 {
2344 // Get first page for sheet (if nothing from that sheet is printed,
2345 // this page can show a different sheet)
2346 nPage = pPrintFuncCache->GetTabStart( aTargetRange.aStart.Tab() );
2347 aArea = pDev->PixelToLogic( tools::Rectangle( 0,0,0,0 ) );
2348 }
2349 else
2350 {
2351 pPrintFuncCache->InitLocations( aMark, pDev ); // does nothing if already initialized
2352
2353 ScPrintPageLocation aLocation;
2354 if ( pPrintFuncCache->FindLocation( aTargetRange.aStart, aLocation ) )
2355 {
2356 nPage = aLocation.nPage;
2357
2358 // get the rectangle of the page's cell range in 1/100th mm
2359 ScRange aLocRange = aLocation.aCellRange;
2360 tools::Rectangle aLocationMM = rDoc.GetMMRect(
2361 aLocRange.aStart.Col(), aLocRange.aStart.Row(),
2362 aLocRange.aEnd.Col(), aLocRange.aEnd.Row(),
2363 aLocRange.aStart.Tab() );
2364 tools::Rectangle aLocationPixel = aLocation.aRectangle;
2365
2366 // Scale and move the target rectangle from aLocationMM to aLocationPixel,
2367 // to get the target rectangle in pixels.
2368 assert(aLocationPixel.GetWidth() != 0 && aLocationPixel.GetHeight() != 0);
2369
2370 Fraction aScaleX( aLocationPixel.GetWidth(), aLocationMM.GetWidth() );
2371 Fraction aScaleY( aLocationPixel.GetHeight(), aLocationMM.GetHeight() );
2372
2373 tools::Long nX1 = aLocationPixel.Left() + static_cast<tools::Long>( Fraction( aTargetRect.Left() - aLocationMM.Left(), 1 ) * aScaleX );
2374 tools::Long nX2 = aLocationPixel.Left() + static_cast<tools::Long>( Fraction( aTargetRect.Right() - aLocationMM.Left(), 1 ) * aScaleX );
2375 tools::Long nY1 = aLocationPixel.Top() + static_cast<tools::Long>( Fraction( aTargetRect.Top() - aLocationMM.Top(), 1 ) * aScaleY );
2376 tools::Long nY2 = aLocationPixel.Top() + static_cast<tools::Long>( Fraction( aTargetRect.Bottom() - aLocationMM.Top(), 1 ) * aScaleY );
2377
2378 if ( nX1 > aLocationPixel.Right() ) nX1 = aLocationPixel.Right();
2379 if ( nX2 > aLocationPixel.Right() ) nX2 = aLocationPixel.Right();
2380 if ( nY1 > aLocationPixel.Bottom() ) nY1 = aLocationPixel.Bottom();
2381 if ( nY2 > aLocationPixel.Bottom() ) nY2 = aLocationPixel.Bottom();
2382
2383 // The link target area is interpreted using the device's MapMode at
2384 // the time of the CreateDest call, so PixelToLogic can be used here,
2385 // regardless of the MapMode that is actually selected.
2386 aArea = pDev->PixelToLogic( tools::Rectangle( nX1, nY1, nX2, nY2 ) );
2387 }
2388 }
2389
2390 if ( nPage >= 0 )
2391 pPDFData->SetLinkDest( rBookmark.nLinkId, pPDFData->CreateDest( aArea, nPage ) );
2392 }
2393 }
2394 else
2395 {
2396 // external link, use as-is
2397 pPDFData->SetLinkURL( rBookmark.nLinkId, aBookmark );
2398 }
2399 }
2400 rBookmarks.clear();
2401}
2402
2403// XLinkTargetSupplier
2404
2405uno::Reference<container::XNameAccess> SAL_CALL ScModelObj::getLinks()
2406{
2407 SolarMutexGuard aGuard;
2408 if (pDocShell)
2409 return new ScLinkTargetTypesObj(pDocShell);
2410 return nullptr;
2411}
2412
2413// XActionLockable
2414
2416{
2417 SolarMutexGuard aGuard;
2418 bool bLocked = false;
2419 if (pDocShell)
2420 bLocked = ( pDocShell->GetLockCount() != 0 );
2421 return bLocked;
2422}
2423
2425{
2426 SolarMutexGuard aGuard;
2427 if (pDocShell)
2429}
2430
2432{
2433 SolarMutexGuard aGuard;
2434 if (pDocShell)
2436}
2437
2438void SAL_CALL ScModelObj::setActionLocks( sal_Int16 nLock )
2439{
2440 SolarMutexGuard aGuard;
2441 if (pDocShell)
2442 pDocShell->SetLockCount(nLock);
2443}
2444
2446{
2447 SolarMutexGuard aGuard;
2448 sal_uInt16 nRet = 0;
2449 if (pDocShell)
2450 {
2451 nRet = pDocShell->GetLockCount();
2453 }
2454 return nRet;
2455}
2456
2458{
2459 SolarMutexGuard aGuard;
2461 if (pDocShell)
2463}
2464
2466{
2467 SolarMutexGuard aGuard;
2469 {
2471 if (pDocShell)
2473 }
2474}
2475
2476// XCalculate
2477
2479{
2480 SolarMutexGuard aGuard;
2481 if (pDocShell)
2482 {
2483 comphelper::ProfileZone aZone("calculate");
2484 pDocShell->DoRecalc(true);
2485 }
2486 else
2487 {
2488 OSL_FAIL("no DocShell");
2489 }
2490}
2491
2493{
2494 SolarMutexGuard aGuard;
2495 if (pDocShell)
2496 {
2497 comphelper::ProfileZone aZone("calculateAll");
2499 }
2500 else
2501 {
2502 OSL_FAIL("no DocShell");
2503 }
2504}
2505
2507{
2508 SolarMutexGuard aGuard;
2509 if (pDocShell)
2510 return pDocShell->GetDocument().GetAutoCalc();
2511
2512 OSL_FAIL("no DocShell");
2513 return false;
2514}
2515
2517{
2518 bool bEnabled(bEnabledIn);
2519 SolarMutexGuard aGuard;
2520 if (pDocShell)
2521 {
2522 ScDocument& rDoc = pDocShell->GetDocument();
2523 if ( rDoc.GetAutoCalc() != bEnabled )
2524 {
2525 rDoc.SetAutoCalc( bEnabled );
2527 }
2528 }
2529 else
2530 {
2531 OSL_FAIL("no DocShell");
2532 }
2533}
2534
2535// XProtectable
2536
2537void SAL_CALL ScModelObj::protect( const OUString& aPassword )
2538{
2539 SolarMutexGuard aGuard;
2540 // #i108245# if already protected, don't change anything
2542 {
2543 pDocShell->GetDocFunc().Protect( TABLEID_DOC, aPassword );
2544 }
2545}
2546
2547void SAL_CALL ScModelObj::unprotect( const OUString& aPassword )
2548{
2549 SolarMutexGuard aGuard;
2550 if (pDocShell)
2551 {
2552 bool bDone = pDocShell->GetDocFunc().Unprotect( TABLEID_DOC, aPassword, true );
2553 if (!bDone)
2554 throw lang::IllegalArgumentException();
2555 }
2556}
2557
2559{
2560 SolarMutexGuard aGuard;
2561 if (pDocShell)
2563
2564 OSL_FAIL("no DocShell");
2565 return false;
2566}
2567
2568// XDrawPagesSupplier
2569
2570uno::Reference<drawing::XDrawPages> SAL_CALL ScModelObj::getDrawPages()
2571{
2572 SolarMutexGuard aGuard;
2573 if (pDocShell)
2574 return new ScDrawPagesObj(pDocShell);
2575
2576 OSL_FAIL("no DocShell");
2577 return nullptr;
2578}
2579
2580// XGoalSeek
2581
2582sheet::GoalResult SAL_CALL ScModelObj::seekGoal(
2583 const table::CellAddress& aFormulaPosition,
2584 const table::CellAddress& aVariablePosition,
2585 const OUString& aGoalValue )
2586{
2587 SolarMutexGuard aGuard;
2588 sheet::GoalResult aResult;
2589 aResult.Divergence = DBL_MAX; // not found
2590 if (pDocShell)
2591 {
2593 ScDocument& rDoc = pDocShell->GetDocument();
2594 double fValue = 0.0;
2595 bool bFound = rDoc.Solver(
2596 static_cast<SCCOL>(aFormulaPosition.Column), static_cast<SCROW>(aFormulaPosition.Row), aFormulaPosition.Sheet,
2597 static_cast<SCCOL>(aVariablePosition.Column), static_cast<SCROW>(aVariablePosition.Row), aVariablePosition.Sheet,
2598 aGoalValue, fValue );
2599 aResult.Result = fValue;
2600 if (bFound)
2601 aResult.Divergence = 0.0;
2602 }
2603 return aResult;
2604}
2605
2606// XConsolidatable
2607
2608uno::Reference<sheet::XConsolidationDescriptor> SAL_CALL ScModelObj::createConsolidationDescriptor(
2609 sal_Bool bEmpty )
2610{
2611 SolarMutexGuard aGuard;
2613 if ( pDocShell && !bEmpty )
2614 {
2615 ScDocument& rDoc = pDocShell->GetDocument();
2616 const ScConsolidateParam* pParam = rDoc.GetConsolidateDlgData();
2617 if (pParam)
2618 pNew->SetParam( *pParam );
2619 }
2620 return pNew;
2621}
2622
2624 const uno::Reference<sheet::XConsolidationDescriptor>& xDescriptor )
2625{
2626 SolarMutexGuard aGuard;
2627 // in theory, this could also be a different object, so use only
2628 // public XConsolidationDescriptor interface to copy the data into
2629 // ScConsolidationDescriptor object
2631
2633 xImpl->setFunction( xDescriptor->getFunction() );
2634 xImpl->setSources( xDescriptor->getSources() );
2635 xImpl->setStartOutputPosition( xDescriptor->getStartOutputPosition() );
2636 xImpl->setUseColumnHeaders( xDescriptor->getUseColumnHeaders() );
2637 xImpl->setUseRowHeaders( xDescriptor->getUseRowHeaders() );
2638 xImpl->setInsertLinks( xDescriptor->getInsertLinks() );
2639
2640 if (pDocShell)
2641 {
2642 const ScConsolidateParam& rParam = xImpl->GetParam();
2643 pDocShell->DoConsolidate( rParam );
2644 pDocShell->GetDocument().SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam>(new ScConsolidateParam(rParam)) );
2645 }
2646}
2647
2648// XDocumentAuditing
2649
2651{
2652 SolarMutexGuard aGuard;
2653 if (pDocShell)
2655}
2656
2657// XViewDataSupplier
2658uno::Reference< container::XIndexAccess > SAL_CALL ScModelObj::getViewData( )
2659{
2660 uno::Reference < container::XIndexAccess > xRet( SfxBaseModel::getViewData() );
2661
2662 if( !xRet.is() )
2663 {
2664 SolarMutexGuard aGuard;
2665 if (pDocShell && pDocShell->GetCreateMode() == SfxObjectCreateMode::EMBEDDED)
2666 {
2668 xRet = xCont;
2669
2670 OUString sName;
2672 SCCOL nPosLeft = pDocShell->GetDocument().GetPosLeft();
2673 SCROW nPosTop = pDocShell->GetDocument().GetPosTop();
2674 uno::Sequence< beans::PropertyValue > aSeq{
2678 };
2679 xCont->insertByIndex( 0, uno::Any( aSeq ) );
2680 }
2681 }
2682
2683 return xRet;
2684}
2685
2686// XPropertySet (Doc-Options)
2688
2689uno::Reference<beans::XPropertySetInfo> SAL_CALL ScModelObj::getPropertySetInfo()
2690{
2691 SolarMutexGuard aGuard;
2692 static uno::Reference<beans::XPropertySetInfo> aRef(
2694 return aRef;
2695}
2696
2698 const OUString& aPropertyName, const uno::Any& aValue )
2699{
2700 SolarMutexGuard aGuard;
2701
2702 if (!pDocShell)
2703 return;
2704
2705 ScDocument& rDoc = pDocShell->GetDocument();
2706 const ScDocOptions& rOldOpt = rDoc.GetDocOptions();
2707 ScDocOptions aNewOpt = rOldOpt;
2708 // Don't recalculate while loading XML, when the formula text is stored
2709 // Recalculation after loading is handled separately.
2710 bool bHardRecalc = !rDoc.IsImportingXML();
2711
2712 bool bOpt = ScDocOptionsHelper::setPropertyValue( aNewOpt, aPropSet.getPropertyMap(), aPropertyName, aValue );
2713 if (bOpt)
2714 {
2715 // done...
2716 if ( aPropertyName == SC_UNO_IGNORECASE ||
2717 aPropertyName == SC_UNONAME_REGEXP ||
2718 aPropertyName == SC_UNONAME_WILDCARDS ||
2719 aPropertyName == SC_UNO_LOOKUPLABELS )
2720 bHardRecalc = false;
2721 }
2722 else if ( aPropertyName == SC_UNONAME_CLOCAL )
2723 {
2724 lang::Locale aLocale;
2725 if ( aValue >>= aLocale )
2726 {
2727 LanguageType eLatin, eCjk, eCtl;
2728 rDoc.GetLanguage( eLatin, eCjk, eCtl );
2729 eLatin = ScUnoConversion::GetLanguage(aLocale);
2730 rDoc.SetLanguage( eLatin, eCjk, eCtl );
2731 }
2732 }
2733 else if ( aPropertyName == SC_UNO_CODENAME )
2734 {
2735 OUString sCodeName;
2736 if ( aValue >>= sCodeName )
2737 rDoc.SetCodeName( sCodeName );
2738 }
2739 else if ( aPropertyName == SC_UNO_CJK_CLOCAL )
2740 {
2741 lang::Locale aLocale;
2742 if ( aValue >>= aLocale )
2743 {
2744 LanguageType eLatin, eCjk, eCtl;
2745 rDoc.GetLanguage( eLatin, eCjk, eCtl );
2746 eCjk = ScUnoConversion::GetLanguage(aLocale);
2747 rDoc.SetLanguage( eLatin, eCjk, eCtl );
2748 }
2749 }
2750 else if ( aPropertyName == SC_UNO_CTL_CLOCAL )
2751 {
2752 lang::Locale aLocale;
2753 if ( aValue >>= aLocale )
2754 {
2755 LanguageType eLatin, eCjk, eCtl;
2756 rDoc.GetLanguage( eLatin, eCjk, eCtl );
2757 eCtl = ScUnoConversion::GetLanguage(aLocale);
2758 rDoc.SetLanguage( eLatin, eCjk, eCtl );
2759 }
2760 }
2761 else if ( aPropertyName == SC_UNO_APPLYFMDES )
2762 {
2763 // model is created if not there
2764 ScDrawLayer* pModel = pDocShell->MakeDrawLayer();
2766
2767 SfxBindings* pBindings = pDocShell->GetViewBindings();
2768 if (pBindings)
2769 pBindings->Invalidate( SID_FM_OPEN_READONLY );
2770 }
2771 else if ( aPropertyName == SC_UNO_AUTOCONTFOC )
2772 {
2773 // model is created if not there
2774 ScDrawLayer* pModel = pDocShell->MakeDrawLayer();
2776
2777 SfxBindings* pBindings = pDocShell->GetViewBindings();
2778 if (pBindings)
2779 pBindings->Invalidate( SID_FM_AUTOCONTROLFOCUS );
2780 }
2781 else if ( aPropertyName == SC_UNO_ISLOADED )
2782 {
2784 }
2785 else if ( aPropertyName == SC_UNO_ISUNDOENABLED )
2786 {
2787 bool bUndoEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2788 rDoc.EnableUndo( bUndoEnabled );
2790 bUndoEnabled
2791 ? officecfg::Office::Common::Undo::Steps::get() : 0);
2792 }
2793 else if ( aPropertyName == SC_UNO_RECORDCHANGES )
2794 {
2795 bool bRecordChangesEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2796
2797 bool bChangeAllowed = true;
2798 if (!bRecordChangesEnabled)
2799 bChangeAllowed = !pDocShell->HasChangeRecordProtection();
2800
2801 if (bChangeAllowed)
2802 pDocShell->SetChangeRecording(bRecordChangesEnabled);
2803 }
2804 else if ( aPropertyName == SC_UNO_ISADJUSTHEIGHTENABLED )
2805 {
2807 rDoc.UnlockAdjustHeight();
2808 else
2809 rDoc.LockAdjustHeight();
2810 }
2811 else if ( aPropertyName == SC_UNO_ISEXECUTELINKENABLED )
2812 {
2814 }
2815 else if ( aPropertyName == SC_UNO_ISCHANGEREADONLYENABLED )
2816 {
2818 }
2819 else if ( aPropertyName == "BuildId" )
2820 {
2821 aValue >>= maBuildId;
2822 }
2823 else if ( aPropertyName == "SavedObject" ) // set from chart after saving
2824 {
2825 OUString aObjName;
2826 aValue >>= aObjName;
2827 if ( !aObjName.isEmpty() )
2828 rDoc.RestoreChartListener( aObjName );
2829 }
2830 else if ( aPropertyName == SC_UNO_INTEROPGRABBAG )
2831 {
2832 setGrabBagItem(aValue);
2833 }
2834
2835 if ( aNewOpt != rOldOpt )
2836 {
2837 rDoc.SetDocOptions( aNewOpt );
2839 if ( bHardRecalc )
2842 }
2843}
2844
2845uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
2846{
2847 SolarMutexGuard aGuard;
2848 uno::Any aRet;
2849
2850 if (pDocShell)
2851 {
2852 ScDocument& rDoc = pDocShell->GetDocument();
2853 const ScDocOptions& rOpt = rDoc.GetDocOptions();
2854 aRet = ScDocOptionsHelper::getPropertyValue( rOpt, aPropSet.getPropertyMap(), aPropertyName );
2855 if ( aRet.hasValue() )
2856 {
2857 // done...
2858 }
2859 else if ( aPropertyName == SC_UNONAME_CLOCAL )
2860 {
2861 LanguageType eLatin, eCjk, eCtl;
2862 rDoc.GetLanguage( eLatin, eCjk, eCtl );
2863
2864 lang::Locale aLocale;
2865 ScUnoConversion::FillLocale( aLocale, eLatin );
2866 aRet <<= aLocale;
2867 }
2868 else if ( aPropertyName == SC_UNO_CODENAME )
2869 {
2870 aRet <<= rDoc.GetCodeName();
2871 }
2872
2873 else if ( aPropertyName == SC_UNO_CJK_CLOCAL )
2874 {
2875 LanguageType eLatin, eCjk, eCtl;
2876 rDoc.GetLanguage( eLatin, eCjk, eCtl );
2877
2878 lang::Locale aLocale;
2879 ScUnoConversion::FillLocale( aLocale, eCjk );
2880 aRet <<= aLocale;
2881 }
2882 else if ( aPropertyName == SC_UNO_CTL_CLOCAL )
2883 {
2884 LanguageType eLatin, eCjk, eCtl;
2885 rDoc.GetLanguage( eLatin, eCjk, eCtl );
2886
2887 lang::Locale aLocale;
2888 ScUnoConversion::FillLocale( aLocale, eCtl );
2889 aRet <<= aLocale;
2890 }
2891 else if ( aPropertyName == SC_UNO_NAMEDRANGES )
2892 {
2893 aRet <<= uno::Reference<sheet::XNamedRanges>(new ScGlobalNamedRangesObj( pDocShell ));
2894 }
2895 else if ( aPropertyName == SC_UNO_DATABASERNG )
2896 {
2897 aRet <<= uno::Reference<sheet::XDatabaseRanges>(new ScDatabaseRangesObj( pDocShell ));
2898 }
2899 else if ( aPropertyName == SC_UNO_UNNAMEDDBRNG )
2900 {
2901 aRet <<= uno::Reference<sheet::XUnnamedDatabaseRanges>(new ScUnnamedDatabaseRangesObj(pDocShell));
2902 }
2903 else if ( aPropertyName == SC_UNO_COLLABELRNG )
2904 {
2905 aRet <<= uno::Reference<sheet::XLabelRanges>(new ScLabelRangesObj( pDocShell, true ));
2906 }
2907 else if ( aPropertyName == SC_UNO_ROWLABELRNG )
2908 {
2909 aRet <<= uno::Reference<sheet::XLabelRanges>(new ScLabelRangesObj( pDocShell, false ));
2910 }
2911 else if ( aPropertyName == SC_UNO_AREALINKS )
2912 {
2913 aRet <<= uno::Reference<sheet::XAreaLinks>(new ScAreaLinksObj( pDocShell ));
2914 }
2915 else if ( aPropertyName == SC_UNO_DDELINKS )
2916 {
2917 aRet <<= uno::Reference<container::XNameAccess>(new ScDDELinksObj( pDocShell ));
2918 }
2919 else if ( aPropertyName == SC_UNO_EXTERNALDOCLINKS )
2920 {
2921 aRet <<= uno::Reference<sheet::XExternalDocLinks>(new ScExternalDocLinksObj(pDocShell));
2922 }
2923 else if ( aPropertyName == SC_UNO_SHEETLINKS )
2924 {
2925 aRet <<= uno::Reference<container::XNameAccess>(new ScSheetLinksObj( pDocShell ));
2926 }
2927 else if ( aPropertyName == SC_UNO_APPLYFMDES )
2928 {
2929 // default for no model is TRUE
2930 ScDrawLayer* pModel = rDoc.GetDrawLayer();
2931 bool bOpenInDesign = pModel == nullptr || pModel->GetOpenInDesignMode();
2932 aRet <<= bOpenInDesign;
2933 }
2934 else if ( aPropertyName == SC_UNO_AUTOCONTFOC )
2935 {
2936 // default for no model is FALSE
2937 ScDrawLayer* pModel = rDoc.GetDrawLayer();
2938 bool bAutoControlFocus = pModel && pModel->GetAutoControlFocus();
2939 aRet <<= bAutoControlFocus;
2940 }
2941 else if ( aPropertyName == SC_UNO_FORBIDDEN )
2942 {
2943 aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
2944 }
2945 else if ( aPropertyName == SC_UNO_HASDRAWPAGES )
2946 {
2947 aRet <<= (pDocShell->GetDocument().GetDrawLayer() != nullptr);
2948 }
2949 else if ( aPropertyName == SC_UNO_BASICLIBRARIES )
2950 {
2951 aRet <<= pDocShell->GetBasicContainer();
2952 }
2953 else if ( aPropertyName == SC_UNO_DIALOGLIBRARIES )
2954 {
2955 aRet <<= pDocShell->GetDialogContainer();
2956 }
2957 else if ( aPropertyName == SC_UNO_VBAGLOBNAME )
2958 {
2959 /* #i111553# This property provides the name of the constant that
2960 will be used to store this model in the global Basic manager.
2961 That constant will be equivalent to 'ThisComponent' but for
2962 each application, so e.g. a 'ThisExcelDoc' and a 'ThisWordDoc'
2963 constant can co-exist, as required by VBA. */
2964 aRet <<= OUString( "ThisExcelDoc" );
2965 }
2966 else if ( aPropertyName == SC_UNO_RUNTIMEUID )
2967 {
2968 aRet <<= getRuntimeUID();
2969 }
2970 else if ( aPropertyName == SC_UNO_HASVALIDSIGNATURES )
2971 {
2972 aRet <<= hasValidSignatures();
2973 }
2974 else if ( aPropertyName == SC_UNO_ISLOADED )
2975 {
2976 aRet <<= !pDocShell->IsEmpty();
2977 }
2978 else if ( aPropertyName == SC_UNO_ISUNDOENABLED )
2979 {
2980 aRet <<= rDoc.IsUndoEnabled();
2981 }
2982 else if ( aPropertyName == SC_UNO_RECORDCHANGES )
2983 {
2984 aRet <<= pDocShell->IsChangeRecording();
2985 }
2986 else if ( aPropertyName == SC_UNO_ISRECORDCHANGESPROTECTED )
2987 {
2989 }
2990 else if ( aPropertyName == SC_UNO_ISADJUSTHEIGHTENABLED )
2991 {
2992 aRet <<= !( rDoc.IsAdjustHeightLocked() );
2993 }
2994 else if ( aPropertyName == SC_UNO_ISEXECUTELINKENABLED )
2995 {
2996 aRet <<= rDoc.IsExecuteLinkEnabled();
2997 }
2998 else if ( aPropertyName == SC_UNO_ISCHANGEREADONLYENABLED )
2999 {
3000 aRet <<= rDoc.IsChangeReadOnlyEnabled();
3001 }
3002 else if ( aPropertyName == SC_UNO_REFERENCEDEVICE )
3003 {
3005 pXDev->SetOutputDevice( rDoc.GetRefDevice() );
3006 aRet <<= uno::Reference< awt::XDevice >( pXDev );
3007 }
3008 else if ( aPropertyName == "BuildId" )
3009 {
3010 aRet <<= maBuildId;
3011 }
3012 else if ( aPropertyName == "InternalDocument" )
3013 {
3014 aRet <<= (pDocShell->GetCreateMode() == SfxObjectCreateMode::INTERNAL);
3015 }
3016 else if ( aPropertyName == SC_UNO_INTEROPGRABBAG )
3017 {
3018 getGrabBagItem(aRet);
3019 }
3020 }
3021
3022 return aRet;
3023}
3024
3026
3027// XMultiServiceFactory
3028
3029css::uno::Reference<css::uno::XInterface> ScModelObj::create(
3030 OUString const & aServiceSpecifier,
3031 css::uno::Sequence<css::uno::Any> const * arguments)
3032{
3033 using ServiceType = ScServiceProvider::Type;
3034
3035 uno::Reference<uno::XInterface> xRet;
3036 ServiceType nType = ScServiceProvider::GetProviderType(aServiceSpecifier);
3037 if ( nType != ServiceType::INVALID )
3038 {
3039 // drawing layer tables must be kept as long as the model is alive
3040 // return stored instance if already set
3041 switch ( nType )
3042 {
3043 case ServiceType::GRADTAB: xRet.set(xDrawGradTab); break;
3044 case ServiceType::HATCHTAB: xRet.set(xDrawHatchTab); break;
3045 case ServiceType::BITMAPTAB: xRet.set(xDrawBitmapTab); break;
3046 case ServiceType::TRGRADTAB: xRet.set(xDrawTrGradTab); break;
3047 case ServiceType::MARKERTAB: xRet.set(xDrawMarkerTab); break;
3048 case ServiceType::DASHTAB: xRet.set(xDrawDashTab); break;
3049 case ServiceType::CHDATAPROV: xRet.set(xChartDataProv); break;
3050 case ServiceType::VBAOBJECTPROVIDER: xRet.set(xObjProvider); break;
3051 default: break;
3052 }
3053
3054 // #i64497# If a chart is in a temporary document during clipboard paste,
3055 // there should be no data provider, so that own data is used
3056 bool bCreate =
3057 ( nType != ServiceType::CHDATAPROV ||
3058 ( pDocShell->GetCreateMode() != SfxObjectCreateMode::INTERNAL ));
3059 // this should never happen, i.e. the temporary document should never be
3060 // loaded, because this unlinks the data
3061 assert(bCreate);
3062
3063 if ( !xRet.is() && bCreate )
3064 {
3065 xRet.set(ScServiceProvider::MakeInstance( nType, pDocShell ));
3066
3067 // store created instance
3068 switch ( nType )
3069 {
3070 case ServiceType::GRADTAB: xDrawGradTab.set(xRet); break;
3071 case ServiceType::HATCHTAB: xDrawHatchTab.set(xRet); break;
3072 case ServiceType::BITMAPTAB: xDrawBitmapTab.set(xRet); break;
3073 case ServiceType::TRGRADTAB: xDrawTrGradTab.set(xRet); break;
3074 case ServiceType::MARKERTAB: xDrawMarkerTab.set(xRet); break;
3075 case ServiceType::DASHTAB: xDrawDashTab.set(xRet); break;
3076 case ServiceType::CHDATAPROV: xChartDataProv.set(xRet); break;
3077 case ServiceType::VBAOBJECTPROVIDER: xObjProvider.set(xRet); break;
3078 default: break;
3079 }
3080 }
3081 }
3082 else
3083 {
3084 // we offload everything we don't know to SvxFmMSFactory,
3085 // it'll throw exception if this isn't okay ...
3086
3087 try
3088 {
3089 xRet = arguments == nullptr
3090 ? SvxFmMSFactory::createInstance(aServiceSpecifier)
3092 aServiceSpecifier, *arguments);
3093 // extra block to force deletion of the temporary before ScShapeObj ctor (setDelegator)
3094 }
3095 catch ( lang::ServiceNotRegisteredException & )
3096 {
3097 }
3098
3099 // if the drawing factory created a shape, a ScShapeObj has to be used
3100 // to support own properties like ImageMap:
3101
3102 uno::Reference<drawing::XShape> xShape( xRet, uno::UNO_QUERY );
3103 if ( xShape.is() )
3104 {
3105 xRet.clear(); // for aggregation, xShape must be the object's only ref
3106 new ScShapeObj( xShape ); // aggregates object and modifies xShape
3107 xRet.set(xShape);
3108 }
3109 }
3110 return xRet;
3111}
3112
3113uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstance(
3114 const OUString& aServiceSpecifier )
3115{
3116 SolarMutexGuard aGuard;
3117 return create(aServiceSpecifier, nullptr);
3118}
3119
3120uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstanceWithArguments(
3121 const OUString& ServiceSpecifier,
3122 const uno::Sequence<uno::Any>& aArgs )
3123{
3125
3126 SolarMutexGuard aGuard;
3127 uno::Reference<uno::XInterface> xInt(create(ServiceSpecifier, &aArgs));
3128
3129 if ( aArgs.hasElements() )
3130 {
3131 // used only for cell value binding so far - it can be initialized after creating
3132
3133 uno::Reference<lang::XInitialization> xInit( xInt, uno::UNO_QUERY );
3134 if ( xInit.is() )
3135 xInit->initialize( aArgs );
3136 }
3137
3138 return xInt;
3139}
3140
3141uno::Sequence<OUString> SAL_CALL ScModelObj::getAvailableServiceNames()
3142{
3143 SolarMutexGuard aGuard;
3144
3147}
3148
3149// XServiceInfo
3151{
3152 return "ScModelObj";
3153 /* // Matching the .component information:
3154 return OUString( "com.sun.star.comp.Calc.SpreadsheetDocument" );
3155 */
3156}
3157
3158sal_Bool SAL_CALL ScModelObj::supportsService( const OUString& rServiceName )
3159{
3160 return cppu::supportsService(this, rServiceName);
3161}
3162
3163uno::Sequence<OUString> SAL_CALL ScModelObj::getSupportedServiceNames()
3164{
3166}
3167
3168// XUnoTunnel
3169
3170sal_Int64 SAL_CALL ScModelObj::getSomething(
3171 const uno::Sequence<sal_Int8 >& rId )
3172{
3173 if ( comphelper::isUnoTunnelId<ScModelObj>(rId) )
3174 {
3175 return comphelper::getSomething_cast(this);
3176 }
3177
3178 if ( comphelper::isUnoTunnelId<SfxObjectShell>(rId) )
3179 {
3181 }
3182
3183 // aggregated number formats supplier has XUnoTunnel, too
3184 // interface from aggregated object must be obtained via queryAggregation
3185
3186 sal_Int64 nRet = SfxBaseModel::getSomething( rId );
3187 if ( nRet )
3188 return nRet;
3189
3190 if ( GetFormatter().is() )
3191 {
3192 const uno::Type& rTunnelType = cppu::UnoType<lang::XUnoTunnel>::get();
3193 uno::Any aNumTunnel(xNumberAgg->queryAggregation(rTunnelType));
3194 if(auto xTunnelAgg = o3tl::tryAccess<uno::Reference<lang::XUnoTunnel>>(
3195 aNumTunnel))
3196 {
3197 return (*xTunnelAgg)->getSomething( rId );
3198 }
3199 }
3200
3201 return 0;
3202}
3203
3204const uno::Sequence<sal_Int8>& ScModelObj::getUnoTunnelId()
3205{
3206 static const comphelper::UnoIdInit theScModelObjUnoTunnelId;
3207 return theScModelObjUnoTunnelId.getSeq();
3208}
3209
3210// XChangesNotifier
3211
3212void ScModelObj::addChangesListener( const uno::Reference< util::XChangesListener >& aListener )
3213{
3214 SolarMutexGuard aGuard;
3215 maChangesListeners.addInterface( aListener );
3216}
3217
3218void ScModelObj::removeChangesListener( const uno::Reference< util::XChangesListener >& aListener )
3219{
3220 SolarMutexGuard aGuard;
3222}
3223
3225{
3226 if ( maChangesListeners.getLength() > 0 )
3227 return true;
3228
3229 // "change" event set in any sheet?
3231}
3232
3233namespace
3234{
3235
3236void lcl_dataAreaInvalidation(ScDocument& rDocument, ScModelObj* pModel,
3237 const ScRangeList& rRanges,
3238 bool bInvalidateDataArea, bool bExtendDataArea)
3239{
3240 size_t nRangeCount = rRanges.size();
3241
3242 for ( size_t nIndex = 0; nIndex < nRangeCount; ++nIndex )
3243 {
3244 ScRange const & rRange = rRanges[ nIndex ];
3245 ScAddress const & rEnd = rRange.aEnd;
3246 SCTAB nTab = rEnd.Tab();
3247
3248 bool bAreaExtended = false;
3249
3250 if (bExtendDataArea)
3251 {
3252 const Size aCurrentDataArea = pModel->getDataArea( nTab );
3253
3254 SCCOL nLastCol = aCurrentDataArea.Width();
3255 SCROW nLastRow = aCurrentDataArea.Height();
3256
3257 bAreaExtended = rEnd.Col() > nLastCol || rEnd.Row() > nLastRow;
3258 }
3259
3260 bool bInvalidate = bAreaExtended || bInvalidateDataArea;
3261 if ( bInvalidate )
3262 {
3263 ScTable* pTab = rDocument.FetchTable( nTab );
3264 if ( pTab )
3265 pTab->InvalidateCellArea();
3266
3269 }
3270 }
3271}
3272
3273};
3274
3275void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& rRanges,
3276 const uno::Sequence< beans::PropertyValue >& rProperties )
3277{
3278 OUString aOperation = rOperation;
3279 bool bIsDataAreaInvalidateType = aOperation == "data-area-invalidate";
3280 bool bIsDataAreaExtendType = aOperation == "data-area-extend";
3281
3282 bool bInvalidateDataArea = bIsDataAreaInvalidateType
3284 bool bExtendDataArea = bIsDataAreaExtendType || aOperation == "cell-change";
3285
3286 if ( pDocShell )
3287 {
3288 ScDocument& rDocument = pDocShell->GetDocument();
3289 lcl_dataAreaInvalidation(rDocument, this, rRanges, bInvalidateDataArea, bExtendDataArea);
3290
3291 // check if we were called only to update data area
3292 if (bIsDataAreaInvalidateType || bIsDataAreaExtendType)
3293 return;
3294
3295 // backward-compatibility Operation conversion
3296 // FIXME: make sure it can be passed
3297 if (rOperation == "delete-content" || rOperation == "undo"
3298 || rOperation == "redo" || rOperation == "paste")
3299 aOperation = "cell-change";
3300 }
3301
3302 if ( pDocShell && HasChangesListeners() )
3303 {
3304 util::ChangesEvent aEvent;
3305 aEvent.Source.set(getXWeak());
3306 aEvent.Base <<= aEvent.Source;
3307
3308 size_t nRangeCount = rRanges.size();
3309 aEvent.Changes.realloc( static_cast< sal_Int32 >( nRangeCount ) );
3310 auto pChanges = aEvent.Changes.getArray();
3311 for ( size_t nIndex = 0; nIndex < nRangeCount; ++nIndex )
3312 {
3313 uno::Reference< table::XCellRange > xRangeObj;
3314
3315 ScRange const & rRange = rRanges[ nIndex ];
3316 if ( rRange.aStart == rRange.aEnd )
3317 {
3318 xRangeObj.set( new ScCellObj( pDocShell, rRange.aStart ) );
3319 }
3320 else
3321 {
3322 xRangeObj.set( new ScCellRangeObj( pDocShell, rRange ) );
3323 }
3324
3325 util::ElementChange& rChange = pChanges[ static_cast< sal_Int32 >( nIndex ) ];
3326 rChange.Accessor <<= aOperation;
3327 rChange.Element <<= rProperties;
3328 rChange.ReplacedElement <<= xRangeObj;
3329 }
3330
3332 while ( aIter.hasMoreElements() )
3333 {
3334 try
3335 {
3336 aIter.next()->changesOccurred( aEvent );
3337 }
3338 catch( uno::Exception& )
3339 {
3340 }
3341 }
3342 }
3343
3344 // handle sheet events
3346 if ( !(aOperation == "cell-change" && pDocShell) )
3347 return;
3348
3350 aMarkData.MarkFromRangeList( rRanges, false );
3351 ScDocument& rDoc = pDocShell->GetDocument();
3352 SCTAB nTabCount = rDoc.GetTableCount();
3353 for (const SCTAB& nTab : aMarkData)
3354 {
3355 if (nTab >= nTabCount)
3356 break;
3357 const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
3358 if (pEvents)
3359 {
3360 const OUString* pScript = pEvents->GetScript(ScSheetEventId::CHANGE);
3361 if (pScript)
3362 {
3363 ScRangeList aTabRanges; // collect ranges on this sheet
3364 size_t nRangeCount = rRanges.size();
3365 for ( size_t nIndex = 0; nIndex < nRangeCount; ++nIndex )
3366 {
3367 ScRange const & rRange = rRanges[ nIndex ];
3368 if ( rRange.aStart.Tab() == nTab )
3369 aTabRanges.push_back( rRange );
3370 }
3371 size_t nTabRangeCount = aTabRanges.size();
3372 if ( nTabRangeCount > 0 )
3373 {
3374 uno::Reference<uno::XInterface> xTarget;
3375 if ( nTabRangeCount == 1 )
3376 {
3377 ScRange const & rRange = aTabRanges[ 0 ];
3378 if ( rRange.aStart == rRange.aEnd )
3379 xTarget.set( cppu::getXWeak( new ScCellObj( pDocShell, rRange.aStart ) ) );
3380 else
3381 xTarget.set( cppu::getXWeak( new ScCellRangeObj( pDocShell, rRange ) ) );
3382 }
3383 else
3384 xTarget.set( cppu::getXWeak( new ScCellRangesObj( pDocShell, aTabRanges ) ) );
3385
3386 uno::Sequence<uno::Any> aParams{ uno::Any(xTarget) };
3387
3388 uno::Any aRet;
3389 uno::Sequence<sal_Int16> aOutArgsIndex;
3390 uno::Sequence<uno::Any> aOutArgs;
3391
3392 /*ErrCode eRet =*/ pDocShell->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
3393 }
3394 }
3395 }
3396 }
3397}
3398
3400{
3401 if (!pDocShell)
3402 return;
3403
3404 ScDocument& rDoc = pDocShell->GetDocument();
3405 // don't call events before the document is visible
3406 // (might also set a flag on SfxEventHintId::LoadFinished and only disable while loading)
3407 if ( rDoc.IsDocVisible() )
3408 {
3409 SCTAB nTabCount = rDoc.GetTableCount();
3410 for (SCTAB nTab = 0; nTab < nTabCount; nTab++)
3411 {
3412 if (rDoc.HasCalcNotification(nTab))
3413 {
3414 if (const ScSheetEvents* pEvents = rDoc.GetSheetEvents( nTab ))
3415 {
3416 if (const OUString* pScript = pEvents->GetScript(ScSheetEventId::CALCULATE))
3417 {
3418 uno::Any aRet;
3419 uno::Sequence<uno::Any> aParams;
3420 uno::Sequence<sal_Int16> aOutArgsIndex;
3421 uno::Sequence<uno::Any> aOutArgs;
3422 pDocShell->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
3423 }
3424 }
3425
3426 try
3427 {
3428 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
3429 uno::Sequence< uno::Any > aArgs{ uno::Any(nTab) };
3430 xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::CALCULATE ), aArgs );
3431 }
3432 catch( uno::Exception& )
3433 {
3434 }
3435 }
3436 }
3437 }
3439}
3440
3441// XOpenCLSelection
3442
3444{
3446}
3447
3449{
3450 if (ScCalcConfig::isOpenCLEnabled() == static_cast<bool>(bEnable))
3451 return;
3453 return;
3454
3455 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
3456 officecfg::Office::Common::Misc::UseOpenCL::set(bEnable, batch);
3457 batch->commit();
3458
3460 if (bEnable)
3461 aConfig.setOpenCLConfigToDefault();
3463
3464#if HAVE_FEATURE_OPENCL
3465 sc::FormulaGroupInterpreter::switchOpenCLDevice(u"", true);
3466#endif
3467
3468 ScDocument* pDoc = GetDocument();
3470
3471}
3472
3474{
3476 aConfig.mbOpenCLAutoSelect = true;
3478 ScFormulaOptions aOptions = SC_MOD()->GetFormulaOptions();
3479 aOptions.SetCalcConfig(aConfig);
3480 SC_MOD()->SetFormulaOptions(aOptions);
3481#if !HAVE_FEATURE_OPENCL
3482 (void) bForce;
3483#else
3484 sc::FormulaGroupInterpreter::switchOpenCLDevice(u"", true, bForce);
3485#endif
3486}
3487
3489{
3491 aConfig.mbOpenCLAutoSelect = false;
3493 ScFormulaOptions aOptions = SC_MOD()->GetFormulaOptions();
3494 aOptions.SetCalcConfig(aConfig);
3495 SC_MOD()->SetFormulaOptions(aOptions);
3496}
3497
3498void ScModelObj::selectOpenCLDevice( sal_Int32 nPlatform, sal_Int32 nDevice )
3499{
3500 if(nPlatform < 0 || nDevice < 0)
3501 throw uno::RuntimeException();
3502
3503#if !HAVE_FEATURE_OPENCL
3504 throw uno::RuntimeException();
3505#else
3506 std::vector<OpenCLPlatformInfo> aPlatformInfo;
3507 sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
3508 if(o3tl::make_unsigned(nPlatform) >= aPlatformInfo.size())
3509 throw uno::RuntimeException();
3510
3511 if(o3tl::make_unsigned(nDevice) >= aPlatformInfo[nPlatform].maDevices.size())
3512 throw uno::RuntimeException();
3513
3514 OUString aDeviceString = aPlatformInfo[nPlatform].maVendor + " " + aPlatformInfo[nPlatform].maDevices[nDevice].maName;
3515 sc::FormulaGroupInterpreter::switchOpenCLDevice(aDeviceString, false);
3516#endif
3517}
3518
3520{
3521#if !HAVE_FEATURE_OPENCL
3522 return -1;
3523#else
3524 sal_Int32 nPlatformId;
3525 sal_Int32 nDeviceId;
3526 sc::FormulaGroupInterpreter::getOpenCLDeviceInfo(nDeviceId, nPlatformId);
3527 return nPlatformId;
3528#endif
3529}
3530
3532{
3533#if !HAVE_FEATURE_OPENCL
3534 return -1;
3535#else
3536 sal_Int32 nPlatformId;
3537 sal_Int32 nDeviceId;
3538 sc::FormulaGroupInterpreter::getOpenCLDeviceInfo(nDeviceId, nPlatformId);
3539 return nDeviceId;
3540#endif
3541}
3542
3543uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
3544{
3545#if !HAVE_FEATURE_OPENCL
3546 return uno::Sequence<sheet::opencl::OpenCLPlatform>();
3547#else
3548 std::vector<OpenCLPlatformInfo> aPlatformInfo;
3549 sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
3550
3551 uno::Sequence<sheet::opencl::OpenCLPlatform> aRet(aPlatformInfo.size());
3552 auto aRetRange = asNonConstRange(aRet);
3553 for(size_t i = 0; i < aPlatformInfo.size(); ++i)
3554 {
3555 aRetRange[i].Name = aPlatformInfo[i].maName;
3556 aRetRange[i].Vendor = aPlatformInfo[i].maVendor;
3557
3558 aRetRange[i].Devices.realloc(aPlatformInfo[i].maDevices.size());
3559 auto pDevices = aRetRange[i].Devices.getArray();
3560 for(size_t j = 0; j < aPlatformInfo[i].maDevices.size(); ++j)
3561 {
3562 const OpenCLDeviceInfo& rDevice = aPlatformInfo[i].maDevices[j];
3563 pDevices[j].Name = rDevice.maName;
3564 pDevices[j].Vendor = rDevice.maVendor;
3565 pDevices[j].Driver = rDevice.maDriver;
3566 }
3567 }
3568
3569 return aRet;
3570#endif
3571}
3572
3573namespace {
3574
3576void setOpcodeSubsetTest(bool bFlag)
3577{
3578 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
3579 officecfg::Office::Calc::Formula::Calculation::OpenCLSubsetOnly::set(bFlag, batch);
3580 batch->commit();
3581}
3582
3583}
3584
3586{
3587 setOpcodeSubsetTest(true);
3588}
3589
3591{
3592 setOpcodeSubsetTest(false);
3593}
3594
3596{
3597 return officecfg::Office::Calc::Formula::Calculation::OpenCLSubsetOnly::get();
3598}
3599
3601{
3602 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
3603 officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::set(number, batch);
3604 batch->commit();
3605}
3606
3608{
3609 return officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::get();
3610}
3611
3613 pDocShell( pDocSh )
3614{
3616}
3617
3619{
3621
3622 if (pDocShell)
3624}
3625
3627{
3628 // we don't care about update of references here
3629
3630 if ( rHint.GetId() == SfxHintId::Dying )
3631 {
3632 pDocShell = nullptr; // became invalid
3633 }
3634}
3635
3636uno::Reference<drawing::XDrawPage> ScDrawPagesObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
3637{
3638 if (pDocShell)
3639 {
3640 ScDrawLayer* pDrawLayer = pDocShell->MakeDrawLayer();
3641 OSL_ENSURE(pDrawLayer,"Cannot create Draw-Layer");
3642 if ( pDrawLayer && nIndex >= 0 && nIndex < pDocShell->GetDocument().GetTableCount() )
3643 {
3644 SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nIndex));
3645 OSL_ENSURE(pPage,"Draw-Page not found");
3646 if (pPage)
3647 {
3648 return uno::Reference<drawing::XDrawPage> (pPage->getUnoPage(), uno::UNO_QUERY);
3649 }
3650 }
3651 }
3652 return nullptr;
3653}
3654
3655// XDrawPages
3656
3657uno::Reference<drawing::XDrawPage> SAL_CALL ScDrawPagesObj::insertNewByIndex( sal_Int32 nPos )
3658{
3659 SolarMutexGuard aGuard;
3660 uno::Reference<drawing::XDrawPage> xRet;
3661 if (pDocShell)
3662 {
3663 OUString aNewName;
3665 if ( pDocShell->GetDocFunc().InsertTable( static_cast<SCTAB>(nPos),
3666 aNewName, true, true ) )
3667 xRet.set(GetObjectByIndex_Impl( nPos ));
3668 }
3669 return xRet;
3670}
3671
3672void SAL_CALL ScDrawPagesObj::remove( const uno::Reference<drawing::XDrawPage>& xPage )
3673{
3674 SolarMutexGuard aGuard;
3675 SvxDrawPage* pImp = comphelper::getFromUnoTunnel<SvxDrawPage>( xPage );
3676 if ( pDocShell && pImp )
3677 {
3678 SdrPage* pPage = pImp->GetSdrPage();
3679 if (pPage)
3680 {
3681 SCTAB nPageNum = static_cast<SCTAB>(pPage->GetPageNum());
3682 pDocShell->GetDocFunc().DeleteTable( nPageNum, true );
3683 }
3684 }
3685}
3686
3687// XIndexAccess
3688
3689sal_Int32 SAL_CALL ScDrawPagesObj::getCount()
3690{
3691 SolarMutexGuard aGuard;
3692 if (pDocShell)
3694 return 0;
3695}
3696
3697uno::Any SAL_CALL ScDrawPagesObj::getByIndex( sal_Int32 nIndex )
3698{
3699 SolarMutexGuard aGuard;
3700 uno::Reference<drawing::XDrawPage> xPage(GetObjectByIndex_Impl(nIndex));
3701 if (!xPage.is())
3702 throw lang::IndexOutOfBoundsException();
3703
3704 return uno::Any(xPage);
3705}
3706
3708{
3710}
3711
3713{
3714 SolarMutexGuard aGuard;
3715 return ( getCount() != 0 );
3716}
3717
3719 pDocShell( pDocSh )
3720{
3722}
3723
3725{
3727
3728 if (pDocShell)
3730}
3731
3733{
3734 // we don't care about update of references here
3735
3736 if ( rHint.GetId() == SfxHintId::Dying )
3737 {
3738 pDocShell = nullptr; // became invalid
3739 }
3740}
3741
3742// XSpreadsheets
3743
3745{
3746 if ( pDocShell && nIndex >= 0 && nIndex < pDocShell->GetDocument().GetTableCount() )
3747 return new ScTableSheetObj( pDocShell, static_cast<SCTAB>(nIndex) );
3748
3749 return nullptr;
3750}
3751
3753{
3754 if (pDocShell)
3755 {
3756 SCTAB nIndex;
3758 return new ScTableSheetObj( pDocShell, nIndex );
3759 }
3760 return nullptr;
3761}
3762
3763void SAL_CALL ScTableSheetsObj::insertNewByName( const OUString& aName, sal_Int16 nPosition )
3764{
3765 SolarMutexGuard aGuard;
3766 bool bDone = false;
3767 if (pDocShell)
3768 {
3769 bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName, true, true );
3770 }
3771 if (!bDone)
3772 throw uno::RuntimeException("ScTableSheetsObj::insertNewByName(): Illegal object name or bad index. Duplicate name?"); // no other exceptions specified
3773}
3774
3775void SAL_CALL ScTableSheetsObj::moveByName( const OUString& aName, sal_Int16 nDestination )
3776{
3777 SolarMutexGuard aGuard;
3778 bool bDone = false;
3779 if (pDocShell)
3780 {
3781 SCTAB nSource;
3782 if ( pDocShell->GetDocument().GetTable( aName, nSource ) )
3783 bDone = pDocShell->MoveTable( nSource, nDestination, false, true );
3784 }
3785 if (!bDone)
3786 throw uno::RuntimeException(); // no other exceptions specified
3787}
3788
3789void SAL_CALL ScTableSheetsObj::copyByName( const OUString& aName,
3790 const OUString& aCopy, sal_Int16 nDestination )
3791{
3792 SolarMutexGuard aGuard;
3793 bool bDone = false;
3794 if (pDocShell)
3795 {
3796 SCTAB nSource;
3797 if ( pDocShell->GetDocument().GetTable( aName, nSource ) )
3798 {
3799 bDone = pDocShell->MoveTable( nSource, nDestination, true, true );
3800 if (bDone)
3801 {
3802 // #i92477# any index past the last sheet means "append" in MoveTable
3803 SCTAB nResultTab = static_cast<SCTAB>(nDestination);
3804 SCTAB nTabCount = pDocShell->GetDocument().GetTableCount(); // count after copying
3805 if (nResultTab >= nTabCount)
3806 nResultTab = nTabCount - 1;
3807
3808 bDone = pDocShell->GetDocFunc().RenameTable( nResultTab, aCopy,
3809 true, true );
3810 }
3811 }
3812 }
3813 if (!bDone)
3814 throw uno::RuntimeException("ScTableSheetsObj::copyByName(): Illegal object name or bad index. Duplicate name?"); // no other exceptions specified
3815}
3816
3817void SAL_CALL ScTableSheetsObj::insertByName( const OUString& aName, const uno::Any& aElement )
3818{
3819 SolarMutexGuard aGuard;
3820 bool bDone = false;
3821 bool bIllArg = false;
3822
3824
3825 if ( pDocShell )
3826 {
3827 uno::Reference<uno::XInterface> xInterface(aElement, uno::UNO_QUERY);
3828 if ( xInterface.is() )
3829 {
3830 ScTableSheetObj* pSheetObj = dynamic_cast<ScTableSheetObj*>( xInterface.get() );
3831 if ( pSheetObj && !pSheetObj->GetDocShell() ) // not inserted yet?
3832 {
3833 ScDocument& rDoc = pDocShell->GetDocument();
3834 SCTAB nDummy;
3835 if ( rDoc.GetTable( aName, nDummy ) )
3836 {
3837 // name already exists
3838 throw container::ElementExistException();
3839 }
3840 SCTAB nPosition = rDoc.GetTableCount();
3841 bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName,
3842 true, true );
3843 if (bDone)
3844 pSheetObj->InitInsertSheet( pDocShell, nPosition );
3845 // set document and new range in the object
3846 }
3847 else
3848 bIllArg = true;
3849 }
3850 else
3851 bIllArg = true;
3852 }
3853
3854 if (!bDone)
3855 {
3856 if (bIllArg)
3857 throw lang::IllegalArgumentException();
3858 else
3859 throw uno::RuntimeException(); // ElementExistException is handled above
3860 }
3861}
3862
3863void SAL_CALL ScTableSheetsObj::replaceByName( const OUString& aName, const uno::Any& aElement )
3864{
3865 SolarMutexGuard aGuard;
3866 bool bDone = false;
3867 bool bIllArg = false;
3868
3870
3871 if ( pDocShell )
3872 {
3873 uno::Reference<uno::XInterface> xInterface(aElement, uno::UNO_QUERY);
3874 if ( xInterface.is() )
3875 {
3876 ScTableSheetObj* pSheetObj = dynamic_cast<ScTableSheetObj*>( xInterface.get() );
3877 if ( pSheetObj && !pSheetObj->GetDocShell() ) // not inserted yet?
3878 {
3879 SCTAB nPosition;
3880 if ( !pDocShell->GetDocument().GetTable( aName, nPosition ) )
3881 {
3882 // not found
3883 throw container::NoSuchElementException();
3884 }
3885
3886 if ( pDocShell->GetDocFunc().DeleteTable( nPosition, true ) )
3887 {
3888 // InsertTable can't really go wrong now
3889 bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName, true, true );
3890 if (bDone)
3891 pSheetObj->InitInsertSheet( pDocShell, nPosition );
3892 }
3893
3894 }
3895 else
3896 bIllArg = true;
3897 }
3898 else
3899 bIllArg = true;
3900 }
3901
3902 if (!bDone)
3903 {
3904 if (bIllArg)
3905 throw lang::IllegalArgumentException();
3906 else
3907 throw uno::RuntimeException(); // NoSuchElementException is handled above
3908 }
3909}
3910
3911void SAL_CALL ScTableSheetsObj::removeByName( const OUString& aName )
3912{
3913 SolarMutexGuard aGuard;
3914 bool bDone = false;
3915 if (pDocShell)
3916 {
3917 SCTAB nIndex;
3919 throw container::NoSuchElementException(); // not found
3920 bDone = pDocShell->GetDocFunc().DeleteTable( nIndex, true );
3921 }
3922
3923 if (!bDone)
3924 throw uno::RuntimeException(); // NoSuchElementException is handled above
3925}
3926
3928 const uno::Reference < sheet::XSpreadsheetDocument > & xDocSrc,
3929 const OUString& srcName, const sal_Int32 nDestPosition )
3930{
3931 //pDocShell is the destination
3932 ScDocument& rDocDest = pDocShell->GetDocument();
3933
3934 // Source document docShell
3935 if ( !xDocSrc.is() )
3936 throw uno::RuntimeException();
3937 ScModelObj* pObj = comphelper::getFromUnoTunnel<ScModelObj>(xDocSrc);
3938 ScDocShell* pDocShellSrc = static_cast<ScDocShell*>(pObj->GetEmbeddedObject());
3939
3940 // SourceSheet Position and does srcName exists ?
3941 SCTAB nIndexSrc;
3942 if ( !pDocShellSrc->GetDocument().GetTable( srcName, nIndexSrc ) )
3943 throw lang::IllegalArgumentException();
3944
3945 // Check the validity of destination index.
3946 SCTAB nCount = rDocDest.GetTableCount();
3947 SCTAB nIndexDest = static_cast<SCTAB>(nDestPosition);
3948 if (nIndexDest > nCount || nIndexDest < 0)
3949 throw lang::IndexOutOfBoundsException();
3950
3951 // Transfer Tab
3953 *pDocShellSrc, nIndexSrc, nIndexDest, true/*bInsertNew*/, true/*bNotifyAndPaint*/ );
3954
3955 return nIndexDest;
3956}
3957
3958// XCellRangesAccess
3959
3960uno::Reference< table::XCell > SAL_CALL ScTableSheetsObj::getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow, sal_Int32 nSheet )
3961{
3962 SolarMutexGuard aGuard;
3963 rtl::Reference<ScTableSheetObj> xSheet = GetObjectByIndex_Impl(static_cast<sal_uInt16>(nSheet));
3964 if (! xSheet.is())
3965 throw lang::IndexOutOfBoundsException();
3966
3967 return xSheet->getCellByPosition(nColumn, nRow);
3968}
3969
3970uno::Reference< table::XCellRange > SAL_CALL ScTableSheetsObj::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom, sal_Int32 nSheet )
3971{
3972 SolarMutexGuard aGuard;
3973 rtl::Reference<ScTableSheetObj> xSheet = GetObjectByIndex_Impl(static_cast<sal_uInt16>(nSheet));
3974 if (! xSheet.is())
3975 throw lang::IndexOutOfBoundsException();
3976
3977 return xSheet->getCellRangeByPosition(nLeft, nTop, nRight, nBottom);
3978}
3979
3980uno::Sequence < uno::Reference< table::XCellRange > > SAL_CALL ScTableSheetsObj::getCellRangesByName( const OUString& aRange )
3981{
3982 SolarMutexGuard aGuard;
3983 uno::Sequence < uno::Reference < table::XCellRange > > xRet;
3984
3985 ScRangeList aRangeList;
3986 ScDocument& rDoc = pDocShell->GetDocument();
3988 throw lang::IllegalArgumentException();
3989
3990 size_t nCount = aRangeList.size();
3991 if (!nCount)
3992 throw lang::IllegalArgumentException();
3993
3994 xRet.realloc(nCount);
3995 auto pRet = xRet.getArray();
3996 for( size_t nIndex = 0; nIndex < nCount; nIndex++ )
3997 {
3998 const ScRange & rRange = aRangeList[ nIndex ];
3999 pRet[nIndex] = new ScCellRangeObj(pDocShell, rRange);
4000 }
4001
4002 return xRet;
4003}
4004
4005// XEnumerationAccess
4006
4007uno::Reference<container::XEnumeration> SAL_CALL ScTableSheetsObj::createEnumeration()
4008{
4009 SolarMutexGuard aGuard;
4010 return new ScIndexEnumeration(this, "com.sun.star.sheet.SpreadsheetsEnumeration");
4011}
4012
4013// XIndexAccess
4014
4015sal_Int32 SAL_CALL ScTableSheetsObj::getCount()
4016{
4017 SolarMutexGuard aGuard;
4018 if (pDocShell)
4020 return 0;
4021}
4022
4023uno::Any SAL_CALL ScTableSheetsObj::getByIndex( sal_Int32 nIndex )
4024{
4025 SolarMutexGuard aGuard;
4026 uno::Reference<sheet::XSpreadsheet> xSheet(GetObjectByIndex_Impl(nIndex));
4027 if (!xSheet.is())
4028 throw lang::IndexOutOfBoundsException();
4029
4030 return uno::Any(xSheet);
4031
4032// return uno::Any();
4033}
4034
4036{
4038}
4039
4041{
4042 SolarMutexGuard aGuard;
4043 return ( getCount() != 0 );
4044}
4045
4046// XNameAccess
4047
4048uno::Any SAL_CALL ScTableSheetsObj::getByName( const OUString& aName )
4049{
4050 SolarMutexGuard aGuard;
4051 uno::Reference<sheet::XSpreadsheet> xSheet(GetObjectByName_Impl(aName));
4052 if (!xSheet.is())
4053 throw container::NoSuchElementException();
4054
4055 return uno::Any(xSheet);
4056}
4057
4058uno::Sequence<OUString> SAL_CALL ScTableSheetsObj::getElementNames()
4059{
4060 SolarMutexGuard aGuard;
4061 if (pDocShell)
4062 {
4063 ScDocument& rDoc = pDocShell->GetDocument();
4064 SCTAB nCount = rDoc.GetTableCount();
4065 OUString aName;
4066 uno::Sequence<OUString> aSeq(nCount);
4067 OUString* pAry = aSeq.getArray();
4068 for (SCTAB i=0; i<nCount; i++)
4069 {
4070 rDoc.GetName( i, aName );
4071 pAry[i] = aName;
4072 }
4073 return aSeq;
4074 }
4075 return uno::Sequence<OUString>();
4076}
4077
4078sal_Bool SAL_CALL ScTableSheetsObj::hasByName( const OUString& aName )
4079{
4080 SolarMutexGuard aGuard;
4081 if (pDocShell)
4082 {
4083 SCTAB nIndex;
4085 return true;
4086 }
4087 return false;
4088}
4089
4091 pDocShell( pDocSh ),
4092 nTab ( nT ),
4093 nStartCol( nSC ),
4094 nEndCol ( nEC )
4095{
4097}
4098
4100{
4102
4103 if (pDocShell)
4105}
4106
4108{
4109 if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
4110 {
4112 }
4113 else if ( rHint.GetId() == SfxHintId::Dying )
4114 {
4115 pDocShell = nullptr; // became invalid
4116 }
4117}
4118
4119// XTableColumns
4120
4122{
4123 SCCOL nCol = static_cast<SCCOL>(nIndex) + nStartCol;
4124 if ( pDocShell && nCol <= nEndCol )
4125 return new ScTableColumnObj( pDocShell, nCol, nTab );
4126
4127 return nullptr; // wrong index
4128}
4129
4131{
4132 SCCOL nCol = 0;
4134 if (nCol >= nStartCol && nCol <= nEndCol)
4135 return new ScTableColumnObj( pDocShell, nCol, nTab );
4136
4137 return nullptr;
4138}
4139
4140void SAL_CALL ScTableColumnsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 nCount )
4141{
4142 SolarMutexGuard aGuard;
4143 bool bDone = false;
4144 if ( pDocShell )
4145 {
4146 const ScDocument& rDoc = pDocShell->GetDocument();
4147 if ( nCount > 0 && nPosition >= 0 && nStartCol+nPosition <= nEndCol &&
4148 nStartCol+nPosition+nCount-1 <= rDoc.MaxCol() )
4149 {
4150 ScRange aRange( static_cast<SCCOL>(nStartCol+nPosition), 0, nTab,
4151 static_cast<SCCOL>(nStartCol+nPosition+nCount-1), rDoc.MaxRow(), nTab );
4152 bDone = pDocShell->GetDocFunc().InsertCells( aRange, nullptr, INS_INSCOLS_BEFORE, true, true );
4153 }
4154 }
4155 if (!bDone)
4156 throw uno::RuntimeException(); // no other exceptions specified
4157}
4158
4159void SAL_CALL ScTableColumnsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount )
4160{
4161 SolarMutexGuard aGuard;
4162 bool bDone = false;
4163 // the range to be deleted has to lie within the object
4164 if ( pDocShell )
4165 {
4166 const ScDocument& rDoc = pDocShell->GetDocument();
4167 if ( nCount > 0 && nIndex >= 0 && nStartCol+nIndex+nCount-1 <= nEndCol )
4168 {
4169 ScRange aRange( static_cast<SCCOL>(nStartCol+nIndex), 0, nTab,
4170 static_cast<SCCOL>(nStartCol+nIndex+nCount-1), rDoc.MaxRow(), nTab );
4171 bDone = pDocShell->GetDocFunc().DeleteCells( aRange, nullptr, DelCellCmd::Cols, true );
4172 }
4173 }
4174 if (!bDone)
4175 throw uno::RuntimeException(); // no other exceptions specified
4176}
4177
4178// XEnumerationAccess
4179
4180uno::Reference<container::XEnumeration> SAL_CALL ScTableColumnsObj::createEnumeration()
4181{
4182 SolarMutexGuard aGuard;
4183 return new ScIndexEnumeration(this, "com.sun.star.table.TableColumnsEnumeration");
4184}
4185
4186// XIndexAccess
4187
4189{
4190 SolarMutexGuard aGuard;
4191 return nEndCol - nStartCol + 1;
4192}
4193
4194uno::Any SAL_CALL ScTableColumnsObj::getByIndex( sal_Int32 nIndex )
4195{
4196 SolarMutexGuard aGuard;
4197 uno::Reference<table::XCellRange> xColumn(GetObjectByIndex_Impl(nIndex));
4198 if (!xColumn.is())
4199 throw lang::IndexOutOfBoundsException();
4200
4201 return uno::Any(xColumn);
4202
4203}
4204
4206{
4208}
4209
4211{
4212 SolarMutexGuard aGuard;
4213 return ( getCount() != 0 );
4214}
4215
4216uno::Any SAL_CALL ScTableColumnsObj::getByName( const OUString& aName )
4217{
4218 SolarMutexGuard aGuard;
4219 uno::Reference<table::XCellRange> xColumn(GetObjectByName_Impl(aName));
4220 if (!xColumn.is())
4221 throw container::NoSuchElementException();
4222
4223 return uno::Any(xColumn);
4224}
4225
4226uno::Sequence<OUString> SAL_CALL ScTableColumnsObj::getElementNames()
4227{
4228 SolarMutexGuard aGuard;
4229 SCCOL nCount = nEndCol - nStartCol + 1;
4230 uno::Sequence<OUString> aSeq(nCount);
4231 OUString* pAry = aSeq.getArray();
4232 for (SCCOL i=0; i<nCount; i++)
4233 pAry[i] = ::ScColToAlpha( nStartCol + i );
4234
4235 return aSeq;
4236}
4237
4238sal_Bool SAL_CALL ScTableColumnsObj::hasByName( const OUString& aName )
4239{
4240 SolarMutexGuard aGuard;
4241 SCCOL nCol = 0;
4243 if (nCol >= nStartCol && nCol <= nEndCol)
4244 return true;
4245
4246 return false; // not found
4247}
4248
4249// XPropertySet
4250
4251uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableColumnsObj::getPropertySetInfo()
4252{
4253 static uno::Reference<beans::XPropertySetInfo> aRef(
4255 return aRef;
4256}
4257
4259 const OUString& aPropertyName, const uno::Any& aValue )
4260{
4261 SolarMutexGuard aGuard;
4262 if (!pDocShell)
4263 throw uno::RuntimeException();
4264
4265 std::vector<sc::ColRowSpan> aColArr(1, sc::ColRowSpan(nStartCol,nEndCol));
4266 ScDocFunc& rFunc = pDocShell->GetDocFunc();
4267
4268 if ( aPropertyName == SC_UNONAME_CELLWID )
4269 {
4270 sal_Int32 nNewWidth = 0;
4271 if ( aValue >>= nNewWidth )
4272 rFunc.SetWidthOrHeight(
4273 true, aColArr, nTab, SC_SIZE_ORIGINAL, o3tl::toTwips(nNewWidth, o3tl::Length::mm100), true, true);
4274 }
4275 else if ( aPropertyName == SC_UNONAME_CELLVIS )
4276 {
4277 bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
4279 rFunc.SetWidthOrHeight(true, aColArr, nTab, eMode, 0, true, true);
4280 // SC_SIZE_DIRECT with size 0: hide
4281 }
4282 else if ( aPropertyName == SC_UNONAME_OWIDTH )
4283 {
4284 bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
4285 if (bOpt)
4286 rFunc.SetWidthOrHeight(
4287 true, aColArr, nTab, SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, true, true);
4288 // sal_False for columns currently has no effect
4289 }
4290 else if ( aPropertyName == SC_UNONAME_NEWPAGE || aPropertyName == SC_UNONAME_MANPAGE )
4291 {
4293 bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
4294 for (SCCOL nCol=nStartCol; nCol<=nEndCol; nCol++)
4295 if (bSet)
4296 rFunc.InsertPageBreak( true, ScAddress(nCol,0,nTab), true, true );
4297 else
4298 rFunc.RemovePageBreak( true, ScAddress(nCol,0,nTab), true, true );
4299 }
4300}
4301
4302uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aPropertyName )
4303{
4304 SolarMutexGuard aGuard;
4305 if (!pDocShell)
4306 throw uno::RuntimeException();
4307
4308 ScDocument& rDoc = pDocShell->GetDocument();
4309 uno::Any aAny;
4310
4312
4313 if ( aPropertyName == SC_UNONAME_CELLWID )
4314 {
4315 // for hidden column, return original height
4316 sal_uInt16 nWidth = rDoc.GetOriginalWidth( nStartCol, nTab );
4317 aAny <<= static_cast<sal_Int32>(convertTwipToMm100(nWidth));
4318 }
4319 else if ( aPropertyName == SC_UNONAME_CELLVIS )
4320 {
4321 bool bVis = !rDoc.ColHidden(nStartCol, nTab);
4322 aAny <<= bVis;
4323 }
4324 else if ( aPropertyName == SC_UNONAME_OWIDTH )
4325 {
4326 bool bOpt = !(rDoc.GetColFlags( nStartCol, nTab ) & CRFlags::ManualSize);
4327 aAny <<= bOpt;
4328 }
4329 else if ( aPropertyName == SC_UNONAME_NEWPAGE )
4330 {
4331 ScBreakType nBreak = rDoc.HasColBreak(nStartCol, nTab);
4332 aAny <<= (nBreak != ScBreakType::NONE);
4333 }
4334 else if ( aPropertyName == SC_UNONAME_MANPAGE )
4335 {
4336 ScBreakType nBreak = rDoc.HasColBreak(nStartCol, nTab);
4337 aAny <<= bool(nBreak & ScBreakType::Manual);
4338 }
4339
4340 return aAny;
4341}
4342
4344
4346 pDocShell( pDocSh ),
4347 nTab ( nT ),
4348 nStartRow( nSR ),
4349 nEndRow ( nER )
4350{
4351 pDocShell->GetDocument().AddUnoObject(*this);
4352}
4353
4355{
4357
4358 if (pDocShell)
4360}
4361
4363{
4364 if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
4365 {
4367 }
4368 else if ( rHint.GetId() == SfxHintId::Dying )
4369 {
4370 pDocShell = nullptr; // became invalid
4371 }
4372}
4373
4374// XTableRows
4375
4377{
4378 SCROW nRow = static_cast<SCROW>(nIndex) + nStartRow;
4379 if ( pDocShell && nRow <= nEndRow )
4380 return new ScTableRowObj( pDocShell, nRow, nTab );
4381
4382 return nullptr; // wrong index
4383}
4384
4385void SAL_CALL ScTableRowsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 nCount )
4386{
4387 SolarMutexGuard aGuard;
4388 bool bDone = false;
4389 if ( pDocShell )
4390 {
4391 const ScDocument& rDoc = pDocShell->GetDocument();
4392 if ( nCount > 0 && nPosition >= 0 && nStartRow+nPosition <= nEndRow &&
4393 nStartRow+nPosition+nCount-1 <= rDoc.MaxRow() )
4394 {
4395 ScRange aRange( 0, static_cast<SCROW>(nStartRow+nPosition), nTab,
4396 rDoc.MaxCol(), static_cast<SCROW>(nStartRow+nPosition+nCount-1), nTab );
4397 bDone = pDocShell->GetDocFunc().InsertCells( aRange, nullptr, INS_INSROWS_BEFORE, true, true );
4398 }
4399 }
4400 if (!bDone)
4401 throw uno::RuntimeException(); // no other exceptions specified
4402}
4403
4404void SAL_CALL ScTableRowsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount )
4405{
4406 SolarMutexGuard aGuard;
4407 bool bDone = false;
4408 // the range to be deleted has to lie within the object
4409 if ( pDocShell && nCount > 0 && nIndex >= 0 && nStartRow+nIndex+nCount-1 <= nEndRow )
4410 {
4411 const ScDocument& rDoc = pDocShell->GetDocument();
4412 ScRange aRange( 0, static_cast<SCROW>(nStartRow+nIndex), nTab,
4413 rDoc.MaxCol(), static_cast<SCROW>(nStartRow+nIndex+nCount-1), nTab );
4414 bDone = pDocShell->GetDocFunc().DeleteCells( aRange, nullptr, DelCellCmd::Rows, true );
4415 }
4416 if (!bDone)
4417 throw uno::RuntimeException(); // no other exceptions specified
4418}
4419
4420// XEnumerationAccess
4421
4422uno::Reference<container::XEnumeration> SAL_CALL ScTableRowsObj::createEnumeration()
4423{
4424 SolarMutexGuard aGuard;
4425 return new ScIndexEnumeration(this, "com.sun.star.table.TableRowsEnumeration");
4426}
4427
4428// XIndexAccess
4429
4430sal_Int32 SAL_CALL ScTableRowsObj::getCount()
4431{
4432 SolarMutexGuard aGuard;
4433 return nEndRow - nStartRow + 1;
4434}
4435
4436uno::Any SAL_CALL ScTableRowsObj::getByIndex( sal_Int32 nIndex )
4437{
4438 SolarMutexGuard aGuard;
4439 uno::Reference<table::XCellRange> xRow(GetObjectByIndex_Impl(nIndex));
4440 if (!xRow.is())
4441 throw lang::IndexOutOfBoundsException();
4442
4443 return uno::Any(xRow);
4444}
4445
4447{
4449}
4450
4452{
4453 SolarMutexGuard aGuard;
4454 return ( getCount() != 0 );
4455}
4456
4457// XPropertySet
4458
4459uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableRowsObj::getPropertySetInfo()
4460{
4461 static uno::Reference<beans::XPropertySetInfo> aRef(
4463 return aRef;
4464}
4465
4467 const OUString& aPropertyName, const uno::Any& aValue )
4468{
4469 SolarMutexGuard aGuard;
4470 if (!pDocShell)
4471 throw uno::RuntimeException();
4472
4473 ScDocFunc& rFunc = pDocShell->GetDocFunc();
4474 ScDocument& rDoc = pDocShell->GetDocument();
4475 std::vector<sc::ColRowSpan> aRowArr(1, sc::ColRowSpan(nStartRow,nEndRow));
4476
4477 if ( aPropertyName == SC_UNONAME_OHEIGHT )
4478 {
4479 sal_Int32 nNewHeight = 0;
4480 if ( rDoc.IsImportingXML() && ( aValue >>= nNewHeight ) )
4481 {
4482 // used to set the stored row height for rows with optimal height when loading.
4483
4484 // TODO: It's probably cleaner to use a different property name
4485 // for this.
4487 }
4488 else
4489 {
4490 bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
4491 if (bOpt)
4492 rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_OPTIMAL, 0, true, true);
4493 else
4494 {
4496 }
4497 }
4498 }
4499 else if ( aPropertyName == SC_UNONAME_CELLHGT )
4500 {
4501 sal_Int32 nNewHeight = 0;
4502 if ( aValue >>= nNewHeight )
4503 {
4504 if (rDoc.IsImportingXML())
4505 {
4506 // TODO: This is a band-aid fix. Eventually we need to
4507 // re-work ods' style import to get it to set styles to
4508 // ScDocument directly.
4510 rDoc.SetManualHeight( nStartRow, nEndRow, nTab, true );
4511 }
4512 else
4513 rFunc.SetWidthOrHeight(
4514 false, aRowArr, nTab, SC_SIZE_ORIGINAL, o3tl::toTwips(nNewHeight, o3tl::Length::mm100), true, true);
4515 }
4516 }
4517 else if ( aPropertyName == SC_UNONAME_CELLVIS )
4518 {
4519 bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
4521 rFunc.SetWidthOrHeight(false, aRowArr, nTab, eMode, 0, true, true);
4522 // SC_SIZE_DIRECT with size 0: hide
4523 }
4524 else if ( aPropertyName == SC_UNONAME_VISFLAG )
4525 {
4526 // #i116460# Shortcut to only set the flag, without drawing layer update etc.
4527 // Should only be used from import filters.
4529 }
4530 else if ( aPropertyName == SC_UNONAME_CELLFILT )
4531 {
4534 rDoc.SetRowFiltered(nStartRow, nEndRow, nTab, true);
4535 else
4536 rDoc.SetRowFiltered(nStartRow, nEndRow, nTab, false);
4537 }
4538 else if ( aPropertyName == SC_UNONAME_NEWPAGE || aPropertyName == SC_UNONAME_MANPAGE )
4539 {
4541 bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
4542 for (SCROW nRow=nStartRow; nRow<=nEndRow; nRow++)
4543 if (bSet)
4544 rFunc.InsertPageBreak( false, ScAddress(0,nRow,nTab), true, true );
4545 else
4546 rFunc.RemovePageBreak( false, ScAddress(0,nRow,nTab), true, true );
4547 }
4548 else if ( aPropertyName == SC_UNONAME_CELLBACK || aPropertyName == SC_UNONAME_CELLTRAN )
4549 {
4550 // #i57867# Background color is specified for row styles in the file format,
4551 // so it has to be supported along with the row properties (import only).
4552
4553 // Use ScCellRangeObj to set the property for all cells in the rows
4554 // (this means, the "row attribute" must be set before individual cell attributes).
4555
4556 ScRange aRange( 0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab );
4557 uno::Reference<beans::XPropertySet> xRangeObj = new ScCellRangeObj( pDocShell, aRange );
4558 xRangeObj->setPropertyValue( aPropertyName, aValue );
4559 }
4560}
4561
4562uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyName )
4563{
4564 SolarMutexGuard aGuard;
4565 if (!pDocShell)
4566 throw uno::RuntimeException();
4567
4568 ScDocument& rDoc = pDocShell->GetDocument();
4569 uno::Any aAny;
4570
4572
4573 if ( aPropertyName == SC_UNONAME_CELLHGT )
4574 {
4575 // for hidden row, return original height
4576 sal_uInt16 nHeight = rDoc.GetOriginalHeight( nStartRow, nTab );
4577 aAny <<= static_cast<sal_Int32>(convertTwipToMm100(nHeight));
4578 }
4579 else if ( aPropertyName == SC_UNONAME_CELLVIS )
4580 {
4581 SCROW nLastRow;
4582 bool bVis = !rDoc.RowHidden(nStartRow, nTab, nullptr, &nLastRow);
4583 aAny <<= bVis;
4584 }
4585 else if ( aPropertyName == SC_UNONAME_CELLFILT )
4586 {
4587 bool bVis = rDoc.RowFiltered(nStartRow, nTab);
4588 aAny <<= bVis;
4589 }
4590 else if ( aPropertyName == SC_UNONAME_OHEIGHT )
4591 {
4592 bool bOpt = !(rDoc.GetRowFlags( nStartRow, nTab ) & CRFlags::ManualSize);
4593 aAny <<= bOpt;
4594 }
4595 else if ( aPropertyName == SC_UNONAME_NEWPAGE )
4596 {
4597 ScBreakType nBreak = rDoc.HasRowBreak(nStartRow, nTab);
4598 aAny <<= (nBreak != ScBreakType::NONE);
4599 }
4600 else if ( aPropertyName == SC_UNONAME_MANPAGE )
4601 {
4602 ScBreakType nBreak = rDoc.HasRowBreak(nStartRow, nTab);
4603 aAny <<= bool(nBreak & ScBreakType::Manual);
4604 }
4605 else if ( aPropertyName == SC_UNONAME_CELLBACK || aPropertyName == SC_UNONAME_CELLTRAN )
4606 {
4607 // Use ScCellRangeObj to get the property from the cell range
4608 // (for completeness only, this is not used by the XML filter).
4609
4610 ScRange aRange( 0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab );
4611 uno::Reference<beans::XPropertySet> xRangeObj = new ScCellRangeObj( pDocShell, aRange );
4612 aAny = xRangeObj->getPropertyValue( aPropertyName );
4613 }
4614
4615 return aAny;
4616}
4617
4619
4621{
4622}
4623
4624// XPropertySet
4625
4626uno::Reference<beans::XPropertySetInfo> SAL_CALL ScSpreadsheetSettingsObj::getPropertySetInfo()
4627{
4628 return nullptr;
4629}
4630
4632 const OUString& /* aPropertyName */, const uno::Any& /* aValue */ )
4633{
4634}
4635
4636uno::Any SAL_CALL ScSpreadsheetSettingsObj::getPropertyValue( const OUString& /* aPropertyName */ )
4637{
4638 return uno::Any();
4639}
4640
4642
4644 pDocShell( pDocSh ),
4645 nTab( nT )
4646{
4647 pDocShell->GetDocument().AddUnoObject(*this);
4648}
4649
4651{
4653
4654 if (pDocShell)
4656}
4657
4659{
4661
4662 if ( rHint.GetId() == SfxHintId::Dying )
4663 {
4664 pDocShell = nullptr; // became invalid
4665 }
4666}
4667
4668bool ScAnnotationsObj::GetAddressByIndex_Impl( sal_Int32 nIndex, ScAddress& rPos ) const
4669{
4670 if (!pDocShell)
4671 return false;
4672
4673 ScDocument& rDoc = pDocShell->GetDocument();
4674 rPos = rDoc.GetNotePosition(nIndex, nTab);
4675 return rPos.IsValid();
4676}
4677
4679{
4680 if (pDocShell)
4681 {
4682 ScAddress aPos;
4683 if ( GetAddressByIndex_Impl( nIndex, aPos ) )
4684 return new ScAnnotationObj( pDocShell, aPos );
4685 }
4686 return nullptr;
4687}
4688
4689// XSheetAnnotations
4690
4692 const table::CellAddress& aPosition, const OUString& rText )
4693{
4694 SolarMutexGuard aGuard;
4695 if (pDocShell)
4696 {
4697 OSL_ENSURE( aPosition.Sheet == nTab, "addAnnotation with a wrong Sheet" );
4698 ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab );
4699 pDocShell->GetDocFunc().ReplaceNote( aPos, rText, nullptr, nullptr, true );
4700 }
4701}
4702
4703void SAL_CALL ScAnnotationsObj::removeByIndex( sal_Int32 nIndex )
4704{
4705 SolarMutexGuard aGuard;
4706 if (pDocShell)
4707 {
4708 ScAddress aPos;
4709 if ( GetAddressByIndex_Impl( nIndex, aPos ) )
4710 {
4712 aMarkData.SelectTable( aPos.Tab(), true );
4713 aMarkData.SetMultiMarkArea( ScRange(aPos) );
4714
4715 pDocShell->GetDocFunc().DeleteContents( aMarkData, InsertDeleteFlags::NOTE, true, true );
4716 }
4717 }
4718}
4719
4720// XEnumerationAccess
4721
4722uno::Reference<container::XEnumeration> SAL_CALL ScAnnotationsObj::createEnumeration()
4723{
4725
4726 SolarMutexGuard aGuard;
4727 return new ScIndexEnumeration(this, "com.sun.star.sheet.CellAnnotationsEnumeration");
4728}
4729
4730// XIndexAccess
4731
4732sal_Int32 SAL_CALL ScAnnotationsObj::getCount()
4733{
4734 SolarMutexGuard aGuard;
4735 sal_Int32 nCount = 0;
4736 if (pDocShell)
4737 {
4738 const ScDocument& rDoc = pDocShell->GetDocument();
4739 for (SCCOL nCol : rDoc.GetAllocatedColumnsRange(nTab, 0, rDoc.MaxCol()))
4740 nCount += rDoc.GetNoteCount(nTab, nCol);
4741 }
4742 return nCount;
4743}
4744
4745uno::Any SAL_CALL ScAnnotationsObj::getByIndex( sal_Int32 nIndex )
4746{
4747 SolarMutexGuard aGuard;
4748 uno::Reference<sheet::XSheetAnnotation> xAnnotation(GetObjectByIndex_Impl(nIndex));
4749 if (!xAnnotation.is())
4750 throw lang::IndexOutOfBoundsException();
4751
4752 return uno::Any(xAnnotation);
4753}
4754
4756{
4758}
4759
4761{
4762 SolarMutexGuard aGuard;
4763 return ( getCount() != 0 );
4764}
4765
4767 pDocShell( pDocSh ),
4768 nTab ( nT )
4769{
4771}
4772
4774{
4776
4777 if (pDocShell)
4779}
4780
4782{
4783 if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
4784 {
4786 }
4787 else if ( rHint.GetId() == SfxHintId::Dying )
4788 {
4789 pDocShell = nullptr; // became invalid
4790 }
4791}
4792
4793// XScenarios
4794
4795bool ScScenariosObj::GetScenarioIndex_Impl( std::u16string_view rName, SCTAB& rIndex )
4796{
4798
4799 if ( pDocShell )
4800 {
4801 OUString aTabName;
4802 ScDocument& rDoc = pDocShell->GetDocument();
4803 SCTAB nCount = static_cast<SCTAB>(getCount());
4804 for (SCTAB i=0; i<nCount; i++)
4805 if (rDoc.GetName( nTab+i+1, aTabName ))
4806 if (aTabName == rName)
4807 {
4808 rIndex = i;
4809 return true;
4810 }
4811 }
4812
4813 return false;
4814}
4815
4817{
4818 sal_uInt16 nCount = static_cast<sal_uInt16>(getCount());
4819 if ( pDocShell && nIndex >= 0 && nIndex < nCount )
4820 return new ScTableSheetObj( pDocShell, nTab+static_cast<SCTAB>(nIndex)+1 );
4821
4822 return nullptr; // no document or wrong index
4823}
4824
4826{
4827 SCTAB nIndex;
4829 return new ScTableSheetObj( pDocShell, nTab+nIndex+1 );
4830
4831 return nullptr; // not found
4832}
4833
4834void SAL_CALL ScScenariosObj::addNewByName( const OUString& aName,
4835 const uno::Sequence<table::CellRangeAddress>& aRanges,
4836 const OUString& aComment )
4837{
4838 SolarMutexGuard aGuard;
4839 if ( !pDocShell )
4840 return;
4841
4843 aMarkData.SelectTable( nTab, true );
4844
4845 for (const table::CellRangeAddress& rRange : aRanges)
4846 {
4847 OSL_ENSURE( rRange.Sheet == nTab, "addScenario with a wrong Tab" );
4848 ScRange aRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), nTab,
4849 static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), nTab );
4850
4851 aMarkData.SetMultiMarkArea( aRange );
4852 }
4853
4856
4857 pDocShell->MakeScenario( nTab, aName, aComment, COL_LIGHTGRAY, nFlags, aMarkData );
4858}
4859
4860void SAL_CALL ScScenariosObj::removeByName( const OUString& aName )
4861{
4862 SolarMutexGuard aGuard;
4863 SCTAB nIndex;
4866}
4867
4868// XEnumerationAccess
4869
4870uno::Reference<container::XEnumeration> SAL_CALL ScScenariosObj::createEnumeration()
4871{
4872 SolarMutexGuard aGuard;
4873 return new ScIndexEnumeration(this, "com.sun.star.sheet.ScenariosEnumeration");
4874}
4875
4876// XIndexAccess
4877
4878sal_Int32 SAL_CALL ScScenariosObj::getCount()
4879{
4880 SolarMutexGuard aGuard;
4881 SCTAB nCount = 0;
4882 if ( pDocShell )
4883 {
4884 ScDocument& rDoc = pDocShell->GetDocument();
4885 if (!rDoc.IsScenario(nTab))
4886 {
4887 SCTAB nTabCount = rDoc.GetTableCount();
4888 SCTAB nNext = nTab + 1;
4889 while (nNext < nTabCount && rDoc.IsScenario(nNext))
4890 {
4891 ++nCount;
4892 ++nNext;
4893 }
4894 }
4895 }
4896 return nCount;
4897}
4898
4899uno::Any SAL_CALL ScScenariosObj::getByIndex( sal_Int32 nIndex )
4900{
4901 SolarMutexGuard aGuard;
4902 uno::Reference<sheet::XScenario> xScen(GetObjectByIndex_Impl(nIndex));
4903 if (!xScen.is())
4904 throw lang::IndexOutOfBoundsException();
4905
4906 return uno::Any(xScen);
4907}
4908
4910{
4912}
4913
4915{
4916 SolarMutexGuard aGuard;
4917 return ( getCount() != 0 );
4918}
4919
4920uno::Any SAL_CALL ScScenariosObj::getByName( const OUString& aName )
4921{
4922 SolarMutexGuard aGuard;
4923 uno::Reference<sheet::XScenario> xScen(GetObjectByName_Impl(aName));
4924 if (!xScen.is())
4925 throw container::NoSuchElementException();
4926
4927 return uno::Any(xScen);
4928}
4929
4930uno::Sequence<OUString> SAL_CALL ScScenariosObj::getElementNames()
4931{
4932 SolarMutexGuard aGuard;
4933 SCTAB nCount = static_cast<SCTAB>(getCount());
4934 uno::Sequence<OUString> aSeq(nCount);
4935
4936 if ( pDocShell ) // otherwise Count = 0
4937 {
4938 OUString aTabName;
4939 ScDocument& rDoc = pDocShell->GetDocument();
4940 OUString* pAry = aSeq.getArray();
4941 for (SCTAB i=0; i<nCount; i++)
4942 if (rDoc.GetName( nTab+i+1, aTabName ))
4943 pAry[i] = aTabName;
4944 }
4945
4946 return aSeq;
4947}
4948
4949sal_Bool SAL_CALL ScScenariosObj::hasByName( const OUString& aName )
4950{
4951 SolarMutexGuard aGuard;
4952 SCTAB nIndex;
4954}
4955
4956/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr auto convertTwipToMm100(N n)
constexpr OUStringLiteral SC_POSITIONLEFT
constexpr OUStringLiteral SC_ACTIVETABLE
constexpr OUStringLiteral SC_POSITIONTOP
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
Definition: address.cxx:1884
bool AlphaToCol(const ScDocument &rDoc, SCCOL &rCol, std::u16string_view rStr)
get column number of A..IV... string
Definition: address.cxx:2509
bool ValidTab(SCTAB nTab)
Definition: address.hxx:111
const SCTAB TABLEID_DOC
Definition: address.hxx:91
AnyEventRef aEvent
@ ForceCalculationNone
Definition: calcconfig.hxx:34
static bool LOKHandleMouseEvent(VclEventId nEvent, vcl::Window *pWin, const MouseEvent *pEvent)
static const AllSettings & GetSettings()
OUString AsRGBHexString() const
static bool HasValidData(const css::uno::Reference< css::datatransfer::XTransferable > &rTransferable)
css::uno::Reference< css::datatransfer::XTransferable > GetTransferable() const
void SetCursorLogicPosition(const Point &rPosition, bool bPoint, bool bClearMark)
const tools::Rectangle & GetOutputArea() const
bool GetAutoControlFocus() const
void SetOpenInDesignMode(bool _bOpenDesignMode)
void SetAutoControlFocus(bool _bAutoControlFocus)
bool GetOpenInDesignMode() const
bool setGraphicSelection(int nType, int nX, int nY, double fScaleX=1.0, double fScaleY=1.0)
bool setTextSelection(int nType, int nX, int nY)
static void paintControlTile(const SdrPage *pPage, const SdrView *pDrawView, vcl::Window const &rMainWindow, VirtualDevice &rDevice, Size aOutputSize, tools::Rectangle const &rTileRect)
static bool postMouseEvent(const SdrPage *pPage, const SdrView *pDrawView, vcl::DocWindow &rMainWindow, int nType, Point aPointHmm, int nCount, int nButtons, int nModifier)
bool Select(sal_Int32 nIndex, bool bSelect=true)
void SetTotalRange(const Range &rTotRange)
EditView & GetEditView() const
Size GetOutputSize() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
vcl::ExtOutDevData * GetExtOutDevData() const
void SetDigitLanguage(LanguageType)
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
SCTAB Tab() const
Definition: address.hxx:283
bool IsValid() const
Definition: address.hxx:305
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:1537
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: docuno.cxx:4745
SCTAB nTab
Collection belongs to the sheet.
Definition: docuno.hxx:679
virtual ~ScAnnotationsObj() override
Definition: docuno.cxx:4650
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: docuno.cxx:4755
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: docuno.cxx:4658
ScDocShell * pDocShell
Definition: docuno.hxx:678
virtual void SAL_CALL insertNew(const css::table::CellAddress &aPosition, const OUString &aText) override
XSheetAnnotations.
Definition: docuno.cxx:4691
bool GetAddressByIndex_Impl(sal_Int32 nIndex, ScAddress &rPos) const
Definition: docuno.cxx:4668
virtual sal_Int32 SAL_CALL getCount() override
XIndexAccess.
Definition: docuno.cxx:4732
virtual sal_Bool SAL_CALL hasElements() override
Definition: docuno.cxx:4760
rtl::Reference< ScAnnotationObj > GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: docuno.cxx:4678
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
XEnumerationAccess.
Definition: docuno.cxx:4722
virtual void SAL_CALL removeByIndex(sal_Int32 nIndex) override
Definition: docuno.cxx:4703
void SetAutoComplete(bool bNew)
Definition: appoptio.hxx:53
really derive cell from range?
Definition: cellsuno.hxx:640
void SetOutlineState(bool bColumn, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bHidden)
Definition: dbfunc3.cxx:253
bool Protect(SCTAB nTab, const OUString &rPassword)
Definition: docfunc.cxx:4010
bool RenameTable(SCTAB nTab, const OUString &rName, bool bRecord, bool bApi)
Definition: docfunc.cxx:3500
bool InsertCells(const ScRange &rRange, const ScMarkData *pTabMark, InsCellCmd eCmd, bool bRecord, bool bApi, bool bPartOfPaste=false)
Definition: docfunc.cxx:1736
bool RemovePageBreak(bool bColumn, const ScAddress &rPos, bool bRecord, bool bSetModified)
Definition: docfunc.cxx:3886
bool DeleteCells(const ScRange &rRange, const ScMarkData *pTabMark, DelCellCmd eCmd, bool bApi)
Definition: docfunc.cxx:2271
bool InsertPageBreak(bool bColumn, const ScAddress &rPos, bool bRecord, bool bSetModified)
Definition: docfunc.cxx:3823
SC_DLLPUBLIC bool InsertTable(SCTAB nTab, const OUString &rName, bool bRecord, bool bApi)
Definition: docfunc.cxx:3269
SC_DLLPUBLIC bool DeleteContents(const ScMarkData &rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi)
Definition: docfunc.cxx:583
SC_DLLPUBLIC bool SetWidthOrHeight(bool bWidth, const std::vector< sc::ColRowSpan > &rRanges, SCTAB nTab, ScSizeMode eMode, sal_uInt16 nSizeTwips, bool bRecord, bool bApi)
Definition: docfunc.cxx:3652
bool DeleteTable(SCTAB nTab, bool bRecord)
Definition: docfunc.cxx:3321
bool DetectiveRefresh(bool bAutomatic=false)
Definition: docfunc.cxx:476
bool Unprotect(SCTAB nTab, const OUString &rPassword, bool bApi)
Definition: docfunc.cxx:4034
void ReplaceNote(const ScAddress &rPos, const OUString &rNoteText, const OUString *pAuthor, const OUString *pDate, bool bApi)
Definition: docfunc.cxx:1342
static bool setPropertyValue(ScDocOptions &rOptions, const SfxItemPropertyMap &rPropMap, std::u16string_view aPropertyName, const css::uno::Any &aValue)
Definition: optuno.cxx:53
static css::uno::Any getPropertyValue(const ScDocOptions &rOptions, const SfxItemPropertyMap &rPropMap, std::u16string_view PropertyName)
Definition: optuno.cxx:128
void SetAutoSpell(bool bVal)
Definition: docoptio.hxx:54
void UnlockPaint()
Definition: docsh3.cxx:322
void LockPaint()
Definition: docsh3.cxx:317
SCTAB MakeScenario(SCTAB nTab, const OUString &rName, const OUString &rComment, const Color &rColor, ScScenarioFlags nFlags, ScMarkData &rMark, bool bRecord=true)
Definition: docsh5.cxx:793
void SetEmpty(bool bSet)
Definition: docsh2.cxx:89
static weld::Window * GetActiveDialogParent()
Definition: docsh.cxx:3112
void DoHardRecalc()
Definition: docsh4.cxx:1530
void SetDocumentModified()
Definition: docsh.cxx:2982
SfxBindings * GetViewBindings()
Definition: docsh4.cxx:2642
sal_uInt16 GetLockCount() const
Definition: docsh.hxx:339
void AfterXMLLoading(bool bRet)
Definition: docsh.cxx:308
virtual bool IsChangeRecording() const override
Definition: docsh.cxx:3335
virtual bool HasChangeRecordProtection() const override
Definition: docsh.cxx:3341
void DoRecalc(bool bApi)
Definition: docsh4.cxx:1479
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
void UpdateAllRowHeights(const ScMarkData *pTabMark=nullptr)
Definition: docsh5.cxx:423
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:169
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
Definition: docsh4.cxx:2623
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:101
void DoConsolidate(const ScConsolidateParam &rParam, bool bRecord=true)
Definition: docsh5.cxx:511
bool MoveTable(SCTAB nSrcTab, SCTAB nDestTab, bool bCopy, bool bRecord)
Definition: docsh5.cxx:910
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: docsh3.cxx:451
void CalcOutputFactor()
Definition: docsh3.cxx:355
virtual void SetChangeRecording(bool bActivate, bool bLockAllViews=false) override
Definition: docsh.cxx:3350
static ScViewData * GetViewData()
Definition: docsh4.cxx:2607
void SetLockCount(sal_uInt16 nNew)
Definition: docsh3.cxx:300
bool IsEmpty() const
Definition: docsh.hxx:351
sal_uLong TransferTab(ScDocShell &rSrcDocShell, SCTAB nSrcPos, SCTAB nDestPos, bool bInsertNew, bool bNotifyAndPaint)
Definition: docsh5.cxx:863
void LockDocument()
Definition: docsh3.cxx:327
ScSheetSaveData * GetSheetSaveData()
Definition: docsh.cxx:3120
void BeforeXMLLoading()
Definition: docsh.cxx:293
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2968
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:221
static SCTAB GetCurTab()
Definition: docsh4.cxx:2614
void UnlockDocument()
Definition: docsh3.cxx:333
ScFormatSaveData * GetFormatSaveData()
Definition: docsh.cxx:3128
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:432
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:898
SCTAB GetVisibleTab() const
Definition: document.hxx:879
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4161
ScInterpreterContext & GetThreadedContext() const
Definition: document.hxx:623
SC_DLLPUBLIC ScRange GetRange(SCTAB nTab, const tools::Rectangle &rMMRect, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1797
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4122
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
Definition: document.cxx:6045
SC_DLLPUBLIC ScTable * FetchTable(SCTAB nTab)
Definition: document.cxx:2509
SC_DLLPUBLIC bool IsDocProtected() const
Definition: documen3.cxx:1894
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:244
SC_DLLPUBLIC ScColumnsRange GetAllocatedColumnsRange(SCTAB nTab, SCCOL nColBegin, SCCOL nColEnd) const
Definition: document.cxx:2534
tools::Long GetScaledRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale) const
Definition: document.cxx:4198
SC_DLLPUBLIC void InitDrawLayer(SfxObjectShell *pDocShell=nullptr)
Definition: documen9.cxx:105
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab)
Definition: document.hxx:880
size_t GetNoteCount(SCTAB nTab, SCCOL nCol) const
Definition: document.cxx:6711
const ScSheetEvents * GetSheetEvents(SCTAB nTab) const
Definition: documen3.cxx:661
SC_DLLPUBLIC bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4475
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
bool IsAdjustHeightLocked() const
Definition: document.hxx:1599
bool Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, SCCOL nVCol, SCROW nVRow, SCTAB nVTab, const OUString &sValStr, double &nX)
(Goal Seek) Find a value of x that is a root of f(x)
Definition: documen4.cxx:72
SC_DLLPUBLIC void EnableUndo(bool bVal)
Definition: document.cxx:6456
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
Definition: documen3.cxx:1942
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
Definition: document.cxx:982
void SetConsolidateDlgData(std::unique_ptr< ScConsolidateParam > pData)
Definition: documen2.cxx:1168
SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4355
SC_DLLPUBLIC sal_uInt16 GetOriginalHeight(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4153
SC_DLLPUBLIC OutputDevice * GetRefDevice()
Definition: documen8.cxx:199
SC_DLLPUBLIC void GetTiledRenderingArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow) const
Return the number of columns / rows that should be visible for the tiled rendering.
Definition: documen2.cxx:702
void EnableExecuteLink(bool bVal)
Definition: document.hxx:1603
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:901
void ResetCalcNotifications()
Definition: documen3.cxx:729
SC_DLLPUBLIC bool GetAutoCalc() const
Definition: document.hxx:1413
void SetCodeName(const OUString &r)
Definition: document.hxx:610
SC_DLLPUBLIC void GetAllNoteEntries(std::vector< sc::NoteEntry > &rNotes) const
Definition: document.cxx:6837
void SetLanguage(LanguageType eLatin, LanguageType eCjk, LanguageType eCtl)
Definition: documen3.cxx:1970
bool HasAnyCalcNotification() const
Definition: documen3.cxx:706
SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4369
const css::uno::Reference< css::script::vba::XVBAEventProcessor > & GetVbaEventProcessor() const
Definition: document.hxx:2539
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1084
SC_DLLPUBLIC bool GetHashCode(SCTAB nTab, sal_Int64 &rHashCode) const
Definition: document.cxx:194
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4416
SC_DLLPUBLIC void CreateValidTabName(OUString &rName) const
Definition: document.cxx:375
SC_DLLPUBLIC CRFlags GetRowFlags(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4335
ScAddress GetNotePosition(size_t nIndex) const
Definition: document.cxx:6775
bool IsExecuteLinkEnabled() const
Definition: document.hxx:1602
SC_DLLPUBLIC CRFlags GetColFlags(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4327
bool HasCalcNotification(SCTAB nTab) const
Definition: documen3.cxx:715
const ScConsolidateParam * GetConsolidateDlgData() const
Definition: document.hxx:654
bool IsChangeReadOnlyEnabled() const
Definition: document.hxx:1604
const OUString & GetCodeName() const
Definition: document.hxx:609
SC_DLLPUBLIC void GetLanguage(LanguageType &rLatin, LanguageType &rCjk, LanguageType &rCtl) const
Definition: documen3.cxx:1963
SC_DLLPUBLIC void SetRowHeightOnly(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt16 nNewHeight)
Definition: document.cxx:4110
SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden)
Definition: document.cxx:4442
bool HasAnySheetEventScript(ScSheetEventId nEvent, bool bWithVbaEvents=false) const
Definition: documen3.cxx:697
void EnableChangeReadOnly(bool bVal)
Definition: document.hxx:1605
SC_DLLPUBLIC bool IsDocVisible() const
Definition: document.hxx:1616
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4430
SC_DLLPUBLIC void SetAutoCalc(bool bNewAutoCalc)
Definition: documen7.cxx:602
SC_DLLPUBLIC bool GetPrintArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow, bool bNotes=true) const
Definition: documen2.cxx:611
SC_DLLPUBLIC bool IsVisible(SCTAB nTab) const
Definition: document.cxx:890
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:909
SC_DLLPUBLIC sal_uInt16 GetOriginalWidth(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4137
SC_DLLPUBLIC void SetManualHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bManual)
Definition: document.cxx:4116
SCCOL GetPosLeft() const
Definition: document.hxx:881
SCROW GetPosTop() const
Definition: document.hxx:883
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2494
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:974
bool IsUndoEnabled() const
Definition: document.hxx:1595
SC_DLLPUBLIC bool GetDataStart(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow) const
Definition: documen2.cxx:679
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:204
void RestoreChartListener(const OUString &rName)
Definition: documen5.cxx:363
SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered)
Definition: document.cxx:4496
void LockAdjustHeight()
Definition: document.hxx:1600
void CheckVectorizationState()
Definition: document.cxx:3805
SC_DLLPUBLIC void UnlockAdjustHeight()
Definition: document.cxx:1781
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1936
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1986
bool IsImportingXML() const
Definition: document.hxx:2227
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
static OUString GetVisibleName(const SdrObject *pObj)
Definition: drwlayer.cxx:2424
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: docuno.cxx:3697
css::uno::Reference< css::drawing::XDrawPage > GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: docuno.cxx:3636
ScDrawPagesObj(ScDocShell *pDocSh)
Definition: docuno.cxx:3612
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL insertNewByIndex(sal_Int32 nIndex) override
XDrawPages.
Definition: docuno.cxx:3657
virtual sal_Int32 SAL_CALL getCount() override
XIndexAccess.
Definition: docuno.cxx:3689
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: docuno.cxx:3707
virtual ~ScDrawPagesObj() override
Definition: docuno.cxx:3618
ScDocShell * pDocShell
Definition: docuno.hxx:411
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XDrawPage > &xPage) override
Definition: docuno.cxx:3672
virtual sal_Bool SAL_CALL hasElements() override
Definition: docuno.cxx:3712
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: docuno.cxx:3626
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:887
This is the UNO API equivalent of ScExternalRefManager.
Definition: linkuno.hxx:431
void SetCalcConfig(const ScCalcConfig &rConfig)
Definition: formulaopt.hxx:44
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
Definition: global.hxx:589
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:591
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: gridwin.cxx:2709
void updateOtherKitSelections() const
Fetch the selection ranges for other views into the LibreOfficeKit selection, map them into our view ...
Definition: gridwin.cxx:6321
OString getCellCursor() const
get Cell cursor in this view's co-ordinate system
Definition: gridwin.cxx:5974
void SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
Update the cell selection according to what handles have been dragged.
Definition: gridwin4.cxx:1765
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: gridwin.cxx:1797
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: gridwin.cxx:2191
void updateKitOtherCursors() const
notify this view with new positions for other view's cursors (after zoom)
Definition: gridwin.cxx:6075
void PaintTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight, SCCOL nTiledRenderingAreaEndCol, SCROW nTiledRenderingAreaEndRow)
Definition: gridwin4.cxx:1549
bool IsInputMode() const
Definition: inputhdl.hxx:186
void LOKPasteFunctionData(const OUString &rFunctionName)
Definition: inputhdl.cxx:1758
EditView * GetTableView()
Definition: inputhdl.hxx:238
void SetTextWysiwyg(bool bSet)
Definition: inputopt.hxx:62
void SetReplaceCellsWarn(bool bSet)
Definition: inputopt.hxx:64
static void SetGlobalConfig(const ScCalcConfig &rConfig)
Definition: interpr4.cxx:3897
static const ScCalcConfig & GetGlobalConfig()
Definition: interpr4.cxx:3902
Graphic / OleObject (need separate collections!)
Definition: targuno.hxx:49
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
const ScRange & GetMultiMarkArea() const
Definition: markdata.hxx:84
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:157
const ScRange & GetMarkArea() const
Definition: markdata.hxx:83
bool IsMultiMarked() const
Definition: markdata.hxx:81
void SetSelectedTabs(const MarkedTabsType &rTabs)
Definition: markdata.cxx:203
std::set< SCTAB > MarkedTabsType
Definition: markdata.hxx:45
void SetMultiMarkArea(const ScRange &rRange, bool bMark=true, bool bSetupMulti=false)
Definition: markdata.cxx:107
void ResetMark()
Definition: markdata.cxx:80
bool IsMarked() const
Definition: markdata.hxx:80
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:92
void MarkFromRangeList(const ScRangeList &rList, bool bReset)
Definition: markdata.cxx:319
void MarkToSimple()
Definition: markdata.cxx:222
void BeforeXMLLoading()
Definition: docuno.cxx:456
virtual void SAL_CALL addActionLock() override
Definition: docuno.cxx:2424
virtual void setClientZoom(int nTilePixelWidth, int nTilePixelHeight, int nTileTwipWidth, int nTileTwipHeight) override
Definition: docuno.cxx:1031
virtual Size getDataArea(long nPart) override
Definition: docuno.cxx:713
std::vector< sal_Int32 > maValidPages
Definition: docuno.hxx:127
void getTrackedChanges(tools::JsonWriter &) override
Definition: docuno.cxx:1120
virtual void setClientVisibleArea(const tools::Rectangle &rRectangle) override
Definition: docuno.cxx:1129
virtual void SAL_CALL release() noexcept override
Definition: docuno.cxx:1351
void UpdateAllRowHeights()
Definition: docuno.cxx:450
virtual int getPart() override
Definition: docuno.cxx:599
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: docuno.cxx:1397
std::unique_ptr< ScPrintFuncCache > pPrintFuncCache
Definition: docuno.hxx:98
std::unique_ptr< ScPrintUIOptions > pPrinterOptions
Definition: docuno.hxx:99
virtual css::sheet::GoalResult SAL_CALL seekGoal(const css::table::CellAddress &aFormulaPosition, const css::table::CellAddress &aVariablePosition, const OUString &aGoalValue) override
XGoalSeek.
Definition: docuno.cxx:2582
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: docuno.cxx:2697
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
XTypeProvider.
Definition: docuno.cxx:1356
virtual void resetSelection() override
Definition: docuno.cxx:969
virtual int getParts() override
Definition: docuno.cxx:593
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
XPropertySet.
Definition: docuno.cxx:2689
virtual void setTextSelection(int nType, int nX, int nY) override
Definition: docuno.cxx:806
virtual sal_Bool SAL_CALL isProtected() override
Definition: docuno.cxx:2558
virtual sal_Bool SAL_CALL isActionLocked() override
XActionLockable.
Definition: docuno.cxx:2415
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: docuno.cxx:1402
virtual sal_Int32 SAL_CALL getPlatformID() override
Definition: docuno.cxx:3519
virtual void SAL_CALL acquire() noexcept override
Definition: docuno.cxx:1346
virtual void SAL_CALL unlockControllers() override
Definition: docuno.cxx:2465
virtual void SAL_CALL disableAutomaticDeviceSelection() override
Definition: docuno.cxx:3488
virtual OString getSheetGeometryData(bool bColumns, bool bRows, bool bSizes, bool bHidden, bool bFiltered, bool bGroups) override
Definition: docuno.cxx:1075
virtual OUString getPartInfo(int nPart) override
Definition: docuno.cxx:605
ScSheetSaveData * GetSheetSaveData()
Definition: docuno.cxx:468
std::unique_ptr< ScPrintState > m_pPrintState
Definition: docuno.hxx:100
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: docuno.cxx:1309
css::uno::Reference< css::uno::XAggregation > const & GetFormatter()
Definition: docuno.cxx:411
virtual bool isMimeTypeSupported() override
Definition: docuno.cxx:1005
virtual void SAL_CALL enableAutomaticCalculation(sal_Bool bEnabled) override
Definition: docuno.cxx:2516
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
XUnoTunnel.
Definition: docuno.cxx:3170
virtual css::uno::Sequence< css::sheet::opencl::OpenCLPlatform > SAL_CALL getOpenCLPlatforms() override
Definition: docuno.cxx:3543
virtual void SAL_CALL unprotect(const OUString &aPassword) override
Definition: docuno.cxx:2547
void AfterXMLLoading()
Definition: docuno.cxx:462
virtual void paintTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight) override
Definition: docuno.cxx:520
virtual void SAL_CALL enableOpcodeSubsetTest() override
Definition: docuno.cxx:3585
bool HasChangesListeners() const
Definition: docuno.cxx:3224
virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) override
Definition: docuno.cxx:736
virtual sal_Int32 SAL_CALL getFormulaCellNumberLimit() override
Definition: docuno.cxx:3607
virtual void initializeForTiledRendering(const css::uno::Sequence< css::beans::PropertyValue > &rArguments) override
Definition: docuno.cxx:1274
virtual void SAL_CALL lockControllers() override
Definition: docuno.cxx:2457
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: docuno.cxx:3158
virtual sal_Bool SAL_CALL isAutomaticCalculationEnabled() override
Definition: docuno.cxx:2506
virtual void SAL_CALL calculateAll() override
Definition: docuno.cxx:2492
virtual ::css::uno::Reference< css::chart2::data::XDataProvider > SAL_CALL createDataProvider() override
XDataProviderAccess.
Definition: docuno.cxx:1462
ScDocShell * pDocShell
Definition: docuno.hxx:97
virtual PointerStyle getPointer() override
Definition: docuno.cxx:1105
virtual sal_Int32 SAL_CALL getDeviceID() override
Definition: docuno.cxx:3531
virtual void SAL_CALL consolidate(const css::uno::Reference< css::sheet::XConsolidationDescriptor > &xDescriptor) override
Definition: docuno.cxx:2623
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getStyleFamilies() override
XStyleFamiliesSupplier.
Definition: docuno.cxx:1474
virtual void setGraphicSelection(int nType, int nX, int nY) override
Definition: docuno.cxx:920
virtual void SAL_CALL refreshArrows() override
XDocumentAuditing.
Definition: docuno.cxx:2650
virtual void setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden) override
Definition: docuno.cxx:1150
SfxObjectShell * GetEmbeddedObject() const
Definition: docuno.cxx:445
void getPostIts(tools::JsonWriter &rJsonWriter) override
Definition: docuno.cxx:1162
SfxItemPropertySet aPropSet
Definition: docuno.hxx:96
static bool IsOnEvenPage(sal_Int32 nPage)
Definition: docuno.hxx:124
OString getViewRenderState() override
Definition: docuno.cxx:1257
virtual SdrModel & getSdrModelFromUnoModel() const override
abstract SdrModel provider
Definition: docuno.cxx:372
virtual OUString getPartHash(int nPart) override
Definition: docuno.cxx:637
ScDocument * GetDocument() const
Definition: docuno.cxx:438
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: docuno.cxx:3204
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: docuno.cxx:3163
virtual void SAL_CALL render(sal_Int32 nRenderer, const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
Definition: docuno.cxx:2094
void getPostItsPos(tools::JsonWriter &rJsonWriter) override
Definition: docuno.cxx:1206
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRenderer(sal_Int32 nRenderer, const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
Definition: docuno.cxx:1852
virtual void SAL_CALL enableAutomaticDeviceSelection(sal_Bool bForce) override
Definition: docuno.cxx:3473
void RepaintRange(const ScRange &rRange)
Definition: docuno.cxx:482
virtual OUString getPartName(int nPart) override
Definition: docuno.cxx:626
static void CreateAndSet(ScDocShell *pDocSh)
create ScModelObj and set at pDocSh (SetBaseModel)
Definition: docuno.cxx:366
virtual void SAL_CALL addChangesListener(const css::uno::Reference< css::util::XChangesListener > &aListener) override
XChangesNotifier.
Definition: docuno.cxx:3212
ScModelObj(ScDocShell *pDocSh)
Definition: docuno.cxx:384
css::uno::Reference< css::uno::XAggregation > xNumberAgg
Definition: docuno.hxx:101
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getViewData() override
XViewDataSupplier.
Definition: docuno.cxx:2658
void HandleCalculateEvents()
Definition: docuno.cxx:3399
virtual OUString SAL_CALL getImplementationName() override
XServiceInfo.
Definition: docuno.cxx:3150
OUString maBuildId
Definition: docuno.hxx:124
virtual sal_Int16 SAL_CALL resetActionLocks() override
Definition: docuno.cxx:2445
css::uno::Reference< css::uno::XInterface > create(OUString const &aServiceSpecifier, css::uno::Sequence< css::uno::Any > const *arguments)
Definition: docuno.cxx:3029
virtual sal_Bool SAL_CALL isOpenCLEnabled() override
Definition: docuno.cxx:3443
virtual void SAL_CALL calculate() override
XCalculatable.
Definition: docuno.cxx:2478
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString &aServiceSpecifier) override
XMultiServiceFactory.
Definition: docuno.cxx:3113
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: docuno.cxx:2845
virtual void setClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &xClipboard) override
Definition: docuno.cxx:994
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
Definition: docuno.cxx:3141
bool FillRenderMarkData(const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &rOptions, ScMarkData &rMark, ScPrintSelectionStatus &rStatus, OUString &rPagesStr, bool &rbRenderToGraphic) const
Definition: docuno.cxx:1588
virtual css::uno::Reference< css::datatransfer::XTransferable > getSelection() override
Definition: docuno.cxx:890
virtual VclPtr< vcl::Window > getDocWindow() override
Definition: docuno.cxx:647
virtual void completeFunction(const OUString &rFunctionName) override
Definition: docuno.cxx:1247
virtual void SAL_CALL enableOpenCL(sal_Bool bEnable) override
Definition: docuno.cxx:3448
virtual void SAL_CALL removeChangesListener(const css::uno::Reference< css::util::XChangesListener > &aListener) override
Definition: docuno.cxx:3218
virtual void SAL_CALL setFormulaCellNumberLimit(sal_Int32 number) override
Definition: docuno.cxx:3600
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString &ServiceSpecifier, const css::uno::Sequence< css::uno::Any > &Arguments) override
Definition: docuno.cxx:3120
virtual void SAL_CALL setActionLocks(sal_Int16 nLock) override
Definition: docuno.cxx:2438
virtual sal_Bool SAL_CALL isOpcodeSubsetTested() override
Definition: docuno.cxx:3595
virtual void SAL_CALL disableOpcodeSubsetTest() override
Definition: docuno.cxx:3590
virtual void SAL_CALL removeActionLock() override
Definition: docuno.cxx:2431
void NotifyChanges(const OUString &rOperation, const ScRangeList &rRanges, const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Definition: docuno.cxx:3275
virtual void getRowColumnHeaders(const tools::Rectangle &rRectangle, tools::JsonWriter &rJsonWriter) override
Definition: docuno.cxx:1062
::comphelper::OInterfaceContainerHelper3< css::util::XChangesListener > maChangesListeners
Definition: docuno.hxx:111
virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getDrawPages() override
XDrawPagesSupplier.
Definition: docuno.cxx:2570
ScFormatSaveData * GetFormatSaveData()
Definition: docuno.cxx:475
virtual Size getDocumentSize() final override
Definition: docuno.cxx:663
virtual ~ScModelObj() override
Definition: docuno.cxx:397
virtual sal_Int32 SAL_CALL getRendererCount(const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
XRenderable.
Definition: docuno.cxx:1757
virtual void SAL_CALL selectOpenCLDevice(sal_Int32 platform, sal_Int32 device) override
Definition: docuno.cxx:3498
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override
XLinkTargetSupplier.
Definition: docuno.cxx:2405
virtual void setPart(int nPart, bool bAllowChangeFocus=true) override
Definition: docuno.cxx:576
virtual css::uno::Reference< css::sheet::XSpreadsheets > SAL_CALL getSheets() override
XSpreadsheetDocument.
Definition: docuno.cxx:1454
virtual void SAL_CALL protect(const OUString &aPassword) override
XProtectable.
Definition: docuno.cxx:2537
virtual void getCellCursor(tools::JsonWriter &rJsonWriter) override
Definition: docuno.cxx:1089
virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override
Definition: docuno.cxx:742
virtual css::uno::Reference< css::sheet::XConsolidationDescriptor > SAL_CALL createConsolidationDescriptor(sal_Bool bEmpty) override
XConsolidatable.
Definition: docuno.cxx:2608
static LanguageType GetOptDigitLanguage()
Definition: scmod.cxx:907
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:73
tools::Long computePosition(index_type nIndex, const std::function< long(index_type)> &getSizePx)
Definition: viewdata.cxx:262
Stores the data for printing that is needed from several sheets, so it doesn't have to be calculated ...
Definition: pfuncache.hxx:85
static void DrawToDev(ScDocument &rDoc, OutputDevice *pDev, double nPrintFactor, const tools::Rectangle &rBound, ScViewData *pViewData, bool bMetaFile)
Definition: printfun.cxx:466
const Size & GetPageSize() const
Definition: printfun.hxx:362
bool GetSkipEmpty() const
Definition: printopt.hxx:36
void SetSkipEmpty(bool bVal)
Definition: printopt.hxx:37
void SetAllSheets(bool bVal)
Definition: printopt.hxx:39
bool GetAllSheets() const
Definition: printopt.hxx:38
Stores the selection in the ScPrintFuncCache so it is only used for the same selection again.
Definition: pfuncache.hxx:46
void SetOptions(const ScPrintOptions &rNew)
Definition: pfuncache.hxx:56
ScPrintSelectionMode GetMode() const
Definition: pfuncache.hxx:61
void SetRanges(const ScRangeList &rNew)
Definition: pfuncache.hxx:55
const ScPrintOptions & GetOptions() const
Definition: pfuncache.hxx:62
void SetMode(ScPrintSelectionMode eNew)
Definition: pfuncache.hxx:54
void SetDefaults()
Definition: docuno.cxx:327
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1137
size_t size() const
Definition: rangelst.hxx:89
static bool GetRangeListFromString(ScRangeList &rRangeList, std::u16string_view rRangeListStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
Definition: rangeutl.cxx:552
static bool MakeRangeFromName(const OUString &rName, const ScDocument &rDoc, SCTAB nCurTab, ScRange &rRange, RutlNameScope eScope=RUTL_NAMES, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1, bool bUseDetailsPos=false)
Definition: rangeutl.cxx:233
ScAddress aEnd
Definition: address.hxx:498
ScRefFlags Parse(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1700
ScAddress aStart
Definition: address.hxx:497
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: docuno.cxx:4909
rtl::Reference< ScTableSheetObj > GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: docuno.cxx:4816
virtual void SAL_CALL removeByName(const OUString &aName) override
Definition: docuno.cxx:4860
ScDocShell * pDocShell
Definition: docuno.hxx:723
virtual ~ScScenariosObj() override
Definition: docuno.cxx:4773
ScScenariosObj(ScDocShell *pDocSh, SCTAB nT)
Definition: docuno.cxx:4766
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
XEnumerationAccess.
Definition: docuno.cxx:4870
bool GetScenarioIndex_Impl(std::u16string_view rName, SCTAB &rIndex)
Definition: docuno.cxx:4795
virtual sal_Int32 SAL_CALL getCount() override
XIndexAccess.
Definition: docuno.cxx:4878
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: docuno.cxx:4899
virtual sal_Bool SAL_CALL hasElements() override
Definition: docuno.cxx:4914
rtl::Reference< ScTableSheetObj > GetObjectByName_Impl(std::u16string_view aName)
Definition: docuno.cxx:4825
virtual void SAL_CALL addNewByName(const OUString &aName, const css::uno::Sequence< css::table::CellRangeAddress > &aRanges, const OUString &aComment) override
XScenarios.
Definition: docuno.cxx:4834
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
XNameAccess.
Definition: docuno.cxx:4920
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: docuno.cxx:4781
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: docuno.cxx:4949
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: docuno.cxx:4930
static css::uno::Sequence< OUString > GetAllServiceNames()
Definition: servuno.cxx:614
static css::uno::Reference< css::uno::XInterface > MakeInstance(Type nType, ScDocShell *pDocShell)
Definition: servuno.cxx:396
static Type GetProviderType(std::u16string_view rServiceName)
Definition: servuno.cxx:372
const OUString * GetScript(ScSheetEventId nEvent) const
Definition: sheetevents.cxx:99
static sal_Int32 GetVbaSheetEventId(ScSheetEventId nEvent)
Definition: sheetevents.cxx:39
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: docuno.cxx:4631
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: docuno.cxx:4636
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
XPropertySet.
Definition: docuno.cxx:4626
int getPart() const override
See SfxViewShell::getPart().
Definition: tabvwshc.cxx:449
void SelectTabPage(const sal_uInt16 nTab)
Definition: tabview3.cxx:1812
void extendTiledAreaIfNeeded()
Definition: tabview.cxx:3003
void getRowColumnHeaders(const tools::Rectangle &rRectangle, tools::JsonWriter &rJsonWriter)
Definition: tabview.cxx:2699
OString getSheetGeometryData(bool bColumns, bool bRows, bool bSizes, bool bHidden, bool bFiltered, bool bGroups)
Definition: tabview.cxx:2929
ScViewData & GetViewData()
Definition: tabview.hxx:344
void Unmark()
Definition: tabview3.cxx:1744
ScDrawView * GetScDrawView()
Definition: tabview.hxx:352
ScTableColumnsObj(ScDocShell *pDocSh, SCTAB nT, SCCOL nSC, SCCOL nEC)
Definition: docuno.cxx:4090
virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) override
XTableColumns.
Definition: docuno.cxx:4140
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: docuno.cxx:4194
virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) override
Definition: docuno.cxx:4159
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: docuno.cxx:4205
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: docuno.cxx:4226
virtual ~ScTableColumnsObj() override
Definition: docuno.cxx:4099
virtual sal_Bool SAL_CALL hasElements() override
Definition: docuno.cxx:4210
ScDocShell * pDocShell
Definition: docuno.hxx:525
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: docuno.cxx:4302
rtl::Reference< ScTableColumnObj > GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: docuno.cxx:4121
virtual sal_Int32 SAL_CALL getCount() override
XIndexAccess.
Definition: docuno.cxx:4188
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: docuno.cxx:4107
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
XEnumerationAccess.
Definition: docuno.cxx:4180
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: docuno.cxx:4238
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
XPropertySet.
Definition: docuno.cxx:4251
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: docuno.cxx:4258
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
XNameAccess.
Definition: docuno.cxx:4216
rtl::Reference< ScTableColumnObj > GetObjectByName_Impl(std::u16string_view aName) const
Definition: docuno.cxx:4130
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
XPropertySet.
Definition: docuno.cxx:4459
virtual sal_Bool SAL_CALL hasElements() override
Definition: docuno.cxx:4451
SCROW nEndRow
Definition: docuno.hxx:594
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: docuno.cxx:4362
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: docuno.cxx:4562
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: docuno.cxx:4466
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: docuno.cxx:4436
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: docuno.cxx:4446
virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) override
Definition: docuno.cxx:4404
virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) override
XTableRows.
Definition: docuno.cxx:4385
SCROW nStartRow
Definition: docuno.hxx:593
ScDocShell * pDocShell
Definition: docuno.hxx:591
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
XEnumerationAccess.
Definition: docuno.cxx:4422
virtual sal_Int32 SAL_CALL getCount() override
XIndexAccess.
Definition: docuno.cxx:4430
rtl::Reference< ScTableRowObj > GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: docuno.cxx:4376
virtual ~ScTableRowsObj() override
Definition: docuno.cxx:4354
void InitInsertSheet(ScDocShell *pDocSh, SCTAB nTab)
Definition: cellsuno.cxx:6491
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
XNameContainer.
Definition: docuno.cxx:3817
virtual void SAL_CALL copyByName(const OUString &aName, const OUString &aCopy, sal_Int16 nDestination) override
Definition: docuno.cxx:3789
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: docuno.cxx:4023
rtl::Reference< ScTableSheetObj > GetObjectByName_Impl(const OUString &aName) const
Definition: docuno.cxx:3752
virtual void SAL_CALL insertNewByName(const OUString &aName, sal_Int16 nPosition) override
XSpreadsheets.
Definition: docuno.cxx:3763
virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition(sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom, sal_Int32 nSheet) override
Definition: docuno.cxx:3970
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
XNameAccess.
Definition: docuno.cxx:4048
rtl::Reference< ScTableSheetObj > GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: docuno.cxx:3744
virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow, sal_Int32 nSheet) override
XCellRangesAccess.
Definition: docuno.cxx:3960
virtual sal_Int32 SAL_CALL importSheet(const css::uno::Reference< css::sheet::XSpreadsheetDocument > &xDocSrc, const OUString &srcName, sal_Int32 nDestPosition) override
XSpreadsheets2.
Definition: docuno.cxx:3927
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: docuno.cxx:4035
ScDocShell * pDocShell
Definition: docuno.hxx:450
ScTableSheetsObj(ScDocShell *pDocSh)
Definition: docuno.cxx:3718
virtual css::uno::Sequence< css::uno::Reference< css::table::XCellRange > > SAL_CALL getCellRangesByName(const OUString &aRange) override
Definition: docuno.cxx:3980
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
XEnumerationAccess.
Definition: docuno.cxx:4007
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: docuno.cxx:3911
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: docuno.cxx:3732
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: docuno.cxx:4058
virtual void SAL_CALL moveByName(const OUString &aName, sal_Int16 nDestination) override
Definition: docuno.cxx:3775
virtual sal_Bool SAL_CALL hasElements() override
Definition: docuno.cxx:4040
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
XNameReplace.
Definition: docuno.cxx:3863
virtual ~ScTableSheetsObj() override
Definition: docuno.cxx:3724
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: docuno.cxx:4078
virtual sal_Int32 SAL_CALL getCount() override
XIndexAccess.
Definition: docuno.cxx:4015
bool GetCellArea(SCCOL &rEndCol, SCROW &rEndRow)
Definition: table1.cxx:521
void InvalidateCellArea()
Definition: table.hxx:623
static void FillLocale(css::lang::Locale &rLocale, LanguageType eLang)
Definition: convuno.cxx:41
static LanguageType GetLanguage(const css::lang::Locale &rLocale)
Definition: convuno.cxx:28
static bool GetBoolFromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:139
void SetScreen(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
Definition: viewdata.cxx:3033
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:554
const Fraction & GetZoomY() const
Definition: viewdata.hxx:460
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
void SetTabNo(SCTAB nNewTab)
Definition: viewdata.cxx:2319
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
void ForcePageUpDownOffset(tools::Long nTwips)
Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea.
Definition: viewdata.hxx:569
double GetPPTY() const
Definition: viewdata.hxx:469
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3162
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
void setLOKVisibleArea(const tools::Rectangle &rArea)
Definition: viewdata.hxx:574
static tools::Long ToPixel(sal_uInt16 nTwips, double nFactor)
Definition: viewdata.hxx:700
ScDBFunc * GetView() const
Definition: viewdata.cxx:864
ScPositionHelper & GetLOKWidthHelper()
Definition: viewdata.hxx:410
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, std::vector< SCTAB > &tabs)
Definition: viewdata.cxx:1036
const Fraction & GetZoomX() const
Definition: viewdata.hxx:459
double GetPPTX() const
Definition: viewdata.hxx:468
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3174
const OUString & GetColorSchemeName() const
Definition: viewopti.hxx:98
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const OutlinerView * GetTextEditOutlinerView() const
virtual bool IsTextEdit() const final override
SdrObject * Next()
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
virtual const tools::Rectangle & GetCurrentBoundRect() const
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
sal_uInt16 GetPageNum() const
void UnmarkAll()
void Notify(SfxBroadcaster &aBC, const SfxHint &aHint) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
void getGrabBagItem(css::uno::Any &rVal) const
bool hasValidSignatures() const
virtual void SAL_CALL unlockControllers() override
virtual void SAL_CALL acquire() noexcept override
virtual sal_Bool SAL_CALL hasControllersLocked() override
virtual void SAL_CALL release() noexcept override
OUString const & getRuntimeUID() const
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
virtual void SAL_CALL lockControllers() override
void setGrabBagItem(const css::uno::Any &rVal)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
css::uno::Reference< css::container::XIndexAccess > SAL_CALL getViewData() override
void Invalidate(sal_uInt16 nId)
SfxHintId GetId() const
const SfxItemPropertyMap & getPropertyMap() const
static void postKeyEventAsync(const VclPtr< vcl::Window > &xWindow, int nType, int nCharCode, int nKeyCode, int nRepeat=0)
static bool testInPlaceComponentMouseEventHit(SfxViewShell *pViewShell, int nType, int nX, int nY, int nCount, int nButtons, int nModifier, double fScaleX, double fScaleY, bool bNegativeX=false)
static void notifyPartSizeChangedAllViews(vcl::ITiledRenderable *pDoc, int nPart)
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
static VclPtr< vcl::Window > getInPlaceDocWindow(SfxViewShell *pViewShell)
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
ErrCode CallXScript(const OUString &rScriptURL, const css::uno::Sequence< css::uno::Any > &aParams, css::uno::Any &aRet, css::uno::Sequence< sal_Int16 > &aOutParamIndex, css::uno::Sequence< css::uno::Any > &aOutParam, bool bRaiseError=true, const css::uno::Any *aCaller=nullptr)
css::uno::Reference< css::script::XLibraryContainer > GetDialogContainer()
void DoDraw(OutputDevice *, const Point &rObjPos, const Size &rSize, const JobSetup &rSetup, sal_uInt16 nAspect=ASPECT_CONTENT, bool bOutputForScreen=false)
SfxObjectCreateMode GetCreateMode() const
void SetBaseModel(SfxBaseModel *pModel)
void SetMaxUndoActionCount(size_t nMaxUndoActionCount)
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
ViewShellDocId GetDocId() const override
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
sal_Int32 size() const
Iterator end(const o3tl::sorted_vector< sal_Int32 > *i_pPossibleValues=nullptr) const
Iterator begin(const o3tl::sorted_vector< sal_Int32 > *i_pPossibleValues=nullptr) const
void SetNumberFormatter(SvNumberFormatter *pNew)
OUString GetModuleName(EModule eModule) const
const Color & GetColor() const
SdrPage * GetSdrPage() const
virtual ::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface > SAL_CALL createInstance(const OUString &ServiceSpecifier) override
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString &ServiceSpecifier, const css::uno::Sequence< css::uno::Any > &Arguments) override
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
const VclPtr< OutputDevice > & GetOutputDevice() const
reference_type * get() const
static std::shared_ptr< ConfigurationChanges > create()
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
css::uno::Reference< ListenerT > const & next()
const css::uno::Sequence< sal_Int8 > & getSeq() const
css::uno::Type const & get()
void put(std::u16string_view pPropName, const OUString &rPropValue)
ScopedJsonWriterStruct startStruct()
ScopedJsonWriterArray startArray(std::string_view)
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr tools::Long Top() const
constexpr tools::Long Right() const
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
rtl::OString toString() const
sal_Int32 CreateDest(const tools::Rectangle &rRect, sal_Int32 nPageNr=-1, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
std::vector< PDFExtOutDevBookmarkEntry > & GetBookmarks()
void SetDocumentLocale(const css::lang::Locale &rLoc)
void SetLinkURL(sal_Int32 nLinkId, const OUString &rURL)
bool GetIsExportBookmarks() const
sal_Int32 CreateOutlineItem(sal_Int32 nParent, const OUString &rText, sal_Int32 nDestID)
bool GetIsExportNamedDestinations() const
sal_Int32 CreateNamedDest(const OUString &sDestName, const tools::Rectangle &rRect, sal_Int32 nPageNr=-1)
void SetLinkDest(sal_Int32 nLinkId, sal_Int32 nDestId)
static css::uno::Any setGroupControlOpt(const OUString &i_rID, const OUString &i_rTitle, const OUString &i_rHelpId)
static css::uno::Any setChoiceRadiosControlOpt(const css::uno::Sequence< OUString > &i_rIDs, const OUString &i_rTitle, const css::uno::Sequence< OUString > &i_rHelpId, const OUString &i_rProperty, const css::uno::Sequence< OUString > &i_rChoices, sal_Int32 i_nValue, const css::uno::Sequence< sal_Bool > &i_rDisabledChoices=css::uno::Sequence< sal_Bool >(), const UIControlOptions &i_rControlOptions=UIControlOptions())
std::vector< css::beans::PropertyValue > m_aUIProperties
static css::uno::Any setBoolControlOpt(const OUString &i_rID, const OUString &i_rTitle, const OUString &i_rHelpId, const OUString &i_rProperty, bool i_bValue, const UIControlOptions &i_rControlOptions=UIControlOptions())
static css::uno::Any setSubgroupControlOpt(const OUString &i_rID, const OUString &i_rTitle, const OUString &i_rHelpId, const UIControlOptions &i_rControlOptions=UIControlOptions())
static css::uno::Any setChoiceListControlOpt(const OUString &i_rID, const OUString &i_rTitle, const css::uno::Sequence< OUString > &i_rHelpId, const OUString &i_rProperty, const css::uno::Sequence< OUString > &i_rChoices, sal_Int32 i_nValue, const css::uno::Sequence< sal_Bool > &i_rDisabledChoices=css::uno::Sequence< sal_Bool >(), const UIControlOptions &i_rControlOptions=UIControlOptions())
static css::uno::Any setEditControlOpt(const OUString &i_rID, const OUString &i_rTitle, const OUString &i_rHelpId, const OUString &i_rProperty, const OUString &i_rValue, const UIControlOptions &i_rControlOptions)
tools::Long GetOutOffXPixel() const
bool HasChildPathFocus(bool bSystemWindow=false) const
void SetClipboard(css::uno::Reference< css::datatransfer::clipboard::XClipboard > const &xClipboard)
void GrabFocus()
virtual void SetOutputSizePixel(const Size &rNewSize)
tools::Long GetOutOffYPixel() const
PointerStyle GetPointer() const
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
int nCount
ULONG m_refCount
#define SC_PF_TESTMERGE
Definition: docsh.hxx:77
constexpr OUStringLiteral SCMODELOBJ_SERVICE
Definition: docuno.cxx:225
constexpr OUStringLiteral SCDOCSETTINGS_SERVICE
Definition: docuno.cxx:226
constexpr OUStringLiteral SCDOC_SERVICE
Definition: docuno.cxx:227
static o3tl::span< const SfxItemPropertyMapEntry > lcl_GetDocOptPropertyMap()
rename this, those are no longer only options
Definition: docuno.cxx:141
static ScViewData * lcl_getViewMatchingDocZoomTab(const Fraction &rZoomX, const Fraction &rZoomY, const SCTAB nTab, const ViewShellDocId &rDocId)
Definition: docuno.cxx:494
static sal_Int32 lcl_GetRendererNum(sal_Int32 nSelRenderer, std::u16string_view rPagesStr, sal_Int32 nTotalPages)
Definition: docuno.cxx:1833
static OutputDevice * lcl_GetRenderDevice(const uno::Sequence< beans::PropertyValue > &rOptions)
Definition: docuno.cxx:1484
static bool lcl_renderSelectionToGraphic(bool bRenderToGraphic, const ScPrintSelectionStatus &rStatus)
Definition: docuno.cxx:1847
static o3tl::span< const SfxItemPropertyMapEntry > lcl_GetRowsPropertyMap()
Definition: docuno.cxx:208
constexpr OUStringLiteral SC_UNO_VBAGLOBNAME
Definition: docuno.cxx:136
static o3tl::span< const SfxItemPropertyMapEntry > lcl_GetColumnsPropertyMap()
StandardDecimals as property and from NumberFormatter ????????
Definition: docuno.cxx:195
static bool lcl_ParseTarget(const OUString &rTarget, ScRange &rTargetRange, tools::Rectangle &rTargetRect, bool &rIsSheet, ScDocument &rDoc, SCTAB nSourceTab)
Definition: docuno.cxx:1508
static void lcl_sendLOKDocumentBackground(const ScViewData *pViewData)
Definition: docuno.cxx:1018
float u
EmbeddedObjectRef * pObject
#define MOUSE_LEFT
Reference< XInterface > xTarget
FilterGroup & rTarget
Reference< XColumn > xColumn
OUString sName
#define RANGE_MAX
ScBreakType
Definition: global.hxx:139
@ INS_INSCOLS_BEFORE
Definition: global.hxx:294
@ INS_INSROWS_BEFORE
Definition: global.hxx:293
@ NOTE
Strings (and string results if InsertDeleteFlags::FORMULA is not set).
ScSizeMode
Definition: global.hxx:351
@ SC_SIZE_DIRECT
Definition: global.hxx:352
@ SC_SIZE_OPTIMAL
Definition: global.hxx:353
@ SC_SIZE_ORIGINAL
Definition: global.hxx:356
@ SC_SIZE_SHOW
Definition: global.hxx:354
ScScenarioFlags
Definition: global.hxx:226
constexpr sal_Int32 STD_EXTRA_WIDTH
Definition: global.hxx:88
std::mutex m_aMutex
SfxHintId
sal_Int32 nIndex
OUString aName
Mode eMode
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define MID_BACK_COLOR
#define MID_GRAPHIC_TRANSPARENT
#define SC_QUERYINTERFACE(x)
Definition: miscuno.hxx:86
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:63
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:72
bool isDataAreaInvalidateType(std::u16string_view rType)
Definition: docsh.hxx:473
constexpr OUStringLiteral aData
bool isCompatFlagSet(Compat flag)
const LanguageTag & getLocale()
bool isdigitAsciiString(std::string_view rString)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
sal_Int64 getSomething_cast(void *p)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
constexpr auto toTwips(N number, Length from)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
std::enable_if<!(detail::IsDerivedReference< T >::value||detail::IsUnoSequenceType< T >::value||std::is_base_of< css::uno::XInterface, T >::value), typenamedetail::Optional< T >::type >::type tryAccess(css::uno::Any const &any)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
long Long
sal_Int16 nId
#define PROP_UNO_WILDCARDSENABLED
Definition: optuno.hxx:37
#define PROP_UNO_ITEREPSILON
Definition: optuno.hxx:30
#define PROP_UNO_LOOKUPLABELS
Definition: optuno.hxx:31
#define PROP_UNO_MATCHWHOLE
Definition: optuno.hxx:32
#define PROP_UNO_ITERCOUNT
Definition: optuno.hxx:29
#define PROP_UNO_REGEXENABLED
Definition: optuno.hxx:36
#define PROP_UNO_DEFTABSTOP
Definition: optuno.hxx:26
#define PROP_UNO_STANDARDDEC
Definition: optuno.hxx:35
#define PROP_UNO_NULLDATE
Definition: optuno.hxx:33
#define PROP_UNO_IGNORECASE
Definition: optuno.hxx:27
#define PROP_UNO_ITERENABLED
Definition: optuno.hxx:28
#define PROP_UNO_SPELLONLINE
Definition: optuno.hxx:34
#define PROP_UNO_CALCASSHOWN
Definition: optuno.hxx:25
PointerStyle
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
@ RUTL_DBASE
Definition: rangeutl.hxx:41
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
#define SC_MOD()
Definition: scmod.hxx:247
Configuration options for formula interpreter.
Definition: calcconfig.hxx:44
static bool isOpenCLEnabled()
Definition: calcconfig.cxx:69
void setOpenCLConfigToDefault()
Definition: calcconfig.cxx:100
static ForceCalculationType getForceCalculationType()
Definition: calcconfig.cxx:63
bool mbOpenCLAutoSelect
Definition: calcconfig.hxx:63
SvNumberFormatter * GetFormatTable() const
The range that is printed on a page (excluding repeated columns/rows), and its position on the page,...
Definition: pfuncache.hxx:69
tools::Rectangle aRectangle
Definition: pfuncache.hxx:72
tools::Long nPage
Definition: pfuncache.hxx:70
bool hasValue()
unsigned char sal_Bool
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
constexpr OUStringLiteral SC_UNONAME_CALCPAGESIZE
Definition: unonames.hxx:664
constexpr OUStringLiteral SC_UNO_RECORDCHANGES
Definition: unonames.hxx:538
constexpr OUStringLiteral SC_UNO_DDELINKS
Definition: unonames.hxx:40
constexpr OUStringLiteral SC_UNO_ISLOADED
Definition: unonames.hxx:530
constexpr OUStringLiteral SC_UNO_DATABASERNG
Definition: unonames.hxx:43
constexpr OUStringLiteral SC_UNO_CALCASSHOWN
Definition: unonames.hxx:512
constexpr OUStringLiteral SC_UNO_ITERCOUNT
Definition: unonames.hxx:516
constexpr OUStringLiteral SC_UNO_NULLDATE
Definition: unonames.hxx:521
constexpr OUStringLiteral SC_UNO_STANDARDDEC
Definition: unonames.hxx:523
constexpr OUStringLiteral SC_UNO_DEFTABSTOP
Definition: unonames.hxx:513
constexpr OUStringLiteral SC_UNO_ISEXECUTELINKENABLED
Definition: unonames.hxx:533
constexpr OUStringLiteral SC_UNONAME_CLOCAL
Definition: unonames.hxx:65
constexpr OUStringLiteral SC_UNO_NAMEDRANGES
Definition: unonames.hxx:45
constexpr OUStringLiteral SC_UNONAME_CELLWID
Definition: unonames.hxx:173
constexpr OUStringLiteral SC_UNO_FORBIDDEN
Definition: unonames.hxx:48
constexpr OUStringLiteral SC_UNO_SHEETLINKS
Definition: unonames.hxx:47
constexpr OUStringLiteral SC_UNONAME_REGEXP
Definition: unonames.hxx:295
constexpr OUStringLiteral SC_UNONAME_CELLHGT
Definition: unonames.hxx:172
constexpr OUStringLiteral SC_UNO_CODENAME
Definition: unonames.hxx:536
constexpr OUStringLiteral SC_UNONAME_WILDCARDS
Definition: unonames.hxx:296
constexpr OUStringLiteral SC_UNO_DIALOGLIBRARIES
Definition: unonames.hxx:527
constexpr OUStringLiteral SC_UNONAME_PAGESIZE
Definition: unonames.hxx:660
constexpr OUStringLiteral SC_UNO_ITEREPSILON
Definition: unonames.hxx:518
constexpr OUStringLiteral SC_UNONAME_CELLTRAN
Definition: unonames.hxx:102
constexpr OUStringLiteral SC_UNO_IGNORECASE
Definition: unonames.hxx:515
constexpr OUStringLiteral SC_UNONAME_OHEIGHT
Definition: unonames.hxx:178
constexpr OUStringLiteral SC_UNO_INTEROPGRABBAG
Definition: unonames.hxx:537
constexpr OUStringLiteral SC_UNONAME_INC_NP_AREA
Definition: unonames.hxx:663
constexpr OUStringLiteral SC_UNO_LOOKUPLABELS
Definition: unonames.hxx:519
constexpr OUStringLiteral SC_UNO_COLLABELRNG
Definition: unonames.hxx:42
constexpr OUStringLiteral SC_UNO_RUNTIMEUID
Definition: unonames.hxx:528
constexpr OUStringLiteral SC_UNO_ISCHANGEREADONLYENABLED
Definition: unonames.hxx:534
constexpr OUStringLiteral SC_UNO_WILDCARDSENABLED
Definition: unonames.hxx:525
constexpr OUStringLiteral SC_UNO_HASVALIDSIGNATURES
Definition: unonames.hxx:529
constexpr OUStringLiteral SC_UNO_CTL_CLOCAL
Definition: unonames.hxx:96
constexpr OUStringLiteral SC_UNONAME_MANPAGE
Definition: unonames.hxx:176
constexpr OUStringLiteral SC_UNO_HASDRAWPAGES
Definition: unonames.hxx:49
constexpr OUStringLiteral SC_UNO_ISUNDOENABLED
Definition: unonames.hxx:531
constexpr OUStringLiteral SC_UNO_REFERENCEDEVICE
Definition: unonames.hxx:535
constexpr OUStringLiteral SC_UNO_BASICLIBRARIES
Definition: unonames.hxx:526
constexpr OUStringLiteral SC_UNO_REGEXENABLED
Definition: unonames.hxx:524
constexpr OUStringLiteral SC_UNO_SPELLONLINE
Definition: unonames.hxx:522
constexpr OUStringLiteral SC_UNONAME_CELLBACK
Definition: unonames.hxx:100
constexpr OUStringLiteral SC_UNONAME_CELLVIS
Definition: unonames.hxx:174
constexpr OUStringLiteral SC_UNONAME_NEWPAGE
Definition: unonames.hxx:177
constexpr OUStringLiteral SC_UNO_AREALINKS
Definition: unonames.hxx:39
constexpr OUStringLiteral SC_UNONAME_CALCPAGEPOS
Definition: unonames.hxx:665
constexpr OUStringLiteral SC_UNONAME_CELLFILT
Definition: unonames.hxx:175
constexpr OUStringLiteral SC_UNO_EXTERNALDOCLINKS
Definition: unonames.hxx:41
constexpr OUStringLiteral SC_UNO_ISADJUSTHEIGHTENABLED
Definition: unonames.hxx:532
constexpr OUStringLiteral SC_UNONAME_OWIDTH
Definition: unonames.hxx:179
constexpr OUStringLiteral SC_UNONAME_RENDERDEV
Definition: unonames.hxx:661
constexpr OUStringLiteral SC_UNO_ISRECORDCHANGESPROTECTED
Definition: unonames.hxx:539
constexpr OUStringLiteral SC_UNONAME_SOURCERANGE
Definition: unonames.hxx:662
constexpr OUStringLiteral SC_UNO_MATCHWHOLE
Definition: unonames.hxx:520
constexpr OUStringLiteral SC_UNO_AUTOCONTFOC
Definition: unonames.hxx:545
constexpr OUStringLiteral SC_UNONAME_VISFLAG
Definition: unonames.hxx:194
constexpr OUStringLiteral SC_UNO_ROWLABELRNG
Definition: unonames.hxx:46
constexpr OUStringLiteral SC_UNO_ITERENABLED
Definition: unonames.hxx:517
constexpr OUStringLiteral SC_UNO_APPLYFMDES
Definition: unonames.hxx:544
constexpr OUStringLiteral SC_UNO_UNNAMEDDBRNG
Definition: unonames.hxx:44
constexpr OUStringLiteral SC_UNO_CJK_CLOCAL
Definition: unonames.hxx:86
VclEventId
const SvXMLTokenMapEntry aTypes[]