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