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