summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/attrib.cxx42
-rw-r--r--sc/source/core/data/funcdesc.cxx17
-rw-r--r--sc/source/core/data/stlsheet.cxx32
-rw-r--r--sc/source/core/data/validat.cxx27
-rw-r--r--sc/source/core/inc/interpre.hxx3
-rw-r--r--sc/source/core/tool/appoptio.cxx29
-rw-r--r--sc/source/core/tool/defaultsoptions.cxx2
-rw-r--r--sc/source/core/tool/docoptio.cxx2
-rw-r--r--sc/source/core/tool/formulaopt.cxx2
-rw-r--r--sc/source/core/tool/interpr1.cxx252
-rw-r--r--sc/source/core/tool/interpr4.cxx2
-rw-r--r--sc/source/core/tool/parclass.cxx2
-rw-r--r--sc/source/core/tool/printopt.cxx2
-rw-r--r--sc/source/core/tool/scopetools.cxx19
-rw-r--r--sc/source/core/tool/token.cxx2
-rw-r--r--sc/source/core/tool/viewopti.cxx2
-rw-r--r--sc/source/filter/excel/xelink.cxx2
-rw-r--r--sc/source/filter/excel/xename.cxx2
-rw-r--r--sc/source/filter/excel/xlformula.cxx4
-rw-r--r--sc/source/filter/html/htmlpars.cxx2
-rw-r--r--sc/source/filter/inc/lotfntbf.hxx1
-rw-r--r--sc/source/filter/oox/formulabase.cxx2
-rw-r--r--sc/source/filter/oox/pagesettings.cxx5
-rw-r--r--sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx48
-rw-r--r--sc/source/ui/app/inputhdl.cxx25
-rw-r--r--sc/source/ui/app/scmod.cxx15
-rw-r--r--sc/source/ui/app/uiitems.cxx22
-rw-r--r--sc/source/ui/dialogs/searchresults.cxx54
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx9
-rw-r--r--sc/source/ui/formdlg/dwfunctr.cxx42
-rw-r--r--sc/source/ui/formdlg/formula.cxx10
-rw-r--r--sc/source/ui/inc/TableFillingAndNavigationTools.hxx2
-rw-r--r--sc/source/ui/inc/dwfunctr.hxx2
-rw-r--r--sc/source/ui/inc/formula.hxx1
-rw-r--r--sc/source/ui/inc/inputhdl.hxx2
-rw-r--r--sc/source/ui/inc/output.hxx2
-rw-r--r--sc/source/ui/inc/uiitems.hxx9
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx24
-rw-r--r--sc/source/ui/unoobj/docuno.cxx2
-rw-r--r--sc/source/ui/vba/vbapagesetup.cxx5
-rw-r--r--sc/source/ui/view/cellsh1.cxx35
-rw-r--r--sc/source/ui/view/gridwin.cxx4
-rw-r--r--sc/source/ui/view/output.cxx19
-rw-r--r--sc/source/ui/view/output2.cxx14
-rw-r--r--sc/source/ui/view/printfun.cxx10
46 files changed, 600 insertions, 213 deletions
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 409f7aa0a6a0..21e7cb350756 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -80,19 +80,19 @@ bool ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxB
* Merge
*/
ScMergeAttr::ScMergeAttr():
- SfxPoolItem(ATTR_MERGE, SfxItemType::ScMergeAttrType),
+ SfxPoolItem(ATTR_MERGE),
nColMerge(0),
nRowMerge(0)
{}
ScMergeAttr::ScMergeAttr( SCCOL nCol, SCROW nRow):
- SfxPoolItem(ATTR_MERGE, SfxItemType::ScMergeAttrType),
+ SfxPoolItem(ATTR_MERGE),
nColMerge(nCol),
nRowMerge(nRow)
{}
ScMergeAttr::ScMergeAttr(const ScMergeAttr& rItem):
- SfxPoolItem(ATTR_MERGE, SfxItemType::ScMergeAttrType)
+ SfxPoolItem(ATTR_MERGE)
{
nColMerge = rItem.nColMerge;
nRowMerge = rItem.nRowMerge;
@@ -183,7 +183,7 @@ void ScMergeFlagAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
* Protection
*/
ScProtectionAttr::ScProtectionAttr():
- SfxPoolItem(ATTR_PROTECTION, SfxItemType::ScProtectionAttrType),
+ SfxPoolItem(ATTR_PROTECTION),
bProtection(true),
bHideFormula(false),
bHideCell(false),
@@ -193,7 +193,7 @@ ScProtectionAttr::ScProtectionAttr():
ScProtectionAttr::ScProtectionAttr( bool bProtect, bool bHFormula,
bool bHCell, bool bHPrint):
- SfxPoolItem(ATTR_PROTECTION, SfxItemType::ScProtectionAttrType),
+ SfxPoolItem(ATTR_PROTECTION),
bProtection(bProtect),
bHideFormula(bHFormula),
bHideCell(bHCell),
@@ -202,7 +202,7 @@ ScProtectionAttr::ScProtectionAttr( bool bProtect, bool bHFormula,
}
ScProtectionAttr::ScProtectionAttr(const ScProtectionAttr& rItem):
- SfxPoolItem(ATTR_PROTECTION, SfxItemType::ScProtectionAttrType)
+ SfxPoolItem(ATTR_PROTECTION)
{
bProtection = rItem.bProtection;
bHideFormula = rItem.bHideFormula;
@@ -392,7 +392,7 @@ void ScProtectionAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
* ScPageHFItem - Dates from the Head and Foot lines
*/
ScPageHFItem::ScPageHFItem( sal_uInt16 nWhichP )
- : SfxPoolItem( nWhichP, SfxItemType::ScPageHFItemType )
+ : SfxPoolItem( nWhichP )
{
}
@@ -518,12 +518,12 @@ void ScPageHFItem::dumpAsXml(xmlTextWriterPtr pWriter) const
* ScViewObjectModeItem - Display Mode of View Objects
*/
ScViewObjectModeItem::ScViewObjectModeItem( sal_uInt16 nWhichP )
- : SfxEnumItem( nWhichP, SfxItemType::ScViewObjectModeItemType, VOBJ_MODE_SHOW )
+ : SfxEnumItem( nWhichP, VOBJ_MODE_SHOW )
{
}
ScViewObjectModeItem::ScViewObjectModeItem( sal_uInt16 nWhichP, ScVObjMode eMode )
- : SfxEnumItem( nWhichP, SfxItemType::ScViewObjectModeItemType, eMode )
+ : SfxEnumItem( nWhichP, eMode )
{
}
@@ -588,14 +588,14 @@ ScViewObjectModeItem* ScViewObjectModeItem::Clone( SfxItemPool* ) const
}
ScPageScaleToItem::ScPageScaleToItem() :
- SfxPoolItem( ATTR_PAGE_SCALETO, SfxItemType::ScPageScaleToItemType ),
+ SfxPoolItem( ATTR_PAGE_SCALETO ),
mnWidth( 0 ),
mnHeight( 0 )
{
}
ScPageScaleToItem::ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight ) :
- SfxPoolItem( ATTR_PAGE_SCALETO, SfxItemType::ScPageScaleToItemType ),
+ SfxPoolItem( ATTR_PAGE_SCALETO ),
mnWidth( nWidth ),
mnHeight( nHeight )
{
@@ -695,24 +695,24 @@ void ScPageScaleToItem::dumpAsXml(xmlTextWriterPtr pWriter) const
}
ScCondFormatItem::ScCondFormatItem():
- SfxPoolItem( ATTR_CONDITIONAL, SfxItemType::ScCondFormatItemType )
+ SfxPoolItem( ATTR_CONDITIONAL )
{
}
ScCondFormatItem::ScCondFormatItem( sal_uInt32 nIndex ):
- SfxPoolItem( ATTR_CONDITIONAL, SfxItemType::ScCondFormatItemType )
+ SfxPoolItem( ATTR_CONDITIONAL )
{
maIndex.insert(nIndex);
}
ScCondFormatItem::ScCondFormatItem( const ScCondFormatIndexes& rIndex ):
- SfxPoolItem( ATTR_CONDITIONAL, SfxItemType::ScCondFormatItemType ),
+ SfxPoolItem( ATTR_CONDITIONAL ),
maIndex( rIndex )
{
}
ScCondFormatItem::ScCondFormatItem( ScCondFormatIndexes&& aIndex ) noexcept:
- SfxPoolItem( ATTR_CONDITIONAL, SfxItemType::ScCondFormatItemType ),
+ SfxPoolItem( ATTR_CONDITIONAL ),
maIndex( std::move(aIndex) )
{
}
@@ -751,7 +751,7 @@ void ScCondFormatItem::dumpAsXml(xmlTextWriterPtr pWriter) const
}
ScRotateValueItem::ScRotateValueItem(Degree100 nAngle)
- : SdrAngleItem(ATTR_ROTATE_VALUE, nAngle, SfxItemType::ScRotateValueItemType)
+ : SdrAngleItem(ATTR_ROTATE_VALUE, nAngle)
{
}
@@ -772,7 +772,7 @@ bool ScRotateValueItem::GetPresentation(SfxItemPresentation ePresentation,
}
ScShrinkToFitCell::ScShrinkToFitCell(bool bShrink)
- : SfxBoolItem(ATTR_SHRINKTOFIT, bShrink, SfxItemType::ScShrinkToFitCellType)
+ : SfxBoolItem(ATTR_SHRINKTOFIT, bShrink)
{
}
@@ -792,7 +792,7 @@ bool ScShrinkToFitCell::GetPresentation(SfxItemPresentation,
}
ScVerticalStackCell::ScVerticalStackCell(bool bStack)
- : SfxBoolItem(ATTR_STACKED, bStack, SfxItemType::ScVerticalStackCellType)
+ : SfxBoolItem(ATTR_STACKED, bStack)
{
}
@@ -812,7 +812,7 @@ bool ScVerticalStackCell::GetPresentation(SfxItemPresentation,
}
ScLineBreakCell::ScLineBreakCell(bool bStack)
- : SfxBoolItem(ATTR_LINEBREAK, bStack, SfxItemType::ScLineBreakCellType)
+ : SfxBoolItem(ATTR_LINEBREAK, bStack)
{
}
@@ -832,7 +832,7 @@ bool ScLineBreakCell::GetPresentation(SfxItemPresentation,
}
ScHyphenateCell::ScHyphenateCell(bool bHyphenate)
- : SfxBoolItem(ATTR_HYPHENATE, bHyphenate, SfxItemType::ScHyphenateCellType)
+ : SfxBoolItem(ATTR_HYPHENATE, bHyphenate)
{
}
@@ -852,7 +852,7 @@ bool ScHyphenateCell::GetPresentation(SfxItemPresentation,
}
ScIndentItem::ScIndentItem(sal_uInt16 nIndent)
- : SfxUInt16Item(ATTR_INDENT, nIndent, SfxItemType::ScIndentItemType)
+ : SfxUInt16Item(ATTR_INDENT, nIndent)
{
}
diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index 6ca1b262792c..ea2bba6ecea2 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -793,6 +793,8 @@ ScFunctionList::ScFunctionList( bool bEnglishFunctionNames )
{ SC_OPCODE_SORTBY, ENTRY(SC_OPCODE_SORTBY_ARY), 0, ID_FUNCTION_GRP_TABLE, HID_FUNC_SORTBY_MS, PAIRED_VAR_ARGS + 1, { 0, 0, 1 }, 0 },
{ SC_OPCODE_MAT_SEQUENCE, ENTRY(SC_OPCODE_MAT_SEQUENCE_ARY), 0, ID_FUNCTION_GRP_MATRIX, HID_FUNC_MSEQUENCE_MS, 4, { 0, 1, 1, 1 }, 0 },
{ SC_OPCODE_RANDARRAY, ENTRY(SC_OPCODE_RANDARRAY_ARY), 0, ID_FUNCTION_GRP_MATH, HID_FUNC_RANDARRAY_MS, 5, { 1, 1, 1, 1, 1 }, 0 },
+ { SC_OPCODE_TOCOL, ENTRY(SC_OPCODE_TOCOL_ARY), 0, ID_FUNCTION_GRP_TABLE, HID_FUNC_TOCOL_MS, 3, { 0, 1, 1 }, 0 },
+ { SC_OPCODE_TOROW, ENTRY(SC_OPCODE_TOROW_ARY), 0, ID_FUNCTION_GRP_TABLE, HID_FUNC_TOROW_MS, 3, { 0, 1, 1 }, 0 },
{ SC_OPCODE_UNIQUE, ENTRY(SC_OPCODE_UNIQUE_ARY), 0, ID_FUNCTION_GRP_TABLE, HID_FUNC_UNIQUE_MS, 3, { 0, 1, 1 }, 0 },
};
@@ -1081,7 +1083,7 @@ ScFunctionMgr::~ScFunctionMgr()
}
-const ScFuncDesc* ScFunctionMgr::Get( sal_uInt16 nFIndex ) const
+const formula::IFunctionDescription* ScFunctionMgr::Get( sal_uInt16 nFIndex ) const
{
const ScFuncDesc* pDesc;
for (pDesc = First(); pDesc; pDesc = Next())
@@ -1137,6 +1139,12 @@ const formula::IFunctionCategory* ScFunctionMgr::getCategory(sal_uInt32 nCategor
return nullptr;
}
+sal_uInt16 ScFunctionMgr::getFunctionIndex(const formula::IFunctionDescription* _pDesc) const
+{
+ const ScFuncDesc* pDesc = dynamic_cast<const ScFuncDesc*>(_pDesc);
+ return pDesc ? pDesc->nFIndex : 0;
+}
+
void ScFunctionMgr::fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const
{
const ScAppOptions& rAppOpt = ScModule::get()->GetAppOptions();
@@ -1153,6 +1161,13 @@ void ScFunctionMgr::fillLastRecentlyUsedFunctions(::std::vector< const formula::
}
}
+void ScFunctionMgr::fillFavouriteFunctions(std::unordered_set<sal_uInt16>& rFavouriteFunctions) const
+{
+ const ScAppOptions& rAppOpt = ScModule::get()->GetAppOptions();
+ rFavouriteFunctions.clear();
+ rFavouriteFunctions = rAppOpt.GetFavouritesList();
+}
+
OUString ScFunctionMgr::GetCategoryName(sal_uInt32 _nCategoryNumber )
{
if (_nCategoryNumber >= SC_FUNCGROUP_COUNT)
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 47b861756337..b56a6ef0c6a2 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -144,13 +144,12 @@ SfxItemSet& ScStyleSheet::GetItemSet()
// (== Standard page template)
SfxItemPool& rItemPool = GetPool()->GetPool();
- pSet = new SfxItemSetFixed<
- ATTR_USERDEF, ATTR_USERDEF,
- ATTR_WRITINGDIR, ATTR_WRITINGDIR,
- ATTR_BACKGROUND, ATTR_BACKGROUND,
- ATTR_BORDER, ATTR_SHADOW,
- ATTR_LRSPACE, ATTR_PAGE_SCALETO>(rItemPool);
-
+ pSet = new SfxItemSet(rItemPool, WhichRangesContainer(svl::Items<
+ ATTR_USERDEF, ATTR_USERDEF,
+ ATTR_WRITINGDIR, ATTR_WRITINGDIR,
+ ATTR_BACKGROUND, ATTR_BACKGROUND,
+ ATTR_BORDER, ATTR_SHADOW,
+ ATTR_LRSPACE, ATTR_PAGE_SCALETO>));
// If being loaded also the set is then filled in from the file,
// so the defaults do not need to be set.
// GetPrinter would then also create a new printer,
@@ -233,20 +232,21 @@ SfxItemSet& ScStyleSheet::GetItemSet()
pItemPool = pItemPool->GetSecondaryPool();
assert(pItemPool);
- pSet = new SfxItemSetFixed<
- XATTR_LINE_FIRST, XATTR_LINE_LAST,
- XATTR_FILL_FIRST, XATTR_FILL_LAST,
- SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
- SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_WORDWRAP,
- SDRATTR_EDGE_FIRST, SDRATTR_MEASURE_LAST,
- SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
- EE_PARA_START, EE_CHAR_END>(*pItemPool);
+ pSet = new SfxItemSet(*pItemPool, WhichRangesContainer(svl::Items<
+ XATTR_LINE_FIRST, XATTR_LINE_LAST,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST,
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
+ SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_WORDWRAP,
+ SDRATTR_EDGE_FIRST, SDRATTR_MEASURE_LAST,
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+ EE_PARA_START, EE_CHAR_END>));
}
break;
case SfxStyleFamily::Para:
default:
- pSet = new SfxItemSetFixed<ATTR_PATTERN_START, ATTR_PATTERN_END>( GetPool()->GetPool() );
+ pSet = new SfxItemSet(GetPool()->GetPool(), WhichRangesContainer(svl::Items<
+ ATTR_PATTERN_START, ATTR_PATTERN_END>));
break;
}
bMySet = true;
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index a830da8cef34..5bedbb6a8c6c 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -245,10 +245,10 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput,
// Macro not found (only with input)
{
//TODO: different error message, if found, but not bAllowed ??
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
+ std::shared_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
VclMessageType::Warning, VclButtonsType::Ok,
ScResId(STR_VALID_MACRONOTFOUND)));
- xBox->run();
+ xBox->runAsync(xBox, [] (sal_uInt32){ });
}
return bScriptReturnedFalse;
@@ -351,10 +351,10 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput,
if ( !bDone && !pCell ) // Macro not found (only with input)
{
//TODO: different error message, if found, but not bAllowed ??
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
+ std::shared_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
VclMessageType::Warning, VclButtonsType::Ok,
ScResId(STR_VALID_MACRONOTFOUND)));
- xBox->run();
+ xBox->runAsync(xBox, [](sal_uInt32) {});
}
return bRet;
@@ -373,14 +373,16 @@ IMPL_STATIC_LINK_NOARG(ScValidationData, InstallLOKNotifierHdl, void*, vcl::ILib
// true -> abort
-bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput,
- const ScAddress& rPos) const
+void ScValidationData::DoError(weld::Window* pParent, const OUString& rInput, const ScAddress& rPos,
+ const std::function<void(bool forget)>& callback) const
{
- if ( eErrorStyle == SC_VALERR_MACRO )
- return DoMacro(rPos, rInput, nullptr, pParent);
+ if ( eErrorStyle == SC_VALERR_MACRO ) {
+ DoMacro(rPos, rInput, nullptr, pParent);
+ return;
+ }
if (!bShowError)
- return true;
+ return;
// Output error message
@@ -407,7 +409,7 @@ bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput,
break;
}
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eType,
+ std::shared_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eType,
eStyle, aMessage, SfxViewShell::Current()));
xBox->set_title(aTitle);
xBox->SetInstallLOKNotifierHdl(LINK(nullptr, ScValidationData, InstallLOKNotifierHdl));
@@ -424,9 +426,8 @@ bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput,
break;
}
- short nRet = xBox->run();
-
- return ( eErrorStyle == SC_VALERR_STOP || nRet == RET_CANCEL );
+ xBox->runAsync(xBox, [this, callback](sal_Int32 result)
+ { callback(eErrorStyle == SC_VALERR_STOP || result == RET_CANCEL); });
}
bool ScValidationData::IsDataValidCustom(
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 1630e8c6b794..d9450ea07149 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -58,6 +58,7 @@ struct ScRefCellValue;
enum MatchMode{ exactorNA=0, exactorS=-1, exactorG=1, wildcard=2, regex=3 };
enum SearchMode{ searchfwd=1, searchrev=-1, searchbasc=2, searchbdesc=-2 };
+enum IgnoreValues{ DEFAULT=0, BLANKS=1, ERRORS=2, ALL=3 };
struct VectorSearchArguments
{
@@ -723,6 +724,8 @@ private:
void ScFilter();
void ScSort();
void ScSortBy();
+ void ScToCol();
+ void ScToRow();
void ScUnique();
void ScLet();
void ScSubTotal();
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index 0115be53db76..e6137341094d 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -26,6 +26,7 @@
#include <miscuno.hxx>
#include <vector>
#include <osl/diagnose.h>
+#include <comphelper/sequence.hxx>
using namespace utl;
using namespace com::sun::star::uno;
@@ -90,6 +91,7 @@ ScAppOptions& ScAppOptions::operator=( const ScAppOptions& rCpy )
bSynchronizeZoom = rCpy.bSynchronizeZoom;
nZoom = rCpy.nZoom;
SetLRUFuncList( rCpy.pLRUList.get(), rCpy.nLRUFuncCount );
+ SetFavouritesList(rCpy.sFavouritesList);
nStatusFunc = rCpy.nStatusFunc;
bAutoComplete = rCpy.bAutoComplete;
bDetectiveAuto = rCpy.bDetectiveAuto;
@@ -139,6 +141,11 @@ static void lcl_GetLastFunctions( Any& rDest, const ScAppOptions& rOpt )
rDest <<= Sequence<sal_Int32>(0); // empty
}
+static void lcl_GetFavouriteFunctions(Any& rDest, const ScAppOptions& rOpt)
+{
+ rDest <<= comphelper::containerToSequence<sal_Int32>(rOpt.GetFavouritesList());
+}
+
static void lcl_GetSortList( Any& rDest )
{
const ScUserList& rUserList = ScGlobal::GetUserList();
@@ -162,8 +169,9 @@ constexpr OUStringLiteral CFGPATH_LAYOUT = u"Office.Calc/Layout";
constexpr OUStringLiteral CFGPATH_INPUT = u"Office.Calc/Input";
#define SCINPUTOPT_LASTFUNCS 0
-#define SCINPUTOPT_AUTOINPUT 1
-#define SCINPUTOPT_DET_AUTO 2
+#define SCINPUTOPT_FAVOURITEFUNCS 1
+#define SCINPUTOPT_AUTOINPUT 2
+#define SCINPUTOPT_DET_AUTO 3
constexpr OUStringLiteral CFGPATH_REVISION = u"Office.Calc/Revision/Color";
@@ -225,6 +233,7 @@ Sequence<OUString> ScAppCfg::GetLayoutPropertyNames()
Sequence<OUString> ScAppCfg::GetInputPropertyNames()
{
return {u"LastFunctions"_ustr, // SCINPUTOPT_LASTFUNCS
+ u"FavouriteFunctions"_ustr, // SCINPUTOPT_FAVOURITEFUNCS
u"AutoInput"_ustr, // SCINPUTOPT_AUTOINPUT
u"DetectiveAuto"_ustr}; // SCINPUTOPT_DET_AUTO
}
@@ -363,6 +372,19 @@ void ScAppCfg::ReadInputCfg()
SetLRUFuncList(pUShorts.data(), nLRUCount);
}
}
+
+ if (Sequence<sal_Int32> aSeq; aValues[SCINPUTOPT_FAVOURITEFUNCS] >>= aSeq)
+ {
+ sal_Int32 nCount = aSeq.getLength();
+ if (nCount < SAL_MAX_UINT16)
+ {
+ sal_uInt16 nFavouritesCount = nCount;
+ std::unordered_set<sal_uInt16> sFavouriteFunctions;
+ for (sal_uInt16 i = 0; i < nFavouritesCount; ++i)
+ sFavouriteFunctions.insert(aSeq[i]);
+ SetFavouritesList(sFavouriteFunctions);
+ }
+ }
SetAutoComplete(ScUnoHelpFunctions::GetBoolFromAny(aValues[SCINPUTOPT_AUTOINPUT]));
SetDetectiveAuto(ScUnoHelpFunctions::GetBoolFromAny(aValues[SCINPUTOPT_DET_AUTO]));
}
@@ -515,6 +537,9 @@ IMPL_LINK_NOARG(ScAppCfg, InputCommitHdl, ScLinkConfigItem&, void)
case SCINPUTOPT_DET_AUTO:
pValues[nProp] <<= GetDetectiveAuto();
break;
+ case SCINPUTOPT_FAVOURITEFUNCS:
+ lcl_GetFavouriteFunctions(pValues[nProp], *this);
+ break;
}
}
aInputItem.PutProperties(aNames, aValues);
diff --git a/sc/source/core/tool/defaultsoptions.cxx b/sc/source/core/tool/defaultsoptions.cxx
index 6436b7e9f910..098cc11e6230 100644
--- a/sc/source/core/tool/defaultsoptions.cxx
+++ b/sc/source/core/tool/defaultsoptions.cxx
@@ -40,7 +40,7 @@ bool ScDefaultsOptions::operator==( const ScDefaultsOptions& rOpt ) const
}
ScTpDefaultsItem::ScTpDefaultsItem( ScDefaultsOptions aOpt ) :
- SfxPoolItem ( SID_SCDEFAULTSOPTIONS, SfxItemType::ScTpDefaultsItemType ),
+ SfxPoolItem ( SID_SCDEFAULTSOPTIONS ),
theOptions (std::move( aOpt ))
{
}
diff --git a/sc/source/core/tool/docoptio.cxx b/sc/source/core/tool/docoptio.cxx
index bc6bc326a9b5..98c8bd7124d6 100644
--- a/sc/source/core/tool/docoptio.cxx
+++ b/sc/source/core/tool/docoptio.cxx
@@ -106,7 +106,7 @@ void ScDocOptions::SetFormulaWildcardsEnabled( bool bVal )
// ScTpCalcItem - data for the CalcOptions TabPage
ScTpCalcItem::ScTpCalcItem( sal_uInt16 nWhichP, const ScDocOptions& rOpt )
- : SfxPoolItem ( nWhichP, SfxItemType::ScTpCalcItemType ),
+ : SfxPoolItem ( nWhichP ),
theOptions ( rOpt )
{
}
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index a0eb6bafb835..4d3027002d27 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -127,7 +127,7 @@ bool ScFormulaOptions::operator!=( const ScFormulaOptions& rOpt ) const
}
ScTpFormulaItem::ScTpFormulaItem( ScFormulaOptions aOpt ) :
- SfxPoolItem ( SID_SCFORMULAOPTIONS, SfxItemType::ScTpFormulaItemType ),
+ SfxPoolItem ( SID_SCFORMULAOPTIONS ),
theOptions (std::move( aOpt ))
{
}
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2116cab1297f..ddf58c111cd9 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8799,6 +8799,228 @@ void ScInterpreter::ScSortBy()
PushIllegalParameter();
}
+void ScInterpreter::ScToCol()
+{
+ sal_uInt8 nParamCount = GetByte();
+ if (!MustHaveParamCount(nParamCount, 1, 3))
+ return;
+
+ // 3rd argument optional - Scan_by_column: default FALSE
+ bool bByColumn = false;
+ if (nParamCount == 3)
+ bByColumn = GetBoolWithDefault(false);
+
+ // 2nd argument optional - Ignore: default keep all values
+ IgnoreValues eIgnoreValues = IgnoreValues::DEFAULT;
+ if (nParamCount >= 2)
+ {
+ sal_Int32 k = GetInt32WithDefault(0);
+ if (k >= 0 && k <= 3)
+ eIgnoreValues = static_cast<IgnoreValues>(k);
+ else
+ {
+ PushIllegalParameter();
+ return;
+ }
+ }
+
+ // 1st argument: take unique search range
+ ScMatrixRef pMatSource = nullptr;
+ SCSIZE nsC = 0, nsR = 0;
+ switch (GetStackType())
+ {
+ case svSingleRef:
+ case svDoubleRef:
+ case svMatrix:
+ case svExternalSingleRef:
+ case svExternalDoubleRef:
+ {
+ pMatSource = GetMatrix();
+ if (!pMatSource)
+ {
+ PushIllegalParameter();
+ return;
+ }
+
+ pMatSource->GetDimensions(nsC, nsR);
+ }
+ break;
+
+ default:
+ PushIllegalParameter();
+ return;
+ }
+
+ if (nGlobalError != FormulaError::NONE || nsC < 1 || nsR < 1)
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ std::vector<std::pair<SCSIZE, SCSIZE>> aResPos;
+ SCSIZE nOut = bByColumn ? nsC : nsR;
+ SCSIZE nIn = bByColumn ? nsR : nsC;
+
+ for (SCSIZE i = 0; i < nOut; i++)
+ {
+ for (SCSIZE j = 0; j < nIn; j++)
+ {
+ SCSIZE nCol = bByColumn ? i : j;
+ SCSIZE nRow = bByColumn ? j : i;
+ if ((eIgnoreValues == IgnoreValues::ALL || eIgnoreValues == IgnoreValues::BLANKS) && pMatSource->IsEmptyCell(nCol, nRow))
+ continue; // Nothing to do
+ else if ((eIgnoreValues == IgnoreValues::ALL || eIgnoreValues == IgnoreValues::ERRORS) && pMatSource->GetError(nCol, nRow) != FormulaError::NONE)
+ continue; // Nothing to do
+ else
+ aResPos.emplace_back(nCol, nRow);
+ }
+
+ }
+ // No result
+ if (aResPos.size() == 0)
+ {
+ PushNA();
+ return;
+ }
+
+ ScMatrixRef pResMat = GetNewMat(1, aResPos.size(), /*bEmpty*/true);
+ if (!pResMat)
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ // fill result matrix to the same column
+ for (SCSIZE iPos = 0; iPos < aResPos.size(); ++iPos)
+ {
+ if (pMatSource->IsEmptyCell(aResPos[iPos].first, aResPos[iPos].second))
+ {
+ pResMat->PutEmpty(0, iPos);
+ }
+ else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, aResPos[iPos].second))
+ {
+ pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, aResPos[iPos].second), 0, iPos);
+ }
+ else
+ {
+ pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, aResPos[iPos].second), 0, iPos);
+ }
+ }
+
+ PushMatrix(pResMat);
+}
+
+void ScInterpreter::ScToRow()
+{
+ sal_uInt8 nParamCount = GetByte();
+ if (!MustHaveParamCount(nParamCount, 1, 3))
+ return;
+
+ // 3rd argument optional - Scan_by_column: default FALSE
+ bool bByColumn = false;
+ if (nParamCount == 3)
+ bByColumn = GetBoolWithDefault(false);
+
+ // 2nd argument optional - Ignore: default keep all values
+ IgnoreValues eIgnoreValues = IgnoreValues::DEFAULT;
+ if (nParamCount >= 2)
+ {
+ sal_Int32 k = GetInt32WithDefault(0);
+ if (k >= 0 && k <= 3)
+ eIgnoreValues = static_cast<IgnoreValues>(k);
+ else
+ {
+ PushIllegalParameter();
+ return;
+ }
+ }
+
+ // 1st argument: take torow range
+ ScMatrixRef pMatSource = nullptr;
+ SCSIZE nsC = 0, nsR = 0;
+ switch (GetStackType())
+ {
+ case svSingleRef:
+ case svDoubleRef:
+ case svMatrix:
+ case svExternalSingleRef:
+ case svExternalDoubleRef:
+ {
+ pMatSource = GetMatrix();
+ if (!pMatSource)
+ {
+ PushIllegalParameter();
+ return;
+ }
+
+ pMatSource->GetDimensions(nsC, nsR);
+ }
+ break;
+
+ default:
+ PushIllegalParameter();
+ return;
+ }
+
+ if (nGlobalError != FormulaError::NONE || nsC < 1 || nsR < 1)
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ std::vector<std::pair<SCSIZE, SCSIZE>> aResPos;
+ SCSIZE nOut = bByColumn ? nsC : nsR;
+ SCSIZE nIn = bByColumn ? nsR : nsC;
+
+ for (SCSIZE i = 0; i < nOut; i++)
+ {
+ for (SCSIZE j = 0; j < nIn; j++)
+ {
+ SCSIZE nCol = bByColumn ? i : j;
+ SCSIZE nRow = bByColumn ? j : i;
+ if ((eIgnoreValues == IgnoreValues::ALL || eIgnoreValues == IgnoreValues::BLANKS) && pMatSource->IsEmptyCell(nCol, nRow))
+ continue; // Nothing to do
+ else if ((eIgnoreValues == IgnoreValues::ALL || eIgnoreValues == IgnoreValues::ERRORS) && pMatSource->GetError(nCol, nRow) != FormulaError::NONE)
+ continue; // Nothing to do
+ else
+ aResPos.emplace_back(nCol, nRow);
+ }
+
+ }
+ // No result
+ if (aResPos.size() == 0)
+ {
+ PushNA();
+ return;
+ }
+
+ ScMatrixRef pResMat = GetNewMat(aResPos.size(), 1, /*bEmpty*/true);
+ if (!pResMat)
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ // fill result matrix to the same row
+ for (SCSIZE iPos = 0; iPos < aResPos.size(); ++iPos)
+ {
+ if (pMatSource->IsEmptyCell(aResPos[iPos].first, aResPos[iPos].second))
+ {
+ pResMat->PutEmpty(iPos, 0);
+ }
+ else if (!pMatSource->IsStringOrEmpty(aResPos[iPos].first, aResPos[iPos].second))
+ {
+ pResMat->PutDouble(pMatSource->GetDouble(aResPos[iPos].first, aResPos[iPos].second), iPos, 0);
+ }
+ else
+ {
+ pResMat->PutString(pMatSource->GetString(aResPos[iPos].first, aResPos[iPos].second), iPos, 0);
+ }
+ }
+
+ PushMatrix(pResMat);
+}
+
void ScInterpreter::ScUnique()
{
sal_uInt8 nParamCount = GetByte();
@@ -8886,19 +9108,18 @@ void ScInterpreter::ScUnique()
// No result
if (aResPos.size() == 0)
{
- if (nGlobalError != FormulaError::NONE)
- {
- PushIllegalArgument();
- }
- else
- {
- PushNA();
- }
+ PushNA();
return;
}
- // fill result matrix with unique values
+
ScMatrixRef pResMat = bByRow ? GetNewMat(nsC, aResPos.size(), /*bEmpty*/true) :
GetNewMat(aResPos.size(), nsR, /*bEmpty*/true);
+ if (!pResMat)
+ {
+ PushIllegalArgument();
+ return;
+ }
+ // fill result matrix with unique values
for (SCSIZE iPos = 0; iPos < aResPos.size(); iPos++)
{
if (bByRow)
@@ -8939,14 +9160,7 @@ void ScInterpreter::ScUnique()
}
}
- if (!pResMat)
- {
- PushIllegalArgument();
- }
- else
- {
- PushMatrix(pResMat);
- }
+ PushMatrix(pResMat);
}
void ScInterpreter::getTokensAtParameter( std::unique_ptr<ScTokenArray>& pTokens, short nPos )
@@ -10207,7 +10421,9 @@ void ScInterpreter::ScIndex()
SetError(FormulaError::IllegalArgument);
sal_uInt16 nOldSp = sp;
ScMatrixRef pMat = GetMatrix();
- if (pMat)
+ if (!pMat)
+ PushError(FormulaError::NoRef);
+ else
{
SCSIZE nC, nR;
pMat->GetDimensions(nC, nR);
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index fcc58c364ec4..693d71856db1 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4159,6 +4159,8 @@ StackVar ScInterpreter::Interpret()
case ocFilter : ScFilter(); break;
case ocSort : ScSort(); break;
case ocSortBy : ScSortBy(); break;
+ case ocToCol : ScToCol(); break;
+ case ocToRow : ScToRow(); break;
case ocUnique : ScUnique(); break;
case ocLet : ScLet(); break;
case ocTrue : ScTrue(); break;
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index a38f0f7c7ef9..bcaca39b0570 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -258,6 +258,8 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
{ ocSumXMY2, {{ ForceArray, ForceArray }, 0, Value }},
{ ocTTest, {{ ForceArray, ForceArray, Value, Value }, 0, Value }},
{ ocTextJoin_MS, {{ Reference, Value, Reference }, 1, Value }},
+ { ocToCol, {{ ReferenceOrRefArray, Value, Value, }, 0, ForceArrayReturn } },
+ { ocToRow, {{ ReferenceOrRefArray, Value, Value, }, 0, ForceArrayReturn } },
{ ocTrend, {{ Reference, Reference, Reference, Value }, 0, Value }},
{ ocTrimMean, {{ Reference, Value }, 0, Value }},
{ ocTrue, {{ Bounds }, 0, Value }},
diff --git a/sc/source/core/tool/printopt.cxx b/sc/source/core/tool/printopt.cxx
index 57fedbda092e..773834ebc630 100644
--- a/sc/source/core/tool/printopt.cxx
+++ b/sc/source/core/tool/printopt.cxx
@@ -48,7 +48,7 @@ bool ScPrintOptions::operator==( const ScPrintOptions& rOpt ) const
}
ScTpPrintItem::ScTpPrintItem( const ScPrintOptions& rOpt ) :
- SfxPoolItem ( SID_SCPRINTOPTIONS, SfxItemType::ScTpPrintItemType ),
+ SfxPoolItem ( SID_SCPRINTOPTIONS ),
theOptions ( rOpt )
{
}
diff --git a/sc/source/core/tool/scopetools.cxx b/sc/source/core/tool/scopetools.cxx
index 022c553d59d8..15d94040e09b 100644
--- a/sc/source/core/tool/scopetools.cxx
+++ b/sc/source/core/tool/scopetools.cxx
@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <o3tl/deleter.hxx>
#include <scopetools.hxx>
#include <document.hxx>
#include <column.hxx>
@@ -84,20 +85,14 @@ DelayStartListeningFormulaCells::DelayStartListeningFormulaCells(ScColumn& colum
{
}
-DelayStartListeningFormulaCells::~DelayStartListeningFormulaCells()
+void DelayStartListeningFormulaCells::ImplDestroy()
{
-#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
- try
- {
- mColumn.GetDoc().EnableDelayStartListeningFormulaCells(&mColumn, mbOldValue);
- }
- catch (...)
- {
- std::abort();
- }
-#else
mColumn.GetDoc().EnableDelayStartListeningFormulaCells(&mColumn, mbOldValue);
-#endif
+}
+
+DelayStartListeningFormulaCells::~DelayStartListeningFormulaCells()
+{
+ suppress_fun_call_w_exception(ImplDestroy());
}
void DelayStartListeningFormulaCells::set()
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 6bfdf87611a7..cda61367b7a2 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1591,6 +1591,8 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocAveDev:
case ocMatSequence:
case ocRandArray:
+ case ocToCol:
+ case ocToRow:
case ocUnique:
// Don't change the state.
break;
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index bd2f110640d3..5ec30bd7e7da 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -169,7 +169,7 @@ std::unique_ptr<SvxGridItem> ScViewOptions::CreateGridItem() const
// ScTpViewItem - data for the ViewOptions TabPage
ScTpViewItem::ScTpViewItem( const ScViewOptions& rOpt )
- : SfxPoolItem ( SID_SCVIEWOPTIONS, SfxItemType::ScTpViewItemType ),
+ : SfxPoolItem ( SID_SCVIEWOPTIONS ),
theOptions ( rOpt )
{
}
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 520e06b8ab74..4374b0bc3ef7 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -1235,7 +1235,7 @@ void XclExpCrn::SaveXml( XclExpXmlStream& rStrm )
{
pFS->startElement(XML_cell, XML_r, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), ScRange(aAdr)), XML_t, "str");
pFS->startElement(XML_v);
- pFS->write( rValue.get< OUString >() );
+ pFS->writeEscaped( rValue.get< OUString >() );
}
else if( rValue.has< bool >() )
{
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 5607a9068d4f..aa33b31deeb3 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -322,6 +322,8 @@ OUString XclExpName::GetWithDefaultRangeSeparator( const OUString& rSymbol ) con
}
}
}
+ if (rSymbol.isEmpty())
+ return u"#NAME?"_ustr;
return rSymbol;
}
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index 1982c3ba2dae..b4db2be5068e 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -608,8 +608,10 @@ const XclFunctionInfo saFuncTable_2021[] =
EXC_FUNCENTRY_V_VR( ocSortBy, 2, 3, 0, "SORTBY" ),
EXC_FUNCENTRY_V_VR( ocMatSequence,1, 4, 0, "SEQUENCE" ),
EXC_FUNCENTRY_V_VR( ocRandArray, 0, 5, 0, "RANDARRAY" ),
+ EXC_FUNCENTRY_V_VR( ocToCol, 1, 3, 0, "TOCOL" ),
+ EXC_FUNCENTRY_V_VR( ocToRow, 1, 3, 0, "TOROW" ),
EXC_FUNCENTRY_V_VR( ocUnique, 1, 3, 0, "UNIQUE" ),
- EXC_FUNCENTRY_V_VR( ocLet, 3, 3, 0, "SORTBY")
+ EXC_FUNCENTRY_V_VR( ocLet, 3, 3, 0, "LET")
};
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 6c225c3020c8..a4e0f7069a1f 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1804,6 +1804,7 @@ void ScHTMLLayoutParser::ProcToken( HtmlImportInfo* pInfo )
}
break;
case HtmlTokenId::UNDERLINE_ON :
+ case HtmlTokenId::INSERTEDTEXT_ON:
{
if ( IsAtBeginningOfText( pInfo ) )
mxActEntry->aItemSet.Put( SvxUnderlineItem( LINESTYLE_SINGLE,
@@ -3099,6 +3100,7 @@ void ScHTMLQueryParser::ProcessToken( const HtmlImportInfo& rInfo )
break;
case HtmlTokenId::UNDERLINE_ON: // <u>
+ case HtmlTokenId::INSERTEDTEXT_ON: // <ins>
mpCurrTable->PutItem( SvxUnderlineItem( LINESTYLE_SINGLE, ATTR_FONT_UNDERLINE ) );
break;
default: break;
diff --git a/sc/source/filter/inc/lotfntbf.hxx b/sc/source/filter/inc/lotfntbf.hxx
index 99d1c9a9d8ed..34adf8fabec0 100644
--- a/sc/source/filter/inc/lotfntbf.hxx
+++ b/sc/source/filter/inc/lotfntbf.hxx
@@ -24,6 +24,7 @@
#include <optional>
// Code in fontbuff.cxx (excel)
+class SfxItemSet;
class LotusFontBuffer
{
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index e2c4ee475d6e..913deb8e4a2a 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -882,6 +882,8 @@ const FunctionData saFuncTable2021[] =
{ "COM.MICROSOFT.SORTBY", "SORTBY", NOID, NOID, 2, MX, V, { RO, RO, VR }, FuncFlags::MACROCALL_NEW | FuncFlags::PARAMPAIRS },
{ "COM.MICROSOFT.SEQUENCE", "SEQUENCE", NOID, NOID, 1, 4, A, { VO }, FuncFlags::MACROCALL_NEW },
{ "COM.MICROSOFT.RANDARRAY", "RANDARRAY", NOID, NOID, 0, 5, A, { VO }, FuncFlags::MACROCALL_NEW },
+ { "COM.MICROSOFT.TOCOL", "TOCOL", NOID, NOID, 1, 3, A, { VO }, FuncFlags::MACROCALL_NEW },
+ { "COM.MICROSOFT.TOROW", "TOROW", NOID, NOID, 1, 3, A, { VO }, FuncFlags::MACROCALL_NEW },
{ "COM.MICROSOFT.UNIQUE", "UNIQUE", NOID, NOID, 1, 3, A, { VO }, FuncFlags::MACROCALL_NEW },
{ "COM.MICROSOFT.LET", "LET", NOID, NOID, 3, MX, R, { VR, VR, VA }, FuncFlags::MACROCALL_NEW | FuncFlags::PARAMPAIRS },
};
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index 825389d37ad0..34062acd893f 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -939,9 +939,8 @@ void PageSettingsConverter::writePageSettingsProperties(
if( 0 < rModel.mnPaperSize )
{
- const msfilter::util::ApiPaperSize& rPaperSize = msfilter::util::PaperSizeConv::getApiSizeForMSPaperSizeIndex( rModel.mnPaperSize );
- aSize = awt::Size( rPaperSize.mnWidth, rPaperSize.mnHeight );
- bValid = ( rPaperSize.mnWidth != 0 && rPaperSize.mnHeight != 0 );
+ aSize = msfilter::util::PaperSizeConv::getApiSizeForMSPaperSizeIndex(rModel.mnPaperSize);
+ bValid = (aSize.Width != 0 && aSize.Height != 0);
}
if( rModel.mnPaperWidth > 0 && rModel.mnPaperHeight > 0 )
{
diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
index be843112859a..d109fb537fbd 100644
--- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
+++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
@@ -13,6 +13,9 @@
#include <editeng/editobj.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/eeitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/borderline.hxx>
+#include <editeng/justifyitem.hxx>
#include <editutil.hxx>
@@ -21,6 +24,8 @@
#include <docfunc.hxx>
#include <docsh.hxx>
+using namespace ::editeng;
+
FormulaTemplate::FormulaTemplate(ScDocument* pDoc)
: mpDoc(pDoc)
, mbUse3D(true)
@@ -213,7 +218,9 @@ void AddressWalkerWriter::writeBoldString(const OUString& aString)
rEngine.SetTextCurrentDefaults(aString);
SfxItemSet aItemSet = rEngine.GetEmptyItemSet();
SvxWeightItem aWeight(WEIGHT_BOLD, EE_CHAR_WEIGHT);
+ SvxHorJustifyItem aJustify(SvxCellHorJustify::Center, ATTR_HOR_JUSTIFY);
aItemSet.Put(aWeight);
+ aItemSet.Put(aJustify);
rEngine.QuickSetAttribs(aItemSet, ESelection(0, 0, 0, aString.getLength()) );
std::unique_ptr<EditTextObject> pEditText(rEngine.CreateTextObject());
mpDocShell->GetDocFunc().SetEditCell(mCurrentAddress, *pEditText, true);
@@ -224,6 +231,47 @@ void AddressWalkerWriter::writeValue(double aValue)
mpDocShell->GetDocFunc().SetValueCell(mCurrentAddress, aValue, true);
}
+// Applies a column header format to the current cell and subsequent (nCols - 1) columns
+// Header format = bold font, horizontally centered, text wrap and top/bottom borders
+void AddressWalkerWriter::formatAsColumnHeader(SCCOL nCols)
+{
+ ScPatternAttr aPattern(mrDocument.getCellAttributeHelper());
+ SvxHorJustifyItem aHJustify(SvxCellHorJustify::Center, ATTR_HOR_JUSTIFY);
+ SvxVerJustifyItem aVJustify(SvxCellVerJustify::Center, ATTR_VER_JUSTIFY);
+ SvxWeightItem aWeight(WEIGHT_BOLD, ATTR_FONT_WEIGHT);
+ ScLineBreakCell aWrap(true);
+ SvxBoxItem aBorderOuter(ATTR_BORDER);
+ SvxBorderLine aLine;
+ aLine.GuessLinesWidths(aLine.GetBorderLineStyle(), SvxBorderLineWidth::Thin);
+ aBorderOuter.SetLine(&aLine, SvxBoxItemLine::TOP);
+ aBorderOuter.SetLine(&aLine, SvxBoxItemLine::BOTTOM);
+
+ aPattern.GetItemSet().Put(aHJustify);
+ aPattern.GetItemSet().Put(aVJustify);
+ aPattern.GetItemSet().Put(aWeight);
+ aPattern.GetItemSet().Put(aWrap);
+ aPattern.GetItemSet().Put(aBorderOuter);
+
+ mrDocument.ApplyPatternAreaTab(mCurrentAddress.Col(), mCurrentAddress.Row(),
+ mCurrentAddress.Col() + nCols - 1, mCurrentAddress.Row(),
+ mCurrentAddress.Tab(), aPattern);
+}
+
+// Formats as the bottom end of a table with a bottom line
+// Starts in the current cell and formats nCols in total
+void AddressWalkerWriter::formatTableBottom(SCCOL nCols)
+{
+ ScPatternAttr aPattern(mrDocument.getCellAttributeHelper());
+ SvxBoxItem aBorderOuter(ATTR_BORDER);
+ SvxBorderLine aLine;
+ aLine.GuessLinesWidths(aLine.GetBorderLineStyle(), SvxBorderLineWidth::Thin);
+ aBorderOuter.SetLine(&aLine, SvxBoxItemLine::BOTTOM);
+ aPattern.GetItemSet().Put(aBorderOuter);
+ mrDocument.ApplyPatternAreaTab(mCurrentAddress.Col(), mCurrentAddress.Row(),
+ mCurrentAddress.Col() + nCols - 1, mCurrentAddress.Row(),
+ mCurrentAddress.Tab(), aPattern);
+}
+
// DataCellIterator
DataCellIterator::DataCellIterator(const ScRange& aInputRange, bool aByColumn)
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index d62f61f0ef70..e778d27886c0 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3118,13 +3118,6 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL
ImplCreateEditEngine();
- bool bMatrix = ( nBlockMode == ScEnterMode::MATRIX );
-
- SfxApplication* pSfxApp = SfxGetpApp();
- std::unique_ptr<EditTextObject> pObject;
- std::unique_ptr<ScPatternAttr> pCellAttrs;
- bool bForget = false; // Remove due to validity?
-
OUString aString = GetEditText(mpEditEngine.get());
OUString aPreAutoCorrectString(aString);
EditView* pActiveView = pTopView ? pTopView : pTableView;
@@ -3193,12 +3186,24 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL
return;
}
- if (pData->DoError(pActiveViewSh->GetFrameWeld(), aString, aCursorPos))
- bForget = true; // Do not take over input
-
+ pData->DoError(
+ pActiveViewSh->GetFrameWeld(), aString, aCursorPos,
+ [this, nBlockMode, aString, aPreAutoCorrectString](bool bForget)
+ { EnterHandler2(nBlockMode, bForget, aString, aPreAutoCorrectString); });
+ return;
}
}
}
+ EnterHandler2(nBlockMode, false, aString, aPreAutoCorrectString);
+}
+
+void ScInputHandler::EnterHandler2(ScEnterMode nBlockMode, bool bForget, OUString aString,
+ const OUString& aPreAutoCorrectString)
+{
+ std::unique_ptr<EditTextObject> pObject;
+ std::unique_ptr<ScPatternAttr> pCellAttrs;
+ bool bMatrix = (nBlockMode == ScEnterMode::MATRIX);
+ SfxApplication* pSfxApp = SfxGetpApp();
// Check for input into DataPilot table
if ( bModified && !bForget )
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index e5f940bbbe34..84238486fa6b 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -785,6 +785,21 @@ void ScModule::InsertEntryToLRUList(sal_uInt16 nFIndex)
SetAppOptions(aNewOpts);
}
+void ScModule::InsertOrEraseFavouritesListEntry(sal_uInt16 nFIndex, bool bInsert)
+{
+ const ScAppOptions& rAppOpt = GetAppOptions();
+ std::unordered_set<sal_uInt16> sFavouriteFunctions = rAppOpt.GetFavouritesList();
+
+ if (bInsert)
+ sFavouriteFunctions.insert(nFIndex);
+ else
+ sFavouriteFunctions.erase(nFIndex);
+
+ ScAppOptions aNewOpts(rAppOpt);
+ aNewOpts.SetFavouritesList(sFavouriteFunctions);
+ SetAppOptions(aNewOpts);
+}
+
void ScModule::SetAppOptions( const ScAppOptions& rOpt )
{
if ( !m_pAppCfg )
diff --git a/sc/source/ui/app/uiitems.cxx b/sc/source/ui/app/uiitems.cxx
index a22afdbf16d5..bddd0c689aea 100644
--- a/sc/source/ui/app/uiitems.cxx
+++ b/sc/source/ui/app/uiitems.cxx
@@ -33,7 +33,7 @@
ScInputStatusItem::ScInputStatusItem(
sal_uInt16 nWhichP, const ScAddress& rCurPos, const ScAddress& rStartPos,
const ScAddress& rEndPos, OUString _aString, const EditTextObject* pData ) :
- SfxPoolItem ( nWhichP, SfxItemType::ScInputStatusItemType ),
+ SfxPoolItem ( nWhichP ),
aCursorPos ( rCurPos ),
aStartPos ( rStartPos ),
aEndPos ( rEndPos ),
@@ -126,7 +126,7 @@ ScEditViewHint::~ScEditViewHint()
ScSortItem::ScSortItem( sal_uInt16 nWhichP,
ScViewData* ptrViewData,
const ScSortParam* pSortData ) :
- SfxPoolItem ( nWhichP, SfxItemType::ScSortItemType ),
+ SfxPoolItem ( nWhichP ),
pViewData ( ptrViewData )
{
if ( pSortData ) theSortData = *pSortData;
@@ -134,7 +134,7 @@ ScSortItem::ScSortItem( sal_uInt16 nWhichP,
ScSortItem::ScSortItem( sal_uInt16 nWhichP,
const ScSortParam* pSortData ) :
- SfxPoolItem ( nWhichP, SfxItemType::ScSortItemType ),
+ SfxPoolItem ( nWhichP ),
pViewData ( nullptr )
{
if ( pSortData ) theSortData = *pSortData;
@@ -168,7 +168,7 @@ bool ScSortItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /* nMemberUd */ ) co
ScQueryItem::ScQueryItem( sal_uInt16 nWhichP,
ScViewData* ptrViewData,
const ScQueryParam* pQueryData ) :
- SfxPoolItem ( nWhichP, SfxItemType::ScQueryItemType ),
+ SfxPoolItem ( nWhichP ),
pViewData ( ptrViewData ),
bIsAdvanced ( false )
{
@@ -180,7 +180,7 @@ ScQueryItem::ScQueryItem( sal_uInt16 nWhichP,
ScQueryItem::ScQueryItem( sal_uInt16 nWhichP,
const ScQueryParam* pQueryData ) :
- SfxPoolItem ( nWhichP, SfxItemType::ScQueryItemType ),
+ SfxPoolItem ( nWhichP ),
pViewData ( nullptr ),
bIsAdvanced ( false )
{
@@ -248,7 +248,7 @@ ScQueryItem* ScQueryItem::Clone( SfxItemPool * ) const
ScSubTotalItem::ScSubTotalItem( sal_uInt16 nWhichP,
ScViewData* ptrViewData,
const ScSubTotalParam* pSubTotalData ) :
- SfxPoolItem ( nWhichP, SfxItemType::ScSubTotalItemType ),
+ SfxPoolItem ( nWhichP ),
pViewData ( ptrViewData )
{
if ( pSubTotalData ) theSubTotalData = *pSubTotalData;
@@ -280,7 +280,7 @@ bool ScSubTotalItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /* nMemberUd */
* Transporter for the UserLIst dialog
*/
ScUserListItem::ScUserListItem( sal_uInt16 nWhichP )
- : SfxPoolItem ( nWhichP, SfxItemType::ScUserListItemType )
+ : SfxPoolItem ( nWhichP )
{
}
@@ -326,7 +326,7 @@ void ScUserListItem::SetUserList( const ScUserList& rUserList )
ScConsolidateItem::ScConsolidateItem(
sal_uInt16 nWhichP,
const ScConsolidateParam* pConsolidateData ) :
- SfxPoolItem ( nWhichP, SfxItemType::ScConsolidateItemType )
+ SfxPoolItem ( nWhichP )
{
if ( pConsolidateData ) theConsData = *pConsolidateData;
}
@@ -350,7 +350,7 @@ ScConsolidateItem* ScConsolidateItem::Clone( SfxItemPool * ) const
*/
ScPivotItem::ScPivotItem( sal_uInt16 nWhichP, const ScDPSaveData* pData,
const ScRange* pRange, bool bNew ) :
- SfxPoolItem ( nWhichP, SfxItemType::ScPivotItemType )
+ SfxPoolItem ( nWhichP )
{
// pSaveData must always exist
if ( pData )
@@ -395,7 +395,7 @@ ScPivotItem* ScPivotItem::Clone( SfxItemPool * ) const
*/
ScSolveItem::ScSolveItem( sal_uInt16 nWhichP,
const ScSolveParam* pSolveData )
- : SfxPoolItem ( nWhichP, SfxItemType::ScSolveItemType )
+ : SfxPoolItem ( nWhichP )
{
if ( pSolveData ) theSolveData = *pSolveData;
}
@@ -419,7 +419,7 @@ ScSolveItem* ScSolveItem::Clone( SfxItemPool * ) const
*/
ScTabOpItem::ScTabOpItem( sal_uInt16 nWhichP,
const ScTabOpParam* pTabOpData )
- : SfxPoolItem ( nWhichP, SfxItemType::ScTabOpItemType )
+ : SfxPoolItem ( nWhichP )
{
if ( pTabOpData ) theTabOpData = *pTabOpData;
}
diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx
index 3f37e26458fd..c0ec382cdb98 100644
--- a/sc/source/ui/dialogs/searchresults.cxx
+++ b/sc/source/ui/dialogs/searchresults.cxx
@@ -65,11 +65,13 @@ namespace
{
class ListWrapper {
weld::TreeView& mrList;
+ const ScDocument& mrDoc;
public:
size_t mnCount = 0;
static const size_t mnMaximum = 1000;
- ListWrapper(weld::TreeView& rList)
+ ListWrapper(weld::TreeView& rList, const ScDocument& rDoc)
: mrList(rList)
+ , mrDoc(rDoc)
{
mrList.clear();
mrList.freeze();
@@ -78,17 +80,16 @@ namespace
{
mrList.thaw();
}
- void Insert(const OUString &rTabName,
- const ScAddress &rPos,
- formula::FormulaGrammar::AddressConvention eConvention,
- const OUString &rText)
+ void Insert(const ScAddress &rPos, const OUString &rText)
{
if (mnCount++ < mnMaximum)
{
- mrList.append_text(rTabName);
+ OUString aTabName;
+ mrDoc.GetName(rPos.Tab(), aTabName);
+ mrList.append_text(aTabName);
int nPos = mrList.n_children() - 1;
mrList.set_text(nPos, rPos.Format(ScRefFlags::ADDR_ABS,
- nullptr, eConvention), 1);
+ nullptr, mrDoc.GetAddressConvention()), 1);
mrList.set_text(nPos, rText, 2);
}
}
@@ -98,27 +99,17 @@ namespace
void SearchResultsDlg::FillResults( ScDocument& rDoc, const ScRangeList &rMatchedRanges, bool bCellNotes,
bool bEmptyCells, bool bMatchedRangesWereClamped )
{
- ListWrapper aList(*mxList);
- std::vector<OUString> aTabNames = rDoc.GetAllTableNames();
- SCTAB nTabCount = aTabNames.size();
+ ListWrapper aList(*mxList, rDoc);
- // tdf#92160 - too many results blow the widget's mind
- size_t nMatchMax = rMatchedRanges.size();
- if (nMatchMax > ListWrapper::mnMaximum)
- nMatchMax = ListWrapper::mnMaximum;
-
- if (bCellNotes || bEmptyCells)
+ for (const auto& rRange : rMatchedRanges)
{
- for (size_t i = 0, n = nMatchMax; i < n; ++i)
+ if (bCellNotes || bEmptyCells)
{
- ScRange const & rRange( rMatchedRanges[i] );
// Bear in mind that mostly the range is one address position
// or a column or a row joined.
ScAddress aPos( rRange.aStart );
for ( ; aPos.Tab() <= rRange.aEnd.Tab(); aPos.IncTab())
{
- if (aPos.Tab() >= nTabCount)
- break; // can this even happen? we just searched on existing sheets ...
for (aPos.SetCol( rRange.aStart.Col()); aPos.Col() <= rRange.aEnd.Col(); aPos.IncCol())
{
for (aPos.SetRow( rRange.aStart.Row()); aPos.Row() <= rRange.aEnd.Row(); aPos.IncRow())
@@ -127,36 +118,23 @@ void SearchResultsDlg::FillResults( ScDocument& rDoc, const ScRangeList &rMatche
{
const ScPostIt* pNote = rDoc.GetNote( aPos);
if (pNote)
- aList.Insert(aTabNames[aPos.Tab()], aPos,
- rDoc.GetAddressConvention(),
- pNote->GetText());
+ aList.Insert(aPos, pNote->GetText());
}
else // bEmptyCells
{
- aList.Insert(aTabNames[aPos.Tab()], aPos,
- rDoc.GetAddressConvention(),
- rDoc.GetString(aPos));
+ aList.Insert(aPos, rDoc.GetString(aPos));
}
}
}
}
}
- }
- else
- {
- for (size_t i = 0, n = nMatchMax; i < n; ++i)
+ else
{
- ScCellIterator aIter(rDoc, rMatchedRanges[i]);
+ ScCellIterator aIter(rDoc, rRange);
for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
{
const ScAddress& aPos = aIter.GetPos();
- if (aPos.Tab() >= nTabCount)
- // Out-of-bound sheet index.
- continue;
-
- aList.Insert(aTabNames[aPos.Tab()], aPos,
- rDoc.GetAddressConvention(),
- rDoc.GetString(aPos));
+ aList.Insert(aPos, rDoc.GetString(aPos));
}
}
}
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 8020cb8c7471..a00bf023c74c 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1227,7 +1227,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
{
const SfxItemSet& rOldSet = pSelAttrs->GetItemSet();
SfxItemPool* pItemPool = rOldSet.GetPool();
- auto pNewSet = std::make_shared<SfxItemSet>(rOldSet);
+ auto pNewSet = std::make_shared<SfxItemSet>(*pItemPool);
if (aLangText == "LANGUAGE_NONE")
{
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 01c65a4ed446..f679b031f3a5 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -161,8 +161,9 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
case SID_CELL_FORMAT_RESET:
case SID_TEXT_STANDARD:
{
- SfxItemSetFixed<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_MINFRAMEHEIGHT,
- SDRATTR_TEXT_MAXFRAMEHEIGHT, SDRATTR_TEXT_MAXFRAMEWIDTH> aEmptyAttr(GetPool());
+ SfxItemSet aEmptyAttr(SfxItemSet::makeFixedSfxItemSet<
+ SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_MINFRAMEHEIGHT,
+ SDRATTR_TEXT_MAXFRAMEHEIGHT, SDRATTR_TEXT_MAXFRAMEWIDTH>(GetPool()));
if (ScDrawLayer::IsNoteCaption(pSingleSelectedObj))
aEmptyAttr.Put(pView->GetAttrFromMarked(true));
@@ -429,7 +430,9 @@ void ScDrawShell::ExecuteMacroAssign(SdrObject* pObj, weld::Window* pWin)
}
// create empty itemset for macro-dlg
- auto xItemSet = std::make_unique<SfxItemSetFixed<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG>>( SfxGetpApp()->GetPool() );
+ auto xItemSet = std::make_unique<SfxItemSet>(SfxItemSet::makeFixedSfxItemSet<
+ SID_ATTR_MACROITEM, SID_ATTR_MACROITEM,
+ SID_EVENTCONFIG, SID_EVENTCONFIG>(SfxGetpApp()->GetPool()));
xItemSet->Put ( aItem );
SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index 3345e1f83f95..e46a4edd582c 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -64,6 +64,7 @@ ScFunctionWin::ScFunctionWin(weld::Widget* pParent)
, pFuncDesc(nullptr)
{
InitLRUList();
+ UpdateFavouritesList();
nArgs=0;
m_aListHelpId = xFuncList->get_help_id();
@@ -141,6 +142,14 @@ void ScFunctionWin::InitLRUList()
UpdateFunctionList(u""_ustr);
}
+void ScFunctionWin::UpdateFavouritesList()
+{
+ ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
+ pFuncMgr->fillFavouriteFunctions(aFavouritesList);
+
+ if (xCatBox->get_active() == 0)
+ UpdateFunctionList(u""_ustr);
+}
/*************************************************************************
#* Member: FillCategoriesMap
@@ -263,16 +272,16 @@ void ScFunctionWin::UpdateFunctionList(const OUString& rSearchString)
{
sal_Int32 nSelPos = xCatBox->get_active();
sal_Int32 nCategory = ( -1 != nSelPos )
- ? (nSelPos-1) : 0;
+ ? (nSelPos-ALL_CATEGORY) : 0;
xFuncList->clear();
xFuncList->freeze();
mCategories.clear();
sFuncScores.clear();
- bool bCollapse = nCategory == 0;
+ bool bCollapse = nSelPos == ALL_CATEGORY;
bool bFilter = !rSearchString.isEmpty();
- if ( nSelPos > 0 )
+ if (nSelPos >= ALL_CATEGORY)
{
ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
@@ -314,7 +323,7 @@ void ScFunctionWin::UpdateFunctionList(const OUString& rSearchString)
xScratchIter.get());
}
}
- else // LRU list
+ else if (nSelPos == LRU_CATEGORY) // LRU list
{
for (const formula::IFunctionDescription* pDesc : aLRUList)
{
@@ -328,6 +337,22 @@ void ScFunctionWin::UpdateFunctionList(const OUString& rSearchString)
}
}
}
+ else // Favourites List
+ {
+ ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
+ for (const auto& elem : aFavouritesList)
+ {
+ const formula::IFunctionDescription* pDesc(pFuncMgr->Get(elem));
+ if (pDesc)
+ {
+ OUString aFunction(pDesc->getFunctionName());
+ OUString aFuncDescId(weld::toId(pDesc));
+
+ xFuncList->insert(nullptr, -1, &aFunction, &aFuncDescId, nullptr, nullptr, false,
+ xScratchIter.get());
+ }
+ }
+ }
xFuncList->thaw();
@@ -487,9 +512,9 @@ void ScFunctionWin::DoEnter(bool bDoubleOrEnter)
IMPL_LINK_NOARG(ScFunctionWin, ModifyHdl, weld::Entry&, void)
{
- if (xCatBox->get_active() == 0)
+ if (xCatBox->get_active() == LRU_CATEGORY || xCatBox->get_active() == FAVOURITES_CATEGORY)
{
- xCatBox->set_active(1);
+ xCatBox->set_active(ALL_CATEGORY);
xHelpButton->set_sensitive(false);
}
OUString searchStr = m_xSearchString->get_text();
@@ -591,10 +616,11 @@ IMPL_LINK(ScFunctionWin, KeyInputHdl, const KeyEvent&, rEvent, bool)
IMPL_LINK_NOARG(ScFunctionWin, SelComboHdl, weld::ComboBox&, void)
{
- if (xCatBox->get_active() == 0)
+ if (xCatBox->get_active() == LRU_CATEGORY || xCatBox->get_active() == FAVOURITES_CATEGORY)
m_xSearchString->set_text(u""_ustr);
- xHelpButton->set_sensitive(xCatBox->get_active() != 1);
+ xHelpButton->set_sensitive(xCatBox->get_active() != ALL_CATEGORY);
OUString searchStr = m_xSearchString->get_text();
+ UpdateFavouritesList();
UpdateFunctionList(searchStr);
SetDescription();
}
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 9af2adbe7472..a2cd6b4e568a 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -512,6 +512,16 @@ void ScFormulaDlg::insertEntryToLRUList(const formula::IFunctionDescription*
const ScFuncDesc* pDesc = dynamic_cast<const ScFuncDesc*>(_pDesc);
SaveLRUEntry(pDesc);
}
+
+void ScFormulaDlg::insertOrEraseFavouritesListEntry(const formula::IFunctionDescription* _pDesc, bool bInsert)
+{
+ const ScFuncDesc* pDesc = dynamic_cast<const ScFuncDesc*>(_pDesc);
+ if (pDesc && pDesc->nFIndex != 0)
+ {
+ ScModule::get()->InsertOrEraseFavouritesListEntry(pDesc->nFIndex, bInsert);
+ }
+}
+
void ScFormulaDlg::showReference(const OUString& _sFormula)
{
ShowReference(_sFormula);
diff --git a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
index ab791151180f..0e678e3f4482 100644
--- a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
+++ b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
@@ -86,6 +86,8 @@ public:
void writeString(const char* aCharArray);
void writeBoldString(const OUString& aString);
void writeValue(double aValue);
+ void formatAsColumnHeader(SCCOL nCols = 1);
+ void formatTableBottom(SCCOL nCols = 1);
};
class DataCellIterator final
diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx
index 9c05491dac2d..e66b02270cbe 100644
--- a/sc/source/ui/inc/dwfunctr.hxx
+++ b/sc/source/ui/inc/dwfunctr.hxx
@@ -63,9 +63,11 @@ private:
::std::set<std::pair<std::pair<sal_Int32, sal_Int32>, std::pair<OUString, const ScFuncDesc*>>>
sFuncScores;
::std::vector< const formula::IFunctionDescription*> aLRUList;
+ ::std::unordered_set<sal_uInt16> aFavouritesList;
::std::unordered_map<OUString, std::unique_ptr<weld::TreeIter>> mCategories;
void UpdateLRUList();
+ void UpdateFavouritesList();
void DoEnter(bool bDouble_or_Enter = false);
void SetDescription();
weld::TreeIter* FillCategoriesMap(const OUString&, bool);
diff --git a/sc/source/ui/inc/formula.hxx b/sc/source/ui/inc/formula.hxx
index 02ee866c1bc9..db6ef49f6b45 100644
--- a/sc/source/ui/inc/formula.hxx
+++ b/sc/source/ui/inc/formula.hxx
@@ -57,6 +57,7 @@ public:
virtual std::unique_ptr<formula::FormulaCompiler> createCompiler( formula::FormulaTokenArray& rArray ) const override;
virtual void doClose(bool _bOk) override;
virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc) override;
+ virtual void insertOrEraseFavouritesListEntry(const formula::IFunctionDescription* pDesc, bool bInsert) override;
virtual void showReference(const OUString& _sFormula) override;
virtual void dispatch(bool _bOK, bool _bMatrixChecked) override;
virtual void setDispatcherLock( bool bLock ) override;
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 3067dd819397..0b68ed14c6b6 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -198,6 +198,8 @@ public:
bool KeyInput( const KeyEvent& rKEvt, bool bStartEdit );
void EnterHandler( ScEnterMode nBlockMode = ScEnterMode::NORMAL, bool bBeforeSavingInLOK = false );
+ void EnterHandler2(ScEnterMode nBlockMode, bool bForget, OUString aString,
+ const OUString& aPreAutoCorrectString);
void CancelHandler();
void SetReference( const ScRange& rRef, const ScDocument& rDoc );
void AddRefEntry();
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index e19bc6f58100..d3d51f52fcc4 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -355,7 +355,7 @@ public:
void SetSnapPixel();
- bool ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType, SCROW nRow = -1,
+ bool ReopenPDFStructureElement(vcl::pdf::StructElement aType, SCROW nRow = -1,
SCCOL nCol = -1);
void DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool bPage, bool bMergeCover = false);
diff --git a/sc/source/ui/inc/uiitems.hxx b/sc/source/ui/inc/uiitems.hxx
index 84625b899f7b..dcab506e64b6 100644
--- a/sc/source/ui/inc/uiitems.hxx
+++ b/sc/source/ui/inc/uiitems.hxx
@@ -51,6 +51,7 @@ class ScInputStatusItem : public SfxPoolItem
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScInputStatusItem)
ScInputStatusItem( sal_uInt16 nWhich,
const ScAddress& rCurPos,
const ScAddress& rStartPos,
@@ -127,6 +128,7 @@ public:
class SC_DLLPUBLIC ScSortItem : public SfxPoolItem
{
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScSortItem)
ScSortItem( sal_uInt16 nWhich,
ScViewData* ptrViewData,
const ScSortParam* pSortData );
@@ -148,6 +150,7 @@ private:
class SC_DLLPUBLIC ScQueryItem : public SfxPoolItem
{
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScQueryItem)
ScQueryItem( sal_uInt16 nWhich,
ScViewData* ptrViewData,
const ScQueryParam* pQueryData );
@@ -175,6 +178,7 @@ private:
class SC_DLLPUBLIC ScSubTotalItem : public SfxPoolItem
{
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScSubTotalItem)
ScSubTotalItem( sal_uInt16 nWhich,
ScViewData* ptrViewData,
const ScSubTotalParam* pSubTotalData );
@@ -194,6 +198,7 @@ private:
class SC_DLLPUBLIC ScUserListItem : public SfxPoolItem
{
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScUserListItem)
ScUserListItem( sal_uInt16 nWhich );
ScUserListItem( const ScUserListItem& rItem );
virtual ~ScUserListItem() override;
@@ -211,6 +216,7 @@ private:
class ScConsolidateItem : public SfxPoolItem
{
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScConsolidateItem)
ScConsolidateItem( sal_uInt16 nWhich,
const ScConsolidateParam* pParam );
@@ -226,6 +232,7 @@ private:
class ScPivotItem : public SfxPoolItem
{
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScPivotItem)
ScPivotItem( sal_uInt16 nWhich, const ScDPSaveData* pData,
const ScRange* pRange, bool bNew );
ScPivotItem( const ScPivotItem& rItem );
@@ -247,6 +254,7 @@ private:
class ScSolveItem : public SfxPoolItem
{
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScSolveItem)
ScSolveItem( sal_uInt16 nWhich,
const ScSolveParam* pParam );
@@ -262,6 +270,7 @@ private:
class ScTabOpItem : public SfxPoolItem
{
public:
+ DECLARE_ITEM_TYPE_FUNCTION(ScTabOpItem)
ScTabOpItem( sal_uInt16 nWhich,
const ScTabOpParam* pParam );
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index 5f75a610def8..cde2774153bc 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -39,6 +39,7 @@
#include <optsolver.hxx>
#include <table.hxx>
#include <TableFillingAndNavigationTools.hxx>
+#include <tabvwsh.hxx>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/sheet/SolverConstraint.hpp>
@@ -1258,10 +1259,12 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
// Objective cell section
aOutput.writeBoldString(ScResId(STR_SENSITIVITY_OBJCELL));
aOutput.newLine();
+ aOutput.formatAsColumnHeader(2);
aOutput.writeString(ScResId(STR_SENSITIVITY_CELL));
aOutput.nextColumn();
aOutput.writeString(ScResId(STR_SENSITIVITY_FINALVALUE));
aOutput.newLine();
+ aOutput.formatTableBottom(2);
aOutput.writeString(GetCellStrAddress(xSolver->getObjective()));
aOutput.nextColumn();
aOutput.writeValue(xSolver->getResultValue());
@@ -1271,6 +1274,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
// Variable cell section
aOutput.writeBoldString(ScResId(STR_SENSITIVITY_VARCELLS));
aOutput.newLine();
+ aOutput.formatAsColumnHeader(6);
aOutput.writeString(ScResId(STR_SENSITIVITY_CELL));
aOutput.nextColumn();
aOutput.writeString(ScResId(STR_SENSITIVITY_FINALVALUE));
@@ -1289,8 +1293,11 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
uno::Sequence<double> aObjReducedCosts = aSensitivity.ObjReducedCosts;
uno::Sequence<double> aObjAllowableDecreases = aSensitivity.ObjAllowableDecreases;
uno::Sequence<double> aObjAllowableIncreases = aSensitivity.ObjAllowableIncreases;
- for (sal_Int32 i = 0; i < aVariables.getLength(); i++)
+ sal_Int32 nRows = aVariables.getLength();
+ for (sal_Int32 i = 0; i < nRows; i++)
{
+ if (i == nRows - 1)
+ aOutput.formatTableBottom(6);
aOutput.writeString(GetCellStrAddress(aVariables[i]));
aOutput.nextColumn();
aOutput.writeValue(aSolution[i]);
@@ -1309,6 +1316,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
// Constraints section
aOutput.writeBoldString(ScResId(STR_SENSITIVITY_CONSTRAINTS));
aOutput.newLine();
+ aOutput.formatAsColumnHeader(6);
aOutput.writeString(ScResId(STR_SENSITIVITY_CELL));
aOutput.nextColumn();
aOutput.writeString(ScResId(STR_SENSITIVITY_FINALVALUE));
@@ -1327,8 +1335,11 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
uno::Sequence<double> aConstrShadowPrices = aSensitivity.ConstrShadowPrices;
uno::Sequence<double> aConstrAllowableDecreases = aSensitivity.ConstrAllowableDecreases;
uno::Sequence<double> aConstrAllowableIncreases = aSensitivity.ConstrAllowableIncreases;
- for (sal_Int32 i = 0; i < aConstraints.getLength(); i++)
+ nRows = aConstraints.getLength();
+ for (sal_Int32 i = 0; i < nRows; i++)
{
+ if (i == nRows - 1)
+ aOutput.formatTableBottom(6);
aOutput.writeString(GetCellStrAddress(aConstraints[i].Left));
aOutput.nextColumn();
aOutput.writeValue(aConstrValues[i]);
@@ -1342,6 +1353,15 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
aOutput.writeValue(aConstrAllowableIncreases[i]);
aOutput.newLine();
}
+
+ // Disable grid lines in the sensitivity report
+ if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell())
+ {
+ ScViewData& rData = pViewSh->GetViewData();
+ rData.SetTabNo(nReportTab);
+ rData.SetShowGrid(false);
+ rData.SetTabNo(mnCurTab);
+ }
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 19ef534be1e6..06e8f47a6b9c 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2249,7 +2249,7 @@ static void lcl_PDFExportHelper(const OutputDevice* pDev, const OUString& rTabNa
if (pPDF->GetIsExportTaggedPDF())
{
if (bIsFirstPage)
- pPDF->WrapBeginStructureElement(vcl::PDFWriter::Document, u"Workbook"_ustr);
+ pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::Document, u"Workbook"_ustr);
else
{ // if there is a new worksheet(not first), delete and add new ScPDFState
assert(pPDF->GetScPDFState());
diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx
index fa05584049a5..27fd2cc61dcd 100644
--- a/sc/source/ui/vba/vbapagesetup.cxx
+++ b/sc/source/ui/vba/vbapagesetup.cxx
@@ -608,10 +608,7 @@ void SAL_CALL ScVbaPageSetup::setPaperSize( sal_Int32 papersize )
{
if ( papersize != excel::XlPaperSize::xlPaperUser )
{
- awt::Size aPaperSize;
- const msfilter::util::ApiPaperSize& rConvertedSize = msfilter::util::PaperSizeConv::getApiSizeForMSPaperSizeIndex( papersize );
- aPaperSize.Height = rConvertedSize.mnHeight;
- aPaperSize.Width = rConvertedSize.mnWidth;
+ awt::Size aPaperSize = msfilter::util::PaperSizeConv::getApiSizeForMSPaperSizeIndex( papersize );
if ( mbIsLandscape )
::std::swap( aPaperSize.Width, aPaperSize.Height );
mxPageProps->setPropertyValue( u"Size"_ustr, uno::Any( aPaperSize ) );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 99f5075f6b3a..e45afab83c00 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2242,28 +2242,23 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
// try to find an existing conditional format
const ScPatternAttr* pPattern = rDoc.GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
ScConditionalFormatList* pList = rDoc.GetCondFormList(aPos.Tab());
- const ScCondFormatIndexes& rCondFormats = pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
- bool bContainsCondFormat = !rCondFormats.empty();
+ bool bContainsCondFormat = false;
bool bCondFormatDlg = false;
- bool bContainsExistingCondFormat = false;
- if(bContainsCondFormat)
+ for (auto nKey : pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData())
{
- for (const auto& rCondFormat : rCondFormats)
+ // check if at least one existing conditional format has the same range
+ const ScConditionalFormat* pCondFormat = pList->GetFormat(nKey);
+ if(!pCondFormat)
+ continue;
+
+ bContainsCondFormat = true; // found at least one format
+ const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
+ if(rCondFormatRange == aRangeList)
{
- // check if at least one existing conditional format has the same range
- const ScConditionalFormat* pCondFormat = pList->GetFormat(rCondFormat);
- if(!pCondFormat)
- continue;
-
- bContainsExistingCondFormat = true;
- const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
- if(rCondFormatRange == aRangeList)
- {
- // found a matching range, edit this conditional format
- bCondFormatDlg = true;
- nIndex = pCondFormat->GetKey();
- break;
- }
+ // found a matching range, edit this conditional format
+ bCondFormatDlg = true;
+ nIndex = pCondFormat->GetKey();
+ break;
}
}
@@ -2426,7 +2421,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
// if not found a conditional format ask whether we should edit one of the existing
// or should create a new overlapping conditional format
- if(bContainsCondFormat && !bCondFormatDlg && bContainsExistingCondFormat)
+ if (bContainsCondFormat && !bCondFormatDlg)
{
std::shared_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 2a73bc1857fa..eb7cbb2e27a7 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2127,6 +2127,10 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
if (!bWasMouseCaptured && IsMouseCaptured())
ReleaseMouse();
+ const bool lokReadOnly = comphelper::LibreOfficeKit::isActive() && pViewSh->IsLokReadOnlyView();
+ if (lokReadOnly)
+ return; // Return as if the action was performed, so the flow is not affected.
+
LaunchDataSelectMenu( aListValPos.Col(), aListValPos.Row() );
nMouseStatus = SC_GM_FILTER; // not set in DoAutoFilterMenue for bDataSelect
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index ddf3dd5e0b78..cc4a3bd6e2b4 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -298,13 +298,13 @@ void ScOutputData::SetSyntaxMode( bool bNewMode )
}
}
-bool ScOutputData::ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType, SCROW nRow, SCCOL nCol)
+bool ScOutputData::ReopenPDFStructureElement(vcl::pdf::StructElement aType, SCROW nRow, SCCOL nCol)
{
bool bReopenTag = false;
vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(mpDev->GetExtOutDevData());
if (pPDF)
{
- if (aType == vcl::PDFWriter::Part) // Worksheet
+ if (aType == vcl::pdf::StructElement::Part) // Worksheet
{
if (pPDF->GetScPDFState()->m_WorksheetId != -1)
{
@@ -313,7 +313,7 @@ bool ScOutputData::ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType
bReopenTag = true;
}
}
- else if (aType == vcl::PDFWriter::Table)
+ else if (aType == vcl::pdf::StructElement::Table)
{
if (pPDF->GetScPDFState()->m_TableId != -1)
{
@@ -322,7 +322,7 @@ bool ScOutputData::ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType
bReopenTag = true;
}
}
- else if (aType == vcl::PDFWriter::TableRow)
+ else if (aType == vcl::pdf::StructElement::TableRow)
{
const auto aIter = pPDF->GetScPDFState()->m_TableRowMap.find(nRow);
if (aIter != pPDF->GetScPDFState()->m_TableRowMap.end() && nRow == aIter->first)
@@ -332,7 +332,7 @@ bool ScOutputData::ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType
bReopenTag = true;
}
}
- else if (aType == vcl::PDFWriter::TableData)
+ else if (aType == vcl::pdf::StructElement::TableData)
{
const std::pair<SCROW, SCCOL> keyToFind = std::make_pair(nRow, nCol);
const auto aIter = pPDF->GetScPDFState()->m_TableDataMap.find(keyToFind);
@@ -1128,7 +1128,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext)
else
{
if (bTaggedPDF)
- pPDF->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement);
+ pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement);
// scan for rows with the same background:
SCSIZE nSkip = 0;
@@ -1298,7 +1298,7 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot
if ( pAttr && !bSkipX )
{
if (bTaggedPDF)
- pPDF->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement);
+ pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement);
ScShadowPart ePart = nPass ?
pThisRowInfo->cellInfo(nCol).eVShadowPart :
@@ -1461,7 +1461,7 @@ void ScOutputData::DrawFrame(vcl::RenderContext& rRenderContext)
vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(mpDev->GetExtOutDevData());
bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF();
if (bTaggedPDF)
- pPDF->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement);
+ pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement);
DrawModeFlags nOldDrawMode = rRenderContext.GetDrawMode();
@@ -2091,7 +2091,8 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
if ( nRefStartX == nRefEndX && nRefStartY == nRefEndY )
mpDoc->ExtendMerge( nRefStartX, nRefStartY, nRefEndX, nRefEndY, nTab );
- else if (mpDoc->HasAttrib(nRefEndX, nRefEndY, nTab, HasAttrFlags::Merged))
+ else if (mpDoc->ValidCol(nRefEndX) && mpDoc->ValidRow(nRefEndY) &&
+ mpDoc->HasAttrib(nRefEndX, nRefEndY, nTab, HasAttrFlags::Merged))
mpDoc->ExtendMerge(nRefEndX, nRefEndY, nRefEndX, nRefEndY, nTab);
if ( !(nRefStartX <= nVisX2 && nRefEndX >= nVisX1 &&
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 421edaafcc5f..4a3bdc5535ba 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1493,11 +1493,11 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF();
if (bTaggedPDF)
{
- bool bReopenTag = ReopenPDFStructureElement(vcl::PDFWriter::Table);
+ bool bReopenTag = ReopenPDFStructureElement(vcl::pdf::StructElement::Table);
if (!bReopenTag)
{
sal_Int32 nId = pPDF->EnsureStructureElement(nullptr);
- pPDF->InitStructureElement(nId, vcl::PDFWriter::Table, u"Table"_ustr);
+ pPDF->InitStructureElement(nId, vcl::pdf::StructElement::Table, u"Table"_ustr);
pPDF->BeginStructureElement(nId);
pPDF->GetScPDFState()->m_TableId = nId;
}
@@ -1571,12 +1571,12 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
if (nLoopStartX != 0)
{
bReopenTag
- = ReopenPDFStructureElement(vcl::PDFWriter::TableRow, nY);
+ = ReopenPDFStructureElement(vcl::pdf::StructElement::TableRow, nY);
}
if (!bReopenTag)
{
sal_Int32 nId = pPDF->EnsureStructureElement(nullptr);
- pPDF->InitStructureElement(nId, vcl::PDFWriter::TableRow, u"TR"_ustr);
+ pPDF->InitStructureElement(nId, vcl::pdf::StructElement::TableRow, u"TR"_ustr);
pPDF->BeginStructureElement(nId);
pPDF->GetScPDFState()->m_TableRowMap.emplace(nY, nId);
}
@@ -1588,7 +1588,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
for (SCCOL nX=nLoopStartX; nX<=nX2; nX++)
{
if (bTaggedPDF)
- pPDF->WrapBeginStructureElement(vcl::PDFWriter::TableData, u"TD"_ustr);
+ pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::TableData, u"TD"_ustr);
bool bMergeEmpty = false;
const ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nX);
@@ -2134,7 +2134,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
if (!aString.isEmpty())
{
if (bTaggedPDF)
- pPDF->WrapBeginStructureElement(vcl::PDFWriter::Paragraph, u"P"_ustr);
+ pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::Paragraph, u"P"_ustr);
// If the string is clipped, make it shorter for
// better performance since drawing by HarfBuzz is
@@ -4492,7 +4492,7 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
bool bReopenTag = false;
if (bTaggedPDF)
- bReopenTag = ReopenPDFStructureElement(vcl::PDFWriter::TableData, nY, nX);
+ bReopenTag = ReopenPDFStructureElement(vcl::pdf::StructElement::TableData, nY, nX);
SCCOL nCellX = nX; // position where the cell really starts
SCROW nCellY = nY;
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index a8c3990b1288..07f5225b87f5 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -554,11 +554,11 @@ void ScPrintFunc::DrawToDev(ScDocument& rDoc, OutputDevice* pDev, double /* nPri
bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF();
if (bTaggedPDF)
{
- bool bReopen = aOutputData.ReopenPDFStructureElement(vcl::PDFWriter::Part);
+ bool bReopen = aOutputData.ReopenPDFStructureElement(vcl::pdf::StructElement::Part);
if (!bReopen)
{
sal_Int32 nId = pPDF->EnsureStructureElement(nullptr);
- pPDF->InitStructureElement(nId, vcl::PDFWriter::Part, u"Worksheet"_ustr);
+ pPDF->InitStructureElement(nId, vcl::pdf::StructElement::Part, u"Worksheet"_ustr);
pPDF->BeginStructureElement(nId);
pPDF->GetScPDFState()->m_WorksheetId = nId;
}
@@ -1624,11 +1624,11 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF();
if (bTaggedPDF)
{
- bool bReopen = aOutputData.ReopenPDFStructureElement(vcl::PDFWriter::Part);
+ bool bReopen = aOutputData.ReopenPDFStructureElement(vcl::pdf::StructElement::Part);
if (!bReopen)
{
sal_Int32 nId = pPDF->EnsureStructureElement(nullptr);
- pPDF->InitStructureElement(nId, vcl::PDFWriter::Part, u"Worksheet"_ustr);
+ pPDF->InitStructureElement(nId, vcl::pdf::StructElement::Part, u"Worksheet"_ustr);
pPDF->BeginStructureElement(nId);
pPDF->GetScPDFState()->m_WorksheetId = nId;
}
@@ -1786,7 +1786,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart
vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData());
bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF();
if (bTaggedPDF)
- pPDF->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement);
+ pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement);
const ScPrintHFParam& rParam = bHeader ? aHdr : aFtr;