Firts funtions: zreverse and zeval
This commit is contained in:
commit
b6c0a86858
|
@ -1,3 +1,12 @@
|
|||
# zaz-functions
|
||||
|
||||
LibreOffice Calc Add-in
|
||||
|
||||
|
||||
## Functions
|
||||
|
||||
* `zreverse` - Get reverse string
|
||||
* `zeval` - Parse and execute expresions
|
||||
|
||||
|
||||
![Image](https://git.cuates.net/elmau/zaz-functions/raw/commit/b0e0a93a8ef27523cd3e0e17ec2df1d085881e60/images/image1.png "Functions")
|
||||
|
|
8
conf.py
8
conf.py
|
@ -136,8 +136,8 @@ MENUS = (
|
|||
|
||||
# ~ Functions, only for TYPE_EXTENSION = 3
|
||||
FUNCTIONS = {
|
||||
'reverse': {
|
||||
'displayname': {'en': 'reverse', 'es': 'reversa'},
|
||||
'zreverse': {
|
||||
'displayname': {'en': 'zreverse', 'es': 'zreversa'},
|
||||
'description': {'en': 'Get reverse string', 'es': 'Retorna la cadena en forma inversa'},
|
||||
'parameters': {
|
||||
'value': {
|
||||
|
@ -146,8 +146,8 @@ FUNCTIONS = {
|
|||
},
|
||||
},
|
||||
},
|
||||
'eval': {
|
||||
'displayname': {'en': 'eval', 'es': 'evalua'},
|
||||
'zeval': {
|
||||
'displayname': {'en': 'zeval', 'es': 'zevalua'},
|
||||
'description': {'en': 'Parse and execute string expressions', 'es': 'Parsea y ejecuta una expresión en texto'},
|
||||
'parameters': {
|
||||
'value': {
|
||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="CalcAddIns" oor:package="org.openoffice.Office">
|
||||
<node oor:name="AddInInfo">
|
||||
<node oor:name="net.elmau.zaz.functions" oor:op="replace">
|
||||
<node oor:name="AddInFunctions">
|
||||
<node oor:name="zreverse" oor:op="replace">
|
||||
<prop oor:name="DisplayName">
|
||||
<value xml:lang="en">zreverse</value>
|
||||
<value xml:lang="es">zreversa</value>
|
||||
</prop>
|
||||
<prop oor:name="Description">
|
||||
<value xml:lang="en">Get reverse string</value>
|
||||
<value xml:lang="es">Retorna la cadena en forma inversa</value>
|
||||
</prop>
|
||||
<prop oor:name="Category">
|
||||
<value>Add-In</value>
|
||||
</prop>
|
||||
<prop oor:name="CompatibilityName">
|
||||
<value xml:lang="en">AutoAddIn.zreverse</value>
|
||||
</prop>
|
||||
<node oor:name="Parameters">
|
||||
<node oor:name="value" oor:op="replace">
|
||||
<prop oor:name="DisplayName">
|
||||
<value xml:lang="en">string</value>
|
||||
<value xml:lang="es">texto</value>
|
||||
</prop>
|
||||
<prop oor:name="Description">
|
||||
<value xml:lang="en">The string</value>
|
||||
<value xml:lang="es">El cadena</value>
|
||||
</prop>
|
||||
</node>
|
||||
</node>
|
||||
</node> <node oor:name="zeval" oor:op="replace">
|
||||
<prop oor:name="DisplayName">
|
||||
<value xml:lang="en">zeval</value>
|
||||
<value xml:lang="es">zevalua</value>
|
||||
</prop>
|
||||
<prop oor:name="Description">
|
||||
<value xml:lang="en">Parse and execute string expressions</value>
|
||||
<value xml:lang="es">Parsea y ejecuta una expresión en texto</value>
|
||||
</prop>
|
||||
<prop oor:name="Category">
|
||||
<value>Add-In</value>
|
||||
</prop>
|
||||
<prop oor:name="CompatibilityName">
|
||||
<value xml:lang="en">AutoAddIn.zeval</value>
|
||||
</prop>
|
||||
<node oor:name="Parameters">
|
||||
<node oor:name="value" oor:op="replace">
|
||||
<prop oor:name="DisplayName">
|
||||
<value xml:lang="en">expression</value>
|
||||
<value xml:lang="es">expresion</value>
|
||||
</prop>
|
||||
<prop oor:name="Description">
|
||||
<value xml:lang="en">The expression to execute</value>
|
||||
<value xml:lang="es">La expresión a ejecutar</value>
|
||||
</prop>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</oor:component-data>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" manifest:version="1.2">
|
||||
<manifest:file-entry manifest:full-path="ZAZFunctions.py" manifest:media-type="application/vnd.sun.star.uno-component;type=Python"/>
|
||||
<manifest:file-entry manifest:full-path="Office/Accelerators.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
|
||||
<manifest:file-entry manifest:full-path="Addons.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
|
||||
<manifest:file-entry manifest:full-path="XZAZFunctions.rdb" manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB"/>
|
||||
<manifest:file-entry manifest:full-path="CalcAddIn.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
|
||||
</manifest:manifest>
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __net_elmau_zaz_functions_idl__
|
||||
#define __net_elmau_zaz_functions_idl__
|
||||
|
||||
#include <com/sun/star/uno/XInterface.idl>
|
||||
|
||||
module net { module elmau { module zaz { module functions {
|
||||
|
||||
interface XZAZFunctions : com::sun::star::uno::XInterface
|
||||
{
|
||||
string zreverse([in] string value);
|
||||
any zeval([in] string value);
|
||||
};
|
||||
|
||||
service functions {
|
||||
interface XZAZFunctions;
|
||||
};
|
||||
|
||||
}; }; }; };
|
||||
#endif
|
Binary file not shown.
|
@ -0,0 +1,25 @@
|
|||
import uno
|
||||
import unohelper
|
||||
from net.elmau.zaz.functions import XZAZFunctions
|
||||
|
||||
|
||||
ID_EXTENSION = 'net.elmau.zaz.functions'
|
||||
SERVICE = ('com.sun.star.sheet.AddIn',)
|
||||
|
||||
|
||||
class ZAZFunctions(unohelper.Base, XZAZFunctions):
|
||||
|
||||
def __init__(self, ctx):
|
||||
self.ctx = ctx
|
||||
|
||||
def zreverse(self, value):
|
||||
result = value[::-1]
|
||||
return result
|
||||
|
||||
def zeval(self, value):
|
||||
result = eval(value)
|
||||
return result
|
||||
|
||||
|
||||
g_ImplementationHelper = unohelper.ImplementationHelper()
|
||||
g_ImplementationHelper.addImplementation(ZAZFunctions, ID_EXTENSION, SERVICE)
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:d="http://openoffice.org/extensions/description/2006">
|
||||
<identifier value="net.elmau.zaz.functions"/>
|
||||
<version value="0.1.0"/>
|
||||
<display-name>
|
||||
<name lang="en">My first extension</name>
|
||||
<name lang="es">Mi primer extensión</name>
|
||||
</display-name>
|
||||
<extension-description>
|
||||
<src lang="en" xlink:href="description/desc_en.txt"/>
|
||||
<src lang="es" xlink:href="description/desc_es.txt"/>
|
||||
</extension-description>
|
||||
<icon>
|
||||
<default xlink:href="images/zazfunctions.png"/>
|
||||
</icon>
|
||||
<publisher>
|
||||
<name xlink:href="https://git.cuates.net/elmau/zaz-functions" lang="en">El Mau</name>
|
||||
<name xlink:href="https://git.cuates.net/elmau/zaz-functions" lang="es">El Mau</name>
|
||||
</publisher>
|
||||
<registration>
|
||||
<simple-license accept-by="user" suppress-on-update="true">
|
||||
<license-text xlink:href="registration/license_en.txt" lang="en"/>
|
||||
<license-text xlink:href="registration/license_es.txt" lang="es"/>
|
||||
</simple-license>
|
||||
</registration>
|
||||
</description>
|
|
@ -0,0 +1 @@
|
|||
My great extension
|
|
@ -0,0 +1 @@
|
|||
Mi gran extensión
|
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,14 @@
|
|||
This file is part of ZAZFunctions.
|
||||
|
||||
ZAZFunctions is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ZAZFunctions 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ZAZFunctions. If not, see <https://www.gnu.org/licenses/>.
|
|
@ -0,0 +1,14 @@
|
|||
This file is part of ZAZFunctions.
|
||||
|
||||
ZAZFunctions is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ZAZFunctions 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ZAZFunctions. If not, see <https://www.gnu.org/licenses/>.
|
Loading…
Reference in New Issue