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 | |
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/core/data/colcontainer.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/column3.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dociter.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/document10.cxx | 17 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/data/table4.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/validat.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 10 | ||||
-rw-r--r-- | sc/source/core/tool/typedstrdata.cxx | 54 | ||||
-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 | ||||
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/app/transobj.cxx | 46 | ||||
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 140 |
21 files changed, 262 insertions, 120 deletions
diff --git a/sc/source/core/data/colcontainer.cxx b/sc/source/core/data/colcontainer.cxx index f6ef8ff7da..a0a9d84577 100644 --- a/sc/source/core/data/colcontainer.cxx +++ b/sc/source/core/data/colcontainer.cxx @@ -47,10 +47,9 @@ void ScColContainer::Clear() void ScColContainer::resize( ScSheetLimits const & rSheetLimits, const size_t aNewColSize ) { size_t aOldColSize = aCols.size(); - if (aNewColSize > aCols.capacity()) - aCols.reserve( aNewColSize ); + aCols.resize( aNewColSize ); for ( size_t nCol = aOldColSize; nCol < aNewColSize; ++nCol ) - aCols.emplace_back(new ScColumn(rSheetLimits)); + aCols[nCol].reset(new ScColumn(rSheetLimits)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index a0b0c639a0..7902722638 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2584,7 +2584,7 @@ class FilterEntriesHandler { if (!mrFilterEntries.mbHasEmpties) { - mrFilterEntries.push_back(ScTypedStrData(OUString())); + mrFilterEntries.push_back(ScTypedStrData(OUString(), 0.0, 0.0, ScTypedStrData::Standard, false, mbFilteredRow)); mrFilterEntries.mbHasEmpties = true; } return; @@ -2614,7 +2614,7 @@ class FilterEntriesHandler OUString aErr = ScGlobal::GetErrorString(nErr); if (!aErr.isEmpty()) { - mrFilterEntries.push_back(ScTypedStrData(std::move(aErr))); + mrFilterEntries.push_back(ScTypedStrData(std::move(aErr), 0.0, 0.0, ScTypedStrData::Standard, false, mbFilteredRow)); return; } } diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index b1fca78c86..1fe1f5344d 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1683,13 +1683,13 @@ void ScDocRowHeightUpdater::updateAll(const bool bOnlyUsedRows) ScProgress aProgress(mrDoc.GetDocumentShell(), ScResId(STR_PROGRESS_HEIGHTING), nCellCount, true); Fraction aZoom(1, 1); - sc::RowHeightContext aCxt(mrDoc.MaxRow(), mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev); sal_uInt64 nProgressStart = 0; for (SCTAB nTab = 0; nTab < mrDoc.GetTableCount(); ++nTab) { if (!ValidTab(nTab) || !mrDoc.maTabs[nTab]) continue; + sc::RowHeightContext aCxt(mrDoc.MaxRow(), mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev); SCCOL nEndCol = 0; SCROW nEndRow = mrDoc.MaxRow(); if (!bOnlyUsedRows || mrDoc.GetPrintArea(nTab, nEndCol, nEndRow)) diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index b42a8d36b5..8ae4ff6c4e 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -89,6 +89,7 @@ void sortAndRemoveDuplicates(std::vector<ScTypedStrData>& rStrings, bool bCaseSe std::vector<ScTypedStrData>::iterator it = std::unique(rStrings.begin(), rStrings.end(), ScTypedStrData::EqualCaseSensitive()); rStrings.erase(it, rStrings.end()); + std::stable_sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessSortCaseSensitive()); } else { @@ -96,6 +97,7 @@ void sortAndRemoveDuplicates(std::vector<ScTypedStrData>& rStrings, bool bCaseSe std::vector<ScTypedStrData>::iterator it = std::unique(rStrings.begin(), rStrings.end(), ScTypedStrData::EqualCaseInsensitive()); rStrings.erase(it, rStrings.end()); + std::stable_sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessSortCaseInsensitive()); } if (std::any_of(rStrings.begin(), rStrings.end(), [](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); })) { diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index ff6d77b432..15bb28fe61 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6896,6 +6896,8 @@ void ScDocument::GetNotesInRange( const ScRangeList& rRangeList, std::vector<sc: const ScRange & rRange = rRangeList[i]; for( SCTAB nTab = rRange.aStart.Tab(); nTab <= rRange.aEnd.Tab(); ++nTab ) { + if (!maTabs[nTab]) + continue; maTabs[nTab]->GetNotesInRange( rRange, rNotes ); } } @@ -6914,6 +6916,8 @@ bool ScDocument::ContainsNotesInRange( const ScRangeList& rRangeList ) const const ScRange & rRange = rRangeList[i]; for( SCTAB nTab = rRange.aStart.Tab(); nTab <= rRange.aEnd.Tab(); ++nTab ) { + if (!maTabs[nTab]) + continue; bool bContainsNote = maTabs[nTab]->ContainsNotesInRange( rRange ); if(bContainsNote) return true; diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index acf0f27672..df50575589 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -22,7 +22,7 @@ #include <refupdatecontext.hxx> #include <sal/log.hxx> -#include <editeng/colritem.hxx> +#include <svx/DocumentColorHelper.hxx> #include <scitems.hxx> #include <datamapper.hxx> #include <docsh.hxx> @@ -188,17 +188,10 @@ std::set<Color> ScDocument::GetDocColors() { std::set<Color> aDocColors; ScDocumentPool *pPool = GetPool(); - const sal_uInt16 pAttribs[] = {ATTR_BACKGROUND, ATTR_FONT_COLOR}; - for (sal_uInt16 nAttrib : pAttribs) - { - for (const SfxPoolItem* pItem : pPool->GetItemSurrogates(nAttrib)) - { - const SvxColorItem *pColorItem = static_cast<const SvxColorItem*>(pItem); - Color aColor( pColorItem->GetValue() ); - if (COL_AUTO != aColor) - aDocColors.insert(aColor); - } - } + + svx::DocumentColorHelper::queryColors<SvxBrushItem>(ATTR_BACKGROUND, pPool, aDocColors); + svx::DocumentColorHelper::queryColors<SvxColorItem>(ATTR_FONT_COLOR, pPool, aDocColors); + return aDocColors; } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index afe2216b1a..6d7c5b0ac8 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -503,6 +503,7 @@ void ScTable::CopyToClip( nCol2 = ClampToAllocatedColumns(nCol2); + pTable->CreateColumnIfNotExists(nCol2); // prevent repeated resizing for ( SCCOL i = nCol1; i <= nCol2; i++) aCol[i].CopyToClip(rCxt, nRow1, nRow2, pTable->CreateColumnIfNotExists(i)); // notes are handled at column level @@ -638,6 +639,9 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO { ScRange aOldRange( nCol1 - nDx, nRow1 - nDy, pTable->nTab, nCol2 - nDx, nRow2 - nDy, pTable->nTab); ScRange aNewRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab ); + // Don't deduplicate when undoing or creating an Undo document! It would disallow correct undo + bool bUndoContext = rDocument.IsUndo() || pTable->rDocument.IsUndo(); + // Note that Undo documents use same pool as the original document bool bSameDoc = rDocument.GetStyleSheetPool() == pTable->rDocument.GetStyleSheetPool(); for(const auto& rxCondFormat : *pTable->mpCondFormatList) @@ -658,7 +662,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO aRefCxt.mnTabDelta = nTab - pTable->nTab; pNewFormat->UpdateReference(aRefCxt, true); - if (bSameDoc && pTable->nTab == nTab && CheckAndDeduplicateCondFormat(rDocument, mpCondFormatList->GetFormat(rxCondFormat->GetKey()), pNewFormat.get(), nTab)) + if (!bUndoContext && bSameDoc && pTable->nTab == nTab && CheckAndDeduplicateCondFormat(rDocument, mpCondFormatList->GetFormat(rxCondFormat->GetKey()), pNewFormat.get(), nTab)) { continue; } @@ -668,7 +672,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO { // Check if there is the same format in the destination // If there is, then simply expand its range - if (CheckAndDeduplicateCondFormat(rDocument, rxCond.get(), pNewFormat.get(), nTab)) + if (!bUndoContext && CheckAndDeduplicateCondFormat(rDocument, rxCond.get(), pNewFormat.get(), nTab)) { bDuplicate = true; break; @@ -1348,6 +1352,7 @@ void ScTable::CopyToTable( // can lead to repetitive splitting and rejoining of the same formula group, which can get // quadratically expensive with large groups. So do the grouping just once at the end. sc::DelayFormulaGroupingSwitch delayGrouping( pDestTab->rDocument, true ); + pDestTab->CreateColumnIfNotExists(ClampToAllocatedColumns(nCol2)); // avoid repeated resizing for (SCCOL i = nCol1; i <= ClampToAllocatedColumns(nCol2); i++) aCol[i].CopyToColumn(rCxt, nRow1, nRow2, bToUndoDoc ? nFlags : nTempFlags, bMarked, pDestTab->CreateColumnIfNotExists(i), pMarkData, bAsLink, bGlobalNamesToLocal); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 62b9dbb9e0..f8a03dd4c7 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -1314,7 +1314,7 @@ void ScTable::GetBackColorArea(SCCOL& rStartCol, SCROW& /*rStartRow*/, const ScPatternAttr* pPattern = ColumnData(nCol).GetPattern(rEndRow + 1); const SvxBrushItem* pBackground = &pPattern->GetItem(ATTR_BACKGROUND); if (!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty() || - pBackground != pDefBackground) + (pBackground->GetColor() != COL_TRANSPARENT && pBackground != pDefBackground)) { bExtend = true; break; diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index a46b09986b..5a569ef944 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -381,6 +381,9 @@ bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput, if ( eErrorStyle == SC_VALERR_MACRO ) return DoMacro(rPos, rInput, nullptr, pParent); + if (!bShowError) + return true; + // Output error message OUString aTitle = aErrorTitle; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 63b1f09692..c9934c26ff 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4738,6 +4738,7 @@ std::unique_ptr<ScTokenArray> ScCompiler::CompileString( const OUString& rFormul pFunctionStack[0].eOp = ocNone; pFunctionStack[0].nSep = 0; size_t nFunction = 0; + size_t nHighWatermark = 0; short nBrackets = 0; bool bInArray = false; eLastOp = ocOpen; @@ -4757,6 +4758,7 @@ std::unique_ptr<ScTokenArray> ScCompiler::CompileString( const OUString& rFormul ++nFunction; pFunctionStack[ nFunction ].eOp = eLastOp; pFunctionStack[ nFunction ].nSep = 0; + nHighWatermark = nFunction; } } break; @@ -4795,6 +4797,7 @@ std::unique_ptr<ScTokenArray> ScCompiler::CompileString( const OUString& rFormul ++nFunction; pFunctionStack[ nFunction ].eOp = eOp; pFunctionStack[ nFunction ].nSep = 0; + nHighWatermark = nFunction; } } break; @@ -4825,6 +4828,7 @@ std::unique_ptr<ScTokenArray> ScCompiler::CompileString( const OUString& rFormul ++nFunction; pFunctionStack[ nFunction ].eOp = eOp; pFunctionStack[ nFunction ].nSep = 0; + nHighWatermark = nFunction; } } break; @@ -4867,9 +4871,9 @@ std::unique_ptr<ScTokenArray> ScCompiler::CompileString( const OUString& rFormul // Append a parameter for WEEKNUM, all 1.0 // Function is already closed, parameter count is nSep+1 size_t nFunc = nFunction + 1; - if (eOp == ocClose && - (pFunctionStack[ nFunc ].eOp == ocWeek && // 2nd week start - pFunctionStack[ nFunc ].nSep == 0)) + if (eOp == ocClose && nFunc <= nHighWatermark && + pFunctionStack[ nFunc ].nSep == 0 && + pFunctionStack[ nFunc ].eOp == ocWeek) // 2nd week start { if ( !static_cast<ScTokenArray*>(pArr)->Add( new FormulaToken( svSep, ocSep)) || !static_cast<ScTokenArray*>(pArr)->Add( new FormulaDoubleToken( 1.0))) diff --git a/sc/source/core/tool/typedstrdata.cxx b/sc/source/core/tool/typedstrdata.cxx index e00c1bc18d..4e3f862ae3 100644 --- a/sc/source/core/tool/typedstrdata.cxx +++ b/sc/source/core/tool/typedstrdata.cxx @@ -34,8 +34,31 @@ bool ScTypedStrData::LessCaseSensitive::operator() (const ScTypedStrData& left, if (left.mbIsDate != right.mbIsDate) return left.mbIsDate < right.mbIsDate; - sal_Int32 nEqual = ScGlobal::GetCaseCollator().compareString( - left.maStrValue, right.maStrValue); + sal_Int32 nEqual + = ScGlobal::GetCaseTransliteration().compareString(left.maStrValue, right.maStrValue); + + if (!nEqual) + return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; + + return nEqual < 0; +} + +bool ScTypedStrData::LessSortCaseSensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const +{ + if (left.meStrType != right.meStrType) + return left.meStrType < right.meStrType; + + if (left.meStrType == Value) + { + if (left.mfValue == right.mfValue) + return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; + return left.mfValue < right.mfValue; + } + + if (left.mbIsDate != right.mbIsDate) + return left.mbIsDate < right.mbIsDate; + + sal_Int32 nEqual = ScGlobal::GetCaseCollator().compareString(left.maStrValue, right.maStrValue); if (!nEqual) return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; @@ -58,8 +81,31 @@ bool ScTypedStrData::LessCaseInsensitive::operator() (const ScTypedStrData& left if (left.mbIsDate != right.mbIsDate) return left.mbIsDate < right.mbIsDate; - sal_Int32 nEqual = ScGlobal::GetCollator().compareString( - left.maStrValue, right.maStrValue); + sal_Int32 nEqual + = ScGlobal::GetTransliteration().compareString(left.maStrValue, right.maStrValue); + + if (!nEqual) + return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; + + return nEqual < 0; +} + +bool ScTypedStrData::LessSortCaseInsensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const +{ + if (left.meStrType != right.meStrType) + return left.meStrType < right.meStrType; + + if (left.meStrType == Value) + { + if (left.mfValue == right.mfValue) + return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; + return left.mfValue < right.mfValue; + } + + if (left.mbIsDate != right.mbIsDate) + return left.mbIsDate < right.mbIsDate; + + sal_Int32 nEqual = ScGlobal::GetCaseCollator().compareString(left.maStrValue, right.maStrValue); if (!nEqual) return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; 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 ) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 809ba8520e..a640d71cb2 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -3159,7 +3159,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL { ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument(); const ScValidationData* pData = rDoc.GetValidationEntry( nValidation ); - if (pData && pData->HasErrMsg()) + if (pData) { // #i67990# don't use pLastPattern in EnterHandler const ScPatternAttr* pPattern = rDoc.GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); @@ -3200,6 +3200,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL if (pData->DoError(pActiveViewSh->GetFrameWeld(), aString, aCursorPos)) bForget = true; // Do not take over input + } } } diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 6a1ef6a046..5f0599c888 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -312,28 +312,34 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt ScAddress aPos(nCol, nRow, nTab); const ScPatternAttr* pPattern = m_pDoc->GetPattern( nCol, nRow, nTab ); - ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool(), m_pDoc.get() ); - ScRefCellValue aCell(*m_pDoc, aPos); - if (aCell.getType() == CELLTYPE_EDIT) + if (pPattern) { - const EditTextObject* pObj = aCell.getEditText(); - aEngine.SetTextCurrentDefaults(*pObj); - } - else - { - SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); - sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); - const Color* pColor; - OUString aText = ScCellFormat::GetString(aCell, nNumFmt, &pColor, *pFormatter, *m_pDoc); - if (!aText.isEmpty()) - aEngine.SetTextCurrentDefaults(aText); - } + ScTabEditEngine aEngine(*pPattern, m_pDoc->GetEditPool(), m_pDoc.get()); + ScRefCellValue aCell(*m_pDoc, aPos); + if (aCell.getType() == CELLTYPE_EDIT) + { + const EditTextObject* pObj = aCell.getEditText(); + aEngine.SetTextCurrentDefaults(*pObj); + } + else + { + SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); + sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); + const Color* pColor; + OUString aText + = ScCellFormat::GetString(aCell, nNumFmt, &pColor, *pFormatter, *m_pDoc); + if (!aText.isEmpty()) + aEngine.SetTextCurrentDefaults(aText); + } - bOK = SetObject( &aEngine, - ((nFormat == SotClipboardFormatId::RTF) ? SCTRANS_TYPE_EDIT_RTF : - ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) ? - SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT : SCTRANS_TYPE_EDIT_BIN)), - rFlavor ); + bOK = SetObject(&aEngine, + ((nFormat == SotClipboardFormatId::RTF) + ? SCTRANS_TYPE_EDIT_RTF + : ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) + ? SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT + : SCTRANS_TYPE_EDIT_BIN)), + rFlavor); + } } else if ( ScImportExport::IsFormatSupported( nFormat ) || nFormat == SotClipboardFormatId::RTF || nFormat == SotClipboardFormatId::RICHTEXT ) diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 92e7096fc2..578c248b7f 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -171,14 +171,7 @@ void ScCheckListMenuControl::CreateDropDown() { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - // tdf#151820 The color used for the arrow head depends on the background color - Color aBackgroundColor = rStyleSettings.GetWindowColor(); - Color aSpinColor; - if (aBackgroundColor.IsDark()) - aSpinColor = rStyleSettings.GetLightColor(); - else - aSpinColor = rStyleSettings.GetDarkShadowColor(); - + Color aSpinColor = rStyleSettings.GetDialogTextColor(); int nWidth = (mxMenu->get_text_height() * 3) / 4; mxDropDown->SetOutputSizePixel(Size(nWidth, nWidth), /*bErase*/true, /*bAlphaMaskTransparent*/true); DecorationView aDecoView(mxDropDown.get()); diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 5fc6fee821..ae95220eef 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -540,6 +540,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) m_xLbEntries->Refresh( ScContentId::GRAPHIC ); m_xLbEntries->Refresh( ScContentId::OLEOBJECT ); m_xLbEntries->Refresh( ScContentId::DRAWING ); + m_xLbEntries->Refresh( ScContentId::NOTE ); break; case SfxHintId::ScAreaLinksChanged: diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 3f4f6b219c..ddbc8e2507 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1041,8 +1041,8 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) mpAutoFilterPopup->setMemberSize(aFilterEntries.size()); for (auto it = aFilterEntries.begin(); it != aFilterEntries.end(); ++it) { - // tdf#140745 show (empty) entry on top of the checkbox list - if (it->GetString().isEmpty()) + // tdf#140745 show (empty) entry on top of the checkbox list if not hidden by filter + if (it->GetString().isEmpty() && !it->IsHiddenByFilter()) { const OUString& aStringVal = it->GetString(); const double aDoubleVal = it->GetValue(); @@ -1051,7 +1051,8 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) bSelected = aSelectedString.count(aStringVal) > 0; else if (bQueryByNonEmpty) bSelected = false; - mpAutoFilterPopup->addMember(aStringVal, aDoubleVal, bSelected, it->IsHiddenByFilter()); + // it->IsHiddenByFilter() is always false here so no need to evaluate it + mpAutoFilterPopup->addMember(aStringVal, aDoubleVal, bSelected, false); aFilterEntries.maStrData.erase(it); break; } @@ -6168,10 +6169,16 @@ void ScGridWindow::DeleteCopySourceOverlay() void ScGridWindow::UpdateCopySourceOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteCopySourceOverlay(); @@ -6222,9 +6229,6 @@ void ScGridWindow::UpdateCopySourceOverlay() xOverlayManager->add(*pDashedBorder); mpOOSelectionBorder->append(std::move(pDashedBorder)); } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } static std::vector<tools::Rectangle> convertPixelToLogical( @@ -6415,10 +6419,16 @@ void ScGridWindow::UpdateCursorOverlay() { ScDocument& rDoc = mrViewData.GetDocument(); - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); // Existing OverlayObjects may be transformed in later versions. // For now, just re-create them. @@ -6577,9 +6587,6 @@ void ScGridWindow::UpdateCursorOverlay() } } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::GetCellSelection(std::vector<tools::Rectangle>& rLogicRects) @@ -6601,10 +6608,16 @@ void ScGridWindow::DeleteSelectionOverlay() void ScGridWindow::UpdateSelectionOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteSelectionOverlay(); std::vector<tools::Rectangle> aRects; @@ -6676,9 +6689,6 @@ void ScGridWindow::UpdateSelectionOverlay() ScInputHandler::SendReferenceMarks(pViewShell, aReferenceMarks); } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::UpdateHighlightOverlay() @@ -6744,10 +6754,16 @@ void ScGridWindow::DeleteAutoFillOverlay() void ScGridWindow::UpdateAutoFillOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteAutoFillOverlay(); @@ -6826,9 +6842,6 @@ void ScGridWindow::UpdateAutoFillOverlay() mpOOAutoFill.reset(new sdr::overlay::OverlayObjectList); mpOOAutoFill->append(std::move(pOverlay)); } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::DeleteDragRectOverlay() @@ -6841,10 +6854,16 @@ void ScGridWindow::UpdateDragRectOverlay() bool bInPrintTwips = comphelper::LibreOfficeKit::isCompatFlagSet( comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteDragRectOverlay(); @@ -6997,9 +7016,6 @@ void ScGridWindow::UpdateDragRectOverlay() pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectsString); } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::DeleteHeaderOverlay() @@ -7009,10 +7025,16 @@ void ScGridWindow::DeleteHeaderOverlay() void ScGridWindow::UpdateHeaderOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteHeaderOverlay(); @@ -7043,9 +7065,6 @@ void ScGridWindow::UpdateHeaderOverlay() mpOOHeader->append(std::move(pOverlay)); } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::DeleteShrinkOverlay() @@ -7055,10 +7074,16 @@ void ScGridWindow::DeleteShrinkOverlay() void ScGridWindow::UpdateShrinkOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - MapMode aOldMode = GetMapMode(); - if ( aOldMode != aDrawMode ) - SetMapMode( aDrawMode ); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); + if (aOldMode != aDrawMode) + SetMapMode(aDrawMode); DeleteShrinkOverlay(); @@ -7110,9 +7135,6 @@ void ScGridWindow::UpdateShrinkOverlay() mpOOShrink->append(std::move(pOverlay)); } } - - if ( aOldMode != aDrawMode ) - SetMapMode( aOldMode ); } void ScGridWindow::DeleteSparklineGroupOverlay() @@ -7122,9 +7144,14 @@ void ScGridWindow::DeleteSparklineGroupOverlay() void ScGridWindow::UpdateSparklineGroupOverlay() { - MapMode aDrawMode = GetDrawMapMode(); - - MapMode aOldMode = GetMapMode(); + const MapMode aDrawMode = GetDrawMapMode(); + const MapMode aOldMode = GetMapMode(); + comphelper::ScopeGuard aMapModeGuard( + [&aOldMode, &aDrawMode, this] { + if (aOldMode != aDrawMode) + SetMapMode(aOldMode); + } + ); if (aOldMode != aDrawMode) SetMapMode(aDrawMode); @@ -7173,9 +7200,6 @@ void ScGridWindow::UpdateSparklineGroupOverlay() } } } - - if (aOldMode != aDrawMode) - SetMapMode(aOldMode); } // #i70788# central method to get the OverlayManager safely |