Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f80f519
draft
andiwand Oct 4, 2025
432e8f5
draft
andiwand Oct 5, 2025
c7bef0c
draft
andiwand Oct 5, 2025
7e45387
draft
andiwand Oct 5, 2025
43f2880
draft more
andiwand Oct 6, 2025
ef93863
ooxml text
andiwand Oct 7, 2025
36c172e
make compile
andiwand Oct 26, 2025
58e768d
transfer ooxml text element functions
andiwand Oct 26, 2025
8eb4ae3
update conan lock
andiwand Oct 26, 2025
f77cdce
update lock again
andiwand Oct 26, 2025
f959eca
again
andiwand Oct 26, 2025
f48d823
Merge branch 'main' of github.com:opendocument-app/OpenDocument.core …
andiwand Oct 26, 2025
b4f99e0
reprioritize conan remotes
andiwand Oct 26, 2025
ac653b4
update locks again
andiwand Oct 26, 2025
cc83dde
fix warnings
andiwand Oct 26, 2025
393bdd8
fix lock file
andiwand Oct 26, 2025
54f0469
fix lock
andiwand Oct 26, 2025
88ac448
fix warning
andiwand Oct 26, 2025
06bdfb4
fix tidy
andiwand Oct 26, 2025
6b8c149
fix lock
andiwand Oct 26, 2025
3747d40
fix lock
andiwand Oct 26, 2025
49ae6a1
fix warnings
andiwand Oct 26, 2025
868261c
fix
andiwand Oct 26, 2025
d2c3ac7
fix
andiwand Oct 26, 2025
094e48e
draft ooxml spreadsheet element adapters
andiwand Oct 26, 2025
46e3e07
draft ooxml presentation element adapter
andiwand Oct 26, 2025
4899683
Merge branch 'main' of github.com:opendocument-app/OpenDocument.core …
andiwand Nov 30, 2025
25a547a
Merge branch 'main' into rework-document-tree
andiwand Nov 30, 2025
95dfa3e
Merge branch 'main' into rework-document-tree
andiwand Dec 3, 2025
d5b6c89
Merge branch 'main' of github.com:opendocument-app/OpenDocument.core …
andiwand Dec 22, 2025
21836db
Merge branch 'rework-document-tree' of github.com:opendocument-app/Op…
andiwand Dec 22, 2025
a473acf
fix build
andiwand Dec 22, 2025
3437e15
fix element creation
andiwand Dec 22, 2025
c482b1c
multiple fixes
andiwand Dec 22, 2025
706255f
fix build
andiwand Dec 22, 2025
7147c78
registry api
andiwand Dec 22, 2025
6ebb0bd
refactor the refactor
andiwand Dec 25, 2025
62c23cc
fix build
andiwand Dec 25, 2025
76d278a
fix
andiwand Dec 25, 2025
c78ebd7
fix build
andiwand Dec 25, 2025
087b157
fix ods regressions
andiwand Dec 26, 2025
5d92ca0
fix
andiwand Dec 26, 2025
202b90b
fix ods empty spanned cells
andiwand Dec 26, 2025
4786528
partially fix pptx
andiwand Dec 26, 2025
2107877
fix pptx
andiwand Dec 26, 2025
5778fac
fix XLSX
andiwand Dec 27, 2025
2e3a137
fix build
andiwand Dec 27, 2025
c262333
xlsx images
andiwand Dec 28, 2025
c724639
fix build
andiwand Dec 28, 2025
cafa87a
fix docx
andiwand Dec 28, 2025
9c75924
todos
andiwand Dec 28, 2025
374b8a0
more todos
andiwand Dec 28, 2025
d2ab047
fix docx table style
andiwand Dec 28, 2025
75d2977
clean includes
andiwand Dec 28, 2025
9391fc4
clean
andiwand Dec 28, 2025
e5afdd3
update refs
andiwand Dec 28, 2025
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
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ set(ODR_SOURCE_FILES
"src/odr/odr.cpp"
"src/odr/quantity.cpp"
"src/odr/style.cpp"
"src/odr/table_dimension.cpp"
"src/odr/table_position.cpp"

"${CMAKE_CURRENT_BINARY_DIR}/src/odr/internal/git_info.cpp"
"src/odr/internal/magic.cpp"
Expand All @@ -99,15 +101,14 @@ set(ODR_SOURCE_FILES
"src/odr/internal/cfb/cfb_util.cpp"

"src/odr/internal/common/document.cpp"
"src/odr/internal/common/document_element.cpp"
"src/odr/internal/common/file.cpp"
"src/odr/internal/common/filesystem.cpp"
"src/odr/internal/common/image_file.cpp"
"src/odr/internal/common/path.cpp"
"src/odr/internal/common/random.cpp"
"src/odr/internal/common/style.cpp"
"src/odr/internal/common/table_cursor.cpp"
"src/odr/internal/common/table_position.cpp"
"src/odr/table_position.cpp"
"src/odr/internal/common/table_range.cpp"
"src/odr/internal/common/temporary_file.cpp"

Expand All @@ -133,25 +134,24 @@ set(ODR_SOURCE_FILES

"src/odr/internal/odf/odf_crypto.cpp"
"src/odr/internal/odf/odf_document.cpp"
"src/odr/internal/odf/odf_element.cpp"
"src/odr/internal/odf/odf_element_registry.cpp"
"src/odr/internal/odf/odf_file.cpp"
"src/odr/internal/odf/odf_manifest.cpp"
"src/odr/internal/odf/odf_meta.cpp"
"src/odr/internal/odf/odf_parser.cpp"
"src/odr/internal/odf/odf_spreadsheet.cpp"
"src/odr/internal/odf/odf_style.cpp"

"src/odr/internal/oldms/oldms_file.cpp"

"src/odr/internal/ooxml/presentation/ooxml_presentation_document.cpp"
"src/odr/internal/ooxml/presentation/ooxml_presentation_element.cpp"
"src/odr/internal/ooxml/presentation/ooxml_presentation_element_registry.cpp"
"src/odr/internal/ooxml/presentation/ooxml_presentation_parser.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_document.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_element.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_parser.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_element_registry.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_style.cpp"
"src/odr/internal/ooxml/text/ooxml_text_document.cpp"
"src/odr/internal/ooxml/text/ooxml_text_element.cpp"
"src/odr/internal/ooxml/text/ooxml_text_element_registry.cpp"
"src/odr/internal/ooxml/text/ooxml_text_parser.cpp"
"src/odr/internal/ooxml/text/ooxml_text_style.cpp"
"src/odr/internal/ooxml/ooxml_crypto.cpp"
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,13 @@ As an alternative to the Conan remote you can also export the package locally vi
## Version

Versions and history are tracked on [GitHub](https://github.com/opendocument-app/OpenDocument.core).

## Testing

### Running the HTML Comparison Server

Scripts and Docker images can be found here https://github.com/opendocument-app/compare-html

```bash
./test/scripts/compare_output_server.sh
```
6 changes: 4 additions & 2 deletions cli/src/back_translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@

#include <odr/internal/util/file_util.hpp>

#include <iostream>
#include <string>

using namespace odr;

int main(int, char **argv) {
const std::shared_ptr logger =
Logger::create_stdio("odr-back-translate", LogLevel::verbose);

const std::string input{argv[1]};
const std::string diff_path{argv[2]};
const std::string output{argv[3]};

const DocumentFile document_file{input};

if (document_file.password_encrypted()) {
std::cerr << "encrypted documents are not supported" << std::endl;
ODR_FATAL(*logger, "encrypted documents are not supported");
return 1;
}

Expand Down
18 changes: 12 additions & 6 deletions cli/src/meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,27 @@
using namespace odr;

int main(const int argc, char **argv) {
const std::shared_ptr logger =
Logger::create_stdio("odr-meta", LogLevel::verbose);

const std::string input{argv[1]};

const bool has_password = argc >= 4;
std::string password;
if (has_password) {
std::optional<std::string> password;
if (argc >= 3) {
password = argv[2];
}

DocumentFile document_file{input};

if (document_file.password_encrypted() && has_password) {
if (document_file.password_encrypted() && !password) {
ODR_FATAL(*logger, "document encrypted but no password given");
return 2;
}
if (document_file.password_encrypted()) {
try {
document_file = document_file.decrypt(password);
document_file = document_file.decrypt(*password);
} catch (const WrongPasswordError &) {
std::cerr << "wrong password" << std::endl;
ODR_FATAL(*logger, "wrong password");
return 1;
}
}
Expand Down
31 changes: 27 additions & 4 deletions cli/src/server.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#include <odr/archive.hpp>
#include <odr/exceptions.hpp>
#include <odr/file.hpp>
#include <odr/filesystem.hpp>
#include <odr/html.hpp>
#include <odr/http_server.hpp>

#include <iostream>
#include <string>

using namespace odr;

int main(const int argc, char **argv) {
auto logger = Logger::create_stdio("odr-server", LogLevel::verbose);
const std::shared_ptr logger =
Logger::create_stdio("odr-server", LogLevel::verbose);

std::string input{argv[1]};

Expand Down Expand Up @@ -48,15 +50,36 @@ int main(const int argc, char **argv) {
html_config.editable = true;

{
std::string prefix = "one_file";
HtmlViews views = server.serve_file(decoded_file, prefix, html_config);
const std::string prefix = "file";
const HtmlViews views =
server.serve_file(decoded_file, prefix, html_config);
ODR_INFO(*logger, "hosted decoded file with id: " << prefix);
for (const auto &view : views) {
ODR_INFO(*logger,
"http://localhost:8080/file/" << prefix << "/" << view.path());
}
}

if (decoded_file.is_document_file() || decoded_file.is_archive_file()) {
std::optional<Filesystem> filesystem;
if (decoded_file.is_document_file()) {
filesystem = decoded_file.as_document_file().document().as_filesystem();
} else if (decoded_file.is_archive_file()) {
filesystem = decoded_file.as_archive_file().archive().as_filesystem();
}

const std::string prefix = "filesystem";
const HtmlService filesystem_service = html::translate(
filesystem.value(), server_config.cache_path + "/" + prefix,
html_config, logger);
server.connect_service(filesystem_service, prefix);
ODR_INFO(*logger, "hosted filesystem with id: " << prefix);
for (const auto &view : filesystem_service.list_views()) {
ODR_INFO(*logger,
"http://localhost:8080/file/" << prefix << "/" << view.path());
}
}

server.listen("localhost", 8080);

return 0;
Expand Down
8 changes: 5 additions & 3 deletions cli/src/translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
#include <odr/html.hpp>

#include <filesystem>
#include <iostream>
#include <string>

using namespace odr;

int main(const int argc, char **argv) {
const std::shared_ptr logger =
Logger::create_stdio("odr-translate", LogLevel::verbose);

const std::string input{argv[1]};
const std::string output{argv[2]};

Expand All @@ -20,14 +22,14 @@ int main(const int argc, char **argv) {
DecodedFile decoded_file{input};

if (decoded_file.password_encrypted() && !password) {
std::cerr << "document encrypted but no password given" << std::endl;
ODR_FATAL(*logger, "document encrypted but no password given");
return 2;
}
if (decoded_file.password_encrypted()) {
try {
decoded_file = decoded_file.decrypt(*password);
} catch (const WrongPasswordError &) {
std::cerr << "wrong password" << std::endl;
ODR_FATAL(*logger, "wrong password");
return 1;
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/odr/definitions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <cstdint>

namespace odr {

using ElementIdentifier = std::uint64_t;

static constexpr ElementIdentifier null_element_id{0};

} // namespace odr
2 changes: 1 addition & 1 deletion src/odr/document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ DocumentType Document::document_type() const noexcept {
}

Element Document::root_element() const {
return {m_impl.get(), m_impl->root_element()};
return {m_impl->element_adapter(), m_impl->root_element()};
}

Filesystem Document::as_filesystem() const {
Expand Down
Loading