incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1190390 - in /incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols: Addons.xcu ListenerHelper.h Makefile MyJob.cxx MyJob.h MyListener.cxx MyListener.h MyProtocolHandler.cxx MyProtocolHandler.h exports.cxx
Date Fri, 28 Oct 2011 15:15:01 GMT
Author: pfg
Date: Fri Oct 28 15:15:00 2011
New Revision: 1190390

URL: http://svn.apache.org/viewvc?rev=1190390&view=rev
Log:
i104788 - Complex Toolbar Controls Extension from the SDK

Modified:
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Addons.xcu
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Makefile
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.h
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.h
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h
    incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/exports.cxx

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Addons.xcu
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Addons.xcu?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Addons.xcu (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Addons.xcu Fri Oct 28 15:15:00 2011
@@ -5,7 +5,7 @@
 			<node oor:name="com.sun.star.comp.framework.addon.complextoolbarcontrols" oor:op="replace">
 				<node oor:name="m1" oor:op="replace">
 					<prop oor:name="URL" oor:type="xs:string">
-						<value>vnd.demo.complextoolbarcontrols.demoaddon:Command1</value>
+						<value>vnd.demo.complextoolbarcontrols.demoaddon:ImageButtonCmd</value>
 					</prop>
 					<prop oor:name="Title" oor:type="xs:string">
 						<value xml:lang="en-US">Image Button</value>
@@ -22,7 +22,7 @@
 				</node>
 				<node oor:name="m2" oor:op="replace">
 					<prop oor:name="URL" oor:type="xs:string">
-                        <value>vnd.demo.complextoolbarcontrols.demoaddon:Command2</value>
+                        <value>vnd.demo.complextoolbarcontrols.demoaddon:ComboboxCmd</value>
 					</prop>
 					<prop oor:name="Title" oor:type="xs:string">
 						<value xml:lang="en-US">ComboBox</value>
@@ -47,7 +47,7 @@
 				</node>
 				<node oor:name="m4" oor:op="replace">
 					<prop oor:name="URL" oor:type="xs:string">
-                        <value>vnd.demo.complextoolbarcontrols.demoaddon:Command5</value>
+                        <value>vnd.demo.complextoolbarcontrols.demoaddon:SpinfieldCmd</value>
 					</prop>
 					<prop oor:name="Title" oor:type="xs:string">
 						<value xml:lang="en-US">Spinfield</value>
@@ -72,7 +72,7 @@
 				</node>
 				<node oor:name="m6" oor:op="replace">
 					<prop oor:name="URL" oor:type="xs:string">
-                        <value>vnd.demo.complextoolbarcontrols.demoaddon:Command6</value>
+                        <value>vnd.demo.complextoolbarcontrols.demoaddon:EditfieldCmd</value>
 					</prop>
 					<prop oor:name="Title" oor:type="xs:string">
 						<value xml:lang="en-US">Editfield</value>
@@ -97,7 +97,7 @@
 				</node>
 				<node oor:name="m8" oor:op="replace">
 					<prop oor:name="URL" oor:type="xs:string">
-                        <value>vnd.demo.complextoolbarcontrols.demoaddon:Command7</value>
+                        <value>vnd.demo.complextoolbarcontrols.demoaddon:DropdownboxCmd</value>
 					</prop>
 					<prop oor:name="Title" oor:type="xs:string">
 						<value xml:lang="en-US">Dropdownbox</value>
@@ -117,7 +117,7 @@
 				</node>
 				<node oor:name="m9" oor:op="replace">
 					<prop oor:name="URL" oor:type="xs:string">
-                        <value>vnd.demo.complextoolbarcontrols.demoaddon:Command3</value>
+                        <value>vnd.demo.complextoolbarcontrols.demoaddon:ToggleDropdownButtonCmd</value>
 					</prop>
 					<prop oor:name="Title" oor:type="xs:string">
 						<value xml:lang="en-US">Toggle Dropdown Button</value>
@@ -134,7 +134,7 @@
 				</node>
 				<node oor:name="m10" oor:op="replace">
 					<prop oor:name="URL" oor:type="xs:string">
-                        <value>vnd.demo.complextoolbarcontrols.demoaddon:Command4</value>
+                        <value>vnd.demo.complextoolbarcontrols.demoaddon:DropdownButtonCmd</value>
 					</prop>
 					<prop oor:name="Title" oor:type="xs:string">
 						<value xml:lang="en-US">Dropdown Button</value>
@@ -154,7 +154,7 @@
 		<node oor:name="Images">
             <node oor:name="vnd.demo.complextoolbarcontrols.image1" oor:op="replace">
 				<prop oor:name="URL">
-                    <value>vnd.demo.complextoolbarcontrols.demoaddon:Command1</value>
+                    <value>vnd.demo.complextoolbarcontrols.demoaddon:ImageButtonCmd</value>
 				</prop>
 				<node oor:name="UserDefinedImages">
 					<prop oor:name="ImageSmallURL" oor:type="xs:string">

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h Fri Oct 28 15:15:00 2011
@@ -1,39 +1,20 @@
 #include <vector>
 #include <hash_map>
+
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/frame/XStatusListener.hpp>
-#include <com/sun/star/frame/FeatureStateEvent.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
 
 #include <rtl/ustring.hxx>
 #include <cppuhelper/implbase1.hxx>
 
-struct hashObjectName_Impl
-{
-	size_t operator()(const ::rtl::OUString Str) const
-	{
-		return (size_t)Str.hashCode();
-	}
-};
-
-struct eqObjectName_Impl
-{
-	sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const
-	{
-		return ( Str1 == Str2 );
-	}
-};
 
 typedef std::vector < com::sun::star::uno::Reference < com::sun::star::frame::XStatusListener > > StatusListeners;
 
-typedef std::hash_map
-<
-	::rtl::OUString,
-	StatusListeners,
-	hashObjectName_Impl,
-	eqObjectName_Impl
->
-ListenerMap;
+typedef std::hash_map < rtl::OUString,
+                        StatusListeners,
+                        rtl::OUStringHash,
+                        std::equal_to< rtl::OUString > > ListenerMap;
 
 // For every frame there is *one* Dispatch object for all possible commands
 // this struct contains an array of listeners for every supported command

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Makefile
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Makefile?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Makefile (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/Makefile Fri Oct 28 15:15:00 2011
@@ -66,6 +66,10 @@ CXXFILES = \
 
 SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
 
+# Add OSL_DEBUG_LEVEL to compiler the flags (for OSL_TRACE et. al.)
+ifeq "$(DEBUG)" "yes"
+CC_FLAGS += -DOSL_DEBUG_LEVEL=2
+endif
 
 # Targets
 .PHONY: ALL

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx Fri Oct 28 15:15:00 2011
@@ -25,11 +25,8 @@
  *
  ************************************************************************/
 
-
-#ifndef _MyJob_HXX
 #include "MyJob.h"
-#endif
-#include <osl/diagnose.h>
+
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/document/XEventBroadcaster.hpp>
@@ -50,9 +47,10 @@ using com::sun::star::document::XEventBr
 Any SAL_CALL MyJob::execute( const Sequence< NamedValue >& aArguments )
 	throw ( IllegalArgumentException, Exception, RuntimeException )
 {
-	Reference < XEventBroadcaster > xBrd( mxMSF->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster") ), UNO_QUERY );
+	Reference < XEventBroadcaster > xBrd( mxMSF->createInstance(
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.GlobalEventBroadcaster" ) ) ), UNO_QUERY );
 	Reference < com::sun::star::document::XEventListener > xLstner( mxMSF->createInstance(
-		::rtl::OUString::createFromAscii("com.sun.star.comp.Office.MyListener" ) ), UNO_QUERY );
+		::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Office.MyListener" ) ) ), UNO_QUERY );
 	if ( xBrd.is() )
 		xBrd->addEventListener( xLstner );
 	return Any();
@@ -61,7 +59,7 @@ Any SAL_CALL MyJob::execute( const Seque
 OUString MyJob_getImplementationName ()
 	throw (RuntimeException)
 {
-	return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Office.MyJob" ) );
+	return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Office.MyJob" ) );
 }
 
 #define SERVICE_NAME "com.sun.star.task.Job"
@@ -69,7 +67,7 @@ OUString MyJob_getImplementationName ()
 sal_Bool SAL_CALL MyJob_supportsService( const OUString& ServiceName )
 	throw (RuntimeException)
 {
-    return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+    return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SERVICE_NAME ) );
 }
 
 Sequence< OUString > SAL_CALL MyJob_getSupportedServiceNames(  )
@@ -77,7 +75,7 @@ Sequence< OUString > SAL_CALL MyJob_getS
 {
 	Sequence < OUString > aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+    pArray[0] =  OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) );
     return aRet;
 }
 

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.h?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.h (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyJob.h Fri Oct 28 15:15:00 2011
@@ -1,150 +1,77 @@
 #ifndef _MyJob_HXX
-
 #define _MyJob_HXX
 
-
-
-#ifndef _COM_SUN_STAR_TASK_XJOB_HPP_
-
 #include <com/sun/star/task/XJob.hpp>
-
-#endif
-
-#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
-
 #include <com/sun/star/lang/XServiceInfo.hpp>
-
-#endif
-
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
-
 #include <cppuhelper/implbase2.hxx>
 
-#endif
-
-
 
 namespace com
-
 {
-
 	namespace sun
-
 	{
-
 		namespace star
-
 		{
-
 			namespace frame
-
 			{
-
 				class XModel;
-
 				class XFrame;
-
 			}
-
-
-
 			namespace beans
-
 			{
-
 				struct NamedValue;
-
 			}
-
 		}
-
 	}
-
 }
 
 
-
 class MyJob : public cppu::WeakImplHelper2
-
 <
-
 	com::sun::star::task::XJob,
-
 	com::sun::star::lang::XServiceInfo
-
 >
-
 {
-
 private:
-
     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
 
-
-
 public:
-
 	MyJob( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
-
         : mxMSF( rxMSF ) {}
-
 	virtual ~MyJob() {}
 
 
-
 	// XJob
-
 	virtual ::com::sun::star::uno::Any SAL_CALL execute(
-
 		const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments )
-
 		throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
 
 
-
 	// XServiceInfo
-
     virtual ::rtl::OUString SAL_CALL getImplementationName(  )
-
 		throw (::com::sun::star::uno::RuntimeException);
 
     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
-
 		throw (::com::sun::star::uno::RuntimeException);
 
     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
-
 		throw (::com::sun::star::uno::RuntimeException);
 
 };
 
 
-
 ::rtl::OUString MyJob_getImplementationName()
-
 	throw ( ::com::sun::star::uno::RuntimeException );
 
-
-
 sal_Bool SAL_CALL MyJob_supportsService( const ::rtl::OUString& ServiceName )
-
 	throw ( ::com::sun::star::uno::RuntimeException );
 
-
-
 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL MyJob_getSupportedServiceNames(  )
-
 	throw ( ::com::sun::star::uno::RuntimeException );
 
-
-
 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-
 SAL_CALL MyJob_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
-
 	throw ( ::com::sun::star::uno::Exception );
 
 
-
 #endif
-

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx Fri Oct 28 15:15:00 2011
@@ -34,22 +34,15 @@
 
 namespace css = ::com::sun::star;
 
-/*-----------------------------------------------------
-	20.11.2003 11:31
------------------------------------------------------*/
+
 MyListener::MyListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
 	: m_xSMGR(xSMGR)
 {}
 
-/*-----------------------------------------------------
-	20.11.2003 11:32
------------------------------------------------------*/
 MyListener::~MyListener()
 {}
 
-/*-----------------------------------------------------
-    20.11.2003 12:04
------------------------------------------------------*/
+
 css::uno::Any SAL_CALL MyListener::execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
 	throw (css::lang::IllegalArgumentException,
 		   css::uno::Exception,
@@ -57,12 +50,12 @@ css::uno::Any SAL_CALL MyListener::execu
 {
     css::uno::Sequence< css::beans::NamedValue > lEnv;
 
-          sal_Int32               i = 0;
-          sal_Int32               c = lArguments.getLength();
+    sal_Int32                     i = 0;
+    sal_Int32                     c = lArguments.getLength();
     const css::beans::NamedValue* p = lArguments.getConstArray();
     for (i=0; i<c; ++i)
 	{
-        if (p[i].Name.equalsAscii("Environment"))
+        if (p[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Environment" ) ) )
         {
             p[i].Value >>= lEnv;
             break;
@@ -75,12 +68,12 @@ css::uno::Any SAL_CALL MyListener::execu
     p = lEnv.getConstArray();
     for (i=0; i<c; ++i)
     {
-        if (p[i].Name.equalsAscii("Model"))
+        if (p[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Model" ) ) )
         {
             p[i].Value >>= xModel;
             break;
         }
-        if (p[i].Name.equalsAscii("Frame"))
+        if (p[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Frame" ) ) )
         {
 			css::uno::Reference< css::frame::XController > xController;
 			css::uno::Reference< css::frame::XFrame >      xFrame;
@@ -97,11 +90,12 @@ css::uno::Any SAL_CALL MyListener::execu
 		return css::uno::Any();
 
     css::uno::Reference< css::lang::XServiceInfo > xInfo(xModel, css::uno::UNO_QUERY);
-    sal_Bool bCalc   = xInfo->supportsService(::rtl::OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument"));
+    sal_Bool bCalc   = xInfo->supportsService(
+        rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) );
     sal_Bool bWriter = (
-                         xInfo->supportsService(::rtl::OUString::createFromAscii("com.sun.star.text.TextDocument"  )) &&
-                        !xInfo->supportsService(::rtl::OUString::createFromAscii("com.sun.star.text.WebDocument"   )) &&
-                        !xInfo->supportsService(::rtl::OUString::createFromAscii("com.sun.star.text.GlobalDocument"))
+                         xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) &&
+                        !xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) &&
+                        !xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.GlobalDocument" ) ) )
                        );
 
     // Wir interessieren uns nur für Writer und Calc. Werden hier aber für
@@ -124,41 +118,33 @@ css::uno::Any SAL_CALL MyListener::execu
 	return css::uno::Any();
 }
 
-/*-----------------------------------------------------
-    20.11.2003 12:13
------------------------------------------------------*/
+
 ::rtl::OUString SAL_CALL MyListener::getImplementationName()
     throw (css::uno::RuntimeException)
 {
-    return ::rtl::OUString::createFromAscii(MYLISTENER_IMPLEMENTATIONNAME);
+    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MYLISTENER_IMPLEMENTATIONNAME ) );
 }
 
-/*-----------------------------------------------------
-    20.11.2003 12:13
------------------------------------------------------*/
+
 css::uno::Sequence< ::rtl::OUString > SAL_CALL MyListener::getSupportedServiceNames()
     throw (css::uno::RuntimeException)
 {
     css::uno::Sequence< ::rtl::OUString > lNames(1);
-    lNames[0] = ::rtl::OUString::createFromAscii(MYLISTENER_SERVICENAME);
+    lNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MYLISTENER_SERVICENAME ) );
     return lNames;
 }
 
-/*-----------------------------------------------------
-    20.11.2003 12:14
------------------------------------------------------*/
+
 sal_Bool SAL_CALL MyListener::supportsService(const ::rtl::OUString& sServiceName)
     throw (css::uno::RuntimeException)
 {
     return (
-            sServiceName.equalsAscii(MYLISTENER_SERVICENAME) ||
-            sServiceName.equalsAscii("com.sun.star.task.Job"    )
+            sServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MYLISTENER_SERVICENAME )) ||
+            sServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.task.Job" ) )
            );
 }
 
-/*-----------------------------------------------------
-	20.11.2003 11:31
------------------------------------------------------*/
+
 css::uno::Reference< css::uno::XInterface > MyListener::st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
 {
 	MyListener* pListener = new MyListener(xSMGR);

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.h?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.h (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyListener.h Fri Oct 28 15:15:00 2011
@@ -1,7 +1,6 @@
 #ifndef _MyListener_HXX
 #define _MyListener_HXX
 
-#include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/task/XJob.hpp>
 #include <com/sun/star/document/XEventListener.hpp>
@@ -24,7 +23,7 @@ namespace css = ::com::sun::star;
  * @see WriterListener
  */
 class MyListener : public cppu::WeakImplHelper2< css::task::XJob         ,
-                                                      css::lang::XServiceInfo >
+                                                 css::lang::XServiceInfo >
 {
     private:
         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
@@ -59,7 +58,6 @@ class CalcListener : public cppu::WeakIm
     private:
         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
 
-
     public:
         CalcListener(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF)
             : mxMSF( rxMSF )

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx Fri Oct 28 15:15:00 2011
@@ -25,51 +25,29 @@
  *
  ************************************************************************/
 
-
 #include "ListenerHelper.h"
 #include "MyProtocolHandler.h"
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/frame/DispatchDescriptor.hpp>
+
+#include <com/sun/star/awt/MessageBoxButtons.hpp>
+#include <com/sun/star/awt/XMessageBoxFactory.hpp>
+#include <com/sun/star/frame/ControlCommand.hpp>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-#include <com/sun/star/text/XTextViewCursor.hpp>
-#include <com/sun/star/text/XTextCursor.hpp>
-#include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheetView.hpp>
-#include <com/sun/star/frame/ControlCommand.hpp>
-#include <com/sun/star/frame/ControlEvent.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XControlNotificationListener.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/awt/XWindowPeer.hpp>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/awt/XMessageBox.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/system/XSystemShellExecute.hpp>
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
 
-#include <osl/file.hxx>
 
-using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
 using namespace com::sun::star::frame;
-using com::sun::star::lang::XMultiServiceFactory;
+using namespace com::sun::star::system;
+using namespace com::sun::star::uno;
+
+using com::sun::star::beans::NamedValue;
 using com::sun::star::beans::PropertyValue;
-using com::sun::star::util::URL;
-using com::sun::star::text::XTextViewCursorSupplier;
-using com::sun::star::text::XTextViewCursor;
-using com::sun::star::text::XTextCursor;
+using com::sun::star::lang::XMultiServiceFactory;
 using com::sun::star::sheet::XSpreadsheetView;
-using com::sun::star::frame::XModel;
-using com::sun::star::text::XTextRange;
-using com::sun::star::text::XTextDocument;
-using com::sun::star::beans::NamedValue;
-using namespace com::sun::star::awt;
-using com::sun::star::view::XSelectionSupplier;
-using namespace com::sun::star::system;
+using com::sun::star::text::XTextViewCursorSupplier;
+using com::sun::star::util::URL;
 
 ListenerHelper aListenerHelper;
 
@@ -77,30 +55,21 @@ void BaseDispatch::ShowMessageBox( const
 {
 	if ( !mxToolkit.is() )
 		mxToolkit = Reference< XToolkit > ( mxMSF->createInstance(
-			::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-                                            "com.sun.star.awt.Toolkit" ))), UNO_QUERY );
-    if ( rFrame.is() && mxToolkit.is() )
+			::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ))), UNO_QUERY );
+
+    Reference< XMessageBoxFactory > xMsgBoxFactory( mxToolkit, UNO_QUERY );
+    if ( rFrame.is() && xMsgBoxFactory.is() )
     {
-        // describe window properties.
-        WindowDescriptor                aDescriptor;
-        aDescriptor.Type              = WindowClass_MODALTOP;
-        aDescriptor.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "infobox" ));
-        aDescriptor.ParentIndex       = -1;
-        aDescriptor.Parent            = Reference< XWindowPeer >( rFrame->getContainerWindow(), UNO_QUERY );
-        aDescriptor.Bounds            = Rectangle(0,0,300,200);
-        aDescriptor.WindowAttributes  = WindowAttribute::BORDER | WindowAttribute::MOVEABLE | WindowAttribute::CLOSEABLE;
+        Reference< XMessageBox > xMsgBox = xMsgBoxFactory->createMessageBox(
+            Reference< XWindowPeer >( rFrame->getContainerWindow(), UNO_QUERY ),
+            Rectangle(0,0,300,200),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "infobox" ) ),
+            MessageBoxButtons::BUTTONS_OK,
+            aTitle,
+            aMsgText );
 
-        Reference< XWindowPeer > xPeer = mxToolkit->createWindow( aDescriptor );
-        if ( xPeer.is() )
-        {
-            Reference< XMessageBox > xMsgBox( xPeer, UNO_QUERY );
-            if ( xMsgBox.is() )
-            {
-                xMsgBox->setCaptionText( aTitle );
-                xMsgBox->setMessageText( aMsgText );
-                xMsgBox->execute();
-            }
-        }
+        if ( xMsgBox.is() )
+            xMsgBox->execute();
     }
 }
 
@@ -161,7 +130,8 @@ Reference< XDispatch > SAL_CALL MyProtoc
 		return 0;
 
 	Reference < XController > xCtrl = mxFrame->getController();
-	if ( xCtrl.is() && !aURL.Protocol.compareToAscii("vnd.demo.complextoolbarcontrols.demoaddon:") )
+	if ( xCtrl.is() && !aURL.Protocol.compareToAscii( 
+        RTL_CONSTASCII_STRINGPARAM( "vnd.demo.complextoolbarcontrols.demoaddon:" ) ) )
 	{
 		Reference < XTextViewCursorSupplier > xCursor( xCtrl, UNO_QUERY );
 		Reference < XSpreadsheetView > xView( xCtrl, UNO_QUERY );
@@ -169,13 +139,13 @@ Reference< XDispatch > SAL_CALL MyProtoc
 			// ohne ein entsprechendes Dokument funktioniert der Handler nicht
 			return xRet;
 
-		if ( aURL.Path.equalsAscii("Command1" ) ||
-			 aURL.Path.equalsAscii("Command2" ) ||
-			 aURL.Path.equalsAscii("Command3" ) ||
-			 aURL.Path.equalsAscii("Command4" ) ||
-			 aURL.Path.equalsAscii("Command5" ) ||
-			 aURL.Path.equalsAscii("Command6" ) ||
-             aURL.Path.equalsAscii("Command7" ) )
+		if ( aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ImageButtonCmd" ) ) ||
+			 aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ComboboxCmd" ) ) ||
+			 aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ToggleDropdownButtonCmd" ) ) ||
+			 aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DropdownButtonCmd" ) ) ||
+			 aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SpinfieldCmd" ) ) ||
+			 aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EditfieldCmd" ) ) ||
+             aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DropdownboxCmd" ) ) )
 		{
 			xRet = aListenerHelper.GetDispatch( mxFrame, aURL.Path );
 			if ( !xRet.is() )
@@ -205,15 +175,15 @@ Sequence < Reference< XDispatch > > SAL_
 ::rtl::OUString MyProtocolHandler_getImplementationName ()
 	throw (RuntimeException)
 {
-    return ::rtl::OUString::createFromAscii(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME);
+    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MYPROTOCOLHANDLER_IMPLEMENTATIONNAME ) );
 }
 
 sal_Bool SAL_CALL MyProtocolHandler_supportsService( const ::rtl::OUString& ServiceName )
 	throw (RuntimeException)
 {
     return (
-            ServiceName.equalsAscii(MYPROTOCOLHANDLER_SERVICENAME  ) ||
-            ServiceName.equalsAscii("com.sun.star.frame.ProtocolHandler")
+            ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MYPROTOCOLHANDLER_SERVICENAME ) ) ||
+            ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.frame.ProtocolHandler" ) )
            );
 }
 
@@ -221,7 +191,7 @@ Sequence< ::rtl::OUString > SAL_CALL MyP
 	throw (RuntimeException)
 {
 	Sequence < ::rtl::OUString > aRet(1);
-    aRet[0] = ::rtl::OUString::createFromAscii(MYPROTOCOLHANDLER_SERVICENAME);
+    aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MYPROTOCOLHANDLER_SERVICENAME ) );
     return aRet;
 }
 
