Classes | Defines | Functions | Variables

ie_imp_StarOffice.cpp File Reference

#include <memory.h>
#include "ut_compiler.h"
#include <gsf/gsf.h>
#include <gsf/gsf-input.h>
#include <gsf/gsf-input-stdio.h>
#include <gsf/gsf-utils.h>
#include <gsf/gsf-infile.h>
#include <gsf/gsf-infile-msole.h>
#include "ut_types.h"
#include "ut_std_string.h"
#include "ut_string.h"
#include "ut_iconv.h"
#include "ut_vector.h"
#include "ut_debugmsg.h"
#include "ut_units.h"
#include "pd_Document.h"
#include "ie_imp_StarOffice.h"
#include "ie_imp_StarOffice_encodings.h"
#include "docinfo.h"
#include "xap_App.h"
#include "xap_Dialog.h"
#include "xap_Frame.h"
#include "xap_Dlg_Password.h"
#include "xap_Dialog_Id.h"
#include "xap_DialogFactory.h"
#include "xap_Module.h"

Classes

struct  ColorData

Defines

#define ABI_BUILTIN_FAR_CALL   ABI_FAR_CALL
#define COLOR_SIZE   (sizeof(gColors)/sizeof(gColors[0]))
#define COL_NAME_USER   (0x8000)
#define COL_RED_1B   (0x0001)
#define COL_RED_2B   (0x0002)
#define COL_GREEN_1B   (0x0010)
#define COL_GREEN_2B   (0x0020)
#define COL_BLUE_1B   (0x0100)
#define COL_BLUE_2B   (0x0200)
#define GetPassword()   _getPassword ( XAP_App::getApp()->getLastFocussedFrame() )

Functions

std::string makeColor (UT_uint8 *aData, UT_uint32 aDataLen)
 Given a data pointer, returns a color string (like cccccc for a medium gray).
static double twipsToPoints (UT_uint32 aTwips)
static std::string twipsToSizeString (UT_uint32 aTwips)
void streamRead (GsfInput *aStream, TextAttr &aAttr, gsf_off_t aEoa) noexcept(false)
static std::string _getPassword (XAP_Frame *pFrame)
void readByteString (GsfInput *stream, char *&str, UT_uint16 *aLength) noexcept(false)
void readByteString (GsfInput *stream, UT_UCS4Char *&str, UT_iconv_t converter, SDWCryptor *cryptor) noexcept(false)
void readFlagRec (GsfInput *stream, UT_uint8 &flags, gsf_off_t *newPos) noexcept(false)
ABI_BUILTIN_FAR_CALL int abi_plugin_register (XAP_ModuleInfo *mi)
 Register the OpenDocument plugin.
ABI_BUILTIN_FAR_CALL int abi_plugin_unregister (XAP_ModuleInfo *mi)
 Unregister the OpenDocument plugin.
ABI_BUILTIN_FAR_CALL int abi_plugin_supports_version (UT_uint32, UT_uint32, UT_uint32)

Variables

static const ColorData gColors []
static char sTabAlignment []
static IE_SuffixConfidence IE_Imp_StarOffice_Sniffer__SuffixConfidence []
static IE_MimeConfidence IE_Imp_StarOffice_Sniffer__MimeConfidence []
static IE_Imp_StarOffice_Snifferm_impSniffer = 0

Define Documentation

#define ABI_BUILTIN_FAR_CALL   ABI_FAR_CALL
#define COL_BLUE_1B   (0x0100)
#define COL_BLUE_2B   (0x0200)
#define COL_GREEN_1B   (0x0010)
#define COL_GREEN_2B   (0x0020)
#define COL_NAME_USER   (0x8000)

Referenced by makeColor().

#define COL_RED_1B   (0x0001)
#define COL_RED_2B   (0x0002)
#define COLOR_SIZE   (sizeof(gColors)/sizeof(gColors[0]))

Referenced by makeColor().

#define GetPassword (  )     _getPassword ( XAP_App::getApp()->getLastFocussedFrame() )

Function Documentation

static std::string _getPassword ( XAP_Frame pFrame  )  [static]
ABI_BUILTIN_FAR_CALL int abi_plugin_register ( XAP_ModuleInfo mi  ) 
ABI_BUILTIN_FAR_CALL int abi_plugin_supports_version ( UT_uint32  ,
UT_uint32  ,
UT_uint32   
)
ABI_BUILTIN_FAR_CALL int abi_plugin_unregister ( XAP_ModuleInfo mi  ) 
std::string makeColor ( UT_uint8 aData,
UT_uint32  aDataLen 
)

Given a data pointer, returns a color string (like cccccc for a medium gray).

throws BOGUS_DOCUMENT on error.

References COL_NAME_USER, COLOR_SIZE, UT_DEBUGMSG, and UT_std_string_sprintf().

void readByteString ( GsfInput *  stream,
UT_UCS4Char *&  str,
UT_iconv_t  converter,
SDWCryptor cryptor = NULL 
)

Reads a bytestring from a stream and converts it to UCS-4. Optionally, it can also decrypt it.

Parameters:
stream The stream to read from
str The string where the bytestring should be stored
converter Iconv handle for charset conversion
cryptor (Optional) The cryptor used for decrypting the string

References readByteString(), UT_convert_cd(), and UT_DEBUGMSG.

void readByteString ( GsfInput *  stream,
char *&  str,
UT_uint16 aLength = NULL 
)

Reads a string from the file where the first uint16 contains the length. If it is zero-terminated, length must include the byte for termination. str must be delete[]'d, not free'd! aLength, if non-null, contains the length of the string in bytes.

References streamRead().

Referenced by SDWDocInfo::load(), readByteString(), and readPaddedByteString().

void readFlagRec ( GsfInput *  stream,
UT_uint8 flags,
gsf_off_t *  newPos = NULL 
)

Reads the header of a flag record from the stream

Parameters:
flags Flags (also contain the length in the 4 least significant bytes)
newPos (optional) Pointer to a variable where the position after the flags record is stored.

References flags, and streamRead().

Referenced by IE_Imp_StarOffice::_loadFile(), and streamRead().

void streamRead ( GsfInput *  aStream,
TextAttr aAttr,
gsf_off_t  aEoa 
)
static double twipsToPoints ( UT_uint32  aTwips  )  [static]

Referenced by twipsToSizeString().

static std::string twipsToSizeString ( UT_uint32  aTwips  )  [static]

Variable Documentation

const ColorData gColors[] [static]
Initial value:
 {
    { IE_MIME_MATCH_FULL,   "application/vnd.stardivision.writer",  UT_CONFIDENCE_GOOD  },  
    { IE_MIME_MATCH_FULL,   "application/x-staroffice-word",        UT_CONFIDENCE_GOOD  },  
    { IE_MIME_MATCH_FULL,   "application/x-staroffice-words",       UT_CONFIDENCE_GOOD  },
    { IE_MIME_MATCH_FULL,   "application/x-starwriter",             UT_CONFIDENCE_GOOD  },
    { IE_MIME_MATCH_BOGUS,  "",                                     UT_CONFIDENCE_ZILCH }
}
Initial value:
 {
    { "sdw",    UT_CONFIDENCE_PERFECT   },
    { "",   UT_CONFIDENCE_ZILCH     }
}
char sTabAlignment[] [static]
Initial value:
 {
  'L', 'R', 'D', 'C'
}