Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ set(ODR_SOURCE_FILES
"src/odr/internal/common/random.cpp"
"src/odr/internal/common/style.cpp"
"src/odr/internal/common/table_cursor.cpp"
"src/odr/table_position.cpp"
"src/odr/internal/common/table_range.cpp"
"src/odr/internal/common/temporary_file.cpp"

Expand Down Expand Up @@ -228,6 +227,7 @@ set(ODR_SOURCE_FILES
"src/odr/internal/util/document_util.cpp"
"src/odr/internal/util/file_util.cpp"
"src/odr/internal/util/hash_util.cpp"
"src/odr/internal/util/number_util.cpp"
"src/odr/internal/util/odr_meta_util.cpp"
"src/odr/internal/util/stream_util.cpp"
"src/odr/internal/util/string_util.cpp"
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@ C++ library to visualize files, especially documents, in HTML.
- [doc](https://github.com/opendocument-app/OpenDocument.core/issues/104), [ppt](https://github.com/opendocument-app/OpenDocument.core/issues/106), [xls](https://github.com/opendocument-app/OpenDocument.core/issues/105)
- [pdf](https://github.com/opendocument-app/OpenDocument.core/issues/108)
- txt
- json
- [zip](https://github.com/opendocument-app/OpenDocument.core/issues/109)
- [cfb](https://github.com/opendocument-app/OpenDocument.core/issues/110) (Microsoft Compound File Binary File Format)
- ttf / otf (font specimen pages)

## Unsupported files
## Detected but not decoded

These are recognised by `list_file_types` / `mimetype` so a caller can report
them, but there is no decoder β€” opening one throws:

- rtf
- wpd (WordPerfect)

## Unsupported files

- pages
- json
- xml
- yaml

Expand Down
2 changes: 1 addition & 1 deletion cli/src/back_translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main(int, char **argv) {
const Document document = document_file.document();

const std::string diff = internal::util::file::read(diff_path);
html::edit(document, diff.c_str());
html::edit(document, diff);

document.save(output);

Expand Down
1 change: 0 additions & 1 deletion jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ add_jar(odr_java
"java/app/opendocument/core/CustomShape.java"
"java/app/opendocument/core/DecodePreference.java"
"java/app/opendocument/core/DecodedFile.java"
"java/app/opendocument/core/DecoderEngine.java"
"java/app/opendocument/core/DirectionalMeasure.java"
"java/app/opendocument/core/DirectionalString.java"
"java/app/opendocument/core/Document.java"
Expand Down
16 changes: 8 additions & 8 deletions jni/java/app/opendocument/core/Circle.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ public final class Circle extends Element {
super(handle, owner);
}

public String x() {
public Measure x() {
return xNative(handle());
}

public String y() {
public Measure y() {
return yNative(handle());
}

public String width() {
public Measure width() {
return widthNative(handle());
}

public String height() {
public Measure height() {
return heightNative(handle());
}

public GraphicStyle style() {
return styleNative(handle());
}

private native String xNative(long handle);
private native Measure xNative(long handle);

private native String yNative(long handle);
private native Measure yNative(long handle);

private native String widthNative(long handle);
private native Measure widthNative(long handle);

private native String heightNative(long handle);
private native Measure heightNative(long handle);

private native GraphicStyle styleNative(long handle);
}
16 changes: 8 additions & 8 deletions jni/java/app/opendocument/core/CustomShape.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ public final class CustomShape extends Element {
super(handle, owner);
}

public String x() {
public Measure x() {
return xNative(handle());
}

public String y() {
public Measure y() {
return yNative(handle());
}

public String width() {
public Measure width() {
return widthNative(handle());
}

public String height() {
public Measure height() {
return heightNative(handle());
}

public GraphicStyle style() {
return styleNative(handle());
}

private native String xNative(long handle);
private native Measure xNative(long handle);

private native String yNative(long handle);
private native Measure yNative(long handle);

private native String widthNative(long handle);
private native Measure widthNative(long handle);

private native String heightNative(long handle);
private native Measure heightNative(long handle);

private native GraphicStyle styleNative(long handle);
}
12 changes: 0 additions & 12 deletions jni/java/app/opendocument/core/DecodePreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,14 @@
public final class DecodePreference {
/** Decode as this file type; {@code null} to detect. */
public FileType asFileType;
/** Decode with this engine; {@code null} to choose automatically. */
public DecoderEngine withEngine;

public List<FileType> fileTypePriority = new ArrayList<>();
public List<DecoderEngine> enginePriority = new ArrayList<>();

// Flattened for the native layer.
int asFileTypeNative() {
return asFileType == null ? -1 : asFileType.toNative();
}

int withEngineNative() {
return withEngine == null ? -1 : withEngine.toNative();
}

int[] fileTypePriorityNative() {
return fileTypePriority.stream().mapToInt(FileType::toNative).toArray();
}

int[] enginePriorityNative() {
return enginePriority.stream().mapToInt(DecoderEngine::toNative).toArray();
}
}
6 changes: 0 additions & 6 deletions jni/java/app/opendocument/core/DecodedFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public FileMeta fileMeta() {
return fileMetaNative(handle());
}

public DecoderEngine decoderEngine() {
return DecoderEngine.fromNative(decoderEngineNative(handle()));
}

public boolean passwordEncrypted() {
return passwordEncryptedNative(handle());
}
Expand Down Expand Up @@ -127,8 +123,6 @@ public FontFile asFontFile() {

private native FileMeta fileMetaNative(long handle);

private native int decoderEngineNative(long handle);

private native boolean passwordEncryptedNative(long handle);

private native int encryptionStateNative(long handle);
Expand Down
14 changes: 0 additions & 14 deletions jni/java/app/opendocument/core/DecoderEngine.java

This file was deleted.

20 changes: 10 additions & 10 deletions jni/java/app/opendocument/core/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ public AnchorType anchorType() {
return AnchorType.fromNative(anchorTypeNative(handle()));
}

public String x() {
public Measure x() {
return xNative(handle());
}

public String y() {
public Measure y() {
return yNative(handle());
}

public String width() {
public Measure width() {
return widthNative(handle());
}

public String height() {
public Measure height() {
return heightNative(handle());
}

public String zIndex() {
public Integer zIndex() {
return zIndexNative(handle());
}

Expand All @@ -36,15 +36,15 @@ public GraphicStyle style() {

private native int anchorTypeNative(long handle);

private native String xNative(long handle);
private native Measure xNative(long handle);

private native String yNative(long handle);
private native Measure yNative(long handle);

private native String widthNative(long handle);
private native Measure widthNative(long handle);

private native String heightNative(long handle);
private native Measure heightNative(long handle);

private native String zIndexNative(long handle);
private native Integer zIndexNative(long handle);

private native GraphicStyle styleNative(long handle);
}
16 changes: 8 additions & 8 deletions jni/java/app/opendocument/core/Line.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ public final class Line extends Element {
super(handle, owner);
}

public String x1() {
public Measure x1() {
return x1Native(handle());
}

public String y1() {
public Measure y1() {
return y1Native(handle());
}

public String x2() {
public Measure x2() {
return x2Native(handle());
}

public String y2() {
public Measure y2() {
return y2Native(handle());
}

public GraphicStyle style() {
return styleNative(handle());
}

private native String x1Native(long handle);
private native Measure x1Native(long handle);

private native String y1Native(long handle);
private native Measure y1Native(long handle);

private native String x2Native(long handle);
private native Measure x2Native(long handle);

private native String y2Native(long handle);
private native Measure y2Native(long handle);

private native GraphicStyle styleNative(long handle);
}
29 changes: 2 additions & 27 deletions jni/java/app/opendocument/core/Odr.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ public static String mimetypeByFileType(FileType type) {
return mimetypeByFileTypeNative(type.toNative());
}

public static String decoderEngineToString(DecoderEngine engine) {
return decoderEngineToStringNative(engine.toNative());
}

public static DecoderEngine decoderEngineByName(String name) {
return DecoderEngine.fromNative(decoderEngineByNameNative(name));
}

/** Determines the possible file types of a file. */
public static List<FileType> listFileTypes(String path) {
List<FileType> result = new ArrayList<>();
Expand All @@ -74,15 +66,6 @@ public static List<FileType> listFileTypes(String path) {
return result;
}

/** Determines the decoder engines for a file type. */
public static List<DecoderEngine> listDecoderEngines(FileType as) {
List<DecoderEngine> result = new ArrayList<>();
for (int code : listDecoderEnginesNative(as.toNative())) {
result.add(DecoderEngine.fromNative(code));
}
return result;
}

/** Determines the MIME type of a file. */
public static native String mimetype(String path);

Expand All @@ -107,9 +90,7 @@ public static DecodedFile open(String path, DecodePreference preference) {
openWithPreferenceNative(
path,
preference.asFileTypeNative(),
preference.withEngineNative(),
preference.fileTypePriorityNative(),
preference.enginePriorityNative()));
preference.fileTypePriorityNative()));
}

private static native int fileTypeByFileExtensionNative(String extension);
Expand All @@ -128,22 +109,16 @@ public static DecodedFile open(String path, DecodePreference preference) {

private static native String mimetypeByFileTypeNative(int type);

private static native String decoderEngineToStringNative(int engine);

private static native int decoderEngineByNameNative(String name);

private static native int[] listFileTypesNative(String path);

private static native int[] listDecoderEnginesNative(int as);

private static native long openNative(String path);

private static native long openWithLoggerNative(String path, long logger);

private static native long openAsNative(String path, int as);

private static native long openWithPreferenceNative(
String path, int asFileType, int withEngine, int[] fileTypePriority, int[] enginePriority);
String path, int asFileType, int[] fileTypePriority);

private Odr() {}
}
16 changes: 0 additions & 16 deletions jni/java/app/opendocument/core/OdrException.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ public UnsupportedFileType(String message) {
}
}

public static final class UnknownDecoderEngine extends OdrException {
private static final long serialVersionUID = 1L;

public UnknownDecoderEngine(String message) {
super(message);
}
}

public static final class UnsupportedDecoderEngine extends OdrException {
private static final long serialVersionUID = 1L;

public UnsupportedDecoderEngine(String message) {
super(message);
}
}

public static final class FileReadError extends OdrException {
private static final long serialVersionUID = 1L;

Expand Down
Loading
Loading