summaryrefslogtreecommitdiff
path: root/sc/addin/rot13
diff options
context:
space:
mode:
Diffstat (limited to 'sc/addin/rot13')
-rw-r--r--sc/addin/rot13/makefile.mk171
-rw-r--r--sc/addin/rot13/rot13.cl182
-rw-r--r--sc/addin/rot13/rot13.src148
3 files changed, 501 insertions, 0 deletions
diff --git a/sc/addin/rot13/makefile.mk b/sc/addin/rot13/makefile.mk
new file mode 100644
index 000000000000..334e94cbb2d0
--- /dev/null
+++ b/sc/addin/rot13/makefile.mk
@@ -0,0 +1,171 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:44:46 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (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.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=sc
+TARGET=rot
+LIBTARGET=NO
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+CL2C=+$(PERL) $(MISC)$/cl2c.pl
+CL2CRID=RID_SC_ADDIN_ROT13
+CL2CSRC=$(TARGET)13.src
+
+# --- Files --------------------------------------------------------
+
+CFILES= $(MISC)$/x$(TARGET).c
+
+SLOFILES= \
+ $(SLO)$/x$(TARGET).obj
+
+# ==========================================================================
+
+SHL1TARGET= rot$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= irot
+SHL1OBJS= $(SLO)$/x$(TARGET).obj
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+.IF "$(GUI)" == "WNT"
+SHL1STDLIBS= gdi32.lib advapi32.lib comdlg32.lib \
+ uuid.lib ole32.lib shell32.lib winspool.lib
+.IF "$(GVER)" == "W40"
+SHL1STDLIBS= $(SHL1STDLIBS) comctl32.lib
+.ENDIF
+.ENDIF
+
+# --- Targets -------------------------------------------------------
+
+ALL: \
+ $(MISC)$/rot.lst \
+ ALLTAR
+
+.INCLUDE: target.mk
+
+$(MISC)$/x$(TARGET).c: $(TARGET)13.cl $(CL2CSRC) $(MISC)$/cl2c.pl
+ $(CL2C) $(TARGET)13.cl $(MISC)$/x$(TARGET).c $(CL2CSRC) $(CL2CRID)
+
+$(MISC)$/cl2c.pl: ..$/util$/cl2c.pl
+.IF "$(GUI)"=="UNX"
+ +tr -d "\015" < ..$/util$/cl2c.pl > $@
+ +chmod +rw $@
+.ELSE
+ @+$(COPY) ..$/util$/cl2c.pl $@
+.ENDIF
+
+$(INCCOM)$/xlang.h : $(SOLARINCDIR)$/tools$/lang.hxx
+.IF "$(GUI)"=="OS2"
+ @+$(COPY) $(SOLARINCDIR)$/tools$/lang.hxx $(tmp)$/lang.hxx
+ @+$(COPY) $(tmp)$/lang.hxx $@
+.ELSE
+ @+$(COPY) $(SOLARINCDIR)$/tools$/lang.hxx $@
+.ENDIF
+
+$(SLOFILES) : $(INCCOM)$/xlang.h
+
+$(MISC)$/rot.lst : \
+ $(MISC)$/x$(TARGET).c \
+ $(INCCOM)$/xlang.h \
+ ..$/inc$/rot13.hrc \
+ ..$/inc$/addin.h
+.IF "$(GUI)"=="WNT"
+ @+echo $(<:+"\n":s/ //) > $@
+.ELSE
+ @+echo $< > $@
+.ENDIF
+
+# --- Def-File ---
+
+# ------------------------------------------------------------------
+# Windows + OS/2 DEF File
+# ------------------------------------------------------------------
+
+.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo LIBRARY $(SHL1TARGET)>$@
+ @echo DESCRIPTION 'Rot13 StarCalc Addin DLL'>>$@
+.IF "$(GUI)" == "WNT"
+ @echo DATA READ WRITE NONSHARED>>$@
+ @echo EXPORTS>>$@
+.ENDIF
+.IF "$(GUI)" == "OS2"
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.ENDIF
+ @echo GetFunctionCount>>$@
+ @echo GetFunctionData>>$@
+ @echo GetParameterDescription>>$@
+ @echo SetLanguage >>$@
+ @echo Rot13>>$@
+
+.ENDIF
+
+
diff --git a/sc/addin/rot13/rot13.cl b/sc/addin/rot13/rot13.cl
new file mode 100644
index 000000000000..9262de35896c
--- /dev/null
+++ b/sc/addin/rot13/rot13.cl
@@ -0,0 +1,182 @@
+/*------------------------------------------------------------------------
+
+$Workfile: ROT13.CL $
+
+$Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sc/addin/rot13/rot13.cl,v 1.1.1.1 2000-09-18 16:44:46 hr Exp $
+
+Description: StarCalc ROT13 AddIn Example
+
+(c) Copyright 1998 - 2000, Sun Microsystems, Inc.
+
+------------------------------------------------------------------------*/
+
+static char rot13_Id[]="@(#) StarCalc Rot13 AddIn (c) 1998-2000 Sun Microsystems, Inc.";
+
+#include <string.h>
+#include <stdio.h>
+
+#include <xlang.h>
+#include <addin.h>
+#include <rot13.hrc>
+
+/**
+ * the current language the Addin is using
+ */
+static USHORT _nLanguage=LANGUAGE_ENGLISH;
+
+/**
+ * StarCalc calls this function to set a new current Language for the Addin
+ *
+ * @param *nLanguage
+ *
+ */
+void CALLTYPE SetLanguage( USHORT* nLanguage )
+{
+ _nLanguage = GetNeutralLanguage( *nLanguage );
+}
+
+
+/**
+ * Tell StarCalc how many new functions this Addin provides.
+ *
+ * @param *nCount - returns the number of functions which are exported to StarCalc
+ *
+ */
+void CALLTYPE GetFunctionCount( USHORT *nCount )
+{
+ *nCount = 1;
+}
+
+/**
+ * Provides neccessary data for each new function to StarCalc
+ *
+ * @param *nNo Input: Function number between 0 and nCount - 1
+ * @param *pFuncName Output: Functionname which should be called in the AddIn-DLL
+ * @param *nParamCount Output: Number of Parameter. Must be greater than 0, because there's always a return-Value. Maximum is 16.
+ * @param *peType Output: Pointer to arrray with exactly 16 variables of typ Paramtype. nParamCount Entries are set to the type of the corresponding Parameters.
+ * @param *pInternalName Output: Functionname as seen by the Spreadsheet user
+ *
+ * @see #GetFunctionCount, #GetParameterDescription
+ *
+ */
+void CALLTYPE GetFunctionData( USHORT * nNo,
+ char * pFuncName,
+ USHORT * nParamCount,
+ ParamType * peType,
+ char * pInternalName )
+{
+
+ switch( *nNo ) {
+ case 0:
+ /* the function name is the same in all languages */
+ SO_StringCopy( pInternalName, "Rot13" );
+ SO_StringCopy( pFuncName, "Rot13" );
+ peType[0] = PTR_STRING;
+ peType[1] = PTR_STRING;
+ *nParamCount=2;
+ break;
+ default:
+ *nParamCount = 0;
+ *pFuncName = 0;
+ *pInternalName = 0;
+ break;
+ }
+}
+
+/**
+ * Provides descriptions for each new function to StarCalc
+ * which are shown is the autopilot
+ *
+ * @param *nNo Input Parameter, Function number between 0 and nCount - 1
+ * @param *nParam Parameter Number
+ * @param *pName Output: Name of the parameter
+ * @param *pDesc Output: Description of the parameter
+ *
+ * @see #GetFunctionCount, #GetParameterDescription
+ */
+void CALLTYPE GetParameterDescription( USHORT* nNo, USHORT* nParam,
+char* pName, char* pDesc )
+{
+ *pName = 0;
+ *pDesc = 0;
+
+
+ switch ( *nNo ) {
+ case 0:
+ switch ( *nParam ) {
+ case 0:
+ SO_StringCopy(pDesc,getText(ROT13_DESC));
+ break;
+ case 1:
+ SO_StringCopy(pName,getText(ROT13_PAR1_NAME));
+ SO_StringCopy(pDesc,getText(ROT13_PAR1_DESC));
+ }
+ }
+}
+
+/**
+ * ROT13 Algorithm, each alphabetical character of the text is rotated by 13 in the alphabet
+ *
+ * @param *ret
+ * @param *src
+ *
+ * ER: well, my personal favorite algorithm is
+ * main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
+ * but for clarification we do it somehow different here ;-)
+ */
+void CALLTYPE Rot13(char *ret, char *src)
+{
+ if ( ! ret ) return;
+ if ( ! src ) *ret='\0';
+
+ for(;src && *src; src++ , ret++) {
+ *ret=*src;
+ if (*ret >= 'A' && *ret <= 'Z') {
+ if ( (*ret +=13) > 'Z' ) *ret-=26;
+ } else if (*ret >= 'a' && *ret < 'n') {
+ *ret +=13;
+ } else if (*ret >= 'n' && *ret <= 'z') {
+ *ret -=13;
+ }
+ }
+ *ret=*src;
+}
+
+
+/*------------------------------------------------------------------------
+
+$Log: not supported by cvs2svn $
+Revision 1.5 1999/08/10 12:48:46 NN
+#68039# copyright
+
+
+ Rev 1.4 10 Aug 1999 14:48:46 NN
+ #68039# copyright
+
+ Rev 1.3 29 Apr 1999 14:56:48 ER
+ #57689# xlang.h statt tools/lang.hxx
+
+ Rev 1.3 29 Apr 1999 14:45:08 ER
+ #57689# xlang.hxx statt tools/lang.hxx
+
+ Rev 1.2 29 Apr 1999 12:53:30 ER
+ #57689# Internationalisierung
+
+ Rev 1.1 15 Mar 1999 16:47:12 HJS
+ aufgeraeumt
+
+ Rev 1.0 10 Mar 1999 12:07:18 BEI
+ Initial revision.
+
+ Rev 1.2 13 Jul 1998 17:57:16 BEI
+ 2 Languages
+
+ Rev 1.1 09 Jul 1998 09:00:50 TRI
+ keine C++ Kommentar in C Files
+
+ Rev 1.0 07 Jul 1998 20:36:36 NN
+ Initial revision.
+
+------------------------------------------------------------------------*/
+
+
diff --git a/sc/addin/rot13/rot13.src b/sc/addin/rot13/rot13.src
new file mode 100644
index 000000000000..e42d558ffd2c
--- /dev/null
+++ b/sc/addin/rot13/rot13.src
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * $RCSfile: rot13.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:44:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "sc.hrc" // Definition RID_XXX in StarCalc
+#include "rot13.hrc"
+
+Resource RID_SC_ADDIN_ROT13
+{
+ String ROT13_DESC // Description
+ {
+ Text = "ROT13 Algorithmus, jedes alphabetische Zeichen des Textes wird um 13 im Alphabet rotiert." ;
+ Text [ english ] = "ROT13 Algorithm, each alphabetical character of the text is rotated by 13 in the alphabet" ;
+ Text[ english_us ] = "ROT13 Algorithm, each alphabetical character of the text is rotated by 13 in the alphabet";
+ Text[ portuguese ] = "ROT13 Algoritmo: rotao de 13 caracteres no alfabeto para cada um dos caracteres alfabticos do texto.";
+ Text[ russian ] = " ROT13: , 13 .";
+ Text[ dutch ] = "ROT13 Algorithme, ieder alfabetisch teken van de tekst roteert met het 13e in het alfabet.";
+ Text[ french ] = "ROT13 Algorythme, remplacement de chaque caractre alphabtique du texte par rotation de 13 caractres dans l'alphabet.";
+ Text[ spanish ] = "Algoritmo ROT13, cada carcter alfabtico del texto rodar 13 espacios en el alfabeto.";
+ Text[ italian ] = "ROT13 algoritmo, ogni carattere alfabetico del testo viene ruotato di 13 nell'alfabeto.";
+ Text[ danish ] = "ROT13 algoritme, hvert alfabetiske tegn i teksten bliver roteret med 13 i alfabetet.";
+ Text[ swedish ] = "ROT13 algoritm, varje alfabetiskt tecken i texten roteras med 13 i alfabetet.";
+ Text[ polish ] = "Algorytm ROT13, kady alfabetyczny znak tekstu zostanie obrcony o 13 w alfabecie.";
+ Text[ portuguese_brazilian ] = "ROT13 Algorithm, each alphabetical character of the text is rotated by 13 in the alphabet";
+ Text[ japanese ] = "ROT13ٺؽ:÷Ă̧̱ޯĕ13ƂɌJԂ܂";
+ Text[ chinese_simplified ] = "ROT13 ıÿĸĸĵ13ĸѭת";
+ Text[ chinese_traditional ] = "ROT13 khA夺CӦrNur13Ӧr`C";
+ Text[ arabic ] = " ROT13 13 .";
+ Text[ dutch ] = "ROT13 Algorithme, ieder alfabetisch teken van de tekst roteert met het 13e in het alfabet.";
+ Text[ chinese_simplified ] = "ROT13 ıÿĸĸĵ13ĸѭת";
+ Text[ greek ] = " ROT13, 13 ";
+ Text[ korean ] = "ROT13 ˰, ؽƮ ĺ ڴ ĺ 13 ھ ڸ ̵մϴ.";
+ Text[ turkish ] = "ROT13 Algoritmi, metnin her alfabetik karakteri alfabe iinde 13 sra dndrlr.";
+ Text[ language_user1 ] = " ";
+ };
+
+ String ROT13_PAR1_NAME // Name of Parameter 1
+ {
+ Text = "Text" ;
+ Text [ english ] = "Text" ;
+ Text[ english_us ] = "Text";
+ Text[ portuguese ] = "Texto";
+ Text[ russian ] = "";
+ Text[ dutch ] = "Tekst";
+ Text[ french ] = "Texte";
+ Text[ spanish ] = "Texto";
+ Text[ italian ] = "Testo";
+ Text[ danish ] = "Tekst";
+ Text[ swedish ] = "Text";
+ Text[ polish ] = "Tekst";
+ Text[ portuguese_brazilian ] = "Text";
+ Text[ japanese ] = "";
+ Text[ chinese_simplified ] = "Text";
+ Text[ chinese_traditional ] = "";
+ Text[ arabic ] = "";
+ Text[ dutch ] = "Tekst";
+ Text[ chinese_simplified ] = "Text";
+ Text[ greek ] = "";
+ Text[ korean ] = "ؽƮ";
+ Text[ turkish ] = "Metin";
+ Text[ language_user1 ] = " ";
+ };
+
+ String ROT13_PAR1_DESC // Description of Parameter 1
+ {
+ Text = "Der Text der rotiert werden soll" ;
+ Text [ english ] = "the text which should be rotated" ;
+ Text[ english_us ] = "The text that is to be rotated";
+ Text[ portuguese ] = " o texto de rotao";
+ Text[ russian ] = ", ";
+ Text[ dutch ] = "de tekst die roteert";
+ Text[ french ] = "Le texte de rotation";
+ Text[ spanish ] = "El texto que debe rodar";
+ Text[ italian ] = "Il testo da ruotare";
+ Text[ danish ] = "Teksten, som skal roteres";
+ Text[ swedish ] = "Texten som skall roteras";
+ Text[ polish ] = "Tekst, ktry ma zosta obrcony";
+ Text[ portuguese_brazilian ] = "the text which should be rotated";
+ Text[ japanese ] = "JԂ÷";
+ Text[ chinese_simplified ] = "Ҫתı";
+ Text[ chinese_traditional ] = "n઺";
+ Text[ arabic ] = " ";
+ Text[ dutch ] = "de tekst die roteert";
+ Text[ chinese_simplified ] = "Ҫתı";
+ Text[ greek ] = " ";
+ Text[ korean ] = "ȸ Ǿ ؽƮ";
+ Text[ turkish ] = "Dndrlecek metin";
+ Text[ language_user1 ] = " ";
+ };
+};
+
+