0001-Upgrade-liborcus-to-0.16.0.patch 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. From 9ffb1f6ac0f11fd446fd0e84b8dc69898691b4d3 Mon Sep 17 00:00:00 2001
  2. From: Kohei Yoshida <kohei@libreoffice.org>
  3. Date: Wed, 9 Sep 2020 21:23:48 -0400
  4. Subject: [PATCH] Upgrade liborcus to 0.16.0.
  5. Change-Id: Iae29fb26417dfc161698a81bee84e81545969065
  6. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102502
  7. Tested-by: Jenkins
  8. Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
  9. ---
  10. RepositoryExternal.mk | 4 +-
  11. configure.ac | 2 +-
  12. download.lst | 4 +-
  13. ...k-all-untentionally-unused-variables.patch | 376 ++++++++++++++++++
  14. external/liborcus/ExternalPackage_liborcus.mk | 8 +-
  15. external/liborcus/ExternalProject_liborcus.mk | 4 +-
  16. external/liborcus/Library_orcus-parser.mk | 1 +
  17. external/liborcus/Library_orcus.mk | 4 +
  18. external/liborcus/UnpackedTarball_liborcus.mk | 1 +
  19. .../liborcus/windows-constants-hack.patch | 2 +-
  20. sc/source/filter/inc/orcusinterface.hxx | 21 +-
  21. sc/source/filter/orcus/interface.cxx | 82 ++--
  22. sc/source/filter/orcus/xmlcontext.cxx | 7 +-
  23. sc/source/ui/xmlsource/xmlsourcedlg.cxx | 6 +-
  24. 14 files changed, 475 insertions(+), 47 deletions(-)
  25. create mode 100644 external/liborcus/0001-Mark-all-untentionally-unused-variables.patch
  26. diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
  27. index 7f623ac..df765fa 100644
  28. --- a/RepositoryExternal.mk
  29. +++ b/RepositoryExternal.mk
  30. @@ -3281,7 +3281,7 @@ $(call gb_LinkTarget_set_include,$(1),\
  31. )
  32. $(call gb_LinkTarget_add_libs,$(1),\
  33. - -L$(call gb_UnpackedTarball_get_dir,liborcus)/src/liborcus/.libs -lorcus-0.15 \
  34. + -L$(call gb_UnpackedTarball_get_dir,liborcus)/src/liborcus/.libs -lorcus-0.16 \
  35. )
  36. $(if $(SYSTEM_BOOST), \
  37. @@ -3300,7 +3300,7 @@ $(call gb_LinkTarget_set_include,$(1),\
  38. )
  39. $(call gb_LinkTarget_add_libs,$(1),\
  40. - -L$(call gb_UnpackedTarball_get_dir,liborcus)/src/parser/.libs -lorcus-parser-0.15 \
  41. + -L$(call gb_UnpackedTarball_get_dir,liborcus)/src/parser/.libs -lorcus-parser-0.16 \
  42. )
  43. endef
  44. diff --git a/configure.ac b/configure.ac
  45. index ce14b54..36342b1 100644
  46. --- a/configure.ac
  47. +++ b/configure.ac
  48. @@ -9827,7 +9827,7 @@ AC_SUBST(ENABLE_FUZZERS)
  49. dnl ===================================================================
  50. dnl Orcus
  51. dnl ===================================================================
  52. -libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
  53. +libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
  54. if test "$with_system_orcus" != "yes"; then
  55. if test "$SYSTEM_BOOST" = "TRUE"; then
  56. # ===========================================================
  57. diff --git a/download.lst b/download.lst
  58. index 6398a09..1f3b4b1 100644
  59. --- a/download.lst
  60. +++ b/download.lst
  61. @@ -204,8 +204,8 @@ export OPENLDAP_SHA256SUM := cdd6cffdebcd95161a73305ec13fc7a78e9707b46ca9f84fb89
  62. export OPENLDAP_TARBALL := openldap-2.4.45.tgz
  63. export OPENSSL_SHA256SUM := 14cb464efe7ac6b54799b34456bd69558a749a4931ecfd9cf9f71d7881cac7bc
  64. export OPENSSL_TARBALL := openssl-1.0.2t.tar.gz
  65. -export ORCUS_SHA256SUM := cfb2aa60825f2a78589ed030c07f46a1ee16ef8a2d1bf2279192fbc1ae5a5f61
  66. -export ORCUS_TARBALL := liborcus-0.15.4.tar.bz2
  67. +export ORCUS_SHA256SUM := 854c6ec167ace59baa2984e175bac7b5b2af91bfde4bb10d2088b87a51ed76ec
  68. +export ORCUS_TARBALL := liborcus-0.16.0.tar.bz2
  69. export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb
  70. export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
  71. export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
  72. diff --git a/external/liborcus/0001-Mark-all-untentionally-unused-variables.patch b/external/liborcus/0001-Mark-all-untentionally-unused-variables.patch
  73. new file mode 100644
  74. index 0000000..b0f6a57
  75. --- /dev/null
  76. +++ b/external/liborcus/0001-Mark-all-untentionally-unused-variables.patch
  77. @@ -0,0 +1,376 @@
  78. +From 6d34c41b661a9e8dddf6d08bf1f3c1fd4f5581da Mon Sep 17 00:00:00 2001
  79. +From: Kohei Yoshida <kohei.yoshida@gmail.com>
  80. +Date: Fri, 11 Sep 2020 21:39:09 -0400
  81. +Subject: [PATCH] Mark all untentionally unused variables.
  82. +
  83. +---
  84. + include/orcus/css_parser.hpp | 70 ++++++++++++++++++++++++------
  85. + include/orcus/csv_parser.hpp | 5 ++-
  86. + include/orcus/json_parser.hpp | 15 +++++--
  87. + include/orcus/sax_parser.hpp | 35 ++++++++++++---
  88. + include/orcus/sax_token_parser.hpp | 20 +++++++--
  89. + include/orcus/yaml_parser.hpp | 10 ++++-
  90. + 6 files changed, 124 insertions(+), 31 deletions(-)
  91. +
  92. +diff --git a/include/orcus/css_parser.hpp b/include/orcus/css_parser.hpp
  93. +index cdfae5e0..3e96980b 100644
  94. +--- a/include/orcus/css_parser.hpp
  95. ++++ b/include/orcus/css_parser.hpp
  96. +@@ -31,23 +31,44 @@ namespace orcus {
  97. + class css_handler
  98. + {
  99. + public:
  100. +- void at_rule_name(const char* p, size_t n) {}
  101. ++ void at_rule_name(const char* p, size_t n)
  102. ++ {
  103. ++ (void)p; (void)n;
  104. ++ }
  105. +
  106. +- void simple_selector_type(const char* p, size_t n) {}
  107. ++ void simple_selector_type(const char* p, size_t n)
  108. ++ {
  109. ++ (void)p; (void)n;
  110. ++ }
  111. +
  112. +- void simple_selector_class(const char* p, size_t n) {}
  113. ++ void simple_selector_class(const char* p, size_t n)
  114. ++ {
  115. ++ (void)p; (void)n;
  116. ++ }
  117. +
  118. +- void simple_selector_pseudo_element(orcus::css::pseudo_element_t pe) {}
  119. ++ void simple_selector_pseudo_element(orcus::css::pseudo_element_t pe)
  120. ++ {
  121. ++ (void)pe;
  122. ++ }
  123. +
  124. +- void simple_selector_pseudo_class(orcus::css::pseudo_class_t pc) {}
  125. ++ void simple_selector_pseudo_class(orcus::css::pseudo_class_t pc)
  126. ++ {
  127. ++ (void)pc;
  128. ++ }
  129. +
  130. +- void simple_selector_id(const char* p, size_t n) {}
  131. ++ void simple_selector_id(const char* p, size_t n)
  132. ++ {
  133. ++ (void)p; (void)n;
  134. ++ }
  135. +
  136. + void end_simple_selector() {}
  137. +
  138. + void end_selector() {}
  139. +
  140. +- void combinator(orcus::css::combinator_t combinator) {}
  141. ++ void combinator(orcus::css::combinator_t combinator)
  142. ++ {
  143. ++ (void)combinator;
  144. ++ }
  145. +
  146. + /**
  147. + * Called at each property name.
  148. +@@ -55,7 +76,10 @@ public:
  149. + * @param p pointer to the char-array containing the property name string.
  150. + * @param n length of the property name string.
  151. + */
  152. +- void property_name(const char* p, size_t n) {}
  153. ++ void property_name(const char* p, size_t n)
  154. ++ {
  155. ++ (void)p; (void)n;
  156. ++ }
  157. +
  158. + /**
  159. + * Called at each ordinary property value string.
  160. +@@ -63,7 +87,10 @@ public:
  161. + * @param p pointer to the char-array containing the value string.
  162. + * @param n length of the value string.
  163. + */
  164. +- void value(const char* p, size_t n) {}
  165. ++ void value(const char* p, size_t n)
  166. ++ {
  167. ++ (void)p; (void)n;
  168. ++ }
  169. +
  170. + /**
  171. + * Called at each RGB color value of a property.
  172. +@@ -72,7 +99,10 @@ public:
  173. + * @param green value of green (0-255)
  174. + * @param blue value of blue (0-255)
  175. + */
  176. +- void rgb(uint8_t red, uint8_t green, uint8_t blue) {}
  177. ++ void rgb(uint8_t red, uint8_t green, uint8_t blue)
  178. ++ {
  179. ++ (void)red; (void)green; (void)blue;
  180. ++ }
  181. +
  182. + /**
  183. + * Called at each RGB color value of a property with alpha transparency
  184. +@@ -83,7 +113,10 @@ public:
  185. + * @param blue value of blue (0-255)
  186. + * @param alpha alpha transparency value
  187. + */
  188. +- void rgba(uint8_t red, uint8_t green, uint8_t blue, double alpha) {}
  189. ++ void rgba(uint8_t red, uint8_t green, uint8_t blue, double alpha)
  190. ++ {
  191. ++ (void)red; (void)green; (void)blue; (void)alpha;
  192. ++ }
  193. +
  194. + /**
  195. + * Called at each HSL color value of a property.
  196. +@@ -92,7 +125,10 @@ public:
  197. + * @param sat saturation
  198. + * @param light lightness
  199. + */
  200. +- void hsl(uint8_t hue, uint8_t sat, uint8_t light) {}
  201. ++ void hsl(uint8_t hue, uint8_t sat, uint8_t light)
  202. ++ {
  203. ++ (void)hue; (void)sat; (void)light;
  204. ++ }
  205. +
  206. + /**
  207. + * Called at each HSL color value of a property with alpha transparency
  208. +@@ -103,7 +139,10 @@ public:
  209. + * @param light lightness
  210. + * @param alpha alpha value
  211. + */
  212. +- void hsla(uint8_t hue, uint8_t sat, uint8_t light, double alpha) {}
  213. ++ void hsla(uint8_t hue, uint8_t sat, uint8_t light, double alpha)
  214. ++ {
  215. ++ (void)hue; (void)sat; (void)light; (void)alpha;
  216. ++ }
  217. +
  218. + /**
  219. + * Called at each URL value of a property.
  220. +@@ -111,7 +150,10 @@ public:
  221. + * @param p pointer to the char-array containing the URL value string.
  222. + * @param n length of the URL value string.
  223. + */
  224. +- void url(const char* p, size_t n) {}
  225. ++ void url(const char* p, size_t n)
  226. ++ {
  227. ++ (void)p; (void)n;
  228. ++ }
  229. +
  230. + /**
  231. + * Called when the parsing begins.
  232. +diff --git a/include/orcus/csv_parser.hpp b/include/orcus/csv_parser.hpp
  233. +index a873b0f2..27b4f924 100644
  234. +--- a/include/orcus/csv_parser.hpp
  235. ++++ b/include/orcus/csv_parser.hpp
  236. +@@ -47,7 +47,10 @@ public:
  237. + * the text content is guaranteed to be valid so long as
  238. + * the original CSV stream content is valid.
  239. + */
  240. +- void cell(const char* p, size_t n, bool transient) {}
  241. ++ void cell(const char* p, size_t n, bool transient)
  242. ++ {
  243. ++ (void)p; (void)n; (void)transient;
  244. ++ }
  245. + };
  246. +
  247. + template<typename _Handler>
  248. +diff --git a/include/orcus/json_parser.hpp b/include/orcus/json_parser.hpp
  249. +index 51a3d7cc..ef22b3a8 100644
  250. +--- a/include/orcus/json_parser.hpp
  251. ++++ b/include/orcus/json_parser.hpp
  252. +@@ -54,7 +54,10 @@ public:
  253. + * pointer points to somewhere in the JSON stream being
  254. + * parsed.
  255. + */
  256. +- void object_key(const char* p, size_t len, bool transient) {}
  257. ++ void object_key(const char* p, size_t len, bool transient)
  258. ++ {
  259. ++ (void)p; (void)len; (void)transient;
  260. ++ }
  261. +
  262. + /**
  263. + * Called when the closing curly brace of an object is encountered.
  264. +@@ -87,14 +90,20 @@ public:
  265. + * pointer points to somewhere in the JSON stream being
  266. + * parsed.
  267. + */
  268. +- void string(const char* p, size_t len, bool transient) {}
  269. ++ void string(const char* p, size_t len, bool transient)
  270. ++ {
  271. ++ (void)p; (void)len; (void)transient;
  272. ++ }
  273. +
  274. + /**
  275. + * Called when a numeric value is encountered.
  276. + *
  277. + * @param val numeric value.
  278. + */
  279. +- void number(double val) {}
  280. ++ void number(double val)
  281. ++ {
  282. ++ (void)val;
  283. ++ }
  284. + };
  285. +
  286. + /**
  287. +diff --git a/include/orcus/sax_parser.hpp b/include/orcus/sax_parser.hpp
  288. +index 73c17d06..3b21bfdf 100644
  289. +--- a/include/orcus/sax_parser.hpp
  290. ++++ b/include/orcus/sax_parser.hpp
  291. +@@ -30,7 +30,10 @@ public:
  292. + *
  293. + * @param param struct containing doctype declaration data.
  294. + */
  295. +- void doctype(const orcus::sax::doctype_declaration& param) {}
  296. ++ void doctype(const orcus::sax::doctype_declaration& param)
  297. ++ {
  298. ++ (void)param;
  299. ++ }
  300. +
  301. + /**
  302. + * Called when &lt;?... is encountered, where the '...' may be an
  303. +@@ -39,28 +42,40 @@ public:
  304. + *
  305. + * @param decl name of the identifier.
  306. + */
  307. +- void start_declaration(const orcus::pstring& decl) {}
  308. ++ void start_declaration(const orcus::pstring& decl)
  309. ++ {
  310. ++ (void)decl;
  311. ++ }
  312. +
  313. + /**
  314. + * Called when the closing tag (&gt;) of a &lt;?... ?&gt; is encountered.
  315. + *
  316. + * @param decl name of the identifier.
  317. + */
  318. +- void end_declaration(const orcus::pstring& decl) {}
  319. ++ void end_declaration(const orcus::pstring& decl)
  320. ++ {
  321. ++ (void)decl;
  322. ++ }
  323. +
  324. + /**
  325. + * Called at the start of each element.
  326. + *
  327. + * @param elem information of the element being parsed.
  328. + */
  329. +- void start_element(const orcus::sax::parser_element& elem) {}
  330. ++ void start_element(const orcus::sax::parser_element& elem)
  331. ++ {
  332. ++ (void)elem;
  333. ++ }
  334. +
  335. + /**
  336. + * Called at the end of each element.
  337. + *
  338. + * @param elem information of the element being parsed.
  339. + */
  340. +- void end_element(const orcus::sax::parser_element& elem) {}
  341. ++ void end_element(const orcus::sax::parser_element& elem)
  342. ++ {
  343. ++ (void)elem;
  344. ++ }
  345. +
  346. + /**
  347. + * Called when a segment of a text content is parsed. Each text content
  348. +@@ -76,7 +91,10 @@ public:
  349. + * a non-text value or be interned within the scope of
  350. + * the callback</em>.
  351. + */
  352. +- void characters(const orcus::pstring& val, bool transient) {}
  353. ++ void characters(const orcus::pstring& val, bool transient)
  354. ++ {
  355. ++ (void)val; (void)transient;
  356. ++ }
  357. +
  358. + /**
  359. + * Called upon parsing of an attribute of an element. Note that <em>when
  360. +@@ -86,7 +104,10 @@ public:
  361. + *
  362. + * @param attr struct containing attribute information.
  363. + */
  364. +- void attribute(const orcus::sax::parser_attribute& attr) {}
  365. ++ void attribute(const orcus::sax::parser_attribute& attr)
  366. ++ {
  367. ++ (void)attr;
  368. ++ }
  369. + };
  370. +
  371. + /**
  372. +diff --git a/include/orcus/sax_token_parser.hpp b/include/orcus/sax_token_parser.hpp
  373. +index 1452bc27..6b1b1de4 100644
  374. +--- a/include/orcus/sax_token_parser.hpp
  375. ++++ b/include/orcus/sax_token_parser.hpp
  376. +@@ -71,7 +71,10 @@ public:
  377. + *
  378. + * @param decl struct containing the attributes of the XML declaration.
  379. + */
  380. +- void declaration(const orcus::xml_declaration_t& decl) {}
  381. ++ void declaration(const orcus::xml_declaration_t& decl)
  382. ++ {
  383. ++ (void)decl;
  384. ++ }
  385. +
  386. + /**
  387. + * Called at the start of each element.
  388. +@@ -79,7 +82,10 @@ public:
  389. + * @param elem struct containing the element's information as well as all
  390. + * the attributes that belong to the element.
  391. + */
  392. +- void start_element(const orcus::xml_token_element_t& elem) {}
  393. ++ void start_element(const orcus::xml_token_element_t& elem)
  394. ++ {
  395. ++ (void)elem;
  396. ++ }
  397. +
  398. + /**
  399. + * Called at the end of each element.
  400. +@@ -87,7 +93,10 @@ public:
  401. + * @param elem struct containing the element's information as well as all
  402. + * the attributes that belong to the element.
  403. + */
  404. +- void end_element(const orcus::xml_token_element_t& elem) {}
  405. ++ void end_element(const orcus::xml_token_element_t& elem)
  406. ++ {
  407. ++ (void)elem;
  408. ++ }
  409. +
  410. + /**
  411. + * Called when a segment of a text content is parsed. Each text content
  412. +@@ -103,7 +112,10 @@ public:
  413. + * a non-text value or be interned within the scope of
  414. + * the callback</em>.
  415. + */
  416. +- void characters(const orcus::pstring& val, bool transient) {}
  417. ++ void characters(const orcus::pstring& val, bool transient)
  418. ++ {
  419. ++ (void)val; (void)transient;
  420. ++ }
  421. + };
  422. +
  423. + /**
  424. +diff --git a/include/orcus/yaml_parser.hpp b/include/orcus/yaml_parser.hpp
  425. +index 797ebbec..8d16fbc7 100644
  426. +--- a/include/orcus/yaml_parser.hpp
  427. ++++ b/include/orcus/yaml_parser.hpp
  428. +@@ -72,14 +72,20 @@ public:
  429. + * @param p pointer to the first character of the string value.
  430. + * @param len length of the string value.
  431. + */
  432. +- void string(const char* p, size_t n) {}
  433. ++ void string(const char* p, size_t n)
  434. ++ {
  435. ++ (void)p; (void)n;
  436. ++ }
  437. +
  438. + /**
  439. + * Called when a numeric value is encountered.
  440. + *
  441. + * @param val numeric value.
  442. + */
  443. +- void number(double val) {}
  444. ++ void number(double val)
  445. ++ {
  446. ++ (void)val;
  447. ++ }
  448. +
  449. + /**
  450. + * Called when a boolean 'true' keyword is encountered.
  451. +--
  452. +2.25.1
  453. +
  454. diff --git a/external/liborcus/ExternalPackage_liborcus.mk b/external/liborcus/ExternalPackage_liborcus.mk
  455. index 21dd1bf..7476918 100644
  456. --- a/external/liborcus/ExternalPackage_liborcus.mk
  457. +++ b/external/liborcus/ExternalPackage_liborcus.mk
  458. @@ -12,11 +12,11 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,liborcus,liborcus))
  459. $(eval $(call gb_ExternalPackage_use_external_project,liborcus,liborcus))
  460. ifeq ($(OS),MACOSX)
  461. -$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.15.0.dylib,src/liborcus/.libs/liborcus-0.15.0.dylib))
  462. -$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.15.0.dylib,src/parser/.libs/liborcus-parser-0.15.0.dylib))
  463. +$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.16.0.dylib,src/liborcus/.libs/liborcus-0.16.0.dylib))
  464. +$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.16.0.dylib,src/parser/.libs/liborcus-parser-0.16.0.dylib))
  465. else ifeq ($(DISABLE_DYNLOADING),)
  466. -$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.15.so.0,src/liborcus/.libs/liborcus-0.15.so.0.0.0))
  467. -$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.15.so.0,src/parser/.libs/liborcus-parser-0.15.so.0.0.0))
  468. +$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.16.so.0,src/liborcus/.libs/liborcus-0.16.so.0.0.0))
  469. +$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.16.so.0,src/parser/.libs/liborcus-parser-0.16.so.0.0.0))
  470. endif
  471. # vim: set noet sw=4 ts=4:
  472. diff --git a/external/liborcus/ExternalProject_liborcus.mk b/external/liborcus/ExternalProject_liborcus.mk
  473. index 38658cc..3671294 100644
  474. --- a/external/liborcus/ExternalProject_liborcus.mk
  475. +++ b/external/liborcus/ExternalProject_liborcus.mk
  476. @@ -123,8 +123,8 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
  477. $(MAKE) \
  478. $(if $(filter MACOSX,$(OS)),\
  479. && $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
  480. - $(EXTERNAL_WORKDIR)/src/liborcus/.libs/liborcus-0.15.0.dylib \
  481. - $(EXTERNAL_WORKDIR)/src/parser/.libs/liborcus-parser-0.15.0.dylib \
  482. + $(EXTERNAL_WORKDIR)/src/liborcus/.libs/liborcus-0.16.0.dylib \
  483. + $(EXTERNAL_WORKDIR)/src/parser/.libs/liborcus-parser-0.16.0.dylib \
  484. ) \
  485. )
  486. $(call gb_Trace_EndRange,liborcus,EXTERNAL)
  487. diff --git a/external/liborcus/Library_orcus-parser.mk b/external/liborcus/Library_orcus-parser.mk
  488. index d3cbddb..4e46591 100644
  489. --- a/external/liborcus/Library_orcus-parser.mk
  490. +++ b/external/liborcus/Library_orcus-parser.mk
  491. @@ -63,6 +63,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus-parser,\
  492. UnpackedTarball/liborcus/src/parser/tokens \
  493. UnpackedTarball/liborcus/src/parser/types \
  494. UnpackedTarball/liborcus/src/parser/xml_namespace \
  495. + UnpackedTarball/liborcus/src/parser/xml_writer \
  496. UnpackedTarball/liborcus/src/parser/yaml_parser_base \
  497. UnpackedTarball/liborcus/src/parser/zip_archive \
  498. UnpackedTarball/liborcus/src/parser/zip_archive_stream \
  499. diff --git a/external/liborcus/Library_orcus.mk b/external/liborcus/Library_orcus.mk
  500. index ea99e75..0a0ca58 100644
  501. --- a/external/liborcus/Library_orcus.mk
  502. +++ b/external/liborcus/Library_orcus.mk
  503. @@ -85,6 +85,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus,\
  504. UnpackedTarball/liborcus/src/liborcus/odf_tokens \
  505. UnpackedTarball/liborcus/src/liborcus/ods_content_xml_context \
  506. UnpackedTarball/liborcus/src/liborcus/ods_content_xml_handler \
  507. + UnpackedTarball/liborcus/src/liborcus/ods_dde_links_context \
  508. UnpackedTarball/liborcus/src/liborcus/ods_session_data \
  509. UnpackedTarball/liborcus/src/liborcus/ooxml_content_types \
  510. UnpackedTarball/liborcus/src/liborcus/ooxml_global \
  511. @@ -103,6 +104,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus,\
  512. UnpackedTarball/liborcus/src/liborcus/orcus_xls_xml \
  513. UnpackedTarball/liborcus/src/liborcus/orcus_xlsx \
  514. UnpackedTarball/liborcus/src/liborcus/orcus_xml \
  515. + UnpackedTarball/liborcus/src/liborcus/orcus_xml_impl \
  516. UnpackedTarball/liborcus/src/liborcus/orcus_xml_map_def \
  517. UnpackedTarball/liborcus/src/liborcus/session_context \
  518. UnpackedTarball/liborcus/src/liborcus/spreadsheet_iface_util \
  519. @@ -134,7 +136,9 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus,\
  520. UnpackedTarball/liborcus/src/liborcus/xml_simple_stream_handler \
  521. UnpackedTarball/liborcus/src/liborcus/xml_stream_handler \
  522. UnpackedTarball/liborcus/src/liborcus/xml_stream_parser \
  523. + UnpackedTarball/liborcus/src/liborcus/xml_structure_mapper \
  524. UnpackedTarball/liborcus/src/liborcus/xml_structure_tree \
  525. + UnpackedTarball/liborcus/src/liborcus/xpath_parser \
  526. UnpackedTarball/liborcus/src/liborcus/yaml_document_tree \
  527. ))
  528. diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk
  529. index e5e33b0..4736dbc 100644
  530. --- a/external/liborcus/UnpackedTarball_liborcus.mk
  531. +++ b/external/liborcus/UnpackedTarball_liborcus.mk
  532. @@ -20,6 +20,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
  533. external/liborcus/gcc9.patch.0 \
  534. external/liborcus/libtool.patch.0 \
  535. external/liborcus/fix-pch.patch.0 \
  536. + external/liborcus/0001-Mark-all-untentionally-unused-variables.patch \
  537. ))
  538. ifeq ($(OS),WNT)
  539. diff --git a/external/liborcus/windows-constants-hack.patch b/external/liborcus/windows-constants-hack.patch
  540. index 876bc16..51aabfa 100644
  541. --- a/external/liborcus/windows-constants-hack.patch
  542. +++ b/external/liborcus/windows-constants-hack.patch
  543. @@ -8,7 +8,7 @@ index ae571f5..539ce18 100644
  544. -#include "constants.inl"
  545. +#define ORCUS_MAJOR_VERSION 0
  546. -+#define ORCUS_MINOR_VERSION 11
  547. ++#define ORCUS_MINOR_VERSION 16
  548. +#define ORCUS_MICRO_VERSION 0
  549. namespace orcus {
  550. diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
  551. index b298c71..00aea67 100644
  552. --- a/sc/source/filter/inc/orcusinterface.hxx
  553. +++ b/sc/source/filter/inc/orcusinterface.hxx
  554. @@ -62,6 +62,11 @@ public:
  555. {
  556. return mnTextEncoding;
  557. }
  558. +
  559. + ScDocumentImport& getDoc() const
  560. + {
  561. + return mrDoc;
  562. + }
  563. };
  564. class ScOrcusRefResolver : public orcus::spreadsheet::iface::import_reference_resolver
  565. @@ -71,20 +76,28 @@ class ScOrcusRefResolver : public orcus::spreadsheet::iface::import_reference_re
  566. public:
  567. ScOrcusRefResolver( const ScOrcusGlobalSettings& rGS );
  568. - orcus::spreadsheet::address_t resolve_address(const char* p, size_t n) override;
  569. - orcus::spreadsheet::range_t resolve_range(const char* p, size_t n) override;
  570. + orcus::spreadsheet::src_address_t resolve_address(const char* p, size_t n) override;
  571. + orcus::spreadsheet::src_range_t resolve_range(const char* p, size_t n) override;
  572. };
  573. class ScOrcusNamedExpression : public orcus::spreadsheet::iface::import_named_expression
  574. {
  575. ScDocumentImport& mrDoc;
  576. const ScOrcusGlobalSettings& mrGlobalSettings;
  577. - SCTAB mnTab; //< negative if global, else >= 0 for sheet-local named expressions.
  578. + ScAddress maBasePos;
  579. + OUString maName;
  580. + OUString maExpr;
  581. + const SCTAB mnTab; //< negative if global, else >= 0 for sheet-local named expressions.
  582. public:
  583. ScOrcusNamedExpression( ScDocumentImport& rDoc, const ScOrcusGlobalSettings& rGS, SCTAB nTab = -1 );
  584. - virtual void define_name(const char* p_name, size_t n_name, const char* p_exp, size_t n_exp) override;
  585. + void reset();
  586. +
  587. + virtual void set_base_position(const orcus::spreadsheet::src_address_t& pos) override;
  588. + virtual void set_named_expression(const char* p_name, size_t n_name, const char* p_exp, size_t n_exp) override;
  589. + virtual void set_named_range(const char* p_name, size_t n_name, const char* p_range, size_t n_range) override;
  590. + virtual void commit() override;
  591. };
  592. class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_strings
  593. diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
  594. index 220f7ce..aa96eb2 100644
  595. --- a/sc/source/filter/orcus/interface.cxx
  596. +++ b/sc/source/filter/orcus/interface.cxx
  597. @@ -46,6 +46,7 @@
  598. #include <sal/log.hxx>
  599. #include <stylesbuffer.hxx>
  600. +#include <orcus/exception.hpp>
  601. using namespace com::sun::star;
  602. @@ -158,51 +159,54 @@ orcus::spreadsheet::formula_grammar_t ScOrcusGlobalSettings::get_default_formula
  603. ScOrcusRefResolver::ScOrcusRefResolver( const ScOrcusGlobalSettings& rGS ) :
  604. mrGlobalSettings(rGS) {}
  605. -os::address_t ScOrcusRefResolver::resolve_address(const char* p, size_t n)
  606. +os::src_address_t ScOrcusRefResolver::resolve_address(const char* p, size_t n)
  607. {
  608. OUString aStr(p, n, mrGlobalSettings.getTextEncoding());
  609. ScAddress aAddr;
  610. - aAddr.Parse(aStr, nullptr,
  611. + aAddr.Parse(aStr, &mrGlobalSettings.getDoc().getDoc(),
  612. formula::FormulaGrammar::extractRefConvention(
  613. mrGlobalSettings.getCalcGrammar()));
  614. - os::address_t ret;
  615. - ret.column = 0;
  616. - ret.row = 0;
  617. -
  618. - if (aAddr.IsValid())
  619. + if (!aAddr.IsValid())
  620. {
  621. - ret.column = aAddr.Col();
  622. - ret.row = aAddr.Row();
  623. + std::ostringstream os;
  624. + os << "'" << std::string(p, n) << "' is not a valid address expression.";
  625. + throw orcus::invalid_arg_error(os.str());
  626. }
  627. + os::src_address_t ret;
  628. + ret.sheet = aAddr.Tab();
  629. + ret.column = aAddr.Col();
  630. + ret.row = aAddr.Row();
  631. +
  632. return ret;
  633. }
  634. -os::range_t ScOrcusRefResolver::resolve_range(const char* p, size_t n)
  635. +os::src_range_t ScOrcusRefResolver::resolve_range(const char* p, size_t n)
  636. {
  637. OUString aStr(p, n, mrGlobalSettings.getTextEncoding());
  638. ScRange aRange;
  639. - aRange.Parse(aStr, nullptr,
  640. + aRange.Parse(aStr, &mrGlobalSettings.getDoc().getDoc(),
  641. formula::FormulaGrammar::extractRefConvention(
  642. mrGlobalSettings.getCalcGrammar()));
  643. - os::range_t ret;
  644. - ret.first.column = 0;
  645. - ret.first.row = 0;
  646. - ret.last.column = 0;
  647. - ret.last.row = 0;
  648. -
  649. - if (aRange.IsValid())
  650. + if (!aRange.IsValid())
  651. {
  652. - ret.first.column = aRange.aStart.Col();
  653. - ret.first.row = aRange.aStart.Row();
  654. - ret.last.column = aRange.aEnd.Col();
  655. - ret.last.row = aRange.aEnd.Row();
  656. + std::ostringstream os;
  657. + os << "'" << std::string(p, n) << "' is not a valid range expression.";
  658. + throw orcus::invalid_arg_error(os.str());
  659. }
  660. + os::src_range_t ret;
  661. + ret.first.sheet = aRange.aStart.Tab();
  662. + ret.first.column = aRange.aStart.Col();
  663. + ret.first.row = aRange.aStart.Row();
  664. + ret.last.sheet = aRange.aEnd.Tab();
  665. + ret.last.column = aRange.aEnd.Col();
  666. + ret.last.row = aRange.aEnd.Row();
  667. +
  668. return ret;
  669. }
  670. @@ -210,20 +214,46 @@ ScOrcusNamedExpression::ScOrcusNamedExpression(
  671. ScDocumentImport& rDoc, const ScOrcusGlobalSettings& rGS, SCTAB nTab ) :
  672. mrDoc(rDoc), mrGlobalSettings(rGS), mnTab(nTab) {}
  673. -void ScOrcusNamedExpression::define_name(const char* p_name, size_t n_name, const char* p_exp, size_t n_exp)
  674. +void ScOrcusNamedExpression::reset()
  675. +{
  676. + maBasePos.SetTab(0);
  677. + maBasePos.SetCol(0);
  678. + maBasePos.SetRow(0);
  679. + maName.clear();
  680. + maExpr.clear();
  681. +}
  682. +
  683. +void ScOrcusNamedExpression::set_base_position(const orcus::spreadsheet::src_address_t& pos)
  684. +{
  685. + maBasePos.SetTab(pos.sheet);
  686. + maBasePos.SetCol(pos.column);
  687. + maBasePos.SetRow(pos.row);
  688. +}
  689. +
  690. +void ScOrcusNamedExpression::set_named_expression(const char* p_name, size_t n_name, const char* p_exp, size_t n_exp)
  691. +{
  692. + maName = OUString(p_name, n_name, mrGlobalSettings.getTextEncoding());
  693. + maExpr = OUString(p_exp, n_exp, mrGlobalSettings.getTextEncoding());
  694. +}
  695. +
  696. +void ScOrcusNamedExpression::set_named_range(const char* /*p_name*/, size_t /*n_name*/, const char* /*p_range*/, size_t /*n_range*/)
  697. {
  698. - OUString aName(p_name, n_name, mrGlobalSettings.getTextEncoding());
  699. - OUString aExpr(p_exp, n_exp, mrGlobalSettings.getTextEncoding());
  700. + throw std::runtime_error("ScOrcusNamedExpression::set_named_range not implemented yet.");
  701. +}
  702. +void ScOrcusNamedExpression::commit()
  703. +{
  704. ScRangeName* pNames = mnTab >= 0 ? mrDoc.getDoc().GetRangeName(mnTab) : mrDoc.getDoc().GetRangeName();
  705. if (!pNames)
  706. return;
  707. ScRangeData* pRange = new ScRangeData(
  708. - &mrDoc.getDoc(), aName, aExpr, ScAddress(), ScRangeData::Type::Name,
  709. + &mrDoc.getDoc(), maName, maExpr, maBasePos, ScRangeData::Type::Name,
  710. mrGlobalSettings.getCalcGrammar());
  711. pNames->insert(pRange, false);
  712. +
  713. + reset(); // make sure to reset the state for the next run.
  714. }
  715. ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, Type eType)
  716. diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx
  717. index ab16ae6..09f3ba9 100644
  718. --- a/sc/source/filter/orcus/xmlcontext.cxx
  719. +++ b/sc/source/filter/orcus/xmlcontext.cxx
  720. @@ -89,10 +89,9 @@ void populateTree(
  721. rTreeCtrl.set_image(*xEntry, rParam.maImgElementRepeat, -1);
  722. }
  723. - orcus::xml_structure_tree::entity_names_type aNames;
  724. + orcus::xml_structure_tree::entity_names_type aNames = rWalker.get_attributes();
  725. // Insert attributes.
  726. - rWalker.get_attributes(aNames);
  727. for (const orcus::xml_structure_tree::entity_name& rAttrName : aNames)
  728. {
  729. OUString sAttr(toString(rAttrName, rWalker));
  730. @@ -106,7 +105,7 @@ void populateTree(
  731. rTreeCtrl.set_image(*xAttr, rParam.maImgAttribute, -1);
  732. }
  733. - rWalker.get_children(aNames);
  734. + aNames = rWalker.get_children();
  735. // Non-leaf if it has child elements, leaf otherwise.
  736. rEntryData.mbLeafNode = aNames.empty();
  737. @@ -266,7 +265,7 @@ void ScOrcusXMLContextImpl::importXML(const ScOrcusImportXMLParam& rParam)
  738. std::for_each(rLink.maFieldPaths.begin(), rLink.maFieldPaths.end(),
  739. [&filter](const OString& rFieldPath)
  740. {
  741. - filter.append_field_link(rFieldPath.getStr());
  742. + filter.append_field_link(rFieldPath.getStr(), orcus::pstring());
  743. }
  744. );
  745. diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
  746. index 1eb2e4b..167ecae 100644
  747. --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
  748. +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
  749. @@ -49,8 +49,12 @@ OUString getXPath(
  750. if (pData)
  751. rNamespaces.push_back(pData->mnNamespaceID);
  752. + // element separator is '/' whereas attribute separator is '/@' in xpath.
  753. aBuf.insert(0, rTree.get_text(*xEntry, 0));
  754. - aBuf.insert(0, isAttribute(rTree, *xEntry) ? '@' : '/');
  755. + if (isAttribute(rTree, *xEntry))
  756. + aBuf.insert(0, "/@");
  757. + else
  758. + aBuf.insert(0, '/');
  759. }
  760. while (rTree.iter_parent(*xEntry));
  761. --
  762. 2.26.2