[Libreoffice-commits] .: 3 commits - sc/inc sc/source
Noel Power
noelp at kemper.freedesktop.org
Fri Nov 5 09:46:58 PDT 2010
sc/inc/document.hxx | 4 -
sc/inc/unonames.hxx | 2
sc/source/core/data/document.cxx | 2
sc/source/filter/excel/excimp8.cxx | 131 ++++++++++++++++++++++++++++++++++--
sc/source/filter/excel/xiescher.cxx | 13 +--
sc/source/filter/excel/xiroot.cxx | 4 -
sc/source/filter/inc/xiescher.hxx | 13 +--
sc/source/ui/docshell/docfunc.cxx | 3
sc/source/ui/docshell/docsh5.cxx | 20 ++++-
sc/source/ui/unoobj/addruno.cxx | 27 +++----
sc/source/ui/unoobj/cellsuno.cxx | 3
11 files changed, 176 insertions(+), 46 deletions(-)
New commits:
commit 43a896391015cf604e6f64de29da8a03efe40567
Merge: 0c0b77c... ca3fd44...
Author: Noel Power <noel.power at novell.com>
Date: Fri Nov 5 11:37:50 2010 +0000
Merge branch 'master' of ssh://git.freedesktop.org/git/libreoffice/calc
commit 0c0b77ce59d8de7000a6365310a63708a011510a
Author: Noel Power <noel.power at novell.com>
Date: Thu Nov 4 21:26:31 2010 +0000
Fix logic for XLA1Representation for CellAddress/RangeConversion
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 2b90cf0..1bb5aac 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -619,7 +619,7 @@
#define SC_UNONAME_ADDRESS "Address"
#define SC_UNONAME_UIREPR "UserInterfaceRepresentation"
#define SC_UNONAME_PERSREPR "PersistentRepresentation"
-#define SC_UNONAME_XL_A1_REPR "XL_A1_Representation"
+#define SC_UNONAME_XLA1REPR "XLA1Representation"
#define SC_UNONAME_REFSHEET "ReferenceSheet"
// --> PB 2004-08-23 #i33095# Security Options
diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx
index e9618d4..eca77af 100644
--- a/sc/source/ui/unoobj/addruno.cxx
+++ b/sc/source/ui/unoobj/addruno.cxx
@@ -117,7 +117,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp
{
{MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_XLA1REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
{0,0,0,0,0,0}
@@ -131,7 +131,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp
{
{MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_XLA1REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
{0,0,0,0,0,0}
@@ -193,11 +193,11 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const rtl::OUString& aPr
bSuccess = ParseUIString( aUIString );
}
}
- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XLA1REPR ) )
{
- ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
- if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- aConv = ::formula::FormulaGrammar::CONV_XL_A1;
+ ::formula::FormulaGrammar::AddressConvention aConv = aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) ?
+ ::formula::FormulaGrammar::CONV_OOO : ::formula::FormulaGrammar::CONV_XL_A1;
+
// parse the file format string
rtl::OUString sRepresentation;
if (aValue >>= sRepresentation)
@@ -271,24 +271,23 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const rtl::OUString&
aRange.aStart.Format( aFormatStr, nFlags, pDoc );
aRet <<= rtl::OUString( aFormatStr );
}
- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XLA1REPR ) )
{
- ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
- if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- aConv = ::formula::FormulaGrammar::CONV_XL_A1;
+ ::formula::FormulaGrammar::AddressConvention eConv = aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) ?
+ ::formula::FormulaGrammar::CONV_OOO : ::formula::FormulaGrammar::CONV_XL_A1;
// generate file format string - always include sheet
String aFormatStr;
- aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
+ aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, eConv );
if ( bIsRange )
{
// manually concatenate range so both parts always have the sheet name
aFormatStr.Append( (sal_Unicode) ':' );
String aSecond;
USHORT nFlags = SCA_VALID;
- if( aConv != ::formula::FormulaGrammar::CONV_XL_A1 )
- nFlags |= SCA_TAB_3D;
- aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
+ if( eConv != ::formula::FormulaGrammar::CONV_XL_A1 )
+ nFlags |= SCA_TAB_3D;
+ aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, eConv );
aFormatStr.Append( aSecond );
}
aRet <<= rtl::OUString( aFormatStr );
commit 3a4fd389d85c4a859ce66a939d3cdd165fc536e0
Author: Noel Power <noel.power at novell.com>
Date: Tue Nov 2 15:36:45 2010 +0000
initial import of latest cws container_controls
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ddbb1e8..ed12028 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -469,7 +469,7 @@ public:
SC_DLLPUBLIC const String& GetName() const { return aDocName; }
void SetName( const String& r ) { aDocName = r; }
const String& GetCodeName() const { return aDocCodeName; }
- void SetCodeName( const String& r ) { aDocCodeName = r; }
+ void SetCodeName( const String& r ) { aDocCodeName = r; }
SC_DLLPUBLIC NameToNameMap* GetLocalNameMap( SCTAB& rTab );
@@ -567,7 +567,7 @@ public:
SC_DLLPUBLIC BOOL HasTable( SCTAB nTab ) const;
SC_DLLPUBLIC BOOL GetName( SCTAB nTab, String& rName ) const;
SC_DLLPUBLIC BOOL GetCodeName( SCTAB nTab, String& rName ) const;
- SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, String& rName );
+ SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, const String& rName );
SC_DLLPUBLIC BOOL GetTable( const String& rName, SCTAB& rTab ) const;
SC_DLLPUBLIC inline SCTAB GetTableCount() const { return nMaxTableNumber; }
SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 2a66a64..f379b07 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -161,7 +161,7 @@ BOOL ScDocument::GetName( SCTAB nTab, String& rName ) const
return FALSE;
}
-BOOL ScDocument::SetCodeName( SCTAB nTab, String& rName )
+BOOL ScDocument::SetCodeName( SCTAB nTab, const String& rName )
{
if (VALIDTAB(nTab))
{
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 7f2a772..4104070 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -105,13 +105,99 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <comphelper/mediadescriptor.hxx>
#include <cppuhelper/component_context.hxx>
#include <sfx2/app.hxx>
#include "xltoolbar.hxx"
+
using namespace com::sun::star;
+using namespace ::comphelper;
using ::rtl::OUString;
+//OleNameOverrideContainer
+
+typedef ::cppu::WeakImplHelper1< container::XNameContainer > OleNameOverrideContainer_BASE;
+
+class OleNameOverrideContainer : public OleNameOverrideContainer_BASE
+{
+private:
+ typedef std::hash_map< rtl::OUString, uno::Reference< container::XIndexContainer >, ::rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > NamedIndexToOleName;
+ NamedIndexToOleName IdToOleNameHash;
+ ::osl::Mutex m_aMutex;
+public:
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return container::XIndexContainer::static_type(0); }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return ( IdToOleNameHash.size() > 0 );
+ }
+ // XNameAcess
+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !hasByName(aName) )
+ throw container::NoSuchElementException();
+ return uno::makeAny( IdToOleNameHash[ aName ] );
+ }
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ uno::Sequence< ::rtl::OUString > aResult( IdToOleNameHash.size() );
+ NamedIndexToOleName::iterator it = IdToOleNameHash.begin();
+ NamedIndexToOleName::iterator it_end = IdToOleNameHash.end();
+ rtl::OUString* pName = aResult.getArray();
+ for (; it != it_end; ++it, ++pName )
+ *pName = it->first;
+ return aResult;
+ }
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return ( IdToOleNameHash.find( aName ) != IdToOleNameHash.end() );
+ }
+
+ // XElementAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return IdToOleNameHash.size();
+ }
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( hasByName( aName ) )
+ throw container::ElementExistException();
+ uno::Reference< container::XIndexContainer > xElement;
+ if ( ! ( aElement >>= xElement ) )
+ throw lang::IllegalArgumentException();
+ IdToOleNameHash[ aName ] = xElement;
+ }
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !hasByName( aName ) )
+ throw container::NoSuchElementException();
+ IdToOleNameHash.erase( IdToOleNameHash.find( aName ) );
+ }
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !hasByName( aName ) )
+ throw container::NoSuchElementException();
+ uno::Reference< container::XIndexContainer > xElement;
+ if ( ! ( aElement >>= xElement ) )
+ throw lang::IllegalArgumentException();
+ IdToOleNameHash[ aName ] = xElement;
+ }
+};
+
// defined in docfunc.cxx ( really this needs a new name )
script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
@@ -244,9 +330,10 @@ void ImportExcel8::ReadBasic( void )
bool bLoadCode = pFilterOpt->IsLoadExcelBasicCode();
bool bLoadExecutable = pFilterOpt->IsLoadExcelBasicExecutable();
bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage();
+ // #FIXME need to get rid of this, we can also do this from within oox
+ // via the "ooo.vba.VBAGlobals" service
if( bLoadCode || bLoadStrg )
{
- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
bool bAsComment = !bLoadExecutable;
if ( !bAsComment )
@@ -268,9 +355,45 @@ void ImportExcel8::ReadBasic( void )
#endif
}
- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
- if ( !bAsComment )
- GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
+ }
+ try
+ {
+ uno::Reference< lang::XComponent > xComponent( pShell->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Sequence< beans::NamedValue > aArgSeq( 1 );
+
+ // collect names of embedded form controls, as specified in the VBA project
+ aArgSeq[ 0 ].Name = CREATE_OUSTRING( "OleNameOverrideInfo" );
+ uno::Reference< container::XNameContainer > xOleNameOverrideSink( new OleNameOverrideContainer );
+ aArgSeq[ 0 ].Value <<= xOleNameOverrideSink;
+
+ uno::Sequence< uno::Any > aArgs( 2 );
+ // framework calls filter objects with factory as first argument
+ aArgs[ 0 ] <<= getProcessServiceFactory();
+ aArgs[ 1 ] <<= aArgSeq;
+
+ uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs( CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelVBAProjectFilter" ), aArgs ), uno::UNO_QUERY_THROW );
+ xImporter->setTargetDocument( xComponent );
+
+ MediaDescriptor aMediaDesc;
+ SfxMedium& rMedium = GetMedium();
+ SfxItemSet* pItemSet = rMedium.GetItemSet();
+ if( pItemSet )
+ {
+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) )
+ aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() );
+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) )
+ aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() );
+ }
+ aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream();
+ aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler();
+
+ // call the filter
+ uno::Reference< document::XFilter > xFilter( xImporter, uno::UNO_QUERY_THROW );
+ xFilter->filter( aMediaDesc.getAsConstPropertyValueList() );
+ GetObjectManager().SetOleNameOverrideInfo( xOleNameOverrideSink );
+ }
+ catch( uno::Exception& )
+ {
}
}
}
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index f32a6e2..12a03c2 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -3176,17 +3176,14 @@ XclImpDffConverter::~XclImpDffConverter()
String XclImpObjectManager::GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId )
{
- String sOleName;
+ rtl::OUString sOleName;
String sCodeName = GetExtDocOptions().GetCodeName( nTab );
- CodeNameToCntrlObjIdInfo::iterator it = maOleCtrlNameOverride.find( sCodeName );
- if ( it != maOleCtrlNameOverride.end() )
+ if ( mxOleCtrlNameOverride->hasByName( sCodeName ) )
{
- CntrlObjIdToName::iterator it_id = it->second.find( nObjId );
- if ( it_id != it->second.end() )
- {
- sOleName = it_id->second;
- }
+ Reference< XIndexContainer > xIdToOleName;
+ mxOleCtrlNameOverride->getByName( sCodeName ) >>= xIdToOleName;
+ xIdToOleName->getByIndex( nObjId ) >>= sOleName;
}
OSL_TRACE("XclImpObjectManager::GetOleNameOverride tab %d, ( module %s ) object id ( %d ) is %s", nTab,
rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), nObjId,
diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx
index 1e81805..9e0c23c 100644
--- a/sc/source/filter/excel/xiroot.cxx
+++ b/sc/source/filter/excel/xiroot.cxx
@@ -109,7 +109,7 @@ void XclImpRoot::SetAppFontEncoding( rtl_TextEncoding eAppFontEnc )
SetTextEncoding( eAppFontEnc );
}
-void XclImpRoot::InitializeTable( SCTAB /*nScTab*/ )
+void XclImpRoot::InitializeTable( SCTAB nScTab )
{
if( GetBiff() <= EXC_BIFF4 )
{
@@ -121,6 +121,8 @@ void XclImpRoot::InitializeTable( SCTAB /*nScTab*/ )
GetXFRangeBuffer().Initialize();
GetPageSettings().Initialize();
GetTabViewSettings().Initialize();
+ // delete the automatically generated codename
+ GetDoc().SetCodeName( nScTab, String::EmptyString() );
}
void XclImpRoot::FinalizeTable()
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index d73bf1b..88aa723 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -1213,8 +1213,6 @@ private:
/** Stores all drawing and OLE objects and additional data related to these objects. */
class XclImpObjectManager : protected XclImpRoot
{
-typedef std::hash_map< sal_Int32, String > CntrlObjIdToName;
-typedef std::map< String, CntrlObjIdToName > CodeNameToCntrlObjIdInfo;
public:
explicit XclImpObjectManager( const XclImpRoot& rRoot );
virtual ~XclImpObjectManager();
@@ -1231,13 +1229,15 @@ public:
String GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
/** Returns the used area in the sheet with the passed index. */
ScRange GetUsedArea( SCTAB nScTab ) const;
- void SetOleNameOverrideInfo( const CodeNameToCntrlObjIdInfo& rOverrideInfo ) { maOleCtrlNameOverride = rOverrideInfo; }
+ /** Sets the container to receive overridden shape/ctrl names from
+ the filter. */
+ void SetOleNameOverrideInfo( const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& rxOverrideInfo ) { mxOleCtrlNameOverride = rxOverrideInfo; }
+ /** Returns the name of overridden name ( or zero length string ) for
+ associated object id. */
String GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId );
// ------------------------------------------------------------------------
private:
- CodeNameToCntrlObjIdInfo maOleCtrlNameOverride;
-
/** Reads and returns a bitmap from WMF/PICT format. */
static void ReadWmf( Graphic& rGraphic, XclImpStream& rStrm );
/** Reads and returns a bitmap from BMP format. */
@@ -1270,6 +1270,7 @@ private:
typedef ScfRef< XclImpSheetDrawing > XclImpSheetDrawingRef;
typedef ::std::map< SCTAB, XclImpSheetDrawingRef > XclImpSheetDrawingMap;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxOleCtrlNameOverride;
DefObjNameMap maDefObjNames; /// Default base names for all object types.
SvMemoryStream maDggStrm; /// Copy of global DFF data (DGG container) in memory.
XclImpSheetDrawingMap maSheetDrawings; /// Drawing managers of all sheets.
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ac22335..53d01f8 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2691,8 +2691,7 @@ void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String
uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
if ( xVBAModuleInfo.is() )
{
- String sCodeName( genModuleName );
- rDoc.SetCodeName( nTab, sCodeName );
+ rDoc.SetCodeName( nTab, genModuleName );
script::ModuleInfo sModuleInfo = lcl_InitModuleInfo( rDocSh, genModuleName );
xVBAModuleInfo->insertModuleInfo( genModuleName, sModuleInfo );
xLib->insertByName( genModuleName, aSourceAny );
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 676c201..59c7e4b 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -43,6 +43,7 @@
#include <svl/smplhint.hxx>
#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
// INCLUDE ---------------------------------------------------------------
@@ -71,6 +72,12 @@
// defined in docfunc.cxx
void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String& sModuleSource );
+using com::sun::star::script::XLibraryContainer;
+using com::sun::star::script::vba::XVBACompatibility;
+using com::sun::star::container::XNameContainer;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::UNO_QUERY;
+
// ---------------------------------------------------------------------------
//
@@ -940,18 +947,21 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
{
StarBASIC* pStarBASIC = GetBasic();
String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
- if ( GetBasicManager()->GetName().Len() > 0 )
+ Reference< XLibraryContainer > xLibContainer = GetBasicContainer();
+ Reference< XVBACompatibility > xVBACompat( xLibContainer, UNO_QUERY );
+
+ if ( xVBACompat.is() )
{
- aLibName = GetBasicManager()->GetName();
+ aLibName = xVBACompat->getProjectName();
pStarBASIC = GetBasicManager()->GetLib( aLibName );
}
+
SCTAB nTabToUse = nDestTab;
if ( nDestTab == SC_TAB_APPEND )
nTabToUse = aDocument.GetMaxTableNumber() - 1;
String sCodeName;
String sSource;
- com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > xLibContainer = GetBasicContainer();
- com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLib;
+ Reference< XNameContainer > xLib;
if( xLibContainer.is() )
{
com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
@@ -1018,7 +1028,7 @@ IMPL_LINK( ScDocShell, RefreshDBDataHdl, ScRefreshTimer*, pRefreshTimer )
{
ScRange aRange;
pDBData->GetArea( aRange );
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> xResultSet;
+ Reference< ::com::sun::star::sdbc::XResultSet> xResultSet;
bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, xResultSet, NULL, TRUE, FALSE ); //! Api-Flag as parameter
// internal operations (sort, query, subtotal) only if no error
if (bContinue)
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index eadb12a..d55bb28 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -8494,8 +8494,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
rtl::OUString aCodeName;
if ( pDocSh && ( aValue >>= aCodeName ) )
{
- String sNewName( aCodeName );
- pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), sNewName );
+ pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), aCodeName );
}
}
else
More information about the Libreoffice-commits
mailing list