@@ -263,34 +233,33 @@ void SAL_CALL BaseDispatch::dispatch( co
 	 */
 	Reference< XInterface > xSelfHold(static_cast< XDispatch* >(this), UNO_QUERY);
 
-	if ( !aURL.Protocol.compareToAscii("vnd.demo.complextoolbarcontrols.demoaddon:") )
+	if ( !aURL.Protocol.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "vnd.demo.complextoolbarcontrols.demoaddon:" ) ) )
 	{
-		if ( !aURL.Path.compareToAscii("Command1" ) )
+		if ( !aURL.Path.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ImageButtonCmd" ) ) )
 		{
             // open the OpenOffice.org web page
-            ::rtl::OUString sURL(::rtl::OUString::createFromAscii("http://www.openoffice.org"));
+            ::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "http://www.openoffice.org" ) );
             Reference< XSystemShellExecute > xSystemShellExecute( mxMSF->createInstance(
-                ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), UNO_QUERY );
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "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" ) )
+		else if ( !aURL.Path.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ComboboxCmd" ) ) )
 		{
             // remove the text if it's in our list
             Sequence< NamedValue > aRemoveArgs( 1 );
             aRemoveArgs[0].Name  = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
             aRemoveArgs[0].Value <<= maComboBoxText;
-            SendCommand( aURL, ::rtl::OUString::createFromAscii( "RemoveEntryText" ), aRemoveArgs, sal_True );
+            SendCommand( aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RemoveEntryText" ) ), aRemoveArgs, sal_True );
 
             // add the new text to the start of the list
             Sequence< NamedValue > aInsertArgs( 2 );
@@ -298,15 +267,15 @@ void SAL_CALL BaseDispatch::dispatch( co
             aInsertArgs[0].Value <<= sal_Int32( 0 );
             aInsertArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
             aInsertArgs[1].Value <<= maComboBoxText;
-            SendCommand( aURL, ::rtl::OUString::createFromAscii( "InsertEntry" ), aInsertArgs, sal_True );
+            SendCommand( aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InsertEntry" ) ), aInsertArgs, sal_True );
         }
-		else if ( !aURL.Path.compareToAscii("Command3" ) )
+		else if ( !aURL.Path.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ToggleDropdownButtonCmd" ) ) )
 		{
             // Retrieve the text argument from the sequence property value
             rtl::OUString aText;
             for ( sal_Int32 i = 0; i < lArgs.getLength(); i++ )
             {
-                if ( lArgs[i].Name.equalsAsciiL( "Text", 4 ))
+                if ( lArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Text" ) ) )
                 {
                     lArgs[i].Value >>= aText;
                     break;
@@ -315,23 +284,23 @@ void SAL_CALL BaseDispatch::dispatch( co
 
             // create new URL to address the combox box
             URL aCmdURL;
-            aCmdURL.Path = rtl::OUString::createFromAscii( "Command2" );
-            aCmdURL.Protocol = rtl::OUString::createFromAscii( "vnd.demo.complextoolbarcontrols.demoaddon:" );
+            aCmdURL.Path = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ComboboxCmd" ) );
+            aCmdURL.Protocol = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "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" );
+            aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) );
             aArgs[0].Value <<= aText;
-            SendCommand( aCmdURL, ::rtl::OUString::createFromAscii( "SetText" ), aArgs, sal_True );
+            SendCommand( aCmdURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SetText" ) ), aArgs, sal_True );
 		}
-		else if ( !aURL.Path.compareToAscii("Command4" ) )
+		else if ( !aURL.Path.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "DropdownButtonCmd" ) ) )
 		{
             // Retrieve the text argument from the sequence property value
             rtl::OUString aText;
             for ( sal_Int32 i = 0; i < lArgs.getLength(); i++ )
             {
-                if ( lArgs[i].Name.equalsAsciiL( "Text", 4 ))
+                if ( lArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Text" ) ) )
                 {
                     lArgs[i].Value >>= aText;
                     break;
@@ -341,17 +310,17 @@ void SAL_CALL BaseDispatch::dispatch( co
             // just enable this command
 		    
             // set enable flag according to selection
-            if ( aText.equalsAscii( "Button Disabled" ))
+            if ( aText.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Button Disabled" ) ))
                 mbButtonEnabled = sal_False;
             else
                 mbButtonEnabled = sal_True;
 
             // create new URL to address the image button
             URL aCmdURL;
-            aCmdURL.Path = rtl::OUString::createFromAscii( "Command1" );
-            aCmdURL.Protocol = rtl::OUString::createFromAscii( "vnd.demo.complextoolbarcontrols.demoaddon:" );
+            aCmdURL.Path = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImageButtonCmd" ) );
+            aCmdURL.Protocol = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "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;
@@ -359,22 +328,37 @@ void SAL_CALL BaseDispatch::dispatch( co
 			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 ); 
         }
-        else if ( !aURL.Path.compareToAscii("Command5" ) )
+        else if ( !aURL.Path.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "SpinfieldCmd" ) ) )
         {
         }
+        else if ( !aURL.Path.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "DropdownboxCmd" ) ) )
+        {
+            // Retrieve the text argument from the sequence property value
+            rtl::OUString aText;
+            for ( sal_Int32 i = 0; i < lArgs.getLength(); i++ )
+            {
+                if ( lArgs[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Text" ) ) )
+                {
+                    lArgs[i].Value >>= aText;
+                    break;
+                }
+            }
+            OSL_TRACE( "Dropdownbox control - selected entry text : %s", 
+                       rtl::OUStringToOString( aText, RTL_TEXTENCODING_UTF8 ).getStr() );
+        }
 	}
 }
 
 void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener >& xControl, const URL& aURL ) throw (RuntimeException)
 {
-	if ( aURL.Protocol.equalsAscii("vnd.demo.complextoolbarcontrols.demoaddon:") )
+	if ( aURL.Protocol.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.demo.complextoolbarcontrols.demoaddon:" ) ) )
 	{
-		if ( aURL.Path.equalsAscii("Command1" ) )
+		if ( aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ImageButtonCmd" ) ) )
         {
 			// just enable this command
 		    ::com::sun::star::frame::FeatureStateEvent aEvent;
@@ -385,7 +369,7 @@ void SAL_CALL BaseDispatch::addStatusLis
 			aEvent.State <<= Any();
 			xControl->statusChanged( aEvent );
         }
-        else if ( aURL.Path.equalsAscii("Command2" ) )
+        else if ( aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ComboboxCmd" ) ) )
 		{
 			// just enable this command
 		    ::com::sun::star::frame::FeatureStateEvent aEvent;
@@ -396,93 +380,93 @@ void SAL_CALL BaseDispatch::addStatusLis
 			aEvent.State <<= Any();
 			xControl->statusChanged( aEvent );
 		}
-		else if ( aURL.Path.equalsAscii("Command3" ) )
+		else if ( aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ToggleDropdownButtonCmd" ) ) )
 		{
             // A toggle dropdown box is normally used for a group of commands
             // 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" );
+            aContextMenu[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Command 1" ) );
+            aContextMenu[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Command 2" ) );
+            aContextMenu[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Command 3" ) );
+
+            aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) );
             aArgs[0].Value <<= aContextMenu;
-            SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True );
-            
+            SendCommandTo( xControl, aURL, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "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 );            
-            SendCommandTo( xControl, aURL, ::rtl::OUString::createFromAscii( "CheckItemPos" ), aArgs, sal_True );
+            aArgs[0].Value <<= sal_Int32( 0 );
+            SendCommandTo( xControl, aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CheckItemPos" ) ), aArgs, sal_True );
         }
-        else if ( aURL.Path.equalsAscii("Command4" ) )
+        else if ( aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DropdownButtonCmd" ) ) )
         {
             // A dropdown box is normally used for a group of dependent modes, where
             // 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" );
+            aContextMenu[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Button Enabled" ) );
+            aContextMenu[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Button Disabled" ) );
+
+            aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) );
             aArgs[0].Value <<= aContextMenu;
-            SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True );            
+            SendCommandTo( xControl, aURL, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "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].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pos" ) );
             aArgs[0].Value <<= nPos;
-            SendCommandTo( xControl, aURL, ::rtl::OUString::createFromAscii( "CheckItemPos" ), aArgs, sal_True );
+            SendCommandTo( xControl, aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CheckItemPos" ) ), aArgs, sal_True );
         }
-        else if ( aURL.Path.equalsAscii("Command5" ) )
+        else if ( aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SpinfieldCmd" ) ) )
         {
             // A spin button
             Sequence< NamedValue > aArgs( 5 );
-            
+
             // send command to initialize spin button
-            aArgs[0].Name = rtl::OUString::createFromAscii( "Value" );
+            aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value" ) );
             aArgs[0].Value <<= double( 0.0 );
-            aArgs[1].Name = rtl::OUString::createFromAscii( "UpperLimit" );
+            aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UpperLimit" ) );
             aArgs[1].Value <<= double( 10.0 );
-            aArgs[2].Name = rtl::OUString::createFromAscii( "LowerLimit" );
+            aArgs[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LowerLimit" ) );
             aArgs[2].Value <<= double( 0.0 );
-            aArgs[3].Name = rtl::OUString::createFromAscii( "Step" );
+            aArgs[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
             aArgs[3].Value <<= double( 0.1 );
-            aArgs[4].Name = rtl::OUString::createFromAscii( "OutputFormat" );
-            aArgs[4].Value <<= rtl::OUString::createFromAscii( "%.2f cm" );
+            aArgs[4].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputFormat" ) );
+            aArgs[4].Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "%.2f cm" ) );
 
-            SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetValues" ), aArgs, sal_True );
+            SendCommandTo( xControl, aURL, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SetValues" ) ), aArgs, sal_True );
         }
-        else if ( aURL.Path.equalsAscii("Command7" ) )
+        else if ( aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DropdownboxCmd" ) ) )
         {
             // 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" );
-            aList[1] = rtl::OUString::createFromAscii( "Black" );
-            aList[2] = rtl::OUString::createFromAscii( "Red" );
-            aList[3] = rtl::OUString::createFromAscii( "Blue" );
-            aList[4] = rtl::OUString::createFromAscii( "Green" );
-            aList[5] = rtl::OUString::createFromAscii( "Grey" );
-            aList[6] = rtl::OUString::createFromAscii( "Yellow" );
-            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" );
+            aList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "White" ) );
+            aList[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) );
+            aList[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) );
+            aList[3] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) );
+            aList[4] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) );
+            aList[5] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Grey" ) );
+            aList[6] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) );
+            aList[7] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Orange" ) );
+            aList[8] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) );
+            aList[9] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pink" ) );
+
+            aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) );
             aArgs[0].Value <<= aList;
-            SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True );
+            SendCommandTo( xControl, aURL, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SetList" ) ), aArgs, sal_True );
         }
 
 		aListenerHelper.AddListener( mxFrame, xControl, aURL.Path );
@@ -496,34 +480,34 @@ void SAL_CALL BaseDispatch::removeStatus
 
 void SAL_CALL BaseDispatch::controlEvent( const ControlEvent& Event ) throw (RuntimeException)
 {
-    if ( Event.aURL.Protocol.equalsAscii("vnd.demo.complextoolbarcontrols.demoaddon:" ))
+    if ( Event.aURL.Protocol.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.demo.complextoolbarcontrols.demoaddon:" ) ) )
 	{
-        if ( Event.aURL.Path.equalsAscii( "Command2" ))
+        if ( Event.aURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ComboboxCmd" ) ) )
         {
             // We get notifications whenever the text inside the combobox has been changed.
             // We store the new text into a member.
-            if ( Event.Event.equalsAscii( "TextChanged" ))
+            if ( Event.Event.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TextChanged" ) ) )
             {
                 rtl::OUString aNewText;
                 sal_Bool      bHasText( sal_False );
                 for ( sal_Int32 i = 0; i < Event.aInformation.getLength(); i++ )
                 {
-                    if ( Event.aInformation[i].Name.equalsAsciiL( "Text", 4 ))
+                    if ( Event.aInformation[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Text" ) ) )
                     {
                         bHasText = Event.aInformation[i].Value >>= aNewText;
                         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 )
+
+BaseDispatch::BaseDispatch( const Reference< XMultiServiceFactory > &rxMSF,
+        const Reference< XFrame >& xFrame, const rtl::OUString& rServiceName )
         : mxMSF( rxMSF )
 		, mxFrame( xFrame )
         , msDocService( rServiceName )

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h Fri Oct 28 15:15:00 2011
@@ -1,16 +1,14 @@
 #ifndef _MyProtocolHandler_HXX
 #define _MyProtocolHandler_HXX
 
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/frame/XDispatchProvider.hpp>
 #include <com/sun/star/frame/XControlNotificationListener.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <cppuhelper/implbase3.hxx>
-#ifndef _CPPUHELPER_IMPLBASE2_HXX
 #include <cppuhelper/implbase2.hxx>
-#endif
-#include <com/sun/star/awt/XToolkit.hpp>
+#include <cppuhelper/implbase3.hxx>
 
 #define MYPROTOCOLHANDLER_IMPLEMENTATIONNAME   "vnd.demo.Impl.ProtocolHandler"
 #define MYPROTOCOLHANDLER_SERVICENAME          "vnd.demo.ProtocolHandler"

Modified: incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/exports.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/exports.cxx?rev=1190390&r1=1190389&r2=1190390&view=diff
==============================================================================
--- incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/exports.cxx (original)
+++ incubator/ooo/trunk/main/odk/examples/cpp/complextoolbarcontrols/exports.cxx Fri Oct 28 15:15:00 2011
@@ -25,33 +25,26 @@
  *
  ************************************************************************/
 
-
-#include <stdio.h>
-
-#include <osl/mutex.hxx>
-#include <osl/thread.h>
 #include <cppuhelper/factory.hxx>
-#include <rtl/ustring.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <sal/types.h>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
 
 #include "MyProtocolHandler.h"
 #include "MyListener.h"
 
 namespace css = ::com::sun::star;
 
-// static void writeInfo(const css::uno::Reference< css::registry::XRegistryKey >& xRegistryKey       ,
-//                       const char*                                               pImplementationName,
-//                       const char*                                               pServiceName       )
-// {
-//     ::rtl::OUStringBuffer sKey(256);
-// 	sKey.append     (::rtl::OUString::createFromAscii(pImplementationName));
-//     sKey.appendAscii("/UNO/SERVICES/");
-//     sKey.append     (::rtl::OUString::createFromAscii(pServiceName));
+#if 0
+static void writeInfo(const css::uno::Reference< css::registry::XRegistryKey >& xRegistryKey       ,
+                      const char*                                               pImplementationName,
+                      const char*                                               pServiceName       )
+{
+    ::rtl::OUStringBuffer sKey(256);
+	sKey.append     (::rtl::OUString::createFromAscii(pImplementationName));
+    sKey.appendAscii("/UNO/SERVICES/");
+    sKey.append     (::rtl::OUString::createFromAscii(pServiceName));
 
-//     xRegistryKey->createKey(sKey.makeStringAndClear());
-// }
+    xRegistryKey->createKey(sKey.makeStringAndClear());
+}
+#endif
 
 extern "C"
 {
@@ -62,30 +55,34 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL compo
 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
 }
 
-// This method not longer necessary since OOo 3.4 where the component registration was
-// was changed to passive component registration. For more details see
-// http://wiki.services.openoffice.org/wiki/Passive_Component_Registration
+#if 0
+/**
+ * This method not longer necessary since OOo 3.4 where the component registration was
+ * was changed to passive component registration. For more details see
+ * http://wiki.services.openoffice.org/wiki/Passive_Component_Registration
+ */
 //==================================================================================================
-// SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* pServiceManager,
-//                                                             void* pRegistryKey   )
-// {
-//     if (!pRegistryKey)
-//         return sal_False;
-
-//     try
-//     {
-//         css::uno::Reference< css::registry::XRegistryKey > xKey(reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey), css::uno::UNO_QUERY);
-
-//         writeInfo( xKey, MYLISTENER_IMPLEMENTATIONNAME       , MYLISTENER_SERVICENAME        );
-//         writeInfo( xKey, MYPROTOCOLHANDLER_IMPLEMENTATIONNAME, MYPROTOCOLHANDLER_SERVICENAME );
-
-//         return sal_True;
-//     }
-//     catch(const css::registry::InvalidRegistryException&)
-//         { OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); }
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* pServiceManager,
+                                                            void* pRegistryKey   )
+{
+    if (!pRegistryKey)
+        return sal_False;
+
+    try
+    {
+        css::uno::Reference< css::registry::XRegistryKey > xKey(reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey), css::uno::UNO_QUERY);
+
+        writeInfo( xKey, MYLISTENER_IMPLEMENTATIONNAME       , MYLISTENER_SERVICENAME        );
+        writeInfo( xKey, MYPROTOCOLHANDLER_IMPLEMENTATIONNAME, MYPROTOCOLHANDLER_SERVICENAME );
+
+        return sal_True;
+    }
+    catch(const css::registry::InvalidRegistryException&)
+        { OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); }
 
-//     return sal_False;
-// }
+    return sal_False;
+}
+#endif
 
 //==================================================================================================
 SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName      ,
@@ -99,17 +96,17 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL comp
     css::uno::Reference< css::lang::XMultiServiceFactory >  xSMGR     (reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager), css::uno::UNO_QUERY);
     ::rtl::OUString                                         sImplName = ::rtl::OUString::createFromAscii(pImplName);
 
-    if (sImplName.equalsAscii(MYLISTENER_IMPLEMENTATIONNAME))
+    if (sImplName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MYLISTENER_IMPLEMENTATIONNAME ) ) )
 	{
         css::uno::Sequence< ::rtl::OUString > lNames(1);
-        lNames[0] = ::rtl::OUString::createFromAscii(MYLISTENER_IMPLEMENTATIONNAME);
+        lNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MYLISTENER_IMPLEMENTATIONNAME ) );
 		xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyListener::st_createInstance, lNames);
 	}
     else
-    if (sImplName.equalsAscii(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME))
+    if (sImplName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MYPROTOCOLHANDLER_IMPLEMENTATIONNAME ) ) )
 	{
         css::uno::Sequence< ::rtl::OUString > lNames(1);
-        lNames[0] = ::rtl::OUString::createFromAscii(MYPROTOCOLHANDLER_SERVICENAME);
+        lNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MYPROTOCOLHANDLER_SERVICENAME ) );
         xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyProtocolHandler_createInstance, lNames);
 	}
 



Mime
View raw message