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 constexpr OUStringLiteral SCNAMEDRANGEOBJ_SERVICE = u"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 
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::getCharClass().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::getCharClass().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  return comphelper::getSomethingImpl(rId, this);
430 }
431 
432 const uno::Sequence<sal_Int8>& ScNamedRangeObj::getUnoTunnelId()
433 {
434  static const comphelper::UnoIdInit theScNamedRangeObjUnoTunnelId;
435  return theScNamedRangeObjUnoTunnelId.getSeq();
436 }
437 
439  mbModifyAndBroadcast(true),
440  pDocShell( pDocSh )
441 {
443 }
444 
446 {
447  SolarMutexGuard g;
448 
449  if (pDocShell)
451 }
452 
454 {
455  // reference update is of no interest
456 
457  if ( rHint.GetId() == SfxHintId::Dying )
458  {
459  pDocShell = nullptr; // became invalid
460  }
461 }
462 
463 // sheet::XNamedRanges
464 
465 void SAL_CALL ScNamedRangesObj::addNewByName( const OUString& aName,
466  const OUString& aContent, const table::CellAddress& aPosition,
467  sal_Int32 nUnoType )
468 {
469  SolarMutexGuard aGuard;
470  ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), aPosition.Sheet );
471 
473  if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
474  if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
477 
478  bool bDone = false;
479  if (pDocShell)
480  {
481  ScDocument& rDoc = pDocShell->GetDocument();
482  // tdf#119457 - check for a valid range name and cell reference
483  switch (ScRangeData::IsNameValid(aName, rDoc))
484  {
486  throw uno::RuntimeException(
487  "Invalid name. Reference to a cell, or a range of cells not allowed",
488  uno::Reference<uno::XInterface>(static_cast<::cppu::OWeakObject*>(this)));
489  break;
491  throw uno::RuntimeException(
492  "Invalid name. Start with a letter, use only letters, numbers and underscore",
493  uno::Reference<uno::XInterface>(static_cast<::cppu::OWeakObject*>(this)));
494  break;
496  if (ScRangeName* pNames = GetRangeName_Impl();
497  pNames
498  && !pNames->findByUpperName(ScGlobal::getCharClass().uppercase(aName)))
499  {
500  std::unique_ptr<ScRangeName> pNewRanges(new ScRangeName( *pNames ));
501  // GRAM_API for API compatibility.
502  ScRangeData* pNew = new ScRangeData( rDoc, aName, aContent,
503  aPos, nNewType,formula::FormulaGrammar::GRAM_API );
504  if ( pNewRanges->insert(pNew) )
505  {
507  bDone = true;
508  }
509  else
510  {
511  pNew = nullptr;
512  }
513  }
514  }
515  }
516 
517  if (!bDone)
518  throw uno::RuntimeException(); // no other exceptions specified
519 }
520 
521 void SAL_CALL ScNamedRangesObj::addNewFromTitles( const table::CellRangeAddress& aSource,
522  sheet::Border aBorder )
523 {
524  SolarMutexGuard aGuard;
526 
527  bool bTop = ( aBorder == sheet::Border_TOP );
528  bool bLeft = ( aBorder == sheet::Border_LEFT );
529  bool bBottom = ( aBorder == sheet::Border_BOTTOM );
530  bool bRight = ( aBorder == sheet::Border_RIGHT );
531 
532  ScRange aRange;
533  ScUnoConversion::FillScRange( aRange, aSource );
534 
536  if (bTop) nFlags |= CreateNameFlags::Top;
537  if (bLeft) nFlags |= CreateNameFlags::Left;
538  if (bBottom) nFlags |= CreateNameFlags::Bottom;
539  if (bRight) nFlags |= CreateNameFlags::Right;
540 
541  if (nFlags != CreateNameFlags::NONE)
542  pDocShell->GetDocFunc().CreateNames( aRange, nFlags, true, GetTab_Impl() );
543 }
544 
545 void SAL_CALL ScNamedRangesObj::removeByName( const OUString& aName )
546 {
547  SolarMutexGuard aGuard;
548  bool bDone = false;
549  if (pDocShell)
550  {
551  ScRangeName* pNames = GetRangeName_Impl();
552  if (pNames)
553  {
554  const ScRangeData* pData = pNames->findByUpperName(ScGlobal::getCharClass().uppercase(aName));
555  if (pData && lcl_UserVisibleName(*pData))
556  {
557  std::unique_ptr<ScRangeName> pNewRanges(new ScRangeName(*pNames));
558  pNewRanges->erase(*pData);
560  bDone = true;
561  }
562  }
563  }
564 
565  if (!bDone)
566  throw uno::RuntimeException(); // no other exceptions specified
567 }
568 
569 void SAL_CALL ScNamedRangesObj::outputList( const table::CellAddress& aOutputPosition )
570 {
571  SolarMutexGuard aGuard;
572  ScAddress aPos( static_cast<SCCOL>(aOutputPosition.Column), static_cast<SCROW>(aOutputPosition.Row), aOutputPosition.Sheet );
573  if (pDocShell)
574  pDocShell->GetDocFunc().InsertNameList( aPos, true );
575 }
576 
577 // container::XEnumerationAccess
578 
579 uno::Reference<container::XEnumeration> SAL_CALL ScNamedRangesObj::createEnumeration()
580 {
581  SolarMutexGuard aGuard;
582  return new ScIndexEnumeration(this, "com.sun.star.sheet.NamedRangesEnumeration");
583 }
584 
585 // container::XIndexAccess
586 
587 sal_Int32 SAL_CALL ScNamedRangesObj::getCount()
588 {
589  SolarMutexGuard aGuard;
590  tools::Long nRet = 0;
591  if (pDocShell)
592  {
593  ScRangeName* pNames = GetRangeName_Impl();
594  if (pNames)
595  {
596  for (const auto& rName : *pNames)
597  if (lcl_UserVisibleName(*rName.second))
598  ++nRet;
599  }
600  }
601  return nRet;
602 }
603 
604 uno::Any SAL_CALL ScNamedRangesObj::getByIndex( sal_Int32 nIndex )
605 {
606  SolarMutexGuard aGuard;
607  uno::Reference< sheet::XNamedRange > xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
608  if ( !xRange.is() )
609  throw lang::IndexOutOfBoundsException();
610 
611  return uno::makeAny(xRange);
612 }
613 
615 {
616  SolarMutexGuard aGuard;
617  return cppu::UnoType<sheet::XNamedRange>::get(); // must be suitable for getByIndex
618 }
619 
621 {
622  SolarMutexGuard aGuard;
623  return ( getCount() != 0 );
624 }
625 
627 {
630  return aRef;
631 }
632 
634  const OUString& rPropertyName, const uno::Any& aValue )
635 {
636  if ( rPropertyName == SC_UNO_MODIFY_BROADCAST )
637  {
638  aValue >>= mbModifyAndBroadcast;
639  }
640 }
641 
642 Any SAL_CALL ScNamedRangesObj::getPropertyValue( const OUString& rPropertyName )
643 {
644  Any aRet;
645  if ( rPropertyName == SC_UNO_MODIFY_BROADCAST )
646  {
647  aRet <<= mbModifyAndBroadcast;
648  }
649 
650  return aRet;
651 }
652 
654 
655 uno::Any SAL_CALL ScNamedRangesObj::getByName( const OUString& aName )
656 {
657  SolarMutexGuard aGuard;
658  uno::Reference< sheet::XNamedRange > xRange(GetObjectByName_Impl(aName));
659  if ( !xRange.is() )
660  throw container::NoSuchElementException();
661 
662  return uno::makeAny(xRange);
663 }
664 
665 uno::Sequence<OUString> SAL_CALL ScNamedRangesObj::getElementNames()
666 {
667  SolarMutexGuard aGuard;
668  if (pDocShell)
669  {
670  ScRangeName* pNames = GetRangeName_Impl();
671  if (pNames)
672  {
673  tools::Long nVisCount = getCount(); // names with lcl_UserVisibleName
674  uno::Sequence<OUString> aSeq(nVisCount);
675  OUString* pAry = aSeq.getArray();
676  sal_uInt16 nVisPos = 0;
677  for (const auto& rName : *pNames)
678  {
679  if (lcl_UserVisibleName(*rName.second))
680  pAry[nVisPos++] = rName.second->GetName();
681  }
682  return aSeq;
683  }
684  }
685  return {};
686 }
687 
688 sal_Bool SAL_CALL ScNamedRangesObj::hasByName( const OUString& aName )
689 {
690  SolarMutexGuard aGuard;
691  if (pDocShell)
692  {
693  ScRangeName* pNames = GetRangeName_Impl();
694  if (pNames)
695  {
696  const ScRangeData* pData = pNames->findByUpperName(ScGlobal::getCharClass().uppercase(aName));
697  if (pData && lcl_UserVisibleName(*pData))
698  return true;
699  }
700  }
701  return false;
702 }
703 
706 {
708 }
709 
712 {
714 }
715 
716 // document::XActionLockable
717 
719 {
720  SolarMutexGuard aGuard;
722 }
723 
725 {
726  SolarMutexGuard aGuard;
727  ScDocument& rDoc = pDocShell->GetDocument();
728  sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
729  ++nLockCount;
730  if ( nLockCount == 1 )
731  {
732  lock();
733  }
734  rDoc.SetNamedRangesLockCount( nLockCount );
735 }
736 
738 {
739  SolarMutexGuard aGuard;
740  ScDocument& rDoc = pDocShell->GetDocument();
741  sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
742  if ( nLockCount > 0 )
743  {
744  --nLockCount;
745  if ( nLockCount == 0 )
746  {
747  unlock();
748  }
749  rDoc.SetNamedRangesLockCount( nLockCount );
750  }
751 }
752 
753 void ScNamedRangesObj::setActionLocks( sal_Int16 nLock )
754 {
755  SolarMutexGuard aGuard;
756  if ( nLock < 0 )
757  return;
758 
759  ScDocument& rDoc = pDocShell->GetDocument();
760  sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
761  if ( nLock == 0 && nLockCount > 0 )
762  {
763  unlock();
764  }
765  if ( nLock > 0 && nLockCount == 0 )
766  {
767  lock();
768  }
769  rDoc.SetNamedRangesLockCount( nLock );
770 }
771 
773 {
774  SolarMutexGuard aGuard;
775  ScDocument& rDoc = pDocShell->GetDocument();
776  sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
777  if ( nLockCount > 0 )
778  {
779  unlock();
780  }
781  rDoc.SetNamedRangesLockCount( 0 );
782  return nLockCount;
783 }
784 
786  : ScNamedRangesObj(pDocSh)
787 {
788 
789 }
790 
792 {
793 
794 }
795 
797 {
798  if (!pDocShell)
799  return nullptr;
800 
802  if (!pNames)
803  return nullptr;
804 
805  sal_uInt16 nPos = 0;
806  for (const auto& rName : *pNames)
807  {
808  if (lcl_UserVisibleName(*rName.second))
809  {
810  if (nPos == nIndex)
811  return new ScNamedRangeObj(this, pDocShell, rName.second->GetName());
812  }
813  ++nPos;
814  }
815  return nullptr;
816 }
817 
819 {
820  if ( pDocShell && hasByName(aName) )
821  return new ScNamedRangeObj(this, pDocShell, aName);
822  return nullptr;
823 }
824 
826 {
827  return pDocShell->GetDocument().GetRangeName();
828 }
829 
831 {
832  return -1;
833 }
834 
835 ScLocalNamedRangesObj::ScLocalNamedRangesObj( ScDocShell* pDocSh, uno::Reference<container::XNamed> const & xSheet )
836  : ScNamedRangesObj(pDocSh),
837  mxSheet(xSheet)
838 {
839 
840 }
841 
843 {
844 
845 }
846 
848 {
849  if ( pDocShell && hasByName( aName ) )
850  return new ScNamedRangeObj( this, pDocShell, aName, mxSheet);
851  return nullptr;
852 
853 }
854 
856 {
857  if (!pDocShell)
858  return nullptr;
859 
860  OUString aName = mxSheet->getName();
861  ScDocument& rDoc = pDocShell->GetDocument();
862  SCTAB nTab;
863  if (!rDoc.GetTable(aName, nTab))
864  return nullptr;
865 
866  ScRangeName* pNames = rDoc.GetRangeName( nTab );
867  if (!pNames)
868  return nullptr;
869 
870  sal_uInt16 nPos = 0;
871  for (const auto& rName : *pNames)
872  {
873  if (lcl_UserVisibleName(*rName.second))
874  {
875  if (nPos == nIndex)
876  return new ScNamedRangeObj(this, pDocShell, rName.second->GetName(), mxSheet);
877  }
878  ++nPos;
879  }
880  return nullptr;
881 }
882 
884 {
885  SCTAB nTab = GetTab_Impl();
886  return pDocShell->GetDocument().GetRangeName( nTab );
887 }
888 
890 {
891  SCTAB nTab;
892  (void)pDocShell->GetDocument().GetTable(mxSheet->getName(), nTab);
893  return nTab;
894 }
895 
896 ScLabelRangeObj::ScLabelRangeObj(ScDocShell* pDocSh, bool bCol, const ScRange& rR) :
897  pDocShell( pDocSh ),
898  bColumn( bCol ),
899  aRange( rR )
900 {
902 }
903 
905 {
906  SolarMutexGuard g;
907 
908  if (pDocShell)
910 }
911 
913 {
915 
916  if ( rHint.GetId() == SfxHintId::Dying )
917  pDocShell = nullptr; // became invalid
918 }
919 
920 // Helper functions
921 
923 {
924  ScRangePair* pRet = nullptr;
925  if (pDocShell)
926  {
927  ScDocument& rDoc = pDocShell->GetDocument();
928  ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
929  if (pList)
930  pRet = pList->Find( aRange );
931  }
932  return pRet;
933 }
934 
935 void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData )
936 {
937  if (!pDocShell)
938  return;
939 
940  ScDocument& rDoc = pDocShell->GetDocument();
941  ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
942  if (!pOldList)
943  return;
944 
945  ScRangePairListRef xNewList(pOldList->Clone());
946  ScRangePair* pEntry = xNewList->Find( aRange );
947  if (!pEntry)
948  return;
949 
950  if ( pLabel )
951  pEntry->GetRange(0) = *pLabel;
952  if ( pData )
953  pEntry->GetRange(1) = *pData;
954 
955  xNewList->Join( *pEntry, true );
956 
957  if (bColumn)
958  rDoc.GetColNameRangesRef() = xNewList;
959  else
960  rDoc.GetRowNameRangesRef() = xNewList;
961 
963  pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
965 
967 
968  if ( pLabel )
969  aRange = *pLabel; // adapt object to find range again
970 }
971 
972 // sheet::XLabelRange
973 
974 table::CellRangeAddress SAL_CALL ScLabelRangeObj::getLabelArea()
975 {
976  SolarMutexGuard aGuard;
977  table::CellRangeAddress aRet;
979  if (pData)
980  ScUnoConversion::FillApiRange( aRet, pData->GetRange(0) );
981  return aRet;
982 }
983 
984 void SAL_CALL ScLabelRangeObj::setLabelArea( const table::CellRangeAddress& aLabelArea )
985 {
986  SolarMutexGuard aGuard;
987  ScRange aLabelRange;
988  ScUnoConversion::FillScRange( aLabelRange, aLabelArea );
989  Modify_Impl( &aLabelRange, nullptr );
990 }
991 
992 table::CellRangeAddress SAL_CALL ScLabelRangeObj::getDataArea()
993 {
994  SolarMutexGuard aGuard;
995  table::CellRangeAddress aRet;
997  if (pData)
998  ScUnoConversion::FillApiRange( aRet, pData->GetRange(1) );
999  return aRet;
1000 }
1001 
1002 void SAL_CALL ScLabelRangeObj::setDataArea( const table::CellRangeAddress& aDataArea )
1003 {
1004  SolarMutexGuard aGuard;
1005  ScRange aDataRange;
1006  ScUnoConversion::FillScRange( aDataRange, aDataArea );
1007  Modify_Impl( nullptr, &aDataRange );
1008 }
1009 
1011  pDocShell( pDocSh ),
1012  bColumn( bCol )
1013 {
1015 }
1016 
1018 {
1019  SolarMutexGuard g;
1020 
1021  if (pDocShell)
1023 }
1024 
1026 {
1027  // reference update is of no interest
1028 
1029  if ( rHint.GetId() == SfxHintId::Dying )
1030  {
1031  pDocShell = nullptr; // became invalid
1032  }
1033 }
1034 
1035 // sheet::XLabelRanges
1036 
1038 {
1039  if (pDocShell)
1040  {
1041  ScDocument& rDoc = pDocShell->GetDocument();
1042  ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
1043  if ( pList && nIndex < pList->size() )
1044  {
1045  ScRangePair & rData = (*pList)[nIndex];
1046  return new ScLabelRangeObj( pDocShell, bColumn, rData.GetRange(0) );
1047  }
1048  }
1049  return nullptr;
1050 }
1051 
1052 void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelArea,
1053  const table::CellRangeAddress& aDataArea )
1054 {
1055  SolarMutexGuard aGuard;
1056  if (!pDocShell)
1057  return;
1058 
1059  ScDocument& rDoc = pDocShell->GetDocument();
1060  ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
1061  if (!pOldList)
1062  return;
1063 
1064  ScRangePairListRef xNewList(pOldList->Clone());
1065 
1066  ScRange aLabelRange;
1067  ScRange aDataRange;
1068  ScUnoConversion::FillScRange( aLabelRange, aLabelArea );
1069  ScUnoConversion::FillScRange( aDataRange, aDataArea );
1070  xNewList->Join( ScRangePair( aLabelRange, aDataRange ) );
1071 
1072  if (bColumn)
1073  rDoc.GetColNameRangesRef() = xNewList;
1074  else
1075  rDoc.GetRowNameRangesRef() = xNewList;
1076 
1077  rDoc.CompileColRowNameFormula();
1078  pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
1080 
1082 }
1083 
1084 void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex )
1085 {
1086  SolarMutexGuard aGuard;
1087  bool bDone = false;
1088  if (pDocShell)
1089  {
1090  ScDocument& rDoc = pDocShell->GetDocument();
1091  ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
1092 
1093  if ( pOldList && nIndex >= 0 && nIndex < static_cast<sal_Int32>(pOldList->size()) )
1094  {
1095  ScRangePairListRef xNewList(pOldList->Clone());
1096 
1097  xNewList->Remove( nIndex );
1098 
1099  if (bColumn)
1100  rDoc.GetColNameRangesRef() = xNewList;
1101  else
1102  rDoc.GetRowNameRangesRef() = xNewList;
1103 
1104  rDoc.CompileColRowNameFormula();
1105  pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
1107  bDone = true;
1108 
1110  }
1111  }
1112  if (!bDone)
1113  throw uno::RuntimeException(); // no other exceptions specified
1114 }
1115 
1116 // container::XEnumerationAccess
1117 
1118 uno::Reference<container::XEnumeration> SAL_CALL ScLabelRangesObj::createEnumeration()
1119 {
1120  SolarMutexGuard aGuard;
1121  return new ScIndexEnumeration(this, "com.sun.star.sheet.LabelRangesEnumeration");
1122 }
1123 
1124 // container::XIndexAccess
1125 
1126 sal_Int32 SAL_CALL ScLabelRangesObj::getCount()
1127 {
1128  SolarMutexGuard aGuard;
1129  if (pDocShell)
1130  {
1131  ScDocument& rDoc = pDocShell->GetDocument();
1132  ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
1133  if (pList)
1134  return pList->size();
1135  }
1136  return 0;
1137 }
1138 
1139 uno::Any SAL_CALL ScLabelRangesObj::getByIndex( sal_Int32 nIndex )
1140 {
1141  SolarMutexGuard aGuard;
1142  uno::Reference< sheet::XLabelRange > xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
1143  if ( !xRange.is() )
1144  throw lang::IndexOutOfBoundsException();
1145 
1146  return uno::makeAny(xRange);
1147 }
1148 
1150 {
1151  SolarMutexGuard aGuard;
1152  return cppu::UnoType<sheet::XLabelRange>::get(); // must be suitable for getByIndex
1153 
1154 }
1155 
1157 {
1158  SolarMutexGuard aGuard;
1159  return ( getCount() != 0 );
1160 }
1161 
1162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getContent() override
XNamedRange.
Definition: nameuno.cxx:232
virtual rtl::Reference< ScNamedRangeObj > GetObjectByIndex_Impl(sal_uInt16 nIndex) override
Definition: nameuno.cxx:855
virtual css::table::CellRangeAddress SAL_CALL getLabelArea() override
XLabelRange.
Definition: nameuno.cxx:974
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:1156
virtual void SAL_CALL addNewByName(const OUString &aName, const OUString &aContent, const css::table::CellAddress &aPosition, sal_Int32 nType) override
XNamedRanges.
Definition: nameuno.cxx:465
ScAddress aStart
Definition: address.hxx:499
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
XEnumerationAccess.
Definition: nameuno.cxx:579
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: nameuno.cxx:102
virtual ScRangeName * GetRangeName_Impl() override
Definition: nameuno.cxx:883
bool CreateNames(const ScRange &rRange, CreateNameFlags nFlags, bool bApi, SCTAB nTab=-1)
Definition: docfunc.cxx:5270
virtual void SAL_CALL addNew(const css::table::CellRangeAddress &aLabelArea, const css::table::CellRangeAddress &aDataArea) override
XLabelRanges.
Definition: nameuno.cxx:1052
SCROW Row() const
Definition: address.hxx:261
ScRangePair * GetData_Impl()
Definition: nameuno.cxx:922
css::uno::Reference< css::container::XNamed > mxSheet
Definition: nameuno.hxx:242
ScLabelRangesObj(ScDocShell *pDocSh, bool bCol)
Definition: nameuno.cxx:1010
virtual void SAL_CALL setDataArea(const css::table::CellRangeAddress &aDataArea) override
Definition: nameuno.cxx:1002
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:1139
ScRangePairList * GetColNameRanges()
Definition: document.hxx:806
#define SCLINKTARGET_SERVICE
Definition: targuno.hxx:41
void CompileColRowNameFormula()
Definition: documen4.cxx:568
sal_uInt16 GetIndex() const
Definition: rangenam.hxx:116
void SetNewRangeNames(std::unique_ptr< ScRangeName > pNewRanges, bool bModifyDoc, SCTAB nTab)
Definition: docfunc.cxx:5137
rtl::Reference< ScNamedRangesObj > mxParent
Definition: nameuno.hxx:55
long Long
SC_DLLPUBLIC void CompileHybridFormula()
Call this immediately after updating named ranges.
Definition: document10.cxx:315
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:904
void SetDocumentModified()
Definition: docsh.cxx:2940
const ContentProperties & rData
ScAddress aEnd
Definition: address.hxx:500
virtual rtl::Reference< ScNamedRangeObj > GetObjectByName_Impl(const OUString &aName) override
Definition: nameuno.cxx:847
static const SfxItemPropertyMapEntry * lcl_GetNamedRangeMap()
Definition: nameuno.cxx:49
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: nameuno.cxx:432
void Remove(size_t nPos)
Definition: rangelst.cxx:1199
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:343
virtual void SAL_CALL removeByName(const OUString &aName) override
Definition: nameuno.cxx:545
SfxHintId GetId() const
#define SC_UNONAME_ISSHAREDFMLA
Definition: unonames.hxx:317
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:256
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: nameuno.cxx:414
virtual void SAL_CALL removeActionLock() override
Definition: nameuno.cxx:737
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:872
void SetNamedRangesLockCount(sal_Int16 nCount)
Definition: document.hxx:1549
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: nameuno.cxx:453
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
virtual rtl::Reference< ScNamedRangeObj > GetObjectByIndex_Impl(sal_uInt16 nIndex)=0
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: nameuno.cxx:604
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:270
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: nameuno.cxx:1149
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:300
const char * sName
ScDocShell * pDocShell
Definition: nameuno.hxx:147
SCTAB GetTab_Impl()
Definition: nameuno.cxx:133
const css::uno::Sequence< sal_Int8 > & getSeq() const
ScDocShell * pDocShell
Definition: nameuno.hxx:56
virtual sal_Int32 SAL_CALL getType() override
Definition: nameuno.cxx:284
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:681
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:871
ScRangePairList * Clone() const
Definition: rangelst.cxx:1303
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: nameuno.cxx:912
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:772
SC_DLLPUBLIC void GetSymbol(OUString &rSymbol, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
Definition: rangenam.cxx:243
constexpr OUStringLiteral SCNAMEDRANGEOBJ_SERVICE
Definition: nameuno.cxx:72
virtual ~ScNamedRangesObj() override
Definition: nameuno.cxx:445
ScNamedRangesObj(ScDocShell *pDocSh)
Definition: nameuno.cxx:438
void Modify_Impl(const ScRange *pLabel, const ScRange *pData)
Definition: nameuno.cxx:935
virtual css::uno::Type SAL_CALL getElementType() override
XElementAccess.
Definition: nameuno.cxx:614
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
XPropertySet.
Definition: nameuno.cxx:626
static SC_DLLPUBLIC const CharClass & getCharClass()
Definition: global.cxx:1016
virtual void SAL_CALL addNewFromTitles(const css::table::CellRangeAddress &aSource, css::sheet::Border aBorder) override
Definition: nameuno.cxx:521
#define static
Definition: arraysum.hxx:27
static SC_DLLPUBLIC IsNameValidType IsNameValid(const OUString &rName, const ScDocument &rDoc)
Definition: rangenam.cxx:466
static SC_DLLPUBLIC void ConvertToTokenSequence(const ScDocument &rDoc, css::uno::Sequence< css::sheet::FormulaToken > &rSequence, const ScTokenArray &rTokenArray)
Definition: tokenuno.cxx:382
const ScRange & GetRange(sal_uInt16 n) const
Definition: address.hxx:816
float u
unsigned char sal_Bool
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: nameuno.cxx:1025
static SC_DLLPUBLIC bool ConvertToTokenArray(ScDocument &rDoc, ScTokenArray &rTokenArray, const css::uno::Sequence< css::sheet::FormulaToken > &rSequence)
Definition: tokenuno.cxx:376
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:587
const SCTAB MAXTAB
Definition: address.hxx:70
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: nameuno.cxx:633
void unlock()
called from the XActionLockable interface methods on final unlock
Definition: nameuno.cxx:711
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:1118
bool HasType(Type nType) const
Definition: rangenam.hxx:176
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:72
SCCOL Col() const
Definition: address.hxx:266
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:835
virtual rtl::Reference< ScNamedRangeObj > GetObjectByIndex_Impl(sal_uInt16 nIndex) override
Definition: nameuno.cxx:796
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:898
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: nameuno.cxx:688
bool InsertNameList(const ScAddress &rStartPos, bool bApi)
Definition: docfunc.cxx:5359
virtual SCTAB GetTab_Impl() override
Definition: nameuno.cxx:889
virtual void SAL_CALL setReferencePosition(const css::table::CellAddress &aReferencePosition) override
Definition: nameuno.cxx:276
void SetIndex(sal_uInt16 nInd)
Definition: rangenam.hxx:115
virtual css::table::CellRangeAddress SAL_CALL getDataArea() override
Definition: nameuno.cxx:992
rtl::Reference< ScLabelRangeObj > GetObjectByIndex_Impl(size_t nIndex)
Definition: nameuno.cxx:1037
virtual sal_Bool SAL_CALL hasElements() override
Definition: nameuno.cxx:620
SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const
Definition: document.hxx:1548
const ScAddress & GetPos() const
Definition: rangenam.hxx:113
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: nameuno.cxx:642
ScRangePairList * GetRowNameRanges()
Definition: document.hxx:807
virtual void SAL_CALL outputList(const css::table::CellAddress &aOutputPosition) override
Definition: nameuno.cxx:569
virtual SCTAB GetTab_Impl() override
Definition: nameuno.cxx:830
virtual ~ScGlobalNamedRangesObj() override
Definition: nameuno.cxx:791
virtual void SAL_CALL setName(const OUString &aName) override
Definition: nameuno.cxx:219
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:896
size_t size() const
Definition: rangelst.cxx:1228
OUString aName
#define SC_UNO_LINKDISPBIT
Definition: unonames.hxx:188
void lock()
called from the XActionLockable interface methods on initial locking
Definition: nameuno.cxx:705
virtual rtl::Reference< ScNamedRangeObj > GetObjectByName_Impl(const OUString &aName) override
Definition: nameuno.cxx:818
virtual void SAL_CALL removeByIndex(sal_Int32 nIndex) override
Definition: nameuno.cxx:1084
virtual void SAL_CALL setLabelArea(const css::table::CellRangeAddress &aLabelArea) override
Definition: nameuno.cxx:984
really derive cell from range?
Definition: cellsuno.hxx:633
virtual void SAL_CALL addActionLock() override
Definition: nameuno.cxx:724
virtual sal_Bool SAL_CALL isActionLocked() override
XActionLockable.
Definition: nameuno.cxx:718
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:906
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
virtual ScRangeName * GetRangeName_Impl() override
Definition: nameuno.cxx:825
Sequence< sal_Int8 > aSeq
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
virtual ~ScLocalNamedRangesObj() override
Definition: nameuno.cxx:842
SC_DLLPUBLIC bool IsValidReference(ScRange &rRef) const
Definition: rangenam.cxx:384
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:1126
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:218
#define SC_UNO_MODIFY_BROADCAST
Definition: unonames.hxx:697
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:79
virtual ~ScLabelRangesObj() override
Definition: nameuno.cxx:1017
virtual SCTAB GetTab_Impl()=0
#define SC_UNO_LINKDISPNAME
Definition: unonames.hxx:189
ScTokenArray * GetCode()
Definition: rangenam.hxx:119
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: nameuno.cxx:665
ScRangePair * Find(const ScAddress &)
Definition: rangelst.cxx:1283
ScRangePairListRef & GetRowNameRangesRef()
Definition: document.hxx:809
void ValidateTabRefs()
Definition: rangenam.cxx:518
virtual void SAL_CALL setActionLocks(sal_Int16 nLock) override
Definition: nameuno.cxx:753
ScGlobalNamedRangesObj(ScDocShell *pDocSh)
Definition: nameuno.cxx:785
#define SC_UNONAME_TOKENINDEX
Definition: unonames.hxx:316
sal_uInt16 nPos
SC_DLLPUBLIC void PreprocessRangeNameUpdate()
Definition: document10.cxx:291
ScDocShell * pDocShell
Definition: nameuno.hxx:254
sal_Int16 SCTAB
Definition: types.hxx:22
ScRangePairListRef & GetColNameRangesRef()
Definition: document.hxx:808
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo