workbookhelper.cxx (ca5ec200) | workbookhelper.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 --- 119 unchanged lines hidden (view full) --- 128 129 /** Returns a reference to the source/target spreadsheet document model. */ 130 inline Reference< XSpreadsheetDocument > getDocument() const { return mxDoc; } 131 /** Returns the cell or page styles container from the Calc document. */ 132 Reference< XNameContainer > getStyleFamily( bool bPageStyles ) const; 133 /** Returns the specified cell or page style from the Calc document. */ 134 Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const; 135 /** Creates and returns a defined name on-the-fly in the Calc document. */ | 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 --- 119 unchanged lines hidden (view full) --- 128 129 /** Returns a reference to the source/target spreadsheet document model. */ 130 inline Reference< XSpreadsheetDocument > getDocument() const { return mxDoc; } 131 /** Returns the cell or page styles container from the Calc document. */ 132 Reference< XNameContainer > getStyleFamily( bool bPageStyles ) const; 133 /** Returns the specified cell or page style from the Calc document. */ 134 Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const; 135 /** Creates and returns a defined name on-the-fly in the Calc document. */ |
136 Reference< XNamedRange > createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const; | 136 Reference< XNamedRange > createNamedRangeObject( OUString& orScope, OUString& orName, sal_Int32 nNameFlags ) const; |
137 /** Creates and returns a database range on-the-fly in the Calc document. */ 138 Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const; 139 /** Creates and returns a com.sun.star.style.Style object for cells or pages. */ 140 Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle ) const; 141 142 // buffers ---------------------------------------------------------------- 143 144 /** Returns the global workbook settings object. */ --- 198 unchanged lines hidden (view full) --- 343 } 344 catch( Exception& ) 345 { 346 } 347 OSL_ENSURE( xStyle.is(), "WorkbookGlobals::getStyleObject - cannot access style object" ); 348 return xStyle; 349} 350 | 137 /** Creates and returns a database range on-the-fly in the Calc document. */ 138 Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const; 139 /** Creates and returns a com.sun.star.style.Style object for cells or pages. */ 140 Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle ) const; 141 142 // buffers ---------------------------------------------------------------- 143 144 /** Returns the global workbook settings object. */ --- 198 unchanged lines hidden (view full) --- 343 } 344 catch( Exception& ) 345 { 346 } 347 OSL_ENSURE( xStyle.is(), "WorkbookGlobals::getStyleObject - cannot access style object" ); 348 return xStyle; 349} 350 |
351Reference< XNamedRange > WorkbookGlobals::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const | 351Reference< XNamedRange > WorkbookGlobals::createNamedRangeObject( OUString& orScope, OUString& orName, sal_Int32 nNameFlags ) const |
352{ 353 // create the name and insert it into the Calc document 354 Reference< XNamedRange > xNamedRange; 355 if( orName.getLength() > 0 ) try 356 { 357 // find an unused name 358 PropertySet aDocProps( mxDoc ); 359 Reference< XNamedRanges > xNamedRanges( aDocProps.getAnyProperty( PROP_NamedRanges ), UNO_QUERY_THROW ); 360 Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY_THROW ); 361 orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' ); 362 // create the named range | 352{ 353 // create the name and insert it into the Calc document 354 Reference< XNamedRange > xNamedRange; 355 if( orName.getLength() > 0 ) try 356 { 357 // find an unused name 358 PropertySet aDocProps( mxDoc ); 359 Reference< XNamedRanges > xNamedRanges( aDocProps.getAnyProperty( PROP_NamedRanges ), UNO_QUERY_THROW ); 360 Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY_THROW ); 361 orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' ); 362 // create the named range |
363 xNamedRanges->addNewByName( orName, OUString(), CellAddress( 0, 0, 0 ), nNameFlags ); 364 xNamedRange.set( xNamedRanges->getByName( orName ), UNO_QUERY ); | 363 xNamedRanges->addNewByScopeName( orScope, orName, OUString(), CellAddress( 0, 0, 0 ), nNameFlags ); 364 xNamedRange.set( xNamedRanges->getByScopeName( orScope, orName ), UNO_QUERY ); |
365 } 366 catch( Exception& ) 367 { 368 } 369 OSL_ENSURE( xNamedRange.is(), "WorkbookGlobals::createNamedRangeObject - cannot create defined name" ); 370 return xNamedRange; 371} 372 --- 360 unchanged lines hidden (view full) --- 733 return mrBookGlob.getStyleFamily( bPageStyles ); 734} 735 736Reference< XStyle > WorkbookHelper::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const 737{ 738 return mrBookGlob.getStyleObject( rStyleName, bPageStyle ); 739} 740 | 365 } 366 catch( Exception& ) 367 { 368 } 369 OSL_ENSURE( xNamedRange.is(), "WorkbookGlobals::createNamedRangeObject - cannot create defined name" ); 370 return xNamedRange; 371} 372 --- 360 unchanged lines hidden (view full) --- 733 return mrBookGlob.getStyleFamily( bPageStyles ); 734} 735 736Reference< XStyle > WorkbookHelper::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const 737{ 738 return mrBookGlob.getStyleObject( rStyleName, bPageStyle ); 739} 740 |
741Reference< XNamedRange > WorkbookHelper::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const | 741Reference< XNamedRange > WorkbookHelper::createNamedRangeObject( OUString& orName, sal_Int32 nSheetId, sal_Int32 nNameFlags ) const |
742{ | 742{ |
743 return mrBookGlob.createNamedRangeObject( orName, nNameFlags ); | 743 OUString orScope = nSheetId >= 0? getWorksheets().getCalcSheetName(nSheetId) : OUString(); 744 return mrBookGlob.createNamedRangeObject( orScope, orName, nNameFlags ); |
744} 745 746Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const 747{ 748 return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr ); 749} 750 751Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle ) const --- 163 unchanged lines hidden --- | 745} 746 747Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const 748{ 749 return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr ); 750} 751 752Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle ) const --- 163 unchanged lines hidden --- |