Mercurial > forge
changeset 12479:9f6ce83052bd octave-forge
Replace calls to deprecated java_get by __java_get__
author | prnienhuis |
---|---|
date | Sun, 11 May 2014 18:43:38 +0000 |
parents | 0123abac91a5 |
children | 2016e77d83ca |
files | main/io/inst/private/__JOD_spsh2oct__.m main/io/inst/private/__JXL_getusedrange__.m main/io/inst/private/__JXL_spsh2oct__.m main/io/inst/private/__OTK_getusedrange__.m main/io/inst/private/__OTK_oct2ods__.m main/io/inst/private/__OTK_spsh_info__.m main/io/inst/private/__OXS_spsh2oct__.m main/io/inst/private/__POI_getusedrange__.m main/io/inst/private/__POI_oct2spsh__.m main/io/inst/private/__POI_spsh2oct__.m main/io/inst/private/__POI_spsh_info__.m main/io/inst/private/__UNO_spsh2oct__.m |
diffstat | 12 files changed, 71 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/main/io/inst/private/__JOD_spsh2oct__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__JOD_spsh2oct__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2009,2010,2011,2012,2013 Philip Nienhuis +## Copyright (C) 2009,2010,2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -33,7 +33,8 @@ ## 2012-02-26 Further workaround for reading strings (actually: cells w/o OfficeValueAttr) ## 2012-10-12 Renamed & moved into ./private ## 2012-10-24 Style fixes -## 2013-12-01 Style fixes, copyright string updates +## 2013-12-01 Style fixes, copyright string updates +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [ rawarr, ods] = __JOD_spsh2oct__ (ods, wsh, crange) @@ -47,13 +48,13 @@ ## 1.2b3+ has public getValueType () persistent ctype; if (isempty (ctype)) - BOOLEAN = char (java_get ("org.jopendocument.dom.ODValueType", "BOOLEAN")); - CURRENCY = char (java_get ("org.jopendocument.dom.ODValueType", "CURRENCY")); - DATE = char (java_get ("org.jopendocument.dom.ODValueType", "DATE")); - FLOAT = char (java_get ("org.jopendocument.dom.ODValueType", "FLOAT")); - PERCENTAGE = char (java_get ("org.jopendocument.dom.ODValueType", "PERCENTAGE")); - STRING = char (java_get ("org.jopendocument.dom.ODValueType", "STRING")); - TIME = char (java_get ("org.jopendocument.dom.ODValueType", "TIME")); + BOOLEAN = char (__java_get__ ("org.jopendocument.dom.ODValueType", "BOOLEAN")); + CURRENCY = char (__java_get__ ("org.jopendocument.dom.ODValueType", "CURRENCY")); + DATE = char (__java_get__ ("org.jopendocument.dom.ODValueType", "DATE")); + FLOAT = char (__java_get__ ("org.jopendocument.dom.ODValueType", "FLOAT")); + PERCENTAGE = char (__java_get__ ("org.jopendocument.dom.ODValueType", "PERCENTAGE")); + STRING = char (__java_get__ ("org.jopendocument.dom.ODValueType", "STRING")); + TIME = char (__java_get__ ("org.jopendocument.dom.ODValueType", "TIME")); endif ## else ## ## 1.2b2 has not
--- a/main/io/inst/private/__JXL_getusedrange__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__JXL_getusedrange__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010,2011,2012,2013 Philip Nienhuis +## Copyright (C) 2010,2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -22,10 +22,11 @@ ## 2012-10-12 Renamed & moved into ./private ## 2012-10-24 Style fixes ## 2013-12-01 Style fixes, copyright string updates +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [ trow, brow, lcol, rcol ] = __JXL_getusedrange__ (xls, wsh) - persistent emptycell = (java_get ("jxl.CellType", "EMPTY")).toString (); + persistent emptycell = (__java_get__ ("jxl.CellType", "EMPTY")).toString (); sh = xls.workbook.getSheet (wsh - 1); ## JXL sheet count 0-based
--- a/main/io/inst/private/__JXL_spsh2oct__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__JXL_spsh2oct__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2009,2010,2011,2012,2013 Philip Nienhuis +## Copyright (C) 2009,2010,2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -52,6 +52,7 @@ ## 2012-10-12 Renamed & moved into ./private ## 2012-10-24 Style fixes ## 2013-12-01 Style fixes, copyright string updates +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [ rawarr, xls, rstatus ] = __JXL_spsh2oct__ (xls, wsh, cellrange, spsh_opts) @@ -59,17 +60,17 @@ if (isempty (ctype)) ctype = cell (11, 1); ## Get enumerated cell types. Beware as they start at 0 not 1 - ctype( 1) = (java_get ("jxl.CellType", "BOOLEAN")).toString (); - ctype( 2) = (java_get ("jxl.CellType", "BOOLEAN_FORMULA")).toString (); - ctype( 3) = (java_get ("jxl.CellType", "DATE")).toString (); - ctype( 4) = (java_get ("jxl.CellType", "DATE_FORMULA")).toString (); - ctype( 5) = (java_get ("jxl.CellType", "EMPTY")).toString (); - ctype( 6) = (java_get ("jxl.CellType", "ERROR")).toString (); - ctype( 7) = (java_get ("jxl.CellType", "FORMULA_ERROR")).toString (); - ctype( 8) = (java_get ("jxl.CellType", "NUMBER")).toString (); - ctype( 9) = (java_get ("jxl.CellType", "LABEL")).toString (); - ctype(10) = (java_get ("jxl.CellType", "NUMBER_FORMULA")).toString (); - ctype(11) = (java_get ("jxl.CellType", "STRING_FORMULA")).toString (); + ctype( 1) = (__java_get__ ("jxl.CellType", "BOOLEAN")).toString (); + ctype( 2) = (__java_get__ ("jxl.CellType", "BOOLEAN_FORMULA")).toString (); + ctype( 3) = (__java_get__ ("jxl.CellType", "DATE")).toString (); + ctype( 4) = (__java_get__ ("jxl.CellType", "DATE_FORMULA")).toString (); + ctype( 5) = (__java_get__ ("jxl.CellType", "EMPTY")).toString (); + ctype( 6) = (__java_get__ ("jxl.CellType", "ERROR")).toString (); + ctype( 7) = (__java_get__ ("jxl.CellType", "FORMULA_ERROR")).toString (); + ctype( 8) = (__java_get__ ("jxl.CellType", "NUMBER")).toString (); + ctype( 9) = (__java_get__ ("jxl.CellType", "LABEL")).toString (); + ctype(10) = (__java_get__ ("jxl.CellType", "NUMBER_FORMULA")).toString (); + ctype(11) = (__java_get__ ("jxl.CellType", "STRING_FORMULA")).toString (); months = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}; endif
--- a/main/io/inst/private/__OTK_getusedrange__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__OTK_getusedrange__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010,2011,2012,2013 Philip Nienhuis +## Copyright (C) 2010,2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -32,6 +32,7 @@ ## 2012-10-24 Style fixes ## 2013-12-01 Style fixes, copyright string updates ## 2013-12-27 Style fixes +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [ trow, lrow, lcol, rcol ] = __OTK_getusedrange__ (ods, ii) @@ -49,7 +50,7 @@ endif ## Create an instance of type NODESET for use in subsequent statement - NODESET = java_get ("javax.xml.xpath.XPathConstants", "NODESET"); + NODESET = __java_get__ ("javax.xml.xpath.XPathConstants", "NODESET"); ## Get table-rows in sheet no. wsh. Sheet count = 1-based (!) str = sprintf ("//table:table[%d]/table:table-row", ii); sh = xpath.evaluate (str, odfcont, NODESET);
--- a/main/io/inst/private/__OTK_oct2ods__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__OTK_oct2ods__.m Sun May 11 18:43:38 2014 +0000 @@ -48,6 +48,7 @@ ## 2013-01-20 Adapted to ML-compatible Java calls ## 2013-12-01 Style fixes, copyright string updates ## 2014-01-29 Style fixes, copyright string updates +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [ ods, rstatus ] = __OTK_oct2ods__ (c_arr, ods, wsh, crange, spsh_opts) @@ -67,7 +68,7 @@ officestyles = ods.app.getOrCreateDocumentStyles(); ## Create an instance of type NODESET for use in subsequent statements - NODESET = java_get ("javax.xml.xpath.XPathConstants", "NODESET"); + NODESET = __java_get__ ("javax.xml.xpath.XPathConstants", "NODESET"); ## Parse sheets ("tables") from ODS file sheets = xpath.evaluate ("//table:table", odfcont, NODESET);
--- a/main/io/inst/private/__OTK_spsh_info__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__OTK_spsh_info__.m Sun May 11 18:43:38 2014 +0000 @@ -23,6 +23,7 @@ ## 2012-10-24 Style fixes ## 2013-12-01 Copyright string updates ## 2014-01-23 Copyright update, return "Empty" for range of empty sheets +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [sh_names] = __OTK_spsh_info__ (ods) @@ -34,7 +35,7 @@ endif ## Create an instance of type NODESET for use in subsequent statement - NODESET = java_get ("javax.xml.xpath.XPathConstants", "NODESET"); + NODESET = __java_get__ ("javax.xml.xpath.XPathConstants", "NODESET"); ## Parse sheets ("tables") from ODS file sheets = xpath.evaluate ("//table:table", ods.workbook, NODESET); nr_of_sheets = sheets.getLength();
--- a/main/io/inst/private/__OXS_spsh2oct__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__OXS_spsh2oct__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2011,2012,2013 Philip Nienhuis +## Copyright (C) 2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -32,6 +32,8 @@ ## 2012-10-24 Style fixes ## 2013-12-06 Updated copyright strings ## 2013-12-29 Overhauled actual worksheet reading section. Now does formulas too +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ +## '' Silence message when reading from sheet given by index function [ rawarr, xls, rstatus ] = __OXS_spsh2oct__ (xls, wsh, cellrange, spsh_opts) @@ -39,12 +41,12 @@ if (isempty (ctype)) ctype = zeros (6, 1); ## Get enumerated cell types. Beware as they start at 0 not 1 - ctype( 1) = (java_get ("com.extentech.ExtenXLS.CellHandle", "TYPE_STRING")); ## 0 - ctype( 2) = (java_get ("com.extentech.ExtenXLS.CellHandle", "TYPE_FP")); ## 1 - ctype( 3) = (java_get ("com.extentech.ExtenXLS.CellHandle", "TYPE_INT")); ## 2 - ctype( 4) = (java_get ("com.extentech.ExtenXLS.CellHandle", "TYPE_FORMULA")); ## 3 - ctype( 5) = (java_get ("com.extentech.ExtenXLS.CellHandle", "TYPE_BOOLEAN")); ## 4 - ctype( 6) = (java_get ("com.extentech.ExtenXLS.CellHandle", "TYPE_DOUBLE")); ## 5 + ctype( 1) = (__java_get__ ("com.extentech.ExtenXLS.CellHandle", "TYPE_STRING")); ## 0 + ctype( 2) = (__java_get__ ("com.extentech.ExtenXLS.CellHandle", "TYPE_FP")); ## 1 + ctype( 3) = (__java_get__ ("com.extentech.ExtenXLS.CellHandle", "TYPE_INT")); ## 2 + ctype( 4) = (__java_get__ ("com.extentech.ExtenXLS.CellHandle", "TYPE_FORMULA")); ## 3 + ctype( 5) = (__java_get__ ("com.extentech.ExtenXLS.CellHandle", "TYPE_BOOLEAN")); ## 4 + ctype( 6) = (__java_get__ ("com.extentech.ExtenXLS.CellHandle", "TYPE_DOUBLE")); ## 5 endif rstatus = 0; @@ -59,7 +61,6 @@ wsh, nr_of_sheets, xls.filename)); endif sh = wb.getWorkSheet (wsh - 1); ## OXS sheet count 0-based - printf ("(Reading from worksheet %s)\n", sh.getSheetName ()); else try sh = wb.getWorkSheet (wsh);
--- a/main/io/inst/private/__POI_getusedrange__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__POI_getusedrange__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010,2011,2012,2013 Philip Nienhuis +## Copyright (C) 2010,2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -23,11 +23,12 @@ ## 2013-09-23 Check getFirstCellNum method return value for empty rows ## 2013-12-06 Style fixes ## 2014-04-06 Fix getFirstCellNum return value when checking rightmost cells +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [ trow, brow, lcol, rcol ] = __POI_getusedrange__ (xls, ii) persistent cblnk; - cblnk = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BLANK"); + cblnk = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BLANK"); sh = xls.workbook.getSheetAt (ii-1); ## Java POI starts counting at 0
--- a/main/io/inst/private/__POI_oct2spsh__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__POI_oct2spsh__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2009,2010,2011,2012,2013 Philip Nienhuis +## Copyright (C) 2009,2010,2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -61,6 +61,7 @@ ## 2012-10-24 Style fixes ## 2013-12-06 Updated copyright strings; style fixes ## 2013-12-07 Fixed .xls extension check; style fixes +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [ xls, rstatus ] = __POI_oct2spsh__ (obj, xls, wsh, crange, spsh_opts) @@ -72,11 +73,11 @@ persistent ctype; if (isempty (ctype)) ## Get cell types. Beware as they start at 0 not 1 - ctype(1) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_NUMERIC"); ## 0 - ctype(2) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BOOLEAN"); ## 4 - ctype(3) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_STRING"); ## 1 - ctype(4) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_FORMULA"); ## 2 - ctype(5) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BLANK"); ## 3 + ctype(1) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_NUMERIC"); ## 0 + ctype(2) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BOOLEAN"); ## 4 + ctype(3) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_STRING"); ## 1 + ctype(4) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_FORMULA"); ## 2 + ctype(5) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BLANK"); ## 3 endif ## scratch vars rstatus = 0; f_errs = 0;
--- a/main/io/inst/private/__POI_spsh2oct__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__POI_spsh2oct__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2009,2010,2011,2012,2013 Philip Nienhuis +## Copyright (C) 2009,2010,2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -51,18 +51,19 @@ ## 2012-10-12 Renamed & moved into ./private ## 2012-10-24 Style fixes ## 2013-12-06 Updated copyright strings; style fixes +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [ rawarr, xls, rstatus ] = __POI_spsh2oct__ (xls, wsh, cellrange, spsh_opts) persistent ctype; if (isempty (ctype)) ## Get enumerated cell types. Beware as they start at 0 not 1 - ctype(1) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_NUMERIC"); - ctype(2) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_STRING"); - ctype(3) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_FORMULA"); - ctype(4) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BLANK"); - ctype(5) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BOOLEAN"); - ctype(6) = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_ERROR"); + ctype(1) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_NUMERIC"); + ctype(2) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_STRING"); + ctype(3) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_FORMULA"); + ctype(4) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BLANK"); + ctype(5) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BOOLEAN"); + ctype(6) = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_ERROR"); endif rstatus = 0; jerror = 0;
--- a/main/io/inst/private/__POI_spsh_info__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__POI_spsh_info__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2012,2013 Philip Nienhuis +## Copyright (C) 2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -22,10 +22,11 @@ ## 2012-10-12 Moved into ./private ## 2012-10-24 Style fixes ## 2013-12-06 Updated copyright strings +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [sh_names] = __POI_spsh_info__ (xls) - persistent cblnk; cblnk = java_get ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BLANK"); + persistent cblnk; cblnk = __java_get__ ("org.apache.poi.ss.usermodel.Cell", "CELL_TYPE_BLANK"); sh_cnt = xls.workbook.getNumberOfSheets(); sh_names = cell (sh_cnt, 2); nsrows = zeros (sh_cnt, 1); for ii=1:sh_cnt
--- a/main/io/inst/private/__UNO_spsh2oct__.m Sun May 11 18:42:51 2014 +0000 +++ b/main/io/inst/private/__UNO_spsh2oct__.m Sun May 11 18:43:38 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2011,2012,2013 Philip Nienhuis +## Copyright (C) 2011,2012,2013,2014 Philip Nienhuis ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -25,6 +25,7 @@ ## 2012-12-21 Search for exact match when searching sheet names ## 2013-01-20 Adapted to ML-compatible Java calls ## 2013-12-06 Updated copyright strings; style fixes +## 2014-05-11 Replace calls to deprecated java_get by __java_get__ function [rawarr, xls, rstatus] = __UNO_spsh2oct__ (xls, wsh, datrange, spsh_opts) @@ -55,11 +56,12 @@ unotmp = javaObject ("com.sun.star.uno.Type", "com.sun.star.sheet.XCellRangesQuery"); xRQ = sh.queryInterface (unotmp); ## Get cell ranges of all rectangles containing data. Type values: - ##java_get ("com.sun.star.sheet.CellFlags", "VALUE") ans = 1 - ##java_get ("com.sun.star.sheet.CellFlags", "DATETIME") ans = 2 - ##java_get ("com.sun.star.sheet.CellFlags", "STRING") ans = 4 - ##java_get ("com.sun.star.sheet.CellFlags", "FORMULA") ans = 16 + - ## Yep, boolean is lacking... sum = 23 + ##__java_get__ ("com.sun.star.sheet.CellFlags", "VALUE") ans = 1 + ##__java_get__ ("com.sun.star.sheet.CellFlags", "DATETIME") ans = 2 + ##__java_get__ ("com.sun.star.sheet.CellFlags", "STRING") ans = 4 + ##__java_get__ ("com.sun.star.sheet.CellFlags", "FORMULA") ans = 16 + + ## -------- + ## Yep, boolean is lacking... sum = 23 Cellflgs = javaObject ("java.lang.Short", "23"); ccells = xRQ.queryContentCells (Cellflgs); addrs = ccells.getRangeAddressesAsString ();