# HG changeset patch # User pyon@macmini # Date 1599822387 -32400 # Node ID 49656dc400692a5d5619bd6701660cf119c01814 # Parent 058fb0a2cda8a0dded0ff4aec1f766bb637d91c5 add qtuti. diff -r 058fb0a2cda8 -r 49656dc40069 src/getexr/getexr.go --- a/src/getexr/getexr.go Fri Aug 14 03:31:29 2020 +0900 +++ b/src/getexr/getexr.go Fri Sep 11 20:06:27 2020 +0900 @@ -21,99 +21,99 @@ func main() { - version := flag.Bool( "v", false, "print version" ) - verbose := flag.Bool( "V", false, "verbose" ) - file := flag.String( "f", "usd.dat", "data file" ) + version := flag.Bool("v", false, "print version") + verbose := flag.Bool("V", false, "verbose") + file := flag.String("f", "usd.dat", "data file") flag.Parse() - if ( *version ) { - fmt.Fprintf( os.Stderr, "getexr - Get Exchange Rate [ version = %s ]\n", ver ) - os.Exit( 0 ) + if (*version) { + fmt.Fprintf(os.Stderr, "getexr - Get Exchange Rate [ version = %s ]\n", ver) + os.Exit(0) } t := time.Now() - now := t.Format( "2006-01-02 15:04:05" ) + now := t.Format("2006-01-02 15:04:05") // Get USD Rate - PrintVerbose( *verbose, "> get rate from yahoo..." ) + PrintVerbose(*verbose, "> get rate from yahoo...") url := "http://finance.yahoo.co.jp/" - resp, err := http.Get( url ) + resp, err := http.Get(url) if err != nil { - log.Fatal( err ) + log.Fatal(err) } - PrintVerbose( *verbose, "success\n" ) + PrintVerbose(*verbose, "success\n") - z := html.NewTokenizer( resp.Body ) - usd, err := ParseHtml( z ) + z := html.NewTokenizer(resp.Body) + usd, err := ParseHtml(z) if err != nil { - log.Fatal( err ) + log.Fatal(err) } defer resp.Body.Close() - PrintVerbose( *verbose, fmt.Sprintf( "> rate = %.2f\n", usd ) ) + PrintVerbose(*verbose, fmt.Sprintf("> rate = %.2f\n", usd)) - content, err := ioutil.ReadFile( *file ) + content, err := ioutil.ReadFile(*file) if err != nil { - log.Fatal( err ) + log.Fatal(err) } fc := 0 - buf1 := strings.Split( string( content ), "\n" ) + buf1 := strings.Split(string(content), "\n") // Compare Alert Rate - buf2 := strings.Split( buf1[ 0 ], "," ) + buf2 := strings.Split(buf1[ 0 ], ",") flg := buf2[0] - thr, _ := strconv.ParseFloat( buf2[1], 32 ) + thr, _ := strconv.ParseFloat(buf2[1], 32) - if ( strings.EqualFold( "H", flg ) && thr < usd ) { + if (strings.EqualFold("H", flg) && thr < usd) { fc = -1 - content = bytes.Replace( content, []byte( "H" ), []byte( "-" ), 1 ) - if err := AlertMail( "H", now, usd ); err != nil { - log.Fatal( err ) + content = bytes.Replace(content, []byte("H"), []byte("-"), 1) + if err := AlertMail("H", now, usd); err != nil { + log.Fatal(err) } - PrintVerbose( *verbose, "> rate higher.\n> sending alert mail.\n" ) + PrintVerbose(*verbose, "> rate higher.\n> sending alert mail.\n") - } else if ( strings.EqualFold( "L", flg ) && thr > usd ) { + } else if (strings.EqualFold("L", flg) && thr > usd) { fc = -1 - content = bytes.Replace( content, []byte( "L" ), []byte( "-" ), 1 ) - if err := AlertMail( "L", now, usd ); err != nil { - log.Fatal( err ) + content = bytes.Replace(content, []byte("L"), []byte("-"), 1) + if err := AlertMail("L", now, usd); err != nil { + log.Fatal(err) } - PrintVerbose( *verbose, "> rate lower.\n> sending alert mail.\n" ) + PrintVerbose(*verbose, "> rate lower.\n> sending alert mail.\n") } // Compare Past Rate - buf2 = strings.Split( buf1[ len( buf1 ) - 2 ], "," ) + buf2 = strings.Split(buf1[ len(buf1) - 2 ], ",") ymd0 := buf2[0] - usd0, _ := strconv.ParseFloat( buf2[1], 32 ) + usd0, _ := strconv.ParseFloat(buf2[1], 32) - if ( math.Abs( usd0 - usd ) > 1.0 ) { + if (math.Abs(usd0 - usd) > 1.0) { fc = 1 // Post E-mail - PrintVerbose( *verbose, "> sending notify mail.\n" ) - if err := NotifyMail( now, usd, ymd0, usd0 ); err != nil { - log.Fatal( err ) + PrintVerbose(*verbose, "> sending notify mail.\n") + if err := NotifyMail(now, usd, ymd0, usd0); err != nil { + log.Fatal(err) } - PrintVerbose( *verbose, "> rate changed.\n" ) + PrintVerbose(*verbose, "> rate changed.\n") } else { - PrintVerbose( *verbose, "> not changed.\n" ) + PrintVerbose(*verbose, "> not changed.\n") } // Save Rate - if ( fc != 0 ) { - if ( fc == 1 ) { - buf := fmt.Sprintf( "%s,%.2f\n", now, usd ) - content = append( content, buf... ) + if (fc != 0) { + if (fc == 1) { + buf := fmt.Sprintf("%s,%.2f\n", now, usd) + content = append(content, buf...) } - if err := ioutil.WriteFile( *file, content, 0777 ); err != nil { - log.Fatal( err ) + if err := ioutil.WriteFile(*file, content, 0777); err != nil { + log.Fatal(err) } - PrintVerbose( *verbose, "> data file overwrited.\n" ) + PrintVerbose(*verbose, "> data file overwrited.\n") } - PrintVerbose( *verbose, "> finish.\n" ) + PrintVerbose(*verbose, "> finish.\n") } -func ParseHtml( z *html.Tokenizer ) ( float64, error ) { +func ParseHtml(z *html.Tokenizer) (float64, error) { for { tt := z.Next() switch tt { @@ -123,59 +123,59 @@ case html.StartTagToken: tag, _ := z.TagName() key, val, _ := z.TagAttr() - if string( tag ) == "strong" && string( key ) == "class" && string( val ) == "bkLine" { + if string(tag) == "strong" && string(key) == "class" && string(val) == "bkLine" { z.Next() - //fmt.Printf( "%s %s %s\n", key, val, z.Token() ) - return strconv.ParseFloat( z.Token().String(), 32 ) + //fmt.Printf("%s %s %s\n", key, val, z.Token()) + return strconv.ParseFloat(z.Token().String(), 32) } } } } -func NotifyMail( now string, usd float64, old string, usd0 float64 ) error { +func NotifyMail(now string, usd float64, old string, usd0 float64) error { address := "muty@willcom.com" msg := "To: " + address + "\r\n" + "Subject: Exchange-Mail\r\n" + "\r\n" + "rate changed\r\n" + now + "\r\n" + - fmt.Sprintf( "[ USD/JPY : %.2f ].", usd ) + "\r\n\r\n" + + fmt.Sprintf("[ USD/JPY : %.2f ].", usd) + "\r\n\r\n" + old + "\r\n" + - fmt.Sprintf( "[ USD/JPY : %.2f ].", usd0 ) + "\r\n" // mail body - if err := SendMail( address, msg ); err != nil { + fmt.Sprintf("[ USD/JPY : %.2f ].", usd0) + "\r\n" // mail body + if err := SendMail(address, msg); err != nil { return err } return nil } -func AlertMail( flg, now string, usd float64 ) error { +func AlertMail(flg, now string, usd float64) error { address := "muty@willcom.com" msg := "To: " + address + "\r\n" + "Subject: Exchange-Mail\r\n" + "\r\n" + "rate changed\r\n" + now + "\r\n" + - fmt.Sprintf( "[ USD/JPY : %.2f ].", usd ) + "\r\n" // mail body - if err := SendMail( address, msg ); err != nil { + fmt.Sprintf("[ USD/JPY : %.2f ].", usd) + "\r\n" // mail body + if err := SendMail(address, msg); err != nil { return err } return nil } -func SendMail( address, msg string ) error { +func SendMail(address, msg string) error { hostname := "sdm.sakura.ne.jp" - auth := smtp.PlainAuth( "", "bad_user@sdm.sakura.ne.jp", "hogehoge3", hostname ) + auth := smtp.PlainAuth("", "bad_user@sdm.sakura.ne.jp", "hogehoge3", hostname) to := []string{ address } - err := smtp.SendMail( hostname + ":587", auth, "bad_user@sdm.sakura.ne.jp", to, []byte( msg ) ) + err := smtp.SendMail(hostname + ":587", auth, "bad_user@sdm.sakura.ne.jp", to, []byte(msg)) if err != nil { return err } return nil } -func PrintVerbose( y bool, msg string ) { +func PrintVerbose(y bool, msg string) { if y { - fmt.Fprintf( os.Stderr, msg ) + fmt.Fprintf(os.Stderr, msg) } } diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/95.go --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/95.go Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,653 @@ +/* + 95.go: Qfuhi Tsuchi + + Last Change: 2020-09-11 金 10:42:16. +*/ + +package main + +/* +#cgo LDFLAGS: -L. -lxdwapi -static +// +// 95.cpp: Qfuhi Tsuchi +// Last Change: 2020-09-08 火 15:20:43. +// + +#include +#include +#include +#include +#include +#include +#include + +#define MAXCOL 1024 +#define MAXLINE 9999 +#define BLOCKSZ 128 +#define ATN_N 20 + +char* xdw2txt(const char* file) { + char in_path[_MAX_PATH]; + _fullpath(in_path, file, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; // 文書ハンドルを開く + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE}; + if (XDW_OpenDocumentHandle(in_path, &h, (XDW_OPEN_MODE*)&mode)) { + fprintf(stderr, "Error: cannot open %s\n", file); + return NULL; + } + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; // 総ページ数を得る + XDW_GetDocumentInformation(h, &info); + int nPage = info.nPages; + + // メイン処理 + char *lpszvalue, *all_lpszvalue; + long datasize[9999]; + for (int i=1; i<=nPage; i++) { + datasize[i] = XDW_GetPageTextToMemory(h, i, NULL, 0, NULL); + datasize[0] += datasize[i]; + } + datasize[0] += nPage - 1; // for "\n" + all_lpszvalue = (char*)malloc(sizeof(char)*datasize[0]); + all_lpszvalue[0] = '\0'; + for (int i = 1; i <= nPage; i++) { + if (i < nPage) datasize[i]++; // for "\n" + lpszvalue = (char*)malloc(sizeof(char)*(datasize[i])); + XDW_GetPageTextToMemory(h, i, lpszvalue, datasize[i], NULL); + strcat(all_lpszvalue, lpszvalue); + if (i < nPage) strcat(all_lpszvalue, "\n"); + free(lpszvalue); + } + + XDW_CloseDocumentHandle(h, NULL); // 文書ハンドルを閉じる + return all_lpszvalue; +} + +void xdw2txtb(const char* xdwfile, const char* txtfile) { + char in_path[_MAX_PATH], out_path[_MAX_PATH]; + _fullpath(in_path, xdwfile, _MAX_PATH); + _fullpath(out_path, txtfile, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; // 文書ハンドルを開く + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE}; + if (XDW_OpenDocumentHandle(in_path, &h, (XDW_OPEN_MODE*)&mode)) { + fprintf(stderr, "Error: cannot open %s\n", xdwfile); + return; + } + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; // 総ページ数を得る + XDW_GetDocumentInformation(h, &info); + int nPage = info.nPages; + + FILE *fp; + if ((fp = fopen(out_path, "w")) == NULL) { + fprintf(stderr, "Error: cannot open %s\n", out_path); + return; + } + + long datasize; + char* lpszvalue; + + for (int i = 1; i <= nPage; i++) { + datasize = XDW_GetPageTextToMemory(h, i, NULL, 0, NULL); + lpszvalue = (char*)malloc(sizeof(char)*datasize); + XDW_GetPageTextToMemory(h, i, lpszvalue, datasize, NULL); + fprintf(fp, "%s\n", lpszvalue); + free(lpszvalue); + } + + fclose(fp); + XDW_CloseDocumentHandle(h, NULL); // 文書ハンドルを閉じる + return; +} + +int xdwsplit1(const char* file, const char* workdir, const char* prefix) { + char file_path[_MAX_PATH]; + _fullpath(file_path, file, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE}; + if (XDW_OpenDocumentHandle(file_path, &h, (XDW_OPEN_MODE*)&mode)) { + fprintf(stderr, "Error: cannot open %s\n", file); + return -1; + } + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; + XDW_GetDocumentInformation(h, &info); + int nPage = info.nPages; + + char buf[_MAX_PATH]; + for (int i = 1; i <= nPage; i++) { + sprintf(buf, "%s/%s%05d.xdw", workdir, prefix, i); + //sprintf(buf, "%s_%05d.xdw", prefix, i); + _fullpath(file_path, buf, _MAX_PATH); + + int api_result = XDW_GetPage(h, i, file_path, NULL); + if (api_result < 0) { + fprintf(stderr, "XDW Error: cannot get page (%s p=%d)\n", file, i); + return -1; + } + } + + XDW_CloseDocumentHandle(h, NULL); + return 0; +} + +int xdwextpage(const char* infile, const int p, const char* outfile) { + char file_path[_MAX_PATH]; + _fullpath(file_path, infile, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE}; + if (XDW_OpenDocumentHandle(file_path, &h, (XDW_OPEN_MODE*)&mode)) { + fprintf(stderr, "Error: cannot open %s\n", infile); + return -1; + } + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; + XDW_GetDocumentInformation(h, &info); + int nPage = info.nPages; + + char buf[_MAX_PATH]; + _fullpath(file_path, outfile, _MAX_PATH); + + int api_result = XDW_GetPage(h, p, file_path, NULL); + if (api_result < 0) { + fprintf(stderr, "XDW Error: cannot get page (%s p=%d)\n", infile, p); + return -1; + } + + XDW_CloseDocumentHandle(h, NULL); + return 0; +} + +void xdwmerge(const char* list, const char* output) { + FILE *fp; + + if ((fp = fopen(list, "r")) == NULL) { + fprintf(stderr, "XDW Error: can't open file [%s]\n", list); + exit(1); + } + + char *all_path = (char*)malloc(MAXLINE * sizeof(char) * _MAX_PATH); + + if (all_path == NULL) { + fprintf(stderr, "XDW Error: can't allocate memory\n"); + exit(1); + } + + int n = 0; + char *q; + char buf[_MAX_PATH]; + + while (fgets(buf, sizeof buf, fp)) { + if ((q = strchr(buf, '\n')) != NULL) { + *q = '\0'; + } + _fullpath(buf, buf, _MAX_PATH); + strncpy(&all_path[n * _MAX_PATH], buf, _MAX_PATH); + n++; + } + fclose(fp); + + char *blk_path = (char*)malloc(BLOCKSZ * sizeof(char) * _MAX_PATH); + const char **blk_path_addr = (const char**)malloc((n / BLOCKSZ + 1) * sizeof(char*) * _MAX_PATH); + if (blk_path == NULL || blk_path_addr == NULL) { + fprintf(stderr, "XDW Error: can't allocate memory\n"); + exit(1); + } + + // process by block + int api_result; + int bn = 0; + for (int p = 0, m = 0; p < n; p++) { + m = p % BLOCKSZ; + if (m == 0 && p > 0) { + sprintf(buf, "tmp_b%04d.xdw", ++bn); + _fullpath(buf, buf, _MAX_PATH); + api_result = XDW_MergeXdwFiles(blk_path_addr, BLOCKSZ, buf, NULL); + if (api_result < 0) { + fprintf(stderr, "XDW Error: can't merge [1] (p = %d, m = %d)\n", p, m); + exit(1); + } + } + strncpy(&blk_path[m * _MAX_PATH], &all_path[p * _MAX_PATH], _MAX_PATH); + blk_path_addr[m] = &blk_path[m * _MAX_PATH]; + } + + sprintf(buf, "tmp_b%04d.xdw", ++bn); + _fullpath(buf, buf, _MAX_PATH); + + int mod = n % BLOCKSZ; + if (mod == 0) mod = BLOCKSZ; + api_result = XDW_MergeXdwFiles(blk_path_addr, mod, buf, NULL); + + if (api_result < 0) { + fprintf(stderr, "XDW Error: can't merge [2]\n"); + exit(1); + } + + // merge blocks + for (int b = 0; b < bn; b++) { + sprintf(buf, "tmp_b%04d.xdw", b + 1); + _fullpath(buf, buf, _MAX_PATH); + strncpy(&blk_path[b * _MAX_PATH], buf, _MAX_PATH); + blk_path_addr[b] = &blk_path[b * _MAX_PATH]; + } + + _fullpath(buf, output, _MAX_PATH ); + api_result = XDW_MergeXdwFiles(blk_path_addr, bn, buf, NULL); + + if (api_result < 0) { + fprintf(stderr, "XDW Error: can't merge [3]\n"); + exit(1); + } + + free(all_path); + free(blk_path); + free(blk_path_addr); + + for (int b = 0; b < bn; b++) { + sprintf(buf, "tmp_b%04d.xdw", b + 1); + _fullpath(buf, buf, _MAX_PATH); + remove(buf); + } +} + +int xdwaddatn(const char* xdwfile, const char* atnfile) { + FILE *fp; + char filepath[_MAX_PATH]; + _fullpath(filepath, atnfile, _MAX_PATH); + + if ((fp = fopen(filepath, "r")) == NULL) { + fprintf(stderr, "Error: cannot open %s\n", filepath); + return -1; + } + + char keyword[128]; + char *q; + fgets(keyword, sizeof keyword, fp); + if ((q = strchr(keyword, '\n')) != NULL) { + *q = '\0'; + } + + char buf[_MAX_PATH]; + int x[ATN_N], y[ATN_N], sz[ATN_N], tr[ATN_N]; + char txt[ATN_N][256]; + int an = 0; + while (fgets(buf, sizeof buf, fp)) { + if ((q = strchr(buf, '\n')) != NULL) { + *q = '\0'; + } + + x[an] = atoi(strtok(buf, ",")); + y[an] = atoi(strtok(NULL, ",")); + sz[an] = atoi(strtok(NULL, ",")); + tr[an] = atoi(strtok(NULL, ",")); + strcpy(txt[an], strtok(NULL, ",")); + an++; + //printf("x=%d y=%d txt=%s sz=%d tr=%d\n", x[an], y[an], txt[an], sz[an], tr[an]); + } + fclose(fp); + + + XDW_DOCUMENT_HANDLE h = NULL; + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_UPDATE, XDW_AUTH_NODIALOGUE}; + + _fullpath(filepath, xdwfile, _MAX_PATH); + int api_result = XDW_OpenDocumentHandle(filepath, &h, (XDW_OPEN_MODE*)&mode); + if (api_result < 0) return api_result; + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; + XDW_GetDocumentInformation(h, &info); + XDW_FOUND_HANDLE pFoundHandle = NULL; + for (int i = 0; i < info.nPages; i++) { + if (keyword[0] != '\0') { + api_result = XDW_FindTextInPage(h, i + 1, keyword, NULL, &pFoundHandle, NULL); + if (!pFoundHandle) { + XDW_CloseFoundHandle(pFoundHandle); + continue; + } + XDW_CloseFoundHandle(pFoundHandle); + } + for (int j = 0; j < an; j++ ) { + XDW_ANNOTATION_HANDLE annoation; + int api_result = XDW_AddAnnotation(h, XDW_AID_TEXT, i + 1, x[j], y[j], NULL, &annoation, NULL); + if (api_result < 0) return api_result; + + api_result = XDW_SetAnnotationAttribute(h, annoation, XDW_ATN_Text, XDW_ATYPE_STRING, txt[j], 0, NULL); + api_result = XDW_SetAnnotationAttribute(h, annoation, XDW_ATN_FontSize, XDW_ATYPE_INT, (char*)&sz[j], 0, NULL); + + int color = XDW_COLOR_WHITE; + if (tr[j]) { + color = XDW_COLOR_NONE; + } + api_result = XDW_SetAnnotationAttribute(h, annoation, XDW_ATN_BackColor, XDW_ATYPE_INT, (char*)&color, 0, NULL); + } + } + + XDW_SaveDocument(h, NULL); + XDW_CloseDocumentHandle(h, NULL); + + return 0; +} + +int xdwaddatntool(const char* xdwfile, const char* toolfile, int n, int x, int y) { + char filepath[_MAX_PATH]; + _fullpath(filepath, xdwfile, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_UPDATE, XDW_AUTH_NODIALOGUE}; + + int api_result = XDW_OpenDocumentHandle(filepath, &h, (XDW_OPEN_MODE*)&mode); + if (api_result < 0) return api_result; + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; + XDW_GetDocumentInformation(h, &info); + + _fullpath(filepath, toolfile, _MAX_PATH); + for (int i = 0; i < info.nPages; i++) { + XDW_ANNOTATION_HANDLE annoation; + int api_result = XDW_AddAnnotationFromAnnFile(h, filepath, n, i + 1, NULL, x, y, &annoation, NULL); + } + + XDW_SaveDocument(h, NULL); + XDW_CloseDocumentHandle(h, NULL); + + return 0; +} + + +*/ +import "C" + +import ( + "bufio" + "regexp" + "encoding/json" + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "path/filepath" + "sort" + "strings" + + "golang.org/x/text/encoding/japanese" + "golang.org/x/text/transform" +) + +type Hhs struct { + No string + Name string + Page int // sinsei page + Tsuchi bool + Kaigo string + Xdw []string +} + +func(h *Hhs) AppendXdw(xdw string) { + h.Xdw = append(h.Xdw, xdw) +} + +func(h *Hhs) CsvString() string { + q := "" + if h.Tsuchi { + q = "○" + } + k := strings.Split(h.Kaigo, "") + return strings.Join([]string{h.No, h.Name, q, k[1] + k[3]}, ",") +} + +func(h *Hhs) Dump() string { + q := "false" + if h.Tsuchi { + q = "true" + } + p := fmt.Sprintf("%05d", h.Page) + x := strings.Join(h.Xdw, ",") + return strings.Join([]string{h.No, h.Name, q, h.Kaigo, p, x}, ",") +} + +type Config struct { + Indir string + Outdir string + Workdir string + Hhsdb string + Atnfile[] string +} + +var ( + ver = "0.1" + conf Config + confjson = "95.json" + logfile = "95.log" + osirase = "KBPA316G.xdw" + sinsei = "KBPA406G.xdw" + rule_s = "rules.ann" + + out_o = "o.xdw" + out_s = "s.xdw" + out_q = "q.xdw" + out_l = "l.csv" + + re_hhsno, re_name, re_kaigo *regexp.Regexp + + // option parameters + version bool +) + +func init() { + /* コンフィグファイルは JSON */ + content, err := ioutil.ReadFile(confjson) + if err != nil { + log.Fatal(err) + } + if err := json.Unmarshal(content, &conf); err != nil { + log.Fatal(err) + } + + osirase = filepath.Join(conf.Indir, osirase) + sinsei = filepath.Join(conf.Indir, sinsei) + + out_o = filepath.Join(conf.Outdir, out_o) + out_s = filepath.Join(conf.Outdir, out_s) + out_q = filepath.Join(conf.Outdir, out_q) + out_l = filepath.Join(conf.Outdir, out_l) + + logfile = filepath.Join(conf.Workdir, logfile) + + /* 一時ファイル消去 */ + os.RemoveAll(conf.Outdir) + os.RemoveAll(conf.Workdir) + os.Mkdir(conf.Outdir, 0755) + os.Mkdir(conf.Workdir, 0755) + + /* 変数初期化 */ + re_hhsno = regexp.MustCompile(`0[1238]00\d{6}`) + re_name = regexp.MustCompile(`日.{30}`) + re_kaigo = regexp.MustCompile(`要((介護)|(支援)).`) + + flag.BoolVar(&version, "v", false, "print version") +} + +func main() { + flag.Parse() + + if version { + fmt.Println("95 - version", ver) + os.Exit(0) + } + + hash_Hhs := make(map[string]Hhs) + + /* 申請書を漁り,構造体を初期化 */ + for p, t := range xdw2txt(sinsei) { + hno := re_hhsno.FindString(t) + name := re_name.FindString(t) + name = strings.Replace(name, "日", "", 1) + kaigo := re_kaigo.FindString(t) + o := fmt.Sprintf("o_%05d.xdw", p + 1) + s := fmt.Sprintf("s_%05d.xdw", p + 1) + h := Hhs{No: hno, Name: name, Kaigo: kaigo, Page:p + 1, Xdw: []string{o, s}} + hash_Hhs[hno] = h + } + + /* バックグラウンドで給付費通知から勧奨対象者を抽出 */ + ch := make(chan int) + go func() { + files, err := ioutil.ReadDir(conf.Indir) + if err != nil { + log.Fatal(err) + } + + qn := 1 + for _, file := range files { + if !strings.HasSuffix(file.Name(), ".xdw") { + continue + } + if strings.HasPrefix(file.Name(), "KDPK016G") || strings.HasPrefix(file.Name(), "KDPK126G") { + qtsuchi := filepath.Join(conf.Indir, file.Name()) + tmptxt := filepath.Join(conf.Workdir, "tmp95.txt") + for p, t := range xdw2txtb(qtsuchi, tmptxt) { + hno := re_hhsno.FindString(t) + if h, ok := hash_Hhs[hno]; ok { + h.Tsuchi = true + q := fmt.Sprintf("q_%05d.xdw", qn) + h.AppendXdw(q) + hash_Hhs[hno] = h + q = filepath.Join(conf.Workdir, q) + C.xdwextpage(C.CString(qtsuchi), C.int(p + 1), C.CString(q)) + qn++ + //fmt.Println(qtsuchi, p, hno, h.Kaigo, h.Xdw) + } + } + } + } + + ch <- 1 + }() + + /* そのあいだにバラす */ + C.xdwsplit1(C.CString(osirase), C.CString(conf.Workdir), C.CString("o_")) + C.xdwsplit1(C.CString(sinsei), C.CString(conf.Workdir), C.CString("s_")) + <-ch + + /* ソート & マージ */ + var slice_Hhs []Hhs + for _, h := range hash_Hhs { + slice_Hhs = append(slice_Hhs, h) + } + sort.Slice(slice_Hhs, func(i, j int) bool { + if slice_Hhs[i].Tsuchi != slice_Hhs[j].Tsuchi { + return slice_Hhs[i].Tsuchi + } + if slice_Hhs[i].Kaigo != slice_Hhs[j].Kaigo { + return slice_Hhs[i].Kaigo < slice_Hhs[j].Kaigo + } + if slice_Hhs[i].Page != slice_Hhs[j].Page { + return slice_Hhs[i].Page < slice_Hhs[j].Page + } + return false + }) + + var list_o, list_s, list_q []string + for _, h := range slice_Hhs { + list_o = append(list_o, filepath.Join(conf.Workdir, h.Xdw[0])) + list_s = append(list_s, filepath.Join(conf.Workdir, h.Xdw[1])) + if h.Tsuchi { + for i, x := range h.Xdw { + if i > 1 { + buf := filepath.Join(conf.Workdir, x) + list_q = append(list_q, buf) + } + } + } + } + xdwmerge(list_o, out_o) + xdwmerge(list_s, out_s) + xdwmerge(list_q, out_q) + + /* リスト出力 & ログダンプ */ + csvtxt := "" + logtxt := "" + for _, h := range slice_Hhs { + csvtxt += h.CsvString() + "\n" + logtxt += h.Dump() + "\n" + } + csvtxt, _, _ = transform.String(japanese.ShiftJIS.NewEncoder(), csvtxt) + if err := ioutil.WriteFile(out_l, []byte(csvtxt), 0644); err != nil { + log.Fatal(err) + } + if err := ioutil.WriteFile(logfile, []byte(logtxt), 0644); err != nil { + log.Fatal(err) + } + + /* バックグラウンドで給付費通知を校正 */ + ch2 := make(chan int) + go func() { + for _, a := range conf.Atnfile { + xdwaddatn(out_q, a) + } + ch2 <- 1 + } () + + /* そのあいだに申請書に枠付け */ + xdwaddatntool(out_s, rule_s, 2, 1497, 803) + <-ch2 +} + +func xdw2txt(file string) (txt []string) { + s := C.GoString(C.xdw2txt(C.CString(file))) + r := strings.NewReader(s) + tr := transform.NewReader(r, japanese.ShiftJIS.NewDecoder()) + buf := bufio.NewScanner(tr) + for buf.Scan() { + txt = append(txt, buf.Text()) + } + return +} + +func xdw2txtb(xdwfile, txtfile string) (txt []string) { + if _, err := os.Stat(txtfile); os.IsExist(err) { + os.Remove(txtfile) + } + + C.xdw2txtb(C.CString(xdwfile), C.CString(txtfile)) + content, err := ioutil.ReadFile(txtfile) + if err != nil { + return nil + } + + r := strings.NewReader(string(content)) + tr := transform.NewReader(r, japanese.ShiftJIS.NewDecoder()) + buf := bufio.NewScanner(tr) + for buf.Scan() { + txt = append(txt, buf.Text()) + } + return +} + +func xdwmerge(list []string, outfile string) (err error) { + order := strings.Join(list, "\n") + order, _, _ = transform.String(japanese.ShiftJIS.NewEncoder(), order) + orderfile := filepath.Join(conf.Workdir, "order95.txt") + if err := ioutil.WriteFile(orderfile, []byte(order), 0644); err != nil { + return err + } + C.xdwmerge(C.CString(orderfile), C.CString(outfile)) + return nil +} + +func xdwaddatn(xdwfile, atnfile string) (err error) { + C.xdwaddatn(C.CString(xdwfile), C.CString(atnfile)) + return nil +} + +func xdwaddatntool(xdwfile, toolfile string, n, x, y int) (err error) { + C.xdwaddatntool(C.CString(xdwfile), C.CString(toolfile), C.int(n), C.int(x), C.int(y)) + return nil +} + diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/95.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/95.json Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,12 @@ +{ + "Indir": "input", + "Outdir": "output", + "Workdir": "work", + "Hhsdb": "hhsdb.txt", + "Atnfile": [ + "all.atn", + "kaigoq.atn", + "sougouq.atn" + ] +} + diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/95_tmpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/95_tmpl.cpp Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,350 @@ +// +// 95.cpp: Qfuhi Tsuchi +// Last Change: 2020-09-08 火 15:20:43. +// + +#include +#include +#include +#include +#include +#include +#include + +#define MAXCOL 1024 +#define MAXLINE 9999 +#define BLOCKSZ 128 +#define ATN_N 20 + +char* xdw2txt(const char* file) { + char in_path[_MAX_PATH]; + _fullpath(in_path, file, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; // 文書ハンドルを開く + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE}; + if (XDW_OpenDocumentHandle(in_path, &h, (XDW_OPEN_MODE*)&mode)) { + fprintf(stderr, "Error: cannot open %s\n", file); + return NULL; + } + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; // 総ページ数を得る + XDW_GetDocumentInformation(h, &info); + int nPage = info.nPages; + + // メイン処理 + char *lpszvalue, *all_lpszvalue; + long datasize[9999]; + for (int i=1; i<=nPage; i++) { + datasize[i] = XDW_GetPageTextToMemory(h, i, NULL, 0, NULL); + datasize[0] += datasize[i]; + } + datasize[0] += nPage - 1; // for "\n" + all_lpszvalue = (char*)malloc(sizeof(char)*datasize[0]); + all_lpszvalue[0] = '\0'; + for (int i = 1; i <= nPage; i++) { + if (i < nPage) datasize[i]++; // for "\n" + lpszvalue = (char*)malloc(sizeof(char)*(datasize[i])); + XDW_GetPageTextToMemory(h, i, lpszvalue, datasize[i], NULL); + strcat(all_lpszvalue, lpszvalue); + if (i < nPage) strcat(all_lpszvalue, "\n"); + free(lpszvalue); + } + + XDW_CloseDocumentHandle(h, NULL); // 文書ハンドルを閉じる + return all_lpszvalue; +} + +void xdw2txtb(const char* xdwfile, const char* txtfile) { + char in_path[_MAX_PATH], out_path[_MAX_PATH]; + _fullpath(in_path, xdwfile, _MAX_PATH); + _fullpath(out_path, txtfile, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; // 文書ハンドルを開く + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE}; + if (XDW_OpenDocumentHandle(in_path, &h, (XDW_OPEN_MODE*)&mode)) { + fprintf(stderr, "Error: cannot open %s\n", xdwfile); + return; + } + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; // 総ページ数を得る + XDW_GetDocumentInformation(h, &info); + int nPage = info.nPages; + + FILE *fp; + if ((fp = fopen(out_path, "w")) == NULL) { + fprintf(stderr, "Error: cannot open %s\n", out_path); + return; + } + + long datasize; + char* lpszvalue; + + for (int i = 1; i <= nPage; i++) { + datasize = XDW_GetPageTextToMemory(h, i, NULL, 0, NULL); + lpszvalue = (char*)malloc(sizeof(char)*datasize); + XDW_GetPageTextToMemory(h, i, lpszvalue, datasize, NULL); + fprintf(fp, "%s\n", lpszvalue); + free(lpszvalue); + } + + fclose(fp); + XDW_CloseDocumentHandle(h, NULL); // 文書ハンドルを閉じる + return; +} + +int xdwsplit1(const char* file, const char* workdir, const char* prefix) { + char file_path[_MAX_PATH]; + _fullpath(file_path, file, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE}; + if (XDW_OpenDocumentHandle(file_path, &h, (XDW_OPEN_MODE*)&mode)) { + fprintf(stderr, "Error: cannot open %s\n", file); + return -1; + } + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; + XDW_GetDocumentInformation(h, &info); + int nPage = info.nPages; + + char buf[_MAX_PATH]; + for (int i = 1; i <= nPage; i++) { + sprintf(buf, "%s/%s%05d.xdw", workdir, prefix, i); + //sprintf(buf, "%s_%05d.xdw", prefix, i); + _fullpath(file_path, buf, _MAX_PATH); + + int api_result = XDW_GetPage(h, i, file_path, NULL); + if (api_result < 0) { + fprintf(stderr, "XDW Error: cannot get page (%s p=%d)\n", file, i); + return -1; + } + } + + XDW_CloseDocumentHandle(h, NULL); + return 0; +} + +int xdwextpage(const char* infile, const int p, const char* outfile) { + char file_path[_MAX_PATH]; + _fullpath(file_path, infile, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE}; + if (XDW_OpenDocumentHandle(file_path, &h, (XDW_OPEN_MODE*)&mode)) { + fprintf(stderr, "Error: cannot open %s\n", infile); + return -1; + } + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; + XDW_GetDocumentInformation(h, &info); + int nPage = info.nPages; + + char buf[_MAX_PATH]; + _fullpath(file_path, outfile, _MAX_PATH); + + int api_result = XDW_GetPage(h, p, file_path, NULL); + if (api_result < 0) { + fprintf(stderr, "XDW Error: cannot get page (%s p=%d)\n", infile, p); + return -1; + } + + XDW_CloseDocumentHandle(h, NULL); + return 0; +} + +void xdwmerge(const char* list, const char* output) { + FILE *fp; + + if ((fp = fopen(list, "r")) == NULL) { + fprintf(stderr, "XDW Error: can't open file [%s]\n", list); + exit(1); + } + + char *all_path = (char*)malloc(MAXLINE * sizeof(char) * _MAX_PATH); + + if (all_path == NULL) { + fprintf(stderr, "XDW Error: can't allocate memory\n"); + exit(1); + } + + int n = 0; + char *q; + char buf[_MAX_PATH]; + + while (fgets(buf, sizeof buf, fp)) { + if ((q = strchr(buf, '\n')) != NULL) { + *q = '\0'; + } + _fullpath(buf, buf, _MAX_PATH); + strncpy(&all_path[n * _MAX_PATH], buf, _MAX_PATH); + n++; + } + fclose(fp); + + char *blk_path = (char*)malloc(BLOCKSZ * sizeof(char) * _MAX_PATH); + const char **blk_path_addr = (const char**)malloc((n / BLOCKSZ + 1) * sizeof(char*) * _MAX_PATH); + if (blk_path == NULL || blk_path_addr == NULL) { + fprintf(stderr, "XDW Error: can't allocate memory\n"); + exit(1); + } + + // process by block + int api_result; + int bn = 0; + for (int p = 0, m = 0; p < n; p++) { + m = p % BLOCKSZ; + if (m == 0 && p > 0) { + sprintf(buf, "tmp_b%04d.xdw", ++bn); + _fullpath(buf, buf, _MAX_PATH); + api_result = XDW_MergeXdwFiles(blk_path_addr, BLOCKSZ, buf, NULL); + if (api_result < 0) { + fprintf(stderr, "XDW Error: can't merge [1] (p = %d, m = %d)\n", p, m); + exit(1); + } + } + strncpy(&blk_path[m * _MAX_PATH], &all_path[p * _MAX_PATH], _MAX_PATH); + blk_path_addr[m] = &blk_path[m * _MAX_PATH]; + } + + sprintf(buf, "tmp_b%04d.xdw", ++bn); + _fullpath(buf, buf, _MAX_PATH); + + int mod = n % BLOCKSZ; + if (mod == 0) mod = BLOCKSZ; + api_result = XDW_MergeXdwFiles(blk_path_addr, mod, buf, NULL); + + if (api_result < 0) { + fprintf(stderr, "XDW Error: can't merge [2]\n"); + exit(1); + } + + // merge blocks + for (int b = 0; b < bn; b++) { + sprintf(buf, "tmp_b%04d.xdw", b + 1); + _fullpath(buf, buf, _MAX_PATH); + strncpy(&blk_path[b * _MAX_PATH], buf, _MAX_PATH); + blk_path_addr[b] = &blk_path[b * _MAX_PATH]; + } + + _fullpath(buf, output, _MAX_PATH ); + api_result = XDW_MergeXdwFiles(blk_path_addr, bn, buf, NULL); + + if (api_result < 0) { + fprintf(stderr, "XDW Error: can't merge [3]\n"); + exit(1); + } + + free(all_path); + free(blk_path); + free(blk_path_addr); + + for (int b = 0; b < bn; b++) { + sprintf(buf, "tmp_b%04d.xdw", b + 1); + _fullpath(buf, buf, _MAX_PATH); + remove(buf); + } +} + +int xdwaddatn(const char* xdwfile, const char* atnfile) { + FILE *fp; + char filepath[_MAX_PATH]; + _fullpath(filepath, atnfile, _MAX_PATH); + + if ((fp = fopen(filepath, "r")) == NULL) { + fprintf(stderr, "Error: cannot open %s\n", filepath); + return -1; + } + + char keyword[128]; + char *q; + fgets(keyword, sizeof keyword, fp); + if ((q = strchr(keyword, '\n')) != NULL) { + *q = '\0'; + } + + char buf[_MAX_PATH]; + int x[ATN_N], y[ATN_N], sz[ATN_N], tr[ATN_N]; + char txt[ATN_N][256]; + int an = 0; + while (fgets(buf, sizeof buf, fp)) { + if ((q = strchr(buf, '\n')) != NULL) { + *q = '\0'; + } + + x[an] = atoi(strtok(buf, ",")); + y[an] = atoi(strtok(NULL, ",")); + sz[an] = atoi(strtok(NULL, ",")); + tr[an] = atoi(strtok(NULL, ",")); + strcpy(txt[an], strtok(NULL, ",")); + an++; + //printf("x=%d y=%d txt=%s sz=%d tr=%d\n", x[an], y[an], txt[an], sz[an], tr[an]); + } + fclose(fp); + + + XDW_DOCUMENT_HANDLE h = NULL; + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_UPDATE, XDW_AUTH_NODIALOGUE}; + + _fullpath(filepath, xdwfile, _MAX_PATH); + int api_result = XDW_OpenDocumentHandle(filepath, &h, (XDW_OPEN_MODE*)&mode); + if (api_result < 0) return api_result; + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; + XDW_GetDocumentInformation(h, &info); + XDW_FOUND_HANDLE pFoundHandle = NULL; + for (int i = 0; i < info.nPages; i++) { + if (keyword[0] != '\0') { + api_result = XDW_FindTextInPage(h, i + 1, keyword, NULL, &pFoundHandle, NULL); + if (!pFoundHandle) { + XDW_CloseFoundHandle(pFoundHandle); + continue; + } + XDW_CloseFoundHandle(pFoundHandle); + } + for (int j = 0; j < an; j++ ) { + XDW_ANNOTATION_HANDLE annoation; + int api_result = XDW_AddAnnotation(h, XDW_AID_TEXT, i + 1, x[j], y[j], NULL, &annoation, NULL); + if (api_result < 0) return api_result; + + api_result = XDW_SetAnnotationAttribute(h, annoation, XDW_ATN_Text, XDW_ATYPE_STRING, txt[j], 0, NULL); + api_result = XDW_SetAnnotationAttribute(h, annoation, XDW_ATN_FontSize, XDW_ATYPE_INT, (char*)&sz[j], 0, NULL); + + int color = XDW_COLOR_WHITE; + if (tr[j]) { + color = XDW_COLOR_NONE; + } + api_result = XDW_SetAnnotationAttribute(h, annoation, XDW_ATN_BackColor, XDW_ATYPE_INT, (char*)&color, 0, NULL); + } + } + + XDW_SaveDocument(h, NULL); + XDW_CloseDocumentHandle(h, NULL); + + return 0; +} + +int xdwaddatntool(const char* xdwfile, const char* toolfile, int n, int x, int y) { + char filepath[_MAX_PATH]; + _fullpath(filepath, xdwfile, _MAX_PATH); + + XDW_DOCUMENT_HANDLE h = NULL; + XDW_OPEN_MODE_EX mode = {sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_UPDATE, XDW_AUTH_NODIALOGUE}; + + int api_result = XDW_OpenDocumentHandle(filepath, &h, (XDW_OPEN_MODE*)&mode); + if (api_result < 0) return api_result; + + XDW_DOCUMENT_INFO info = {sizeof(XDW_DOCUMENT_INFO), 0, 0, 0}; + XDW_GetDocumentInformation(h, &info); + + _fullpath(filepath, toolfile, _MAX_PATH); + for (int i = 0; i < info.nPages; i++) { + XDW_ANNOTATION_HANDLE annoation; + int api_result = XDW_AddAnnotationFromAnnFile(h, filepath, n, i + 1, NULL, x, y, &annoation, NULL); + } + + XDW_SaveDocument(h, NULL); + XDW_CloseDocumentHandle(h, NULL); + + return 0; +} + diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/95_tmpl.go --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/95_tmpl.go Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,303 @@ +/* + 95.go: Qfuhi Tsuchi + + Last Change: 2020-09-11 金 10:42:16. +*/ + +package main + +/* +#cgo LDFLAGS: -L. -lxdwapi -static +##### C_SOURCE ##### +*/ +import "C" + +import ( + "bufio" + "regexp" + "encoding/json" + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "path/filepath" + "sort" + "strings" + + "golang.org/x/text/encoding/japanese" + "golang.org/x/text/transform" +) + +type Hhs struct { + No string + Name string + Page int // sinsei page + Tsuchi bool + Kaigo string + Xdw []string +} + +func(h *Hhs) AppendXdw(xdw string) { + h.Xdw = append(h.Xdw, xdw) +} + +func(h *Hhs) CsvString() string { + q := "" + if h.Tsuchi { + q = "○" + } + k := strings.Split(h.Kaigo, "") + return strings.Join([]string{h.No, h.Name, q, k[1] + k[3]}, ",") +} + +func(h *Hhs) Dump() string { + q := "false" + if h.Tsuchi { + q = "true" + } + p := fmt.Sprintf("%05d", h.Page) + x := strings.Join(h.Xdw, ",") + return strings.Join([]string{h.No, h.Name, q, h.Kaigo, p, x}, ",") +} + +type Config struct { + Indir string + Outdir string + Workdir string + Hhsdb string + Atnfile[] string +} + +var ( + ver = "0.1" + conf Config + confjson = "95.json" + logfile = "95.log" + osirase = "KBPA316G.xdw" + sinsei = "KBPA406G.xdw" + rule_s = "rules.ann" + + out_o = "o.xdw" + out_s = "s.xdw" + out_q = "q.xdw" + out_l = "l.csv" + + re_hhsno, re_name, re_kaigo *regexp.Regexp + + // option parameters + version bool +) + +func init() { + /* コンフィグファイルは JSON */ + content, err := ioutil.ReadFile(confjson) + if err != nil { + log.Fatal(err) + } + if err := json.Unmarshal(content, &conf); err != nil { + log.Fatal(err) + } + + osirase = filepath.Join(conf.Indir, osirase) + sinsei = filepath.Join(conf.Indir, sinsei) + + out_o = filepath.Join(conf.Outdir, out_o) + out_s = filepath.Join(conf.Outdir, out_s) + out_q = filepath.Join(conf.Outdir, out_q) + out_l = filepath.Join(conf.Outdir, out_l) + + logfile = filepath.Join(conf.Workdir, logfile) + + /* 一時ファイル消去 */ + os.RemoveAll(conf.Outdir) + os.RemoveAll(conf.Workdir) + os.Mkdir(conf.Outdir, 0755) + os.Mkdir(conf.Workdir, 0755) + + /* 変数初期化 */ + re_hhsno = regexp.MustCompile(`0[1238]00\d{6}`) + re_name = regexp.MustCompile(`日.{30}`) + re_kaigo = regexp.MustCompile(`要((介護)|(支援)).`) + + flag.BoolVar(&version, "v", false, "print version") +} + +func main() { + flag.Parse() + + if version { + fmt.Println("95 - version", ver) + os.Exit(0) + } + + hash_Hhs := make(map[string]Hhs) + + /* 申請書を漁り,構造体を初期化 */ + for p, t := range xdw2txt(sinsei) { + hno := re_hhsno.FindString(t) + name := re_name.FindString(t) + name = strings.Replace(name, "日", "", 1) + kaigo := re_kaigo.FindString(t) + o := fmt.Sprintf("o_%05d.xdw", p + 1) + s := fmt.Sprintf("s_%05d.xdw", p + 1) + h := Hhs{No: hno, Name: name, Kaigo: kaigo, Page:p + 1, Xdw: []string{o, s}} + hash_Hhs[hno] = h + } + + /* バックグラウンドで給付費通知から勧奨対象者を抽出 */ + ch := make(chan int) + go func() { + files, err := ioutil.ReadDir(conf.Indir) + if err != nil { + log.Fatal(err) + } + + qn := 1 + for _, file := range files { + if !strings.HasSuffix(file.Name(), ".xdw") { + continue + } + if strings.HasPrefix(file.Name(), "KDPK016G") || strings.HasPrefix(file.Name(), "KDPK126G") { + qtsuchi := filepath.Join(conf.Indir, file.Name()) + tmptxt := filepath.Join(conf.Workdir, "tmp95.txt") + for p, t := range xdw2txtb(qtsuchi, tmptxt) { + hno := re_hhsno.FindString(t) + if h, ok := hash_Hhs[hno]; ok { + h.Tsuchi = true + q := fmt.Sprintf("q_%05d.xdw", qn) + h.AppendXdw(q) + hash_Hhs[hno] = h + q = filepath.Join(conf.Workdir, q) + C.xdwextpage(C.CString(qtsuchi), C.int(p + 1), C.CString(q)) + qn++ + //fmt.Println(qtsuchi, p, hno, h.Kaigo, h.Xdw) + } + } + } + } + + ch <- 1 + }() + + /* そのあいだにバラす */ + C.xdwsplit1(C.CString(osirase), C.CString(conf.Workdir), C.CString("o_")) + C.xdwsplit1(C.CString(sinsei), C.CString(conf.Workdir), C.CString("s_")) + <-ch + + /* ソート & マージ */ + var slice_Hhs []Hhs + for _, h := range hash_Hhs { + slice_Hhs = append(slice_Hhs, h) + } + sort.Slice(slice_Hhs, func(i, j int) bool { + if slice_Hhs[i].Tsuchi != slice_Hhs[j].Tsuchi { + return slice_Hhs[i].Tsuchi + } + if slice_Hhs[i].Kaigo != slice_Hhs[j].Kaigo { + return slice_Hhs[i].Kaigo < slice_Hhs[j].Kaigo + } + if slice_Hhs[i].Page != slice_Hhs[j].Page { + return slice_Hhs[i].Page < slice_Hhs[j].Page + } + return false + }) + + var list_o, list_s, list_q []string + for _, h := range slice_Hhs { + list_o = append(list_o, filepath.Join(conf.Workdir, h.Xdw[0])) + list_s = append(list_s, filepath.Join(conf.Workdir, h.Xdw[1])) + if h.Tsuchi { + for i, x := range h.Xdw { + if i > 1 { + buf := filepath.Join(conf.Workdir, x) + list_q = append(list_q, buf) + } + } + } + } + xdwmerge(list_o, out_o) + xdwmerge(list_s, out_s) + xdwmerge(list_q, out_q) + + /* リスト出力 & ログダンプ */ + csvtxt := "" + logtxt := "" + for _, h := range slice_Hhs { + csvtxt += h.CsvString() + "\n" + logtxt += h.Dump() + "\n" + } + csvtxt, _, _ = transform.String(japanese.ShiftJIS.NewEncoder(), csvtxt) + if err := ioutil.WriteFile(out_l, []byte(csvtxt), 0644); err != nil { + log.Fatal(err) + } + if err := ioutil.WriteFile(logfile, []byte(logtxt), 0644); err != nil { + log.Fatal(err) + } + + /* バックグラウンドで給付費通知を校正 */ + ch2 := make(chan int) + go func() { + for _, a := range conf.Atnfile { + xdwaddatn(out_q, a) + } + ch2 <- 1 + } () + + /* そのあいだに申請書に枠付け */ + xdwaddatntool(out_s, rule_s, 2, 1497, 803) + <-ch2 +} + +func xdw2txt(file string) (txt []string) { + s := C.GoString(C.xdw2txt(C.CString(file))) + r := strings.NewReader(s) + tr := transform.NewReader(r, japanese.ShiftJIS.NewDecoder()) + buf := bufio.NewScanner(tr) + for buf.Scan() { + txt = append(txt, buf.Text()) + } + return +} + +func xdw2txtb(xdwfile, txtfile string) (txt []string) { + if _, err := os.Stat(txtfile); os.IsExist(err) { + os.Remove(txtfile) + } + + C.xdw2txtb(C.CString(xdwfile), C.CString(txtfile)) + content, err := ioutil.ReadFile(txtfile) + if err != nil { + return nil + } + + r := strings.NewReader(string(content)) + tr := transform.NewReader(r, japanese.ShiftJIS.NewDecoder()) + buf := bufio.NewScanner(tr) + for buf.Scan() { + txt = append(txt, buf.Text()) + } + return +} + +func xdwmerge(list []string, outfile string) (err error) { + order := strings.Join(list, "\n") + order, _, _ = transform.String(japanese.ShiftJIS.NewEncoder(), order) + orderfile := filepath.Join(conf.Workdir, "order95.txt") + if err := ioutil.WriteFile(orderfile, []byte(order), 0644); err != nil { + return err + } + C.xdwmerge(C.CString(orderfile), C.CString(outfile)) + return nil +} + +func xdwaddatn(xdwfile, atnfile string) (err error) { + C.xdwaddatn(C.CString(xdwfile), C.CString(atnfile)) + return nil +} + +func xdwaddatntool(xdwfile, toolfile string, n, x, y int) (err error) { + C.xdwaddatntool(C.CString(xdwfile), C.CString(toolfile), C.int(n), C.int(x), C.int(y)) + return nil +} + diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/Makefile Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,10 @@ +all: 95_tmpl.go 95_tmpl.cpp + cls + time /t + perl mkgo.pl 95_tmpl.go 95_tmpl.cpp > 95.go + go build 95.go + @echo build done............................................ + time /t + 95.exe + time /t + diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/Readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/Readme.txt Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,17 @@ +--------------------------------------------------------------------------------- + 95 の使い方 +--------------------------------------------------------------------------------- + +1. input フォルダに以下のような感じで 各種 Docuworks ファイルを突込む + * お知らせ KBPA316G.xdw + * 申請書 KBPA406G.xdw + * 介護給付費通知 KDPK016G.xdw KDPK016G-1.xdw KDPK016G-2.xdw + * 総合事業給付費通知 KDPK126G.xdw + +2. 95.exe をダブルクリックする + +3. output フォルダに以下のような感じで 各種 Docuworks ファイルらができる + * お知らせ o.xdw + * 申請書 s.xdw + * 介護給付費等通知 q.xdw + * 介護給付費等リスト l.csv \ No newline at end of file diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/all.atn --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/all.atn Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,2 @@ + +1780,27850,110,0, diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/kaigoq.atn --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/kaigoq.atn Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,10 @@ +싋t +16000,1050,120,0, +13500,5200,110,0, +13500,5800,110,0,ȐkLsg +13500,6400,110,0,ی +13500,7000,110,0, +7000,7800,120,0,یT[rXp󋵂̂m点 +2180,9960,100,1,̒ʒm̓T[rXp󋵂mFׂ̂m点łB +2180,10910,100,1,̒ʒmɂKvȎ葱͂܂B +1950,15200,100,1,pT[rX diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/mkgo.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/mkgo.pl Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,13 @@ +use utf8; + +open my $f, '<', $ARGV[1]; +my $cpp = do{local $/; <$f>}; +close $f; + +open $f, '<', $ARGV[0]; +while (<$f>) { + s/##### C_SOURCE #####/$cpp/; + print; +} +close $f; + diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/rules.ann Binary file src/kaigo/qtuti/rules.ann has changed diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/sougouq.atn --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/sougouq.atn Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,11 @@ +Ƌt +16000,1050,120,0, +13430,4600,110,0, +13430,5200,110,0,ȐkLsg +13430,5800,110,0,ی +13500,6400,110,0, +7000,7800,120,0,ƃT[rXp󋵂̂m点 +2180,9960,100,1,̒ʒm̓T[rXp󋵂mFׂ̂m点łB +2180,10910,100,1,̒ʒmɂKvȎ葱͂܂B +1950,15200,100,1,pT[rX +1780,27490,110,0, diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/xdw_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/xdw_api.h Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,1121 @@ +/* File: xdw_api.h +// Copyright(C) 1999-2013 by Fuji Xerox Co., Ltd. All right reserved. +*/ + +#ifndef XDW_API_H +#define XDW_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef XDWAPI_DECLARATIONS +#define XDWAPI_DECLARATIONS + +#ifdef _WIN64 +#ifndef XDW_DISABLE_PRAGMA_PACK +#pragma pack(push, xdwapi_enter_parser) +#pragma pack(8) +#endif /* XDW_DISABLE_PRAGMA_PACK */ +#endif /* _WIN64 */ + +#define XDWAPI __stdcall + +#define XDW_GI_VERSION 1 +#define XDW_GI_INSTALLPATH 2 +#define XDW_GI_BINPATH 3 +#define XDW_GI_PLUGINPATH 4 +#define XDW_GI_FOLDERROOTPATH 5 +#define XDW_GI_USERFOLDERPATH 6 +#define XDW_GI_SYSTEMFOLDERPATH 7 +#define XDW_GI_RECEIVEFOLDERPATH 8 +#define XDW_GI_SENDFOLDERPATH 9 +#define XDW_GI_DWINPUTPATH 10 +#define XDW_GI_DWDESKPATH 11 +#define XDW_GI_DWVIEWERPATH 12 +#define XDW_GI_DWVLTPATH 13 +#define XDW_GI_DWDESK_FILENAME_DELIMITER 1001 +#define XDW_GI_DWDESK_FILENAME_DIGITS 1002 + + +#define XDW_PGT_NULL 0 +#define XDW_PGT_FROMIMAGE 1 +#define XDW_PGT_FROMAPPL 2 + +#define XDW_MAXPATH 255 +#define XDW_MAXINPUTIMAGEPATH 127 + +#define XDW_OPEN_READONLY 0 +#define XDW_OPEN_UPDATE 1 + +#define XDW_AUTH_NONE 0 +#define XDW_AUTH_NODIALOGUE 1 +#define XDW_AUTH_CONDITIONAL_DIALOGUE 2 + +#define XDW_PERM_DOC_EDIT 0x02 +#define XDW_PERM_ANNO_EDIT 0x04 +#define XDW_PERM_PRINT 0x08 +#define XDW_PERM_COPY 0x10 + +#define XDW_DT_DOCUMENT 0 +#define XDW_DT_BINDER 1 +#define XDW_DT_CONTAINER 2 + +#define XDW_ROT_0 0 +#define XDW_ROT_90 90 +#define XDW_ROT_180 180 +#define XDW_ROT_270 270 + +#define XDW_CREATE_FITDEF 0 +#define XDW_CREATE_FIT 1 +#define XDW_CREATE_USERDEF 2 +#define XDW_CREATE_USERDEF_FIT 3 +#define XDW_CREATE_FITDEF_DIVIDEBMP 4 + +#define XDW_COMPRESS_NORMAL 0 +#define XDW_COMPRESS_LOSSLESS 1 +#define XDW_COMPRESS_HIGHQUALITY 2 +#define XDW_COMPRESS_HIGHCOMPRESS 3 +#define XDW_COMPRESS_NOCOMPRESS 4 +#define XDW_COMPRESS_JPEG 5 +#define XDW_COMPRESS_PACKBITS 6 +#define XDW_COMPRESS_G4 7 +#define XDW_COMPRESS_MRC_NORMAL 8 +#define XDW_COMPRESS_MRC_HIGHQUALITY 9 +#define XDW_COMPRESS_MRC_HIGHCOMPRESS 10 +#define XDW_COMPRESS_MRC 11 +#define XDW_COMPRESS_JPEG_TTN2 12 + +#define XDW_CONVERT_MRC_ORIGINAL 0 +#define XDW_CONVERT_MRC_OS 1 + +#define XDW_IMAGE_DIB 0 +#define XDW_IMAGE_TIFF 1 +#define XDW_IMAGE_JPEG 2 +#define XDW_IMAGE_PDF 3 + +#define XDW_CREATE_HCENTER 0 +#define XDW_CREATE_LEFT 1 +#define XDW_CREATE_RIGHT 2 + +#define XDW_CREATE_VCENTER 0 +#define XDW_CREATE_TOP 1 +#define XDW_CREATE_BOTTOM 2 + +#define XDW_CREATE_DEFAULT_SIZE 0 +#define XDW_CREATE_A3_SIZE 1 +#define XDW_CREATE_2A0_SIZE 2 + +#define XDW_LINE_NONE 0 +#define XDW_LINE_BEGINNING 1 +#define XDW_LINE_ENDING 2 +#define XDW_LINE_BOTH 3 +#define XDW_LINE_WIDE_POLYLINE 0 +#define XDW_LINE_POLYLINE 1 +#define XDW_LINE_POLYGON 2 + +#define XDW_BORDER_TYPE_SOLID 0 +#define XDW_BORDER_TYPE_DOT 1 +#define XDW_BORDER_TYPE_DASH 2 +#define XDW_BORDER_TYPE_DASHDOT 3 +#define XDW_BORDER_TYPE_DOUBLE 4 + +#define XDW_STAMP_AUTO 0 +#define XDW_STAMP_MANUAL 1 +#define XDW_STAMP_NO_BASISYEAR 0 +#define XDW_STAMP_BASISYEAR 1 +#define XDW_STAMP_DATE_YMD 0 +#define XDW_STAMP_DATE_DMY 1 + +#define XDW_PAGEFORM_HEADER 0 +#define XDW_PAGEFORM_FOOTER 1 +#define XDW_PAGEFORM_TOPIMAGE 2 +#define XDW_PAGEFORM_BOTTOMIMAGE 3 +#define XDW_PAGEFORM_PAGENUMBER 4 + +#define XDW_PAGEFORM_STAY 0 +#define XDW_PAGEFORM_REMOVE 1 + +#define XDW_ALIGN_LEFT 0 +#define XDW_ALIGN_HCENTER 1 +#define XDW_ALIGN_RIGHT 2 +#define XDW_ALIGN_TOP 0 +#define XDW_ALIGN_BOTTOM 1 +#define XDW_ALIGN_VCENTER 2 + +#define XDW_PAGERANGE_ALL 0 +#define XDW_PAGERANGE_SPECIFIED 1 + +#define XDW_CRTP_BEGINNING 1 +#define XDW_CRTP_PRINTING 2 +#define XDW_CRTP_PAGE_CREATING 3 +#define XDW_CRTP_ORIGINAL_APPENDING 4 +#define XDW_CRTP_WRITING 5 +#define XDW_CRTP_ENDING 6 +#define XDW_CRTP_CANCELING 7 +#define XDW_CRTP_FINISHED 8 +#define XDW_CRTP_CANCELED 9 + +#define XDW_AID_FUSEN 32794 +#define XDW_AID_TEXT 32785 +#define XDW_AID_STAMP 32819 +#define XDW_AID_STRAIGHTLINE 32828 +#define XDW_AID_RECTANGLE 32829 +#define XDW_AID_ARC 32830 +#define XDW_AID_POLYGON 32834 +#define XDW_AID_MARKER 32795 +#define XDW_AID_LINK 49199 +#define XDW_AID_PAGEFORM 32814 +#define XDW_AID_OLE 32783 +#define XDW_AID_BITMAP 32831 +#define XDW_AID_RECEIVEDSTAMP 32832 +#define XDW_AID_CUSTOM 32837 +#define XDW_AID_TITLE 32838 +#define XDW_AID_GROUP 32839 + +#define XDW_ATYPE_INT 0 +#define XDW_ATYPE_STRING 1 +#define XDW_ATYPE_DATE 2 +#define XDW_ATYPE_BOOL 3 +#define XDW_ATYPE_OCTS 4 +#define XDW_ATYPE_OTHER 999 + +#define XDW_SUMMARY_INFO 1 +#define XDW_USER_DEF 2 +#define XDW_ANNOTATION 4 + +#define XDW_SIZE_FREE 0 +#define XDW_SIZE_A3_PORTRAIT 1 +#define XDW_SIZE_A3_LANDSCAPE 2 +#define XDW_SIZE_A4_PORTRAIT 3 +#define XDW_SIZE_A4_LANDSCAPE 4 +#define XDW_SIZE_A5_PORTRAIT 5 +#define XDW_SIZE_A5_LANDSCAPE 6 +#define XDW_SIZE_B4_PORTRAIT 7 +#define XDW_SIZE_B4_LANDSCAPE 8 +#define XDW_SIZE_B5_PORTRAIT 9 +#define XDW_SIZE_B5_LANDSCAPE 10 + +#define XDW_BINDER_COLOR_0 0 +#define XDW_BINDER_COLOR_1 1 +#define XDW_BINDER_COLOR_2 2 +#define XDW_BINDER_COLOR_3 3 +#define XDW_BINDER_COLOR_4 4 +#define XDW_BINDER_COLOR_5 5 +#define XDW_BINDER_COLOR_6 6 +#define XDW_BINDER_COLOR_7 7 +#define XDW_BINDER_COLOR_8 8 +#define XDW_BINDER_COLOR_9 9 +#define XDW_BINDER_COLOR_10 10 +#define XDW_BINDER_COLOR_11 11 +#define XDW_BINDER_COLOR_12 12 +#define XDW_BINDER_COLOR_13 13 +#define XDW_BINDER_COLOR_14 14 +#define XDW_BINDER_COLOR_15 15 + +#define XDW_REDUCENOISE_NONE 0 +#define XDW_REDUCENOISE_NORMAL 1 +#define XDW_REDUCENOISE_WEAK 2 +#define XDW_REDUCENOISE_STRONG 3 + +#define XDW_PRIORITY_NONE 0 +#define XDW_PRIORITY_SPEED 1 +#define XDW_PRIORITY_RECOGNITION 2 + +#define XDW_OCR_ENGINE_V4 1 // old name - should be here for compatibility +#define XDW_OCR_ENGINE_DEFAULT 1 +#define XDW_OCR_ENGINE_WRP 2 +#define XDW_OCR_ENGINE_FRE 3 +#define XDW_OCR_ENGINE_FRE_MULTI 4 + +#define XDW_OCR_LANGUAGE_AUTO -1 +#define XDW_OCR_LANGUAGE_JAPANESE 0 +#define XDW_OCR_LANGUAGE_ENGLISH 1 + +#define XDW_OCR_MULTIPLELANGUAGES_ENGLISH 0x02 +#define XDW_OCR_MULTIPLELANGUAGES_FRENCH 0x04 +#define XDW_OCR_MULTIPLELANGUAGES_SIMPLIFIED_CHINESE 0x08 +#define XDW_OCR_MULTIPLELANGUAGES_TRADITIONAL_CHINESE 0x10 +#define XDW_OCR_MULTIPLELANGUAGES_THAI 0x20 +#define XDW_OCR_MULTIPLELANGUAGES_JAPANESE 0x40 +#define XDW_OCR_MULTIPLELANGUAGES_KOREAN 0x80 + +#define XDW_OCR_FORM_AUTO 0 +#define XDW_OCR_FORM_TABLE 1 +#define XDW_OCR_FORM_WRITING 2 + +#define XDW_OCR_COLUMN_AUTO 0 +#define XDW_OCR_COLUMN_HORIZONTAL_SINGLE 1 +#define XDW_OCR_COLUMN_HORIZONTAL_MULTI 2 +#define XDW_OCR_COLUMN_VERTICAL_SINGLE 3 +#define XDW_OCR_COLUMN_VERTICAL_MULTI 4 + +#define XDW_OCR_DOCTYPE_AUTO 0 +#define XDW_OCR_DOCTYPE_HORIZONTAL_SINGLE 1 +#define XDW_OCR_DOCTYPE_PLAINTEXT 2 + +#define XDW_OCR_ENGINE_LEVEL_SPEED 1 +#define XDW_OCR_ENGINE_LEVEL_STANDARD 2 +#define XDW_OCR_ENGINE_LEVEL_ACCURACY 3 + +#define XDW_OCR_MIXEDRATE_JAPANESE 1 +#define XDW_OCR_MIXEDRATE_BALANCED 2 +#define XDW_OCR_MIXEDRATE_ENGLISH 3 + +#define XDW_PROTECT_PSWD 1 +#define XDW_PROTECT_PSWD128 3 +#define XDW_PROTECT_PKI 4 +#define XDW_PROTECT_STAMP 5 +#define XDW_PROTECT_CONTEXT_SERVICE 6 +#define XDW_PROTECT_PSWD256 7 +#define XDW_PROTECT_PKI256 8 + +#define XDW_GPTI_TYPE_EMF 0 +#define XDW_GPTI_TYPE_OCRTEXT 1 + +#define XDW_IMAGE_MONO 0 +#define XDW_IMAGE_COLOR 1 +#define XDW_IMAGE_MONO_HIGHQUALITY 2 + +#define XDW_SIGNATURE_STAMP 100 +#define XDW_SIGNATURE_PKI 102 +#define XDW_SIGNATURE_PKI_SHA256 105 + +#define XDW_SIGNATURE_STAMP_DOC_NONE 0 +#define XDW_SIGNATURE_STAMP_DOC_NOEDIT 1 +#define XDW_SIGNATURE_STAMP_DOC_EDIT 2 +#define XDW_SIGNATURE_STAMP_DOC_BAD 3 + +#define XDW_SIGNATURE_STAMP_STAMP_NONE 0 +#define XDW_SIGNATURE_STAMP_STAMP_TRUSTED 1 +#define XDW_SIGNATURE_STAMP_STAMP_NOTRUST 2 + +#define XDW_SIGNATURE_STAMP_ERROR_OK 0 +#define XDW_SIGNATURE_STAMP_ERROR_NO_OPENING_CASE 1 +#define XDW_SIGNATURE_STAMP_ERROR_NO_SELFSTAMP 2 +#define XDW_SIGNATURE_STAMP_ERROR_OUT_OF_VALIDITY 3 +#define XDW_SIGNATURE_STAMP_ERROR_INVALID_DATA 4 +#define XDW_SIGNATURE_STAMP_ERROR_OUT_OF_MEMORY 100 +#define XDW_SIGNATURE_STAMP_ERROR_UNKNOWN 9999 + +#define XDW_SIGNATURE_PKI_DOC_UNKNOWN 0 +#define XDW_SIGNATURE_PKI_DOC_GOOD 1 +#define XDW_SIGNATURE_PKI_DOC_MODIFIED 2 +#define XDW_SIGNATURE_PKI_DOC_BAD 3 +#define XDW_SIGNATURE_PKI_DOC_GOOD_TRUSTED 4 +#define XDW_SIGNATURE_PKI_DOC_MODIFIED_TRUSTED 5 + +#define XDW_SIGNATURE_PKI_TYPE_LOW 0 +#define XDW_SIGNATURE_PKI_TYPE_MID_LOCAL 1 +#define XDW_SIGNATURE_PKI_TYPE_MID_NETWORK 2 +#define XDW_SIGNATURE_PKI_TYPE_HIGH_LOCAL 3 +#define XDW_SIGNATURE_PKI_TYPE_HIGH_NETWORK 4 + +#define XDW_SIGNATURE_PKI_CERT_UNKNOWN 0 +#define XDW_SIGNATURE_PKI_CERT_OK 1 +#define XDW_SIGNATURE_PKI_CERT_NO_ROOT_CERTIFICATE 2 +#define XDW_SIGNATURE_PKI_CERT_NO_REVOCATION_CHECK 3 +#define XDW_SIGNATURE_PKI_CERT_OUT_OF_VALIDITY 4 +#define XDW_SIGNATURE_PKI_CERT_OUT_OF_VALIDITY_AT_SIGNED_TIME 5 +#define XDW_SIGNATURE_PKI_CERT_REVOKE_CERTIFICATE 6 +#define XDW_SIGNATURE_PKI_CERT_REVOKE_INTERMEDIATE_CERTIFICATE 7 +#define XDW_SIGNATURE_PKI_CERT_INVALID_SIGNATURE 8 +#define XDW_SIGNATURE_PKI_CERT_INVALID_USAGE 9 +#define XDW_SIGNATURE_PKI_CERT_UNDEFINED_ERROR 10 + +#define XDW_SIGNATURE_PKI_ERROR_UNKNOWN 0 +#define XDW_SIGNATURE_PKI_ERROR_OK 1 +#define XDW_SIGNATURE_PKI_ERROR_BAD_PLATFORM 2 +#define XDW_SIGNATURE_PKI_ERROR_WRITE_REG_ERROR 3 +#define XDW_SIGNATURE_PKI_ERROR_BAD_TRUST_LEVEL 4 +#define XDW_SIGNATURE_PKI_ERROR_BAD_REVOKE_CHECK_TYPE 5 +#define XDW_SIGNATURE_PKI_ERROR_BAD_AUTO_IMPORT_CERT_FLAG 6 +#define XDW_SIGNATURE_PKI_ERROR_BAD_SIGN_CONFIG 7 +#define XDW_SIGNATURE_PKI_ERROR_NO_IMAGE_FILE 8 +#define XDW_SIGNATURE_PKI_ERROR_BAD_SIGN_CERT 9 +#define XDW_SIGNATURE_PKI_ERROR_NO_SIGN_CERT 10 +#define XDW_SIGNATURE_PKI_ERROR_NOT_USE_PRIVATE_KEY 11 +#define XDW_SIGNATURE_PKI_ERROR_INVALID 12 +#define XDW_SIGNATURE_PKI_ERROR_BAD_SIGN 13 +#define XDW_SIGNATURE_PKI_ERROR_REVOKE_CHECK_ERROR 14 +#define XDW_SIGNATURE_PKI_ERROR_OUT_OF_VALIDITY 15 +#define XDW_SIGNATURE_PKI_ERROR_NO_CERT 16 +#define XDW_SIGNATURE_PKI_ERROR_FAILURE_IMPOPT_CERT 17 +#define XDW_SIGNATURE_PKI_ERROR_NO_ROOT_CERT 18 +#define XDW_SIGNATURE_PKI_ERROR_BAD_CERT_SIZE 19 +#define XDW_SIGNATURE_PKI_ERROR_BAD_ARG 20 +#define XDW_SIGNATURE_PKI_ERROR_BAD_CERT_FORMAT 21 + +#define XDW_SECURITY_PKI_ERROR_UNKNOWN 0 +#define XDW_SECURITY_PKI_ERROR_OK 1 +#define XDW_SECURITY_PKI_ERROR_BAD_PLATFORM 2 +#define XDW_SECURITY_PKI_ERROR_WRITE_REG_ERROR 3 +#define XDW_SECURITY_PKI_ERROR_BAD_TRUST_LEVEL 4 +#define XDW_SECURITY_PKI_ERROR_BAD_REVOKE_CHECK_TYPE 5 +#define XDW_SECURITY_PKI_ERROR_REVOKED 6 +#define XDW_SECURITY_PKI_ERROR_BAD_SIGN 7 +#define XDW_SECURITY_PKI_ERROR_REVOKE_CHECK_ERROR 8 +#define XDW_SECURITY_PKI_ERROR_OUT_OF_VALIDITY 9 +#define XDW_SECURITY_PKI_ERROR_NO_CERT 10 +#define XDW_SECURITY_PKI_ERROR_FAILURE_IMPORT_CERT 11 +#define XDW_SECURITY_PKI_ERROR_NO_ROOT_CERT 12 +#define XDW_SECURITY_PKI_ERROR_BAD_CERT_FORMAT 13 +#define XDW_SECURITY_PKI_ERROR_BAD_CERT_USAGE 14 +#define XDW_SECURITY_PKI_ERROR_CA_CERT_IS_REVOKED 15 +#define XDW_SECURITY_PKI_ERROR_TOO_MANY_CERT 16 + +#define XDW_IGNORE_CASE 0x02 +#define XDW_IGNORE_WIDTH 0x04 +#define XDW_IGNORE_HIRAKATA 0x08 + +#define XDW_STARCH 1 +#define XDW_STARCH_OFF 0 + +#define XDW_TEXT_UNKNOWN 0 +#define XDW_TEXT_MULTIBYTE 1 +#define XDW_TEXT_UNICODE 2 +#define XDW_TEXT_UNICODE_IFNECESSARY 3 + +#define XDW_HGLOBAL void* + +typedef struct { int dummy; } *XDW_DOCUMENT_HANDLE; +typedef struct { int dummy; } *XDW_CREATE_HANDLE; +typedef struct { int dummy; } *XDW_ANNOTATION_HANDLE; +typedef struct { int dummy; } *XDW_FOUND_HANDLE; + +typedef unsigned short XDW_WCHAR; + +typedef struct tag_XDW_RECT { + long left; + long top; + long right; + long bottom; +} XDW_RECT; + +typedef struct tag_XDW_GPTI_OCRTEXT_UNIT { + const char* lpszText; + XDW_RECT rect; +} XDW_GPTI_OCRTEXT_UNIT; + +typedef struct tag_XDW_GPTI_OCRTEXT { + int nUnitNum; + XDW_GPTI_OCRTEXT_UNIT* pUnits; +} XDW_GPTI_OCRTEXT; + +typedef struct tag_XDW_GPTI_INFO { + int nSize; + int nInfoType; + int nPageWidth; + int nPageHeight; + int nRotateDegree; + int nDataSize; + XDW_HGLOBAL pData; +} XDW_GPTI_INFO; + +typedef struct tag_XDW_DOCUMENT_INFO { + int nSize; + int nPages; + int nVersion; + int nOriginalData; + int nDocType; + int nPermission; + int nShowAnnotations; + int nDocuments; + int nBinderColor; + int nBinderSize; +} XDW_DOCUMENT_INFO; + +typedef struct tag_XDW_PAGE_INFO { + int nSize; + int nWidth; + int nHeight; + int nPageType; + int nHorRes; + int nVerRes; + int nCompressType; + int nAnnotations; +} XDW_PAGE_INFO; + +typedef struct tag_XDW_PAGE_INFO_EX { + int nSize; + int nWidth; + int nHeight; + int nPageType; + int nHorRes; + int nVerRes; + int nCompressType; + int nAnnotations; + int nDegree; + int nOrgWidth; + int nOrgHeight; + int nOrgHorRes; + int nOrgVerRes; + int nImageWidth; + int nImageHeight; +} XDW_PAGE_INFO_EX; + +typedef struct tag_XDW_IMAGE_OPTION { + int nSize; + int nDpi; + int nColor; +} XDW_IMAGE_OPTION; + +typedef struct tag_XDW_OPEN_MODE { + int nSize; + int nOption; +} XDW_OPEN_MODE; + +typedef struct tag_XDW_OPEN_MODE_EX { + int nSize; + int nOption; + int nAuthMode; +} XDW_OPEN_MODE_EX; + +typedef struct tag_XDW_CREATE_OPTION { + int nSize; + int nFitImage; + int nCompress; + int nZoom; + int nWidth; + int nHeight; + int nHorPos; + int nVerPos; +} XDW_CREATE_OPTION; + +typedef struct tag_XDW_CREATE_OPTION_EX { + int nSize; + int nFitImage; + int nCompress; + int nZoom; + int nWidth; + int nHeight; + int nHorPos; + int nVerPos; + int nZoomDetail; +} XDW_CREATE_OPTION_EX; + +typedef struct tag_XDW_CREATE_OPTION_EX2 { + int nSize; + int nFitImage; + int nCompress; + int nZoom; + int nWidth; + int nHeight; + int nHorPos; + int nVerPos; + int nZoomDetail; + int nMaxPaperSize; +} XDW_CREATE_OPTION_EX2; + + +#define XDW_SIZEOF_ORGDATANAME 256 +typedef struct tag_XDW_ORGDATA_INFO { + int nSize; + int nDataSize; + long nDate; + char szName[XDW_SIZEOF_ORGDATANAME]; +} XDW_ORGDATA_INFO; + +typedef struct tag_XDW_ORGDATA_INFOW { + int nSize; + int nDataSize; + long nDate; + XDW_WCHAR szName[XDW_SIZEOF_ORGDATANAME]; +} XDW_ORGDATA_INFOW; + +#define XDW_SIZEOF_LINKROOTFOLDER 256 +typedef struct tag_XDW_LINKROOTFOLDER_INFO { + int nSize; + char szPath[XDW_SIZEOF_LINKROOTFOLDER]; + char szLinkRootFolderName[XDW_SIZEOF_LINKROOTFOLDER]; +} XDW_LINKROOTFOLDER_INFO ; + +typedef struct tag_XDW_LINKROOTFOLDER_INFOW { + int nSize; + XDW_WCHAR wszPath[XDW_SIZEOF_LINKROOTFOLDER]; + XDW_WCHAR wszLinkRootFolderName[XDW_SIZEOF_LINKROOTFOLDER]; +} XDW_LINKROOTFOLDER_INFOW ; + +typedef struct tag_XDW_CREATE_STATUS { + int nSize; + int phase; + int nTotalPage; + int nPage; +} XDW_CREATE_STATUS; + +typedef struct tag_XDW_ANNOTATION_INFO { + int nSize; + XDW_ANNOTATION_HANDLE handle; + int nHorPos; + int nVerPos; + int nWidth; + int nHeight; + int nAnnotationType; + int nChildAnnotations; +} XDW_ANNOTATION_INFO; + + +typedef struct tag_XDW_AA_INITIAL_DATA { + int nSize; + int nAnnotationType; + int nReserved1; + int nReserved2; +} XDW_AA_INITIAL_DATA; + +typedef struct tag_XDW_AA_FUSEN_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nWidth; + int nHeight; +} XDW_AA_FUSEN_INITIAL_DATA; + +typedef struct tag_XDW_AA_STRAIGHTLINE_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nHorVec; + int nVerVec; +} XDW_AA_STRAIGHTLINE_INITIAL_DATA; + +typedef struct tag_XDW_AA_RECT_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nWidth; + int nHeight; +} XDW_AA_RECT_INITIAL_DATA; + +typedef struct tag_XDW_AA_ARC_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nWidth; + int nHeight; +} XDW_AA_ARC_INITIAL_DATA; + +typedef struct tag_XDW_AA_BITMAP_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + char szImagePath[256]; +} XDW_AA_BITMAP_INITIAL_DATA; + +typedef struct tag_XDW_AA_BITMAP_INITIAL_DATAW { + XDW_AA_INITIAL_DATA common; + XDW_WCHAR wszImagePath[256]; +} XDW_AA_BITMAP_INITIAL_DATAW; + +typedef struct tag_XDW_AA_STAMP_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nWidth; +} XDW_AA_STAMP_INITIAL_DATA; + +typedef struct tag_XDW_AA_RECEIVEDSTAMP_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nWidth; +} XDW_AA_RECEIVEDSTAMP_INITIAL_DATA; + +#define XDW_SIZEOF_GUID 36 +typedef struct tag_XDW_AA_CUSTOM_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nWidth; + int nHeight; + char* lpszGuid; + int nCustomDataSize; + unsigned char* pCustomData; +} XDW_AA_CUSTOM_INITIAL_DATA; + +typedef struct tag_XDW_IMAGE_OPTION_EX { + int nSize; + int nDpi; + int nColor; + int nImageType; + void* pDetailOption; +} XDW_IMAGE_OPTION_EX; + +typedef struct tag_XDW_IMAGE_OPTION_TIFF { + int nSize; + int nCompress; + int nEndOfMultiPages; +} XDW_IMAGE_OPTION_TIFF; + +typedef struct tag_XDW_IMAGE_OPTION_JPEG { + int nSize; + int nCompress; +} XDW_IMAGE_OPTION_JPEG; + +typedef struct tag_XDW_IMAGE_OPTION_PDF { + int nSize; + int nCompress; + int nConvertMethod; + int nEndOfMultiPages; +} XDW_IMAGE_OPTION_PDF; + +typedef struct tag_XDW_BINDER_INITIAL_DATA { + int nSize; + int nBinderColor; + int nBinderSize; +} XDW_BINDER_INITIAL_DATA; + +typedef struct tag_XDW_OCR_OPTION_V4 { + int nSize; + int nNoiseReduction; + int nLanguage; + int nInsertSpaceCharacter; + int nJapaneseKnowledgeProcessing; + int nForm; + int nColumn; + int nDisplayProcess; + int nAutoDeskew; +} XDW_OCR_OPTION_V4; + +typedef struct tag_XDW_OCR_OPTION_V5 { + int nSize; + int nNoiseReduction; + int nLanguage; + int nInsertSpaceCharacter; + int nJapaneseKnowledgeProcessing; + int nForm; + int nColumn; + int nDisplayProcess; + int nAutoDeskew; + unsigned int nAreaNum; + XDW_RECT** pAreaRects; +} XDW_OCR_OPTION_V5; + +typedef struct tag_XDW_OCR_OPTION_V5_EX { + int nSize; + int nNoiseReduction; + int nLanguage; + int nInsertSpaceCharacter; + int nJapaneseKnowledgeProcessing; + int nForm; + int nColumn; + int nDisplayProcess; + int nAutoDeskew; + unsigned int nAreaNum; + XDW_RECT** pAreaRects; + int nPriority; +} XDW_OCR_OPTION_V5_EX; + +typedef struct tag_XDW_OCR_OPTION_WRP { + int nSize; + int nNoiseReduction; + int nLanguage; + int nInsertSpaceCharacter; + int nForm; + int nColumn; + int nAutoDeskew; + int nPriority; +} XDW_OCR_OPTION_WRP; + +typedef struct tag_XDW_OCR_OPTION_FRE { + int nSize; + int nNoiseReduction; + int nLanguage; + int nDocumentType; + int nDisplayProcess; + int nAutoDeskew; + unsigned int nAreaNum; + XDW_RECT** pAreaRects; + int nPriority; +} XDW_OCR_OPTION_FRE; + +typedef struct tag_XDW_OCR_OPTION_V7 { + int nSize; + int nNoiseReduction; + int nLanguage; + int nInsertSpaceCharacter; + int nJapaneseKnowledgeProcessing; + int nForm; + int nColumn; + int nDisplayProcess; + int nAutoDeskew; + unsigned int nAreaNum; + XDW_RECT** pAreaRects; + int nPriority; + int nEngineLevel; + int nLanguageMixedRate; + int nHalfSizeChar; +} XDW_OCR_OPTION_V7; + +typedef struct tag_XDW_OCR_OPTION_FRE_V7 { + int nSize; + int nNoiseReduction; + int nLanguage; + int nDocumentType; + int nDisplayProcess; + int nAutoDeskew; + unsigned int nAreaNum; + XDW_RECT** pAreaRects; + int nPriority; + int nEngineLevel; +} XDW_OCR_OPTION_FRE_V7; + +typedef struct tag_XDW_PAGE_COLOR_INFO { + int nSize; + int nColor; + int nImageDepth; +} XDW_PAGE_COLOR_INFO; + +#define XDW_SIZEOF_PSWD 256 +typedef struct tag_XDW_SECURITY_OPTION_PSWD { + int nSize; + int nPermission; + char szOpenPswd[XDW_SIZEOF_PSWD]; + char szFullAccessPswd[XDW_SIZEOF_PSWD]; + char* lpszComment; +} XDW_SECURITY_OPTION_PSWD; + +typedef struct tag_XDW_DER_CERTIFICATE { + void *pCert; + int nCertSize; +} XDW_DER_CERTIFICATE; + +typedef struct tag_XDW_SECURITY_OPTION_PKI { + int nSize; + int nPermission; + XDW_DER_CERTIFICATE* lpxdcCerts; + int nCertsNum; + int nFullAccessCertsNum; + int nErrorStatus; + int nFirstErrorCert; +} XDW_SECURITY_OPTION_PKI; + +typedef struct tag_XDW_PROTECT_OPTION { + int nSize; + int nAuthMode; +} XDW_PROTECT_OPTION; + +typedef struct tag_XDW_RELEASE_PROTECTION_OPTION { + int nSize; + int nAuthMode; +} XDW_RELEASE_PROTECTION_OPTION; + +typedef struct tag_XDW_PROTECTION_INFO { + int nSize; + int nProtectType; + int nPermission; +} XDW_PROTECTION_INFO; + +typedef struct tag_XDW_SIGNATURE_OPTION_V5 { + int nSize; + int nPage; + int nHorPos; + int nVerPos; + int nSignatureType; +} XDW_SIGNATURE_OPTION_V5; + +typedef struct tag_XDW_SIGNATURE_INFO_V5 { + int nSize; + int nSignatureType; + int nPage; + int nHorPos; + int nVerPos; + int nWidth; + int nHeight; + long nSignedTime; +} XDW_SIGNATURE_INFO_V5; + +typedef struct tag_XDW_SIGNATURE_MODULE_STATUS { + int nSize; + int nSignatureType; + int nErrorStatus; +} XDW_SIGNATURE_MODULE_STATUS; + +typedef struct tag_XDW_SIGNATURE_MODULE_OPTION_PKI { + int nSize; + void *pSignerCert; + int nSignerCertSize; +} XDW_SIGNATURE_MODULE_OPTION_PKI; + +#define XDW_SIZEOF_STAMPNAME 256 +#define XDW_SIZEOF_STAMPOWNERNAME 64 +#define XDW_SIZEOF_STAMPREMARKS 1024 +typedef struct tag_XDW_SIGNATURE_STAMP_INFO_V5 { + int nSize; + char lpszStampName[XDW_SIZEOF_STAMPNAME]; + char lpszOwnerName[XDW_SIZEOF_STAMPOWNERNAME]; + long nValidDate; + char lpszRemarks[XDW_SIZEOF_STAMPREMARKS]; + int nDocVerificationStatus; + int nStampVerificationStatus; +} XDW_SIGNATURE_STAMP_INFO_V5; + +#define XDW_SIZEOF_PKIMODULENAME 16 +#define XDW_SIZEOF_PKISUBJECTDN 512 +#define XDW_SIZEOF_PKISUBJECT 256 +#define XDW_SIZEOF_PKIISSUERDN 512 +#define XDW_SIZEOF_PKIISSUER 256 +#define XDW_SIZEOF_PKINOTBEFORE 32 +#define XDW_SIZEOF_PKINOTAFTER 32 +#define XDW_SIZEOF_PKISERIAL 64 +#define XDW_SIZEOF_PKIREMARKS 64 +#define XDW_SIZEOF_PKISIGNEDTIME 32 + +typedef struct tag_XDW_SIGNATURE_PKI_INFO_V5 { + int nSize; + char lpszModule[XDW_SIZEOF_PKIMODULENAME]; + char lpszSubjectDN[XDW_SIZEOF_PKISUBJECTDN]; + char lpszSubject[XDW_SIZEOF_PKISUBJECT]; + char lpszIssuerDN[XDW_SIZEOF_PKIISSUERDN]; + char lpszIssuer[XDW_SIZEOF_PKIISSUER]; + char lpszNotBefore[XDW_SIZEOF_PKINOTBEFORE]; + char lpszNotAfter[XDW_SIZEOF_PKINOTAFTER]; + char lpszSerial[XDW_SIZEOF_PKISERIAL]; + void* pSignerCert; + int nSignerCertSize; + char lpszRemarks[XDW_SIZEOF_PKIREMARKS]; + char lpszSigningTime[XDW_SIZEOF_PKISIGNEDTIME]; + int nDocVerificationStatus; + int nCertVerificationType; + int nCertVerificationStatus; +} XDW_SIGNATURE_PKI_INFO_V5; + +typedef struct tag_XDW_OCR_TEXTINFO { + int nSize; + int nWidth; + int nHeight; + long charset; + char* lpszText; + int nLineRect; + XDW_RECT* pLineRect; +} XDW_OCR_TEXTINFO; + +typedef struct tag_XDW_OCRIMAGE_OPTION { + int nSize; + int nDpi; + int nNoiseReduction; + int nPriority; +} XDW_OCRIMAGE_OPTION; + +typedef struct tag_XDW_FIND_TEXT_OPTION { + int nSize; + int nIgnoreMode; + int nReserved; + int nReserved2; +} XDW_FIND_TEXT_OPTION; + +#define XDW_FOUND_RECT_STATUS_HIT (0) +#define XDW_FOUND_RECT_STATUS_PAGE (1) + +typedef struct tag_XDW_POINT { + int x; + int y; +} XDW_POINT; + + +typedef struct tag_XDW_AA_MARKER_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nCounts; + XDW_POINT* pPoints; +} XDW_AA_MARKER_INITIAL_DATA; + +typedef struct tag_XDW_AA_POLYGON_INITIAL_DATA { + XDW_AA_INITIAL_DATA common; + int nCounts; + XDW_POINT* pPoints; +} XDW_AA_POLYGON_INITIAL_DATA; + +typedef struct XDW_BEGIN_CREATE_OPTION { + int nSize; + BOOL bNoUseSpecifiedApp; +} XDW_BEGIN_CREATE_OPTION; + +#ifdef _WIN64 +#ifndef XDW_DISABLE_PRAGMA_PACK +#pragma pack(pop, xdwapi_enter_parser) +#endif /* XDW_DISABLE_PRAGMA_PACK */ +#endif /* _WIN64 */ + +#endif //XDWAPI_DECLARATIONS + + +int XDWAPI XDW_GetInformation(int nIndex, char* lpszOutput, int nSize, void* reserved); +int XDWAPI XDW_GetInformationW(int nIndex, XDW_WCHAR* lpwszOutput, int nSize, void* reserved); +int XDWAPI XDW_AddSystemFolder(int nIndex, void* reserved ); + +int XDWAPI XDW_MergeXdwFiles(const char** lpszInputPaths, int nFiles, const char* lpszOutputPath, void* reserved ); +int XDWAPI XDW_MergeXdwFilesW(const XDW_WCHAR** lpwszInputPaths, int nFiles, const XDW_WCHAR* lpwszOutputPath, void* reserved ); +int XDWAPI XDW_OpenDocumentHandle(const char* lpszFilePath, XDW_DOCUMENT_HANDLE* pHandle, XDW_OPEN_MODE* pOpenMode); +int XDWAPI XDW_OpenDocumentHandleW(const XDW_WCHAR* lpwszFilePath, XDW_DOCUMENT_HANDLE* pHandle, XDW_OPEN_MODE* pOpenMode); +int XDWAPI XDW_CloseDocumentHandle(XDW_DOCUMENT_HANDLE handle, void* reserved ); +int XDWAPI XDW_GetDocumentInformation(XDW_DOCUMENT_HANDLE handle, XDW_DOCUMENT_INFO* pDocumentInfo); +int XDWAPI XDW_GetPageInformation(XDW_DOCUMENT_HANDLE handle, int nPage, XDW_PAGE_INFO* pPageInfo); +int XDWAPI XDW_GetPageImage(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_GetPageImageW(XDW_DOCUMENT_HANDLE handle, int nPage, const XDW_WCHAR* lpwszOutputPath, void* reserved); +int XDWAPI XDW_GetPageText(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszOutputPath, void* reserved ); +int XDWAPI XDW_ConvertPageToImageFile(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszOutputPath, XDW_IMAGE_OPTION* pImageOption); +int XDWAPI XDW_ConvertPageToImageFileW(XDW_DOCUMENT_HANDLE handle, int nPage, const XDW_WCHAR* lpwszOutputPath, XDW_IMAGE_OPTION* pImageOption); +int XDWAPI XDW_GetPage(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_GetPageW(XDW_DOCUMENT_HANDLE handle, int nPage, const XDW_WCHAR* lpwszOutputPath, void* reserved); +int XDWAPI XDW_DeletePage(XDW_DOCUMENT_HANDLE handle, int nPage, void* reserved); +int XDWAPI XDW_RotatePage(XDW_DOCUMENT_HANDLE handle, int nPage, int nDegree, void* reserved); +int XDWAPI XDW_SaveDocument(XDW_DOCUMENT_HANDLE handle, void* reserved); +int XDWAPI XDW_CreateXdwFromImageFile(const char* lpszInputPath, const char* lpszOutputPath, XDW_CREATE_OPTION* pOption); +int XDWAPI XDW_CreateXdwFromImageFileW(const XDW_WCHAR* lpwszInputPath, const XDW_WCHAR* lpwszOutputPath, XDW_CREATE_OPTION* pOption); + +int XDWAPI XDW_GetOriginalDataInformation(XDW_DOCUMENT_HANDLE handle, int nOriginalData, XDW_ORGDATA_INFO* pOriginalDataInfo, void* reserved); +int XDWAPI XDW_GetOriginalData(XDW_DOCUMENT_HANDLE handle, int nOriginalData, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_GetOriginalDataW(XDW_DOCUMENT_HANDLE handle, int nOriginalData, const XDW_WCHAR* lpwszOutputPath, void* reserved); +int XDWAPI XDW_InsertOriginalData(XDW_DOCUMENT_HANDLE handle, int nOriginalData, const char* lpszInputPath, void* reserved); +int XDWAPI XDW_DeleteOriginalData(XDW_DOCUMENT_HANDLE handle, int nOriginalData, void* reserved); + +int XDWAPI XDW_BeginCreationFromAppFile(const char* lpszInputPath, const char* lpszOutputPath, BOOL bWithOriginal, XDW_CREATE_HANDLE* handle, void* pCreateOption); +int XDWAPI XDW_BeginCreationFromAppFileW(const XDW_WCHAR* lpszInputPath, const XDW_WCHAR* lpszOutputPath, BOOL bWithOriginal, XDW_CREATE_HANDLE* handle, void* pCreateOption); +int XDWAPI XDW_EndCreationFromAppFile(XDW_CREATE_HANDLE handle, void* reserved); +int XDWAPI XDW_GetStatusCreationFromAppFile(XDW_CREATE_HANDLE handle, XDW_CREATE_STATUS* pStatus); +int XDWAPI XDW_CancelCreationFromAppFile(XDW_CREATE_HANDLE handle, void* reserved); + +int XDWAPI XDW_GetUserAttribute(XDW_DOCUMENT_HANDLE handle, const char* lpszAttributeName, char* pAttributeValue, int nDataSize, void *reserved); +int XDWAPI XDW_SetUserAttribute(XDW_DOCUMENT_HANDLE handle, const char* lpszAttributeName, char* pAttributeValue, int nDataSize, void *reserved); + +int XDWAPI XDW_GetAnnotationInformation(XDW_DOCUMENT_HANDLE hDocument, int nPage, XDW_ANNOTATION_HANDLE hAnnotation,int nIndex, XDW_ANNOTATION_INFO* pAnnotationInfo, void* reserved); +int XDWAPI XDW_GetAnnotationAttribute(XDW_ANNOTATION_HANDLE handle, const char* lpszAttributeName, char* pAttribute, int nDataSize, void* reserved); + +int XDWAPI XDW_AddAnnotation(XDW_DOCUMENT_HANDLE handle, int hAnnotationType, int nPage, int nHorPos, int nVerPos, XDW_AA_INITIAL_DATA *pInitialData, XDW_ANNOTATION_HANDLE* phNewAnnotation, void* reserved); +int XDWAPI XDW_RemoveAnnotation(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hRemoveAnnotation, void* reserved); +int XDWAPI XDW_SetAnnotationAttribute(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, const char* lpszAttributeName, int nAttributeType, char* pAttributeValue, int nReserved, void* pReserved); +int XDWAPI XDW_SetAnnotationSize(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, int nWidth, int nHeight, void* reserved); +int XDWAPI XDW_SetAnnotationPosition(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, int nHorPos, int nVerPos, void* reserved); +int XDWAPI XDW_CreateSfxDocument(const char* lpszInputPath, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_CreateSfxDocumentW(const XDW_WCHAR* lpwszInputPath, const XDW_WCHAR* lpwszOutputPath, void* reserved); +int XDWAPI XDW_ExtractFromSfxDocument(const char* lpszInputPath, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_ExtractFromSfxDocumentW(const XDW_WCHAR* lpwszInputPath, const XDW_WCHAR* lpwszOutputPath, void* reserved); + +int XDWAPI XDW_ConvertPageToImageHandle(XDW_DOCUMENT_HANDLE handle, int nPage, XDW_HGLOBAL* phDIB, XDW_IMAGE_OPTION* pImageOption); +int XDWAPI XDW_GetThumbnailImageHandle(XDW_DOCUMENT_HANDLE handle, int nPage, XDW_HGLOBAL* phDIB, void* reserved); + +int XDWAPI XDW_GetPageTextToMemory(XDW_DOCUMENT_HANDLE handle, int nPage, char* lpszValue, int nDataSize, void* reserved); +int XDWAPI XDW_GetFullText(XDW_DOCUMENT_HANDLE handle, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_GetPageUserAttribute(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszAttributeName, char* pAttributeValue, int nDataSize, void *reserved); +int XDWAPI XDW_SetPageUserAttribute(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszAttributeName, char* pAttributeValue, int nDataSize, void *reserved); + +int XDWAPI XDW_ReducePageNoise(XDW_DOCUMENT_HANDLE handle, int nPage, int nLevel, void* reserved); +int XDWAPI XDW_ShowOrHideAnnotations(XDW_DOCUMENT_HANDLE handle, int nShowAnnotations, void* reserved); +int XDWAPI XDW_GetCompressedPageImage(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_GetCompressedPageImageW(XDW_DOCUMENT_HANDLE handle, int nPage, const XDW_WCHAR* lpwszOutputPath, void* reserved); +int XDWAPI XDW_InsertDocument(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszInputPath, void* reserved); +int XDWAPI XDW_InsertDocumentW(XDW_DOCUMENT_HANDLE handle, int nPage, const XDW_WCHAR* lpwszInputPath, void* reserved); +int XDWAPI XDW_ApplyOcr(XDW_DOCUMENT_HANDLE handle, int nPage, int nOcrEngine, void* pOption, void* reserved); +int XDWAPI XDW_RotatePageAuto(XDW_DOCUMENT_HANDLE handle, int nPage, void* reserved); +int XDWAPI XDW_CreateBinder(const char* lpszOutputPath, XDW_BINDER_INITIAL_DATA* pInitialData, void* reserved); +int XDWAPI XDW_CreateBinderW(const XDW_WCHAR* lpwszOutputPath, XDW_BINDER_INITIAL_DATA* pInitialData, void* reserved); +int XDWAPI XDW_InsertDocumentToBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, const char* lpszInputPath, void* reserved); + +int XDWAPI XDW_GetDocumentFromBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_GetDocumentFromBinderW(XDW_DOCUMENT_HANDLE handle, int nPosition, const XDW_WCHAR* lpwszOutputPath, void* reserved); +int XDWAPI XDW_DeleteDocumentInBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, void* reserved); +int XDWAPI XDW_GetDocumentNameInBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, char* lpszDocName, int nDocNameSize, void* reserved); +int XDWAPI XDW_SetDocumentNameInBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, char* lpszDocName, void* reserved); +int XDWAPI XDW_GetDocumentInformationInBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, XDW_DOCUMENT_INFO* pDocumentInfo, void* reserved); +int XDWAPI XDW_Finalize(void* reserved); +int XDWAPI XDW_GetPageColorInformation(XDW_DOCUMENT_HANDLE handle, int nPage, XDW_PAGE_COLOR_INFO* pColorInfo, void* reserved); +int XDWAPI XDW_OptimizeDocument(const char* lpszInputPath, const char* lpszOutputPath, void* reserved); +int XDWAPI XDW_OptimizeDocumentW(const XDW_WCHAR* lpwszInputPath, const XDW_WCHAR* lpwszOutputPath, void* reserved); +int XDWAPI XDW_ProtectDocument(const char* lpszInputPath, const char* lpszOutputPath, int nProtectType, void* pModuleOption, void* pProtectOption); +int XDWAPI XDW_ProtectDocumentW(const XDW_WCHAR* lpwszInputPath, const XDW_WCHAR* lpwszOutputPath, int nProtectType, void* pModuleOption, void* pProtectOption); + +int XDWAPI XDW_CreateXdwFromImageFileAndInsertDocument(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszInputPath, XDW_CREATE_OPTION* pOption, void* reserved); +int XDWAPI XDW_CreateXdwFromImageFileAndInsertDocumentW(XDW_DOCUMENT_HANDLE handle, int nPage, const XDW_WCHAR* lpwszInputPath, XDW_CREATE_OPTION* pOption, void* reserved); +int XDWAPI XDW_GetDocumentAttributeNumber(XDW_DOCUMENT_HANDLE handle, void* reserved); +int XDWAPI XDW_GetDocumentAttributeByName(XDW_DOCUMENT_HANDLE handle, const char* lpszAttributeName, int* nAttributeType, char* pAttributeValue, int nDataSize, void* reserved); +int XDWAPI XDW_GetDocumentAttributeByOrder(XDW_DOCUMENT_HANDLE handle, int nOrder, char* lpszAttributeName, int* nAttributeType, char* pAttributeValue, int nDataSize, void* reserved); +int XDWAPI XDW_SetDocumentAttribute(XDW_DOCUMENT_HANDLE handle, const char* lpszAttributeName, int nAttributeType, char* pAttributeValue, void* reserved); +int XDWAPI XDW_SucceedAttribute(XDW_DOCUMENT_HANDLE handle, const char* lpszFilePath, int nDocument, int nSuccession, void* reserved); +int XDWAPI XDW_SucceedAttributeW(XDW_DOCUMENT_HANDLE handle, const XDW_WCHAR* lpwszFilePath, int nDocument, int nSuccession, void* reserved); +int XDWAPI XDW_GetPageFormAttribute(XDW_DOCUMENT_HANDLE handle, int nPageForm, const char* lpszAttributeName, char* pAttributeValue, int nDataSize, void* reserved); +int XDWAPI XDW_SetPageFormAttribute(XDW_DOCUMENT_HANDLE handle, int nPageForm, const char* lpszAttributeName, int nAttributeType, char* pAttributeValue, int nReserved, void* pReserved); +int XDWAPI XDW_UpdatePageForm(XDW_DOCUMENT_HANDLE handle, int nOtherPageForm, void* reserved); +int XDWAPI XDW_RemovePageForm(XDW_DOCUMENT_HANDLE handle, int nOtherPageForm, void* reserved); +int XDWAPI XDW_GetLinkRootFolderInformation(int nOrder, XDW_LINKROOTFOLDER_INFO* pLinkRootFolderInfo, void* reserved); +int XDWAPI XDW_GetLinkRootFolderInformationW(int nOrder, XDW_LINKROOTFOLDER_INFOW* pLinkRootFolderInfo, void* reserved); +int XDWAPI XDW_GetLinkRootFolderNumber(void* reserved); +int XDWAPI XDW_GetLinkRootFolderNumberW(void* reserved); +int XDWAPI XDW_GetPageTextInformation(XDW_DOCUMENT_HANDLE handle, int nPage, void* pInfo, void* reserved); +int XDWAPI XDW_GetDocumentSignatureNumber(XDW_DOCUMENT_HANDLE handle, void* reserved); +int XDWAPI XDW_AddAnnotationOnParentAnnotation(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, int hAnnotationType, int nHorPos, int nVerPos, XDW_AA_INITIAL_DATA *pInitialData, XDW_ANNOTATION_HANDLE* phNewAnnotation, void* reserved); +int XDWAPI XDW_SignDocument(const char* lpszInputPath, const char* lpszOutputPath, void* pOption, void* pModuleOption, void* pReserved, void* pModuleStatus); +int XDWAPI XDW_SignDocumentW(const XDW_WCHAR* lpwszInputPath, const XDW_WCHAR* lpwszOutputPath, void* pOption, void* pModuleOption, void* pReserved, void* pModuleStatus); +int XDWAPI XDW_GetSignatureInformation(XDW_DOCUMENT_HANDLE handle, int nSignature, void* pInfo, void* pModuleInfo, void* pReserved, void* pModuleStatus); +int XDWAPI XDW_UpdateSignatureStatus(XDW_DOCUMENT_HANDLE handle, int nSignature, void* pModuleOption, void* pReserved, void* pModuleStatus); + +int XDWAPI XDW_GetOcrImage(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszOutputPath, void* pImageOption, void* reserved); +int XDWAPI XDW_GetOcrImageW(XDW_DOCUMENT_HANDLE handle, int nPage, const XDW_WCHAR* lpwszOutputPath, void* pImageOption, void* reserved); +int XDWAPI XDW_SetOcrData(XDW_DOCUMENT_HANDLE handle, int nPage, XDW_OCR_TEXTINFO* pData, void* reserved); + +int XDWAPI XDW_GetDocumentAttributeNumberInBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, void* reserved); +int XDWAPI XDW_GetDocumentAttributeByNameInBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, const char* lpszAttributeName, int* nAttributeType, char* pAttributeValue, int nDataSize, void* reserved); +int XDWAPI XDW_GetDocumentAttributeByOrderInBinder(XDW_DOCUMENT_HANDLE handle, int nPosition, int nOrder, char* lpszAttributeName, int* nAttributeType, char* pAttributeValue, int nDataSize, void* reserved); + +int XDWAPI XDW_GetTMInfo(XDW_DOCUMENT_HANDLE handle, void* pTMInfo, int nTMInfoSize, void* reserved); +int XDWAPI XDW_SetTMInfo(XDW_DOCUMENT_HANDLE handle, const void* pTMInfo, int nTMInfoSize, void* reserved); + +int XDWAPI XDW_CreateXdwFromImagePdfFile(const char* lpszInputPath, const char* lpszOutputPath, void* reserved); + +int XDWAPI XDW_FindTextInPage(XDW_DOCUMENT_HANDLE handle, int nPage, const char* lpszText, XDW_FIND_TEXT_OPTION* pOption, XDW_FOUND_HANDLE* pFoundHandle, void* reserved); +int XDWAPI XDW_FindNext(XDW_FOUND_HANDLE* pFoundHandle, void* reserved); +int XDWAPI XDW_GetNumberOfRectsInFoundObject(XDW_FOUND_HANDLE foundHandle, void* reserved); +int XDWAPI XDW_GetRectInFoundObject(XDW_FOUND_HANDLE foundHandle, int nRect, XDW_RECT* pRect, int* pnStatus, void* reserved); +int XDWAPI XDW_CloseFoundHandle(XDW_FOUND_HANDLE foundHandle); + +int XDWAPI XDW_GetAnnotationUserAttribute(XDW_ANNOTATION_HANDLE hAnnotation, const char* lpszAttributeName, char* pAttributeValue, int nDataSize, void *reserved); +int XDWAPI XDW_SetAnnotationUserAttribute(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, const char* lpszAttributeName, char* pAttributeValue, int nDataSize, void *reserved); + +int XDWAPI XDW_StarchAnnotation(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, int nStarch, void* reserved); + +int XDWAPI XDW_ReleaseProtectionOfDocument(const char* lpszInputPath, const char* lpszOutputPath, void* pOption); +int XDWAPI XDW_ReleaseProtectionOfDocumentW(const XDW_WCHAR* lpwszInputPath, const XDW_WCHAR* lpwszOutputPath, void* pOption); +int XDWAPI XDW_GetProtectionInformation(const char* lpszInputPath, XDW_PROTECTION_INFO* pProtectionInfo, void* reserved); +int XDWAPI XDW_GetProtectionInformationW(const XDW_WCHAR* lpwszInputPath, XDW_PROTECTION_INFO* pProtectionInfo, void* reserved); + +int XDWAPI XDW_GetAnnotationCustomAttributeByName(XDW_ANNOTATION_HANDLE hAnnotation, XDW_WCHAR* lpszAttributeName, int* pnAttributeType, char* pAttributeValue, int nDataSize, void* reserved); +int XDWAPI XDW_GetAnnotationCustomAttributeByOrder(XDW_ANNOTATION_HANDLE hAnnotation, int nOrder, XDW_WCHAR* lpszAttributeName, int* pnAttributeType, char* pAttributeValue, int nDataSize, void* reserved); +int XDWAPI XDW_GetAnnotationCustomAttributeNumber(XDW_ANNOTATION_HANDLE hAnnotation, void* reserved); +int XDWAPI XDW_SetAnnotationCustomAttribute(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, XDW_WCHAR* lpszAttributeName, int nAttributeType, char* pAttributeValue, void* reserved); + +int XDWAPI XDW_GetPageTextToMemoryW(XDW_DOCUMENT_HANDLE handle, int nPage, XDW_WCHAR* pValue, int nBufferLength, void* reserved); +int XDWAPI XDW_GetFullTextW(XDW_DOCUMENT_HANDLE handle, const XDW_WCHAR* pOutputPath, void* reserved); +int XDWAPI XDW_GetAnnotationAttributeW(XDW_ANNOTATION_HANDLE handle, const char* lpszAttributeName, void* pAttributeValue, int nDataSize, int* pnTextType, unsigned int codepage, void* reserved); +int XDWAPI XDW_SetAnnotationAttributeW(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, const char* lpszAttributeName, int nAttributeType, void* pAttributeValue, int nTextType, unsigned int codepage, int nReserved, void* pReserved); +int XDWAPI XDW_GetDocumentAttributeByNameW(XDW_DOCUMENT_HANDLE handle, const XDW_WCHAR* pAttributeName, int* pnAttributeType, void* pAttributeValue, int nDataSize, int* pnTextType, unsigned int codepage, void* reserved); +int XDWAPI XDW_GetDocumentAttributeByOrderW(XDW_DOCUMENT_HANDLE handle, int nOrder, XDW_WCHAR* pAttributeName, int* pnAttributeType, void* pAttributeValue, int nDataSize, int* pnTextType, unsigned int codepage, void* reserved); +int XDWAPI XDW_GetDocumentAttributeByNameInBinderW(XDW_DOCUMENT_HANDLE handle, int nPosition, const XDW_WCHAR* pAttributeName, int* pnAttributeType, void* pAttributeValue, int nDataSize, int* pnTextType, unsigned int codepage, void* reserved); +int XDWAPI XDW_GetDocumentAttributeByOrderInBinderW(XDW_DOCUMENT_HANDLE handle, int nPosition, int nOrder, XDW_WCHAR* pAttributeName, int* pnAttributeType, void* pAttributeValue, int nDataSize, int* pnTextType, unsigned int codepage, void* reserved); +int XDWAPI XDW_SetDocumentAttributeW(XDW_DOCUMENT_HANDLE handle, const XDW_WCHAR* pAttributeName, int nAttributeType, void* pAttributeValue, int nTextType, unsigned int codepage, void* reserved); +int XDWAPI XDW_GetDocumentNameInBinderW(XDW_DOCUMENT_HANDLE handle, int nPosition, XDW_WCHAR* pDocName, int nBufferLength, int* pnTextType, unsigned int codepage, void* reserved); +int XDWAPI XDW_SetDocumentNameInBinderW(XDW_DOCUMENT_HANDLE handle, int nPosition, const XDW_WCHAR* pDocName, int nTextType, unsigned int codepage, void* reserved); +int XDWAPI XDW_GetOriginalDataInformationW(XDW_DOCUMENT_HANDLE handle, int nOriginalData, XDW_ORGDATA_INFOW* pOriginalDataInfoW, int* pnTextType, unsigned int codepage, void* reserved); + +int XDWAPI XDW_AddAnnotationFromAnnFile(XDW_DOCUMENT_HANDLE handle, const char* lpszAnnFilePath, int nIndex, int nPage, XDW_ANNOTATION_HANDLE hAnnotation, int nHorPos, int nVerPos, XDW_ANNOTATION_HANDLE* phNewAnnotation, void* reserved); +int XDWAPI XDW_AddAnnotationFromAnnFileW(XDW_DOCUMENT_HANDLE handle, const XDW_WCHAR* lpwszAnnFilePath, int nIndex, int nPage, XDW_ANNOTATION_HANDLE hAnnotation, int nHorPos, int nVerPos, XDW_ANNOTATION_HANDLE* phNewAnnotation, void* reserved); +int XDWAPI XDW_GroupAnnotations(XDW_DOCUMENT_HANDLE handle, int nPage, XDW_ANNOTATION_HANDLE hAnnotation, int* pnAnntationIndexes, int nAnnotationNum, XDW_ANNOTATION_HANDLE* phNewAnnotation, void* reserved); +int XDWAPI XDW_UnGroupAnnotation(XDW_DOCUMENT_HANDLE handle, XDW_ANNOTATION_HANDLE hAnnotation, void* reserved); + +/* error code */ +#ifndef XDWAPI_E_DECLARATIONS +#define XDWAPI_E_DECLARATIONS + +#define XDW_E_NOT_INSTALLED ((int)0x80040001) +#define XDW_E_INFO_NOT_FOUND ((int)0x80040002) +#define XDW_E_INSUFFICIENT_BUFFER ((int)0x8007007A) +#define XDW_E_FILE_NOT_FOUND ((int)0x80070002) +#define XDW_E_FILE_EXISTS ((int)0x80070050) +#define XDW_E_ACCESSDENIED ((int)0x80070005) +#define XDW_E_BAD_FORMAT ((int)0x8007000B) +#define XDW_E_OUTOFMEMORY ((int)0x8007000E) +#define XDW_E_WRITE_FAULT ((int)0x8007001D) +#define XDW_E_SHARING_VIOLATION ((int)0x80070020) +#define XDW_E_DISK_FULL ((int)0x80070027) +#define XDW_E_INVALIDARG ((int)0x80070057) +#define XDW_E_INVALID_NAME ((int)0x8007007B) +#define XDW_E_INVALID_ACCESS ((int)0x80040003) +#define XDW_E_INVALID_OPERATION ((int)0x80040004) +#define XDW_E_NEWFORMAT ((int)0x800E0004) +#define XDW_E_BAD_NETPATH ((int)0x800E0005) +#define XDW_E_APPLICATION_FAILED ((int)0x80001156) +#define XDW_E_SIGNATURE_MODULE ((int)0x800E0010) +#define XDW_E_PROTECT_MODULE ((int)0x800E0012) +#define XDW_E_UNEXPECTED ((int)0x8000FFFF) +#define XDW_E_CANCELED ((int)0x80040005) +#define XDW_E_ANNOTATION_NOT_ACCEPTED ((int)0x80040006) + +#endif //XDWAPI_E_DECLARATIONS + +#ifdef __cplusplus +} /* end of extern "C" */ +#endif /* __cplusplus */ + +#endif /* XDW_API_H */ + diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/xdwapi.lib Binary file src/kaigo/qtuti/xdwapi.lib has changed diff -r 058fb0a2cda8 -r 49656dc40069 src/kaigo/qtuti/xdwapian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/kaigo/qtuti/xdwapian.h Fri Sep 11 20:06:27 2020 +0900 @@ -0,0 +1,133 @@ +/* File: xdwapian.h +// Copyright(C) 1999-2002 by Fuji Xerox Co., Ltd. All right reserved. +*/ + +#ifndef __XDWAPIAN_H__ +#define __XDWAPIAN_H__ 1 + +#define XDW_ATN_Text "%Text" +#define XDW_ATN_FontName "%FontName" +#define XDW_ATN_FontStyle "%FontStyle" +#define XDW_ATN_FontSize "%FontSize" +#define XDW_ATN_ForeColor "%ForeColor" +#define XDW_ATN_FontPitchAndFamily "%FontPitchAndFamily" +#define XDW_ATN_FontCharSet "%FontCharSet" +#define XDW_ATN_BackColor "%BackColor" +#define XDW_ATN_Caption "%Caption" +#define XDW_ATN_Url "%Url" +#define XDW_ATN_XdwPath "%XdwPath" +#define XDW_ATN_ShowIcon "%ShowIcon" +#define XDW_ATN_LinkType "%LinkType" +#define XDW_ATN_XdwPage "%XdwPage" +#define XDW_ATN_Tooltip "%Tooltip" +#define XDW_ATN_Tooltip_String "%TooltipString" +#define XDW_ATN_XdwPath_Relative "%XdwPathRelative" +#define XDW_ATN_XdwLink "%XdwLink" +#define XDW_ATN_LinkAtn_Title "%LinkAtnTitle" +#define XDW_ATN_OtherFilePath "%OtherFilePath" +#define XDW_ATN_OtherFilePath_Relative "%OtherFilePathRelative" +#define XDW_ATN_MailAddress "%MailAddress" +#define XDW_ATN_BorderStyle "%BorderStyle" +#define XDW_ATN_BorderWidth "%BorderWidth" +#define XDW_ATN_BorderColor "%BorderColor" +#define XDW_ATN_BorderTransparent "%BorderTransparent" +#define XDW_ATN_BorderType "%BorderType" +#define XDW_ATN_FillStyle "%FillStyle" +#define XDW_ATN_FillColor "%FillColor" +#define XDW_ATN_FillTransparent "%FillTransparent" +#define XDW_ATN_ArrowheadType "%ArrowheadType" +#define XDW_ATN_ArrowheadStyle "%ArrowheadStyle" +#define XDW_ATN_WordWrap "%WordWrap" +#define XDW_ATN_TextDirection "%TextDirection" +#define XDW_ATN_TextOrientation "%TextOrientation" +#define XDW_ATN_LineSpace "%LineSpace" +#define XDW_ATN_AutoResize "%AutoResize" +#define XDW_ATN_Invisible "%Invisible" +#define XDW_ATN_PageFrom "%PageFrom" +#define XDW_ATN_XdwNameInXbd "%XdwNameInXbd" +#define XDW_ATN_TopField "%TopField" +#define XDW_ATN_BottomField "%BottomField" +#define XDW_ATN_DateStyle "%DateStyle" +#define XDW_ATN_YearField "%YearField" +#define XDW_ATN_MonthField "%MonthField" +#define XDW_ATN_DayField "%DayField" +#define XDW_ATN_BasisYearStyle "%BasisYearStyle" +#define XDW_ATN_BasisYear "%BasisYear" +#define XDW_ATN_DateField_FirstChar "%DateFieldFirstChar" +#define XDW_ATN_Alignment "%Alignment" +#define XDW_ATN_LeftRightMargin "%LeftRightMargin" +#define XDW_ATN_TopBottomMargin "%TopBottomMargin" +#define XDW_ATN_VerPosition "%VerPosition" +#define XDW_ATN_StartingNumber "%StartingNumber" +#define XDW_ATN_Digit "%Digit" +#define XDW_ATN_PageRange "%PageRange" +#define XDW_ATN_BeginningPage "%BeginningPage" +#define XDW_ATN_EndingPage "%EndingPage" +#define XDW_ATN_Zoom "%Zoom" +#define XDW_ATN_ImageFile "%ImageFile" +#define XDW_ATN_Points "%Points" +#define XDW_ATN_DateFormat "%DateFormat" +#define XDW_ATN_DateOrder "%DateOrder" +#define XDW_ATN_TextSpacing "%Spacing" +#define XDW_ATN_TextTopMargin "%TopMargin" +#define XDW_ATN_TextLeftMargin "%LeftMargin" +#define XDW_ATN_TextBottomMargin "%BottomMargin" +#define XDW_ATN_TextRightMargin "%RightMargin" +#define XDW_ATN_TextAutoResizeHeight "%AutoResizeHeight" +#define XDW_ATN_GUID "%CustomAnnGuid" +#define XDW_ATN_CustomData "%CustomAnnCustomData" + +#define XDW_PROP_TITLE "%Title" +#define XDW_PROP_SUBJECT "%Subject" +#define XDW_PROP_AUTHOR "%Author" +#define XDW_PROP_KEYWORDS "%Keywords" +#define XDW_PROP_COMMENTS "%Comments" + +#define XDW_PROPW_TITLE L"%Title" +#define XDW_PROPW_SUBJECT L"%Subject" +#define XDW_PROPW_AUTHOR L"%Author" +#define XDW_PROPW_KEYWORDS L"%Keywords" +#define XDW_PROPW_COMMENTS L"%Comments" + +#define XDW_COLOR_NONE 0x010101 +#define XDW_COLOR_BLACK 0x000000 +#define XDW_COLOR_MAROON 0x000080 +#define XDW_COLOR_GREEN 0x008000 +#define XDW_COLOR_OLIVE 0x008080 +#define XDW_COLOR_NAVY 0x800000 +#define XDW_COLOR_PURPLE 0x800080 +#define XDW_COLOR_TEAL 0x808000 +#define XDW_COLOR_GRAY 0x808080 +#define XDW_COLOR_SILVER 0xC0C0C0 +#define XDW_COLOR_RED 0x0000FF +#define XDW_COLOR_LIME 0x00FF00 +#define XDW_COLOR_YELLOW 0x00FFFF +#define XDW_COLOR_BLUE 0xFF0000 +#define XDW_COLOR_FUCHIA 0xFF00FF +#define XDW_COLOR_AQUA 0xFFFF00 +#define XDW_COLOR_WHITE 0xFFFFFF +#define XDW_COLOR_FUSEN_RED 0xFFC2FF +#define XDW_COLOR_FUSEN_BLUE 0xFFBF9D +#define XDW_COLOR_FUSEN_YELLOW 0x64FFFF +#define XDW_COLOR_FUSEN_LIME 0xC2FF9D +#define XDW_COLOR_FUSEN_PALE_RED 0xE1D7FF +#define XDW_COLOR_FUSEN_PALE_BLUE 0xFAE1C8 +#define XDW_COLOR_FUSEN_PALE_YELLOW 0xC3FAFF +#define XDW_COLOR_FUSEN_PALE_LIME 0xD2FACD + +#define XDW_FS_ITALIC_FLAG 1 +#define XDW_FS_BOLD_FLAG 2 +#define XDW_FS_UNDERLINE_FLAG 4 +#define XDW_FS_STRIKEOUT_FLAG 8 + +#define XDW_LT_LINK_TO_ME 0 +#define XDW_LT_LINK_TO_XDW 1 +#define XDW_LT_LINK_TO_URL 2 +#define XDW_LT_LINK_TO_OTHERFILE 3 +#define XDW_LT_LINK_TO_MAILADDR 4 + +#define XDW_PF_XDW 0 +#define XDW_PF_XBD 1 +#define XDW_PF_XDW_IN_XBD 2 + +#endif //__XDWAPIAN_H__