1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: commandcontainer.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef _DBA_COREDATAACCESS_COMMANDCONTAINER_HXX_
35 #include "commandcontainer.hxx"
37 #ifndef _DBA_COREDATAACESS_COMMANDDEFINITION_HXX_
38 #include "commanddefinition.hxx"
41 #ifndef _TOOLS_DEBUG_HXX
42 #include <tools/debug.hxx>
44 #ifndef DBACCESS_SHARED_DBASTRINGS_HRC
45 #include "dbastrings.hrc"
48 using namespace ::com::sun::star::uno
;
49 using namespace ::com::sun::star::lang
;
50 using namespace ::com::sun::star::beans
;
51 using namespace ::com::sun::star::container
;
52 using namespace ::com::sun::star::ucb
;
53 using namespace ::osl
;
54 using namespace ::comphelper
;
55 using namespace ::cppu
;
57 //........................................................................
60 //........................................................................
62 //==========================================================================
64 //==========================================================================
65 DBG_NAME(OCommandContainer
)
66 //--------------------------------------------------------------------------
67 OCommandContainer::OCommandContainer( const Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _xORB
68 ,const Reference
< XInterface
>& _xParentContainer
69 ,const TContentPtr
& _pImpl
72 :ODefinitionContainer(_xORB
,_xParentContainer
,_pImpl
,!_bTables
)
75 DBG_CTOR(OCommandContainer
, NULL
);
77 //--------------------------------------------------------------------------
78 OCommandContainer::~OCommandContainer()
80 DBG_DTOR(OCommandContainer
, NULL
);
82 // -----------------------------------------------------------------------------
83 IMPLEMENT_FORWARD_XINTERFACE2( OCommandContainer
,ODefinitionContainer
,OCommandContainer_BASE
)
84 IMPLEMENT_TYPEPROVIDER2(OCommandContainer
,ODefinitionContainer
,OCommandContainer_BASE
);
85 //--------------------------------------------------------------------------
86 Reference
< XContent
> OCommandContainer::createObject( const ::rtl::OUString
& _rName
)
88 const ODefinitionContainer_Impl
& rDefinitions( getDefinitions() );
89 OSL_ENSURE( rDefinitions
.find(_rName
) != rDefinitions
.end(), "OCommandContainer::createObject: Invalid entry in map!" );
91 const TContentPtr
& pElementContent( rDefinitions
.find( _rName
)->second
);
93 return new OComponentDefinition( *this, _rName
, m_aContext
.getLegacyServiceFactory(), pElementContent
, m_bTables
);
94 return new OCommandDefinition( *this, _rName
, m_aContext
.getLegacyServiceFactory(), pElementContent
);
97 // -----------------------------------------------------------------------------
98 Reference
< XInterface
> SAL_CALL
OCommandContainer::createInstanceWithArguments(const Sequence
< Any
>& /*aArguments*/ ) throw (Exception
, RuntimeException
)
100 return createInstance( );
103 // -----------------------------------------------------------------------------
104 Reference
< XInterface
> SAL_CALL
OCommandContainer::createInstance( ) throw (Exception
, RuntimeException
)
106 return m_aContext
.createComponent( (::rtl::OUString
)( m_bTables
? SERVICE_SDB_TABLEDEFINITION
: SERVICE_SDB_COMMAND_DEFINITION
) );
109 // -----------------------------------------------------------------------------
110 ::rtl::OUString
OCommandContainer::determineContentType() const
112 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseCommandDefinitionContainer" ) );
115 //........................................................................
116 } // namespace dbaccess
117 //........................................................................