Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <libxml/parser.h>
00024 #include <libxml/xmlwriter.h>
00025 #include <string>
00026 #include <vector>
00027 #include <gsf/gsf-utils.h>
00028 #include "ut_rand.h"
00029 #include "ut_jpeg.h"
00030 #include "ut_go_file.h"
00031 #include "ut_bytebuf.h"
00032 #include "png.h"
00033 #include "xap_Module.h"
00034 #include "xap_App.h"
00035 #include "xav_View.h"
00036 #include "ev_EditMethod.h"
00037 #include "ap_Args.h"
00038 #include <gsf/gsf-input.h>
00039
00040 using namespace std;
00041
00042 class abiword_garble;
00043
00044 class abiword_document {
00045
00046 private:
00047 string mFilename;
00048 xmlDocPtr mDocument;
00049 abiword_garble* mAbiGarble;
00050 size_t mCharsGarbled;
00051 size_t mImagesGarbled;
00052 string mReplaceString;
00053
00054 void garble_node( xmlNodePtr node );
00055 void garble_image_node( xmlNodePtr node );
00056 bool garble_png( void*& data, size_t& size );
00057 bool garble_jpeg( void*& data, size_t& size );
00058 void garble_image_line( char* line, size_t bytes );
00059 char get_random_char();
00060 public:
00061 abiword_document( abiword_garble* abigarble, const string& filename );
00062 ~abiword_document();
00063 void garble();
00064 void save();
00065 };
00066
00067 class abiword_garble {
00068
00069 private:
00070 vector<string> mFilenames;
00071 bool mVerbose;
00072 bool mInitialized;
00073 bool mImageGarbling;
00074
00075 void usage();
00076 public:
00077 abiword_garble( int argc, const char** argv );
00078 int run();
00079 bool verbose() const { return mVerbose; }
00080 bool initialized() const { return mInitialized; }
00081 bool image_garbling() const { return mImageGarbling; }
00082 };