summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-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.cxx2
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx3
-rw-r--r--sc/source/ui/docshell/docfunc.cxx4
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx9
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx5
-rw-r--r--sc/source/ui/inc/TableFillingAndNavigationTools.hxx2
-rw-r--r--sc/source/ui/inc/inputhdl.hxx2
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx24
-rw-r--r--sc/source/ui/undo/undoblk.cxx15
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx2
-rw-r--r--sc/source/ui/unoobj/optuno.cxx4
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx10
-rw-r--r--sc/source/ui/view/cellsh1.cxx50
-rw-r--r--sc/source/ui/view/cellsh2.cxx204
-rw-r--r--sc/source/ui/view/dbfunc.cxx6
-rw-r--r--sc/source/ui/view/viewfunc.cxx3
18 files changed, 266 insertions, 152 deletions
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 84238486fa6b..26e40a2d3d9a 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2344,7 +2344,7 @@ bool ScModule::HasThesaurusLanguage( LanguageType nLang )
return bHasLang;
}
-std::optional<SfxStyleFamilies> ScModule::CreateStyleFamilies()
+SfxStyleFamilies ScModule::CreateStyleFamilies()
{
SfxStyleFamilies aStyleFamilies;
std::locale resLocale = ScModule::get()->GetResLocale();
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 0470d00e9291..317f7f3a9165 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -1160,8 +1160,7 @@ IMPL_LINK(ScFilterDlg, LbSelectHdl, weld::ComboBox&, rLb, void)
UpdateColorList(4);
}
- auto aEntry = theQueryData.GetEntry(nQ);
- aEntry.eOp = op;
+ theQueryData.GetEntry(nQ).eOp = op;
}
else if (&rLb == m_xLbColor1.get() || &rLb == m_xLbColor2.get() || &rLb == m_xLbColor3.get()
|| &rLb == m_xLbColor4.get())
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index e745b922315e..9b5413cd1c17 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5703,7 +5703,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
ScConditionalFormatList* pOld = rDoc.GetCondFormList(nTab);
if (pOld)
- pUndoDoc->SetCondFormList(new ScConditionalFormatList(*pUndoDoc, *pOld), nTab);
+ pUndoDoc->SetCondFormList(pOld->Clone(*pUndoDoc), nTab);
else
pUndoDoc->SetCondFormList(nullptr, nTab);
@@ -5723,7 +5723,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
{
ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO));
pRedoDoc->InitUndo( rDoc, nTab, nTab );
- pRedoDoc->SetCondFormList(new ScConditionalFormatList(*pRedoDoc, *pList), nTab);
+ pRedoDoc->SetCondFormList(pList->Clone(*pRedoDoc), nTab);
rDocShell.GetUndoManager()->AddUndoAction(
std::make_unique<ScUndoConditionalFormatList>(&rDocShell, std::move(pUndoDoc), std::move(pRedoDoc), nTab));
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/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index a44532a05907..cc373117bfa2 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -57,7 +57,6 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
-#include <cppuhelper/bootstrap.hxx>
#include <svtools/dialogclosedlistener.hxx>
#include <officecfg/Office/Common.hxx>
@@ -628,9 +627,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV
rViewShell.ActivateObject(pObj.get(), embed::EmbedVerbs::MS_OLEVERB_SHOW);
//open wizard
- //@todo get context from calc if that has one
- uno::Reference< uno::XComponentContext > xContext(
- ::cppu::defaultBootstrap_InitialComponentContext() );
+ uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
if(xContext.is())
{
uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
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/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/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/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index cd96fa833f21..f5b3124c8795 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1626,7 +1626,7 @@ ScDocumentUniquePtr ScUndoConditionalFormat::createUndoRedoData()
ScDocumentUniquePtr pUndoRedoDoc(new ScDocument(SCDOCMODE_UNDO));
pUndoRedoDoc->InitUndo(rDoc, mnTab, mnTab);
if (const auto* pList = rDoc.GetCondFormList(mnTab))
- pUndoRedoDoc->SetCondFormList(new ScConditionalFormatList(*pUndoRedoDoc, *pList), mnTab);
+ pUndoRedoDoc->SetCondFormList(pList->Clone(*pUndoRedoDoc), mnTab);
return pUndoRedoDoc;
}
@@ -1654,14 +1654,23 @@ void ScUndoConditionalFormat::DoChange(ScDocument* pSrcDoc)
// formats with the other formats in the tab, to get the correct state.
ScRangeList aCombinedRange;
if (const auto* pOldList = rDoc.GetCondFormList(mnTab))
+ {
aCombinedRange = pOldList->GetCombinedRange();
+ // Clear all existing CF keys from cells' attributes
+ for (auto& pFormat : *pOldList)
+ rDoc.RemoveCondFormatData(aCombinedRange, mnTab, pFormat->GetKey());
+ }
if (const auto* pNewList = pSrcDoc->GetCondFormList(mnTab))
{
for (const auto& cond : *pNewList)
+ {
+ // Restore the CF keys to cell attributes
+ rDoc.AddCondFormatData(cond->GetRange(), mnTab, cond->GetKey());
for (const auto& range : cond->GetRange())
aCombinedRange.Join(range);
- rDoc.SetCondFormList(new ScConditionalFormatList(rDoc, *pNewList), mnTab);
+ }
+ rDoc.SetCondFormList(pNewList->Clone(rDoc), mnTab);
}
else
{
@@ -1725,7 +1734,7 @@ void ScUndoConditionalFormatList::DoChange(const ScDocument* pSrcDoc)
mpUndoDoc->GetCondFormList(mnTab)->RemoveFromDocument(rDoc);
mpRedoDoc->GetCondFormList(mnTab)->AddToDocument(rDoc);
}
- rDoc.SetCondFormList(new ScConditionalFormatList(rDoc, *pSrcDoc->GetCondFormList(mnTab)), mnTab);
+ rDoc.SetCondFormList(pSrcDoc->GetCondFormList(mnTab)->Clone(rDoc), mnTab);
pDocShell->PostPaintGridAll();
pDocShell->PostDataChanged();
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 82ad1eeab815..7e301b4b3984 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -581,7 +581,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName,
{
ArrayOfArrayProc<uno::Any>::processSequences( pDoc, rArg, aTokenArr, nDocRow, bArgErr, bOverflow );
}
- else if (uno::Reference<table::XCellRange> xRange; rArg >>= xRange)
+ else if (uno::Reference<table::XCellRange> xRange; (rArg >>= xRange) && xRange)
{
// currently, only our own cell ranges are supported
diff --git a/sc/source/ui/unoobj/optuno.cxx b/sc/source/ui/unoobj/optuno.cxx
index 3d475f74ef8c..ce885684a254 100644
--- a/sc/source/ui/unoobj/optuno.cxx
+++ b/sc/source/ui/unoobj/optuno.cxx
@@ -30,7 +30,7 @@ using namespace com::sun::star;
bool ScDocOptionsHelper::setPropertyValue( ScDocOptions& rOptions,
const SfxItemPropertyMap& rPropMap,
- const OUString& aPropertyName, const uno::Any& aValue )
+ std::u16string_view aPropertyName, const uno::Any& aValue )
{
//! use map (with new identifiers)
@@ -103,7 +103,7 @@ bool ScDocOptionsHelper::setPropertyValue( ScDocOptions& rOptions,
uno::Any ScDocOptionsHelper::getPropertyValue(
const ScDocOptions& rOptions,
const SfxItemPropertyMap& rPropMap,
- const OUString& aPropertyName )
+ std::u16string_view aPropertyName )
{
uno::Any aRet;
const SfxItemPropertyMapEntry* pEntry = rPropMap.getByName( aPropertyName );
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 659a271a05e0..417fded19368 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1161,7 +1161,7 @@ uno::Reference<container::XIndexReplace> ScStyleObj::CreateEmptyNumberingRules()
// beans::XPropertyState
-const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName,
+const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( std::u16string_view rPropName,
const SfxItemPropertyMapEntry*& rpResultEntry )
{
SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
@@ -1195,7 +1195,7 @@ const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName,
return nullptr;
}
-beans::PropertyState ScStyleObj::getPropertyState_Impl( const OUString& aPropertyName )
+beans::PropertyState ScStyleObj::getPropertyState_Impl( std::u16string_view aPropertyName )
{
beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
@@ -1279,7 +1279,7 @@ void SAL_CALL ScStyleObj::setPropertyToDefault( const OUString& aPropertyName )
setPropertyValue_Impl( aPropertyName, pEntry, nullptr );
}
-uno::Any ScStyleObj::getPropertyDefault_Impl( const OUString& aPropertyName )
+uno::Any ScStyleObj::getPropertyDefault_Impl( std::u16string_view aPropertyName )
{
uno::Any aAny;
@@ -1531,7 +1531,7 @@ void SAL_CALL ScStyleObj::setPropertyValue( const OUString& aPropertyName, const
setPropertyValue_Impl( aPropertyName, pEntry, &aValue );
}
-void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const SfxItemPropertyMapEntry* pEntry, const uno::Any* pValue )
+void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const SfxItemPropertyMapEntry* pEntry, const uno::Any* pValue )
{
SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
if ( !(pStyle && pEntry) )
@@ -1872,7 +1872,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx
static_cast<SfxStyleSheet*>(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged));
}
-uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName )
+uno::Any ScStyleObj::getPropertyValue_Impl( std::u16string_view aPropertyName )
{
uno::Any aAny;
SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 99f5075f6b3a..fcbd50bcea60 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -27,6 +27,7 @@
#include <basic/sberrors.hxx>
#include <comphelper/lok.hxx>
+#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
#include <svl/stritem.hxx>
#include <svl/numformat.hxx>
@@ -95,7 +96,6 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <cppuhelper/bootstrap.hxx>
#include <o3tl/string_view.hxx>
#include <memory>
@@ -1443,7 +1443,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
weld::WaitObject aWait( GetViewData().GetDialogParent() );
pTabViewShell->CopyToClip( nullptr, false, false, true );
rReq.Done();
- GetViewData().SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border );
+
+ if (!comphelper::LibreOfficeKit::isActive() || !pTabViewShell->GetViewShell() || !pTabViewShell->GetViewShell()->IsLokReadOnlyView())
+ GetViewData().SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border );
+
pTabViewShell->ShowCursor();
pTabViewShell->UpdateCopySourceOverlay();
}
@@ -1454,7 +1457,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
weld::WaitObject aWait( GetViewData().GetDialogParent() );
pTabViewShell->CutToClip();
rReq.Done();
- GetViewData().SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border );
+
+ if (!comphelper::LibreOfficeKit::isActive() || !pTabViewShell->GetViewShell() || !pTabViewShell->GetViewShell()->IsLokReadOnlyView())
+ GetViewData().SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border );
+
pTabViewShell->ShowCursor();
pTabViewShell->UpdateCopySourceOverlay();
}
@@ -2004,8 +2010,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_CHINESE_CONVERSION:
{
//open ChineseTranslationDialog
- Reference< XComponentContext > xContext(
- ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
+ uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
if(xContext.is())
{
Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
@@ -2242,28 +2247,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 +2426,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/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 38a2e62ac177..29d6f126b4e6 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -920,102 +920,136 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
auto xDlg = std::make_shared<ScValidationDlg>(pParentWin, &aArgSet, pTabViewShell);
ScValidationRegisteredDlg aRegisterThatDlgExists(pParentWin, xDlg);
- short nResult = xDlg->run();
- if ( nResult == RET_OK )
+ struct lcl_auxData
{
- const SfxItemSet* pOutSet = xDlg->GetOutputItemSet();
-
- if ( const SfxUInt16Item* pItem = pOutSet->GetItemIfSet( FID_VALID_MODE ) )
- eMode = static_cast<ScValidationMode>(pItem->GetValue());
- if ( const SfxUInt16Item* pItem = pOutSet->GetItemIfSet( FID_VALID_CONDMODE ) )
- eOper = static_cast<ScConditionMode>(pItem->GetValue());
- if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_VALUE1 ) )
+ ScAddress aCursorPos;
+ ScValidationMode eMode;
+ ScConditionMode eOper;
+ OUString aExpr1;
+ OUString aExpr2;
+ bool bBlank;
+ sal_Int16 nListType;
+ bool bShowHelp;
+ OUString aHelpTitle;
+ OUString aHelpText;
+ bool bShowError;
+ ScValidErrorStyle eErrStyle;
+ OUString aErrTitle;
+ OUString aErrText;
+ bool bCaseSensitive;
+ };
+
+ std::shared_ptr<lcl_auxData> xAuxData = std::make_shared<lcl_auxData>(lcl_auxData{
+ aCursorPos, eMode, eOper, aExpr1, aExpr2, bBlank, nListType, bShowHelp,
+ aHelpTitle, aHelpText, bShowError, eErrStyle, aErrTitle, aErrText, bCaseSensitive});
+
+ auto xRequest = std::make_shared<SfxRequest>(rReq);
+ rReq.Ignore(); // the 'old' request is not relevant any more
+ SfxTabDialogController::runAsync(
+ xDlg,
+ [&rDoc, xRequest=std::move(xRequest), xAuxData=std::move(xAuxData),
+ xDlg, pTabViewShell](sal_Int32 nResult)
+ {
+ if ( nResult == RET_OK )
{
- OUString aTemp1 = pItem->GetValue();
- if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
+ const SfxItemSet* pOutSet = xDlg->GetOutputItemSet();
+
+ if ( const SfxUInt16Item* pItem = pOutSet->GetItemIfSet( FID_VALID_MODE ) )
+ xAuxData->eMode = static_cast<ScValidationMode>(pItem->GetValue());
+ if ( const SfxUInt16Item* pItem = pOutSet->GetItemIfSet( FID_VALID_CONDMODE ) )
+ xAuxData->eOper = static_cast<ScConditionMode>(pItem->GetValue());
+ if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_VALUE1 ) )
{
- sal_uInt32 nNumIndex = 0;
- double nVal;
- if (rDoc.GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
- aExpr1 = ::rtl::math::doubleToUString( nVal,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- ScGlobal::getLocaleData().getNumDecimalSep()[0], true);
+ OUString aTemp1 = pItem->GetValue();
+ if (xAuxData->eMode == SC_VALID_DATE || xAuxData->eMode == SC_VALID_TIME)
+ {
+ sal_uInt32 nNumIndex = 0;
+ double nVal;
+ if (rDoc.GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
+ xAuxData->aExpr1 = ::rtl::math::doubleToUString( nVal,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ ScGlobal::getLocaleData().getNumDecimalSep()[0], true);
+ else
+ xAuxData->aExpr1 = aTemp1;
+ }
else
- aExpr1 = aTemp1;
+ xAuxData->aExpr1 = aTemp1;
}
- else
- aExpr1 = aTemp1;
- }
- if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_VALUE2 ) )
- {
- OUString aTemp2 = pItem->GetValue();
- if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
+ if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_VALUE2 ) )
{
- sal_uInt32 nNumIndex = 0;
- double nVal;
- if (rDoc.GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
- aExpr2 = ::rtl::math::doubleToUString( nVal,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- ScGlobal::getLocaleData().getNumDecimalSep()[0], true);
- else
- aExpr2 = aTemp2;
- if ( eMode == SC_VALID_TIME ) {
- sal_Int32 wraparound = aExpr1.compareTo(aExpr2);
- if (wraparound > 0) {
- if (eOper == ScConditionMode::Between) {
- eOper = ScConditionMode::NotBetween;
- std::swap( aExpr1, aExpr2 );
- }
- else if (eOper == ScConditionMode::NotBetween) {
- eOper = ScConditionMode::Between;
- std::swap( aExpr1, aExpr2 );
+ OUString aTemp2 = pItem->GetValue();
+ if (xAuxData->eMode == SC_VALID_DATE || xAuxData->eMode == SC_VALID_TIME)
+ {
+ sal_uInt32 nNumIndex = 0;
+ double nVal;
+ if (rDoc.GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
+ xAuxData->aExpr2 = ::rtl::math::doubleToUString( nVal,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ ScGlobal::getLocaleData().getNumDecimalSep()[0], true);
+ else
+ xAuxData->aExpr2 = aTemp2;
+ if ( xAuxData->eMode == SC_VALID_TIME ) {
+ sal_Int32 wraparound = xAuxData->aExpr1.compareTo(xAuxData->aExpr2);
+ if (wraparound > 0) {
+ if (xAuxData->eOper == ScConditionMode::Between) {
+ xAuxData->eOper = ScConditionMode::NotBetween;
+ std::swap( xAuxData->aExpr1, xAuxData->aExpr2 );
+ }
+ else if (xAuxData->eOper == ScConditionMode::NotBetween) {
+ xAuxData->eOper = ScConditionMode::Between;
+ std::swap( xAuxData->aExpr1, xAuxData->aExpr2 );
+ }
}
}
}
+ else
+ xAuxData->aExpr2 = aTemp2;
}
- else
- aExpr2 = aTemp2;
+ if ( const SfxBoolItem* pItem = pOutSet->GetItemIfSet( FID_VALID_BLANK ) )
+ xAuxData->bBlank = pItem->GetValue();
+ if ( const SfxBoolItem* pItem = pOutSet->GetItemIfSet( FID_VALID_CASESENS ) )
+ xAuxData->bCaseSensitive = pItem->GetValue();
+ if ( const SfxInt16Item* pItem = pOutSet->GetItemIfSet( FID_VALID_LISTTYPE ) )
+ xAuxData->nListType = pItem->GetValue();
+
+ if ( const SfxBoolItem* pItem = pOutSet->GetItemIfSet( FID_VALID_SHOWHELP ) )
+ xAuxData->bShowHelp = pItem->GetValue();
+ if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_HELPTITLE ) )
+ xAuxData->aHelpTitle = pItem->GetValue();
+ if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_HELPTEXT ) )
+ xAuxData->aHelpText = pItem->GetValue();
+
+ if ( const SfxBoolItem* pItem = pOutSet->GetItemIfSet( FID_VALID_SHOWERR ) )
+ xAuxData->bShowError = pItem->GetValue();
+ if ( const SfxUInt16Item* pItem = pOutSet->GetItemIfSet( FID_VALID_ERRSTYLE ) )
+ xAuxData->eErrStyle = static_cast<ScValidErrorStyle>(pItem->GetValue());
+ if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_ERRTITLE ) )
+ xAuxData->aErrTitle = pItem->GetValue();
+ if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_ERRTEXT ) )
+ xAuxData->aErrText = pItem->GetValue();
+
+ ScValidationData aData( xAuxData->eMode, xAuxData->eOper, xAuxData->aExpr1, xAuxData->aExpr2, rDoc, xAuxData->aCursorPos );
+ aData.SetIgnoreBlank( xAuxData->bBlank );
+ aData.SetCaseSensitive( xAuxData->bCaseSensitive );
+ aData.SetListType( xAuxData->nListType );
+
+ aData.SetInput(xAuxData->aHelpTitle, xAuxData->aHelpText); // sets bShowInput to TRUE
+ if (!xAuxData->bShowHelp)
+ aData.ResetInput(); // reset only bShowInput
+
+ aData.SetError(xAuxData->aErrTitle, xAuxData->aErrText, xAuxData->eErrStyle); // sets bShowError to TRUE
+ if (!xAuxData->bShowError)
+ aData.ResetError(); // reset only bShowError
+
+ pTabViewShell->SetValidation( aData );
+ pTabViewShell->TestHintWindow();
+ xRequest->Done( *pOutSet );
}
- if ( const SfxBoolItem* pItem = pOutSet->GetItemIfSet( FID_VALID_BLANK ) )
- bBlank = pItem->GetValue();
- if ( const SfxBoolItem* pItem = pOutSet->GetItemIfSet( FID_VALID_CASESENS ) )
- bCaseSensitive = pItem->GetValue();
- if ( const SfxInt16Item* pItem = pOutSet->GetItemIfSet( FID_VALID_LISTTYPE ) )
- nListType = pItem->GetValue();
-
- if ( const SfxBoolItem* pItem = pOutSet->GetItemIfSet( FID_VALID_SHOWHELP ) )
- bShowHelp = pItem->GetValue();
- if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_HELPTITLE ) )
- aHelpTitle = pItem->GetValue();
- if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_HELPTEXT ) )
- aHelpText = pItem->GetValue();
-
- if ( const SfxBoolItem* pItem = pOutSet->GetItemIfSet( FID_VALID_SHOWERR ) )
- bShowError = pItem->GetValue();
- if ( const SfxUInt16Item* pItem = pOutSet->GetItemIfSet( FID_VALID_ERRSTYLE ) )
- eErrStyle = static_cast<ScValidErrorStyle>(pItem->GetValue());
- if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_ERRTITLE ) )
- aErrTitle = pItem->GetValue();
- if ( const SfxStringItem* pItem = pOutSet->GetItemIfSet( FID_VALID_ERRTEXT ) )
- aErrText = pItem->GetValue();
-
- ScValidationData aData( eMode, eOper, aExpr1, aExpr2, rDoc, aCursorPos );
- aData.SetIgnoreBlank( bBlank );
- aData.SetCaseSensitive( bCaseSensitive );
- aData.SetListType( nListType );
-
- aData.SetInput(aHelpTitle, aHelpText); // sets bShowInput to TRUE
- if (!bShowHelp)
- aData.ResetInput(); // reset only bShowInput
-
- aData.SetError(aErrTitle, aErrText, eErrStyle); // sets bShowError to TRUE
- if (!bShowError)
- aData.ResetError(); // reset only bShowError
-
- pTabViewShell->SetValidation( aData );
- pTabViewShell->TestHintWindow();
- rReq.Done( *pOutSet );
- }
+ else
+ {
+ pTabViewShell->TestHintWindow();
+ }
+ });
}
}
break;
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 875531b37924..b330c89e662c 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -310,6 +310,7 @@ void ScDBFunc::ToggleAutoFilter()
{
nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
rDoc.ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~ScMF::Auto ) );
+ aParam.RemoveAllEntriesByField(nCol);
}
// use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation
@@ -324,11 +325,6 @@ void ScDBFunc::ToggleAutoFilter()
pDBData->SetAutoFilter(false);
- // remove filter (incl. Paint / Undo)
-
- SCSIZE nEC = aParam.GetEntryCount();
- for (SCSIZE i=0; i<nEC; i++)
- aParam.GetEntry(i).bDoQuery = false;
aParam.bDuplicate = true;
Query( aParam, nullptr, true );
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index fff197680f86..1d766741cd99 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1485,9 +1485,8 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
const SfxPoolItem* pItem = nullptr;
if ( rNewSet.GetItemState( nWhich, true, &pItem ) == SfxItemState::SET && pItem )
{
- for ( const auto & rPair : rMap.getPropertyEntries())
+ for ( const auto pEntry : rMap.getPropertyEntries())
{
- const SfxItemPropertyMapEntry* pEntry = rPair.second;
if ( pEntry->nWID == nWhich )
{
css::uno::Any aVal;