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 if ( const SfxStringItem* pItem = rMedium.GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS ) )
426 return pItem->GetValue();
427
428 return OUString();
429}
430
431bool ScDocumentLoader::GetFilterName( const OUString& rFileName,
432 OUString& rFilter, OUString& rOptions,
433 bool bWithContent, bool bWithInteraction )
434{
435 SfxObjectShell* pDocSh = SfxObjectShell::GetFirst( checkSfxObjectShell<ScDocShell> );
436 while ( pDocSh )
437 {
438 if ( pDocSh->HasName() )
439 {
440 SfxMedium* pMed = pDocSh->GetMedium();
441 if ( pMed->GetName() == rFileName )
442 {
443 rFilter = pMed->GetFilter()->GetFilterName();
444 rOptions = GetOptions(*pMed);
445 return true;
446 }
447 }
448 pDocSh = SfxObjectShell::GetNext( *pDocSh, checkSfxObjectShell<ScDocShell> );
449 }
450
451 INetURLObject aUrl( rFileName );
452 INetProtocol eProt = aUrl.GetProtocol();
453 if ( eProt == INetProtocol::NotValid ) // invalid URL?
454 return false; // abort without creating a medium
455
456 // Filter detection
457
458 std::shared_ptr<const SfxFilter> pSfxFilter;
459 auto pMedium = std::make_unique<SfxMedium>( rFileName, StreamMode::STD_READ );
461 {
462 if ( bWithInteraction )
463 pMedium->UseInteractionHandler(true); // #i73992# no longer called from GuessFilter
464
465 SfxFilterMatcher aMatcher("scalc");
466 if( bWithContent )
467 aMatcher.GuessFilter( *pMedium, pSfxFilter );
468 else
469 aMatcher.GuessFilterIgnoringContent( *pMedium, pSfxFilter );
470 }
471
472 bool bOK = false;
473 if ( pMedium->GetError() == ERRCODE_NONE )
474 {
475 if ( pSfxFilter )
476 rFilter = pSfxFilter->GetFilterName();
477 else
478 rFilter = ScDocShell::GetOwnFilterName(); // otherwise Calc file
479 bOK = !rFilter.isEmpty();
480 }
481
482 return bOK;
483}
484
485void ScDocumentLoader::RemoveAppPrefix( OUString& rFilterName )
486{
487 OUString aAppPrefix( STRING_SCAPP + ": ");
488 if (rFilterName.startsWith( aAppPrefix))
489 rFilterName = rFilterName.copy( aAppPrefix.getLength());
490}
491
492SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, std::shared_ptr<const SfxFilter> const & pFilter,
493 const OUString& rOptions, weld::Window* pInteractionParent )
494{
495 // Always create SfxItemSet so ScDocShell can set options.
496 auto pSet = std::make_shared<SfxAllItemSet>( SfxGetpApp()->GetPool() );
497 if ( !rOptions.isEmpty() )
498 pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, rOptions ) );
499
500 if (pInteractionParent)
501 {
502 css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
503 css::uno::Reference<css::task::XInteractionHandler> xIHdl(css::task::InteractionHandler::createWithParent(xContext,
504 pInteractionParent->GetXWindow()), css::uno::UNO_QUERY_THROW);
505 pSet->Put(SfxUnoAnyItem(SID_INTERACTIONHANDLER, css::uno::Any(xIHdl)));
506 }
507
508 SfxMedium *pRet = new SfxMedium( rFileName, StreamMode::STD_READ, pFilter, std::move(pSet) );
509 if (pInteractionParent)
510 pRet->UseInteractionHandler(true); // to enable the filter options dialog
511 return pRet;
512}
513
514ScDocumentLoader::ScDocumentLoader(const OUString& rFileName,
515 OUString& rFilterName, OUString& rOptions,
516 sal_uInt32 nRekCnt, weld::Window* pInteractionParent,
517 css::uno::Reference<css::io::XInputStream> xInputStream)
518 : pDocShell(nullptr)
519 , pMedium(nullptr)
520{
521 if ( rFilterName.isEmpty() )
522 GetFilterName(rFileName, rFilterName, rOptions, true, pInteractionParent != nullptr);
523
524 std::shared_ptr<const SfxFilter> pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( rFilterName );
525
526 pMedium = CreateMedium(rFileName, pFilter, rOptions, pInteractionParent);
527 if (xInputStream.is())
528 pMedium->setStreamToLoadFrom(xInputStream, true);
529 if ( pMedium->GetError() != ERRCODE_NONE )
530 return ;
531
532 pDocShell = new ScDocShell( SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS );
533 aRef = pDocShell;
534
536 ScExtDocOptions* pExtDocOpt = rDoc.GetExtDocOptions();
537 if( !pExtDocOpt )
538 {
539 rDoc.SetExtDocOptions( std::make_unique<ScExtDocOptions>() );
540 pExtDocOpt = rDoc.GetExtDocOptions();
541 }
542 pExtDocOpt->GetDocSettings().mnLinkCnt = nRekCnt;
543
545
546 OUString aNew = GetOptions(*pMedium); // options are set per dialog on load
547 if (!aNew.isEmpty() && aNew != rOptions)
548 rOptions = aNew;
549}
550
552{
553 if ( aRef.is() )
554 aRef->DoClose();
555 else
556 delete pMedium;
557}
558
560{
561 if ( aRef.is() )
562 {
563 // release reference without calling DoClose - caller must
564 // have another reference to the doc and call DoClose later
565
566 pDocShell = nullptr;
567 pMedium = nullptr;
568 aRef.clear();
569 }
570}
571
573{
574 return pDocShell ? &pDocShell->GetDocument() : nullptr;
575}
576
578{
579 if ( pDocShell && pMedium )
580 return pMedium->GetError() != ERRCODE_NONE;
581 else
582 return true;
583}
584
586{
587 if ( pDocShell )
588 return pDocShell->GetTitle();
589 else
590 return OUString();
591}
592
593/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SCTAB MAXTAB
Definition: address.hxx:70
SfxApplication * SfxGetpApp()
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:3315
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
static OUString GetOwnFilterName()
Definition: docsh.cxx:2842
static bool HasAutomaticTableName(std::u16string_view rFilter)
Definition: docsh.cxx:2877
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:492
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:514
static void RemoveAppPrefix(OUString &rFilterName)
Definition: tablink.cxx:485
void ReleaseDocRef()
Definition: tablink.cxx:559
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:431
SfxObjectShellRef aRef
Definition: tablink.hxx:80
bool IsError() const
Definition: tablink.cxx:577
ScDocShell * pDocShell
Definition: tablink.hxx:79
OUString GetTitle() const
Definition: tablink.cxx:585
SfxMedium * pMedium
Definition: tablink.hxx:81
ScDocument * GetDocument()
Definition: tablink.cxx:572
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
Definition: documen3.cxx:530
SC_DLLPUBLIC sal_uLong TransferTab(ScDocument &rSrcDoc, SCTAB nSrcPos, SCTAB nDestPos, bool bInsertNew=true, bool bResultsOnly=false)
Definition: documen2.cxx:946
SC_DLLPUBLIC void SetFormula(const ScAddress &rPos, const ScTokenArray &rArray)
Definition: documen2.cxx:1135
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:449
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:244
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
Definition: document.cxx:837
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
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:3391
ScExtDocOptions * GetExtDocOptions()
Definition: document.hxx:644
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:502
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:2041
void SetLink(SCTAB nTab, ScLinkMode nMode, const OUString &rDoc, const OUString &rFilter, const OUString &rOptions, const OUString &rTabName, sal_uLong nRefreshDelay)
Definition: documen3.cxx:544
SC_DLLPUBLIC void SetExtDocOptions(std::unique_ptr< ScExtDocOptions > pNewOptions)
Definition: documen3.cxx:2016
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
Definition: document.cxx:1920
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
Definition: documen3.cxx:509
bool IsLinked(SCTAB nTab) const
Definition: documen3.cxx:486
bool IsUndoEnabled() const
Definition: document.hxx:1595
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:204
void BroadcastUno(const SfxHint &rHint)
Definition: documen3.cxx:952
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
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:1026
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 SAL_WARN_UNUSED_RESULT 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 SAL_WARN_UNUSED_RESULT 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:2720
@ SCDOCMODE_UNDO
Definition: document.hxx:258
#define ERRCODE_NONE
SotClipboardFormatId
@ CELLTYPE_FORMULA
Definition: global.hxx:276
constexpr OUStringLiteral STRING_SCAPP
Definition: global.hxx:58
ScLinkMode
Definition: global.hxx:215
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