diff options
Diffstat (limited to 'odk/examples/cpp/complextoolbarcontrols')
9 files changed, 58 insertions, 58 deletions
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 |