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 <vector>
44 
45 using namespace com::sun::star;
46 using namespace formula;
47 using ::com::sun::star::uno::Any;
48 using ::com::sun::star::uno::Sequence;
49 using ::com::sun::star::lang::IllegalArgumentException;
50 using ::com::sun::star::uno::RuntimeException;
51 using ::std::vector;
52 
53 // used for sheet- and area link:
55 {
56  static const SfxItemPropertyMapEntry aSheetLinkMap_Impl[] =
57  {
63  { u"", 0, css::uno::Type(), 0, 0 }
64  };
65  return aSheetLinkMap_Impl;
66 }
67 
68 SC_SIMPLE_SERVICE_INFO( ScAreaLinkObj, "ScAreaLinkObj", "com.sun.star.sheet.CellAreaLink" )
69 SC_SIMPLE_SERVICE_INFO( ScAreaLinksObj, "ScAreaLinksObj", "com.sun.star.sheet.CellAreaLinks" )
70 SC_SIMPLE_SERVICE_INFO( ScDDELinkObj, "ScDDELinkObj", "com.sun.star.sheet.DDELink" )
71 SC_SIMPLE_SERVICE_INFO( ScDDELinksObj, "ScDDELinksObj", "com.sun.star.sheet.DDELinks" )
72 SC_SIMPLE_SERVICE_INFO( ScSheetLinkObj, "ScSheetLinkObj", "com.sun.star.sheet.SheetLink" )
73 SC_SIMPLE_SERVICE_INFO( ScSheetLinksObj, "ScSheetLinksObj", "com.sun.star.sheet.SheetLinks" )
74 
75 ScSheetLinkObj::ScSheetLinkObj(ScDocShell* pDocSh, const OUString& rName) :
76  aPropSet( lcl_GetSheetLinkMap() ),
77  pDocShell( pDocSh ),
78  aFileName( rName )
79 {
80  pDocShell->GetDocument().AddUnoObject(*this);
81 }
82 
84 {
86 
87  if (pDocShell)
88  pDocShell->GetDocument().RemoveUnoObject(*this);
89 }
90 
92 {
94  // UpdateRef is not needed here
95 
96  if ( auto pRefreshHint = dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
97  {
98  if ( pRefreshHint->GetLinkType() == ScLinkRefType::SHEET && pRefreshHint->GetUrl() == aFileName )
99  Refreshed_Impl();
100  }
101  else
102  {
103  if ( rHint.GetId() == SfxHintId::Dying )
104  pDocShell = nullptr; // pointer is invalid
105  }
106 }
107 
109 {
110  if (pDocShell)
111  {
112  sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
113  size_t nCount = pLinkManager->GetLinks().size();
114  for (size_t i=0; i<nCount; i++)
115  {
116  ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
117  if (auto pTabLink = dynamic_cast<ScTableLink*>( pBase))
118  {
119  if ( pTabLink->GetFileName() == aFileName )
120  return pTabLink;
121  }
122  }
123  }
124  return nullptr; // not found
125 }
126 
127 // XNamed
128 
129 OUString SAL_CALL ScSheetLinkObj::getName()
130 {
131  SolarMutexGuard aGuard;
132  return getFileName(); // Name is the same as filename (URL)
133 }
134 
135 void SAL_CALL ScSheetLinkObj::setName( const OUString& aName )
136 {
137  SolarMutexGuard aGuard;
138  setFileName(aName); // Name is the same as filename (URL)
139 }
140 
141 // XRefreshable
142 
143 void SAL_CALL ScSheetLinkObj::refresh()
144 {
145  SolarMutexGuard aGuard;
146  ScTableLink* pLink = GetLink_Impl();
147  if (pLink)
148  pLink->Refresh( pLink->GetFileName(), pLink->GetFilterName(), nullptr, pLink->GetRefreshDelay() );
149 }
150 
152  const uno::Reference<util::XRefreshListener >& xListener )
153 {
154  SolarMutexGuard aGuard;
155  aRefreshListeners.push_back( xListener );
156 
157  // hold one additional ref to keep this object alive as long as there are listeners
158  if ( aRefreshListeners.size() == 1 )
159  acquire();
160 }
161 
163  const uno::Reference<util::XRefreshListener >& xListener )
164 {
165  SolarMutexGuard aGuard;
166  size_t nCount = aRefreshListeners.size();
167  for ( size_t n=nCount; n--; )
168  {
169  uno::Reference<util::XRefreshListener>& rObj = aRefreshListeners[n];
170  if ( rObj == xListener )
171  {
172  aRefreshListeners.erase( aRefreshListeners.begin() + n );
173  if ( aRefreshListeners.empty() )
174  release(); // release ref for listeners
175  break;
176  }
177  }
178 }
179 
181 {
182  lang::EventObject aEvent;
183  aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
184  for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners)
185  xRefreshListener->refreshed( aEvent );
186 }
187 
188 void ScSheetLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefresh )
189 {
190  ScTableLink* pLink = GetLink_Impl();
191  if( pLink )
192  pLink->SetRefreshDelay( static_cast<sal_uLong>(nRefresh) );
193 }
194 
195 // XPropertySet
196 
197 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScSheetLinkObj::getPropertySetInfo()
198 {
199  SolarMutexGuard aGuard;
200  static uno::Reference<beans::XPropertySetInfo> aRef(
201  new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
202  return aRef;
203 }
204 
206  const OUString& aPropertyName, const uno::Any& aValue )
207 {
208  SolarMutexGuard aGuard;
209  OUString aValStr;
210  if ( aPropertyName == SC_UNONAME_LINKURL )
211  {
212  if ( aValue >>= aValStr )
213  setFileName( aValStr );
214  }
215  else if ( aPropertyName == SC_UNONAME_FILTER )
216  {
217  if ( aValue >>= aValStr )
218  setFilter( aValStr );
219  }
220  else if ( aPropertyName == SC_UNONAME_FILTOPT )
221  {
222  if ( aValue >>= aValStr )
223  setFilterOptions( aValStr );
224  }
225  else if ( aPropertyName == SC_UNONAME_REFPERIOD )
226  {
227  sal_Int32 nRefresh = 0;
228  if ( aValue >>= nRefresh )
229  setRefreshDelay( nRefresh );
230  }
231  else if ( aPropertyName == SC_UNONAME_REFDELAY )
232  {
233  sal_Int32 nRefresh = 0;
234  if ( aValue >>= nRefresh )
235  setRefreshDelay( nRefresh );
236  }
237 }
238 
239 uno::Any SAL_CALL ScSheetLinkObj::getPropertyValue( const OUString& aPropertyName )
240 {
241  SolarMutexGuard aGuard;
242  uno::Any aRet;
243  if ( aPropertyName == SC_UNONAME_LINKURL )
244  aRet <<= getFileName();
245  else if ( aPropertyName == SC_UNONAME_FILTER )
246  aRet <<= getFilter();
247  else if ( aPropertyName == SC_UNONAME_FILTOPT )
248  aRet <<= getFilterOptions();
249  else if ( aPropertyName == SC_UNONAME_REFPERIOD )
250  aRet <<= getRefreshDelay();
251  else if ( aPropertyName == SC_UNONAME_REFDELAY )
252  aRet <<= getRefreshDelay();
253  return aRet;
254 }
255 
257 
258 // internal:
259 
260 OUString ScSheetLinkObj::getFileName() const
261 {
262  SolarMutexGuard aGuard;
263  return aFileName;
264 }
265 
266 void ScSheetLinkObj::setFileName(const OUString& rNewName)
267 {
268  SolarMutexGuard aGuard;
269  ScTableLink* pLink = GetLink_Impl();
270  if (!pLink)
271  return;
272 
273  // pLink->Refresh with a new file name confuses sfx2::LinkManager
274  // therefore we transplant the sheets manually and create new links with UpdateLinks
275 
276  OUString aNewStr(ScGlobal::GetAbsDocName( rNewName, pDocShell ));
277 
278  // first transplant the sheets
279 
280  ScDocument& rDoc = pDocShell->GetDocument();
281  SCTAB nTabCount = rDoc.GetTableCount();
282  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
283  if ( rDoc.IsLinked(nTab) && rDoc.GetLinkDoc(nTab) == aFileName ) // old file
284  rDoc.SetLink( nTab, rDoc.GetLinkMode(nTab), aNewStr,
285  rDoc.GetLinkFlt(nTab), rDoc.GetLinkOpt(nTab),
286  rDoc.GetLinkTab(nTab),
287  rDoc.GetLinkRefreshDelay(nTab) ); // only change the file
288 
289  // update links
291 
292  pDocShell->UpdateLinks(); // remove old links, possibly set up new ones
293 
294  // copy data
295 
296  aFileName = aNewStr;
297  pLink = GetLink_Impl(); // new link with new name
298  if (pLink)
299  pLink->Update(); // incl. paint & undo for data
300 }
301 
303 {
304  SolarMutexGuard aGuard;
305  OUString aRet;
306  ScTableLink* pLink = GetLink_Impl();
307  if (pLink)
308  aRet = pLink->GetFilterName();
309  return aRet;
310 }
311 
312 void ScSheetLinkObj::setFilter(const OUString& rFilter)
313 {
314  SolarMutexGuard aGuard;
315  ScTableLink* pLink = GetLink_Impl();
316  if (pLink)
317  {
318  pLink->Refresh( aFileName, rFilter, nullptr, pLink->GetRefreshDelay() );
319  }
320 }
321 
323 {
324  SolarMutexGuard aGuard;
325  OUString aRet;
326  ScTableLink* pLink = GetLink_Impl();
327  if (pLink)
328  aRet = pLink->GetOptions();
329  return aRet;
330 }
331 
332 void ScSheetLinkObj::setFilterOptions(const OUString& FilterOptions)
333 {
334  SolarMutexGuard aGuard;
335  ScTableLink* pLink = GetLink_Impl();
336  if (pLink)
337  {
338  OUString aOptStr(FilterOptions);
339  pLink->Refresh( aFileName, pLink->GetFilterName(), &aOptStr, pLink->GetRefreshDelay() );
340  }
341 }
342 
344 {
345  SolarMutexGuard aGuard;
346  sal_Int32 nRet = 0;
347  ScTableLink* pLink = GetLink_Impl();
348  if (pLink)
349  nRet = static_cast<sal_Int32>(pLink->GetRefreshDelay());
350  return nRet;
351 }
352 
353 void ScSheetLinkObj::setRefreshDelay(sal_Int32 nRefreshDelay)
354 {
355  SolarMutexGuard aGuard;
356  ModifyRefreshDelay_Impl( nRefreshDelay );
357 }
358 
360  pDocShell( pDocSh )
361 {
363 }
364 
366 {
367  SolarMutexGuard g;
368 
369  if (pDocShell)
371 }
372 
374 {
375  // we don't care about update of references here
376 
377  if ( rHint.GetId() == SfxHintId::Dying )
378  {
379  pDocShell = nullptr; // became invalid
380  }
381 }
382 
383 // XSheetLinks
384 
386 {
387  if (!pDocShell)
388  return nullptr;
389 
390  typedef std::unordered_set<OUString> StrSetType;
391  StrSetType aNames;
392  ScDocument& rDoc = pDocShell->GetDocument();
393  SCTAB nTabCount = rDoc.GetTableCount();
394  sal_Int32 nCount = 0;
395  for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
396  {
397  if (!rDoc.IsLinked(nTab))
398  continue;
399 
400  OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
401  if (aNames.insert(aLinkDoc).second)
402  {
403  // unique document name.
404  if (nCount == nIndex)
405  return new ScSheetLinkObj( pDocShell, aLinkDoc );
406  ++nCount;
407  }
408  }
409 
410  return nullptr; // no document or index too large
411 }
412 
414 {
415  // Name is the same as file name
416 
417  if (pDocShell)
418  {
419  ScDocument& rDoc = pDocShell->GetDocument();
420  SCTAB nTabCount = rDoc.GetTableCount();
421  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
422  if (rDoc.IsLinked(nTab))
423  {
425  OUString aLinkDoc = rDoc.GetLinkDoc( nTab );
426  if ( aLinkDoc == aName )
427  return new ScSheetLinkObj( pDocShell, aName );
428  }
429  }
430 
431  return nullptr;
432 }
433 
434 // XEnumerationAccess
435 uno::Reference<container::XEnumeration> SAL_CALL ScSheetLinksObj::createEnumeration()
436 {
437  SolarMutexGuard aGuard;
438  return new ScIndexEnumeration(this, "com.sun.star.sheet.SheetLinksEnumeration");
439 }
440 
441 // XIndexAccess
442 sal_Int32 SAL_CALL ScSheetLinksObj::getCount()
443 {
444  typedef std::unordered_set<OUString> StrSetType;
445 
446  SolarMutexGuard aGuard;
447  if (!pDocShell)
448  return 0;
449 
450  sal_Int32 nCount = 0;
451 
452  StrSetType aNames;
453  ScDocument& rDoc = pDocShell->GetDocument();
454  SCTAB nTabCount = rDoc.GetTableCount();
455  for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
456  {
457  if (!rDoc.IsLinked(nTab))
458  continue;
459 
460  OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
461  if (aNames.insert(aLinkDoc).second)
462  ++nCount;
463  }
464  return nCount;
465 }
466 
467 uno::Any SAL_CALL ScSheetLinksObj::getByIndex( sal_Int32 nIndex )
468 {
469  SolarMutexGuard aGuard;
470  uno::Reference<beans::XPropertySet> xLink(GetObjectByIndex_Impl(nIndex));
471  if (!xLink.is())
472  throw lang::IndexOutOfBoundsException();
473 
474  return uno::makeAny(xLink);
475 }
476 
478 {
479  SolarMutexGuard aGuard;
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::makeAny(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_uLong nRefresh = pLink->GetRefreshDelay();
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, nRefresh, bFitBlock, true );
652 }
653 
654 void ScAreaLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefresh )
655 {
657  if( pLink )
658  pLink->SetRefreshDelay( static_cast<sal_uLong>(nRefresh) );
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->GetRefreshDelay() );
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 = static_cast<sal_Int32>(pLink->GetRefreshDelay());
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  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::makeAny(xLink);
976 
977 }
978 
980 {
981  SolarMutexGuard aGuard;
983 }
984 
986 {
987  SolarMutexGuard aGuard;
988  return ( getCount() != 0 );
989 }
990 
991 ScDDELinkObj::ScDDELinkObj(ScDocShell* pDocSh, const OUString& rA,
992  const OUString& rT, const OUString& rI) :
993  pDocShell( pDocSh ),
994  aAppl( rA ),
995  aTopic( rT ),
996  aItem( rI )
997 {
999 }
1000 
1002 {
1003  SolarMutexGuard g;
1004 
1005  if (pDocShell)
1007 }
1008 
1010 {
1012  // UpdateRef is not needed here
1013 
1014  if ( auto pRefreshedHint = dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
1015  {
1016  if ( pRefreshedHint->GetLinkType() == ScLinkRefType::DDE &&
1017  pRefreshedHint->GetDdeAppl() == aAppl &&
1018  pRefreshedHint->GetDdeTopic() == aTopic &&
1019  pRefreshedHint->GetDdeItem() == aItem )
1020  Refreshed_Impl();
1021  }
1022  else
1023  {
1024  if ( rHint.GetId() == SfxHintId::Dying )
1025  pDocShell = nullptr; // pointer is invalid
1026  }
1027 }
1028 
1029 // XNamed
1030 
1031 static OUString lcl_BuildDDEName( const OUString& rAppl, const OUString& rTopic, const OUString& rItem )
1032 {
1033  // Appl|Topic!Item (like Excel)
1034  OUString aRet = rAppl + "|" + rTopic + "!" + rItem;
1035  return aRet;
1036 }
1037 
1038 OUString SAL_CALL ScDDELinkObj::getName()
1039 {
1040  SolarMutexGuard aGuard;
1041  return lcl_BuildDDEName( aAppl, aTopic, aItem );
1042 }
1043 
1044 void SAL_CALL ScDDELinkObj::setName( const OUString& /* aName */ )
1045 {
1046  // name can't be changed (formulas wouldn't find the link)
1047  throw uno::RuntimeException();
1048 }
1049 
1050 // XDDELink
1051 
1052 OUString SAL_CALL ScDDELinkObj::getApplication()
1053 {
1054  SolarMutexGuard aGuard;
1056 
1057  return aAppl;
1058 }
1059 
1060 OUString SAL_CALL ScDDELinkObj::getTopic()
1061 {
1062  SolarMutexGuard aGuard;
1064 
1065  return aTopic;
1066 }
1067 
1068 OUString SAL_CALL ScDDELinkObj::getItem()
1069 {
1070  SolarMutexGuard aGuard;
1072 
1073  return aItem;
1074 }
1075 
1076 // XRefreshable
1077 
1078 void SAL_CALL ScDDELinkObj::refresh()
1079 {
1080  SolarMutexGuard aGuard;
1081  if (pDocShell)
1082  {
1084  rMgr.updateDdeLink(aAppl, aTopic, aItem);
1085  }
1086 }
1087 
1089  const uno::Reference<util::XRefreshListener >& xListener )
1090 {
1091  SolarMutexGuard aGuard;
1092  aRefreshListeners.push_back( xListener );
1093 
1094  // hold one additional ref to keep this object alive as long as there are listeners
1095  if ( aRefreshListeners.size() == 1 )
1096  acquire();
1097 }
1098 
1100  const uno::Reference<util::XRefreshListener >& xListener )
1101 {
1102  SolarMutexGuard aGuard;
1103  size_t nCount = aRefreshListeners.size();
1104  for ( size_t n=nCount; n--; )
1105  {
1106  uno::Reference<util::XRefreshListener>& rObj = aRefreshListeners[n];
1107  if ( rObj == xListener )
1108  {
1109  aRefreshListeners.erase( aRefreshListeners.begin() + n );
1110  if ( aRefreshListeners.empty() )
1111  release(); // release ref for listeners
1112  break;
1113  }
1114  }
1115 }
1116 
1117 // XDDELinkResults
1118 
1119 uno::Sequence< uno::Sequence< uno::Any > > ScDDELinkObj::getResults( )
1120 {
1121  SolarMutexGuard aGuard;
1122  uno::Sequence< uno::Sequence< uno::Any > > aReturn;
1123  bool bSuccess = false;
1124 
1125  if ( pDocShell )
1126  {
1127  ScDocument& rDoc = pDocShell->GetDocument();
1128  size_t nPos = 0;
1129  if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
1130  {
1131  const ScMatrix* pMatrix = rDoc.GetDdeLinkResultMatrix( nPos );
1132  if ( pMatrix )
1133  {
1134  uno::Any aAny;
1135  if ( ScRangeToSequence::FillMixedArray( aAny, pMatrix, true ) )
1136  {
1137  aAny >>= aReturn;
1138  }
1139  }
1140  bSuccess = true;
1141  }
1142  }
1143 
1144  if ( !bSuccess )
1145  {
1146  throw uno::RuntimeException(
1147  "ScDDELinkObj::getResults: failed to get results!" );
1148  }
1149 
1150  return aReturn;
1151 }
1152 
1153 void ScDDELinkObj::setResults( const uno::Sequence< uno::Sequence< uno::Any > >& aResults )
1154 {
1155  SolarMutexGuard aGuard;
1156  bool bSuccess = false;
1157 
1158  if ( pDocShell )
1159  {
1160  ScDocument& rDoc = pDocShell->GetDocument();
1161  size_t nPos = 0;
1162  if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
1163  {
1164  ScMatrixRef xMatrix = ScSequenceToMatrix::CreateMixedMatrix( Any(aResults) );
1165  bSuccess = rDoc.SetDdeLinkResultMatrix( nPos, xMatrix );
1166  }
1167  }
1168 
1169  if ( !bSuccess )
1170  {
1171  throw uno::RuntimeException(
1172  "ScDDELinkObj::setResults: failed to set results!" );
1173  }
1174 }
1175 
1177 {
1178  lang::EventObject aEvent;
1179  aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
1180  for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners)
1181  xRefreshListener->refreshed( aEvent );
1182 }
1183 
1185  pDocShell( pDocSh )
1186 {
1188 }
1189 
1191 {
1192  SolarMutexGuard g;
1193 
1194  if (pDocShell)
1196 }
1197 
1199 {
1200  // we don't care about update of references here
1201 
1202  if ( rHint.GetId() == SfxHintId::Dying )
1203  {
1204  pDocShell = nullptr; // became invalid
1205  }
1206 }
1207 
1208 // XDDELinks
1209 
1211 {
1212  if (pDocShell)
1213  {
1214  OUString aAppl, aTopic, aItem;
1215  if ( pDocShell->GetDocument().GetDdeLinkData( static_cast<size_t>(nIndex), aAppl, aTopic, aItem ) )
1216  return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem );
1217  }
1218  return nullptr;
1219 }
1220 
1222 {
1223  if (pDocShell)
1224  {
1225  OUString aAppl, aTopic, aItem;
1226 
1227  ScDocument& rDoc = pDocShell->GetDocument();
1228  size_t nCount = rDoc.GetDocLinkManager().getDdeLinkCount();
1229  for (size_t i=0; i<nCount; i++)
1230  {
1231  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1232  if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aName )
1233  return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem );
1234  }
1235  }
1236  return nullptr;
1237 }
1238 
1239 // XEnumerationAccess
1240 
1241 uno::Reference<container::XEnumeration> SAL_CALL ScDDELinksObj::createEnumeration()
1242 {
1243  SolarMutexGuard aGuard;
1244  return new ScIndexEnumeration(this, "com.sun.star.sheet.DDELinksEnumeration");
1245 }
1246 
1247 // XIndexAccess
1248 
1249 sal_Int32 SAL_CALL ScDDELinksObj::getCount()
1250 {
1251  SolarMutexGuard aGuard;
1252  sal_Int32 nAreaCount = 0;
1253  if (pDocShell)
1255  return nAreaCount;
1256 }
1257 
1258 uno::Any SAL_CALL ScDDELinksObj::getByIndex( sal_Int32 nIndex )
1259 {
1260  SolarMutexGuard aGuard;
1261  uno::Reference<sheet::XDDELink> xLink(GetObjectByIndex_Impl(nIndex));
1262  if (!xLink.is())
1263  throw lang::IndexOutOfBoundsException();
1264 
1265  return uno::makeAny(xLink);
1266 }
1267 
1269 {
1270  SolarMutexGuard aGuard;
1272 }
1273 
1275 {
1276  SolarMutexGuard aGuard;
1277  return ( getCount() != 0 );
1278 }
1279 
1280 uno::Any SAL_CALL ScDDELinksObj::getByName( const OUString& aName )
1281 {
1282  SolarMutexGuard aGuard;
1283  uno::Reference<sheet::XDDELink> xLink(GetObjectByName_Impl(aName));
1284  if (!xLink.is())
1285  throw container::NoSuchElementException();
1286 
1287  return uno::makeAny(xLink);
1288 }
1289 
1290 uno::Sequence<OUString> SAL_CALL ScDDELinksObj::getElementNames()
1291 {
1292  SolarMutexGuard aGuard;
1293  if (pDocShell)
1294  {
1295  OUString aAppl, aTopic, aItem;
1296 
1297  ScDocument& rDoc = pDocShell->GetDocument();
1299  uno::Sequence<OUString> aSeq(nCount);
1300  OUString* pAry = aSeq.getArray();
1301 
1302  for (size_t i=0; i<nCount; i++)
1303  {
1304  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1305  pAry[i] = lcl_BuildDDEName(aAppl, aTopic, aItem);
1306  }
1307  return aSeq;
1308  }
1309  return uno::Sequence<OUString>();
1310 }
1311 
1312 sal_Bool SAL_CALL ScDDELinksObj::hasByName( const OUString& aName )
1313 {
1314  SolarMutexGuard aGuard;
1315  if (pDocShell)
1316  {
1317  OUString aAppl, aTopic, aItem;
1318 
1319  ScDocument& rDoc = pDocShell->GetDocument();
1321  for (size_t i=0; i<nCount; i++)
1322  {
1323  rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
1324  if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aName )
1325  return true;
1326  }
1327  }
1328  return false;
1329 }
1330 
1331 // XDDELinks
1332 
1333 uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink(
1334  const OUString& aApplication, const OUString& aTopic,
1335  const OUString& aItem, css::sheet::DDELinkMode nMode )
1336 {
1337  SolarMutexGuard aGuard;
1338  uno::Reference< sheet::XDDELink > xLink;
1339 
1340  if ( pDocShell )
1341  {
1342  ScDocument& rDoc = pDocShell->GetDocument();
1343  sal_uInt8 nMod = SC_DDE_DEFAULT;
1344  switch ( nMode )
1345  {
1346  case sheet::DDELinkMode_DEFAULT:
1347  {
1348  nMod = SC_DDE_DEFAULT;
1349  }
1350  break;
1351  case sheet::DDELinkMode_ENGLISH:
1352  {
1353  nMod = SC_DDE_ENGLISH;
1354  }
1355  break;
1356  case sheet::DDELinkMode_TEXT:
1357  {
1358  nMod = SC_DDE_TEXT;
1359  }
1360  break;
1361  default:
1362  {
1363  }
1364  break;
1365  }
1366 
1367  if ( rDoc.CreateDdeLink( aApplication, aTopic, aItem, nMod, ScMatrixRef() ) )
1368  {
1369  const OUString aName( lcl_BuildDDEName( aApplication, aTopic, aItem ) );
1370  xLink.set( GetObjectByName_Impl( aName ) );
1371  }
1372  }
1373 
1374  if ( !xLink.is() )
1375  {
1376  throw uno::RuntimeException(
1377  "ScDDELinksObj::addDDELink: cannot add DDE link!" );
1378  }
1379 
1380  return xLink;
1381 }
1382 
1384  mpDocShell(pDocShell),
1385  mpTable(pTable),
1386  mnIndex(nIndex)
1387 {
1388 }
1389 
1391 {
1392 }
1393 
1394 void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nCol, sal_Int32 nRow, const Any& rValue)
1395 {
1396  SolarMutexGuard aGuard;
1397  if (nRow < 0 || nCol < 0)
1398  throw IllegalArgumentException();
1399 
1401  double fVal = 0.0;
1402  OUString aVal;
1403  if (rValue >>= fVal)
1404  pToken.reset(new FormulaDoubleToken(fVal));
1405  else if (rValue >>= aVal)
1406  {
1408  svl::SharedString aSS = rPool.intern(aVal);
1409  pToken.reset(new FormulaStringToken(aSS));
1410  }
1411  else
1412  // unidentified value type.
1413  return;
1414 
1415  mpTable->setCell(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), pToken);
1416 }
1417 
1418 Any SAL_CALL ScExternalSheetCacheObj::getCellValue(sal_Int32 nCol, sal_Int32 nRow)
1419 {
1420  SolarMutexGuard aGuard;
1421  if (nRow < 0 || nCol < 0)
1422  throw IllegalArgumentException();
1423 
1424  FormulaToken* pToken = mpTable->getCell(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow)).get();
1425  if (!pToken)
1426  throw IllegalArgumentException();
1427 
1428  Any aValue;
1429  switch (pToken->GetType())
1430  {
1431  case svDouble:
1432  {
1433  double fVal = pToken->GetDouble();
1434  aValue <<= fVal;
1435  }
1436  break;
1437  case svString:
1438  {
1439  OUString aVal = pToken->GetString().getString();
1440  aValue <<= aVal;
1441  }
1442  break;
1443  default:
1444  throw IllegalArgumentException();
1445  }
1446  return aValue;
1447 }
1448 
1449 Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllRows()
1450 {
1451  SolarMutexGuard aGuard;
1452  vector<SCROW> aRows;
1453  mpTable->getAllRows(aRows);
1454  size_t nSize = aRows.size();
1455  Sequence<sal_Int32> aRowsSeq(nSize);
1456  for (size_t i = 0; i < nSize; ++i)
1457  aRowsSeq[i] = aRows[i];
1458 
1459  return aRowsSeq;
1460 }
1461 
1462 Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllColumns(sal_Int32 nRow)
1463 {
1464  SolarMutexGuard aGuard;
1465  if (nRow < 0)
1466  throw IllegalArgumentException();
1467 
1468  vector<SCCOL> aCols;
1469  mpTable->getAllCols(static_cast<SCROW>(nRow), aCols);
1470  size_t nSize = aCols.size();
1471  Sequence<sal_Int32> aColsSeq(nSize);
1472  for (size_t i = 0; i < nSize; ++i)
1473  aColsSeq[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 {
1581  SolarMutexGuard aGuard;
1583 }
1584 
1586 {
1587  SolarMutexGuard aGuard;
1588 
1589  // #i116940# be consistent with getByName: count only table names which have a cache already
1590  return getElementNames().hasElements();
1591 }
1592 
1594 {
1595  return static_cast<sal_Int32>(mnFileId);
1596 }
1597 
1599  mpDocShell(pDocShell),
1600  mpRefMgr(pDocShell->GetDocument().GetExternalRefManager())
1601 {
1602 }
1603 
1605 {
1606 }
1607 
1608 uno::Reference< sheet::XExternalDocLink > SAL_CALL ScExternalDocLinksObj::addDocLink(
1609  const OUString& aDocName )
1610 {
1611  SolarMutexGuard aGuard;
1612  OUString aDocUrl( ScGlobal::GetAbsDocName( aDocName, mpDocShell));
1613  sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocUrl);
1614  uno::Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
1615  return aDocLink;
1616 }
1617 
1618 Any SAL_CALL ScExternalDocLinksObj::getByName(const OUString &aName)
1619 {
1620  SolarMutexGuard aGuard;
1621  OUString aDocUrl( ScGlobal::GetAbsDocName( aName, mpDocShell));
1622  if (!mpRefMgr->hasExternalFile(aDocUrl))
1623  throw container::NoSuchElementException();
1624 
1625  sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocUrl);
1626  uno::Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
1627 
1628  return Any(aDocLink);
1629 }
1630 
1632 {
1633  SolarMutexGuard aGuard;
1634  sal_uInt16 n = mpRefMgr->getExternalFileCount();
1636  for (sal_uInt16 i = 0; i < n; ++i)
1637  {
1638  const OUString* pName = mpRefMgr->getExternalFileName(i);
1639  aSeq[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 {
1682  SolarMutexGuard aGuard;
1684 }
1685 
1687 {
1688  SolarMutexGuard aGuard;
1689  return mpRefMgr->getExternalFileCount() > 0;
1690 }
1691 
1692 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
Definition: documen3.cxx:506
size_t nPos
Definition: linkuno.hxx:167
virtual css::uno::Any SAL_CALL getCellValue(sal_Int32 nCol, sal_Int32 nRow) override
Definition: linkuno.cxx:1418
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:151
ScDocShell * mpDocShell
Definition: linkuno.hxx:425
OUString GetLinkOpt(SCTAB nTab) const
Definition: documen3.cxx:520
virtual OUString SAL_CALL getItem() override
Definition: linkuno.cxx:1068
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:353
virtual svl::SharedString GetString() const
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:1333
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:499
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:563
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:499
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:312
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:1190
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:1198
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:205
#define SC_UNONAME_FILTOPT
Definition: unonames.hxx:367
void SetRefreshDelay(sal_uLong nSeconds)
sal_uIntPtr sal_uLong
sal_Int32 getRefreshDelay() const
Definition: linkuno.cxx:343
const sal_uInt8 SC_DDE_DEFAULT
Definition: document.hxx:291
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:91
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:991
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:888
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:968
const sal_uInt8 SC_DDE_TEXT
Definition: document.hxx:293
sc::DocumentLinkManager & GetDocLinkManager()
Definition: documen2.cxx:225
virtual ~ScAreaLinksObj() override
Definition: linkuno.cxx:880
bool IsLinked(SCTAB nTab) const
Definition: documen3.cxx:480
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:162
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:266
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:1088
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: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:818
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1686
ScDocShell * pDocShell
Definition: linkuno.hxx:123
ScAreaLinkObj * GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:900
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: linkuno.cxx:1099
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:168
XRefreshListenerArr_Impl aRefreshListeners
Definition: linkuno.hxx:282
ScDocShell * pDocShell
Definition: linkuno.hxx:166
virtual OUString SAL_CALL getApplication() override
Definition: linkuno.cxx:1052
virtual ~ScSheetLinksObj() override
Definition: linkuno.cxx:365
ScDDELinkObj * GetObjectByName_Impl(const OUString &aName)
Definition: linkuno.cxx:1221
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
bool SetDdeLinkResultMatrix(size_t nDdePos, const ScMatrixRef &pResults)
Sets a result matrix for the specified DDE link.
Definition: documen8.cxx:1022
int nCount
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:1651
void Refreshed_Impl()
Definition: linkuno.cxx:1176
static OUString lcl_BuildDDEName(const OUString &rAppl, const OUString &rTopic, const OUString &rItem)
Definition: linkuno.cxx:1031
svDouble
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:26
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:985
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:294
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:1631
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:366
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
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: linkuno.cxx:467
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:435
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:284
virtual ~ScExternalDocLinkObj() override
Definition: linkuno.cxx:1488
sal_uInt16 char * pName
Definition: callform.cxx:58
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:991
virtual OUString SAL_CALL getTopic() override
Definition: linkuno.cxx:1060
const SvBaseLinks & GetLinks() const
int i
virtual css::uno::Type SAL_CALL getElementType() override
Definition: linkuno.cxx:979
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:985
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:1280
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:1312
bool GetDdeLinkData(size_t nDdePos, OUString &rAppl, OUString &rTopic, OUString &rItem) const
Returns the connection data of the specified DDE link.
Definition: documen8.cxx:963
virtual ~ScExternalSheetCacheObj() override
Definition: linkuno.cxx:1390
ScDDELinksObj(ScDocShell *pDocSh)
Definition: linkuno.cxx:1184
ScDocShell * pDocShell
Definition: linkuno.hxx:327
OUString getFilter() const
Definition: linkuno.cxx:792
virtual void SAL_CALL setName(const OUString &aName) override
Definition: linkuno.cxx:135
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:541
const SfxItemPropertyMap & getPropertyMap() const
virtual css::uno::Reference< css::sheet::XExternalDocLink > SAL_CALL addDocLink(const OUString &aDocName) override
Definition: linkuno.cxx:1608
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:513
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:852
OUString getFilter() const
Definition: linkuno.cxx:302
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:483
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1274
static const SfxItemPropertyMapEntry * lcl_GetSheetLinkMap()
Definition: linkuno.cxx:54
bool hasExternalFile(sal_uInt16 nFileId) const
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:73
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:893
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:5515
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: linkuno.cxx:197
void setRefreshDelay(sal_Int32 nRefreshDelay)
Definition: linkuno.cxx:834
void ModifyRefreshDelay_Impl(sal_Int32 nRefresh)
Definition: linkuno.cxx:188
::formula::FormulaTokenRef TokenRef
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:950
virtual void SAL_CALL refresh() override
Definition: linkuno.cxx:143
virtual ~ScExternalDocLinksObj() override
Definition: linkuno.cxx:1604
void updateDdeLink(const OUString &rAppl, const OUString &rTopic, const OUString &rItem)
virtual void SAL_CALL setName(const OUString &aName) override
Definition: linkuno.cxx:1044
virtual ~ScDDELinkObj() override
Definition: linkuno.cxx:1001
SC_DLLPUBLIC bool FindDdeLink(const OUString &rAppl, const OUString &rTopic, const OUString &rItem, sal_uInt8 nMode, size_t &rnDdePos)
Tries to find a DDE link with the specified connection data.
Definition: documen8.cxx:957
ScDDELinkObj * GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:1210
ScSheetLinkObj * GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: linkuno.cxx:385
virtual ~ScAreaLinkObj() override
Definition: linkuno.cxx:580
#define SC_UNONAME_LINKURL
Definition: unonames.hxx:368
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:1394
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:477
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: linkuno.cxx:1241
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
ScSheetLinkObj * GetObjectByName_Impl(const OUString &aName)
Definition: linkuno.cxx:413
SfxItemPropertySet aPropSet
Definition: linkuno.hxx:165
virtual sal_Bool SAL_CALL hasElements() override
Definition: linkuno.cxx:1585
virtual OUString SAL_CALL getSourceArea() override
Definition: linkuno.cxx:842
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getAllRows() override
Definition: linkuno.cxx:1449
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getResults() override
Definition: linkuno.cxx:1119
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:534
size_t getDdeLinkCount() const
std::shared_ptr< Table > TableTypeRef
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: linkuno.cxx:1290
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: linkuno.cxx:1645
ScExternalDocLinksObj(ScDocShell *pDocShell)
Definition: linkuno.cxx:1598
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: linkuno.cxx:713
virtual void SAL_CALL refresh() override
Definition: linkuno.cxx:1078
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: linkuno.cxx:721
ScDocShell * mpDocShell
Definition: linkuno.hxx:389
OUString getFilterOptions() const
Definition: linkuno.cxx:322
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:901
ScExternalDocLinkObj(ScDocShell *pDocShell, ScExternalRefManager *pRefMgr, sal_uInt16 nFileId)
Definition: linkuno.cxx:1483
ScExternalRefCache::TableTypeRef mpTable
Definition: linkuno.hxx:390
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
Definition: documen3.cxx:527
Sequence< sal_Int8 > aSeq
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:373
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
virtual ~ScSheetLinkObj() override
Definition: linkuno.cxx:83
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:108
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:1383
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:1249
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: linkuno.cxx:239
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:1153
void setFilterOptions(const OUString &FilterOptions)
Definition: linkuno.cxx:332
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: linkuno.cxx:1618
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:874
virtual sal_Int32 SAL_CALL getCount() override
Definition: linkuno.cxx:442
const sal_uInt8 SC_DDE_ENGLISH
Definition: document.hxx:292
#define SC_UNONAME_REFDELAY
Definition: unonames.hxx:370
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:218
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: linkuno.cxx:1009
ScSheetLinksObj(ScDocShell *pDocSh)
Definition: linkuno.cxx:359
void Refreshed_Impl()
Definition: linkuno.cxx:180
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:1038
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:1268
StackVar GetType() const
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getAllColumns(sal_Int32 nRow) override
Definition: linkuno.cxx:1462
sal_uLong GetRefreshDelay() const
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
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:1593
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: linkuno.cxx:1258
virtual OUString SAL_CALL getName() override
Definition: linkuno.cxx:129
ScExternalRefManager * mpRefMgr
Definition: linkuno.hxx:463
#define SC_UNONAME_REFPERIOD
Definition: unonames.hxx:369