workbookhelper.cxx (dffa72de) workbookhelper.cxx (102b8ff7)
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

--- 14 unchanged lines hidden (view full) ---

23
24#include "oox/xls/workbookhelper.hxx"
25
26#include <com/sun/star/container/XIndexAccess.hpp>
27#include <com/sun/star/container/XNameContainer.hpp>
28#include <com/sun/star/document/XActionLockable.hpp>
29#include <com/sun/star/sheet/XDatabaseRange.hpp>
30#include <com/sun/star/sheet/XDatabaseRanges.hpp>
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

--- 14 unchanged lines hidden (view full) ---

23
24#include "oox/xls/workbookhelper.hxx"
25
26#include <com/sun/star/container/XIndexAccess.hpp>
27#include <com/sun/star/container/XNameContainer.hpp>
28#include <com/sun/star/document/XActionLockable.hpp>
29#include <com/sun/star/sheet/XDatabaseRange.hpp>
30#include <com/sun/star/sheet/XDatabaseRanges.hpp>
31#include <com/sun/star/sheet/XNamedRange.hpp>
32#include <com/sun/star/sheet/XNamedRanges.hpp>
31#include <com/sun/star/sheet/XNamedRange2.hpp>
32#include <com/sun/star/sheet/XNamedRanges2.hpp>
33#include <com/sun/star/sheet/XSpreadsheet.hpp>
34#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
35#include <com/sun/star/style/XStyle.hpp>
36#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
37#include <com/sun/star/table/CellAddress.hpp>
38#include <osl/thread.h>
39#include "oox/drawingml/theme.hxx"
40#include "oox/helper/progressbar.hxx"

--- 87 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. */
33#include <com/sun/star/sheet/XSpreadsheet.hpp>
34#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
35#include <com/sun/star/style/XStyle.hpp>
36#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
37#include <com/sun/star/table/CellAddress.hpp>
38#include <osl/thread.h>
39#include "oox/drawingml/theme.hxx"
40#include "oox/helper/progressbar.hxx"

--- 87 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& orScope, OUString& orName, sal_Int32 nNameFlags ) const;
136 Reference< XNamedRange2 > 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& orScope, OUString& orName, sal_Int32 nNameFlags ) const
351Reference< XNamedRange2 > WorkbookGlobals::createNamedRangeObject( OUString& orScope, OUString& orName, sal_Int32 nNameFlags ) const
352{
353 // create the name and insert it into the Calc document
352{
353 // create the name and insert it into the Calc document
354 Reference< XNamedRange > xNamedRange;
354 Reference< XNamedRange2 > xNamedRange;
355 if( orName.getLength() > 0 ) try
356 {
357 // find an unused name
358 PropertySet aDocProps( mxDoc );
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 );
359 Reference< XNamedRanges2 > xNamedRanges( aDocProps.getAnyProperty( PROP_NamedRanges2 ), UNO_QUERY_THROW );
360 Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY_THROW );
361 orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
362 // create the named range
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 {

--- 365 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
360 Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY_THROW );
361 orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
362 // create the named range
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 {

--- 365 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 nSheetId, sal_Int32 nNameFlags ) const
741Reference< XNamedRange2 > WorkbookHelper::createNamedRangeObject( OUString& orName, sal_Int32 nSheetId, sal_Int32 nNameFlags ) const
742{
743 OUString orScope = nSheetId >= 0? getWorksheets().getCalcSheetName(nSheetId) : OUString();
744 return mrBookGlob.createNamedRangeObject( orScope, orName, nNameFlags );
745}
746
747Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const
748{
749 return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr );

--- 166 unchanged lines hidden ---
742{
743 OUString orScope = nSheetId >= 0? getWorksheets().getCalcSheetName(nSheetId) : OUString();
744 return mrBookGlob.createNamedRangeObject( orScope, orName, nNameFlags );
745}
746
747Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const
748{
749 return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr );

--- 166 unchanged lines hidden ---