Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2724

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/24/2724/1

Show LibreOffice controls in Glade's tool palette

Glade didn't show any LibreOffice controls in its tool palette
because the catalog didn't have any glade-widget-group element.
This adds a XSLT script to automatically generate such element.

A better version of the script would create separate groups for
each module/namespace, but currently I have no idea how to do
this with libxslt, as it doesn't provide fn::distinct-values().

Change-Id: Iaa3e4b0471b58c48838e000e6d78a73b0c6a4bd3
---
A extras/CustomTarget_glade.mk
M extras/Module_extras.mk
M extras/Package_glade.mk
R extras/source/glade/libreoffice-catalog.xml.in
A extras/source/glade/makewidgetgroup.xslt
5 files changed, 78 insertions(+), 1 deletion(-)



diff --git a/extras/CustomTarget_glade.mk b/extras/CustomTarget_glade.mk
new file mode 100644
index 0000000..89d452e
--- /dev/null
+++ b/extras/CustomTarget_glade.mk
@@ -0,0 +1,26 @@
+# -*- 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/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,extras/glade))
+
+#
+# Rules
+#
+
+$(call gb_CustomTarget_get_workdir,extras/source/glade)/libreoffice-catalog.xml : \
+        $(SRCDIR)/extras/source/glade/libreoffice-catalog.xml.in \
+        $(SRCDIR)/extras/source/glade/makewidgetgroup.xslt \
+        | $(call gb_ExternalExecutable_get_dependencies,xsltproc)
+       $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSLT,4)
+       $(call gb_Helper_abbreviate_dirs, \
+       $(call gb_ExternalExecutable_get_command,xsltproc) --nonet \
+               -o $@ $(SRCDIR)/extras/source/glade/makewidgetgroup.xslt $< \
+       )
+
+# vim: set noet sw=4 ts=4:
diff --git a/extras/Module_extras.mk b/extras/Module_extras.mk
index 7144265..c3cb14b 100644
--- a/extras/Module_extras.mk
+++ b/extras/Module_extras.mk
@@ -12,6 +12,7 @@
 $(eval $(call gb_Module_add_targets,extras,\
        AllLangZip_autotextshare \
        CustomTarget_autocorr \
+       CustomTarget_glade \
        Package_fonts \
        Package_glade \
        Package_labels \
diff --git a/extras/Package_glade.mk b/extras/Package_glade.mk
index 9621aa9..1ac1f69 100644
--- a/extras/Package_glade.mk
+++ b/extras/Package_glade.mk
@@ -7,7 +7,7 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_Package_Package,extras_glade,$(SRCDIR)/extras/source/glade))
+$(eval $(call gb_Package_Package,extras_glade,$(call 
gb_CustomTarget_get_workdir,extras/source/glade)))
 
 $(eval $(call 
gb_Package_add_file,extras_glade,pck/libreoffice-catalog.xml,libreoffice-catalog.xml))
 
diff --git a/extras/source/glade/libreoffice-catalog.xml 
b/extras/source/glade/libreoffice-catalog.xml.in
similarity index 100%
rename from extras/source/glade/libreoffice-catalog.xml
rename to extras/source/glade/libreoffice-catalog.xml.in
diff --git a/extras/source/glade/makewidgetgroup.xslt b/extras/source/glade/makewidgetgroup.xslt
new file mode 100644
index 0000000..c7d97d7
--- /dev/null
+++ b/extras/source/glade/makewidgetgroup.xslt
@@ -0,0 +1,50 @@
+<?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 .
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+  <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
+
+  <!-- work arround apparently broken output indenting in libxslt -->
+  <xsl:param name="indent" select="'  '"/>
+
+  <xsl:template match="/glade-catalog">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+
+      <xsl:text>&#10;</xsl:text>
+      <xsl:value-of select="$indent"/>
+      <glade-widget-group name="libreoffice" title="LibreOffice">
+      <xsl:text>&#10;</xsl:text>
+
+        <xsl:for-each select="//glade-widget-class">
+          <xsl:value-of select="concat($indent,$indent)"/>
+          <glade-widget-class-ref name="{@name}"/>
+          <xsl:text>&#10;</xsl:text>
+        </xsl:for-each>
+
+      <xsl:value-of select="$indent"/>
+      </glade-widget-group>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>

-- 
To view, visit https://gerrit.libreoffice.org/2724
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa3e4b0471b58c48838e000e6d78a73b0c6a4bd3
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Mathias Hasselmann <mathias@openismus.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.