Skip to content

Commit b233734

Browse files
committed
make compile
1 parent 3e360f4 commit b233734

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

app/conanfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[requires]
2-
odrcore/9.9.9@
2+
odrcore/5.0.0-pre1@
33

44
[generators]
55
CMakeToolchain

app/src/main/cpp/CoreWrapper.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <odr/document.hpp>
44
#include <odr/file.hpp>
55
#include <odr/html.hpp>
6-
#include <odr/open_document_reader.hpp>
6+
#include <odr/odr.hpp>
77
#include <odr/exceptions.hpp>
88
#include <odr/http_server.hpp>
99

@@ -79,7 +79,7 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jclass
7979
try {
8080
odr::FileType fileType;
8181
try {
82-
const auto types = odr::OpenDocumentReader::types(inputPathCpp);
82+
const auto types = odr::types(inputPathCpp);
8383
if (types.empty()) {
8484
env->SetIntField(result, errorField, -5);
8585
return result;
@@ -90,7 +90,7 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jclass
9090
fileType = e.file_type;
9191
}
9292

93-
const auto extensionCpp = odr::OpenDocumentReader::type_to_string(fileType);
93+
const auto extensionCpp = odr::type_to_string(fileType);
9494
const auto extensionC = extensionCpp.c_str();
9595
jstring extension = env->NewStringUTF(extensionC);
9696

@@ -100,8 +100,8 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jclass
100100

101101
// __android_log_print(ANDROID_LOG_VERBOSE, "smn", "%s", extensionCpp.c_str());
102102

103-
const auto file = odr::OpenDocumentReader::open(inputPathCpp);
104-
const auto fileCategory = odr::OpenDocumentReader::category_by_type(file.file_type());
103+
const auto file = odr::open(inputPathCpp);
104+
const auto fileCategory = odr::category_by_type(file.file_type());
105105

106106
if (!ooxml &&
107107
(file.file_type() == odr::FileType::office_open_xml_document ||
@@ -129,15 +129,16 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jclass
129129
config.text_document_margin = true;
130130
}
131131

132-
s_html = odr::OpenDocumentReader::html(inputPathCpp, [&passwordCpp]() -> std::string {
132+
s_html = odr::html::translate(odr::File(inputPathCpp), outputPathCpp, config,
133+
[&passwordCpp]() -> std::string {
133134
if (passwordCpp.has_value()) {
134135
return passwordCpp.value();
135136
}
136137
return "";
137-
}, outputPathCpp, config);
138+
});
138139

139140
{
140-
const auto extensionCpp = odr::OpenDocumentReader::type_to_string(
141+
const auto extensionCpp = odr::type_to_string(
141142
s_html->file_type());
142143
const auto extensionC = extensionCpp.c_str();
143144
jstring extension = env->NewStringUTF(extensionC);
@@ -202,7 +203,7 @@ Java_at_tomtasche_reader_background_CoreWrapper_backtranslateNative(JNIEnv *env,
202203

203204
const auto htmlDiffC = env->GetStringUTFChars(htmlDiff, &isCopy);
204205

205-
const auto extension = odr::OpenDocumentReader::type_to_string(s_html->file_type());
206+
const auto extension = odr::type_to_string(s_html->file_type());
206207
const auto outputPathCpp = outputPathPrefixCpp + "." + extension;
207208
const char *outputPathC = outputPathCpp.c_str();
208209
jstring outputPath = env->NewStringUTF(outputPathC);
@@ -272,13 +273,14 @@ Java_at_tomtasche_reader_background_CoreWrapper_hostFileNative(JNIEnv *env, jcla
272273
odr::DecodePreference decodePreference;
273274
decodePreference.engine_priority = {
274275
odr::DecoderEngine::poppler, odr::DecoderEngine::wvware, odr::DecoderEngine::odr};
275-
odr::DecodedFile file = odr::OpenDocumentReader::open(inputPathCpp, decodePreference);
276+
odr::DecodedFile file = odr::open(inputPathCpp, decodePreference);
276277

277278
__android_log_print(ANDROID_LOG_INFO, "smn", "file type %i", file.file_type());
278279

279280
try {
280-
std::string id = s_server->host_file(file);
281-
return env->NewStringUTF(id.c_str());
281+
std::string prefix = "hi";
282+
s_server->serve_file(file, prefix, odr::HtmlConfig());
283+
return env->NewStringUTF(prefix.c_str());
282284
} catch (...) {
283285
__android_log_print(ANDROID_LOG_ERROR, "smn", "error");
284286
return env->NewStringUTF("error");

app/src/main/java/at/tomtasche/reader/background/CoreHttpLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class CoreHttpLoader extends FileLoader {
1414
private CoreWrapper lastCore;
1515

1616
public CoreHttpLoader(Context context, ConfigManager configManager) {
17-
super(context, LoaderType.ODF);
17+
super(context, LoaderType.CORE);
1818

1919
this.configManager = configManager;
2020
}

0 commit comments

Comments
 (0)