summaryrefslogtreecommitdiff
path: root/cli_ure
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.cz>2011-08-02 18:11:29 +0200
committerPetr Mladek <pmladek@suse.cz>2013-04-30 12:05:24 +0200
commit41b7509c77d7068584f056792b252f48bdad9892 (patch)
treecdeec43f8407c68d39c566fde8a15c523538c298 /cli_ure
parent4befbdd730e5a16cbcfa66d67bd7be7132d06bfb (diff)
[mono] cli_ure-source-bootstrap-managed_bootstrap-cs.diff: add mono support
Change-Id: Ibc1fa86a11a4f0c3a8c7ca1393e3c336e8294585
Diffstat (limited to 'cli_ure')
-rw-r--r--cli_ure/CliLibrary_cli_cppuhelper_mono.mk32
-rw-r--r--cli_ure/source/bootstrap/managed_bootstrap.cs106
2 files changed, 138 insertions, 0 deletions
diff --git a/cli_ure/CliLibrary_cli_cppuhelper_mono.mk b/cli_ure/CliLibrary_cli_cppuhelper_mono.mk
new file mode 100644
index 000000000000..8129be89a22f
--- /dev/null
+++ b/cli_ure/CliLibrary_cli_cppuhelper_mono.mk
@@ -0,0 +1,32 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+include $(SRCDIR)/cli_ure/version/version.txt
+
+$(eval $(call gb_CliLibrary_CliLibrary,cli_cppuhelper))
+
+$(eval $(call gb_CliLibrary_set_configfile,cli_cppuhelper,cli_ure/source/native/cli_cppuhelper_config))
+
+$(eval $(call gb_CliLibrary_set_keyfile,cli_cppuhelper,$(SRCDIR)/cli_ure/source/cliuno.snk))
+
+$(eval $(call gb_CliLibrary_set_policy,cli_cppuhelper,$(CLI_CPPUHELPER_POLICY_ASSEMBLY),$(CLI_CPPUHELPER_POLICY_VERSION)))
+
+$(eval $(call gb_CliLibrary_add_csfiles,cli_cppuhelper,\
+ cli_ure/source/bootstrap/managed_bootstrap \
+))
+
+$(eval $(call gb_CliLibrary_add_generated_csfiles,cli_cppuhelper,\
+ CustomTarget/cli_ure/source/bootstrap/assembly \
+))
+
+$(eval $(call gb_CliLibrary_use_assemblies,cli_cppuhelper,\
+ cli_uretypes \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/cli_ure/source/bootstrap/managed_bootstrap.cs b/cli_ure/source/bootstrap/managed_bootstrap.cs
new file mode 100644
index 000000000000..9a7fc41d9053
--- /dev/null
+++ b/cli_ure/source/bootstrap/managed_bootstrap.cs
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+namespace uno.util
+{
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+public class Bootstrap
+{
+ private Bootstrap() {}
+
+ public static unoidl.com.sun.star.uno.XComponentContext
+ defaultBootstrap_InitialComponentContext()
+ {
+ return defaultBootstrap_InitialComponentContext(null, null);
+ }
+
+ public static unoidl.com.sun.star.uno.XComponentContext
+ defaultBootstrap_InitialComponentContext(
+ string iniFile,
+ IDictionaryEnumerator bootstrapParameters)
+ {
+ if (bootstrapParameters != null)
+ {
+ bootstrapParameters.Reset();
+ while (bootstrapParameters.MoveNext())
+ {
+ string key = (string)bootstrapParameters.Key;
+ string value = (string)bootstrapParameters.Value;
+
+ native_bootstrap_set(key, key.Length, value, value.Length);
+ }
+ }
+
+ System.Console.WriteLine("Bootstrap with ini " + iniFile);
+ // bootstrap native uno
+ IntPtr context;
+ if (iniFile == null)
+ {
+ context = native_defaultBootstrap_InitialComponentContext();
+ }
+ else
+ {
+ context = native_defaultBootstrap_InitialComponentContext(iniFile, iniFile.Length);
+ }
+
+ return (unoidl.com.sun.star.uno.XComponentContext)ExtractObject(context);
+ }
+
+ public static unoidl.com.sun.star.uno.XComponentContext bootstrap()
+ {
+ return (unoidl.com.sun.star.uno.XComponentContext)ExtractObject(native_bootstrap());
+ }
+
+ static object ExtractObject(IntPtr managed)
+ {
+ GCHandle handle = (GCHandle)managed;
+ object ret = handle.Target;
+ handle.Free();
+ return ret;
+ }
+
+ [DllImport("cli_uno_glue")]
+ private static extern void native_bootstrap_set(
+ [MarshalAs(UnmanagedType.LPWStr)] string key, int keyLength,
+ [MarshalAs(UnmanagedType.LPWStr)] string value, int valueLength);
+
+ [DllImport("cli_uno_glue", EntryPoint="native_defaultBootstrap_InitialComponentContext")]
+ private static extern IntPtr native_defaultBootstrap_InitialComponentContext();
+
+ [DllImport("cli_uno_glue", EntryPoint="native_defaultBootstrap_InitialComponentContext_iniFile")]
+ private static extern IntPtr native_defaultBootstrap_InitialComponentContext(
+ [MarshalAs(UnmanagedType.LPWStr)] string iniFile, int nameLength);
+
+ [DllImport("cli_uno_glue")]
+ private static extern IntPtr native_bootstrap();
+}
+
+}