diff options
Diffstat (limited to 'odk/examples/cpp')
14 files changed, 117 insertions, 117 deletions
diff --git a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx index 6d72448c8762..9ef679db86de 100644 --- a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx +++ b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ /***************************************************************************** @@ -80,9 +80,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } if (argc == 3) { - sConnectionString = OUString::createFromAscii(argv[2]); + sConnectionString = OUString::createFromAscii(argv[2]); } - + // Creates a simple registry service instance. Reference< XSimpleRegistry > xSimpleRegistry( ::cppu::createSimpleRegistry() ); @@ -101,7 +101,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) */ Reference< XComponentContext > xComponentContext( ::cppu::bootstrap_InitialComponentContext( xSimpleRegistry ) ); - + /* Gets the service manager instance to be used (or null). This method has been added for convenience, because the service manager is a often used object. @@ -113,7 +113,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) by the factory. */ Reference< XInterface > xInterface = - xMultiComponentFactoryClient->createInstanceWithContext( + xMultiComponentFactoryClient->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.bridge.UnoUrlResolver" ), xComponentContext ); @@ -121,8 +121,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) // Resolves the component context from the office, on the uno URL given by argv[1]. try - { - xInterface = Reference< XInterface >( + { + xInterface = Reference< XInterface >( resolver->resolve( sConnectionString ), UNO_QUERY ); } catch ( Exception& e ) @@ -130,9 +130,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) printf("Error: cannot establish a connection using '%s':\n %s\n", OUStringToOString(sConnectionString, RTL_TEXTENCODING_ASCII_US).getStr(), OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr()); - exit(1); + exit(1); } - + // gets the server component context as property of the office component factory Reference< XPropertySet > xPropSet( xInterface, UNO_QUERY ); xPropSet->getPropertyValue( OUString::createFromAscii("DefaultContext") ) >>= xComponentContext; @@ -140,15 +140,15 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) // gets the service manager from the office Reference< XMultiComponentFactory > xMultiComponentFactoryServer( xComponentContext->getServiceManager() ); - + /* Creates an instance of a component which supports the services specified by the factory. Important: using the office component context. */ Reference < XComponentLoader > xComponentLoader( - xMultiComponentFactoryServer->createInstanceWithContext( + xMultiComponentFactoryServer->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ) ), xComponentContext ), UNO_QUERY ); - + /* Loads a component specified by an URL into the specified new or existing frame. */ @@ -156,7 +156,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) osl_getProcessWorkingDir(&sWorkingDir.pData); osl::FileBase::getFileURLFromSystemPath( OUString::createFromAscii(argv[1]), sDocPathUrl); osl::FileBase::getAbsoluteFileURL( sWorkingDir, sDocPathUrl, sAbsoluteDocUrl); - + Reference< XComponent > xComponent = xComponentLoader->loadComponentFromURL( sAbsoluteDocUrl, OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, Sequence < ::com::sun::star::beans::PropertyValue >() ); diff --git a/odk/examples/cpp/complextoolbarcontrols/CalcListener.cxx b/odk/examples/cpp/complextoolbarcontrols/CalcListener.cxx index 506e9c7b297e..fd344840d362 100644 --- a/odk/examples/cpp/complextoolbarcontrols/CalcListener.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/CalcListener.cxx @@ -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 diff --git a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx index e0011e93d3e1..fa0a90560fc5 100644 --- a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx @@ -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 @@ -40,9 +40,9 @@ using com::sun::star::frame::FeatureStateEvent; static AllListeners aListeners; -void ListenerHelper::AddListener( - const Reference < XFrame >& xFrame, - const Reference < XStatusListener > xControl, +void ListenerHelper::AddListener( + const Reference < XFrame >& xFrame, + const Reference < XStatusListener > xControl, const ::rtl::OUString& aCommand ) { sal_uInt32 i=0; @@ -56,8 +56,8 @@ void ListenerHelper::AddListener( } void ListenerHelper::RemoveListener( - const Reference < XFrame >& xFrame, - const Reference < XStatusListener > xControl, + const Reference < XFrame >& xFrame, + const Reference < XStatusListener > xControl, const ::rtl::OUString& aCommand ) { sal_uInt32 nSize = aListeners.size(); @@ -73,7 +73,7 @@ void ListenerHelper::RemoveListener( { aL.erase( aIter ); break; - } + } aIter++; } @@ -81,8 +81,8 @@ void ListenerHelper::RemoveListener( } } -void ListenerHelper::Notify( - const Reference < XFrame >& xFrame, +void ListenerHelper::Notify( + const Reference < XFrame >& xFrame, const ::rtl::OUString& aCommand, FeatureStateEvent& rEvent ) { @@ -103,8 +103,8 @@ void ListenerHelper::Notify( } } -com::sun::star::uno::Reference < XDispatch > ListenerHelper::GetDispatch( - const Reference < XFrame >& xFrame, +com::sun::star::uno::Reference < XDispatch > ListenerHelper::GetDispatch( + const Reference < XFrame >& xFrame, const ::rtl::OUString& aCommand ) { sal_uInt32 nSize = aListeners.size(); @@ -117,15 +117,15 @@ com::sun::star::uno::Reference < XDispatch > ListenerHelper::GetDispatch( return Reference < XDispatch >(); } -void ListenerHelper::AddDispatch( +void ListenerHelper::AddDispatch( const Reference < XDispatch > xDispatch, - const Reference < XFrame >& xFrame, + const Reference < XFrame >& xFrame, const ::rtl::OUString& aCommand ) { - ListenerItem aItem; + ListenerItem aItem; aItem.xFrame = xFrame; aItem.xDispatch = xDispatch; - aListeners.push_back( aItem ); + aListeners.push_back( aItem ); xFrame->addEventListener( new ListenerItemEventListener( xFrame ) ); } @@ -138,7 +138,7 @@ void SAL_CALL ListenerItemEventListener::disposing( const EventObject& aEvent) t { aListeners.erase( aIter ); break; - } + } aIter++; } diff --git a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h index 8aa8621ac841..e4255ecf8528 100644 --- a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h +++ b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h @@ -41,7 +41,7 @@ ListenerMap; // these arrays are accessed by a hash_map (with the command string as index) struct ListenerItem { - ListenerMap aContainer; + ListenerMap aContainer; ::com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > xDispatch; ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame; }; diff --git a/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx b/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx index c87f14195929..0f061b39cf9f 100644 --- a/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx @@ -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 diff --git a/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx b/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx index a780efcfba23..0c4f6a16b80d 100644 --- a/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx @@ -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 diff --git a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx index d0fd2b200898..dd58c3a74f4e 100644 --- a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx @@ -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 @@ -107,11 +107,11 @@ void BaseDispatch::ShowMessageBox( const Reference< XFrame >& rFrame, const ::rt void BaseDispatch::SendCommand( const com::sun::star::util::URL& aURL, const ::rtl::OUString& rCommand, const Sequence< NamedValue >& rArgs, sal_Bool bEnabled ) { - Reference < XDispatch > xDispatch = + Reference < XDispatch > xDispatch = aListenerHelper.GetDispatch( mxFrame, aURL.Path ); - + FeatureStateEvent aEvent; - + aEvent.FeatureURL = aURL; aEvent.Source = xDispatch; aEvent.IsEnabled = bEnabled; @@ -120,15 +120,15 @@ void BaseDispatch::SendCommand( const com::sun::star::util::URL& aURL, const ::r ControlCommand aCtrlCmd; aCtrlCmd.Command = rCommand; aCtrlCmd.Arguments = rArgs; - + aEvent.State <<= aCtrlCmd; - aListenerHelper.Notify( mxFrame, aEvent.FeatureURL.Path, aEvent ); + aListenerHelper.Notify( mxFrame, aEvent.FeatureURL.Path, aEvent ); } void BaseDispatch::SendCommandTo( const Reference< XStatusListener >& xControl, const URL& aURL, const ::rtl::OUString& rCommand, const Sequence< NamedValue >& rArgs, sal_Bool bEnabled ) { FeatureStateEvent aEvent; - + aEvent.FeatureURL = aURL; aEvent.Source = (::com::sun::star::frame::XDispatch*) this; aEvent.IsEnabled = bEnabled; @@ -137,7 +137,7 @@ void BaseDispatch::SendCommandTo( const Reference< XStatusListener >& xControl, ControlCommand aCtrlCmd; aCtrlCmd.Command = rCommand; aCtrlCmd.Arguments = rArgs; - + aEvent.State <<= aCtrlCmd; xControl->statusChanged( aEvent ); } @@ -154,7 +154,7 @@ void SAL_CALL MyProtocolHandler::initialize( const Sequence< Any >& aArguments ) } } -Reference< XDispatch > SAL_CALL MyProtocolHandler::queryDispatch( const URL& aURL, const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags ) +Reference< XDispatch > SAL_CALL MyProtocolHandler::queryDispatch( const URL& aURL, const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags ) throw( RuntimeException ) { Reference < XDispatch > xRet; @@ -273,16 +273,16 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property Reference< XSystemShellExecute > xSystemShellExecute( mxMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), UNO_QUERY ); if ( xSystemShellExecute.is() ) - { + { try - + { xSystemShellExecute->execute( sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); - } + } catch( Exception& rEx ) { (void)rEx; - } + } } } else if ( !aURL.Path.compareToAscii("Command2" ) ) @@ -319,7 +319,7 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property aCmdURL.Path = rtl::OUString::createFromAscii( "Command2" ); aCmdURL.Protocol = rtl::OUString::createFromAscii( "vnd.demo.complextoolbarcontrols.demoaddon:" ); aCmdURL.Complete = aCmdURL.Path + aCmdURL.Protocol; - + // set the selected item as text into the combobox Sequence< NamedValue > aArgs( 1 ); aArgs[0].Name = rtl::OUString::createFromAscii( "Text" ); @@ -338,9 +338,9 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property break; } } - + // just enable this command - + // set enable flag according to selection if ( aText.equalsAscii( "Button Disabled" )) mbButtonEnabled = sal_False; @@ -352,7 +352,7 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property aCmdURL.Path = rtl::OUString::createFromAscii( "Command1" ); aCmdURL.Protocol = rtl::OUString::createFromAscii( "vnd.demo.complextoolbarcontrols.demoaddon:" ); aCmdURL.Complete = aCmdURL.Path + aCmdURL.Protocol; - + // create and initialize FeatureStateEvent with IsEnabled ::com::sun::star::frame::FeatureStateEvent aEvent; aEvent.FeatureURL = aCmdURL; @@ -360,10 +360,10 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property aEvent.IsEnabled = mbButtonEnabled; aEvent.Requery = sal_False; aEvent.State <<= Any(); - + // Notify listener about new state Reference < XDispatch > xDispatch = aListenerHelper.GetDispatch( mxFrame, aURL.Path ); - aListenerHelper.Notify( mxFrame, aEvent.FeatureURL.Path, aEvent ); + aListenerHelper.Notify( mxFrame, aEvent.FeatureURL.Path, aEvent ); } else if ( !aURL.Path.compareToAscii("Command5" ) ) { @@ -403,20 +403,20 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener // where the user can select the last issued command easily. // E.g. a typical command group would be "Insert shape" Sequence< NamedValue > aArgs( 1 ); - + // send command to set context menu content Sequence< rtl::OUString > aContextMenu( 3 ); aContextMenu[0] = rtl::OUString::createFromAscii( "Command 1" ); aContextMenu[1] = rtl::OUString::createFromAscii( "Command 2" ); aContextMenu[2] = rtl::OUString::createFromAscii( "Command 3" ); - + aArgs[0].Name = rtl::OUString::createFromAscii( "List" ); aArgs[0].Value <<= aContextMenu; SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True ); - + // send command to check item on pos=0 aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pos" )); - aArgs[0].Value <<= sal_Int32( 0 ); + aArgs[0].Value <<= sal_Int32( 0 ); SendCommandTo( xControl, aURL, ::rtl::OUString::createFromAscii( "CheckItemPos" ), aArgs, sal_True ); } else if ( aURL.Path.equalsAscii("Command4" ) ) @@ -425,19 +425,19 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener // the user can only select one. The modes cannot be combined. // E.g. a typical group would be left,right,center,block. Sequence< NamedValue > aArgs( 1 ); - + // send command to set context menu content Sequence< rtl::OUString > aContextMenu( 2 ); aContextMenu[0] = rtl::OUString::createFromAscii( "Button Enabled" ); aContextMenu[1] = rtl::OUString::createFromAscii( "Button Disabled" ); - + aArgs[0].Name = rtl::OUString::createFromAscii( "List" ); aArgs[0].Value <<= aContextMenu; - SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True ); + SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True ); // set position according to enable/disable state of button sal_Int32 nPos( mbButtonEnabled ? 0 : 1 ); - + // send command to check item on pos=0 aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pos" )); aArgs[0].Value <<= nPos; @@ -447,7 +447,7 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener { // A spin button Sequence< NamedValue > aArgs( 5 ); - + // send command to initialize spin button aArgs[0].Name = rtl::OUString::createFromAscii( "Value" ); aArgs[0].Value <<= double( 0.0 ); @@ -467,7 +467,7 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener // A dropdown box is normally used for a group of commands // where the user can select one of a defined set. Sequence< NamedValue > aArgs( 1 ); - + // send command to set context menu content Sequence< rtl::OUString > aList( 10 ); aList[0] = rtl::OUString::createFromAscii( "White" ); @@ -480,7 +480,7 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener aList[7] = rtl::OUString::createFromAscii( "Orange" ); aList[8] = rtl::OUString::createFromAscii( "Brown" ); aList[9] = rtl::OUString::createFromAscii( "Pink" ); - + aArgs[0].Name = rtl::OUString::createFromAscii( "List" ); aArgs[0].Value <<= aList; SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True ); @@ -515,14 +515,14 @@ void SAL_CALL BaseDispatch::controlEvent( const ControlEvent& Event ) throw (Run break; } } - + if ( bHasText ) maComboBoxText = aNewText; } } } } - + BaseDispatch::BaseDispatch( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const ::rtl::OUString& rServiceName ) : mxMSF( rxMSF ) diff --git a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h index 747514272fed..3ffae431c0af 100644 --- a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h +++ b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h @@ -49,7 +49,7 @@ public: // XDispatchProvider virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > - SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, + SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ); virtual ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > @@ -115,10 +115,10 @@ public: const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException); - + // XControlNotificationListener - virtual void SAL_CALL controlEvent( const ::com::sun::star::frame::ControlEvent& Event ) - throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL controlEvent( const ::com::sun::star::frame::ControlEvent& Event ) + throw (::com::sun::star::uno::RuntimeException); }; class WriterDispatch : public BaseDispatch diff --git a/odk/examples/cpp/complextoolbarcontrols/WriterListener.cxx b/odk/examples/cpp/complextoolbarcontrols/WriterListener.cxx index a45e217248d6..2d41f12d8899 100644 --- a/odk/examples/cpp/complextoolbarcontrols/WriterListener.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/WriterListener.cxx @@ -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 diff --git a/odk/examples/cpp/complextoolbarcontrols/exports.cxx b/odk/examples/cpp/complextoolbarcontrols/exports.cxx index 1a850cfd7458..b4e49b5bda66 100644 --- a/odk/examples/cpp/complextoolbarcontrols/exports.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/exports.cxx @@ -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 diff --git a/odk/examples/cpp/counter/XCountable.idl b/odk/examples/cpp/counter/XCountable.idl index 290a134b2c0a..2df69c914b0d 100644 --- a/odk/examples/cpp/counter/XCountable.idl +++ b/odk/examples/cpp/counter/XCountable.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <com/sun/star/uno/XInterface.idl> @@ -46,7 +46,7 @@ module foo long increment(); long decrement(); }; - + service Counter { // exported interfaces: diff --git a/odk/examples/cpp/counter/counter.cxx b/odk/examples/cpp/counter/counter.cxx index e2c714de5398..8e5c341ca4cf 100644 --- a/odk/examples/cpp/counter/counter.cxx +++ b/odk/examples/cpp/counter/counter.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,14 +30,14 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ /************************************************************************* ************************************************************************* * - * service implementation: foo.Counter - * exported interfaces: foo.XCounter + * service implementation: foo.Counter + * exported interfaces: foo.XCounter * * simple example component implementing a counter * @@ -56,7 +56,7 @@ #include <foo/XCountable.hpp> #define SERVICENAME "foo.Counter" -#define IMPLNAME "com.sun.star.comp.example.cpp.Counter" +#define IMPLNAME "com.sun.star.comp.example.cpp.Counter" using namespace ::rtl; using namespace ::osl; @@ -74,10 +74,10 @@ class MyCounterImpl { // to obtain other services if needed Reference< XMultiServiceFactory > m_xServiceManager; - + sal_Int32 m_nRefCount; sal_Int32 m_nCount; - + public: MyCounterImpl( const Reference< XMultiServiceFactory > & xServiceManager ) : m_xServiceManager( xServiceManager ), m_nRefCount( 0 ) @@ -91,12 +91,12 @@ public: virtual void SAL_CALL release() throw () { if (! --m_nRefCount) delete this; } virtual Any SAL_CALL queryInterface( const Type & rType ) throw (RuntimeException) - { return cppu::queryInterface(rType, + { return cppu::queryInterface(rType, static_cast< XInterface* >( static_cast< XServiceInfo* >( this ) ), static_cast< XCountable* >( this ), static_cast< XServiceInfo* >( this ) ); } - // XServiceInfo implementation + // XServiceInfo implementation virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException); virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException); @@ -114,14 +114,14 @@ public: }; //************************************************************************* -OUString SAL_CALL MyCounterImpl::getImplementationName( ) +OUString SAL_CALL MyCounterImpl::getImplementationName( ) throw(RuntimeException) { return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ); -} +} //************************************************************************* -sal_Bool SAL_CALL MyCounterImpl::supportsService( const OUString& ServiceName ) +sal_Bool SAL_CALL MyCounterImpl::supportsService( const OUString& ServiceName ) throw(RuntimeException) { Sequence< OUString > aSNL = getSupportedServiceNames(); @@ -130,21 +130,21 @@ sal_Bool SAL_CALL MyCounterImpl::supportsService( const OUString& ServiceName ) if( pArray[i] == ServiceName ) return sal_True; return sal_False; -} +} //************************************************************************* -Sequence<OUString> SAL_CALL MyCounterImpl::getSupportedServiceNames( ) +Sequence<OUString> SAL_CALL MyCounterImpl::getSupportedServiceNames( ) throw(RuntimeException) { return getSupportedServiceNames_Static(); -} +} //************************************************************************* -Sequence<OUString> SAL_CALL MyCounterImpl::getSupportedServiceNames_Static( ) +Sequence<OUString> SAL_CALL MyCounterImpl::getSupportedServiceNames_Static( ) { OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) ); return Sequence< OUString >( &aName, 1 ); -} +} @@ -191,13 +191,13 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * Reference< XRegistryKey > xNewKey( reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) ); - + const Sequence< OUString > & rSNL = MyCounterImpl::getSupportedServiceNames_Static(); const OUString * pArray = rSNL.getConstArray(); for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) xNewKey->createKey( pArray[nPos] ); - + return sal_True; } catch (InvalidRegistryException &) @@ -214,12 +214,12 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * * @param pImplName name of implementation * @param pServiceManager a service manager, need for component creation * @param pRegistryKey the registry key for this component, need for persistent data - * @return a component factory + * @return a component factory */ extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey) { void * pRet = 0; - + if (rtl_str_compare( pImplName, IMPLNAME ) == 0) { Reference< XSingleServiceFactory > xFactory( createSingleFactory( @@ -227,14 +227,14 @@ extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ), MyCounterImpl_create, MyCounterImpl::getSupportedServiceNames_Static() ) ); - + if (xFactory.is()) { xFactory->acquire(); pRet = xFactory.get(); } } - + return pRet; } diff --git a/odk/examples/cpp/counter/countermain.cxx b/odk/examples/cpp/counter/countermain.cxx index 9473ff01d1ae..99fcb7e0321c 100644 --- a/odk/examples/cpp/counter/countermain.cxx +++ b/odk/examples/cpp/counter/countermain.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ /************************************************************************* @@ -69,7 +69,7 @@ using namespace ::rtl; //======================================================================= SAL_IMPLEMENT_MAIN() { - Reference< XSimpleRegistry > xReg = createSimpleRegistry(); + Reference< XSimpleRegistry > xReg = createSimpleRegistry(); OSL_ENSURE( xReg.is(), "### cannot get service instance of \"com.sun.star.regiystry.SimpleRegistry\"!" ); xReg->open(OUString::createFromAscii("counter.uno.rdb"), sal_False, sal_False); @@ -92,17 +92,17 @@ SAL_IMPLEMENT_MAIN() OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), // loader for component #ifdef UNX #ifdef MACOSX - OUString::createFromAscii("counter.uno.dylib"), // component location + OUString::createFromAscii("counter.uno.dylib"), // component location #else - OUString::createFromAscii("counter.uno.so"), // component location + OUString::createFromAscii("counter.uno.so"), // component location #endif #else - OUString::createFromAscii("counter.uno.dll"), // component location + OUString::createFromAscii("counter.uno.dll"), // component location #endif - Reference< XSimpleRegistry >() // registry omitted, + Reference< XSimpleRegistry >() // registry omitted, // defaulting to service manager registry used ); - + // get a counter instance Reference< XInterface > xx ; xx = xMgr->createInstanceWithContext(OUString::createFromAscii("foo.Counter"), xContext); diff --git a/odk/examples/cpp/remoteclient/remoteclient.cxx b/odk/examples/cpp/remoteclient/remoteclient.cxx index 47d83d1558f4..960f84ed04ab 100644 --- a/odk/examples/cpp/remoteclient/remoteclient.cxx +++ b/odk/examples/cpp/remoteclient/remoteclient.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -78,7 +78,7 @@ public: // Methods virtual sal_Int32 SAL_CALL run( const Sequence< OUString >& aArguments ) throw(RuntimeException); - + private: // helper methods void testPipe( const Reference < XInterface > & rComponent ); Reference< XMultiServiceFactory > m_xSMgr; @@ -107,8 +107,8 @@ void PipeClientMain::testPipe( const Reference< XInterface > & rxInterface ) printf( "error : Couldn't read the expected number of bytes\n" ); return; } - - if( seqRead.getConstArray()[0] != 5 || + + if( seqRead.getConstArray()[0] != 5 || seqRead.getConstArray()[1] != 4 || seqRead.getConstArray()[2] != 3 ) { @@ -191,7 +191,7 @@ sal_Int32 PipeClientMain::run( const Sequence< OUString > & aArguments ) throw ( } else { - printf( "usage: (uno remoteclient-component --) uno-url\n" + printf( "usage: (uno remoteclient-component --) uno-url\n" "e.g.: uno:socket,host=localhost,port=2083;urp;MyPipe\n" ); return 1; } @@ -244,12 +244,12 @@ sal_Bool SAL_CALL component_writeInfo( Reference< XRegistryKey > xNewKey( reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); - + const Sequence< OUString > & rSNL = getSupportedServiceNames(); const OUString * pArray = rSNL.getConstArray(); for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) xNewKey->createKey( pArray[nPos] ); - + return sal_True; } catch (InvalidRegistryException &) @@ -264,21 +264,21 @@ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { void * pRet = 0; - + if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0) { Reference< XSingleServiceFactory > xFactory( createSingleFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), CreateInstance, getSupportedServiceNames() ) ); - + if (xFactory.is()) { xFactory->acquire(); pRet = xFactory.get(); } } - + return pRet; } } |