LibreOffice Module sc (master)  1
nameuno.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 <svl/hint.hxx>
21 #include <vcl/svapp.hxx>
22 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
23 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
24 #include <com/sun/star/awt/XBitmap.hpp>
25 #include <com/sun/star/beans/PropertyAttribute.hpp>
26 
29 #include <unotools/charclass.hxx>
30 
31 using namespace ::com::sun::star;
32 using ::com::sun::star::uno::Reference;
33 using ::com::sun::star::uno::Any;
34 
35 #include <nameuno.hxx>
36 #include <miscuno.hxx>
37 #include <cellsuno.hxx>
38 #include <convuno.hxx>
39 #include <targuno.hxx>
40 #include <tokenuno.hxx>
41 #include <tokenarray.hxx>
42 #include <docsh.hxx>
43 #include <docfunc.hxx>
44 #include <rangenam.hxx>
45 #include <unonames.hxx>
46 
47 #include <scui_def.hxx>
48 
50 {
51  static const SfxItemPropertyMapEntry aNamedRangeMap_Impl[] =
52  {
53  {u"" SC_UNO_LINKDISPBIT, 0, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0 },
54  {u"" SC_UNO_LINKDISPNAME, 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
55  {u"" SC_UNONAME_TOKENINDEX, 0, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::READONLY, 0 },
57  { u"", 0, css::uno::Type(), 0, 0 }
58  };
59  return aNamedRangeMap_Impl;
60 }
61 
63 {
64  static const SfxItemPropertyMapEntry aNamedRangesMap_Impl[] =
65  {
67  { u"", 0, css::uno::Type(), 0, 0 }
68  };
69  return aNamedRangesMap_Impl;
70 }
71 
72 #define SCNAMEDRANGEOBJ_SERVICE "com.sun.star.sheet.NamedRange"
73 
74 SC_SIMPLE_SERVICE_INFO( ScLabelRangeObj, "ScLabelRangeObj", "com.sun.star.sheet.LabelRange" )
75 SC_SIMPLE_SERVICE_INFO( ScLabelRangesObj, "ScLabelRangesObj", "com.sun.star.sheet.LabelRanges" )
76 SC_SIMPLE_SERVICE_INFO( ScNamedRangesObj, "ScNamedRangesObj", "com.sun.star.sheet.NamedRanges" )
77 
78 static bool lcl_UserVisibleName(const ScRangeData& rData)
79 {
81 
82  return !rData.HasType(ScRangeData::Type::Database);
83 }
84 
85 ScNamedRangeObj::ScNamedRangeObj( rtl::Reference< ScNamedRangesObj > const & xParent, ScDocShell* pDocSh, const OUString& rNm, Reference<container::XNamed> const & xSheet):
86  mxParent(xParent),
87  pDocShell( pDocSh ),
88  aName( rNm ),
89  mxSheet( xSheet )
90 {
92 }
93 
95 {
97 
98  if (pDocShell)
100 }
101 
103 {
104  // reference update is of no interest
105 
106  if ( rHint.GetId() == SfxHintId::Dying )
107  pDocShell = nullptr; // became invalid
108 }
109 
110 // Helper functions
111 
113 {
114  ScRangeData* pRet = nullptr;
115  if (pDocShell)
116  {
117  ScRangeName* pNames;
118  SCTAB nTab = GetTab_Impl();
119  if (nTab >= 0)
120  pNames = pDocShell->GetDocument().GetRangeName(nTab);
121  else
122  pNames = pDocShell->GetDocument().GetRangeName();
123  if (pNames)
124  {
125  pRet = pNames->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName));
126  if (pRet)
127  pRet->ValidateTabRefs(); // adjust relative tab refs to valid tables
128  }
129  }
130  return pRet;
131 }
132 
134 {
135  if (mxSheet.is())
136  {
137  if (!pDocShell)
138  return -2;
139  ScDocument& rDoc = pDocShell->GetDocument();
140  SCTAB nTab;
141  OUString sName = mxSheet->getName();
142  bool bFound = rDoc.GetTable(sName, nTab);
143  assert(bFound); (void)bFound; // fouled up?
144  return nTab;
145  }
146  else
147  return -1;//global range name
148 }
149 
150 // sheet::XNamedRange
151 
152 void ScNamedRangeObj::Modify_Impl( const OUString* pNewName, const ScTokenArray* pNewTokens, const OUString* pNewContent,
153  const ScAddress* pNewPos, const ScRangeData::Type* pNewType,
154  const formula::FormulaGrammar::Grammar eGrammar )
155 {
156  if (!pDocShell)
157  return;
158 
159  ScDocument& rDoc = pDocShell->GetDocument();
160  ScRangeName* pNames;
161  SCTAB nTab = GetTab_Impl();
162  if (nTab >= 0)
163  pNames = rDoc.GetRangeName(nTab);
164  else
165  pNames = rDoc.GetRangeName();
166  if (!pNames)
167  return;
168 
169  const ScRangeData* pOld = pNames->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName));
170  if (!pOld)
171  return;
172 
173  std::unique_ptr<ScRangeName> pNewRanges(new ScRangeName(*pNames));
174 
175  OUString aInsName = pOld->GetName();
176  if (pNewName)
177  aInsName = *pNewName;
178 
179  OUString aContent; // Content string based =>
180  pOld->GetSymbol( aContent, eGrammar); // no problems with changed positions and such.
181  if (pNewContent)
182  aContent = *pNewContent;
183 
184  ScAddress aPos = pOld->GetPos();
185  if (pNewPos)
186  aPos = *pNewPos;
187 
188  ScRangeData::Type nType = pOld->GetType();
189  if (pNewType)
190  nType = *pNewType;
191 
192  ScRangeData* pNew = nullptr;
193  if (pNewTokens)
194  pNew = new ScRangeData( rDoc, aInsName, *pNewTokens, aPos, nType );
195  else
196  pNew = new ScRangeData( rDoc, aInsName, aContent, aPos, nType, eGrammar );
197 
198  pNew->SetIndex( pOld->GetIndex() );
199 
200  pNewRanges->erase(*pOld);
201  if (pNewRanges->insert(pNew))
202  {
203  pDocShell->GetDocFunc().SetNewRangeNames(std::move(pNewRanges), mxParent->IsModifyAndBroadcast(), nTab);
204 
205  aName = aInsName;
206  }
207  else
208  {
209  pNew = nullptr;
210  }
211 }
212 
213 OUString SAL_CALL ScNamedRangeObj::getName()
214 {
215  SolarMutexGuard aGuard;
216  return aName;
217 }
218 
219 void SAL_CALL ScNamedRangeObj::setName( const OUString& aNewName )
220 {
221  SolarMutexGuard aGuard;
223 
224  OUString aNewStr(aNewName);
225  // GRAM_API for API compatibility.
226  Modify_Impl( &aNewStr, nullptr, nullptr, nullptr, nullptr,formula::FormulaGrammar::GRAM_API );
227 
228  if ( aName != aNewStr ) // some error occurred...
229  throw uno::RuntimeException(); // no other exceptions specified
230 }
231 
232 OUString SAL_CALL ScNamedRangeObj::getContent()
233 {
234  SolarMutexGuard aGuard;
235  OUString aContent;
237  if (pData)
238  // GRAM_API for API compatibility.
240  return aContent;
241 }
242 
243 void SAL_CALL ScNamedRangeObj::setContent( const OUString& aContent )
244 {
245  SolarMutexGuard aGuard;
246  OUString aContStr(aContent);
247  // GRAM_API for API compatibility.
248  Modify_Impl( nullptr, nullptr, &aContStr, nullptr, nullptr,formula::FormulaGrammar::GRAM_API );
249 }
250 
251 table::CellAddress SAL_CALL ScNamedRangeObj::getReferencePosition()
252 {
253  SolarMutexGuard aGuard;
254  ScAddress aPos;
256  if (pData)
257  aPos = pData->GetPos();
258  table::CellAddress aAddress;
259  aAddress.Column = aPos.Col();
260  aAddress.Row = aPos.Row();
261  aAddress.Sheet = aPos.Tab();
262  if (pDocShell)
263  {
264  SCTAB nDocTabs = pDocShell->GetDocument().GetTableCount();
265  if ( aAddress.Sheet >= nDocTabs && nDocTabs > 0 )
266  {
267  // Even after ValidateTabRefs, the position can be invalid if
268  // the content points to preceding tables. The resulting string
269  // is invalid in any case, so the position is just shifted.
270  aAddress.Sheet = nDocTabs - 1;
271  }
272  }
273  return aAddress;
274 }
275 
276 void SAL_CALL ScNamedRangeObj::setReferencePosition( const table::CellAddress& aReferencePosition )
277 {
278  SolarMutexGuard aGuard;
279  ScAddress aPos( static_cast<SCCOL>(aReferencePosition.Column), static_cast<SCROW>(aReferencePosition.Row), aReferencePosition.Sheet );
280  // GRAM_API for API compatibility.
281  Modify_Impl( nullptr, nullptr, nullptr, &aPos, nullptr,formula::FormulaGrammar::GRAM_API );
282 }
283 
284 sal_Int32 SAL_CALL ScNamedRangeObj::getType()
285 {
286  SolarMutexGuard aGuard;
287  sal_Int32 nType=0;
289  if (pData)
290  {
291  // do not return internal ScRangeData::Type flags
292  if ( pData->HasType(ScRangeData::Type::Criteria) ) nType |= sheet::NamedRangeFlag::FILTER_CRITERIA;
293  if ( pData->HasType(ScRangeData::Type::PrintArea) ) nType |= sheet::NamedRangeFlag::PRINT_AREA;
296  }
297  return nType;
298 }
299 
300 void SAL_CALL ScNamedRangeObj::setType( sal_Int32 nUnoType )
301 {
302  SolarMutexGuard aGuard;
304  if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
305  if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
308 
309  // GRAM_API for API compatibility.
310  Modify_Impl( nullptr, nullptr, nullptr, nullptr, &nNewType,formula::FormulaGrammar::GRAM_API );
311 }
312 
313 // XFormulaTokens
314 
315 uno::Sequence<sheet::FormulaToken> SAL_CALL ScNamedRangeObj::getTokens()
316 {
317  SolarMutexGuard aGuard;
318  uno::Sequence<sheet::FormulaToken> aSequence;
320  if (pData && pDocShell)
321  {
322  ScTokenArray* pTokenArray = pData->GetCode();
323  if ( pTokenArray )
324  ScTokenConversion::ConvertToTokenSequence( pDocShell->GetDocument(), aSequence, *pTokenArray );
325  }
326  return aSequence;
327 }
328 
329 void SAL_CALL ScNamedRangeObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rTokens )
330 {
331  SolarMutexGuard aGuard;
332  if( pDocShell )
333  {
334  ScTokenArray aTokenArray(pDocShell->GetDocument());
336  // GRAM_API for API compatibility.
337  Modify_Impl( nullptr, &aTokenArray, nullptr, nullptr, nullptr, formula::FormulaGrammar::GRAM_API );
338  }
339 }
340 
341 // XCellRangeSource
342 
343 uno::Reference<table::XCellRange> SAL_CALL ScNamedRangeObj::getReferredCells()
344 {
345  SolarMutexGuard aGuard;
346  ScRange aRange;
348  if ( pData && pData->IsValidReference( aRange ) )
349  {
351 
352  if ( aRange.aStart == aRange.aEnd )
353  return new ScCellObj( pDocShell, aRange.aStart );
354  else
355  return new ScCellRangeObj( pDocShell, aRange );
356  }
357  return nullptr;
358 }
359 
360 // beans::XPropertySet
361 
362 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScNamedRangeObj::getPropertySetInfo()
363 {
364  SolarMutexGuard aGuard;
365  static uno::Reference< beans::XPropertySetInfo > aRef(new SfxItemPropertySetInfo( lcl_GetNamedRangeMap() ));
366  return aRef;
367 }
368 
370  const OUString& rPropertyName, const uno::Any& /*aValue*/ )
371 {
372  SolarMutexGuard aGuard;
373  if ( rPropertyName == SC_UNONAME_ISSHAREDFMLA )
374  {
375  // Ignore this.
376  }
377 }
378 
379 uno::Any SAL_CALL ScNamedRangeObj::getPropertyValue( const OUString& rPropertyName )
380 {
381  SolarMutexGuard aGuard;
382  uno::Any aRet;
383  if ( rPropertyName == SC_UNO_LINKDISPBIT )
384  {
385  // no target bitmaps for individual entries (would be all equal)
386  // ScLinkTargetTypeObj::SetLinkTargetBitmap( aRet, SC_LINKTARGETTYPE_RANGENAME );
387  }
388  else if ( rPropertyName == SC_UNO_LINKDISPNAME )
389  aRet <<= aName;
390  else if ( rPropertyName == SC_UNONAME_TOKENINDEX )
391  {
392  // get index for use in formula tokens (read-only)
394  if (pData)
395  aRet <<= static_cast<sal_Int32>(pData->GetIndex());
396  }
397  else if ( rPropertyName == SC_UNONAME_ISSHAREDFMLA )
398  {
399  if (GetRangeData_Impl())
400  aRet <<= false;
401  }
402  return aRet;
403 }
404 
406 
407 // lang::XServiceInfo
408 
409 OUString SAL_CALL ScNamedRangeObj::getImplementationName()
410 {
411  return "ScNamedRangeObj";
412 }
413 
414 sal_Bool SAL_CALL ScNamedRangeObj::supportsService( const OUString& rServiceName )
415 {
416  return cppu::supportsService(this, rServiceName);
417 }
418 
419 uno::Sequence<OUString> SAL_CALL ScNamedRangeObj::getSupportedServiceNames()
420 {
422 }
423 
424 // XUnoTunnel
425 
426 sal_Int64 SAL_CALL ScNamedRangeObj::getSomething(
427  const uno::Sequence<sal_Int8 >& rId )
428 {
429  if ( isUnoTunnelId<ScNamedRangeObj>(rId) )
430  {
431  return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
432  }
433  return 0;
434 }
435 
436 namespace
437 {
438  class theScNamedRangeObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScNamedRangeObjUnoTunnelId> {};
439 }
440 
441 const uno::Sequence<sal_Int8>& ScNamedRangeObj::getUnoTunnelId()
442 {
443  return theScNamedRangeObjUnoTunnelId::get().getSeq();
444 }
445 
447  mbModifyAndBroadcast(true),
448  pDocShell( pDocSh )
449 {
451 }
452 
454 {
455  SolarMutexGuard g;
456 
457  if (pDocShell)
459 }
460 
462 {
463  // reference update is of no interest
464 
465  if ( rHint.GetId() == SfxHintId::Dying )
466  {
467  pDocShell = nullptr; // became invalid
468  }
469 }
470 
471 // sheet::XNamedRanges
472 
473 void SAL_CALL ScNamedRangesObj::addNewByName( const OUString& aName,
474  const OUString& aContent, const table::CellAddress& aPosition,
475  sal_Int32 nUnoType )
476 {
477  SolarMutexGuard aGuard;
478  ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), aPosition.Sheet );
479 
481  if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
482  if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
485 
486  bool bDone = false;
487  if (pDocShell)
488  {
489  ScDocument& rDoc = pDocShell->GetDocument();
490  ScRangeName* pNames = GetRangeName_Impl();
491  if (pNames && !pNames->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName)))
492  {
493  std::unique_ptr<ScRangeName> pNewRanges(new ScRangeName( *pNames ));
494  // GRAM_API for API compatibility.
495  ScRangeData* pNew = new ScRangeData( rDoc, aName, aContent,
496  aPos, nNewType,formula::FormulaGrammar::GRAM_API );
497  if ( pNewRanges->insert(pNew) )
498  {
500  bDone = true;
501  }
502  else
503  {
504  pNew = nullptr;
505  }
506  }
507  }
508 
509  if (!bDone)
510  throw uno::RuntimeException(); // no other exceptions specified
511 }
512 
513 void SAL_CALL ScNamedRangesObj::addNewFromTitles( const table::CellRangeAddress& aSource,
514  sheet::Border aBorder )
515 {
516  SolarMutexGuard aGuard;
518 
519  bool bTop = ( aBorder == sheet::Border_TOP );
520  bool bLeft = ( aBorder == sheet::Border_LEFT );
521  bool bBottom = ( aBorder == sheet::Border_BOTTOM );
522  bool bRight = ( aBorder == sheet::Border_RIGHT );
523 
524  ScRange aRange;
525  ScUnoConversion::FillScRange( aRange, aSource );
526 
528  if (bTop) nFlags |= CreateNameFlags::Top;
529  if (bLeft) nFlags |= CreateNameFlags::Left;
530  if (bBottom) nFlags |= CreateNameFlags::Bottom;
531  if (bRight) nFlags |= CreateNameFlags::Right;
532 
533  if (nFlags != CreateNameFlags::NONE)
534  pDocShell->GetDocFunc().CreateNames( aRange, nFlags, true, GetTab_Impl() );
535 }
536 
537 void SAL_CALL ScNamedRangesObj::removeByName( const OUString& aName )
538 {
539  SolarMutexGuard aGuard;
540  bool bDone = false;
541  if (pDocShell)
542  {
543  ScRangeName* pNames = GetRangeName_Impl();
544  if (pNames)
545  {
546  const ScRangeData* pData = pNames->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName));
547  if (pData && lcl_UserVisibleName(*pData))
548  {
549  std::unique_ptr<ScRangeName> pNewRanges(new ScRangeName(*pNames));
550  pNewRanges->erase(*pData);
552  bDone = true;
553  }
554  }
555  }
556 
557  if (!bDone)
558  throw uno::RuntimeException(); // no other exceptions specified
559 }
560 
561 void SAL_CALL ScNamedRangesObj::outputList( const table::CellAddress& aOutputPosition )
562 {
563  SolarMutexGuard aGuard;
564  ScAddress aPos( static_cast<SCCOL>(aOutputPosition.Column), static_cast<SCROW>(aOutputPosition.Row), aOutputPosition.Sheet );
565  if (pDocShell)
566  pDocShell->GetDocFunc().InsertNameList( aPos, true );
567 }
568 
569 // container::XEnumerationAccess
570 
571 uno::Reference<container::XEnumeration> SAL_CALL ScNamedRangesObj::createEnumeration()
572 {
573  SolarMutexGuard aGuard;
574  return new ScIndexEnumeration(this, "com.sun.star.sheet.NamedRangesEnumeration");
575 }
576 
577 // container::XIndexAccess
578 
579 sal_Int32 SAL_CALL ScNamedRangesObj::getCount()
580 {
581  SolarMutexGuard aGuard;
582  tools::Long nRet = 0;
583  if (pDocShell)
584  {
585  ScRangeName* pNames = GetRangeName_Impl();
586  if (pNames)
587  {
588  for (const auto& rName : *pNames)
589  if (lcl_UserVisibleName(*rName.second))
590  ++nRet;
591  }
592  }
593  return nRet;
594 }
595 
596 uno::Any SAL_CALL ScNamedRangesObj::getByIndex( sal_Int32 nIndex )
597 {
598  SolarMutexGuard aGuard;
599  uno::Reference< sheet::XNamedRange > xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
600  if ( !xRange.is() )
601  throw lang::IndexOutOfBoundsException();
602 
603  return uno::makeAny(xRange);
604 }
605 
607 {
608  SolarMutexGuard aGuard;
609  return cppu::UnoType<sheet::XNamedRange>::get(); // must be suitable for getByIndex
610 }
611 
613 {
614  SolarMutexGuard aGuard;
615  return ( getCount() != 0 );
616 }
617 
619 {
622  return aRef;
623 }
624 
626  const OUString& rPropertyName, const uno::Any& aValue )
627 {
628  if ( rPropertyName == SC_UNO_MODIFY_BROADCAST )
629  {
630  aValue >>= mbModifyAndBroadcast;
631  }
632 }
633 
634 Any SAL_CALL ScNamedRangesObj::getPropertyValue( const OUString& rPropertyName )
635 {
636  Any aRet;
637  if ( rPropertyName == SC_UNO_MODIFY_BROADCAST )
638  {
639  aRet <<= mbModifyAndBroadcast;
640  }
641 
642  return aRet;
643 }
644 
646 
647 uno::Any SAL_CALL ScNamedRangesObj::getByName( const OUString& aName )
648 {
649  SolarMutexGuard aGuard;
650  uno::Reference< sheet::XNamedRange > xRange(GetObjectByName_Impl(aName));
651  if ( !xRange.is() )
652  throw container::NoSuchElementException();
653 
654  return uno::makeAny(xRange);
655 }
656 
657 uno::Sequence<OUString> SAL_CALL ScNamedRangesObj::getElementNames()
658 {
659  SolarMutexGuard aGuard;
660  if (pDocShell)
661  {
662  ScRangeName* pNames = GetRangeName_Impl();
663  if (pNames)
664  {
665  tools::Long nVisCount = getCount(); // names with lcl_UserVisibleName
666  uno::Sequence<OUString> aSeq(nVisCount);
667  OUString* pAry = aSeq.getArray();
668  sal_uInt16 nVisPos = 0;
669  for (const auto& rName : *pNames)
670  {
671  if (lcl_UserVisibleName(*rName.second))
672  pAry[nVisPos++] = rName.second->GetName();
673  }
674  return aSeq;
675  }
676  }
677  return uno::Sequence<OUString>(0);
678 }
679 
680 sal_Bool SAL_CALL ScNamedRangesObj::hasByName( const OUString& aName )
681 {
682  SolarMutexGuard aGuard;
683  if (pDocShell)
684  {
685  ScRangeName* pNames = GetRangeName_Impl();
686  if (pNames)
687  {
688  const ScRangeData* pData = pNames->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName));
689  if (pData && lcl_UserVisibleName(*pData))
690  return true;
691  }
692  }
693  return false;
694 }
695 
698 {
700 }
701 
704 {
706 }
707 
708 // document::XActionLockable
709 
711 {
712  SolarMutexGuard aGuard;
714 }
715 
717 {
718  SolarMutexGuard aGuard;
719  ScDocument& rDoc = pDocShell->GetDocument();
720  sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
721  ++nLockCount;
722  if ( nLockCount == 1 )
723  {
724  lock();
725  }
726  rDoc.SetNamedRangesLockCount( nLockCount );
727 }
728 
730 {
731  SolarMutexGuard aGuard;
732  ScDocument& rDoc = pDocShell->GetDocument();
733  sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
734  if ( nLockCount > 0 )
735  {
736  --nLockCount;
737  if ( nLockCount == 0 )
738  {
739  unlock();
740  }
741  rDoc.SetNamedRangesLockCount( nLockCount );
742  }
743 }
744 
745 void ScNamedRangesObj::setActionLocks( sal_Int16 nLock )
746 {
747  SolarMutexGuard aGuard;
748  if ( nLock < 0 )
749  return;
750 
751  ScDocument& rDoc = pDocShell->GetDocument();
752  sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
753  if ( nLock == 0 && nLockCount > 0 )
754  {
755  unlock();
756  }
757  if ( nLock > 0 && nLockCount == 0 )
758  {
759  lock();
760  }
761  rDoc.SetNamedRangesLockCount( nLock );
762 }
763 
765 {
766  SolarMutexGuard aGuard;
767  ScDocument& rDoc = pDocShell->GetDocument();
768  sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
769  if ( nLockCount > 0 )
770  {
771  unlock();
772  }
773  rDoc.SetNamedRangesLockCount( 0 );
774  return nLockCount;
775 }
776 
778  : ScNamedRangesObj(pDocSh)
779 {
780 
781 }
782 
784 {
785 
786 }
787 
789 {
790  if (!pDocShell)
791  return nullptr;
792 
794  if (!pNames)
795  return nullptr;
796 
797  sal_uInt16 nPos = 0;
798  for (const auto& rName : *pNames)
799  {
800  if (lcl_UserVisibleName(*rName.second))
801  {
802  if (nPos == nIndex)
803  return new ScNamedRangeObj(this, pDocShell, rName.second->GetName());
804  }
805  ++nPos;
806  }
807  return nullptr;
808 }
809 
811 {
812  if ( pDocShell && hasByName(aName) )
813  return new ScNamedRangeObj(this, pDocShell, aName);
814  return nullptr;
815 }
816 
818 {
819  return pDocShell->GetDocument().GetRangeName();
820 }
821 
823 {
824  return -1;
825 }
826 
827 ScLocalNamedRangesObj::ScLocalNamedRangesObj( ScDocShell* pDocSh, uno::Reference<container::XNamed> const & xSheet )
828  : ScNamedRangesObj(pDocSh),
829  mxSheet(xSheet)
830 {
831 
832 }
833 
835 {
836 
837 }
838 
840 {
841  if ( pDocShell && hasByName( aName ) )
842  return new ScNamedRangeObj( this, pDocShell, aName, mxSheet);
843  return nullptr;
844 
845 }
846 
848 {
849  if (!pDocShell)
850  return nullptr;
851 
852  OUString aName = mxSheet->getName();
853  ScDocument& rDoc = pDocShell->GetDocument();
854  SCTAB nTab;
855  if (!rDoc.GetTable(aName, nTab))
856  return nullptr;
857 
858  ScRangeName* pNames = rDoc.GetRangeName( nTab );
859  if (!pNames)
860  return nullptr;
861 
862  sal_uInt16 nPos = 0;
863  for (const auto& rName : *pNames)
864  {
865  if (lcl_UserVisibleName(*rName.second))
866  {
867  if (nPos == nIndex)
868  return new ScNamedRangeObj(this, pDocShell, rName.second->GetName(), mxSheet);
869  }
870  ++nPos;
871  }
872  return nullptr;
873 }
874 
876 {
877  SCTAB nTab = GetTab_Impl();
878  return pDocShell->GetDocument().GetRangeName( nTab );
879 }
880 
882 {
883  SCTAB nTab;
884  (void)pDocShell->GetDocument().GetTable(mxSheet->getName(), nTab);
885  return nTab;
886 }
887 
888 ScLabelRangeObj::ScLabelRangeObj(ScDocShell* pDocSh, bool bCol, const ScRange& rR) :
889  pDocShell( pDocSh ),
890  bColumn( bCol ),
891  aRange( rR )
892 {
894 }
895 
897 {
898  SolarMutexGuard g;
899 
900  if (pDocShell)
902 }
903 
905 {
907 
908  if ( rHint.GetId() == SfxHintId::Dying )
909  pDocShell = nullptr; // became invalid
910 }
911 
912 // Helper functions
913 
915 {
916  ScRangePair* pRet = nullptr;
917  if (pDocShell)
918  {
919  ScDocument& rDoc = pDocShell->GetDocument();
920  ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
921  if (pList)
922  pRet = pList->Find( aRange );
923  }
924  return pRet;
925 }
926 
927 void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData )
928 {
929  if (!pDocShell)
930  return;
931 
932  ScDocument& rDoc = pDocShell->GetDocument();
933  ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
934  if (!pOldList)
935  return;
936 
937  ScRangePairListRef xNewList(pOldList->Clone());
938  ScRangePair* pEntry = xNewList->Find( aRange );
939  if (!pEntry)
940  return;
941 
942  if ( pLabel )
943  pEntry->GetRange(0) = *pLabel;
944  if ( pData )
945  pEntry->GetRange(1) = *pData;
946 
947  xNewList->Join( *pEntry, true );
948 
949  if (bColumn)
950  rDoc.GetColNameRangesRef() = xNewList;
951  else
952  rDoc.GetRowNameRangesRef() = xNewList;
953 
955  pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
957 
959 
960  if ( pLabel )
961  aRange = *pLabel; // adapt object to find range again
962 }
963 
964 // sheet::XLabelRange
965 
966 table::CellRangeAddress SAL_CALL ScLabelRangeObj::getLabelArea()
967 {
968  SolarMutexGuard aGuard;
969  table::CellRangeAddress aRet;
971  if (pData)
972  ScUnoConversion::FillApiRange( aRet, pData->GetRange(0) );
973  return aRet;
974 }
975 
976 void SAL_CALL ScLabelRangeObj::setLabelArea( const table::CellRangeAddress& aLabelArea )
977 {
978  SolarMutexGuard aGuard;
979  ScRange aLabelRange;
980  ScUnoConversion::FillScRange( aLabelRange, aLabelArea );
981  Modify_Impl( &aLabelRange, nullptr );
982 }
983 
984 table::CellRangeAddress SAL_CALL ScLabelRangeObj::getDataArea()
985 {
986  SolarMutexGuard aGuard;
987  table::CellRangeAddress aRet;
989  if (pData)
990  ScUnoConversion::FillApiRange( aRet, pData->GetRange(1) );
991  return aRet;
992 }
993 
994 void SAL_CALL ScLabelRangeObj::setDataArea( const table::CellRangeAddress& aDataArea )
995 {
996  SolarMutexGuard aGuard;
997  ScRange aDataRange;
998  ScUnoConversion::FillScRange( aDataRange, aDataArea );
999  Modify_Impl( nullptr, &aDataRange );
1000 }
1001 
1003  pDocShell( pDocSh ),
1004  bColumn( bCol )
1005 {
1007 }
1008 
1010 {
1011  SolarMutexGuard g;
1012 
1013  if (pDocShell)
1015 }
1016 
1018 {
1019  // reference update is of no interest
1020 
1021  if ( rHint.GetId() == SfxHintId::Dying )
1022  {
1023  pDocShell = nullptr; // became invalid
1024  }
1025 }
1026 
1027 // sheet::XLabelRanges
1028 
1030 {
1031  if (pDocShell)
1032  {
1033  ScDocument& rDoc = pDocShell->GetDocument();
1034  ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
1035  if ( pList && nIndex < pList->size() )
1036  {
1037  ScRangePair & rData = (*pList)[nIndex];
1038  return new ScLabelRangeObj( pDocShell, bColumn, rData.GetRange(0) );
1039  }
1040  }
1041  return nullptr;
1042 }
1043 
1044 void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelArea,
1045  const table::CellRangeAddress& aDataArea )
1046 {
1047  SolarMutexGuard aGuard;
1048  if (!pDocShell)
1049  return;
1050 
1051  ScDocument& rDoc = pDocShell->GetDocument();
1052  ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
1053  if (!pOldList)
1054  return;
1055 
1056  ScRangePairListRef xNewList(pOldList->Clone());
1057 
1058  ScRange aLabelRange;
1059  ScRange aDataRange;
1060  ScUnoConversion::FillScRange( aLabelRange, aLabelArea );
1061  ScUnoConversion::FillScRange( aDataRange, aDataArea );
1062  xNewList->Join( ScRangePair( aLabelRange, aDataRange ) );
1063 
1064  if (bColumn)
1065  rDoc.GetColNameRangesRef() = xNewList;
1066  else
1067  rDoc.GetRowNameRangesRef() = xNewList;
1068 
1069  rDoc.CompileColRowNameFormula();
1070  pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
1072 
1074 }
1075 
1076 void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex )
1077 {
1078  SolarMutexGuard aGuard;
1079  bool bDone = false;
1080  if (pDocShell)
1081  {
1082  ScDocument& rDoc = pDocShell->GetDocument();
1083  ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
1084 
1085  if ( pOldList && nIndex >= 0 && nIndex < static_cast<sal_Int32>(pOldList->size()) )
1086  {
1087  ScRangePairListRef xNewList(pOldList->Clone());
1088 
1089  xNewList->Remove( nIndex );
1090 
1091  if (bColumn)
1092  rDoc.GetColNameRangesRef() = xNewList;
1093  else
1094  rDoc.GetRowNameRangesRef() = xNewList;
1095 
1096  rDoc.CompileColRowNameFormula();
1097  pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
1099  bDone = true;
1100 
1102  }
1103  }
1104  if (!bDone)
1105  throw uno::RuntimeException(); // no other exceptions specified
1106 }
1107 
1108 // container::XEnumerationAccess
1109 
1110 uno::Reference<container::XEnumeration> SAL_CALL ScLabelRangesObj::createEnumeration()
1111 {
1112  SolarMutexGuard aGuard;
1113  return new ScIndexEnumeration(this, "com.sun.star.sheet.LabelRangesEnumeration");
1114 }
1115 
1116 // container::XIndexAccess
1117 
1118 sal_Int32 SAL_CALL ScLabelRangesObj::getCount()
1119 {
1120  SolarMutexGuard aGuard;
1121  if (pDocShell)
1122  {
1123  ScDocument& rDoc = pDocShell->GetDocument();
1124  ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
1125  if (pList)
1126  return pList->size();
1127  }
1128  return 0;
1129 }
1130 
1131 uno::Any SAL_CALL ScLabelRangesObj::getByIndex( sal_Int32 nIndex )
1132 {
1133  SolarMutexGuard aGuard;
1134  uno::Reference< sheet::XLabelRange > xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
1135  if ( !xRange.is() )
1136  throw lang::IndexOutOfBoundsException();
1137 
1138  return uno::makeAny(xRange);
1139 }
1140 
1142 {
1143  SolarMutexGuard aGuard;
1144  return cppu::UnoType<sheet::XLabelRange>::get(); // must be suitable for getByIndex
1145 
1146 }
1147 
1149 {
1150  SolarMutexGuard aGuard;
1151  return ( getCount() != 0 );
1152 }
1153 
1154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getContent() override
XNamedRange.
Definition: nameuno.cxx:232
virtual css::table::CellRangeAddress SAL_CALL getLabelArea() override
XLabelRange.
Definition: nameuno.cxx:966
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
XPropertySet.
Definition: nameuno.cxx:362
virtual css::table::CellAddress SAL_CALL getReferencePosition() override
Definition: nameuno.cxx:251
virtual sal_Bool SAL_CALL hasElements() override
Definition: nameuno.cxx:1148
virtual void SAL_CALL addNewByName(const OUString &aName, const OUString &aContent, const css::table::CellAddress &aPosition, sal_Int32 nType) override
XNamedRanges.
Definition: nameuno.cxx:473
ScAddress aStart
Definition: address.hxx:500
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
XEnumerationAccess.
Definition: nameuno.cxx:571
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: nameuno.cxx:102
virtual ScRangeName * GetRangeName_Impl() override
Definition: nameuno.cxx:875
bool CreateNames(const ScRange &rRange, CreateNameFlags nFlags, bool bApi, SCTAB nTab=-1)
Definition: docfunc.cxx:5274
virtual void SAL_CALL addNew(const css::table::CellRangeAddress &aLabelArea, const css::table::CellRangeAddress &aDataArea) override
XLabelRanges.
Definition: nameuno.cxx:1044
SCROW Row() const
Definition: address.hxx:262
ScRangePair * GetData_Impl()
Definition: nameuno.cxx:914
css::uno::Reference< css::container::XNamed > mxSheet
Definition: nameuno.hxx:243
ScLabelRangesObj(ScDocShell *pDocSh, bool bCol)
Definition: nameuno.cxx:1002
virtual void SAL_CALL setDataArea(const css::table::CellRangeAddress &aDataArea) override
Definition: nameuno.cxx:994
std::unique_ptr< ContentProperties > pData
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
XUnoTunnel.
Definition: nameuno.cxx:426
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: nameuno.cxx:1131
ScRangePairList * GetColNameRanges()
Definition: document.hxx:814
#define SCLINKTARGET_SERVICE
Definition: targuno.hxx:42
void CompileColRowNameFormula()
Definition: documen4.cxx:566
sal_uInt16 GetIndex() const
Definition: rangenam.hxx:117
void SetNewRangeNames(std::unique_ptr< ScRangeName > pNewRanges, bool bModifyDoc, SCTAB nTab)
Definition: docfunc.cxx:5141
rtl::Reference< ScNamedRangesObj > mxParent
Definition: nameuno.hxx:56
long Long
SC_DLLPUBLIC void CompileHybridFormula()
Call this immediately after updating named ranges.
Definition: document10.cxx:316
WeakReference< XInterface > mxParent
void Modify_Impl(const OUString *pNewName, const ScTokenArray *pNewTokens, const OUString *pNewContent, const ScAddress *pNewPos, const ScRangeData::Type *pNewType, const formula::FormulaGrammar::Grammar eGrammar)
Definition: nameuno.cxx:152
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
ScRangeData * GetRangeData_Impl()
Definition: nameuno.cxx:112
virtual ~ScLabelRangeObj() override
Definition: nameuno.cxx:896
void SetDocumentModified()
Definition: docsh.cxx:2819
const ContentProperties & rData
ScAddress aEnd
Definition: address.hxx:501
static const SfxItemPropertyMapEntry * lcl_GetNamedRangeMap()
Definition: nameuno.cxx:49
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: nameuno.cxx:441
virtual ScNamedRangeObj * GetObjectByIndex_Impl(sal_uInt16 nIndex) override
Definition: nameuno.cxx:788
virtual ScNamedRangeObj * GetObjectByIndex_Impl(sal_uInt16 nIndex)=0
CreateNameFlags
Definition: scui_def.hxx:51
css::uno::Reference< css::container::XNamed > mxSheet
Definition: nameuno.hxx:59
virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getReferredCells() override
XCellRangeReferrer.
Definition: nameuno.cxx:343
virtual void SAL_CALL removeByName(const OUString &aName) override
Definition: nameuno.cxx:537
SfxHintId GetId() const
ScLabelRangeObj * GetObjectByIndex_Impl(size_t nIndex)
Definition: nameuno.cxx:1029
#define SC_UNONAME_ISSHAREDFMLA
Definition: unonames.hxx:318
virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens() override
XFormulaTokens.
Definition: nameuno.cxx:315
virtual void SAL_CALL setTokens(const css::uno::Sequence< css::sheet::FormulaToken > &aTokens) override
Definition: nameuno.cxx:329
ScNamedRangeObj(rtl::Reference< ScNamedRangesObj > const &xParent, ScDocShell *pDocSh, const OUString &rNm, css::uno::Reference< css::container::XNamed > const &xSheet=css::uno::Reference< css::container::XNamed >())
Definition: nameuno.cxx:85
virtual ScRangeName * GetRangeName_Impl()=0
ScRange aRange
criterion to find range
Definition: nameuno.hxx:257
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: nameuno.cxx:414
virtual void SAL_CALL removeActionLock() override
Definition: nameuno.cxx:729
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:879
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void SetNamedRangesLockCount(sal_Int16 nCount)
Definition: document.hxx:1551
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: nameuno.cxx:461
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: nameuno.cxx:596
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:260
virtual void SAL_CALL setContent(const OUString &aContent) override
Definition: nameuno.cxx:243
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: nameuno.cxx:379
SCTAB Tab() const
Definition: address.hxx:271
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: nameuno.cxx:1141
const OUString & GetName() const
OUString aName
Definition: nameuno.hxx:58
void GetName(OUString &rName) const
Definition: rangenam.hxx:111
virtual void SAL_CALL setType(sal_Int32 nType) override
Definition: nameuno.cxx:300
const char * sName
ScDocShell * pDocShell
Definition: nameuno.hxx:148
SCTAB GetTab_Impl()
Definition: nameuno.cxx:133
#define SCNAMEDRANGEOBJ_SERVICE
Definition: nameuno.cxx:72
ScDocShell * pDocShell
Definition: nameuno.hxx:57
virtual sal_Int32 SAL_CALL getType() override
Definition: nameuno.cxx:284
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:682
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:878
ScRangePairList * Clone() const
Definition: rangelst.cxx:1306
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: nameuno.cxx:904
static const SfxItemPropertyMapEntry * lcl_GetNamedRangesMap()
Definition: nameuno.cxx:62
virtual OUString SAL_CALL getName() override
XNamed.
Definition: nameuno.cxx:213
virtual sal_Int16 SAL_CALL resetActionLocks() override
Definition: nameuno.cxx:764
SC_DLLPUBLIC void GetSymbol(OUString &rSymbol, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
Definition: rangenam.cxx:246
virtual ~ScNamedRangesObj() override
Definition: nameuno.cxx:453
ScNamedRangesObj(ScDocShell *pDocSh)
Definition: nameuno.cxx:446
void Modify_Impl(const ScRange *pLabel, const ScRange *pData)
Definition: nameuno.cxx:927
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: nameuno.cxx:606
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
XPropertySet.
Definition: nameuno.cxx:618
virtual void SAL_CALL addNewFromTitles(const css::table::CellRangeAddress &aSource, css::sheet::Border aBorder) override
Definition: nameuno.cxx:513
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
static SC_DLLPUBLIC void ConvertToTokenSequence(const ScDocument &rDoc, css::uno::Sequence< css::sheet::FormulaToken > &rSequence, const ScTokenArray &rTokenArray)
Definition: tokenuno.cxx:354
const ScRange & GetRange(sal_uInt16 n) const
Definition: address.hxx:817
float u
unsigned char sal_Bool
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: nameuno.cxx:1017
static SC_DLLPUBLIC bool ConvertToTokenArray(ScDocument &rDoc, ScTokenArray &rTokenArray, const css::uno::Sequence< css::sheet::FormulaToken > &rSequence)
Definition: tokenuno.cxx:348
size
css::uno::Type const & get()
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:64
ScDocShell * pDocShell
Definition: nameuno.hxx:288
bool mbModifyAndBroadcast
if true, adding new name or modifying existing one will set the document 'modified' and broadcast the...
Definition: nameuno.hxx:138
virtual sal_Int32 SAL_CALL getCount() override
XIndexAccess.
Definition: nameuno.cxx:579
const SCTAB MAXTAB
Definition: address.hxx:71
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: nameuno.cxx:625
void unlock()
called from the XActionLockable interface methods on final unlock
Definition: nameuno.cxx:703
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:99
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
XEnumerationAccess.
Definition: nameuno.cxx:1110
bool HasType(Type nType) const
Definition: rangenam.hxx:177
static bool lcl_UserVisibleName(const ScRangeData &rData)
Definition: nameuno.cxx:78
virtual ~ScNamedRangeObj() override
Definition: nameuno.cxx:94
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:73
SCCOL Col() const
Definition: address.hxx:267
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: nameuno.cxx:419
ScLocalNamedRangesObj(ScDocShell *pDocSh, css::uno::Reference< css::container::XNamed > const &xNamed)
Definition: nameuno.cxx:827
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:893
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: nameuno.cxx:680
bool InsertNameList(const ScAddress &rStartPos, bool bApi)
Definition: docfunc.cxx:5363
virtual SCTAB GetTab_Impl() override
Definition: nameuno.cxx:881
virtual void SAL_CALL setReferencePosition(const css::table::CellAddress &aReferencePosition) override
Definition: nameuno.cxx:276
void SetIndex(sal_uInt16 nInd)
Definition: rangenam.hxx:116
virtual css::table::CellRangeAddress SAL_CALL getDataArea() override
Definition: nameuno.cxx:984
virtual sal_Bool SAL_CALL hasElements() override
Definition: nameuno.cxx:612
SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const
Definition: document.hxx:1550
const ScAddress & GetPos() const
Definition: rangenam.hxx:114
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: nameuno.cxx:634
ScRangePairList * GetRowNameRanges()
Definition: document.hxx:815
virtual void SAL_CALL outputList(const css::table::CellAddress &aOutputPosition) override
Definition: nameuno.cxx:561
virtual SCTAB GetTab_Impl() override
Definition: nameuno.cxx:822
virtual ~ScGlobalNamedRangesObj() override
Definition: nameuno.cxx:783
virtual void SAL_CALL setName(const OUString &aName) override
Definition: nameuno.cxx:219
ScLabelRangeObj(ScDocShell *pDocSh, bool bCol, const ScRange &rR)
Definition: nameuno.cxx:888
size_t size() const
Definition: rangelst.cxx:1231
OUString aName
#define SC_UNO_LINKDISPBIT
Definition: unonames.hxx:189
void lock()
called from the XActionLockable interface methods on initial locking
Definition: nameuno.cxx:697
virtual void SAL_CALL removeByIndex(sal_Int32 nIndex) override
Definition: nameuno.cxx:1076
virtual void SAL_CALL setLabelArea(const css::table::CellRangeAddress &aLabelArea) override
Definition: nameuno.cxx:976
really derive cell from range?
Definition: cellsuno.hxx:628
virtual void SAL_CALL addActionLock() override
Definition: nameuno.cxx:716
virtual sal_Bool SAL_CALL isActionLocked() override
XActionLockable.
Definition: nameuno.cxx:710
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:901
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
Definition: global.cxx:1011
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
virtual ScRangeName * GetRangeName_Impl() override
Definition: nameuno.cxx:817
Sequence< sal_Int8 > aSeq
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
virtual ~ScLocalNamedRangesObj() override
Definition: nameuno.cxx:834
SC_DLLPUBLIC bool IsValidReference(ScRange &rRef) const
Definition: rangenam.cxx:385
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: nameuno.cxx:369
virtual sal_Int32 SAL_CALL getCount() override
XIndexAccess.
Definition: nameuno.cxx:1118
Type GetType() const
Definition: rangenam.hxx:126
virtual ScNamedRangeObj * GetObjectByName_Impl(const OUString &aName) override
Definition: nameuno.cxx:810
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
Definition: convuno.hxx:88
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:218
#define SC_UNO_MODIFY_BROADCAST
Definition: unonames.hxx:692
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:80
virtual ScNamedRangeObj * GetObjectByIndex_Impl(sal_uInt16 nIndex) override
Definition: nameuno.cxx:847
virtual ~ScLabelRangesObj() override
Definition: nameuno.cxx:1009
virtual SCTAB GetTab_Impl()=0
#define SC_UNO_LINKDISPNAME
Definition: unonames.hxx:190
ScTokenArray * GetCode()
Definition: rangenam.hxx:120
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: nameuno.cxx:657
ScRangePair * Find(const ScAddress &)
Definition: rangelst.cxx:1286
ScRangePairListRef & GetRowNameRangesRef()
Definition: document.hxx:817
void ValidateTabRefs()
Definition: rangenam.cxx:519
virtual ScNamedRangeObj * GetObjectByName_Impl(const OUString &aName) override
Definition: nameuno.cxx:839
virtual void SAL_CALL setActionLocks(sal_Int16 nLock) override
Definition: nameuno.cxx:745
ScGlobalNamedRangesObj(ScDocShell *pDocSh)
Definition: nameuno.cxx:777
#define SC_UNONAME_TOKENINDEX
Definition: unonames.hxx:317
sal_uInt16 nPos
SC_DLLPUBLIC void PreprocessRangeNameUpdate()
Definition: document10.cxx:292
ScDocShell * pDocShell
Definition: nameuno.hxx:255
sal_Int16 SCTAB
Definition: types.hxx:23
ScRangePairListRef & GetColNameRangesRef()
Definition: document.hxx:816
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo