Commits

Anonymous committed 080a052

container_controls: code cleanup

Comments (0)

Files changed (4)

oox/inc/oox/ole/vbaproject.hxx

     /** Registers a dummy module that will be created when the VBA project is
         imported. */
     void                addDummyModule( const ::rtl::OUString& rName, sal_Int32 nType );
-    
+
     /** Called when the import process of the VBA code modules starts. */
     virtual void        prepareModuleImport();
 
 
 private:
     typedef ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap;
-    
+
     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
                         mxGlobalFactory;    /// Global service factory.
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >

oox/source/ole/vbamodule.cxx

  ************************************************************************/
 
 #include "oox/ole/vbamodule.hxx"
+
+#include <hash_map>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/script/ModuleInfo.hpp>
 #include <com/sun/star/script/ModuleType.hpp>
 #include <com/sun/star/script/XVBAModuleInfo.hpp>
-#include <hash_map>
 #include <cppuhelper/implbase1.hxx>
 #include "oox/helper/binaryinputstream.hxx"
 #include "oox/helper/storagebase.hxx"
 #include "oox/ole/vbahelper.hxx"
 #include "oox/ole/vbainputstream.hxx"
 
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::container::XIndexContainer;
-using ::com::sun::star::container::ElementExistException;
-using ::com::sun::star::container::NoSuchElementException;
-using ::com::sun::star::lang::IndexOutOfBoundsException;
-using ::com::sun::star::lang::WrappedTargetException;
-using ::com::sun::star::lang::IllegalArgumentException;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::script::ModuleInfo;
-using ::com::sun::star::script::XVBAModuleInfo;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Type;
-using ::com::sun::star::uno::makeAny;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-
-namespace ApiModuleType = ::com::sun::star::script::ModuleType;
-
 namespace oox {
 namespace ole {
 
 // ============================================================================
 
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
 typedef ::cppu::WeakImplHelper1< XIndexContainer > OleIdToNameContainer_BASE;
 typedef std::hash_map< sal_Int32, rtl::OUString >  ObjIdToName;
+
 class OleIdToNameContainer : public OleIdToNameContainer_BASE
 {
     ObjIdToName ObjIdToNameHash;
     mxDocModel( rxDocModel ),
     maName( rName ),
     meTextEnc( eTextEnc ),
-    mnType( ApiModuleType::UNKNOWN ),
+    mnType( ModuleType::UNKNOWN ),
     mnOffset( SAL_MAX_UINT32 ),
     mbReadOnly( false ),
     mbPrivate( false ),
             break;
             case VBA_ID_MODULETYPEPROCEDURAL:
                 OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
-                OSL_ENSURE( mnType == ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
-                mnType = ApiModuleType::NORMAL;
+                OSL_ENSURE( mnType == ModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
+                mnType = ModuleType::NORMAL;
             break;
             case VBA_ID_MODULETYPEDOCUMENT:
                 OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
-                OSL_ENSURE( mnType == ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
-                mnType = ApiModuleType::DOCUMENT;
+                OSL_ENSURE( mnType == ModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
+                mnType = ModuleType::DOCUMENT;
             break;
             case VBA_ID_MODULEREADONLY:
                 OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
     }
     OSL_ENSURE( maName.getLength() > 0, "VbaModule::importDirRecords - missing module name" );
     OSL_ENSURE( maStreamName.getLength() > 0, "VbaModule::importDirRecords - missing module stream name" );
-    OSL_ENSURE( mnType != ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - missing module type" );
+    OSL_ENSURE( mnType != ModuleType::UNKNOWN, "VbaModule::importDirRecords - missing module type" );
     OSL_ENSURE( mnOffset < SAL_MAX_UINT32, "VbaModule::importDirRecords - missing module stream offset" );
 }
 
     aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
     switch( mnType )
     {
-        case ApiModuleType::NORMAL:
+        case ModuleType::NORMAL:
             aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAModule" ) );
         break;
-        case ApiModuleType::CLASS:
+        case ModuleType::CLASS:
             aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAClassModule" ) );
         break;
-        case ApiModuleType::FORM:
+        case ModuleType::FORM:
             aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAFormModule" ) );
             // hack from old filter, document Basic should know the XModel, but it doesn't
             aModuleInfo.ModuleObject.set( mxDocModel, UNO_QUERY );
         break;
-        case ApiModuleType::DOCUMENT:
+        case ModuleType::DOCUMENT:
             aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBADocumentModule" ) );
             // get the VBA implementation object associated to the document module
             if( rxDocObjectNA.is() ) try
     if( mbExecutable )
     {
         aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Option VBASupport 1\n" ) );
-        if( mnType == ApiModuleType::CLASS )
+        if( mnType == ModuleType::CLASS )
             aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Option ClassModule\n" ) );
     }
     else

oox/source/ole/vbaproject.cxx

  ************************************************************************/
 
 #include "oox/ole/vbaproject.hxx"
+
 #include <com/sun/star/document/XEventsSupplier.hpp>
 #include <com/sun/star/document/XStorageBasedDocument.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/script/ModuleType.hpp>
 #include <com/sun/star/script/XLibraryContainer.hpp>
 #include <com/sun/star/script/XVBACompat.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/string.hxx>
 #include <rtl/tencinfo.h>
 #include <rtl/ustrbuf.h>
-#include <comphelper/configurationhelper.hxx>
-#include <comphelper/string.hxx>
-#include "properties.hxx"
-#include "tokens.hxx"
 #include "oox/helper/binaryinputstream.hxx"
 #include "oox/helper/containerhelper.hxx"
 #include "oox/helper/propertyset.hxx"
 #include "oox/ole/vbahelper.hxx"
 #include "oox/ole/vbainputstream.hxx"
 #include "oox/ole/vbamodule.hxx"
-
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::document::XEventsSupplier;
-using ::com::sun::star::document::XStorageBasedDocument;
-using ::com::sun::star::embed::XStorage;
-using ::com::sun::star::embed::XTransactedObject;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::io::XStream;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::script::XLibraryContainer;
-using ::com::sun::star::script::XVBACompat;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::uno::XInterface;
-using ::comphelper::ConfigurationHelper;
-
-namespace ApiModuleType = ::com::sun::star::script::ModuleType;
+#include "properties.hxx"
+#include "tokens.hxx"
 
 namespace oox {
 namespace ole {
 
 // ============================================================================
 
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::uno;
+
+using ::comphelper::ConfigurationHelper;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
 namespace {
 
 bool lclReadConfigItem( const Reference< XInterface >& rxConfigAccess, const OUString& rItemName )
     OSL_ENSURE( xVbaStrg.get(), "VbaProject::importVba - cannot open 'VBA' substorage" );
     if( !xVbaStrg )
         return;
-        
+
     /*  Read the 'VBA/dir' stream which contains general settings of the VBA
         project such as the text encoding used throughout several streams, and
         a list of all code modules.
             bExitLoop = (nLineLen >= 2) && (aLine[ 0 ] == '[') && (aLine[ nLineLen - 1 ] == ']');
             if( !bExitLoop && VbaHelper::extractKeyValue( aKey, aValue, aLine ) )
             {
-                sal_Int32 nType = ApiModuleType::UNKNOWN;
+                sal_Int32 nType = ModuleType::UNKNOWN;
                 if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Document" ) ) )
                 {
-                    nType = ApiModuleType::DOCUMENT;
+                    nType = ModuleType::DOCUMENT;
                     // strip automation server version from module names
                     sal_Int32 nSlashPos = aValue.indexOf( '/' );
                     if( nSlashPos >= 0 )
                         aValue = aValue.copy( 0, nSlashPos );
                 }
                 else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Module" ) ) )
-                    nType = ApiModuleType::NORMAL;
+                    nType = ModuleType::NORMAL;
                 else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Class" ) ) )
-                    nType = ApiModuleType::CLASS;
+                    nType = ModuleType::CLASS;
                 else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "BaseClass" ) ) )
-                    nType = ApiModuleType::FORM;
+                    nType = ModuleType::FORM;
 
-                if( (nType != ApiModuleType::UNKNOWN) && (aValue.getLength() > 0) )
+                if( (nType != ModuleType::UNKNOWN) && (aValue.getLength() > 0) )
                 {
                     OSL_ENSURE( aModules.has( aValue ), "VbaProject::importVba - module not found" );
                     if( VbaModule* pModule = aModules.get( aValue ).get() )
             {
                 // resolve module name from storage name (which equals the module stream name)
                 VbaModule* pModule = aModulesByStrm.get( *aIt ).get();
-                OSL_ENSURE( pModule && (pModule->getType() == ApiModuleType::FORM),
+                OSL_ENSURE( pModule && (pModule->getType() == ModuleType::FORM),
                     "VbaProject::importVba - form substorage without form module" );
                 OUString aModuleName;
                 if( pModule )

oox/source/xls/excelvbaproject.cxx

 /*************************************************************************
  *
  * 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
 namespace oox {
 namespace xls {
 
+// ============================================================================
+
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::document;
 using namespace ::com::sun::star::frame;
     {
         // collect existing codenames (do not use them when creating new codenames)
         CodeNameSet aUsedCodeNames;
-        
+
         // collect common sheets and chart sheets without codenames
         SheetPropertySetList aSheetsWithout, aChartsWithout;
-        
+
         // iterate over all imported sheets
         Reference< XEnumerationAccess > xSheetsEA( mxDocument->getSheets(), UNO_QUERY_THROW );
         Reference< XEnumeration > xSheetsEnum( xSheetsEA->createEnumeration(), UNO_SET_THROW );