summaryrefslogtreecommitdiff
path: root/odk/examples/cpp/complextoolbarcontrols
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/cpp/complextoolbarcontrols')
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/Addons.xcu33
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/CalcWindowState.xcu17
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/Jobs.xcu18
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx37
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h48
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/MyJob.cxx48
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/MyJob.h99
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/MyListener.cxx61
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/MyListener.h22
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx270
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h28
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/ProtocolHandler.xcu17
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/WriterWindowState.xcu17
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/exports.cxx68
14 files changed, 378 insertions, 405 deletions
diff --git a/odk/examples/cpp/complextoolbarcontrols/Addons.xcu b/odk/examples/cpp/complextoolbarcontrols/Addons.xcu
index 52ef0d376ca4..ce9aa26920fc 100644
--- a/odk/examples/cpp/complextoolbarcontrols/Addons.xcu
+++ b/odk/examples/cpp/complextoolbarcontrols/Addons.xcu
@@ -1,11 +1,28 @@
<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
<node oor:name="AddonUI">
<node oor:name="OfficeToolBar">
<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 +39,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 +64,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 +89,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 +114,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 +134,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 +151,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 +171,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">
diff --git a/odk/examples/cpp/complextoolbarcontrols/CalcWindowState.xcu b/odk/examples/cpp/complextoolbarcontrols/CalcWindowState.xcu
index dbb79464f8a0..4d9f71c2923a 100644
--- a/odk/examples/cpp/complextoolbarcontrols/CalcWindowState.xcu
+++ b/odk/examples/cpp/complextoolbarcontrols/CalcWindowState.xcu
@@ -1,4 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="CalcWindowState" oor:package="org.openoffice.Office.UI">
<node oor:name="UIElements">
<node oor:name="States">
diff --git a/odk/examples/cpp/complextoolbarcontrols/Jobs.xcu b/odk/examples/cpp/complextoolbarcontrols/Jobs.xcu
index 342b6fe3120e..976e4843447a 100644
--- a/odk/examples/cpp/complextoolbarcontrols/Jobs.xcu
+++ b/odk/examples/cpp/complextoolbarcontrols/Jobs.xcu
@@ -1,5 +1,21 @@
<?xml version='1.0' encoding='UTF-8'?>
-
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
<oor:component-data oor:name="Jobs" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="Jobs">
<node oor:name="DemoAddOn" oor:op="replace">
diff --git a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx
index 9468853fa4d8..a55ce0dd5ab1 100644
--- a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx
@@ -1,30 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
#include "ListenerHelper.h"
diff --git a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h
index 8e68906b200d..a1e633ec3d76 100644
--- a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h
+++ b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.h
@@ -1,40 +1,38 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
#include <vector>
#include <boost/unordered_map.hpp>
+
#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 boost::unordered_map
-<
- ::rtl::OUString,
- StatusListeners,
- hashObjectName_Impl,
- eqObjectName_Impl
->
-ListenerMap;
+typedef boost::unordered_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
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx b/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
index ad7f95a5f4aa..3a00c1658e85 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
@@ -1,34 +1,25 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
#include "MyJob.h"
-#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>
@@ -49,9 +40,10 @@ using com::sun::star::document::XEventBroadcaster;
Any SAL_CALL MyJob::execute( const Sequence< NamedValue >& aArguments )
throw ( IllegalArgumentException, Exception, RuntimeException )
{
- Reference < XEventBroadcaster > xBrd( mxMSF->createInstance(::rtl::OUString("com.sun.star.frame.GlobalEventBroadcaster") ), UNO_QUERY );
+ Reference < XEventBroadcaster > xBrd( mxMSF->createInstance(
+ "com.sun.star.frame.GlobalEventBroadcaster" ), UNO_QUERY );
Reference < com::sun::star::document::XEventListener > xLstner( mxMSF->createInstance(
- ::rtl::OUString("com.sun.star.comp.Office.MyListener") ), UNO_QUERY );
+ "com.sun.star.comp.Office.MyListener" ), UNO_QUERY );
if ( xBrd.is() )
xBrd->addEventListener( xLstner );
return Any();
@@ -60,7 +52,7 @@ Any SAL_CALL MyJob::execute( const Sequence< NamedValue >& aArguments )
OUString MyJob_getImplementationName ()
throw (RuntimeException)
{
- return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Office.MyJob" ) );
+ return OUString( "com.sun.star.comp.Office.MyJob" );
}
#define SERVICE_NAME "com.sun.star.task.Job"
@@ -76,7 +68,7 @@ Sequence< OUString > SAL_CALL MyJob_getSupportedServiceNames( )
{
Sequence < OUString > aRet(1);
OUString* pArray = aRet.getArray();
- pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ pArray[0] = OUString( SERVICE_NAME );
return aRet;
}
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyJob.h b/odk/examples/cpp/complextoolbarcontrols/MyJob.h
index 3f2989f7be80..b6ac4bef0c37 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyJob.h
+++ b/odk/examples/cpp/complextoolbarcontrols/MyJob.h
@@ -1,152 +1,89 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-#ifndef _MyJob_HXX
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#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
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx b/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
index cdcda6b30691..59d964fff5bb 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
@@ -1,30 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
#include "MyListener.h"
@@ -52,8 +43,8 @@ css::uno::Any SAL_CALL MyListener::execute(const css::uno::Sequence< css::beans:
{
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)
{
@@ -92,12 +83,10 @@ css::uno::Any SAL_CALL MyListener::execute(const css::uno::Sequence< css::beans:
return css::uno::Any();
css::uno::Reference< css::lang::XServiceInfo > xInfo(xModel, css::uno::UNO_QUERY);
- sal_Bool bCalc = xInfo->supportsService(::rtl::OUString("com.sun.star.sheet.SpreadsheetDocument"));
- sal_Bool bWriter = (
- xInfo->supportsService(::rtl::OUString("com.sun.star.text.TextDocument")) &&
- !xInfo->supportsService(::rtl::OUString("com.sun.star.text.WebDocument")) &&
- !xInfo->supportsService(::rtl::OUString("com.sun.star.text.GlobalDocument"))
- );
+ sal_Bool bCalc = xInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument");
+ sal_Bool bWriter = ( xInfo->supportsService("com.sun.star.text.TextDocument") &&
+ !xInfo->supportsService("com.sun.star.text.WebDocument") &&
+ !xInfo->supportsService("com.sun.star.text.GlobalDocument") );
// We are interested only in Writer and Calc. However, here we are
// notified of all newly opened Documents...
@@ -123,7 +112,7 @@ css::uno::Any SAL_CALL MyListener::execute(const css::uno::Sequence< css::beans:
::rtl::OUString SAL_CALL MyListener::getImplementationName()
throw (css::uno::RuntimeException)
{
- return ::rtl::OUString(MYLISTENER_IMPLEMENTATIONNAME);
+ return ::rtl::OUString( MYLISTENER_IMPLEMENTATIONNAME );
}
@@ -131,7 +120,7 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL MyListener::getSupportedServiceNa
throw (css::uno::RuntimeException)
{
css::uno::Sequence< ::rtl::OUString > lNames(1);
- lNames[0] = ::rtl::OUString(MYLISTENER_SERVICENAME);
+ lNames[0] = ::rtl::OUString( MYLISTENER_SERVICENAME );
return lNames;
}
@@ -139,10 +128,8 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL MyListener::getSupportedServiceNa
sal_Bool SAL_CALL MyListener::supportsService(const ::rtl::OUString& sServiceName)
throw (css::uno::RuntimeException)
{
- return (
- sServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(MYLISTENER_SERVICENAME)) ||
- sServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.task.Job"))
- );
+ return sServiceName== MYLISTENER_SERVICENAME ||
+ sServiceName == "com.sun.star.task.Job";
}
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyListener.h b/odk/examples/cpp/complextoolbarcontrols/MyListener.h
index 24caa9d31d31..25fd45cb46f2 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyListener.h
+++ b/odk/examples/cpp/complextoolbarcontrols/MyListener.h
@@ -1,8 +1,25 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
#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>
@@ -25,11 +42,10 @@ 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;
-
public:
MyListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
virtual ~MyListener();
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
index 71537c5454c6..c149167d2ee4 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
@@ -1,78 +1,47 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
#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/Toolkitr.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 <compphelper/componentcontext.hxx>
-#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;
@@ -80,28 +49,19 @@ void BaseDispatch::ShowMessageBox( const Reference< XFrame >& rFrame, const ::rt
{
if ( !mxToolkit.is() )
mxToolkit = Reference< XToolkit > ( Toolkit::create(comphelper::getComponentContext(mxMSF)), UNO_QUERY_THROW );
- if ( rFrame.is() )
+ Reference< XMessageBoxFactory > xMsgBoxFactory( mxToolkit, UNO_QUERY );
+ if ( rFrame.is() && xMsgBoxFactory.is() )
{
- // describe window properties.
- WindowDescriptor aDescriptor;
- aDescriptor.Type = WindowClass_MODALTOP;
- aDescriptor.WindowServiceName = ::rtl::OUString( "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< 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();
- }
- }
+ 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 );
+
+ if ( xMsgBox.is() )
+ xMsgBox->execute();
}
}
@@ -162,7 +122,7 @@ Reference< XDispatch > SAL_CALL MyProtocolHandler::queryDispatch( const URL& a
return 0;
Reference < XController > xCtrl = mxFrame->getController();
- if ( xCtrl.is() && !aURL.Protocol.compareToAscii("vnd.demo.complextoolbarcontrols.demoaddon:") )
+ if ( xCtrl.is() && aURL.Protocol == "vnd.demo.complextoolbarcontrols.demoaddon:" )
{
Reference < XTextViewCursorSupplier > xCursor( xCtrl, UNO_QUERY );
Reference < XSpreadsheetView > xView( xCtrl, UNO_QUERY );
@@ -170,8 +130,13 @@ Reference< XDispatch > SAL_CALL MyProtocolHandler::queryDispatch( const URL& a
// without an appropriate corresponding document the handler doesn't function
return xRet;
- if ( aURL.Path == "Command1" || aURL.Path == "Command2" || aURL.Path == "Command3" || aURL.Path == "Command4" || aURL.Path == "Command5"
- || aURL.Path == "Command6" || aURL.Path == "Command7" )
+ if ( aURL.Path == "ImageButtonCmd" ||
+ aURL.Path == "ComboboxCmd" ||
+ aURL.Path == "ToggleDropdownButtonCmd" ||
+ aURL.Path == "DropdownButtonCmd" ||
+ aURL.Path == "SpinfieldCmd" ||
+ aURL.Path == "EditfieldCmd" ||
+ aURL.Path == "DropdownboxCmd" )
{
xRet = aListenerHelper.GetDispatch( mxFrame, aURL.Path );
if ( !xRet.is() )
@@ -201,20 +166,21 @@ Sequence < Reference< XDispatch > > SAL_CALL MyProtocolHandler::queryDispatches(
::rtl::OUString MyProtocolHandler_getImplementationName ()
throw (RuntimeException)
{
- return ::rtl::OUString(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME);
+ return ::rtl::OUString( MYPROTOCOLHANDLER_IMPLEMENTATIONNAME );
}
sal_Bool SAL_CALL MyProtocolHandler_supportsService( const ::rtl::OUString& ServiceName )
throw (RuntimeException)
{
- return ( ServiceName.equalsAscii(MYPROTOCOLHANDLER_SERVICENAME) || ServiceName == "com.sun.star.frame.ProtocolHandler" );
+ return ServiceName == MYPROTOCOLHANDLER_SERVICENAME ||
+ ServiceName == "com.sun.star.frame.ProtocolHandler";
}
Sequence< ::rtl::OUString > SAL_CALL MyProtocolHandler_getSupportedServiceNames( )
throw (RuntimeException)
{
Sequence < ::rtl::OUString > aRet(1);
- aRet[0] = ::rtl::OUString(MYPROTOCOLHANDLER_SERVICENAME);
+ aRet[0] = ::rtl::OUString( MYPROTOCOLHANDLER_SERVICENAME );
return aRet;
}
@@ -256,14 +222,14 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property
*/
Reference< XInterface > xSelfHold(static_cast< XDispatch* >(this), UNO_QUERY);
- if ( !aURL.Protocol.compareToAscii("vnd.demo.complextoolbarcontrols.demoaddon:") )
+ if ( aURL.Protocol == "vnd.demo.complextoolbarcontrols.demoaddon:" )
{
- if ( !aURL.Path.compareToAscii("Command1" ) )
+ if ( aURL.Path == "ImageButtonCmd" )
{
- // open the OpenOffice.org web page
- ::rtl::OUString sURL(::rtl::OUString("http://www.openoffice.org"));
+ // open the LibreOffice web page
+ ::rtl::OUString sURL("http://www.libreoffice.org");
Reference< XSystemShellExecute > xSystemShellExecute( mxMSF->createInstance(
- ::rtl::OUString("com.sun.star.system.SystemShellExecute")), UNO_QUERY );
+ "com.sun.star.system.SystemShellExecute"), UNO_QUERY );
if ( xSystemShellExecute.is() )
{
try
@@ -277,13 +243,13 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property
}
}
}
- else if ( !aURL.Path.compareToAscii("Command2" ) )
+ else if ( aURL.Path == "ComboboxCmd" )
{
// remove the text if it's in our list
Sequence< NamedValue > aRemoveArgs( 1 );
aRemoveArgs[0].Name = rtl::OUString( "Text" );
aRemoveArgs[0].Value <<= maComboBoxText;
- SendCommand( aURL, ::rtl::OUString("RemoveEntryText"), aRemoveArgs, sal_True );
+ SendCommand( aURL, ::rtl::OUString( "RemoveEntryText" ), aRemoveArgs, sal_True );
// add the new text to the start of the list
Sequence< NamedValue > aInsertArgs( 2 );
@@ -293,13 +259,13 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property
aInsertArgs[1].Value <<= maComboBoxText;
SendCommand( aURL, ::rtl::OUString("InsertEntry"), aInsertArgs, sal_True );
}
- else if ( !aURL.Path.compareToAscii("Command3" ) )
+ else if ( aURL.Path == "InsertEntry" )
{
// 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 == "Text" )
{
lArgs[i].Value >>= aText;
break;
@@ -308,23 +274,23 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property
// create new URL to address the combox box
URL aCmdURL;
- aCmdURL.Path = rtl::OUString("Command2");
- aCmdURL.Protocol = rtl::OUString("vnd.demo.complextoolbarcontrols.demoaddon:");
+ aCmdURL.Path = "ComboboxCmd";
+ aCmdURL.Protocol = "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("Text");
+ aArgs[0].Name = "Text";
aArgs[0].Value <<= aText;
- SendCommand( aCmdURL, ::rtl::OUString("SetText"), aArgs, sal_True );
+ SendCommand( aCmdURL, ::rtl::OUString( "SetText" ), aArgs, sal_True );
}
- else if ( !aURL.Path.compareToAscii("Command4" ) )
+ else if ( aURL.Path == "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 == "Text" )
{
lArgs[i].Value >>= aText;
break;
@@ -341,8 +307,8 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property
// create new URL to address the image button
URL aCmdURL;
- aCmdURL.Path = rtl::OUString("Command1");
- aCmdURL.Protocol = rtl::OUString("vnd.demo.complextoolbarcontrols.demoaddon:");
+ aCmdURL.Path = "Command1";
+ aCmdURL.Protocol = "vnd.demo.complextoolbarcontrols.demoaddon:";
aCmdURL.Complete = aCmdURL.Path + aCmdURL.Protocol;
// create and initialize FeatureStateEvent with IsEnabled
@@ -357,9 +323,24 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property
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 == "SpinfieldCmd" )
{
}
+ else if ( aURL.Path == "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 == "Text" )
+ {
+ lArgs[i].Value >>= aText;
+ break;
+ }
+ }
+ OSL_TRACE( "Dropdownbox control - selected entry text : %s",
+ rtl::OUStringToOString( aText, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
}
}
@@ -367,7 +348,7 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener
{
if ( aURL.Protocol == "vnd.demo.complextoolbarcontrols.demoaddon:" )
{
- if ( aURL.Path == "Command1" )
+ if ( aURL.Path == "ImageButtonCmd" )
{
// just enable this command
::com::sun::star::frame::FeatureStateEvent aEvent;
@@ -378,7 +359,7 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener
aEvent.State <<= Any();
xControl->statusChanged( aEvent );
}
- else if ( aURL.Path == "Command2" )
+ else if ( aURL.Path == "ComboboxCmd" )
{
// just enable this command
::com::sun::star::frame::FeatureStateEvent aEvent;
@@ -389,7 +370,7 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener
aEvent.State <<= Any();
xControl->statusChanged( aEvent );
}
- else if ( aURL.Path == "Command3" )
+ else if ( aURL.Path == "ToggleDropdownButtonCmd" )
{
// A toggle dropdown box is normally used for a group of commands
// where the user can select the last issued command easily.
@@ -398,20 +379,20 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener
// send command to set context menu content
Sequence< rtl::OUString > aContextMenu( 3 );
- aContextMenu[0] = rtl::OUString("Command 1");
- aContextMenu[1] = rtl::OUString("Command 2");
- aContextMenu[2] = rtl::OUString("Command 3");
+ aContextMenu[0] = "Command 1";
+ aContextMenu[1] = "Command 2";
+ aContextMenu[2] = "Command 3";
- aArgs[0].Name = rtl::OUString("List");
+ aArgs[0].Name = "List";
aArgs[0].Value <<= aContextMenu;
- SendCommandTo( xControl, aURL, rtl::OUString("SetList"), aArgs, sal_True );
+ SendCommandTo( xControl, aURL, rtl::OUString( "SetList" ), aArgs, sal_True );
// send command to check item on pos=0
aArgs[0].Name = rtl::OUString( "Pos" );
aArgs[0].Value <<= sal_Int32( 0 );
- SendCommandTo( xControl, aURL, ::rtl::OUString("CheckItemPos"), aArgs, sal_True );
+ SendCommandTo( xControl, aURL, ::rtl::OUString( "CheckItemPos" ), aArgs, sal_True );
}
- else if ( aURL.Path == "Command4" )
+ else if ( aURL.Path == "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.
@@ -420,41 +401,41 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener
// send command to set context menu content
Sequence< rtl::OUString > aContextMenu( 2 );
- aContextMenu[0] = rtl::OUString("Button Enabled");
- aContextMenu[1] = rtl::OUString("Button Disabled");
+ aContextMenu[0] = "Button Enabled";
+ aContextMenu[1] = "Button Disabled";
- aArgs[0].Name = rtl::OUString("List");
+ aArgs[0].Name = "List";
aArgs[0].Value <<= aContextMenu;
- SendCommandTo( xControl, aURL, rtl::OUString("SetList"), aArgs, sal_True );
+ SendCommandTo( xControl, aURL, rtl::OUString( "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( "Pos" );
+ aArgs[0].Name = "Pos";
aArgs[0].Value <<= nPos;
- SendCommandTo( xControl, aURL, ::rtl::OUString("CheckItemPos"), aArgs, sal_True );
+ SendCommandTo( xControl, aURL, ::rtl::OUString( "CheckItemPos" ), aArgs, sal_True );
}
- else if ( aURL.Path == "Command5" )
+ else if ( aURL.Path == "SpinfieldCmd" )
{
// A spin button
Sequence< NamedValue > aArgs( 5 );
// send command to initialize spin button
- aArgs[0].Name = rtl::OUString("Value");
+ aArgs[0].Name = "Value";
aArgs[0].Value <<= double( 0.0 );
- aArgs[1].Name = rtl::OUString("UpperLimit");
+ aArgs[1].Name = "UpperLimit";
aArgs[1].Value <<= double( 10.0 );
- aArgs[2].Name = rtl::OUString("LowerLimit");
+ aArgs[2].Name = "LowerLimit";
aArgs[2].Value <<= double( 0.0 );
- aArgs[3].Name = rtl::OUString("Step");
+ aArgs[3].Name = "Step";
aArgs[3].Value <<= double( 0.1 );
- aArgs[4].Name = rtl::OUString("OutputFormat");
+ aArgs[4].Name = "OutputFormat";
aArgs[4].Value <<= rtl::OUString("%.2f cm");
- SendCommandTo( xControl, aURL, rtl::OUString("SetValues"), aArgs, sal_True );
+ SendCommandTo( xControl, aURL, rtl::OUString( "SetValues" ), aArgs, sal_True );
}
- else if ( aURL.Path == "Command7" )
+ else if ( aURL.Path == "DropdownboxCmd" )
{
// A dropdown box is normally used for a group of commands
// where the user can select one of a defined set.
@@ -462,20 +443,20 @@ void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener
// send command to set context menu content
Sequence< rtl::OUString > aList( 10 );
- aList[0] = rtl::OUString("White");
- aList[1] = rtl::OUString("Black");
- aList[2] = rtl::OUString("Red");
- aList[3] = rtl::OUString("Blue");
- aList[4] = rtl::OUString("Green");
- aList[5] = rtl::OUString("Grey");
- aList[6] = rtl::OUString("Yellow");
- aList[7] = rtl::OUString("Orange");
- aList[8] = rtl::OUString("Brown");
- aList[9] = rtl::OUString("Pink");
-
- aArgs[0].Name = rtl::OUString("List");
+ aList[0] = "White";
+ aList[1] = "Black";
+ aList[2] = "Red";
+ aList[3] = "Blue";
+ aList[4] = "Green";
+ aList[5] = "Grey";
+ aList[6] = "Yellow";
+ aList[7] = "Orange";
+ aList[8] = "Brown";
+ aList[9] = "Pink";
+
+ aArgs[0].Name = "List";
aArgs[0].Value <<= aList;
- SendCommandTo( xControl, aURL, rtl::OUString("SetList"), aArgs, sal_True );
+ SendCommandTo( xControl, aURL, rtl::OUString( "SetList" ), aArgs, sal_True );
}
aListenerHelper.AddListener( mxFrame, xControl, aURL.Path );
@@ -491,7 +472,7 @@ void SAL_CALL BaseDispatch::controlEvent( const ControlEvent& Event ) throw (Run
{
if ( Event.aURL.Protocol == "vnd.demo.complextoolbarcontrols.demoaddon:" )
{
- if ( Event.aURL.Path == "Command2" )
+ if ( Event.aURL.Path == "ComboboxCmd" )
{
// We get notifications whenever the text inside the combobox has been changed.
// We store the new text into a member.
@@ -501,7 +482,7 @@ void SAL_CALL BaseDispatch::controlEvent( const ControlEvent& Event ) throw (Run
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 == "Text" )
{
bHasText = Event.aInformation[i].Value >>= aNewText;
break;
@@ -515,8 +496,9 @@ void SAL_CALL BaseDispatch::controlEvent( const ControlEvent& Event ) throw (Run
}
}
-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 )
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h
index 747514272fed..25817f6ef75c 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h
+++ b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h
@@ -1,17 +1,33 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
#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"
diff --git a/odk/examples/cpp/complextoolbarcontrols/ProtocolHandler.xcu b/odk/examples/cpp/complextoolbarcontrols/ProtocolHandler.xcu
index 3bab74410a24..293e0185c1e6 100644
--- a/odk/examples/cpp/complextoolbarcontrols/ProtocolHandler.xcu
+++ b/odk/examples/cpp/complextoolbarcontrols/ProtocolHandler.xcu
@@ -1,4 +1,21 @@
<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
<oor:component-data oor:name="ProtocolHandler" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="HandlerSet">
<node oor:name="vnd.demo.ProtocolHandler" oor:op="replace">
diff --git a/odk/examples/cpp/complextoolbarcontrols/WriterWindowState.xcu b/odk/examples/cpp/complextoolbarcontrols/WriterWindowState.xcu
index fd5453eba348..e590f65458f4 100644
--- a/odk/examples/cpp/complextoolbarcontrols/WriterWindowState.xcu
+++ b/odk/examples/cpp/complextoolbarcontrols/WriterWindowState.xcu
@@ -1,4 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI">
<node oor:name="UIElements">
<node oor:name="States">
diff --git a/odk/examples/cpp/complextoolbarcontrols/exports.cxx b/odk/examples/cpp/complextoolbarcontrols/exports.cxx
index 763d6950be76..b7196bc123c7 100644
--- a/odk/examples/cpp/complextoolbarcontrols/exports.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/exports.cxx
@@ -1,61 +1,32 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
-
-#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));
-
-// xRegistryKey->createKey(sKey.makeStringAndClear());
-// }
-
extern "C"
{
+
SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName ,
void* pServiceManager,
void* pRegistryKey )
@@ -67,17 +38,16 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplNa
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 == MYLISTENER_IMPLEMENTATIONNAME)
{
css::uno::Sequence< ::rtl::OUString > lNames(1);
- lNames[0] = ::rtl::OUString(MYLISTENER_IMPLEMENTATIONNAME);
+ lNames[0] = MYLISTENER_IMPLEMENTATIONNAME;
xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyListener::st_createInstance, lNames);
}
- else
- if (sImplName.equalsAscii(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME))
+ else if (sImplName == MYPROTOCOLHANDLER_IMPLEMENTATIONNAME)
{
css::uno::Sequence< ::rtl::OUString > lNames(1);
- lNames[0] = ::rtl::OUString(MYPROTOCOLHANDLER_SERVICENAME);
+ lNames[0] = MYPROTOCOLHANDLER_SERVICENAME;
xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyProtocolHandler_createInstance, lNames);
}