diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
commit | 5a7157d319477830426797532e02ac39d3b859f4 (patch) | |
tree | 3773f5ce209bee14a5643e98672e0f3828c71434 /sc/source/filter | |
parent | Releasing progress-linux version 4:24.2.0-3~progress7.99u1. (diff) | |
download | libreoffice-5a7157d319477830426797532e02ac39d3b859f4.tar.xz libreoffice-5a7157d319477830426797532e02ac39d3b859f4.zip |
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | sc/source/filter/excel/xeroot.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/excel/xestream.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 53 | ||||
-rw-r--r-- | sc/source/filter/inc/htmlpars.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/rtf/rtfparse.cxx | 4 |
5 files changed, 66 insertions, 5 deletions
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index ce281890f8..c1959767d9 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -317,8 +317,10 @@ uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( std::u16s { rtlRandomPool aRandomPool = rtl_random_createPool (); sal_uInt8 pnDocId[16]; - rtl_random_getBytes( aRandomPool, pnDocId, 16 ); - + if (rtl_random_getBytes(aRandomPool, pnDocId, 16) != rtl_Random_E_None) + { + throw uno::RuntimeException("rtl_random_getBytes failed"); + } rtl_random_destroyPool( aRandomPool ); sal_uInt16 pnPasswd[16] = {}; diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 4158fa2c15..a70e4e08bd 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -564,7 +564,10 @@ void XclExpBiff8Encrypter::Init( const Sequence< NamedValue >& rEncryptionData ) // generate the salt here rtlRandomPool aRandomPool = rtl_random_createPool (); - rtl_random_getBytes( aRandomPool, mpnSalt, 16 ); + if (rtl_random_getBytes(aRandomPool, mpnSalt, 16) != rtl_Random_E_None) + { + throw uno::RuntimeException("rtl_random_getBytes failed"); + } rtl_random_destroyPool( aRandomPool ); memset( mpnSaltDigest, 0, sizeof( mpnSaltDigest ) ); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index f5f8900815..be957b1851 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -61,6 +61,7 @@ #include <rangelst.hxx> #include <orcus/css_parser.hpp> +#include <boost/property_tree/json_parser.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> @@ -71,6 +72,48 @@ using ::editeng::SvxBorderLine; using namespace ::com::sun::star; +namespace +{ +/// data-sheets-value from google sheets, value is a JSON. +void ParseDataSheetsValue(const OUString& rDataSheetsValue, std::optional<OUString>& rVal, std::optional<OUString>& rNum) +{ + // data-sheets-value from google sheets, value is a JSON. + OString aEncodedOption = rDataSheetsValue.toUtf8(); + const char* pEncodedOption = aEncodedOption.getStr(); + std::stringstream aStream(pEncodedOption); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + // The "1" key describes the original data type. + auto it = aTree.find("1"); + if (it != aTree.not_found()) + { + int nValueType = std::stoi(it->second.get_value<std::string>()); + switch (nValueType) + { + case 2: + { + // 2 is text. + // See SfxHTMLParser::GetTableDataOptionsValNum(), we leave the parse and a number + // language unspecified. + rNum = ";;@"; + break; + } + case 4: + { + // 4 is boolean. + it = aTree.find("4"); + if (it != aTree.not_found()) + { + rVal = OUString::fromUtf8(it->second.get_value<std::string>()); + } + rNum = ";;BOOLEAN"; + break; + } + } + } +} +} + ScHTMLStyles::ScHTMLStyles() : maEmpty() {} void ScHTMLStyles::add(const char* pElemName, size_t nElemName, const char* pClassName, size_t nClassName, @@ -978,6 +1021,11 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* pInfo ) mxActEntry->pNumStr = rOption.GetString(); } break; + case HtmlOptionId::DSVAL: + { + ParseDataSheetsValue(rOption.GetString(), mxActEntry->pValStr, mxActEntry->pNumStr); + } + break; default: break; } } @@ -2116,6 +2164,11 @@ void ScHTMLTable::DataOn( const HtmlImportInfo& rInfo ) } } break; + case HtmlOptionId::DSVAL: + { + ParseDataSheetsValue(rOption.GetString(), pValStr, pNumStr); + } + break; default: break; } } diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx index fcdf6b4443..5b2d441098 100644 --- a/sc/source/filter/inc/htmlpars.hxx +++ b/sc/source/filter/inc/htmlpars.hxx @@ -149,6 +149,7 @@ class HTMLOption; typedef ::std::map<SCROW, SCROW> InnerMap; typedef ::std::map<sal_uInt16, InnerMap*> OuterMap; +/// HTML parser used during paste into Calc. class ScHTMLLayoutParser : public ScHTMLParser { private: @@ -575,6 +576,8 @@ public: Builds the table structure correctly, ignores extended formatting like pictures or column widths. + + Used during file load / import into Calc. */ class ScHTMLQueryParser : public ScHTMLParser { diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx index b2d2b8c252..0617a86c62 100644 --- a/sc/source/filter/rtf/rtfparse.cxx +++ b/sc/source/filter/rtf/rtfparse.cxx @@ -101,8 +101,8 @@ inline void ScRTFParser::NextRow() bool ScRTFParser::SeekTwips( sal_uInt16 nTwips, SCCOL* pCol ) { - ScRTFColTwips::const_iterator it = aColTwips.find( nTwips ); - bool bFound = it != aColTwips.end(); + ScRTFColTwips::const_iterator it = aColTwips.lower_bound( nTwips ); + bool bFound = it != aColTwips.end() && *it == nTwips; sal_uInt16 nPos = it - aColTwips.begin(); *pCol = static_cast<SCCOL>(nPos); if ( bFound ) |