LibreOffice Module sc (master)  1
linkuno.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/lang/IndexOutOfBoundsException.hpp>
23 #include <comphelper/sequence.hxx>
24 #include <formula/token.hxx>
25 #include <svl/hint.hxx>
26 #include <sfx2/linkmgr.hxx>
27 #include <vcl/svapp.hxx>
28 #include <svl/sharedstringpool.hxx>
29 
30 #include <linkuno.hxx>
31 #include <miscuno.hxx>
32 #include <convuno.hxx>
33 #include <docsh.hxx>
34 #include <docfunc.hxx>
35 #include <tablink.hxx>
36 #include <arealink.hxx>
37 #include <hints.hxx>
38 #include <unonames.hxx>
39 #include <rangeseq.hxx>
40 #include <scmatrix.hxx>
41 #include <documentlinkmgr.hxx>
42 
43 #include <string_view>
44 #include <vector>
45 
46 using namespace com::sun::star;
47 using namespace formula;
48 using ::com::sun::star::uno::Any;
49 using ::com::sun::star::uno::Sequence;
50 using ::com::sun::star::lang::IllegalArgumentException;
51 using ::com::sun::star::uno::RuntimeException;
52 using ::std::vector;
53 
54 // used for sheet- and area link:
56 {
57  static const SfxItemPropertyMapEntry aSheetLinkMap_Impl[] =
58  {
64  { u"", 0, css::uno::Type(), 0, 0 }
65  };
66  return aSheetLinkMap_Impl;
67 }
68 
69 SC_SIMPLE_SERVICE_INFO( ScAreaLinkObj, "ScAreaLinkObj", "com.sun.star.sheet.CellAreaLink" )
70 SC_SIMPLE_SERVICE_INFO( ScAreaLinksObj, "ScAreaLinksObj", "com.sun.star.sheet.CellAreaLinks" )
71 SC_SIMPLE_SERVICE_INFO( ScDDELinkObj, "ScDDELinkObj", "com.sun.star.sheet.DDELink" )
72 SC_SIMPLE_SERVICE_INFO( ScDDELinksObj, "ScDDELinksObj", "com.sun.star.sheet.DDELinks" )
73 SC_SIMPLE_SERVICE_INFO( ScSheetLinkObj, "ScSheetLinkObj", "com.sun.star.sheet.SheetLink" )
74 SC_SIMPLE_SERVICE_INFO( ScSheetLinksObj, "ScSheetLinksObj", "com.sun.star.sheet.SheetLinks" )
75 
76 ScSheetLinkObj::ScSheetLinkObj(ScDocShell* pDocSh, const OUString& rName) :
77  aPropSet( lcl_GetSheetLinkMap() ),
78  pDocShell( pDocSh ),
79  aFileName( rName )
80 {
81  pDocShell->GetDocument().AddUnoObject(*this);
82 }
83 
85 {
87 
88  if (pDocShell)
89  pDocShell->GetDocument().RemoveUnoObject(*this);
90 }
91 
93 {
95  // UpdateRef is not needed here
96 
97  if ( auto pRefreshHint = dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
98  {
99  if ( pRefreshHint->GetLinkType() == ScLinkRefType::SHEET && pRefreshHint->GetUrl() == aFileName )
100  Refreshed_Impl();
101  }
102  else
103  {
104  if ( rHint.GetId() == SfxHintId::Dying )
105  pDocShell = nullptr; // pointer is invalid
106  }
107 }
108 
110 {
111  if (pDocShell)
112  {
113  sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
114  size_t nCount = pLinkManager->GetLinks().size();
115  for (size_t i=0; i<nCount; i++)
116  {
117  ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
118  if (auto pTabLink = dynamic_cast<ScTableLink*>( pBase))
119  {
120  if ( pTabLink->GetFileName() == aFileName )
121  return pTabLink;
122  }
123  }
124  }
125  return nullptr; // not found
126 }
127 
128 // XNamed
129 
130 OUString SAL_CALL ScSheetLinkObj::getName()
131 {
132  SolarMutexGuard aGuard;
133  return getFileName(); // Name is the same as filename (URL)
134 }
135 
136 void SAL_CALL ScSheetLinkObj::setName( const OUString& aName )
137 {
138  SolarMutexGuard aGuard;
139  setFileName(aName); // Name is the same as filename (URL)
140 }
141 
142 // XRefreshable
143 
144 void SAL_CALL ScSheetLinkObj::refresh()
145 {
146  SolarMutexGuard aGuard;
147  ScTableLink* pLink = GetLink_Impl();
148  if (pLink)
149  pLink->Refresh( pLink->GetFileName(), pLink->GetFilterName(), nullptr, pLink->GetRefreshDelaySeconds() );
150 }
151 
153  const uno::Reference<util::XRefreshListener >& xListener )
154 {
155  SolarMutexGuard aGuard;
156  aRefreshListeners.push_back( xListener );
157 
158  // hold one additional ref to keep this object alive as long as there are listeners
159  if ( aRefreshListeners.size() == 1 )
160  acquire();
161 }
162 
164  const uno::Reference<util::XRefreshListener >& xListener )
165 {
166  SolarMutexGuard aGuard;
167  size_t nCount = aRefreshListeners.size();
168  for ( size_t n=nCount; n--; )
169  {
170  uno::Reference<util::XRefreshListener>& rObj = aRefreshListeners[n];
171  if ( rObj == xListener )
172  {
173  aRefreshListeners.erase( aRefreshListeners.begin() + n );
174  if ( aRefreshListeners.empty() )
175  release(); // release ref for listeners
176  break;
177  }
178  }
179 }
180 
182 {
183  lang::EventObject aEvent;
184  aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
185  for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners)
186  xRefreshListener->refreshed( aEvent );
187 }
188 
189 void ScSheetLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefresh )
190 {
191  ScTableLink* pLink = GetLink_Impl();
192  if( pLink )
193  pLink->SetRefreshDelay( static_cast<sal_uLong>(nRefresh) );
194 }
195 
196 // XPropertySet
197 
198 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScSheetLinkObj::getPropertySetInfo()
199 {
200  SolarMutexGuard aGuard;
201  static uno::Reference<beans::XPropertySetInfo> aRef(
202  new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
203  return aRef;
204 }
205 
207  const OUString& aPropertyName, const uno::Any& aValue )
208 {
209  SolarMutexGuard aGuard;
210  OUString aValStr;
211  if ( aPropertyName == SC_UNONAME_LINKURL )
212  {
213  if ( aValue >>= aValStr )
214  setFileName( aValStr );
215  }
216  else if ( aPropertyName == SC_UNONAME_FILTER )
217  {
218  if ( aValue >>= aValStr )
219  setFilter( aValStr );
220  }
221  else if ( aPropertyName == SC_UNONAME_FILTOPT )
222  {
223  if ( aValue >>= aValStr )
224  setFilterOptions( aValStr );
225  }
226  else if ( aPropertyName == SC_UNONAME_REFPERIOD )
227  {
228  sal_Int32 nRefresh = 0;
229  if ( aValue >>= nRefresh )
230  setRefreshDelay( nRefresh );
231  }
232  else if ( aPropertyName == SC_UNONAME_REFDELAY )
233  {
234  sal_Int32 nRefresh = 0;
235  if ( aValue >>= nRefresh )
236  setRefreshDelay( nRefresh );
237  }
238 }
239 
240 uno::Any SAL_CALL ScSheetLinkObj::getPropertyValue( const OUString& aPropertyName )
241 {
242  SolarMutexGuard aGuard;
243  uno::Any aRet;
244  if ( aPropertyName == SC_UNONAME_LINKURL )
245  aRet <<= getFileName();
246  else if ( aPropertyName == SC_UNONAME_FILTER )
247  aRet <<= getFilter();
248  else if ( aPropertyName == SC_UNONAME_FILTOPT )
249  aRet <<= getFilterOptions();
250  else if ( aPropertyName == SC_UNONAME_REFPERIOD )
251  aRet <<= getRefreshDelay();
252  else if ( aPropertyName == SC_UNONAME_REFDELAY )
253  aRet <<= getRefreshDelay();
254  return aRet;
255 }
256 
258 
259 // internal:
260 
261 OUString ScSheetLinkObj::getFileName() const
262 {
263  SolarMutexGuard aGuard;
264  return aFileName;
265 }
266 
267 void ScSheetLinkObj::setFileName(const OUString& rNewName)
268 {
269  SolarMutexGuard aGuard;
270  ScTableLink* pLink = GetLink_Impl();
271  if (!pLink)
272  return;
273 
274  // pLink->Refresh with a new file name confuses sfx2::LinkManager
275  // therefore we transplant the sheets manually and create new links with UpdateLinks
276 
277  OUString aNewStr(ScGlobal::GetAbsDocName( rNewName, pDocShell ));
278 
279  // first transplant the sheets
280 
281  ScDocument& rDoc = pDocShell->GetDocument();
282  SCTAB nTabCount = rDoc.GetTableCount();
283  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
284  if ( rDoc.IsLinked(nTab) && rDoc.GetLinkDoc(nTab) == aFileName ) // old file
285  rDoc.SetLink( nTab, rDoc.GetLinkMode(nTab), aNewStr,
286  rDoc.GetLinkFlt(nTab), rDoc.GetLinkOpt(nTab),
287  rDoc.GetLinkTab(nTab),
288  rDoc.GetLinkRefreshDelay(nTab) ); // only change the file
289 
290  // update links
292 
293  pDocShell->UpdateLinks(); // remove old links, possibly set up new ones
294 
295  // copy data
296 
297  aFileName = aNewStr;
298  pLink = GetLink_Impl(); // new link with new name
299  if (pLink)
300  pLink->Update(); // incl. paint & undo for data
301 }
302 
304 {
305  SolarMutexGuard aGuard;
306  OUString aRet;
307  ScTableLink* pLink = GetLink_Impl();
308  if (pLink)
309  aRet = pLink->GetFilterName();
310  return aRet;
311 }
312 
313 void ScSheetLinkObj::setFilter(const OUString& rFilter)
314 {
315  SolarMutexGuard aGuard;
316  ScTableLink* pLink = GetLink_Impl();
317  if (pLink)
318  {
319  pLink->Refresh( aFileName, rFilter, nullptr, pLink->GetRefreshDelaySeconds() );
320  }
321 }
322 
324 {
325  SolarMutexGuard aGuard;
326  OUString aRet;
327  ScTableLink* pLink = GetLink_Impl();
328  if (pLink)
329  aRet = pLink->GetOptions();
330  return aRet;
331 }
332 
333 void ScSheetLinkObj::setFilterOptions(const OUString& FilterOptions)
334 {
335  SolarMutexGuard aGuard;
336  ScTableLink* pLink = GetLink_Impl();
337  if (pLink)
338  {
339  OUString aOptStr(FilterOptions);
340  pLink->Refresh( aFileName, pLink->GetFilterName(), &aOptStr, pLink->GetRefreshDelaySeconds() );
341  }
342 }
343 
345 {
346  SolarMutexGuard aGuard;
347  sal_Int32 nRet = 0;
348  ScTableLink* pLink = GetLink_Impl();
349  if (pLink)
350  nRet = pLink->GetRefreshDelaySeconds();
351  return nRet;
352 }
353 
354 void ScSheetLinkObj::setRefreshDelay(sal_Int32 nRefreshDelay)
355 {
356  SolarMutexGuard aGuard;
357  ModifyRefreshDelay_Impl( nRefreshDelay );
358 }
359 
361  pDocShell( pDocSh )
362 {
364 }
365 
367 {
368  SolarMutexGuard g;
369 
370  if (pDocShell)
372 }
373 
375 {
376  // we don't care about update of references here
377 
378  if ( rHint.GetId() == SfxHintId::Dying )
379  {
380  pDocShell = nullptr; // became invalid
381  }
382 }
383 
384 // XSheetLinks
385 
387 {
388  if (!pDocShell)
389  return nullptr;
390 
391  typedef std::unordered_set<OUString> StrSetType;
392  StrSetType aNames;
393  ScDocument& rDoc = pDocShell->GetDocument();
394  SCTAB nTabCount = rDoc.GetTableCount();
395  sal_Int32 nCount = 0;
396  for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
397  {
398  if (!rDoc.IsLinked(nTab))
399  continue;
400 
401  OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
402  if (aNames.insert(aLinkDoc).second)
403  {
404  // unique document name.
405  if (nCount == nIndex)
406  return new ScSheetLinkObj( pDocShell, aLinkDoc );
407  ++nCount;
408  }
409  }
410 
411  return nullptr; // no document or index too large
412 }
413 
415 {
416  // Name is the same as file name
417 
418  if (pDocShell)
419  {
420  ScDocument& rDoc = pDocShell->GetDocument();
421  SCTAB nTabCount = rDoc.GetTableCount();
422  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
423  if (rDoc.IsLinked(nTab))
424  {
426  OUString aLinkDoc = rDoc.GetLinkDoc( nTab );
427  if ( aLinkDoc == aName )
428  return new ScSheetLinkObj( pDocShell, aName );
429  }
430  }
431 
432  return nullptr;
433 }
434 
435 // XEnumerationAccess
436 uno::Reference<container::XEnumeration> SAL_CALL ScSheetLinksObj::createEnumeration()
437 {
438  SolarMutexGuard aGuard;
439  return new ScIndexEnumeration(this, "com.sun.star.sheet.SheetLinksEnumeration");
440 }
441 
442 // XIndexAccess
443 sal_Int32 SAL_CALL ScSheetLinksObj::getCount()
444 {
445  typedef std::unordered_set<OUString> StrSetType;
446 
447  SolarMutexGuard aGuard;
448  if (!pDocShell)
449  return 0;
450 
451  sal_Int32 nCount = 0;
452 
453  StrSetType aNames;
454  ScDocument& rDoc = pDocShell->GetDocument();
455  SCTAB nTabCount = rDoc.GetTableCount();
456  for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
457  {
458  if (!rDoc.IsLinked(nTab))
459  continue;
460 
461  OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
462  if (aNames.insert(aLinkDoc).second)
463  ++nCount;
464  }
465  return nCount;
466 }
467 
468 uno::Any SAL_CALL ScSheetLinksObj::getByIndex( sal_Int32 nIndex )
469 {
470  SolarMutexGuard aGuard;
471  uno::Reference<beans::XPropertySet> xLink(GetObjectByIndex_Impl(nIndex));
472  if (!xLink.is())
473  throw lang::IndexOutOfBoundsException();
474 
475  return uno::Any(xLink);
476 }
477 
479 {
481 }
482 
484 {
485  SolarMutexGuard aGuard;
486  return ( getCount() != 0 );
487 }
488 
489 uno::Any SAL_CALL ScSheetLinksObj::getByName( const OUString& aName )
490 {
491  SolarMutexGuard aGuard;
492  uno::Reference<beans::XPropertySet> xLink(GetObjectByName_Impl(aName));
493  if (!xLink.is())
494  throw container::NoSuchElementException();
495 
496  return uno::Any(xLink);
497 }
498 
499 sal_Bool SAL_CALL ScSheetLinksObj::hasByName( const OUString& aName )
500 {
501  SolarMutexGuard aGuard;
502  // Name is the same as file name
503 
504  if (pDocShell)
505  {
506  ScDocument& rDoc = pDocShell->GetDocument();
507  SCTAB nTabCount = rDoc.GetTableCount();
508  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
509  if (rDoc.IsLinked(nTab))
510  {
512  OUString aLinkDoc(rDoc.GetLinkDoc( nTab ));
513  if ( aLinkDoc == aName )
514  return true;
515  }
516  }
517  return false;
518 }
519 
520 uno::Sequence<OUString> SAL_CALL ScSheetLinksObj::getElementNames()
521 {
522  typedef std::unordered_set<OUString> StrSetType;
523 
524  SolarMutexGuard aGuard;
525  // Name is the same as file name
526 
527  if (!pDocShell)
528  return uno::Sequence<OUString>();
529 
530  StrSetType aNames;
531  ScDocument& rDoc = pDocShell->GetDocument();
532  SCTAB nTabCount = rDoc.GetTableCount();
533 
534  sal_Int32 nLinkCount = getCount();
535  uno::Sequence<OUString> aSeq(nLinkCount);
536  OUString* pAry = aSeq.getArray();
537  size_t nPos = 0;
538  for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
539  {
540  if (!rDoc.IsLinked(nTab))
541  continue;
542 
543  OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
544  if (aNames.insert(aLinkDoc).second)
545  pAry[nPos++] = aLinkDoc;
546  }
547  OSL_ENSURE( nPos==static_cast<size_t>(nLinkCount), "verzaehlt" );
548  return aSeq;
549 }
550 
551 static ScAreaLink* lcl_GetAreaLink( ScDocShell* pDocShell, size_t nPos )
552 {
553  if (pDocShell)
554  {
555  sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
556  size_t nTotalCount = pLinkManager->GetLinks().size();
557  size_t nAreaCount = 0;
558  for (size_t i=0; i<nTotalCount; i++)
559  {
560  ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
561  if (auto pAreaLink = dynamic_cast<ScAreaLink*>( pBase))
562  {
563  if ( nAreaCount == nPos )
564  return pAreaLink;
565  ++nAreaCount;
566  }
567  }
568  }
569  return nullptr; // not found
570 }
571 
573  aPropSet( lcl_GetSheetLinkMap() ),
574  pDocShell( pDocSh ),
575  nPos( nP )
576 {
578 }
579 
581 {
582  SolarMutexGuard g;
583 
584  if (pDocShell)
586 }
587 
589 {
591  // UpdateRef is not needed here
592 
593  if ( auto pRefreshedHint = dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
594  {
595  if ( pRefreshedHint->GetLinkType() == ScLinkRefType::AREA )
596  {
597  // get this link to compare dest position
599  if ( pLink && pLink->GetDestArea().aStart == pRefreshedHint->GetDestPos() )
600  Refreshed_Impl();
601  }
602  }
603  else
604  {
605  if ( rHint.GetId() == SfxHintId::Dying )
606  pDocShell = nullptr; // pointer is invalid
607  }
608 }
609 
610 // XFileLink
611 
612 void ScAreaLinkObj::Modify_Impl( const OUString* pNewFile, const OUString* pNewFilter,
613  const OUString* pNewOptions, const OUString* pNewSource,
614  const table::CellRangeAddress* pNewDest )
615 {
617  if (!pLink)
618  return;
619 
620  OUString aFile (pLink->GetFile());
621  OUString aFilter (pLink->GetFilter());
622  OUString aOptions (pLink->GetOptions());
623  OUString aSource (pLink->GetSource());
624  ScRange aDest (pLink->GetDestArea());
625  sal_Int32 nRefreshDelaySeconds = pLink->GetRefreshDelaySeconds();
626 
629 
631  pLinkManager->Remove( pLink );
632  pLink = nullptr; // deleted along with remove
633 
634  bool bFitBlock = true; // move, if the size changes with update
635  if (pNewFile)
636  {
637  aFile = ScGlobal::GetAbsDocName( *pNewFile, pDocShell );
638  }
639  if (pNewFilter)
640  aFilter = *pNewFilter;
641  if (pNewOptions)
642  aOptions = *pNewOptions;
643  if (pNewSource)
644  aSource = *pNewSource;
645  if (pNewDest)
646  {
647  ScUnoConversion::FillScRange( aDest, *pNewDest );
648  bFitBlock = false; // new range was specified -> do not move the content
649  }
650  pDocShell->GetDocFunc().InsertAreaLink( aFile, aFilter, aOptions, aSource,
651  aDest, nRefreshDelaySeconds, bFitBlock, true );
652 }
653 
654 void ScAreaLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefreshDelaySeconds )
655 {
657  if( pLink )
658  pLink->SetRefreshDelay( nRefreshDelaySeconds );
659 }
660 
661 // XRefreshable
662 
663 void SAL_CALL ScAreaLinkObj::refresh()
664 {
665  SolarMutexGuard aGuard;
667  if (pLink)
668  pLink->Refresh( pLink->GetFile(), pLink->GetFilter(), pLink->GetSource(), pLink->GetRefreshDelaySeconds() );
669 }
670 
672  const uno::Reference<util::XRefreshListener >& xListener )
673 {
674  SolarMutexGuard aGuard;
675  aRefreshListeners.push_back( xListener );
676 
677  // hold one additional ref to keep this object alive as long as there are listeners
678  if ( aRefreshListeners.size() == 1 )
679  acquire();
680 }
681 
683  const uno::Reference<util::XRefreshListener >& xListener )
684 {
685  SolarMutexGuard aGuard;
686  size_t nCount = aRefreshListeners.size();
687  for ( size_t n=nCount; n--; )
688  {
689  uno::Reference<util::XRefreshListener>& rObj = aRefreshListeners[n];
690  if ( rObj == xListener )
691  {
692  aRefreshListeners.erase( aRefreshListeners.begin() + n );
693  if ( aRefreshListeners.empty() )
694  release(); // release ref for listeners
695  break;
696  }
697 
698  if(n == 0)
699  break;
700  }
701 }
702 
704 {
705  lang::EventObject aEvent;
706  aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
707  for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners)
708  xRefreshListener->refreshed( aEvent );
709 }
710 
711 // XPropertySet
712 
713 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAreaLinkObj::getPropertySetInfo()
714 {
715  SolarMutexGuard aGuard;
716  static uno::Reference<beans::XPropertySetInfo> aRef(
718  return aRef;
719 }
720 
722  const OUString& aPropertyName, const uno::Any& aValue )
723 {
724  SolarMutexGuard aGuard;
725  OUString aValStr;
726  if ( aPropertyName == SC_UNONAME_LINKURL )
727  {
728  if ( aValue >>= aValStr )
729  setFileName( aValStr );
730  }
731  else if ( aPropertyName == SC_UNONAME_FILTER )
732  {
733  if ( aValue >>= aValStr )
734  setFilter( aValStr );
735  }
736  else if ( aPropertyName == SC_UNONAME_FILTOPT )
737  {
738  if ( aValue >>= aValStr )
739  setFilterOptions( aValStr );
740  }
741  else if ( aPropertyName == SC_UNONAME_REFPERIOD )
742  {
743  sal_Int32 nRefresh = 0;
744  if ( aValue >>= nRefresh )
745  setRefreshDelay( nRefresh );
746  }
747  else if ( aPropertyName == SC_UNONAME_REFDELAY )
748  {
749  sal_Int32 nRefresh = 0;
750  if ( aValue >>= nRefresh )
751  setRefreshDelay( nRefresh );
752  }
753 }
754 
755 uno::Any SAL_CALL ScAreaLinkObj::getPropertyValue( const OUString& aPropertyName )
756 {
757  SolarMutexGuard aGuard;
758  uno::Any aRet;
759  if ( aPropertyName == SC_UNONAME_LINKURL )
760  aRet <<= getFileName();
761  else if ( aPropertyName == SC_UNONAME_FILTER )
762  aRet <<= getFilter();
763  else if ( aPropertyName == SC_UNONAME_FILTOPT )
764  aRet <<= getFilterOptions();
765  else if ( aPropertyName == SC_UNONAME_REFPERIOD )
766  aRet <<= getRefreshDelay();
767  else if ( aPropertyName == SC_UNONAME_REFDELAY )
768  aRet <<= getRefreshDelay();
769  return aRet;
770 }
771 
773 
774 // internal:
775 
776 OUString ScAreaLinkObj::getFileName() const
777 {
778  SolarMutexGuard aGuard;
779  OUString aRet;
780  ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, nPos);
781  if (pLink)
782  aRet = pLink->GetFile();
783  return aRet;
784 }
785 
786 void ScAreaLinkObj::setFileName(const OUString& rNewName)
787 {
788  SolarMutexGuard aGuard;
789  Modify_Impl( &rNewName, nullptr, nullptr, nullptr, nullptr );
790 }
791 
792 OUString ScAreaLinkObj::getFilter() const
793 {
794  SolarMutexGuard aGuard;
795  OUString aRet;
797  if (pLink)
798  aRet = pLink->GetFilter();
799  return aRet;
800 }
801 
802 void ScAreaLinkObj::setFilter(const OUString& Filter)
803 {
804  SolarMutexGuard aGuard;
805  Modify_Impl( nullptr, &Filter, nullptr, nullptr, nullptr );
806 }
807 
809 {
810  SolarMutexGuard aGuard;
811  OUString aRet;
813  if (pLink)
814  aRet = pLink->GetOptions();
815  return aRet;
816 }
817 
818 void ScAreaLinkObj::setFilterOptions(const OUString& FilterOptions)
819 {
820  SolarMutexGuard aGuard;
821  Modify_Impl( nullptr, nullptr, &FilterOptions, nullptr, nullptr );
822 }
823 
825 {
826  SolarMutexGuard aGuard;
827  sal_Int32 nRet = 0;
829  if (pLink)
830  nRet = pLink->GetRefreshDelaySeconds();
831  return nRet;
832 }
833 
834 void ScAreaLinkObj::setRefreshDelay(sal_Int32 nRefreshDelay)
835 {
836  SolarMutexGuard aGuard;
837  ModifyRefreshDelay_Impl( nRefreshDelay );
838 }
839 
840 // XAreaLink
841 
842 OUString SAL_CALL ScAreaLinkObj::getSourceArea()
843 {
844  SolarMutexGuard aGuard;
845  OUString aRet;
847  if (pLink)
848  aRet = pLink->GetSource();
849  return aRet;
850 }
851 
852 void SAL_CALL ScAreaLinkObj::setSourceArea( const OUString& aSourceArea )
853 {
854  SolarMutexGuard aGuard;
855  Modify_Impl( nullptr, nullptr, nullptr, &aSourceArea, nullptr );
856 }
857 
858 table::CellRangeAddress SAL_CALL ScAreaLinkObj::getDestArea()
859 {
860  SolarMutexGuard aGuard;
861  table::CellRangeAddress aRet;
863  if (pLink)
864  ScUnoConversion::FillApiRange( aRet, pLink->GetDestArea() );
865  return aRet;
866 }
867 
868 void SAL_CALL ScAreaLinkObj::setDestArea( const table::CellRangeAddress& aDestArea )
869 {
870  SolarMutexGuard aGuard;
871  Modify_Impl( nullptr, nullptr, nullptr, nullptr, &aDestArea );
872 }
873 
875  pDocShell( pDocSh )
876 {
878 }
879 
881 {
882  SolarMutexGuard g;
883 
884  if (pDocShell)
886 }
887 
889 {
890  // we don't care about update of references here
891 
892  if ( rHint.GetId() == SfxHintId::Dying )
893  {
894  pDocShell = nullptr; // became invalid
895  }
896 }
897 
898 // XAreaLinks
899 
901 {
902  if ( pDocShell && nIndex >= 0 && nIndex < getCount() )
903  return new ScAreaLinkObj( pDocShell, static_cast<size_t>(nIndex) );
904 
905  return nullptr; // not found
906 }
907 
908 void SAL_CALL ScAreaLinksObj::insertAtPosition( const table::CellAddress& aDestPos,
909  const OUString& aFileName,
910  const OUString& aSourceArea,
911  const OUString& aFilter,
912  const OUString& aFilterOptions )
913 {
914  SolarMutexGuard aGuard;
915  if (pDocShell)
916  {
917  OUString aFileStr (aFileName);
918  ScAddress aDestAddr( static_cast<SCCOL>(aDestPos.Column), static_cast<SCROW>(aDestPos.Row), aDestPos.Sheet );
919 
920  aFileStr = ScGlobal::GetAbsDocName( aFileStr, pDocShell );
921  pDocShell->GetDocFunc().InsertAreaLink( aFileStr, aFilter, aFilterOptions,
922  aSourceArea, ScRange(aDestAddr),
923  /*nRefreshDelaySeconds*/0, false, true ); // don't move contents
924  }
925 }
926 
927 void SAL_CALL ScAreaLinksObj::removeByIndex( sal_Int32 nIndex )
928 {
929  SolarMutexGuard aGuard;
930  ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, static_cast<size_t>(nIndex));
931  if (pLink)
932  {
934 
936  pLinkManager->Remove( pLink );
937  }
938 }
939 
940 // XEnumerationAccess
941 
942 uno::Reference<container::XEnumeration> SAL_CALL ScAreaLinksObj::createEnumeration()
943 {
944  SolarMutexGuard aGuard;
945  return new ScIndexEnumeration(this, "com.sun.star.sheet.CellAreaLinksEnumeration");
946 }
947 
948 // XIndexAccess
949 
950 sal_Int32 SAL_CALL ScAreaLinksObj::getCount()
951 {
952  SolarMutexGuard aGuard;
953  sal_Int32 nAreaCount = 0;
954  if (pDocShell)
955  {
957  size_t nTotalCount = pLinkManager->GetLinks().size();
958  for (size_t i=0; i<nTotalCount; i++)
959  {
960  ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
961  if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr)
962  ++nAreaCount;
963  }
964  }
965  return nAreaCount;
966 }
967 
968 uno::Any SAL_CALL ScAreaLinksObj::getByIndex( sal_Int32 nIndex )
969 {
970  SolarMutexGuard aGuard;
971  uno::Reference<sheet::XAreaLink> xLink(GetObjectByIndex_Impl(nIndex));
972  if (!xLink.is())
973  throw lang::IndexOutOfBoundsException();
974 
975  return uno::Any(xLink);
976 
977 }
978 
980 {
982 }
983 
985 {
986  SolarMutexGuard aGuard;
987  return ( getCount() != 0 );
988 }
989 
990 ScDDELinkObj::ScDDELinkObj(ScDocShell* pDocSh, const OUString& rA,
991  const OUString& rT, const OUString& rI) :
992  pDocShell( pDocSh ),
993  aAppl( rA ),
994  aTopic( rT ),
995  aItem( rI )
996 {
998 }
999 
1001 {
1002  SolarMutexGuard g;
1003 
1004  if (pDocShell)
1006 }
1007 
1009 {
1011  // UpdateRef is not needed here
1012 
1013  if ( auto pRefreshedHint = dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
1014  {
1015  if ( pRefreshedHint->GetLinkType() == ScLinkRefType::DDE &&
1016  pRefreshedHint->GetDdeAppl() == aAppl &&
1017  pRefreshedHint->GetDdeTopic() == aTopic &&
1018  pRefreshedHint->GetDdeItem() == aItem )
1019  Refreshed_Impl();
1020  }
1021  else
1022  {
1023  if ( rHint.GetId() == SfxHintId::Dying )
1024  pDocShell = nullptr; // pointer is invalid
1025  }
1026 }
1027 
1028 // XNamed
1029 
1030 static OUString lcl_BuildDDEName( std::u16string_view rAppl, std::u16string_view rTopic, std::u16string_view rItem )
1031 {
1032  // Appl|Topic!Item (like Excel)
1033  OUString aRet = OUString::Concat(rAppl) + "|" + rTopic + "!" + rItem;
1034  return aRet;
1035 }
1036 
1037 OUString SAL_CALL ScDDELinkObj::getName()
1038 {
1039  SolarMutexGuard aGuard;
1040  return lcl_BuildDDEName( aAppl, aTopic, aItem );
1041 }
1042 
1043 void SAL_CALL ScDDELinkObj::setName( const OUString& /* aName */ )
1044 {
1045  // name can't be changed (formulas wouldn't find the link)
1046  throw uno::RuntimeException();
1047 }
1048 
1049 // XDDELink
1050 
1051 OUString SAL_CALL ScDDELinkObj::getApplication()
1052 {
1053  SolarMutexGuard aGuard;
1055 
1056  return aAppl;
1057 }
1058 
1059 OUString SAL_CALL ScDDELinkObj::getTopic()
1060 {
1061  SolarMutexGuard aGuard;
1063 
1064  return aTopic;
1065 }
1066 
1067 OUString SAL_CALL ScDDELinkObj::getItem()
1068 {
1069  SolarMutexGuard aGuard;
1071 
1072  return aItem;
1073 }
1074 
1075 // XRefreshable
1076 
1077 void SAL_CALL ScDDELinkObj::refresh()
1078 {
1079  SolarMutexGuard aGuard;
1080  if (pDocShell)
1081  {
1083  rMgr.updateDdeLink(aAppl, aTopic, aItem);
1084  }
1085 }
1086 
1088  const uno::Reference<util::XRefreshListener >& xListener )
1089 {
1090  SolarMutexGuard aGuard;
1091  aRefreshListeners.push_back( xListener );
1092 
1093  // hold one additional ref to keep this object alive as long as there are listeners
1094  if ( aRefreshListeners.size() == 1 )
1095  acquire();
1096 }
1097 
1099  const uno::Reference<util::XRefreshListener >& xListener )
1100 {
1101  SolarMutexGuard aGuard;
1102  size_t nCount = aRefreshListeners.size();
1103  for ( size_t n=nCount; n--; )
1104  {
1105  uno::Reference<util::XRefreshListener>& rObj = aRefreshListeners[n];
1106  if ( rObj == xListener )
1107  {
1108  aRefreshListeners.erase( aRefreshListeners.begin() + n );
1109  if ( aRefreshListeners.empty() )
1110  release(); // release ref for listeners
1111  break;
1112  }
1113  }
1114 }
1115 
1116 // XDDELinkResults
1117 
1118 uno::Sequence< uno::Sequence< uno::Any > > ScDDELinkObj::getResults( )
1119 {
1120  SolarMutexGuard aGuard;
1121  uno::Sequence< uno::Sequence< uno::Any > > aReturn;
1122  bool bSuccess = false;
1123 
1124  if ( pDocShell )
1125  {
1126  ScDocument& rDoc = pDocShell->GetDocument();
1127  size_t nPos = 0;
1128  if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
1129  {
1130  const ScMatrix* pMatrix = rDoc.GetDdeLinkResultMatrix( nPos );
1131  if ( pMatrix )
1132  {
1133  uno::Any aAny;
1134  if ( ScRangeToSequence::FillMixedArray( aAny, pMatrix, true ) )
1135  {
1136  aAny >>= aReturn;
1137  }
1138  }
1139  bSuccess = true;
1140  }
1141  }
1142 
1143  if ( !bSuccess )
1144  {
1145  throw uno::RuntimeException(
1146  "ScDDELinkObj::getResults: failed to get results!" );
1147  }
1148 
1149  return aReturn;
1150 }
1151 
1152 void ScDDELinkObj::setResults( const uno::Sequence< uno::Sequence< uno::Any > >& aResults )
1153 {
1154  SolarMutexGuard aGuard;
1155  bool bSuccess = false;
1156 
1157  if ( pDocShell )
1158  {
1159  ScDocument& rDoc = pDocShell->GetDocument();
1160  size_t nPos = 0;
1161  if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
1162  {
1163  ScMatrixRef xMatrix = ScSequenceToMatrix::CreateMixedMatrix( Any(aResults) );
1164  bSuccess = rDoc.SetDdeLinkResultMatrix( nPos, xMatrix );
1165  }
1166  }
1167 
1168  if ( !bSuccess )
1169  {
1170  throw uno::RuntimeException(
1171  "ScDDELinkObj::setResults: failed to set results!" );
1172  }
1173 }
1174 
1176 {
1177  lang::EventObject aEvent;
1178  aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
1179  for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners)
1180  xRefreshListener->refreshed( aEvent );
1181 }
1182 
1184  pDocShell( pDocSh )
1185 {
1187 }
1188 
1190 {
1191  SolarMutexGuard g;
1192 
1193  if (pDocShell)
1195 }
1196 
1198 {
1199  // we don't care about update of references here
1200 
1201  if ( rHint.GetId() == SfxHintId::Dying )
1202  {
1203  pDocShell = nullptr; // became invalid
1204  }
1205 }
1206 
1207 // XDDELinks
1208 
1210 {
1211  if (pDocShell)
1212  {
1213  OUString aAppl, aTopic, aItem;
1214  if ( pDocShell->GetDocument().GetDdeLinkData( static_cast<size_t>(nIndex), aAppl, aTopic, aItem ) )
1215  return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem );
1216  }
1217  return nullptr;
1218 }
1219 
1221 {
1222  if (pDocShell)
1223  {
1224  OUString aAppl, aTopic, aItem;
1225 
1226  ScDocument& rDoc = pDocShell->GetDocument();
1227  size_t nCount = rDoc.GetDocLinkManager().getDdeLinkCount();
1228  for (size_t i=0; i<nCount; i++)
1229  {
1230  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1231  if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aName )
1232  return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem );
1233  }
1234  }
1235  return nullptr;
1236 }
1237 
1238 // XEnumerationAccess
1239 
1240 uno::Reference<container::XEnumeration> SAL_CALL ScDDELinksObj::createEnumeration()
1241 {
1242  SolarMutexGuard aGuard;
1243  return new ScIndexEnumeration(this, "com.sun.star.sheet.DDELinksEnumeration");
1244 }
1245 
1246 // XIndexAccess
1247 
1248 sal_Int32 SAL_CALL ScDDELinksObj::getCount()
1249 {
1250  SolarMutexGuard aGuard;
1251  sal_Int32 nAreaCount = 0;
1252  if (pDocShell)
1254  return nAreaCount;
1255 }
1256 
1257 uno::Any SAL_CALL ScDDELinksObj::getByIndex( sal_Int32 nIndex )
1258 {
1259  SolarMutexGuard aGuard;
1260  uno::Reference<sheet::XDDELink> xLink(GetObjectByIndex_Impl(nIndex));
1261  if (!xLink.is())
1262  throw lang::IndexOutOfBoundsException();
1263 
1264  return uno::Any(xLink);
1265 }
1266 
1268 {
1270 }
1271 
1273 {
1274  SolarMutexGuard aGuard;
1275  return ( getCount() != 0 );
1276 }
1277 
1278 uno::Any SAL_CALL ScDDELinksObj::getByName( const OUString& aName )
1279 {
1280  SolarMutexGuard aGuard;
1281  uno::Reference<sheet::XDDELink> xLink(GetObjectByName_Impl(aName));
1282  if (!xLink.is())
1283  throw container::NoSuchElementException();
1284 
1285  return uno::Any(xLink);
1286 }
1287 
1288 uno::Sequence<OUString> SAL_CALL ScDDELinksObj::getElementNames()
1289 {
1290  SolarMutexGuard aGuard;
1291  if (pDocShell)
1292  {
1293  OUString aAppl, aTopic, aItem;
1294 
1295  ScDocument& rDoc = pDocShell->GetDocument();
1297  uno::Sequence<OUString> aSeq(nCount);
1298  OUString* pAry = aSeq.getArray();
1299 
1300  for (size_t i=0; i<nCount; i++)
1301  {
1302  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1303  pAry[i] = lcl_BuildDDEName(aAppl, aTopic, aItem);
1304  }
1305  return aSeq;
1306  }
1307  return uno::Sequence<OUString>();
1308 }
1309 
1310 sal_Bool SAL_CALL ScDDELinksObj::hasByName( const OUString& aName )
1311 {
1312  SolarMutexGuard aGuard;
1313  if (pDocShell)
1314  {
1315  OUString aAppl, aTopic, aItem;
1316 
1317  ScDocument& rDoc = pDocShell->GetDocument();
1319  for (size_t i=0; i<nCount; i++)
1320  {
1321  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1322  if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aName )
1323  return true;
1324  }
1325  }
1326  return false;
1327 }
1328 
1329 // XDDELinks
1330 
1331 uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink(
1332  const OUString& aApplication, const OUString& aTopic,
1333  const OUString& aItem, css::sheet::DDELinkMode nMode )
1334 {
1335  SolarMutexGuard aGuard;
1336  uno::Reference< sheet::XDDELink > xLink;
1337 
1338  if ( pDocShell )
1339  {
1340  ScDocument& rDoc = pDocShell->GetDocument();
1341  sal_uInt8 nMod = SC_DDE_DEFAULT;
1342  switch ( nMode )
1343  {
1344  case sheet::DDELinkMode_DEFAULT:
1345  {
1346  nMod = SC_DDE_DEFAULT;
1347  }
1348  break;
1349  case sheet::DDELinkMode_ENGLISH:
1350  {
1351  nMod = SC_DDE_ENGLISH;
1352  }
1353  break;
1354  case sheet::DDELinkMode_TEXT:
1355  {
1356  nMod = SC_DDE_TEXT;
1357  }
1358  break;
1359  default:
1360  {
1361  }
1362  break;
1363  }
1364 
1365  if ( rDoc.CreateDdeLink( aApplication, aTopic, aItem, nMod, ScMatrixRef() ) )
1366  {
1367  const OUString aName( lcl_BuildDDEName( aApplication, aTopic, aItem ) );
1368  xLink.set( GetObjectByName_Impl( aName ) );
1369  }
1370  }
1371 
1372  if ( !xLink.is() )
1373  {
1374  throw uno::RuntimeException(
1375  "ScDDELinksObj::addDDELink: cannot add DDE link!" );
1376  }
1377 
1378  return xLink;
1379 }
1380 
1382  mpDocShell(pDocShell),
1383  mpTable(pTable),
1384  mnIndex(nIndex)
1385 {
1386 }
1387 
1389 {
1390 }
1391 
1392 void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nCol, sal_Int32 nRow, const Any& rValue)
1393 {
1394  SolarMutexGuard aGuard;
1395  if (nRow < 0 || nCol < 0)
1396  throw IllegalArgumentException();
1397 
1399  double fVal = 0.0;
1400  OUString aVal;
1401  if (rValue >>= fVal)
1402  pToken.reset(new FormulaDoubleToken(fVal));
1403  else if (rValue >>= aVal)
1404  {
1406  svl::SharedString aSS = rPool.intern(aVal);
1407  pToken.reset(new FormulaStringToken(aSS));
1408  }
1409  else
1410  // unidentified value type.
1411  return;
1412 
1413  mpTable->setCell(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), pToken);
1414 }
1415 
1416 Any SAL_CALL ScExternalSheetCacheObj::getCellValue(sal_Int32 nCol, sal_Int32 nRow)
1417 {
1418  SolarMutexGuard aGuard;
1419  if (nRow < 0 || nCol < 0)
1420  throw IllegalArgumentException();
1421 
1422  FormulaToken* pToken = mpTable->getCell(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow)).get();
1423  if (!pToken)
1424  throw IllegalArgumentException();
1425 
1426  Any aValue;
1427  switch (pToken->GetType())
1428  {
1429  case svDouble:
1430  {
1431  double fVal = pToken->GetDouble();
1432  aValue <<= fVal;
1433  }
1434  break;
1435  case svString:
1436  {
1437  OUString aVal = pToken->GetString().getString();
1438  aValue <<= aVal;
1439  }
1440  break;
1441  default:
1442  throw IllegalArgumentException();
1443  }
1444  return aValue;
1445 }
1446 
1447 Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllRows()
1448 {
1449  SolarMutexGuard aGuard;
1450  vector<SCROW> aRows;
1451  mpTable->getAllRows(aRows);
1452  size_t nSize = aRows.size();
1453  Sequence<sal_Int32> aRowsSeq(nSize);
1454  auto aRowsSeqRange = asNonConstRange(aRowsSeq);
1455  for (size_t i = 0; i < nSize; ++i)
1456  aRowsSeqRange[i] = aRows[i];
1457 
1458  return aRowsSeq;
1459 }
1460 
1461 Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllColumns(sal_Int32 nRow)
1462 {
1463  SolarMutexGuard aGuard;
1464  if (nRow < 0)
1465  throw IllegalArgumentException();
1466 
1467  vector<SCCOL> aCols;
1468  mpTable->getAllCols(static_cast<SCROW>(nRow), aCols);
1469  size_t nSize = aCols.size();
1470  Sequence<sal_Int32> aColsSeq(nSize);
1471  auto aColsSeqRange = asNonConstRange(aColsSeq);
1472  for (size_t i = 0; i < nSize; ++i)
1473  aColsSeqRange[i] = aCols[i];
1474 
1475  return aColsSeq;
1476 }
1477 
1479 {
1480  return static_cast< sal_Int32 >( mnIndex );
1481 }
1482 
1484  mpDocShell(pDocShell), mpRefMgr(pRefMgr), mnFileId(nFileId)
1485 {
1486 }
1487 
1489 {
1490 }
1491 
1492 uno::Reference< sheet::XExternalSheetCache > SAL_CALL ScExternalDocLinkObj::addSheetCache(
1493  const OUString& aSheetName, sal_Bool bDynamicCache )
1494 {
1495  SolarMutexGuard aGuard;
1496  size_t nIndex = 0;
1497  ScExternalRefCache::TableTypeRef pTable = mpRefMgr->getCacheTable(mnFileId, aSheetName, true, &nIndex);
1498  if (!bDynamicCache)
1499  // Set the whole table cached to prevent access to the source document.
1500  pTable->setWholeTableCached();
1501 
1502  uno::Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
1503  return aSheetCache;
1504 }
1505 
1506 Any SAL_CALL ScExternalDocLinkObj::getByName(const OUString &aName)
1507 {
1508  SolarMutexGuard aGuard;
1509  size_t nIndex = 0;
1510  ScExternalRefCache::TableTypeRef pTable = mpRefMgr->getCacheTable(mnFileId, aName, false, &nIndex);
1511  if (!pTable)
1512  throw container::NoSuchElementException();
1513 
1514  uno::Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
1515 
1516  return Any(aSheetCache);
1517 }
1518 
1520 {
1521  SolarMutexGuard aGuard;
1522  vector<OUString> aTabNames;
1524 
1525  // #i116940# be consistent with getByName: include only table names which have a cache already
1526  vector<OUString> aValidNames;
1527  std::copy_if(aTabNames.begin(), aTabNames.end(), std::back_inserter(aValidNames),
1528  [&](const OUString& rTabName) { return mpRefMgr->getCacheTable(mnFileId, rTabName, false); });
1529 
1531  return aSeq;
1532 }
1533 
1534 sal_Bool SAL_CALL ScExternalDocLinkObj::hasByName(const OUString &aName)
1535 {
1536  SolarMutexGuard aGuard;
1537 
1538  // #i116940# be consistent with getByName: allow only table names which have a cache already
1540  return bool(pTable);
1541 }
1542 
1544 {
1545  SolarMutexGuard aGuard;
1546 
1547  // #i116940# be consistent with getByName: count only table names which have a cache already
1548  return getElementNames().getLength();
1549 }
1550 
1551 Any SAL_CALL ScExternalDocLinkObj::getByIndex(sal_Int32 nApiIndex)
1552 {
1553  SolarMutexGuard aGuard;
1554 
1555  // #i116940# Can't use nApiIndex as index for the ref manager, because the API counts only
1556  // the entries which have a cache already. Quick solution: Use getElementNames.
1558  if (nApiIndex < 0 || nApiIndex >= aNames.getLength())
1559  throw lang::IndexOutOfBoundsException();
1560 
1561  size_t nIndex = 0;
1562  ScExternalRefCache::TableTypeRef pTable = mpRefMgr->getCacheTable(mnFileId, aNames[nApiIndex], false, &nIndex);
1563  if (!pTable)
1564  throw lang::IndexOutOfBoundsException();
1565 
1566  uno::Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
1567 
1568  return Any(aSheetCache);
1569 }
1570 
1571 uno::Reference< container::XEnumeration > SAL_CALL ScExternalDocLinkObj::createEnumeration()
1572 {
1573  SolarMutexGuard aGuard;
1574  uno::Reference< container::XEnumeration > aRef(
1575  new ScIndexEnumeration(this, "com.sun.star.sheet.ExternalDocLink"));
1576  return aRef;
1577 }
1578 
1580 {
1582 }
1583 
1585 {
1586  SolarMutexGuard aGuard;
1587 
1588  // #i116940# be consistent with getByName: count only table names which have a cache already
1589  return getElementNames().hasElements();
1590 }
1591 
1593 {
1594  return static_cast<sal_Int32>(mnFileId);
1595 }
1596 
1598  mpDocShell(pDocShell),
1599  mpRefMgr(pDocShell->GetDocument().GetExternalRefManager())
1600 {
1601 }
1602 
1604 {
1605 }
1606 
1607 uno::Reference< sheet::XExternalDocLink > SAL_CALL ScExternalDocLinksObj::addDocLink(
1608  const OUString& aDocName )
1609 {
1610  SolarMutexGuard aGuard;
1611  OUString aDocUrl( ScGlobal::GetAbsDocName( aDocName, mpDocShell));
1612  sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocUrl);
1613  uno::Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
1614  return aDocLink;
1615 }
1616 
1617 Any SAL_CALL ScExternalDocLinksObj::getByName(const OUString &aName)
1618 {
1619  SolarMutexGuard aGuard;
1620  OUString aDocUrl( ScGlobal::GetAbsDocName( aName, mpDocShell));
1621  if (!mpRefMgr->hasExternalFile(aDocUrl))
1622  throw container::NoSuchElementException();
1623 
1624  sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocUrl);
1625  uno::Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
1626 
1627  return Any(aDocLink);
1628 }
1629 
1631 {
1632  SolarMutexGuard aGuard;
1633  sal_uInt16 n = mpRefMgr->getExternalFileCount();
1635  auto aSeqRange = asNonConstRange(aSeq);
1636  for (sal_uInt16 i = 0; i < n; ++i)
1637  {
1638  const OUString* pName = mpRefMgr->getExternalFileName(i);
1639  aSeqRange[i] = pName ? *pName : OUString();
1640  }
1641 
1642  return aSeq;
1643 }
1644 
1645 sal_Bool SAL_CALL ScExternalDocLinksObj::hasByName(const OUString &aName)
1646 {
1647  SolarMutexGuard aGuard;
1648  return mpRefMgr->hasExternalFile(aName);
1649 }
1650 
1652 {
1653  SolarMutexGuard aGuard;
1654  return mpRefMgr->getExternalFileCount();
1655 }
1656 
1657 Any SAL_CALL ScExternalDocLinksObj::getByIndex(sal_Int32 nIndex)
1658 {
1659  SolarMutexGuard aGuard;
1660  if (nIndex > ::std::numeric_limits<sal_uInt16>::max() || nIndex < ::std::numeric_limits<sal_uInt16>::min())
1661  throw lang::IndexOutOfBoundsException();
1662 
1663  sal_uInt16 nFileId = static_cast<sal_uInt16>(nIndex);
1664 
1665  if (!mpRefMgr->hasExternalFile(nFileId))
1666  throw lang::IndexOutOfBoundsException();
1667 
1668  uno::Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
1669  return Any(aDocLink);
1670 }
1671 
1672 uno::Reference< container::XEnumeration > SAL_CALL ScExternalDocLinksObj::createEnumeration()
1673 {
1674  SolarMutexGuard aGuard;
1675  uno::Reference< container::XEnumeration > aRef(
1676  new ScIndexEnumeration(this, "com.sun.star.sheet.ExternalDocLinks"));
1677  return aRef;
1678 }
1679 
1681 {
1683 }
1684 
1686 {
1687  SolarMutexGuard aGuard;
1688  return mpRefMgr->getExternalFileCount() > 0;
1689 }
1690 
1691 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
Definition: documen3.cxx:511
size_t nPos
Definition: linkuno.hxx:166
virtual css::uno::Any SAL_CALL getCellValue(sal_Int32 nCol, sal_Int32 nRow) override
Definition: linkuno.cxx:1416
Matrix data type that can store values of mixed types.
Definition: scmatrix.hxx:112
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:152
ScDocShell * mpDocShell
Definition: linkuno.hxx:424
OUString GetLinkOpt(SCTAB nTab) const
Definition: documen3.cxx:525
virtual OUString SAL_CALL getItem() override
Definition: linkuno.cxx:1067
svString
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:682
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: linkuno.cxx:755
void setRefreshDelay(sal_Int32 nRefreshDelay)
Definition: linkuno.cxx:354
virtual css::uno::Reference< css::sheet::XDDELink > SAL_CALL addDDELink(const OUString &aApplication, const OUString &aTopic, const OUString &aItem, css::sheet::DDELinkMode nMode) override
Definition: linkuno.cxx:1331
sal_Int32 nIndex
OUString getString() const
ScAddress aStart
Definition: address.hxx:497
SharedString intern(const OUString &rStr)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:499
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:584
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:504
sal_uInt16 getExternalFileCount() const
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: linkuno.cxx:1657
void setFilter(const OUString &Filter)
Definition: linkuno.cxx:313
ScDocShell * pDocShell
Definition: linkuno.hxx:230
ScDocShell * pDocShell
Definition: linkuno.hxx:277
OUString aItem
Definition: linkuno.hxx:280
OUString aTopic
Definition: linkuno.hxx:279
virtual ~ScDDELinksObj() override
Definition: linkuno.cxx:1189
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:588
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:1197
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:671
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: linkuno.cxx:206
#define SC_UNONAME_FILTOPT
Definition: unonames.hxx:368
sal_Int32 getRefreshDelay() const
Definition: linkuno.cxx:344
const sal_uInt8 SC_DDE_DEFAULT
Definition: document.hxx:300
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:92
sal_Int64 n
SC_DLLPUBLIC bool CreateDdeLink(const OUString &rAppl, const OUString &rTopic, const OUString &rItem, sal_uInt8 nMode, const ScMatrixRef &pResults)
Tries to find a DDE link or creates a new, if not extant.
Definition: documen8.cxx:993
rtl::Reference< ScDDELinkObj > GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:1209
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:888
static OUString lcl_BuildDDEName(std::u16string_view rAppl, std::u16string_view rTopic, std::u16string_view rItem)
Definition: linkuno.cxx:1030
ScDocShell * mpDocShell
Definition: linkuno.hxx:461
virtual double GetDouble() const
sal_uInt16 getExternalFileId(const OUString &rFile)
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: linkuno.cxx:968
const sal_uInt8 SC_DDE_TEXT
Definition: document.hxx:302
sc::DocumentLinkManager & GetDocLinkManager()
Definition: documen2.cxx:239
virtual ~ScAreaLinksObj() override
Definition: linkuno.cxx:880
bool IsLinked(SCTAB nTab) const
Definition: documen3.cxx:485
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:163
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:1534
SfxHintId GetId() const
void setFileName(const OUString &FileName)
Definition: linkuno.cxx:267
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:1087
virtual void SAL_CALL insertAtPosition(const css::table::CellAddress &aDestPos, const OUString &aFileName, const OUString &aSourceArea, const OUString &aFilter, const OUString &aFilterOptions) override
Definition: linkuno.cxx:908
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:489
order of XNamed and DDELink changed to avoid "duplicate comdat" symbols
Definition: linkuno.hxx:268
const OUString * getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal=false)
It returns a pointer to the name of the URI associated with a given external file ID...
void setFilterOptions(const OUString &FilterOptions)
Definition: linkuno.cxx:818
rtl::Reference< ScAreaLinkObj > GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:900
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1685
ScDocShell * pDocShell
Definition: linkuno.hxx:122
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:1098
OUString getFilterOptions() const
Definition: linkuno.cxx:808
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:942
XRefreshListenerArr_Impl aRefreshListeners
Definition: linkuno.hxx:167
XRefreshListenerArr_Impl aRefreshListeners
Definition: linkuno.hxx:281
ScDocShell * pDocShell
Definition: linkuno.hxx:165
virtual OUString SAL_CALL getApplication() override
Definition: linkuno.cxx:1051
virtual ~ScSheetLinksObj() override
Definition: linkuno.cxx:366
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:315
bool SetDdeLinkResultMatrix(size_t nDdePos, const ScMatrixRef &pResults)
Sets a result matrix for the specified DDE link.
Definition: documen8.cxx:1024
int nCount
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:1651
void Refreshed_Impl()
Definition: linkuno.cxx:1175
svDouble
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:25
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:984
OUString getFileName() const
Definition: linkuno.cxx:776
virtual css::uno::Reference< css::sheet::XExternalSheetCache > SAL_CALL addSheetCache(const OUString &aSheetName, sal_Bool bDynamicCache) override
Definition: linkuno.cxx:1492
const sal_uInt8 SC_DDE_IGNOREMODE
Definition: document.hxx:303
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:1630
static bool FillMixedArray(css::uno::Any &rAny, ScDocument &rDoc, const ScRange &rRange, bool bAllowNV=false)
void setFilter(const OUString &Filter)
Definition: linkuno.cxx:802
#define SC_UNONAME_FILTER
Definition: unonames.hxx:367
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:520
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:1579
rtl::Reference< ScDDELinkObj > GetObjectByName_Impl(std::u16string_view aName)
Definition: linkuno.cxx:1220
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: linkuno.cxx:468
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:436
virtual sal_Int32 SAL_CALL getTokenIndex() override
Definition: linkuno.cxx:1478
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
Definition: global2.cxx:287
virtual ~ScExternalDocLinkObj() override
Definition: linkuno.cxx:1488
sal_uInt16 char * pName
Definition: callform.cxx:57
void setFileName(const OUString &FileName)
Definition: linkuno.cxx:786
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:1680
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:1571
ScDDELinkObj(ScDocShell *pDocSh, const OUString &rA, const OUString &rT, const OUString &rI)
Definition: linkuno.cxx:990
virtual OUString SAL_CALL getTopic() override
Definition: linkuno.cxx:1059
const SvBaseLinks & GetLinks() const
int i
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:979
SC_DLLPUBLIC bool FindDdeLink(std::u16string_view rAppl, std::u16string_view rTopic, std::u16string_view rItem, sal_uInt8 nMode, size_t &rnDdePos)
Tries to find a DDE link with the specified connection data.
Definition: documen8.cxx:959
void Remove(SvBaseLink const *pLink)
rtl::Reference< ScSheetLinkObj > GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:386
SC_DLLPUBLIC const ScMatrix * GetDdeLinkResultMatrix(size_t nDdePos) const
Returns the result matrix of the specified DDE link.
Definition: documen8.cxx:987
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:1278
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:1310
bool GetDdeLinkData(size_t nDdePos, OUString &rAppl, OUString &rTopic, OUString &rItem) const
Returns the connection data of the specified DDE link.
Definition: documen8.cxx:965
virtual ~ScExternalSheetCacheObj() override
Definition: linkuno.cxx:1388
ScDDELinksObj(ScDocShell *pDocSh)
Definition: linkuno.cxx:1183
ScDocShell * pDocShell
Definition: linkuno.hxx:326
OUString getFilter() const
Definition: linkuno.cxx:792
rtl::Reference< ScSheetLinkObj > GetObjectByName_Impl(const OUString &aName)
Definition: linkuno.cxx:414
virtual void SAL_CALL setName(const OUString &aName) override
Definition: linkuno.cxx:136
virtual css::table::CellRangeAddress SAL_CALL getDestArea() override
Definition: linkuno.cxx:858
float u
unsigned char sal_Bool
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:1543
void SetLink(SCTAB nTab, ScLinkMode nMode, const OUString &rDoc, const OUString &rFilter, const OUString &rOptions, const OUString &rTabName, sal_uLong nRefreshDelay)
Definition: documen3.cxx:546
const SfxItemPropertyMap & getPropertyMap() const
virtual css::uno::Reference< css::sheet::XExternalDocLink > SAL_CALL addDocLink(const OUString &aDocName) override
Definition: linkuno.cxx:1607
void getAllCachedTableNames(sal_uInt16 nFileId,::std::vector< OUString > &rTabNames) const
Returns a vector containing all (real) table names and cache tables of the specified file...
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:1672
ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const
Get a cache table instance for specified table and table index.
OUString GetLinkFlt(SCTAB nTab) const
Definition: documen3.cxx:518
css::uno::Type const & get()
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:63
sal_Int32 GetRefreshDelaySeconds() const
virtual void SAL_CALL setSourceArea(const OUString &aSourceArea) override
Definition: linkuno.cxx:852
OUString getFilter() const
Definition: linkuno.cxx:303
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:483
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1272
static const SfxItemPropertyMapEntry * lcl_GetSheetLinkMap()
Definition: linkuno.cxx:55
bool hasExternalFile(sal_uInt16 nFileId) const
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:72
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:901
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: linkuno.cxx:198
void setRefreshDelay(sal_Int32 nRefreshDelay)
Definition: linkuno.cxx:834
void ModifyRefreshDelay_Impl(sal_Int32 nRefresh)
Definition: linkuno.cxx:189
::formula::FormulaTokenRef TokenRef
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:950
virtual void SAL_CALL refresh() override
Definition: linkuno.cxx:144
virtual ~ScExternalDocLinksObj() override
Definition: linkuno.cxx:1603
virtual void SAL_CALL setName(const OUString &aName) override
Definition: linkuno.cxx:1043
virtual ~ScDDELinkObj() override
Definition: linkuno.cxx:1000
virtual ~ScAreaLinkObj() override
Definition: linkuno.cxx:580
#define SC_UNONAME_LINKURL
Definition: unonames.hxx:369
void Refreshed_Impl()
Definition: linkuno.cxx:703
virtual void SAL_CALL setCellValue(sal_Int32 nCol, sal_Int32 nRow, const css::uno::Any &rAny) override
Definition: linkuno.cxx:1392
void ModifyRefreshDelay_Impl(sal_Int32 nRefresh)
Definition: linkuno.cxx:654
SvBaseLink * pLink
unsigned char sal_uInt8
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:478
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:1240
void InsertAreaLink(const OUString &rFile, const OUString &rFilter, const OUString &rOptions, const OUString &rSource, const ScRange &rDestRange, sal_Int32 nRefreshDelaySeconds, bool bFitBlock, bool bApi)
Definition: docfunc.cxx:5513
virtual const svl::SharedString & GetString() const
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
SfxItemPropertySet aPropSet
Definition: linkuno.hxx:164
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1584
virtual OUString SAL_CALL getSourceArea() override
Definition: linkuno.cxx:842
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getAllRows() override
Definition: linkuno.cxx:1447
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getResults() override
Definition: linkuno.cxx:1118
static ScMatrixRef CreateMixedMatrix(const css::uno::Any &rAny)
Convert a sequence of mixed elements to ScMatrix.
Definition: rangeseq.cxx:357
OUString aName
sal_uLong GetLinkRefreshDelay(SCTAB nTab) const
Definition: documen3.cxx:539
size_t getDdeLinkCount() const
std::shared_ptr< Table > TableTypeRef
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:1288
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:1645
ScExternalDocLinksObj(ScDocShell *pDocShell)
Definition: linkuno.cxx:1597
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: linkuno.cxx:713
virtual void SAL_CALL refresh() override
Definition: linkuno.cxx:1077
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: linkuno.cxx:721
ScDocShell * mpDocShell
Definition: linkuno.hxx:388
OUString getFilterOptions() const
Definition: linkuno.cxx:323
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:909
ScExternalDocLinkObj(ScDocShell *pDocShell, ScExternalRefManager *pRefMgr, sal_uInt16 nFileId)
Definition: linkuno.cxx:1483
ScExternalRefCache::TableTypeRef mpTable
Definition: linkuno.hxx:389
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
Definition: documen3.cxx:532
Sequence< sal_Int8 > aSeq
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:374
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
virtual ~ScSheetLinkObj() override
Definition: linkuno.cxx:84
sal_Int32 getRefreshDelay() const
Definition: linkuno.cxx:824
virtual void SAL_CALL setDestArea(const css::table::CellRangeAddress &aDestArea) override
Definition: linkuno.cxx:868
ScTableLink * GetLink_Impl() const
Definition: linkuno.cxx:109
static ScAreaLink * lcl_GetAreaLink(ScDocShell *pDocShell, size_t nPos)
Definition: linkuno.cxx:551
ScExternalSheetCacheObj(ScDocShell *pDocShell, ScExternalRefCache::TableTypeRef const &pTable, size_t nIndex)
Definition: linkuno.cxx:1381
void SetRefreshDelay(sal_Int32 nSeconds)
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:1248
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: linkuno.cxx:240
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:1506
virtual void SAL_CALL refresh() override
Definition: linkuno.cxx:663
virtual void SAL_CALL setResults(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aResults) override
Definition: linkuno.cxx:1152
void setFilterOptions(const OUString &FilterOptions)
Definition: linkuno.cxx:333
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:1617
ScExternalRefManager * mpRefMgr
Definition: linkuno.hxx:425
sal_uInt16 mnFileId
Definition: linkuno.hxx:426
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
Definition: convuno.hxx:87
ScAreaLinksObj(ScDocShell *pDocSh)
Definition: linkuno.cxx:874
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:443
const sal_uInt8 SC_DDE_ENGLISH
Definition: document.hxx:301
#define SC_UNONAME_REFDELAY
Definition: unonames.hxx:371
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:222
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:1008
ScSheetLinksObj(ScDocShell *pDocSh)
Definition: linkuno.cxx:360
void Refreshed_Impl()
Definition: linkuno.cxx:181
int mnIndex
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:79
virtual OUString SAL_CALL getName() override
Definition: linkuno.cxx:1037
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:229
OUString aAppl
Definition: linkuno.hxx:278
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:1267
StackVar GetType() const
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getAllColumns(sal_Int32 nRow) override
Definition: linkuno.cxx:1461
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:1519
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: linkuno.cxx:1551
ScAreaLinkObj(ScDocShell *pDocSh, size_t nP)
Definition: linkuno.cxx:572
void updateDdeLink(std::u16string_view rAppl, std::u16string_view rTopic, std::u16string_view rItem)
AnyEventRef aEvent
virtual void SAL_CALL removeByIndex(sal_Int32 nIndex) override
Definition: linkuno.cxx:927
void Modify_Impl(const OUString *pNewFile, const OUString *pNewFilter, const OUString *pNewOptions, const OUString *pNewSource, const css::table::CellRangeAddress *pNewDest)
Definition: linkuno.cxx:612
virtual sal_Int32 SAL_CALL getTokenIndex() override
Definition: linkuno.cxx:1592
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: linkuno.cxx:1257
virtual OUString SAL_CALL getName() override
Definition: linkuno.cxx:130
ScExternalRefManager * mpRefMgr
Definition: linkuno.hxx:462
#define SC_UNONAME_REFPERIOD
Definition: unonames.hxx:370