nameuno.cxx (b3f79822) | nameuno.cxx (dffa72de) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 71 unchanged lines hidden (view full) --- 80{ 81 //! als Methode an ScRangeData 82 83 return ( pData && !pData->HasType( RT_DATABASE ) && !pData->HasType( RT_SHARED ) ); 84} 85 86//------------------------------------------------------------------------ 87 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 71 unchanged lines hidden (view full) --- 80{ 81 //! als Methode an ScRangeData 82 83 return ( pData && !pData->HasType( RT_DATABASE ) && !pData->HasType( RT_SHARED ) ); 84} 85 86//------------------------------------------------------------------------ 87 |
88ScNamedRangeObj::ScNamedRangeObj(ScDocShell* pDocSh, const String& rNm) : | 88ScNamedRangeObj::ScNamedRangeObj(ScDocShell* pDocSh, const String& rNm, const String& rScopeName) : |
89 pDocShell( pDocSh ), | 89 pDocShell( pDocSh ), |
90 aName( rNm ) | 90 aName( rNm ), 91 aScopeName(rScopeName) |
91{ 92 pDocShell->GetDocument()->AddUnoObject(*this); 93} 94 95ScNamedRangeObj::~ScNamedRangeObj() 96{ 97 if (pDocShell) 98 pDocShell->GetDocument()->RemoveUnoObject(*this); --- 13 unchanged lines hidden (view full) --- 112{ 113 ScRangeData* pRet = NULL; 114 if (pDocShell) 115 { 116 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 117 if (pNames) 118 { 119 sal_uInt16 nPos = 0; | 92{ 93 pDocShell->GetDocument()->AddUnoObject(*this); 94} 95 96ScNamedRangeObj::~ScNamedRangeObj() 97{ 98 if (pDocShell) 99 pDocShell->GetDocument()->RemoveUnoObject(*this); --- 13 unchanged lines hidden (view full) --- 113{ 114 ScRangeData* pRet = NULL; 115 if (pDocShell) 116 { 117 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 118 if (pNames) 119 { 120 sal_uInt16 nPos = 0; |
120 if (pNames->SearchName( aName, nPos )) | 121 SCTAB nameScope = MAXTABCOUNT; 122 if ( aScopeName != EMPTY_STRING ) |
121 { | 123 { |
124 pDocShell->GetDocument()->GetTable( aScopeName, nameScope ); 125 } 126 if (pNames->SearchName( aName, nPos, nameScope )) 127 { |
|
122 pRet = (*pNames)[nPos]; 123 pRet->ValidateTabRefs(); // adjust relative tab refs to valid tables 124 } 125 } 126 } 127 return pRet; 128} 129 130// sheet::XNamedRange 131 | 128 pRet = (*pNames)[nPos]; 129 pRet->ValidateTabRefs(); // adjust relative tab refs to valid tables 130 } 131 } 132 } 133 return pRet; 134} 135 136// sheet::XNamedRange 137 |
132void ScNamedRangeObj::Modify_Impl( const String* pNewName, const ScTokenArray* pNewTokens, const String* pNewContent, | 138void ScNamedRangeObj::Modify_Impl( const String* pNewRangeName, const ScTokenArray* pNewTokens, const String* pNewContent, |
133 const ScAddress* pNewPos, const sal_uInt16* pNewType, | 139 const ScAddress* pNewPos, const sal_uInt16* pNewType, |
134 const formula::FormulaGrammar::Grammar eGrammar ) | 140 const formula::FormulaGrammar::Grammar eGrammar, const String* pNewScopeName ) |
135{ | 141{ |
136 if (pDocShell) 137 { 138 ScDocument* pDoc = pDocShell->GetDocument(); 139 ScRangeName* pNames = pDoc->GetRangeName(); 140 if (pNames) 141 { 142 sal_uInt16 nPos = 0; 143 if (pNames->SearchName( aName, nPos )) 144 { 145 ScRangeName* pNewRanges = new ScRangeName( *pNames ); 146 ScRangeData* pOld = (*pNames)[nPos]; | 142 if (pDocShell) 143 { 144 ScDocument* pDoc = pDocShell->GetDocument(); 145 ScRangeName* pNames = pDoc->GetRangeName(); 146 if (pNames) 147 { 148 sal_uInt16 nPos = 0; 149 SCTAB nameScope = MAXTABCOUNT; 150 if (aScopeName != EMPTY_STRING ) 151 pDoc->GetTable(aScopeName, nameScope); 152 153 if (pNames->SearchName( aName, nPos, nameScope )) 154 { 155 SCTAB newNameScope = MAXTABCOUNT; 156 if (pNewScopeName && *pNewScopeName != EMPTY_STRING && !pDoc->GetTable(*pNewScopeName, newNameScope)) 157 return; 158 //added for namerange renew 159 else if (!pNewScopeName || *pNewScopeName == EMPTY_STRING ) 160 newNameScope = nameScope; 161 //end of add |
147 | 162 |
148 String aInsName(pOld->GetName()); 149 if (pNewName) 150 aInsName = *pNewName; 151 String aContent; // Content string based => 152 pOld->GetSymbol( aContent, eGrammar); // no problems with changed positions and such. 153 if (pNewContent) 154 aContent = *pNewContent; 155 ScAddress aPos(pOld->GetPos()); 156 if (pNewPos) 157 aPos = *pNewPos; 158 sal_uInt16 nType = pOld->GetType(); 159 if (pNewType) 160 nType = *pNewType; | 163 ScRangeName* pNewRanges = new ScRangeName( *pNames ); 164 ScRangeData* pOld = (*pNames)[nPos]; |
161 | 165 |
162 ScRangeData* pNew = NULL; 163 if ( pNewTokens ) 164 pNew = new ScRangeData( pDoc, aInsName, *pNewTokens, aPos, nType ); 165 else 166 pNew = new ScRangeData( pDoc, aInsName, aContent, aPos, nType, eGrammar ); 167 pNew->SetIndex( pOld->GetIndex() ); | 166 String aInsName(pOld->GetName()); 167 if (pNewRangeName) 168 aInsName = *pNewRangeName; 169 String aContent; // Content string based => 170 pOld->GetSymbol( aContent, eGrammar); // no problems with changed positions and such. 171 if (pNewContent) 172 aContent = *pNewContent; 173 ScAddress aPos(pOld->GetPos()); 174 if (pNewPos) 175 aPos = *pNewPos; 176 sal_uInt16 nType = pOld->GetType(); 177 if (pNewType) 178 nType = *pNewType; |
168 | 179 |
169 pNewRanges->AtFree( nPos ); 170 if ( pNewRanges->Insert(pNew) ) 171 { 172 ScDocFunc aFunc(*pDocShell); 173 aFunc.SetNewRangeNames( pNewRanges, sal_True ); 174 175 aName = aInsName; //! broadcast? 176 } 177 else 178 { 179 delete pNew; //! uno::Exception/Fehler oder so 180 delete pNewRanges; 181 } 182 } 183 } 184 } | 180 ScRangeData* pNew = NULL; 181 if ( pNewTokens ) 182 pNew = new ScRangeData( pDoc, aInsName, *pNewTokens, aPos, nType ); 183 else 184 pNew = new ScRangeData( pDoc, aInsName, aContent, aPos, nType, eGrammar ); 185 pNew->SetIndex( pOld->GetIndex() ); 186 pNew->SetRangeScope(newNameScope); 187 188 pNewRanges->AtFree( nPos ); 189 if ( pNewRanges->Insert(pNew) ) 190 { 191 ScDocFunc aFunc(*pDocShell); 192 aFunc.SetNewRangeNames( pNewRanges, sal_True ); 193 aName = aInsName; //! broadcast? 194 aScopeName = pNewScopeName ? *pNewScopeName : aScopeName; 195 } 196 else 197 { 198 delete pNew; //! uno::Exception/Fehler oder so 199 delete pNewRanges; 200 } 201 } 202 } 203 } |
185} 186 187 188rtl::OUString SAL_CALL ScNamedRangeObj::getName() throw(uno::RuntimeException) 189{ 190 ScUnoGuard aGuard; 191 return aName; 192} --- 6 unchanged lines hidden (view full) --- 199 200 String aNewStr(aNewName); 201 // GRAM_PODF_A1 for API compatibility. 202 Modify_Impl( &aNewStr, NULL, NULL, NULL, NULL,formula::FormulaGrammar::GRAM_PODF_A1 ); 203 204 if ( aName != aNewStr ) // some error occured... 205 throw uno::RuntimeException(); // no other exceptions specified 206} | 204} 205 206 207rtl::OUString SAL_CALL ScNamedRangeObj::getName() throw(uno::RuntimeException) 208{ 209 ScUnoGuard aGuard; 210 return aName; 211} --- 6 unchanged lines hidden (view full) --- 218 219 String aNewStr(aNewName); 220 // GRAM_PODF_A1 for API compatibility. 221 Modify_Impl( &aNewStr, NULL, NULL, NULL, NULL,formula::FormulaGrammar::GRAM_PODF_A1 ); 222 223 if ( aName != aNewStr ) // some error occured... 224 throw uno::RuntimeException(); // no other exceptions specified 225} |
226rtl::OUString SAL_CALL ScNamedRangeObj::getScopeName() throw(uno::RuntimeException) 227{ 228 ScUnoGuard aGuard; 229 return aScopeName; 230} |
|
207 | 231 |
232void SAL_CALL ScNamedRangeObj::setScopeAndRangeName( const rtl::OUString& aNewScopeName, const rtl::OUString& aNewRangeName ) 233 throw(uno::RuntimeException) 234{ 235 ScUnoGuard aGuard; 236 //! Formeln anpassen ????? 237 238 String aNewRangeStr(aNewRangeName); 239 String aNewScopeStr(aNewScopeName); 240 // GRAM_PODF_A1 for API compatibility. 241 Modify_Impl( &aNewRangeStr, NULL, NULL, NULL, NULL,formula::FormulaGrammar::GRAM_PODF_A1, aNewScopeName.getLength() == 0 ? NULL : &aNewScopeStr); 242 243 if ( aScopeName != aNewScopeStr || aName != aNewRangeStr ) // some error occured... 244 throw uno::RuntimeException(); // no other exceptions specified 245} 246 247 |
|
208rtl::OUString SAL_CALL ScNamedRangeObj::getContent() throw(uno::RuntimeException) 209{ 210 ScUnoGuard aGuard; 211 String aContent; 212 ScRangeData* pData = GetRangeData_Impl(); 213 if (pData) 214 // GRAM_PODF_A1 for API compatibility. 215 pData->GetSymbol( aContent,formula::FormulaGrammar::GRAM_PODF_A1); --- 292 unchanged lines hidden (view full) --- 508 sal_uInt16 nCount = pNames->GetCount(); 509 sal_uInt16 nPos = 0; 510 for (sal_uInt16 i=0; i<nCount; i++) 511 { 512 ScRangeData* pData = (*pNames)[i]; 513 if (lcl_UserVisibleName(pData)) // interne weglassen 514 { 515 if ( nPos == nIndex ) | 248rtl::OUString SAL_CALL ScNamedRangeObj::getContent() throw(uno::RuntimeException) 249{ 250 ScUnoGuard aGuard; 251 String aContent; 252 ScRangeData* pData = GetRangeData_Impl(); 253 if (pData) 254 // GRAM_PODF_A1 for API compatibility. 255 pData->GetSymbol( aContent,formula::FormulaGrammar::GRAM_PODF_A1); --- 292 unchanged lines hidden (view full) --- 548 sal_uInt16 nCount = pNames->GetCount(); 549 sal_uInt16 nPos = 0; 550 for (sal_uInt16 i=0; i<nCount; i++) 551 { 552 ScRangeData* pData = (*pNames)[i]; 553 if (lcl_UserVisibleName(pData)) // interne weglassen 554 { 555 if ( nPos == nIndex ) |
516 return new ScNamedRangeObj( pDocShell, pData->GetName() ); | 556 return new ScNamedRangeObj( pDocShell, pData->GetName(), pData->GetScopeSheetName() ); |
517 ++nPos; 518 } 519 } 520 } 521 } 522 return NULL; 523} 524 525ScNamedRangeObj* ScNamedRangesObj::GetObjectByName_Impl(const rtl::OUString& aName) 526{ 527 if ( pDocShell && hasByName(aName) ) 528 return new ScNamedRangeObj( pDocShell, String(aName) ); 529 return NULL; 530} 531 | 557 ++nPos; 558 } 559 } 560 } 561 } 562 return NULL; 563} 564 565ScNamedRangeObj* ScNamedRangesObj::GetObjectByName_Impl(const rtl::OUString& aName) 566{ 567 if ( pDocShell && hasByName(aName) ) 568 return new ScNamedRangeObj( pDocShell, String(aName) ); 569 return NULL; 570} 571 |
532void SAL_CALL ScNamedRangesObj::addNewByName( const rtl::OUString& aName, 533 const rtl::OUString& aContent, const table::CellAddress& aPosition, 534 sal_Int32 nUnoType ) throw(uno::RuntimeException) | 572ScNamedRangeObj* ScNamedRangesObj::GetObjectByScopeName_Impl(const ::rtl::OUString& aScopeName, const ::rtl::OUString& aRangeName) |
535{ | 573{ |
536 ScUnoGuard aGuard; 537 String aNameStr(aName); 538 String aContStr(aContent); | 574 if ( pDocShell && hasByScopeName(aScopeName, aRangeName) ) 575 return new ScNamedRangeObj( pDocShell, String(aRangeName),String(aScopeName) ); 576 return NULL; 577} 578void ScNamedRangesObj::ImplAddNewByScopeAndName(SCTAB aScope, const ::rtl::OUString& aRangeName, const ::rtl::OUString& aContent, 579 const ::com::sun::star::table::CellAddress& aPosition, sal_Int32 nUnoType) throw(uno::RuntimeException) 580{ |
539 ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, aPosition.Sheet ); 540 541 sal_uInt16 nNewType = RT_NAME; 542 if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA; 543 if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA; 544 if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER; 545 if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER; 546 | 581 ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, aPosition.Sheet ); 582 583 sal_uInt16 nNewType = RT_NAME; 584 if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA; 585 if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA; 586 if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER; 587 if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER; 588 |
547 sal_Bool bDone = sal_False; | 589 bool bDone = false; |
548 if (pDocShell) 549 { 550 ScDocument* pDoc = pDocShell->GetDocument(); 551 ScRangeName* pNames = pDoc->GetRangeName(); | 590 if (pDocShell) 591 { 592 ScDocument* pDoc = pDocShell->GetDocument(); 593 ScRangeName* pNames = pDoc->GetRangeName(); |
552 sal_uInt16 nIndex = 0; 553 if (pNames && !pNames->SearchName(aNameStr, nIndex)) | 594 sal_uInt16 nIndex = 0; 595 String aNameStr(aRangeName); 596 String aContStr(aContent); 597 if (pNames && !pNames->SearchName(aNameStr, nIndex,aScope)) |
554 { | 598 { |
555 ScRangeName* pNewRanges = new ScRangeName( *pNames ); | 599 ScRangeName* pNewRanges = new ScRangeName( *pNames ); |
556 // GRAM_PODF_A1 for API compatibility. | 600 // GRAM_PODF_A1 for API compatibility. |
557 ScRangeData* pNew = new ScRangeData( pDoc, aNameStr, aContStr, 558 aPos, nNewType,formula::FormulaGrammar::GRAM_PODF_A1 ); 559 if ( pNewRanges->Insert(pNew) ) 560 { | 601 ScRangeData* pNew = new ScRangeData( pDoc, aNameStr, aContStr, 602 aPos, nNewType,formula::FormulaGrammar::GRAM_PODF_A1 );//GRAM_ODFF,// 603 604 pNew->SetRangeScope(aScope); 605 606 if ( pNewRanges->Insert(pNew) ) 607 { |
561 ScDocFunc aFunc(*pDocShell); | 608 ScDocFunc aFunc(*pDocShell); |
562 aFunc.SetNewRangeNames( pNewRanges, sal_True ); 563 bDone = sal_True; 564 } 565 else 566 { | 609 aFunc.SetNewRangeNames( pNewRanges, sal_True ); 610 bDone = true; 611 } 612 else 613 { |
567 delete pNew; | 614 delete pNew; |
568 delete pNewRanges; 569 } | 615 delete pNewRanges; 616 } |
570 } 571 } 572 573 if (!bDone) 574 throw uno::RuntimeException(); // no other exceptions specified 575} 576 | 617 } 618 } 619 620 if (!bDone) 621 throw uno::RuntimeException(); // no other exceptions specified 622} 623 |
624void SAL_CALL ScNamedRangesObj::addNewByName( const rtl::OUString& aName, 625 const rtl::OUString& aContent, const table::CellAddress& aPosition, 626 sal_Int32 nUnoType ) throw(uno::RuntimeException) 627{ 628 ScUnoGuard aGuard; 629 ImplAddNewByScopeAndName(MAXTABCOUNT, aName, aContent, aPosition, nUnoType); 630} 631 632 633void SAL_CALL ScNamedRangesObj::addNewByScopeName( const rtl::OUString& aScopeName,const rtl::OUString& aRangeName, 634 const rtl::OUString& aContent, const table::CellAddress& aPosition, 635 sal_Int32 nUnoType ) throw(uno::RuntimeException) 636{ 637 ScUnoGuard aGuard; 638 SCTAB scope = MAXTABCOUNT; 639 if (aScopeName.getLength() != 0 && pDocShell && 640 !pDocShell->GetDocument()->GetTable( String(aScopeName), scope ) ) 641 throw uno::RuntimeException(); 642 ImplAddNewByScopeAndName(scope, aRangeName, aContent, aPosition, nUnoType); 643 644 645} 646 |
|
577void SAL_CALL ScNamedRangesObj::addNewFromTitles( const table::CellRangeAddress& aSource, 578 sheet::Border aBorder ) throw(uno::RuntimeException) 579{ 580 ScUnoGuard aGuard; 581 //! das darf kein enum sein, weil mehrere Bits gesetzt sein koennen !!! 582 583 sal_Bool bTop = ( aBorder == sheet::Border_TOP ); 584 sal_Bool bLeft = ( aBorder == sheet::Border_LEFT ); --- 11 unchanged lines hidden (view full) --- 596 597 if (nFlags) 598 { 599 ScDocFunc aFunc(*pDocShell); 600 aFunc.CreateNames( aRange, nFlags, sal_True ); 601 } 602} 603 | 647void SAL_CALL ScNamedRangesObj::addNewFromTitles( const table::CellRangeAddress& aSource, 648 sheet::Border aBorder ) throw(uno::RuntimeException) 649{ 650 ScUnoGuard aGuard; 651 //! das darf kein enum sein, weil mehrere Bits gesetzt sein koennen !!! 652 653 sal_Bool bTop = ( aBorder == sheet::Border_TOP ); 654 sal_Bool bLeft = ( aBorder == sheet::Border_LEFT ); --- 11 unchanged lines hidden (view full) --- 666 667 if (nFlags) 668 { 669 ScDocFunc aFunc(*pDocShell); 670 aFunc.CreateNames( aRange, nFlags, sal_True ); 671 } 672} 673 |
604void SAL_CALL ScNamedRangesObj::removeByName( const rtl::OUString& aName ) 605 throw(uno::RuntimeException) | 674void ScNamedRangesObj::ImplRemoveByScopeAndName(SCTAB aScope, const ::rtl::OUString& aRangeName) 675 throw(uno::RuntimeException) |
606{ | 676{ |
607 ScUnoGuard aGuard; 608 sal_Bool bDone = sal_False; | 677 bool bDone = false; |
609 if (pDocShell) 610 { 611 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 612 if (pNames) 613 { | 678 if (pDocShell) 679 { 680 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 681 if (pNames) 682 { |
614 String aString(aName); | |
615 sal_uInt16 nPos = 0; | 683 sal_uInt16 nPos = 0; |
616 if (pNames->SearchName( aString, nPos )) | 684 if (pNames->SearchName( String(aRangeName), nPos, aScope )) |
617 if ( lcl_UserVisibleName((*pNames)[nPos]) ) 618 { | 685 if ( lcl_UserVisibleName((*pNames)[nPos]) ) 686 { |
619 ScRangeName* pNewRanges = new ScRangeName(*pNames); | 687 ScRangeName* pNewRanges = new ScRangeName(*pNames); |
620 pNewRanges->AtFree(nPos); 621 ScDocFunc aFunc(*pDocShell); | 688 pNewRanges->AtFree(nPos); 689 ScDocFunc aFunc(*pDocShell); |
622 aFunc.SetNewRangeNames( pNewRanges, sal_True ); 623 bDone = sal_True; | 690 aFunc.SetNewRangeNames( pNewRanges, sal_True ); 691 bDone = true; |
624 } 625 } 626 } 627 628 if (!bDone) 629 throw uno::RuntimeException(); // no other exceptions specified 630} 631 | 692 } 693 } 694 } 695 696 if (!bDone) 697 throw uno::RuntimeException(); // no other exceptions specified 698} 699 |
700void SAL_CALL ScNamedRangesObj::removeByName( const rtl::OUString& aName ) 701 throw(uno::RuntimeException) 702{ 703 ScUnoGuard aGuard; 704 ImplRemoveByScopeAndName(MAXTABCOUNT, aName); 705} 706 707 708void SAL_CALL ScNamedRangesObj::removeByScopeName( const ::rtl::OUString& aScopeName, const ::rtl::OUString& aRangeName ) 709 throw(uno::RuntimeException) 710{ 711 ScUnoGuard aGuard; 712 SCTAB scope = MAXTABCOUNT; 713 if (aScopeName.getLength() != 0 && pDocShell && 714 !pDocShell->GetDocument()->GetTable( String(aScopeName), scope )) 715 throw uno::RuntimeException(); 716 ImplRemoveByScopeAndName(scope, aRangeName); 717} 718 719 |
|
632void SAL_CALL ScNamedRangesObj::outputList( const table::CellAddress& aOutputPosition ) 633 throw(uno::RuntimeException) 634{ 635 ScUnoGuard aGuard; 636 ScAddress aPos( (SCCOL)aOutputPosition.Column, (SCROW)aOutputPosition.Row, aOutputPosition.Sheet ); 637 if (pDocShell) 638 { 639 ScDocFunc aFunc(*pDocShell); --- 63 unchanged lines hidden (view full) --- 703 uno::Reference< sheet::XNamedRange > xRange(GetObjectByName_Impl(aName)); 704 if ( xRange.is() ) 705 return uno::makeAny(xRange); 706 else 707 throw container::NoSuchElementException(); 708// return uno::Any(); 709} 710 | 720void SAL_CALL ScNamedRangesObj::outputList( const table::CellAddress& aOutputPosition ) 721 throw(uno::RuntimeException) 722{ 723 ScUnoGuard aGuard; 724 ScAddress aPos( (SCCOL)aOutputPosition.Column, (SCROW)aOutputPosition.Row, aOutputPosition.Sheet ); 725 if (pDocShell) 726 { 727 ScDocFunc aFunc(*pDocShell); --- 63 unchanged lines hidden (view full) --- 791 uno::Reference< sheet::XNamedRange > xRange(GetObjectByName_Impl(aName)); 792 if ( xRange.is() ) 793 return uno::makeAny(xRange); 794 else 795 throw container::NoSuchElementException(); 796// return uno::Any(); 797} 798 |
799uno::Any SAL_CALL ScNamedRangesObj::getByScopeName( const rtl::OUString& aScopeName, const rtl::OUString& aRangeName ) 800 throw(container::NoSuchElementException, 801 lang::WrappedTargetException, uno::RuntimeException) 802{ 803 ScUnoGuard aGuard; 804 uno::Reference< sheet::XNamedRange > xRange(GetObjectByScopeName_Impl(aScopeName, aRangeName)); 805 if ( xRange.is() ) 806 return uno::makeAny(xRange); 807 else 808 throw container::NoSuchElementException(); 809// return uno::Any(); 810} |
|
711uno::Sequence<rtl::OUString> SAL_CALL ScNamedRangesObj::getElementNames() 712 throw(uno::RuntimeException) 713{ 714 ScUnoGuard aGuard; 715 if (pDocShell) 716 { 717 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 718 if (pNames) --- 12 unchanged lines hidden (view full) --- 731 } 732// DBG_ASSERT(nVisPos == nVisCount, "huch, verzaehlt?"); 733 return aSeq; 734 } 735 } 736 return uno::Sequence<rtl::OUString>(0); 737} 738 | 811uno::Sequence<rtl::OUString> SAL_CALL ScNamedRangesObj::getElementNames() 812 throw(uno::RuntimeException) 813{ 814 ScUnoGuard aGuard; 815 if (pDocShell) 816 { 817 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 818 if (pNames) --- 12 unchanged lines hidden (view full) --- 831 } 832// DBG_ASSERT(nVisPos == nVisCount, "huch, verzaehlt?"); 833 return aSeq; 834 } 835 } 836 return uno::Sequence<rtl::OUString>(0); 837} 838 |
839uno::Sequence< sheet::RangeScopeName > SAL_CALL ScNamedRangesObj::getElementScopeNames() 840 throw(uno::RuntimeException) 841{ 842 ScUnoGuard aGuard; 843 if (pDocShell) 844 { 845 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 846 if (pNames) 847 { 848 long nVisCount = getCount(); // Namen mit lcl_UserVisibleName 849 uno::Sequence<sheet::RangeScopeName> aSeq(nVisCount); 850 sheet::RangeScopeName * pAry = aSeq.getArray(); 851 852 sal_uInt16 nCount = pNames->GetCount(); 853 sal_uInt16 nVisPos = 0; 854 for (sal_uInt16 i=0; i<nCount; i++) 855 { 856 ScRangeData* pData = (*pNames)[i]; 857 if ( lcl_UserVisibleName(pData) ) 858 { 859 pAry[nVisPos].RangeName = pData->GetName(); 860 pAry[nVisPos++].ScopeName = pData->GetScopeSheetName(); 861 } 862 } 863// DBG_ASSERT(nVisPos == nVisCount, "huch, verzaehlt?"); 864 return aSeq; 865 } 866 } 867 return uno::Sequence< sheet::RangeScopeName >(0); 868} |
|
739sal_Bool SAL_CALL ScNamedRangesObj::hasByName( const rtl::OUString& aName ) 740 throw(uno::RuntimeException) 741{ 742 ScUnoGuard aGuard; 743 if (pDocShell) 744 { 745 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 746 if (pNames) 747 { 748 sal_uInt16 nPos = 0; 749 if (pNames->SearchName( String(aName), nPos )) 750 if ( lcl_UserVisibleName((*pNames)[nPos]) ) 751 return sal_True; 752 } 753 } 754 return sal_False; 755} 756 | 869sal_Bool SAL_CALL ScNamedRangesObj::hasByName( const rtl::OUString& aName ) 870 throw(uno::RuntimeException) 871{ 872 ScUnoGuard aGuard; 873 if (pDocShell) 874 { 875 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 876 if (pNames) 877 { 878 sal_uInt16 nPos = 0; 879 if (pNames->SearchName( String(aName), nPos )) 880 if ( lcl_UserVisibleName((*pNames)[nPos]) ) 881 return sal_True; 882 } 883 } 884 return sal_False; 885} 886 |
887sal_Bool SAL_CALL ScNamedRangesObj::hasByScopeName( const ::rtl::OUString& aScopeName, const ::rtl::OUString& aRangeName) 888 throw(uno::RuntimeException) 889{ 890 ScUnoGuard aGuard; 891 if (pDocShell) 892 { 893 SCTAB scope = MAXTABCOUNT; 894 if (aScopeName.getLength() != 0 && !pDocShell->GetDocument()->GetTable( String(aScopeName), scope ) ) 895 return sal_False; 896 897 ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); 898 if (pNames) 899 { 900 sal_uInt16 nPos = 0; 901 if (pNames->SearchName( String(aRangeName), nPos, scope )) 902 if ( lcl_UserVisibleName((*pNames)[nPos]) ) 903 return sal_True; 904 } 905 } 906 return sal_False; 907} |
|
757/** called from the XActionLockable interface methods on initial locking */ 758void ScNamedRangesObj::lock() 759{ 760 pDocShell->GetDocument()->CompileNameFormula( sal_True ); // CreateFormulaString 761} 762 763/** called from the XActionLockable interface methods on final unlock */ 764void ScNamedRangesObj::unlock() --- 363 unchanged lines hidden --- | 908/** called from the XActionLockable interface methods on initial locking */ 909void ScNamedRangesObj::lock() 910{ 911 pDocShell->GetDocument()->CompileNameFormula( sal_True ); // CreateFormulaString 912} 913 914/** called from the XActionLockable interface methods on final unlock */ 915void ScNamedRangesObj::unlock() --- 363 unchanged lines hidden --- |