LibreOffice Module sc (master) 1
tablink.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 <sal/config.h>
21
22#include <com/sun/star/task/InteractionHandler.hpp>
23
24#include <sfx2/sfxsids.hrc>
25#include <sfx2/app.hxx>
26#include <svl/itemset.hxx>
27#include <svl/stritem.hxx>
28#include <sfx2/docfile.hxx>
29#include <sfx2/docfilt.hxx>
30#include <sfx2/fcontnr.hxx>
31#include <sfx2/frame.hxx>
32#include <sfx2/linkmgr.hxx>
33#include <utility>
34#include <vcl/weld.hxx>
35#include <tools/urlobj.hxx>
39
40#include <tablink.hxx>
41
42#include <scextopt.hxx>
43#include <document.hxx>
44#include <docsh.hxx>
45#include <globstr.hrc>
46#include <scresid.hxx>
47#include <undoblk.hxx>
48#include <undotab.hxx>
49#include <global.hxx>
50#include <hints.hxx>
51#include <dociter.hxx>
52#include <formula/opcode.hxx>
53#include <formulaiter.hxx>
54#include <tokenarray.hxx>
55
57{
60
61 TableLink_Impl() : m_pDocSh( nullptr ) {}
62};
63
64
65ScTableLink::ScTableLink(ScDocShell* pDocSh, OUString aFile,
66 OUString aFilter, OUString aOpt,
67 sal_Int32 nRefreshDelaySeconds ):
69 ScRefreshTimer( nRefreshDelaySeconds ),
70 pImpl( new TableLink_Impl ),
71 aFileName(std::move(aFile)),
72 aFilterName(std::move(aFilter)),
73 aOptions(std::move(aOpt)),
74 bInCreate( false ),
75 bInEdit( false ),
76 bAddUndo( true )
77{
78 pImpl->m_pDocSh = pDocSh;
79}
80
82 OUString aFilter, OUString aOpt,
83 sal_Int32 nRefreshDelaySeconds ):
85 ScRefreshTimer( nRefreshDelaySeconds ),
86 pImpl( new TableLink_Impl ),
87 aFileName(std::move(aFile)),
88 aFilterName(std::move(aFilter)),
89 aOptions(std::move(aOpt)),
90 bInCreate( false ),
91 bInEdit( false ),
92 bAddUndo( true )
93{
94 pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell );
95 SetRefreshHandler( LINK( this, ScTableLink, RefreshHdl ) );
96 SetRefreshControl( &pImpl->m_pDocSh->GetDocument().GetRefreshTimerControlAddress() );
97}
98
100{
101 // cancel connection
102
104 ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
105 SCTAB nCount = rDoc.GetTableCount();
106 for (SCTAB nTab=0; nTab<nCount; nTab++)
107 if (rDoc.IsLinked(nTab) && aFileName == rDoc.GetLinkDoc(nTab))
108 rDoc.SetLink( nTab, ScLinkMode::NONE, "", "", "", "", 0 );
109}
110
111void ScTableLink::Edit(weld::Window* pParent, const Link<SvBaseLink&,void>& rEndEditHdl)
112{
113 pImpl->m_aEndEditLink = rEndEditHdl;
114
115 bInEdit = true;
116 SvBaseLink::Edit( pParent, LINK( this, ScTableLink, TableEndEditHdl ) );
117}
118
120 const OUString&, const css::uno::Any& )
121{
122 sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument().GetLinkManager();
123 if (pLinkManager!=nullptr)
124 {
125 OUString aFile, aFilter;
126 sfx2::LinkManager::GetDisplayNames(this, nullptr, &aFile, nullptr, &aFilter);
127
128 // the file dialog returns the filter name with the application prefix
129 // -> remove prefix
131
132 if (!bInCreate)
133 Refresh( aFile, aFilter, nullptr, GetRefreshDelaySeconds() ); // don't load twice
134 }
135 return SUCCESS;
136}
137
139{
140 // delete link: Undo
141 ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
142 bool bUndo (rDoc.IsUndoEnabled());
143
144 if (bAddUndo && bUndo)
145 {
146 pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
147 std::make_unique<ScUndoRemoveLink>( pImpl->m_pDocSh, aFileName ) );
148
149 bAddUndo = false; // only once
150 }
151
152 // connection gets cancelled in the dtor
153
154 SvBaseLink::Closed();
155}
156
158{
159 return pImpl->m_pDocSh->GetDocument().HasLink( aFileName, aFilterName, aOptions );
160}
161
162bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
163 const OUString* pNewOptions, sal_Int32 nNewRefreshDelaySeconds )
164{
165 // load document
166
167 if (rNewFile.isEmpty() || rNewFilter.isEmpty())
168 return false;
169
170 OUString aNewUrl = ScGlobal::GetAbsDocName(rNewFile, pImpl->m_pDocSh);
171 bool bNewUrlName = aFileName != aNewUrl;
172
173 std::shared_ptr<const SfxFilter> pFilter = pImpl->m_pDocSh->GetFactory().GetFilterContainer()->GetFilter4FilterName(rNewFilter);
174 if (!pFilter)
175 return false;
176
177 ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
178 rDoc.SetInLinkUpdate( true );
179
180 bool bUndo(rDoc.IsUndoEnabled());
181
182 // if new filter has been selected, forget options
183 if (aFilterName != rNewFilter)
184 aOptions.clear();
185 if ( pNewOptions ) // options hard-specified?
186 aOptions = *pNewOptions;
187
188 // always create ItemSet, so that DocShell can set the options
189 auto pSet = std::make_shared<SfxAllItemSet>( SfxGetpApp()->GetPool() );
190 if (!aOptions.isEmpty())
191 pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, aOptions ) );
192
193 SfxMedium* pMed = new SfxMedium(aNewUrl, StreamMode::STD_READ, pFilter, std::move(pSet));
194
195 if ( bInEdit ) // only if using the edit dialog,
196 pMed->UseInteractionHandler(true); // enable the filter options dialog
197
198 // aRef->DoClose() will be called explicitly, but it is still more safe to use SfxObjectShellLock here
199 ScDocShell* pSrcShell = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS);
200 SfxObjectShellLock aRef = pSrcShell;
201 pSrcShell->DoLoad(pMed);
202
203 // options might have been set
204 OUString aNewOpt = ScDocumentLoader::GetOptions(*pMed);
205 if (aNewOpt.isEmpty())
206 aNewOpt = aOptions;
207
208 // Undo...
209
210 ScDocumentUniquePtr pUndoDoc;
211 bool bFirst = true;
212 if (bAddUndo && bUndo)
213 pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
214
215 // copy tables
216
217 ScDocShellModificator aModificator( *pImpl->m_pDocSh );
218
219 bool bNotFound = false;
220 ScDocument& rSrcDoc = pSrcShell->GetDocument();
221
222 // from text filters that don't set the table name,
223 // use the one table regardless of link table name
224 bool bAutoTab = (rSrcDoc.GetTableCount() == 1) &&
226
227 SCTAB nCount = rDoc.GetTableCount();
228 for (SCTAB nTab=0; nTab<nCount; nTab++)
229 {
230 ScLinkMode nMode = rDoc.GetLinkMode(nTab);
231 if (nMode != ScLinkMode::NONE && aFileName == rDoc.GetLinkDoc(nTab))
232 {
233 OUString aTabName = rDoc.GetLinkTab(nTab);
234
235 // Undo
236
237 if (bAddUndo && bUndo)
238 {
239 if (bFirst)
240 pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
241 else
242 pUndoDoc->AddUndoTab( nTab, nTab, true, true );
243 bFirst = false;
244 ScRange aRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab);
245 rDoc.CopyToDocument(aRange, InsertDeleteFlags::ALL, false, *pUndoDoc);
246 pUndoDoc->TransferDrawPage( rDoc, nTab, nTab );
247 pUndoDoc->SetLink( nTab, nMode, aFileName, aFilterName,
248 aOptions, aTabName, GetRefreshDelaySeconds() );
249 pUndoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
250 }
251
252 // adjust table name of an ExtDocRef
253
254 if ( bNewUrlName && nMode == ScLinkMode::VALUE )
255 {
256 OUString aName;
257 rDoc.GetName( nTab, aName );
258 if ( ScGlobal::GetTransliteration().isEqual(
259 ScGlobal::GetDocTabName( aFileName, aTabName ), aName ) )
260 {
261 rDoc.RenameTab( nTab,
262 ScGlobal::GetDocTabName( aNewUrl, aTabName ),
263 true/*bExternalDocument*/ );
264 }
265 }
266
267 // copy
268
269 SCTAB nSrcTab = 0;
270 bool bFound = false;
271 /* #i71497# check if external document is loaded successfully,
272 otherwise we may find the empty default sheet "Sheet1" in
273 rSrcDoc, even if the document does not exist. */
274 if( pMed->GetError() == ERRCODE_NONE )
275 {
276 // no sheet name -> use first sheet
277 if ( !aTabName.isEmpty() && !bAutoTab )
278 bFound = rSrcDoc.GetTable( aTabName, nSrcTab );
279 else
280 bFound = true;
281 }
282
283 if (bFound)
284 rDoc.TransferTab( rSrcDoc, nSrcTab, nTab, false, // don't insert anew
285 (nMode == ScLinkMode::VALUE) ); // only values?
286 else
287 {
288 rDoc.DeleteAreaTab( 0,0,rDoc.MaxCol(),rDoc.MaxRow(), nTab, InsertDeleteFlags::ALL );
289
290 bool bShowError = true;
291 if ( nMode == ScLinkMode::VALUE )
292 {
293 // Value link (used with external references in formulas):
294 // Look for formulas that reference the sheet, and put errors in the referenced cells.
295
296 ScRangeList aErrorCells; // cells on the linked sheets that need error values
297
298 ScCellIterator aIter(rDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB)); // all sheets
299 for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
300 {
301 if (aIter.getType() != CELLTYPE_FORMULA)
302 continue;
303
304 ScFormulaCell* pCell = aIter.getFormulaCell();
305 ScDetectiveRefIter aRefIter(rDoc, pCell);
306 ScRange aRefRange;
307 while ( aRefIter.GetNextRef( aRefRange ) )
308 {
309 if ( aRefRange.aStart.Tab() <= nTab && aRefRange.aEnd.Tab() >= nTab )
310 {
311 // use first cell of range references (don't fill potentially large ranges)
312
313 aErrorCells.Join( ScRange( aRefRange.aStart ) );
314 }
315 }
316 }
317
318 size_t nRanges = aErrorCells.size();
319 if ( nRanges ) // found any?
320 {
321 ScTokenArray aTokenArr(rDoc);
322 aTokenArr.AddOpCode( ocNotAvail );
323 aTokenArr.AddOpCode( ocOpen );
324 aTokenArr.AddOpCode( ocClose );
325 aTokenArr.AddOpCode( ocStop );
326
327 for (size_t nPos=0; nPos < nRanges; nPos++)
328 {
329 const ScRange & rRange = aErrorCells[ nPos ];
330 SCCOL nStartCol = rRange.aStart.Col();
331 SCROW nStartRow = rRange.aStart.Row();
332 SCCOL nEndCol = rRange.aEnd.Col();
333 SCROW nEndRow = rRange.aEnd.Row();
334 for (SCROW nRow=nStartRow; nRow<=nEndRow; nRow++)
335 for (SCCOL nCol=nStartCol; nCol<=nEndCol; nCol++)
336 {
337 ScAddress aDestPos( nCol, nRow, nTab );
338 rDoc.SetFormula(aDestPos, aTokenArr);
339 }
340 }
341
342 bShowError = false;
343 }
344 // if no references were found, insert error message (don't leave the sheet empty)
345 }
346
347 if ( bShowError )
348 {
349 // Normal link or no references: put error message on sheet.
350
351 rDoc.SetString( 0,0,nTab, ScResId(STR_LINKERROR) );
352 rDoc.SetString( 0,1,nTab, ScResId(STR_LINKERRORFILE) );
353 rDoc.SetString( 1,1,nTab, aNewUrl );
354 rDoc.SetString( 0,2,nTab, ScResId(STR_LINKERRORTAB) );
355 rDoc.SetString( 1,2,nTab, aTabName );
356 }
357
358 bNotFound = true;
359 }
360
361 if ( bNewUrlName || aFilterName != rNewFilter ||
362 aOptions != aNewOpt || pNewOptions ||
363 nNewRefreshDelaySeconds != GetRefreshDelaySeconds() )
364 rDoc.SetLink( nTab, nMode, aNewUrl, rNewFilter, aNewOpt,
365 aTabName, nNewRefreshDelaySeconds );
366 }
367 }
368
369 // memorize new settings
370
371 if ( bNewUrlName )
372 aFileName = aNewUrl;
373 if (aFilterName != rNewFilter)
374 aFilterName = rNewFilter;
375 if (aOptions != aNewOpt)
376 aOptions = aNewOpt;
377
378 // clean up
379
380 aRef->DoClose();
381
382 // Undo
383
384 if (bAddUndo && bUndo)
385 pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
386 std::make_unique<ScUndoRefreshLink>( pImpl->m_pDocSh, std::move(pUndoDoc) ) );
387
388 // Paint (may be several tables)
389
390 pImpl->m_pDocSh->PostPaint( ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB),
392 aModificator.SetDocumentModified();
393
394 if (bNotFound)
395 {
397 }
398
399 rDoc.SetInLinkUpdate( false );
400
401 // notify Uno objects (for XRefreshListener)
404 aHint.SetSheetLink( aFileName );
405 rDoc.BroadcastUno( aHint );
406
407 return true;
408}
409
410IMPL_LINK_NOARG(ScTableLink, RefreshHdl, Timer *, void)
411{
412 Refresh( aFileName, aFilterName, nullptr, GetRefreshDelaySeconds() );
413}
414
415IMPL_LINK( ScTableLink, TableEndEditHdl, ::sfx2::SvBaseLink&, rLink, void )
416{
417 pImpl->m_aEndEditLink.Call( rLink );
418 bInEdit = false;
419}
420
421// === ScDocumentLoader ==================================================
422
423OUString ScDocumentLoader::GetOptions( const SfxMedium& rMedium )
424{
425 SfxItemSet* pSet = rMedium.GetItemSet();
426 const SfxStringItem* pItem;
427 if ( pSet && (pItem = pSet->GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
428 return pItem->GetValue();
429
430 return OUString();
431}
432
433bool ScDocumentLoader::GetFilterName( const OUString& rFileName,
434 OUString& rFilter, OUString& rOptions,
435 bool bWithContent, bool bWithInteraction )
436{
437 SfxObjectShell* pDocSh = SfxObjectShell::GetFirst( checkSfxObjectShell<ScDocShell> );
438 while ( pDocSh )
439 {
440 if ( pDocSh->HasName() )
441 {
442 SfxMedium* pMed = pDocSh->GetMedium();
443 if ( pMed->GetName() == rFileName )
444 {
445 rFilter = pMed->GetFilter()->GetFilterName();
446 rOptions = GetOptions(*pMed);
447 return true;
448 }
449 }
450 pDocSh = SfxObjectShell::GetNext( *pDocSh, checkSfxObjectShell<ScDocShell> );
451 }
452
453 INetURLObject aUrl( rFileName );
454 INetProtocol eProt = aUrl.GetProtocol();
455 if ( eProt == INetProtocol::NotValid ) // invalid URL?
456 return false; // abort without creating a medium
457
458 // Filter detection
459
460 std::shared_ptr<const SfxFilter> pSfxFilter;
461 auto pMedium = std::make_unique<SfxMedium>( rFileName, StreamMode::STD_READ );
463 {
464 if ( bWithInteraction )
465 pMedium->UseInteractionHandler(true); // #i73992# no longer called from GuessFilter
466
467 SfxFilterMatcher aMatcher("scalc");
468 if( bWithContent )
469 aMatcher.GuessFilter( *pMedium, pSfxFilter );
470 else
471 aMatcher.GuessFilterIgnoringContent( *pMedium, pSfxFilter );
472 }
473
474 bool bOK = false;
475 if ( pMedium->GetError() == ERRCODE_NONE )
476 {
477 if ( pSfxFilter )
478 rFilter = pSfxFilter->GetFilterName();
479 else
480 rFilter = ScDocShell::GetOwnFilterName(); // otherwise Calc file
481 bOK = !rFilter.isEmpty();
482 }
483
484 return bOK;
485}
486
487void ScDocumentLoader::RemoveAppPrefix( OUString& rFilterName )
488{
489 OUString aAppPrefix( STRING_SCAPP + ": ");
490 if (rFilterName.startsWith( aAppPrefix))
491 rFilterName = rFilterName.copy( aAppPrefix.getLength());
492}
493
494SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, std::shared_ptr<const SfxFilter> const & pFilter,
495 const OUString& rOptions, weld::Window* pInteractionParent )
496{
497 // Always create SfxItemSet so ScDocShell can set options.
498 auto pSet = std::make_shared<SfxAllItemSet>( SfxGetpApp()->GetPool() );
499 if ( !rOptions.isEmpty() )
500 pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, rOptions ) );
501
502 if (pInteractionParent)
503 {
504 css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
505 css::uno::Reference<css::task::XInteractionHandler> xIHdl(css::task::InteractionHandler::createWithParent(xContext,
506 pInteractionParent->GetXWindow()), css::uno::UNO_QUERY_THROW);
507 pSet->Put(SfxUnoAnyItem(SID_INTERACTIONHANDLER, css::uno::Any(xIHdl)));
508 }
509
510 SfxMedium *pRet = new SfxMedium( rFileName, StreamMode::STD_READ, pFilter, std::move(pSet) );
511 if (pInteractionParent)
512 pRet->UseInteractionHandler(true); // to enable the filter options dialog
513 return pRet;
514}
515
516ScDocumentLoader::ScDocumentLoader(const OUString& rFileName,
517 OUString& rFilterName, OUString& rOptions,
518 sal_uInt32 nRekCnt, weld::Window* pInteractionParent,
519 css::uno::Reference<css::io::XInputStream> xInputStream)
520 : pDocShell(nullptr)
521 , pMedium(nullptr)
522{
523 if ( rFilterName.isEmpty() )
524 GetFilterName(rFileName, rFilterName, rOptions, true, pInteractionParent != nullptr);
525
526 std::shared_ptr<const SfxFilter> pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( rFilterName );
527
528 pMedium = CreateMedium(rFileName, pFilter, rOptions, pInteractionParent);
529 if (xInputStream.is())
530 pMedium->setStreamToLoadFrom(xInputStream, true);
531 if ( pMedium->GetError() != ERRCODE_NONE )
532 return ;
533
534 pDocShell = new ScDocShell( SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS );
535 aRef = pDocShell;
536
538 ScExtDocOptions* pExtDocOpt = rDoc.GetExtDocOptions();
539 if( !pExtDocOpt )
540 {
541 rDoc.SetExtDocOptions( std::make_unique<ScExtDocOptions>() );
542 pExtDocOpt = rDoc.GetExtDocOptions();
543 }
544 pExtDocOpt->GetDocSettings().mnLinkCnt = nRekCnt;
545
547
548 OUString aNew = GetOptions(*pMedium); // options are set per dialog on load
549 if (!aNew.isEmpty() && aNew != rOptions)
550 rOptions = aNew;
551}
552
554{
555 if ( aRef.is() )
556 aRef->DoClose();
557 else
558 delete pMedium;
559}
560
562{
563 if ( aRef.is() )
564 {
565 // release reference without calling DoClose - caller must
566 // have another reference to the doc and call DoClose later
567
568 pDocShell = nullptr;
569 pMedium = nullptr;
570 aRef.clear();
571 }
572}
573
575{
576 return pDocShell ? &pDocShell->GetDocument() : nullptr;
577}
578
580{
581 if ( pDocShell && pMedium )
582 return pMedium->GetError() != ERRCODE_NONE;
583 else
584 return true;
585}
586
588{
589 if ( pDocShell )
590 return pDocShell->GetTitle();
591 else
592 return OUString();
593}
594
595/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SCTAB MAXTAB
Definition: address.hxx:70
SfxApplication * SfxGetpApp()
const OUString & GetValue() const
INetProtocol GetProtocol() const
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
Walk through all cells in an area.
Definition: dociter.hxx:206
CellType getType() const
Definition: dociter.hxx:233
ScFormulaCell * getFormulaCell()
Definition: dociter.hxx:236
Iterator for references in a formula cell.
Definition: formulaiter.hxx:32
bool GetNextRef(ScRange &rRange)
Definition: formulaiter.cxx:52
Create before modifications of the document and destroy thereafter.
Definition: docsh.hxx:455
void SetDocumentModified()
Definition: docsh.cxx:3297
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
static OUString GetOwnFilterName()
Definition: docsh.cxx:2818
static bool HasAutomaticTableName(std::u16string_view rFilter)
Definition: docsh.cxx:2853
static SfxMedium * CreateMedium(const OUString &rFileName, std::shared_ptr< const SfxFilter > const &pFilter, const OUString &rOptions, weld::Window *pInteractionParent=nullptr)
Create SfxMedium for stream read with SfxFilter and filter options set at the medium's SfxItemSet.
Definition: tablink.cxx:494
ScDocumentLoader(const OUString &rFileName, OUString &rFilterName, OUString &rOptions, sal_uInt32 nRekCnt=0, weld::Window *pInteractionParent=nullptr, css::uno::Reference< css::io::XInputStream > xInputStream=css::uno::Reference< css::io::XInputStream >())
Definition: tablink.cxx:516
static void RemoveAppPrefix(OUString &rFilterName)
Definition: tablink.cxx:487
void ReleaseDocRef()
Definition: tablink.cxx:561
static OUString GetOptions(const SfxMedium &rMedium)
Definition: tablink.cxx:423
static bool GetFilterName(const OUString &rFileName, OUString &rFilter, OUString &rOptions, bool bWithContent, bool bWithInteraction)
Returns the filter name and options from a file name.
Definition: tablink.cxx:433
SfxObjectShellRef aRef
Definition: tablink.hxx:80
bool IsError() const
Definition: tablink.cxx:579
ScDocShell * pDocShell
Definition: tablink.hxx:79
OUString GetTitle() const
Definition: tablink.cxx:587
SfxMedium * pMedium
Definition: tablink.hxx:81
ScDocument * GetDocument()
Definition: tablink.cxx:574
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
Definition: documen3.cxx:538
SC_DLLPUBLIC sal_uLong TransferTab(ScDocument &rSrcDoc, SCTAB nSrcPos, SCTAB nDestPos, bool bInsertNew=true, bool bResultsOnly=false)
Definition: documen2.cxx:937
SC_DLLPUBLIC void SetFormula(const ScAddress &rPos, const ScTokenArray &rArray)
Definition: documen2.cxx:1096
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:454
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:264
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:891
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
Definition: document.cxx:865
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:892
void SetInLinkUpdate(bool bSet)
Definition: documen8.cxx:776
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3422
ScExtDocOptions * GetExtDocOptions()
Definition: document.hxx:643
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:510
void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, InsertDeleteFlags nFlags, bool bMarked, ScDocument &rDestDoc, const ScMarkData *pMarks=nullptr, bool bColRowFlags=true)
Definition: document.cxx:2072
void SetLink(SCTAB nTab, ScLinkMode nMode, const OUString &rDoc, const OUString &rFilter, const OUString &rOptions, const OUString &rTabName, sal_uLong nRefreshDelay)
Definition: documen3.cxx:552
SC_DLLPUBLIC void SetExtDocOptions(std::unique_ptr< ScExtDocOptions > pNewOptions)
Definition: documen3.cxx:2032
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
Definition: document.cxx:1951
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
Definition: documen3.cxx:517
bool IsLinked(SCTAB nTab) const
Definition: documen3.cxx:491
bool IsUndoEnabled() const
Definition: document.hxx:1593
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:217
void BroadcastUno(const SfxHint &rHint)
Definition: documen3.cxx:958
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:317
Extended options held by an ScDocument containing additional settings for filters.
Definition: scextopt.hxx:77
const ScExtDocSettings & GetDocSettings() const
Definition: scextopt.cxx:170
static SC_DLLPUBLIC OUString GetDocTabName(std::u16string_view rFileName, std::u16string_view rTabName)
Definition: global2.cxx:324
static SC_DLLPUBLIC ::utl::TransliterationWrapper & GetTransliteration()
Definition: global.cxx:1024
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
Definition: global2.cxx:287
void SetSheetLink(const OUString &rSourceUrl)
Definition: hints.cxx:62
void Join(const ScRange &, bool bIsInList=false)
Definition: rangelst.cxx:152
size_t size() const
Definition: rangelst.hxx:89
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
sal_Int32 GetRefreshDelaySeconds() const
void StopRefreshTimer()
void SetRefreshHandler(const Link< Timer *, void > &rLink)
void SetRefreshControl(std::unique_ptr< ScRefreshTimerControl > const *pp)
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
Definition: token.cxx:2265
ErrCode GuessFilterIgnoringContent(SfxMedium const &rMedium, std::shared_ptr< const SfxFilter > &) const
ErrCode GuessFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const std::shared_ptr< const SfxFilter > & GetFilter() const
void setStreamToLoadFrom(const css::uno::Reference< css::io::XInputStream > &xInputStream, bool bIsReadOnly)
void UseInteractionHandler(bool)
SfxItemSet * GetItemSet() const
ErrCode GetError() const
const OUString & GetName() const
bool HasName() const
static SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
SfxMedium * GetMedium() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
bool DoLoad(SfxMedium *pMedium)
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
bool is() const
static bool IsFuzzing()
virtual css::uno::Reference< css::awt::XWindow > GetXWindow()=0
int nCount
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2717
@ SCDOCMODE_UNDO
Definition: document.hxx:257
#define ERRCODE_NONE
SotClipboardFormatId
@ CELLTYPE_FORMULA
Definition: global.hxx:275
constexpr OUStringLiteral STRING_SCAPP
Definition: global.hxx:58
ScLinkMode
Definition: global.hxx:214
OUString aName
sal_uInt16 nPos
SfxLinkUpdateMode
Reference< XComponentContext > getProcessComponentContext()
ocClose
ocStop
ocOpen
ocNotAvail
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
sal_uInt32 mnLinkCnt
Recursive counter for loading external documents.
Definition: scextopt.hxx:31
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
INetProtocol