Changeset 338 for branches


Ignore:
Timestamp:
Mar 31, 2010, 9:54:16 PM (12 years ago)
Author:
dmik
Message:

branches/kmk: Poppler plugin: Take and return text field contents in UTF-8.

Location:
branches/kmk/Lucide/plugins
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/kmk/Lucide/plugins/ludoc/luitext.idl

    r319 r338  
    1111{
    1212    /**
    13      * Returns the contents of the text field.
     13     * Returns the contents of the text field as a zero-terminated UTF-8 string.
    1414     *
    1515     * To be overriden. By default, returns NULL.
     
    1818
    1919    /**
    20      * Sets the contents of the text field.
     20     * Sets the contents of the text field using a zero-terminated UTF-8 string.
    2121     *
    2222     * TO be overriden. By default, does nothing.
  • branches/kmk/Lucide/plugins/lupoppler/lupitext.cpp

    r326 r338  
    5454
    5555#include "lupitext.xih"
     56#include "cpconv.h"
    5657
    5758
     
    7576
    7677    somThis->widget = aFormWidgetText;
     78    somThis->contents = NULL;
    7779}
    7880
     
    8890    /* local LuPopplerInputField deinitialization code */
    8991
     92    delete[] somThis->contents;
     93
    9094    LuPopplerInputText_EndDestructor;
    9195}
     
    97101    LuPopplerInputTextData *somThis = LuPopplerInputTextGetData(somSelf);
    98102
    99     GooString *contents = somThis->widget->getContent();
    100     return contents->getCString();
     103    delete[] somThis->contents;
     104
     105    GooString *gooStr = somThis->widget->getContent();
     106    somThis->contents = uniUtf16BEToUtf8( gooStr->getCString(), gooStr->getLength(),
     107                                          NULL, NULL );
     108    return somThis->contents;
    101109}
    102110
     
    106114    LuPopplerInputTextData *somThis = LuPopplerInputTextGetData(somSelf);
    107115
    108     GooString *contents = new GooString(aContents);
    109     somThis->widget->setContent(contents);
     116    size_t len = 0;
     117    char *str = uniUtf8ToUtf16BE( aContents, NULL, NULL, &len );
     118    GooString *contents = new GooString( str, len );
     119    delete[] str;
     120    somThis->widget->setContent( contents );
    110121    delete contents;
    111122}
  • branches/kmk/Lucide/plugins/lupoppler/lupitext.idl

    r326 r338  
    3939
    4040        FormWidgetText widget;
     41        string contents;
    4142
    4243        passthru C_h_before =  ""
Note: See TracChangeset for help on using the changeset viewer.