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