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->GetRefreshDelay() );
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->GetRefreshDelay() );
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->GetRefreshDelay() );
341  }
342 }
343 
345 {
346  SolarMutexGuard aGuard;
347  sal_Int32 nRet = 0;
348  ScTableLink* pLink = GetLink_Impl();
349  if (pLink)
350  nRet = static_cast<sal_Int32>(pLink->GetRefreshDelay());
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::makeAny(xLink);
476 }
477 
479 {
480  SolarMutexGuard aGuard;
482 }
483 
485 {
486  SolarMutexGuard aGuard;
487  return ( getCount() != 0 );
488 }
489 
490 uno::Any SAL_CALL ScSheetLinksObj::getByName( const OUString& aName )
491 {
492  SolarMutexGuard aGuard;
493  uno::Reference<beans::XPropertySet> xLink(GetObjectByName_Impl(aName));
494  if (!xLink.is())
495  throw container::NoSuchElementException();
496 
497  return uno::makeAny(xLink);
498 }
499 
500 sal_Bool SAL_CALL ScSheetLinksObj::hasByName( const OUString& aName )
501 {
502  SolarMutexGuard aGuard;
503  // Name is the same as file name
504 
505  if (pDocShell)
506  {
507  ScDocument& rDoc = pDocShell->GetDocument();
508  SCTAB nTabCount = rDoc.GetTableCount();
509  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
510  if (rDoc.IsLinked(nTab))
511  {
513  OUString aLinkDoc(rDoc.GetLinkDoc( nTab ));
514  if ( aLinkDoc == aName )
515  return true;
516  }
517  }
518  return false;
519 }
520 
521 uno::Sequence<OUString> SAL_CALL ScSheetLinksObj::getElementNames()
522 {
523  typedef std::unordered_set<OUString> StrSetType;
524 
525  SolarMutexGuard aGuard;
526  // Name is the same as file name
527 
528  if (!pDocShell)
529  return uno::Sequence<OUString>();
530 
531  StrSetType aNames;
532  ScDocument& rDoc = pDocShell->GetDocument();
533  SCTAB nTabCount = rDoc.GetTableCount();
534 
535  sal_Int32 nLinkCount = getCount();
536  uno::Sequence<OUString> aSeq(nLinkCount);
537  OUString* pAry = aSeq.getArray();
538  size_t nPos = 0;
539  for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
540  {
541  if (!rDoc.IsLinked(nTab))
542  continue;
543 
544  OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
545  if (aNames.insert(aLinkDoc).second)
546  pAry[nPos++] = aLinkDoc;
547  }
548  OSL_ENSURE( nPos==static_cast<size_t>(nLinkCount), "verzaehlt" );
549  return aSeq;
550 }
551 
552 static ScAreaLink* lcl_GetAreaLink( ScDocShell* pDocShell, size_t nPos )
553 {
554  if (pDocShell)
555  {
556  sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
557  size_t nTotalCount = pLinkManager->GetLinks().size();
558  size_t nAreaCount = 0;
559  for (size_t i=0; i<nTotalCount; i++)
560  {
561  ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
562  if (auto pAreaLink = dynamic_cast<ScAreaLink*>( pBase))
563  {
564  if ( nAreaCount == nPos )
565  return pAreaLink;
566  ++nAreaCount;
567  }
568  }
569  }
570  return nullptr; // not found
571 }
572 
574  aPropSet( lcl_GetSheetLinkMap() ),
575  pDocShell( pDocSh ),
576  nPos( nP )
577 {
579 }
580 
582 {
583  SolarMutexGuard g;
584 
585  if (pDocShell)
587 }
588 
590 {
592  // UpdateRef is not needed here
593 
594  if ( auto pRefreshedHint = dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
595  {
596  if ( pRefreshedHint->GetLinkType() == ScLinkRefType::AREA )
597  {
598  // get this link to compare dest position
600  if ( pLink && pLink->GetDestArea().aStart == pRefreshedHint->GetDestPos() )
601  Refreshed_Impl();
602  }
603  }
604  else
605  {
606  if ( rHint.GetId() == SfxHintId::Dying )
607  pDocShell = nullptr; // pointer is invalid
608  }
609 }
610 
611 // XFileLink
612 
613 void ScAreaLinkObj::Modify_Impl( const OUString* pNewFile, const OUString* pNewFilter,
614  const OUString* pNewOptions, const OUString* pNewSource,
615  const table::CellRangeAddress* pNewDest )
616 {
618  if (!pLink)
619  return;
620 
621  OUString aFile (pLink->GetFile());
622  OUString aFilter (pLink->GetFilter());
623  OUString aOptions (pLink->GetOptions());
624  OUString aSource (pLink->GetSource());
625  ScRange aDest (pLink->GetDestArea());
626  sal_uLong nRefresh = pLink->GetRefreshDelay();
627 
630 
632  pLinkManager->Remove( pLink );
633  pLink = nullptr; // deleted along with remove
634 
635  bool bFitBlock = true; // move, if the size changes with update
636  if (pNewFile)
637  {
638  aFile = ScGlobal::GetAbsDocName( *pNewFile, pDocShell );
639  }
640  if (pNewFilter)
641  aFilter = *pNewFilter;
642  if (pNewOptions)
643  aOptions = *pNewOptions;
644  if (pNewSource)
645  aSource = *pNewSource;
646  if (pNewDest)
647  {
648  ScUnoConversion::FillScRange( aDest, *pNewDest );
649  bFitBlock = false; // new range was specified -> do not move the content
650  }
651  pDocShell->GetDocFunc().InsertAreaLink( aFile, aFilter, aOptions, aSource,
652  aDest, nRefresh, bFitBlock, true );
653 }
654 
655 void ScAreaLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefresh )
656 {
658  if( pLink )
659  pLink->SetRefreshDelay( static_cast<sal_uLong>(nRefresh) );
660 }
661 
662 // XRefreshable
663 
664 void SAL_CALL ScAreaLinkObj::refresh()
665 {
666  SolarMutexGuard aGuard;
668  if (pLink)
669  pLink->Refresh( pLink->GetFile(), pLink->GetFilter(), pLink->GetSource(), pLink->GetRefreshDelay() );
670 }
671 
673  const uno::Reference<util::XRefreshListener >& xListener )
674 {
675  SolarMutexGuard aGuard;
676  aRefreshListeners.push_back( xListener );
677 
678  // hold one additional ref to keep this object alive as long as there are listeners
679  if ( aRefreshListeners.size() == 1 )
680  acquire();
681 }
682 
684  const uno::Reference<util::XRefreshListener >& xListener )
685 {
686  SolarMutexGuard aGuard;
687  size_t nCount = aRefreshListeners.size();
688  for ( size_t n=nCount; n--; )
689  {
690  uno::Reference<util::XRefreshListener>& rObj = aRefreshListeners[n];
691  if ( rObj == xListener )
692  {
693  aRefreshListeners.erase( aRefreshListeners.begin() + n );
694  if ( aRefreshListeners.empty() )
695  release(); // release ref for listeners
696  break;
697  }
698 
699  if(n == 0)
700  break;
701  }
702 }
703 
705 {
706  lang::EventObject aEvent;
707  aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
708  for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners)
709  xRefreshListener->refreshed( aEvent );
710 }
711 
712 // XPropertySet
713 
714 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAreaLinkObj::getPropertySetInfo()
715 {
716  SolarMutexGuard aGuard;
717  static uno::Reference<beans::XPropertySetInfo> aRef(
719  return aRef;
720 }
721 
723  const OUString& aPropertyName, const uno::Any& aValue )
724 {
725  SolarMutexGuard aGuard;
726  OUString aValStr;
727  if ( aPropertyName == SC_UNONAME_LINKURL )
728  {
729  if ( aValue >>= aValStr )
730  setFileName( aValStr );
731  }
732  else if ( aPropertyName == SC_UNONAME_FILTER )
733  {
734  if ( aValue >>= aValStr )
735  setFilter( aValStr );
736  }
737  else if ( aPropertyName == SC_UNONAME_FILTOPT )
738  {
739  if ( aValue >>= aValStr )
740  setFilterOptions( aValStr );
741  }
742  else if ( aPropertyName == SC_UNONAME_REFPERIOD )
743  {
744  sal_Int32 nRefresh = 0;
745  if ( aValue >>= nRefresh )
746  setRefreshDelay( nRefresh );
747  }
748  else if ( aPropertyName == SC_UNONAME_REFDELAY )
749  {
750  sal_Int32 nRefresh = 0;
751  if ( aValue >>= nRefresh )
752  setRefreshDelay( nRefresh );
753  }
754 }
755 
756 uno::Any SAL_CALL ScAreaLinkObj::getPropertyValue( const OUString& aPropertyName )
757 {
758  SolarMutexGuard aGuard;
759  uno::Any aRet;
760  if ( aPropertyName == SC_UNONAME_LINKURL )
761  aRet <<= getFileName();
762  else if ( aPropertyName == SC_UNONAME_FILTER )
763  aRet <<= getFilter();
764  else if ( aPropertyName == SC_UNONAME_FILTOPT )
765  aRet <<= getFilterOptions();
766  else if ( aPropertyName == SC_UNONAME_REFPERIOD )
767  aRet <<= getRefreshDelay();
768  else if ( aPropertyName == SC_UNONAME_REFDELAY )
769  aRet <<= getRefreshDelay();
770  return aRet;
771 }
772 
774 
775 // internal:
776 
777 OUString ScAreaLinkObj::getFileName() const
778 {
779  SolarMutexGuard aGuard;
780  OUString aRet;
781  ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, nPos);
782  if (pLink)
783  aRet = pLink->GetFile();
784  return aRet;
785 }
786 
787 void ScAreaLinkObj::setFileName(const OUString& rNewName)
788 {
789  SolarMutexGuard aGuard;
790  Modify_Impl( &rNewName, nullptr, nullptr, nullptr, nullptr );
791 }
792 
793 OUString ScAreaLinkObj::getFilter() const
794 {
795  SolarMutexGuard aGuard;
796  OUString aRet;
798  if (pLink)
799  aRet = pLink->GetFilter();
800  return aRet;
801 }
802 
803 void ScAreaLinkObj::setFilter(const OUString& Filter)
804 {
805  SolarMutexGuard aGuard;
806  Modify_Impl( nullptr, &Filter, nullptr, nullptr, nullptr );
807 }
808 
810 {
811  SolarMutexGuard aGuard;
812  OUString aRet;
814  if (pLink)
815  aRet = pLink->GetOptions();
816  return aRet;
817 }
818 
819 void ScAreaLinkObj::setFilterOptions(const OUString& FilterOptions)
820 {
821  SolarMutexGuard aGuard;
822  Modify_Impl( nullptr, nullptr, &FilterOptions, nullptr, nullptr );
823 }
824 
826 {
827  SolarMutexGuard aGuard;
828  sal_Int32 nRet = 0;
830  if (pLink)
831  nRet = static_cast<sal_Int32>(pLink->GetRefreshDelay());
832  return nRet;
833 }
834 
835 void ScAreaLinkObj::setRefreshDelay(sal_Int32 nRefreshDelay)
836 {
837  SolarMutexGuard aGuard;
838  ModifyRefreshDelay_Impl( nRefreshDelay );
839 }
840 
841 // XAreaLink
842 
843 OUString SAL_CALL ScAreaLinkObj::getSourceArea()
844 {
845  SolarMutexGuard aGuard;
846  OUString aRet;
848  if (pLink)
849  aRet = pLink->GetSource();
850  return aRet;
851 }
852 
853 void SAL_CALL ScAreaLinkObj::setSourceArea( const OUString& aSourceArea )
854 {
855  SolarMutexGuard aGuard;
856  Modify_Impl( nullptr, nullptr, nullptr, &aSourceArea, nullptr );
857 }
858 
859 table::CellRangeAddress SAL_CALL ScAreaLinkObj::getDestArea()
860 {
861  SolarMutexGuard aGuard;
862  table::CellRangeAddress aRet;
864  if (pLink)
865  ScUnoConversion::FillApiRange( aRet, pLink->GetDestArea() );
866  return aRet;
867 }
868 
869 void SAL_CALL ScAreaLinkObj::setDestArea( const table::CellRangeAddress& aDestArea )
870 {
871  SolarMutexGuard aGuard;
872  Modify_Impl( nullptr, nullptr, nullptr, nullptr, &aDestArea );
873 }
874 
876  pDocShell( pDocSh )
877 {
879 }
880 
882 {
883  SolarMutexGuard g;
884 
885  if (pDocShell)
887 }
888 
890 {
891  // we don't care about update of references here
892 
893  if ( rHint.GetId() == SfxHintId::Dying )
894  {
895  pDocShell = nullptr; // became invalid
896  }
897 }
898 
899 // XAreaLinks
900 
902 {
903  if ( pDocShell && nIndex >= 0 && nIndex < getCount() )
904  return new ScAreaLinkObj( pDocShell, static_cast<size_t>(nIndex) );
905 
906  return nullptr; // not found
907 }
908 
909 void SAL_CALL ScAreaLinksObj::insertAtPosition( const table::CellAddress& aDestPos,
910  const OUString& aFileName,
911  const OUString& aSourceArea,
912  const OUString& aFilter,
913  const OUString& aFilterOptions )
914 {
915  SolarMutexGuard aGuard;
916  if (pDocShell)
917  {
918  OUString aFileStr (aFileName);
919  ScAddress aDestAddr( static_cast<SCCOL>(aDestPos.Column), static_cast<SCROW>(aDestPos.Row), aDestPos.Sheet );
920 
921  aFileStr = ScGlobal::GetAbsDocName( aFileStr, pDocShell );
922  pDocShell->GetDocFunc().InsertAreaLink( aFileStr, aFilter, aFilterOptions,
923  aSourceArea, ScRange(aDestAddr),
924  0, false, true ); // don't move contents
925  }
926 }
927 
928 void SAL_CALL ScAreaLinksObj::removeByIndex( sal_Int32 nIndex )
929 {
930  SolarMutexGuard aGuard;
931  ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, static_cast<size_t>(nIndex));
932  if (pLink)
933  {
935 
937  pLinkManager->Remove( pLink );
938  }
939 }
940 
941 // XEnumerationAccess
942 
943 uno::Reference<container::XEnumeration> SAL_CALL ScAreaLinksObj::createEnumeration()
944 {
945  SolarMutexGuard aGuard;
946  return new ScIndexEnumeration(this, "com.sun.star.sheet.CellAreaLinksEnumeration");
947 }
948 
949 // XIndexAccess
950 
951 sal_Int32 SAL_CALL ScAreaLinksObj::getCount()
952 {
953  SolarMutexGuard aGuard;
954  sal_Int32 nAreaCount = 0;
955  if (pDocShell)
956  {
958  size_t nTotalCount = pLinkManager->GetLinks().size();
959  for (size_t i=0; i<nTotalCount; i++)
960  {
961  ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
962  if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr)
963  ++nAreaCount;
964  }
965  }
966  return nAreaCount;
967 }
968 
969 uno::Any SAL_CALL ScAreaLinksObj::getByIndex( sal_Int32 nIndex )
970 {
971  SolarMutexGuard aGuard;
972  uno::Reference<sheet::XAreaLink> xLink(GetObjectByIndex_Impl(nIndex));
973  if (!xLink.is())
974  throw lang::IndexOutOfBoundsException();
975 
976  return uno::makeAny(xLink);
977 
978 }
979 
981 {
982  SolarMutexGuard aGuard;
984 }
985 
987 {
988  SolarMutexGuard aGuard;
989  return ( getCount() != 0 );
990 }
991 
992 ScDDELinkObj::ScDDELinkObj(ScDocShell* pDocSh, const OUString& rA,
993  const OUString& rT, const OUString& rI) :
994  pDocShell( pDocSh ),
995  aAppl( rA ),
996  aTopic( rT ),
997  aItem( rI )
998 {
1000 }
1001 
1003 {
1004  SolarMutexGuard g;
1005 
1006  if (pDocShell)
1008 }
1009 
1011 {
1013  // UpdateRef is not needed here
1014 
1015  if ( auto pRefreshedHint = dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
1016  {
1017  if ( pRefreshedHint->GetLinkType() == ScLinkRefType::DDE &&
1018  pRefreshedHint->GetDdeAppl() == aAppl &&
1019  pRefreshedHint->GetDdeTopic() == aTopic &&
1020  pRefreshedHint->GetDdeItem() == aItem )
1021  Refreshed_Impl();
1022  }
1023  else
1024  {
1025  if ( rHint.GetId() == SfxHintId::Dying )
1026  pDocShell = nullptr; // pointer is invalid
1027  }
1028 }
1029 
1030 // XNamed
1031 
1032 static OUString lcl_BuildDDEName( std::u16string_view rAppl, std::u16string_view rTopic, std::u16string_view rItem )
1033 {
1034  // Appl|Topic!Item (like Excel)
1035  OUString aRet = OUString::Concat(rAppl) + "|" + rTopic + "!" + rItem;
1036  return aRet;
1037 }
1038 
1039 OUString SAL_CALL ScDDELinkObj::getName()
1040 {
1041  SolarMutexGuard aGuard;
1042  return lcl_BuildDDEName( aAppl, aTopic, aItem );
1043 }
1044 
1045 void SAL_CALL ScDDELinkObj::setName( const OUString& /* aName */ )
1046 {
1047  // name can't be changed (formulas wouldn't find the link)
1048  throw uno::RuntimeException();
1049 }
1050 
1051 // XDDELink
1052 
1053 OUString SAL_CALL ScDDELinkObj::getApplication()
1054 {
1055  SolarMutexGuard aGuard;
1057 
1058  return aAppl;
1059 }
1060 
1061 OUString SAL_CALL ScDDELinkObj::getTopic()
1062 {
1063  SolarMutexGuard aGuard;
1065 
1066  return aTopic;
1067 }
1068 
1069 OUString SAL_CALL ScDDELinkObj::getItem()
1070 {
1071  SolarMutexGuard aGuard;
1073 
1074  return aItem;
1075 }
1076 
1077 // XRefreshable
1078 
1079 void SAL_CALL ScDDELinkObj::refresh()
1080 {
1081  SolarMutexGuard aGuard;
1082  if (pDocShell)
1083  {
1085  rMgr.updateDdeLink(aAppl, aTopic, aItem);
1086  }
1087 }
1088 
1090  const uno::Reference<util::XRefreshListener >& xListener )
1091 {
1092  SolarMutexGuard aGuard;
1093  aRefreshListeners.push_back( xListener );
1094 
1095  // hold one additional ref to keep this object alive as long as there are listeners
1096  if ( aRefreshListeners.size() == 1 )
1097  acquire();
1098 }
1099 
1101  const uno::Reference<util::XRefreshListener >& xListener )
1102 {
1103  SolarMutexGuard aGuard;
1104  size_t nCount = aRefreshListeners.size();
1105  for ( size_t n=nCount; n--; )
1106  {
1107  uno::Reference<util::XRefreshListener>& rObj = aRefreshListeners[n];
1108  if ( rObj == xListener )
1109  {
1110  aRefreshListeners.erase( aRefreshListeners.begin() + n );
1111  if ( aRefreshListeners.empty() )
1112  release(); // release ref for listeners
1113  break;
1114  }
1115  }
1116 }
1117 
1118 // XDDELinkResults
1119 
1120 uno::Sequence< uno::Sequence< uno::Any > > ScDDELinkObj::getResults( )
1121 {
1122  SolarMutexGuard aGuard;
1123  uno::Sequence< uno::Sequence< uno::Any > > aReturn;
1124  bool bSuccess = false;
1125 
1126  if ( pDocShell )
1127  {
1128  ScDocument& rDoc = pDocShell->GetDocument();
1129  size_t nPos = 0;
1130  if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
1131  {
1132  const ScMatrix* pMatrix = rDoc.GetDdeLinkResultMatrix( nPos );
1133  if ( pMatrix )
1134  {
1135  uno::Any aAny;
1136  if ( ScRangeToSequence::FillMixedArray( aAny, pMatrix, true ) )
1137  {
1138  aAny >>= aReturn;
1139  }
1140  }
1141  bSuccess = true;
1142  }
1143  }
1144 
1145  if ( !bSuccess )
1146  {
1147  throw uno::RuntimeException(
1148  "ScDDELinkObj::getResults: failed to get results!" );
1149  }
1150 
1151  return aReturn;
1152 }
1153 
1154 void ScDDELinkObj::setResults( const uno::Sequence< uno::Sequence< uno::Any > >& aResults )
1155 {
1156  SolarMutexGuard aGuard;
1157  bool bSuccess = false;
1158 
1159  if ( pDocShell )
1160  {
1161  ScDocument& rDoc = pDocShell->GetDocument();
1162  size_t nPos = 0;
1163  if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
1164  {
1165  ScMatrixRef xMatrix = ScSequenceToMatrix::CreateMixedMatrix( Any(aResults) );
1166  bSuccess = rDoc.SetDdeLinkResultMatrix( nPos, xMatrix );
1167  }
1168  }
1169 
1170  if ( !bSuccess )
1171  {
1172  throw uno::RuntimeException(
1173  "ScDDELinkObj::setResults: failed to set results!" );
1174  }
1175 }
1176 
1178 {
1179  lang::EventObject aEvent;
1180  aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
1181  for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners)
1182  xRefreshListener->refreshed( aEvent );
1183 }
1184 
1186  pDocShell( pDocSh )
1187 {
1189 }
1190 
1192 {
1193  SolarMutexGuard g;
1194 
1195  if (pDocShell)
1197 }
1198 
1200 {
1201  // we don't care about update of references here
1202 
1203  if ( rHint.GetId() == SfxHintId::Dying )
1204  {
1205  pDocShell = nullptr; // became invalid
1206  }
1207 }
1208 
1209 // XDDELinks
1210 
1212 {
1213  if (pDocShell)
1214  {
1215  OUString aAppl, aTopic, aItem;
1216  if ( pDocShell->GetDocument().GetDdeLinkData( static_cast<size_t>(nIndex), aAppl, aTopic, aItem ) )
1217  return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem );
1218  }
1219  return nullptr;
1220 }
1221 
1223 {
1224  if (pDocShell)
1225  {
1226  OUString aAppl, aTopic, aItem;
1227 
1228  ScDocument& rDoc = pDocShell->GetDocument();
1229  size_t nCount = rDoc.GetDocLinkManager().getDdeLinkCount();
1230  for (size_t i=0; i<nCount; i++)
1231  {
1232  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1233  if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aName )
1234  return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem );
1235  }
1236  }
1237  return nullptr;
1238 }
1239 
1240 // XEnumerationAccess
1241 
1242 uno::Reference<container::XEnumeration> SAL_CALL ScDDELinksObj::createEnumeration()
1243 {
1244  SolarMutexGuard aGuard;
1245  return new ScIndexEnumeration(this, "com.sun.star.sheet.DDELinksEnumeration");
1246 }
1247 
1248 // XIndexAccess
1249 
1250 sal_Int32 SAL_CALL ScDDELinksObj::getCount()
1251 {
1252  SolarMutexGuard aGuard;
1253  sal_Int32 nAreaCount = 0;
1254  if (pDocShell)
1256  return nAreaCount;
1257 }
1258 
1259 uno::Any SAL_CALL ScDDELinksObj::getByIndex( sal_Int32 nIndex )
1260 {
1261  SolarMutexGuard aGuard;
1262  uno::Reference<sheet::XDDELink> xLink(GetObjectByIndex_Impl(nIndex));
1263  if (!xLink.is())
1264  throw lang::IndexOutOfBoundsException();
1265 
1266  return uno::makeAny(xLink);
1267 }
1268 
1270 {
1271  SolarMutexGuard aGuard;
1273 }
1274 
1276 {
1277  SolarMutexGuard aGuard;
1278  return ( getCount() != 0 );
1279 }
1280 
1281 uno::Any SAL_CALL ScDDELinksObj::getByName( const OUString& aName )
1282 {
1283  SolarMutexGuard aGuard;
1284  uno::Reference<sheet::XDDELink> xLink(GetObjectByName_Impl(aName));
1285  if (!xLink.is())
1286  throw container::NoSuchElementException();
1287 
1288  return uno::makeAny(xLink);
1289 }
1290 
1291 uno::Sequence<OUString> SAL_CALL ScDDELinksObj::getElementNames()
1292 {
1293  SolarMutexGuard aGuard;
1294  if (pDocShell)
1295  {
1296  OUString aAppl, aTopic, aItem;
1297 
1298  ScDocument& rDoc = pDocShell->GetDocument();
1300  uno::Sequence<OUString> aSeq(nCount);
1301  OUString* pAry = aSeq.getArray();
1302 
1303  for (size_t i=0; i<nCount; i++)
1304  {
1305  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1306  pAry[i] = lcl_BuildDDEName(aAppl, aTopic, aItem);
1307  }
1308  return aSeq;
1309  }
1310  return uno::Sequence<OUString>();
1311 }
1312 
1313 sal_Bool SAL_CALL ScDDELinksObj::hasByName( const OUString& aName )
1314 {
1315  SolarMutexGuard aGuard;
1316  if (pDocShell)
1317  {
1318  OUString aAppl, aTopic, aItem;
1319 
1320  ScDocument& rDoc = pDocShell->GetDocument();
1322  for (size_t i=0; i<nCount; i++)
1323  {
1324  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1325  if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aName )
1326  return true;
1327  }
1328  }
1329  return false;
1330 }
1331 
1332 // XDDELinks
1333 
1334 uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink(
1335  const OUString& aApplication, const OUString& aTopic,
1336  const OUString& aItem, css::sheet::DDELinkMode nMode )
1337 {
1338  SolarMutexGuard aGuard;
1339  uno::Reference< sheet::XDDELink > xLink;
1340 
1341  if ( pDocShell )
1342  {
1343  ScDocument& rDoc = pDocShell->GetDocument();
1344  sal_uInt8 nMod = SC_DDE_DEFAULT;
1345  switch ( nMode )
1346  {
1347  case sheet::DDELinkMode_DEFAULT:
1348  {
1349  nMod = SC_DDE_DEFAULT;
1350  }
1351  break;
1352  case sheet::DDELinkMode_ENGLISH:
1353  {
1354  nMod = SC_DDE_ENGLISH;
1355  }
1356  break;
1357  case sheet::DDELinkMode_TEXT:
1358  {
1359  nMod = SC_DDE_TEXT;
1360  }
1361  break;
1362  default:
1363  {
1364  }
1365  break;
1366  }
1367 
1368  if ( rDoc.CreateDdeLink( aApplication, aTopic, aItem, nMod, ScMatrixRef() ) )
1369  {
1370  const OUString aName( lcl_BuildDDEName( aApplication, aTopic, aItem ) );
1371  xLink.set( GetObjectByName_Impl( aName ) );
1372  }
1373  }
1374 
1375  if ( !xLink.is() )
1376  {
1377  throw uno::RuntimeException(
1378  "ScDDELinksObj::addDDELink: cannot add DDE link!" );
1379  }
1380 
1381  return xLink;
1382 }
1383 
1385  mpDocShell(pDocShell),
1386  mpTable(pTable),
1387  mnIndex(nIndex)
1388 {
1389 }
1390 
1392 {
1393 }
1394 
1395 void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nCol, sal_Int32 nRow, const Any& rValue)
1396 {
1397  SolarMutexGuard aGuard;
1398  if (nRow < 0 || nCol < 0)
1399  throw IllegalArgumentException();
1400 
1402  double fVal = 0.0;
1403  OUString aVal;
1404  if (rValue >>= fVal)
1405  pToken.reset(new FormulaDoubleToken(fVal));
1406  else if (rValue >>= aVal)
1407  {
1409  svl::SharedString aSS = rPool.intern(aVal);
1410  pToken.reset(new FormulaStringToken(aSS));
1411  }
1412  else
1413  // unidentified value type.
1414  return;
1415 
1416  mpTable->setCell(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), pToken);
1417 }
1418 
1419 Any SAL_CALL ScExternalSheetCacheObj::getCellValue(sal_Int32 nCol, sal_Int32 nRow)
1420 {
1421  SolarMutexGuard aGuard;
1422  if (nRow < 0 || nCol < 0)
1423  throw IllegalArgumentException();
1424 
1425  FormulaToken* pToken = mpTable->getCell(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow)).get();
1426  if (!pToken)
1427  throw IllegalArgumentException();
1428 
1429  Any aValue;
1430  switch (pToken->GetType())
1431  {
1432  case svDouble:
1433  {
1434  double fVal = pToken->GetDouble();
1435  aValue <<= fVal;
1436  }
1437  break;
1438  case svString:
1439  {
1440  OUString aVal = pToken->GetString().getString();
1441  aValue <<= aVal;
1442  }
1443  break;
1444  default:
1445  throw IllegalArgumentException();
1446  }
1447  return aValue;
1448 }
1449 
1450 Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllRows()
1451 {
1452  SolarMutexGuard aGuard;
1453  vector<SCROW> aRows;
1454  mpTable->getAllRows(aRows);
1455  size_t nSize = aRows.size();
1456  Sequence<sal_Int32> aRowsSeq(nSize);
1457  for (size_t i = 0; i < nSize; ++i)
1458  aRowsSeq[i] = aRows[i];
1459 
1460  return aRowsSeq;
1461 }
1462 
1463 Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllColumns(sal_Int32 nRow)
1464 {
1465  SolarMutexGuard aGuard;
1466  if (nRow < 0)
1467  throw IllegalArgumentException();
1468 
1469  vector<SCCOL> aCols;
1470  mpTable->getAllCols(static_cast<SCROW>(nRow), aCols);
1471  size_t nSize = aCols.size();
1472  Sequence<sal_Int32> aColsSeq(nSize);
1473  for (size_t i = 0; i < nSize; ++i)
1474  aColsSeq[i] = aCols[i];
1475 
1476  return aColsSeq;
1477 }
1478 
1480 {
1481  return static_cast< sal_Int32 >( mnIndex );
1482 }
1483 
1485  mpDocShell(pDocShell), mpRefMgr(pRefMgr), mnFileId(nFileId)
1486 {
1487 }
1488 
1490 {
1491 }
1492 
1493 uno::Reference< sheet::XExternalSheetCache > SAL_CALL ScExternalDocLinkObj::addSheetCache(
1494  const OUString& aSheetName, sal_Bool bDynamicCache )
1495 {
1496  SolarMutexGuard aGuard;
1497  size_t nIndex = 0;
1498  ScExternalRefCache::TableTypeRef pTable = mpRefMgr->getCacheTable(mnFileId, aSheetName, true, &nIndex);
1499  if (!bDynamicCache)
1500  // Set the whole table cached to prevent access to the source document.
1501  pTable->setWholeTableCached();
1502 
1503  uno::Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
1504  return aSheetCache;
1505 }
1506 
1507 Any SAL_CALL ScExternalDocLinkObj::getByName(const OUString &aName)
1508 {
1509  SolarMutexGuard aGuard;
1510  size_t nIndex = 0;
1511  ScExternalRefCache::TableTypeRef pTable = mpRefMgr->getCacheTable(mnFileId, aName, false, &nIndex);
1512  if (!pTable)
1513  throw container::NoSuchElementException();
1514 
1515  uno::Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
1516 
1517  return Any(aSheetCache);
1518 }
1519 
1521 {
1522  SolarMutexGuard aGuard;
1523  vector<OUString> aTabNames;
1525 
1526  // #i116940# be consistent with getByName: include only table names which have a cache already
1527  vector<OUString> aValidNames;
1528  std::copy_if(aTabNames.begin(), aTabNames.end(), std::back_inserter(aValidNames),
1529  [&](const OUString& rTabName) { return mpRefMgr->getCacheTable(mnFileId, rTabName, false); });
1530 
1532  return aSeq;
1533 }
1534 
1535 sal_Bool SAL_CALL ScExternalDocLinkObj::hasByName(const OUString &aName)
1536 {
1537  SolarMutexGuard aGuard;
1538 
1539  // #i116940# be consistent with getByName: allow only table names which have a cache already
1541  return bool(pTable);
1542 }
1543 
1545 {
1546  SolarMutexGuard aGuard;
1547 
1548  // #i116940# be consistent with getByName: count only table names which have a cache already
1549  return getElementNames().getLength();
1550 }
1551 
1552 Any SAL_CALL ScExternalDocLinkObj::getByIndex(sal_Int32 nApiIndex)
1553 {
1554  SolarMutexGuard aGuard;
1555 
1556  // #i116940# Can't use nApiIndex as index for the ref manager, because the API counts only
1557  // the entries which have a cache already. Quick solution: Use getElementNames.
1559  if (nApiIndex < 0 || nApiIndex >= aNames.getLength())
1560  throw lang::IndexOutOfBoundsException();
1561 
1562  size_t nIndex = 0;
1563  ScExternalRefCache::TableTypeRef pTable = mpRefMgr->getCacheTable(mnFileId, aNames[nApiIndex], false, &nIndex);
1564  if (!pTable)
1565  throw lang::IndexOutOfBoundsException();
1566 
1567  uno::Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
1568 
1569  return Any(aSheetCache);
1570 }
1571 
1572 uno::Reference< container::XEnumeration > SAL_CALL ScExternalDocLinkObj::createEnumeration()
1573 {
1574  SolarMutexGuard aGuard;
1575  uno::Reference< container::XEnumeration > aRef(
1576  new ScIndexEnumeration(this, "com.sun.star.sheet.ExternalDocLink"));
1577  return aRef;
1578 }
1579 
1581 {
1582  SolarMutexGuard aGuard;
1584 }
1585 
1587 {
1588  SolarMutexGuard aGuard;
1589 
1590  // #i116940# be consistent with getByName: count only table names which have a cache already
1591  return getElementNames().hasElements();
1592 }
1593 
1595 {
1596  return static_cast<sal_Int32>(mnFileId);
1597 }
1598 
1600  mpDocShell(pDocShell),
1601  mpRefMgr(pDocShell->GetDocument().GetExternalRefManager())
1602 {
1603 }
1604 
1606 {
1607 }
1608 
1609 uno::Reference< sheet::XExternalDocLink > SAL_CALL ScExternalDocLinksObj::addDocLink(
1610  const OUString& aDocName )
1611 {
1612  SolarMutexGuard aGuard;
1613  OUString aDocUrl( ScGlobal::GetAbsDocName( aDocName, mpDocShell));
1614  sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocUrl);
1615  uno::Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
1616  return aDocLink;
1617 }
1618 
1619 Any SAL_CALL ScExternalDocLinksObj::getByName(const OUString &aName)
1620 {
1621  SolarMutexGuard aGuard;
1622  OUString aDocUrl( ScGlobal::GetAbsDocName( aName, mpDocShell));
1623  if (!mpRefMgr->hasExternalFile(aDocUrl))
1624  throw container::NoSuchElementException();
1625 
1626  sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocUrl);
1627  uno::Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
1628 
1629  return Any(aDocLink);
1630 }
1631 
1633 {
1634  SolarMutexGuard aGuard;
1635  sal_uInt16 n = mpRefMgr->getExternalFileCount();
1637  for (sal_uInt16 i = 0; i < n; ++i)
1638  {
1639  const OUString* pName = mpRefMgr->getExternalFileName(i);
1640  aSeq[i] = pName ? *pName : OUString();
1641  }
1642 
1643  return aSeq;
1644 }
1645 
1646 sal_Bool SAL_CALL ScExternalDocLinksObj::hasByName(const OUString &aName)
1647 {
1648  SolarMutexGuard aGuard;
1649  return mpRefMgr->hasExternalFile(aName);
1650 }
1651 
1653 {
1654  SolarMutexGuard aGuard;
1655  return mpRefMgr->getExternalFileCount();
1656 }
1657 
1658 Any SAL_CALL ScExternalDocLinksObj::getByIndex(sal_Int32 nIndex)
1659 {
1660  SolarMutexGuard aGuard;
1661  if (nIndex > ::std::numeric_limits<sal_uInt16>::max() || nIndex < ::std::numeric_limits<sal_uInt16>::min())
1662  throw lang::IndexOutOfBoundsException();
1663 
1664  sal_uInt16 nFileId = static_cast<sal_uInt16>(nIndex);
1665 
1666  if (!mpRefMgr->hasExternalFile(nFileId))
1667  throw lang::IndexOutOfBoundsException();
1668 
1669  uno::Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
1670  return Any(aDocLink);
1671 }
1672 
1673 uno::Reference< container::XEnumeration > SAL_CALL ScExternalDocLinksObj::createEnumeration()
1674 {
1675  SolarMutexGuard aGuard;
1676  uno::Reference< container::XEnumeration > aRef(
1677  new ScIndexEnumeration(this, "com.sun.star.sheet.ExternalDocLinks"));
1678  return aRef;
1679 }
1680 
1682 {
1683  SolarMutexGuard aGuard;
1685 }
1686 
1688 {
1689  SolarMutexGuard aGuard;
1690  return mpRefMgr->getExternalFileCount() > 0;
1691 }
1692 
1693 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
Definition: documen3.cxx:505
size_t nPos
Definition: linkuno.hxx:167
virtual css::uno::Any SAL_CALL getCellValue(sal_Int32 nCol, sal_Int32 nRow) override
Definition: linkuno.cxx:1419
Matrix data type that can store values of mixed types.
Definition: scmatrix.hxx:113
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:152
ScDocShell * mpDocShell
Definition: linkuno.hxx:425
OUString GetLinkOpt(SCTAB nTab) const
Definition: documen3.cxx:519
virtual OUString SAL_CALL getItem() override
Definition: linkuno.cxx:1069
svString
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:683
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: linkuno.cxx:756
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:1334
sal_Int32 nIndex
OUString getString() const
ScAddress aStart
Definition: address.hxx:500
SharedString intern(const OUString &rStr)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:500
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:563
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:498
sal_uInt16 getExternalFileCount() const
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: linkuno.cxx:1658
void setFilter(const OUString &Filter)
Definition: linkuno.cxx:313
ScDocShell * pDocShell
Definition: linkuno.hxx:231
ScDocShell * pDocShell
Definition: linkuno.hxx:278
OUString aItem
Definition: linkuno.hxx:281
OUString aTopic
Definition: linkuno.hxx:280
virtual ~ScDDELinksObj() override
Definition: linkuno.cxx:1191
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:589
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:1199
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:672
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:367
void SetRefreshDelay(sal_uLong nSeconds)
sal_uIntPtr sal_uLong
sal_Int32 getRefreshDelay() const
Definition: linkuno.cxx:344
const sal_uInt8 SC_DDE_DEFAULT
Definition: document.hxx:292
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:992
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:889
static OUString lcl_BuildDDEName(std::u16string_view rAppl, std::u16string_view rTopic, std::u16string_view rItem)
Definition: linkuno.cxx:1032
ScDocShell * mpDocShell
Definition: linkuno.hxx:462
virtual double GetDouble() const
sal_uInt16 getExternalFileId(const OUString &rFile)
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: linkuno.cxx:969
const sal_uInt8 SC_DDE_TEXT
Definition: document.hxx:294
sc::DocumentLinkManager & GetDocLinkManager()
Definition: documen2.cxx:225
virtual ~ScAreaLinksObj() override
Definition: linkuno.cxx:881
bool IsLinked(SCTAB nTab) const
Definition: documen3.cxx:479
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:1535
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:1089
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:909
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:490
order of XNamed and DDELink changed to avoid "duplicate comdat" symbols
Definition: linkuno.hxx:269
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:819
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1687
ScDocShell * pDocShell
Definition: linkuno.hxx:123
ScAreaLinkObj * GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:901
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:1100
OUString getFilterOptions() const
Definition: linkuno.cxx:809
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:943
XRefreshListenerArr_Impl aRefreshListeners
Definition: linkuno.hxx:168
XRefreshListenerArr_Impl aRefreshListeners
Definition: linkuno.hxx:282
ScDocShell * pDocShell
Definition: linkuno.hxx:166
virtual OUString SAL_CALL getApplication() override
Definition: linkuno.cxx:1053
virtual ~ScSheetLinksObj() override
Definition: linkuno.cxx:366
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:312
ScDDELinkObj * GetObjectByName_Impl(std::u16string_view aName)
Definition: linkuno.cxx:1222
bool SetDdeLinkResultMatrix(size_t nDdePos, const ScMatrixRef &pResults)
Sets a result matrix for the specified DDE link.
Definition: documen8.cxx:1023
int nCount
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:1652
void Refreshed_Impl()
Definition: linkuno.cxx:1177
svDouble
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:26
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:986
OUString getFileName() const
Definition: linkuno.cxx:777
virtual css::uno::Reference< css::sheet::XExternalSheetCache > SAL_CALL addSheetCache(const OUString &aSheetName, sal_Bool bDynamicCache) override
Definition: linkuno.cxx:1493
const sal_uInt8 SC_DDE_IGNOREMODE
Definition: document.hxx:295
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:1632
static bool FillMixedArray(css::uno::Any &rAny, ScDocument &rDoc, const ScRange &rRange, bool bAllowNV=false)
void setFilter(const OUString &Filter)
Definition: linkuno.cxx:803
#define SC_UNONAME_FILTER
Definition: unonames.hxx:366
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:521
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:1580
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:1479
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
Definition: global2.cxx:284
virtual ~ScExternalDocLinkObj() override
Definition: linkuno.cxx:1489
sal_uInt16 char * pName
Definition: callform.cxx:57
void setFileName(const OUString &FileName)
Definition: linkuno.cxx:787
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:1681
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:1572
ScDDELinkObj(ScDocShell *pDocSh, const OUString &rA, const OUString &rT, const OUString &rI)
Definition: linkuno.cxx:992
virtual OUString SAL_CALL getTopic() override
Definition: linkuno.cxx:1061
const SvBaseLinks & GetLinks() const
int i
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:980
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:958
void Remove(SvBaseLink const *pLink)
SC_DLLPUBLIC const ScMatrix * GetDdeLinkResultMatrix(size_t nDdePos) const
Returns the result matrix of the specified DDE link.
Definition: documen8.cxx:986
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:1281
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:1313
bool GetDdeLinkData(size_t nDdePos, OUString &rAppl, OUString &rTopic, OUString &rItem) const
Returns the connection data of the specified DDE link.
Definition: documen8.cxx:964
virtual ~ScExternalSheetCacheObj() override
Definition: linkuno.cxx:1391
ScDDELinksObj(ScDocShell *pDocSh)
Definition: linkuno.cxx:1185
ScDocShell * pDocShell
Definition: linkuno.hxx:327
OUString getFilter() const
Definition: linkuno.cxx:793
virtual void SAL_CALL setName(const OUString &aName) override
Definition: linkuno.cxx:136
virtual css::table::CellRangeAddress SAL_CALL getDestArea() override
Definition: linkuno.cxx:859
float u
unsigned char sal_Bool
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:1544
void SetLink(SCTAB nTab, ScLinkMode nMode, const OUString &rDoc, const OUString &rFilter, const OUString &rOptions, const OUString &rTabName, sal_uLong nRefreshDelay)
Definition: documen3.cxx:540
const SfxItemPropertyMap & getPropertyMap() const
virtual css::uno::Reference< css::sheet::XExternalDocLink > SAL_CALL addDocLink(const OUString &aDocName) override
Definition: linkuno.cxx:1609
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:1673
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:512
css::uno::Type const & get()
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:64
virtual void SAL_CALL setSourceArea(const OUString &aSourceArea) override
Definition: linkuno.cxx:853
OUString getFilter() const
Definition: linkuno.cxx:303
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:484
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1275
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:73
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:892
void InsertAreaLink(const OUString &rFile, const OUString &rFilter, const OUString &rOptions, const OUString &rSource, const ScRange &rDestRange, sal_uLong nRefresh, bool bFitBlock, bool bApi)
Definition: docfunc.cxx:5509
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: linkuno.cxx:198
void setRefreshDelay(sal_Int32 nRefreshDelay)
Definition: linkuno.cxx:835
void ModifyRefreshDelay_Impl(sal_Int32 nRefresh)
Definition: linkuno.cxx:189
::formula::FormulaTokenRef TokenRef
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:951
virtual void SAL_CALL refresh() override
Definition: linkuno.cxx:144
virtual ~ScExternalDocLinksObj() override
Definition: linkuno.cxx:1605
virtual void SAL_CALL setName(const OUString &aName) override
Definition: linkuno.cxx:1045
virtual ~ScDDELinkObj() override
Definition: linkuno.cxx:1002
ScDDELinkObj * GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:1211
ScSheetLinkObj * GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:386
virtual ~ScAreaLinkObj() override
Definition: linkuno.cxx:581
#define SC_UNONAME_LINKURL
Definition: unonames.hxx:368
void Refreshed_Impl()
Definition: linkuno.cxx:704
virtual void SAL_CALL setCellValue(sal_Int32 nCol, sal_Int32 nRow, const css::uno::Any &rAny) override
Definition: linkuno.cxx:1395
void ModifyRefreshDelay_Impl(sal_Int32 nRefresh)
Definition: linkuno.cxx:655
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:1242
virtual const svl::SharedString & GetString() const
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
ScSheetLinkObj * GetObjectByName_Impl(const OUString &aName)
Definition: linkuno.cxx:414
SfxItemPropertySet aPropSet
Definition: linkuno.hxx:165
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1586
virtual OUString SAL_CALL getSourceArea() override
Definition: linkuno.cxx:843
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getAllRows() override
Definition: linkuno.cxx:1450
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getResults() override
Definition: linkuno.cxx:1120
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:533
size_t getDdeLinkCount() const
std::shared_ptr< Table > TableTypeRef
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:1291
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:1646
ScExternalDocLinksObj(ScDocShell *pDocShell)
Definition: linkuno.cxx:1599
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: linkuno.cxx:714
virtual void SAL_CALL refresh() override
Definition: linkuno.cxx:1079
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: linkuno.cxx:722
ScDocShell * mpDocShell
Definition: linkuno.hxx:389
OUString getFilterOptions() const
Definition: linkuno.cxx:323
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:900
ScExternalDocLinkObj(ScDocShell *pDocShell, ScExternalRefManager *pRefMgr, sal_uInt16 nFileId)
Definition: linkuno.cxx:1484
ScExternalRefCache::TableTypeRef mpTable
Definition: linkuno.hxx:390
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
Definition: documen3.cxx:526
Sequence< sal_Int8 > aSeq
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:374
const ScDocument & GetDocument() const
Definition: docsh.hxx:217
virtual ~ScSheetLinkObj() override
Definition: linkuno.cxx:84
sal_Int32 getRefreshDelay() const
Definition: linkuno.cxx:825
virtual void SAL_CALL setDestArea(const css::table::CellRangeAddress &aDestArea) override
Definition: linkuno.cxx:869
ScTableLink * GetLink_Impl() const
Definition: linkuno.cxx:109
static ScAreaLink * lcl_GetAreaLink(ScDocShell *pDocShell, size_t nPos)
Definition: linkuno.cxx:552
ScExternalSheetCacheObj(ScDocShell *pDocShell, ScExternalRefCache::TableTypeRef const &pTable, size_t nIndex)
Definition: linkuno.cxx:1384
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:1250
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:1507
virtual void SAL_CALL refresh() override
Definition: linkuno.cxx:664
virtual void SAL_CALL setResults(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aResults) override
Definition: linkuno.cxx:1154
void setFilterOptions(const OUString &FilterOptions)
Definition: linkuno.cxx:333
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:1619
ScExternalRefManager * mpRefMgr
Definition: linkuno.hxx:426
sal_uInt16 mnFileId
Definition: linkuno.hxx:427
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
Definition: convuno.hxx:88
ScAreaLinksObj(ScDocShell *pDocSh)
Definition: linkuno.cxx:875
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:443
const sal_uInt8 SC_DDE_ENGLISH
Definition: document.hxx:293
#define SC_UNONAME_REFDELAY
Definition: unonames.hxx:370
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:219
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:1010
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:80
virtual OUString SAL_CALL getName() override
Definition: linkuno.cxx:1039
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:215
OUString aAppl
Definition: linkuno.hxx:279
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:1269
StackVar GetType() const
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getAllColumns(sal_Int32 nRow) override
Definition: linkuno.cxx:1463
sal_uLong GetRefreshDelay() const
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:1520
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: linkuno.cxx:1552
ScAreaLinkObj(ScDocShell *pDocSh, size_t nP)
Definition: linkuno.cxx:573
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:928
void Modify_Impl(const OUString *pNewFile, const OUString *pNewFilter, const OUString *pNewOptions, const OUString *pNewSource, const css::table::CellRangeAddress *pNewDest)
Definition: linkuno.cxx:613
virtual sal_Int32 SAL_CALL getTokenIndex() override
Definition: linkuno.cxx:1594
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: linkuno.cxx:1259
virtual OUString SAL_CALL getName() override
Definition: linkuno.cxx:130
ScExternalRefManager * mpRefMgr
Definition: linkuno.hxx:463
#define SC_UNONAME_REFPERIOD
Definition: unonames.hxx:369