--- psiconv/trunk/lib/psiconv/data.c 2004/03/08 23:20:41 240 +++ psiconv/trunk/lib/psiconv/data.c 2004/03/16 13:47:04 241 @@ -24,6 +24,7 @@ #include "data.h" #include "list.h" #include "unicode.h" +#include "error.h" #ifdef DMALLOC #include @@ -335,6 +336,33 @@ return psiconv_list_get(ss->styles,0xff - nr); } +int psiconv_find_style(const psiconv_word_styles_section ss, + const psiconv_ucs2 *name, + int *nr) +{ + const psiconv_ucs2 value_normal[] = { 'N','o','r','m','a','l',0 }; + psiconv_word_style style; + int i; + + if (!nr) + return PSICONV_E_OTHER; + if(!psiconv_unicode_strcmp(value_normal,name)) { + *nr = 0; + return 0; + } + for (i = 0; i < psiconv_list_length(ss->styles);i++) { + if (!(style = psiconv_list_get(ss->styles,i))) + return PSICONV_E_NOMEM; + if (!psiconv_unicode_strcmp(style->name,name)) { + *nr = 0xff - i; + return 0; + } + } + *nr = 0; + return PSICONV_E_OTHER; +} + + psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr) { return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1);