xref: /trunk/main/dtrans/source/win32/clipb/wcbentry.cxx (revision 9c9d9658c5c7e4a65453d7bfdc82f55dc0fd0331)
148123e16SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
348123e16SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
448123e16SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
548123e16SAndrew Rist  * distributed with this work for additional information
648123e16SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
748123e16SAndrew Rist  * to you under the Apache License, Version 2.0 (the
848123e16SAndrew Rist  * "License"); you may not use this file except in compliance
948123e16SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1148123e16SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1348123e16SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1448123e16SAndrew Rist  * software distributed under the License is distributed on an
1548123e16SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1648123e16SAndrew Rist  * KIND, either express or implied.  See the License for the
1748123e16SAndrew Rist  * specific language governing permissions and limitations
1848123e16SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2048123e16SAndrew Rist  *************************************************************/
2148123e16SAndrew Rist 
2248123e16SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dtrans.hxx"
26cdf0e10cSrcweir //______________________________________________________________________________________________________________
27cdf0e10cSrcweir //  includes of other projects
28cdf0e10cSrcweir //______________________________________________________________________________________________________________
29cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
30cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
31cdf0e10cSrcweir #include <osl/diagnose.h>
32cdf0e10cSrcweir #include "WinClipboard.hxx"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //-----------------------------------------------------------------
35cdf0e10cSrcweir // some defines
36cdf0e10cSrcweir //-----------------------------------------------------------------
37cdf0e10cSrcweir 
38cdf0e10cSrcweir // the service names
39cdf0e10cSrcweir #define WINCLIPBOARD_SERVICE_NAME  "com.sun.star.datatransfer.clipboard.SystemClipboard"
40cdf0e10cSrcweir 
41cdf0e10cSrcweir // the implementation names
42cdf0e10cSrcweir #define WINCLIPBOARD_IMPL_NAME  "com.sun.star.datatransfer.clipboard.ClipboardW32"
43cdf0e10cSrcweir 
44cdf0e10cSrcweir // the registry key names
45cdf0e10cSrcweir // a key under which this service will be registered, Format: -> "/ImplName/UNO/SERVICES/ServiceName"
46cdf0e10cSrcweir //                        <     Implementation-Name    ></UNO/SERVICES/><    Service-Name           >
47cdf0e10cSrcweir #define WINCLIPBOARD_REGKEY_NAME  "/com.sun.star.datatransfer.clipboard.ClipboardW32/UNO/SERVICES/com.sun.star.datatransfer.clipboard.SystemClipboard"
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------
50cdf0e10cSrcweir // namespace directives
51cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------
52cdf0e10cSrcweir 
53cdf0e10cSrcweir using namespace ::rtl                       ;
54cdf0e10cSrcweir using namespace ::com::sun::star::uno       ;
55cdf0e10cSrcweir using namespace ::com::sun::star::registry  ;
56cdf0e10cSrcweir using namespace ::cppu                      ;
57cdf0e10cSrcweir using namespace ::com::sun::star::lang;
58cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer::clipboard;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir //-----------------------------------------------------------------
61cdf0e10cSrcweir // create a static object to initialize the shell9x library
62cdf0e10cSrcweir //-----------------------------------------------------------------
63cdf0e10cSrcweir 
64cdf0e10cSrcweir namespace
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     //-----------------------------------------------------------------------------------------------------------
68*9c9d9658SJohn Bampton     // functions to create a new Clipboard instance; is needed by factory helper implementation
69cdf0e10cSrcweir     // @param rServiceManager - service manager, useful if the component needs other uno services
70cdf0e10cSrcweir     // so we should give it to every UNO-Implementation component
71cdf0e10cSrcweir     //-----------------------------------------------------------------------------------------------------------
72cdf0e10cSrcweir 
createInstance(const Reference<XMultiServiceFactory> & rServiceManager)73cdf0e10cSrcweir     Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
74cdf0e10cSrcweir     {
75cdf0e10cSrcweir         return Reference< XInterface >( static_cast< XClipboard* >( new CWinClipboard( rServiceManager, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) ) ) ) );
76cdf0e10cSrcweir     }
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------
80cdf0e10cSrcweir // the 3 important functions which will be exported
81cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------
82cdf0e10cSrcweir 
83cdf0e10cSrcweir extern "C"
84cdf0e10cSrcweir {
85cdf0e10cSrcweir 
86cdf0e10cSrcweir //----------------------------------------------------------------------
87cdf0e10cSrcweir // component_getImplementationEnvironment
88cdf0e10cSrcweir //----------------------------------------------------------------------
89cdf0e10cSrcweir 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)90e8183b3fSdamjan SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
91cdf0e10cSrcweir     const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir //----------------------------------------------------------------------
97cdf0e10cSrcweir // component_getFactory
98cdf0e10cSrcweir // returns a factory to create XFilePicker-Services
99cdf0e10cSrcweir //----------------------------------------------------------------------
100cdf0e10cSrcweir 
component_getFactory(const sal_Char * pImplName,uno_Interface * pSrvManager,uno_Interface *)101e8183b3fSdamjan SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     void* pRet = 0;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, WINCLIPBOARD_IMPL_NAME ) ) )
106cdf0e10cSrcweir     {
107cdf0e10cSrcweir         Sequence< OUString > aSNS( 1 );
108cdf0e10cSrcweir         aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( WINCLIPBOARD_SERVICE_NAME ) );
109cdf0e10cSrcweir 
110cdf0e10cSrcweir         //OUString( RTL_CONSTASCII_USTRINGPARAM( FPS_IMPL_NAME ) )
111cdf0e10cSrcweir         Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory(
112cdf0e10cSrcweir             reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
113cdf0e10cSrcweir             OUString::createFromAscii( pImplName ),
114cdf0e10cSrcweir             createInstance,
115cdf0e10cSrcweir             aSNS ) );
116cdf0e10cSrcweir         if ( xFactory.is() )
117cdf0e10cSrcweir         {
118cdf0e10cSrcweir             xFactory->acquire();
119cdf0e10cSrcweir             pRet = xFactory.get();
120cdf0e10cSrcweir         }
121cdf0e10cSrcweir     }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     return pRet;
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir } // extern "C"
127