diff options
Diffstat (limited to 'sc/source')
32 files changed, 189 insertions, 165 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index fdff19415a48..413094f44adb 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1001,11 +1001,13 @@ bool RequiresFixedFormula(ScConditionMode eMode) return false; } -OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, std::string_view rText) +OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, const OString& rText) { OStringBuffer aBuffer; XclXmlUtils::ToOString(aBuffer, rAddress); OString aPos = aBuffer.makeStringAndClear(); + // double quotes in rText need to be escaped + const OString aText = rText.replaceAll("\""_ostr, "\"\""_ostr); switch (eMode) { case ScConditionMode::Error: @@ -1013,13 +1015,13 @@ OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, std::s case ScConditionMode::NoError: return OString("NOT(ISERROR(" + aPos + "))") ; case ScConditionMode::BeginsWith: - return OString("LEFT(" + aPos + ",LEN(\"" + rText + "\"))=\"" + rText + "\""); + return OString("LEFT(" + aPos + ",LEN(\"" + aText + "\"))=\"" + aText + "\""); case ScConditionMode::EndsWith: - return OString("RIGHT(" + aPos +",LEN(\"" + rText + "\"))=\"" + rText + "\""); + return OString("RIGHT(" + aPos +",LEN(\"" + aText + "\"))=\"" + aText + "\""); case ScConditionMode::ContainsText: - return OString(OString::Concat("NOT(ISERROR(SEARCH(\"") + rText + "\"," + aPos + ")))"); + return OString(OString::Concat("NOT(ISERROR(SEARCH(\"") + aText + "\"," + aPos + ")))"); case ScConditionMode::NotContainsText: - return OString(OString::Concat("ISERROR(SEARCH(\"") + rText + "\"," + aPos + "))"); + return OString(OString::Concat("ISERROR(SEARCH(\"") + aText + "\"," + aPos + "))"); default: break; } diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 35288daa99fc..8ac122e33509 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -147,7 +147,7 @@ void SAL_CALL ScAccessibleCell::grabFocus( ) } } -AbsoluteScreenPixelRectangle ScAccessibleCell::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleCell::GetBoundingBoxOnScreen() { AbsoluteScreenPixelRectangle aCellRect(GetBoundingBox()); if (mpViewShell) @@ -162,7 +162,7 @@ AbsoluteScreenPixelRectangle ScAccessibleCell::GetBoundingBoxOnScreen() const return aCellRect; } -tools::Rectangle ScAccessibleCell::GetBoundingBox() const +tools::Rectangle ScAccessibleCell::GetBoundingBox() { tools::Rectangle aCellRect; if (mpViewShell) diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index d1bd67a7686e..ea3ddbf2da1f 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -1930,7 +1930,7 @@ uno::Sequence<sal_Int8> SAL_CALL ///===== IAccessibleViewForwarder ======================================== -tools::Rectangle ScAccessibleDocument::GetVisibleArea_Impl() const +tools::Rectangle ScAccessibleDocument::GetVisibleArea_Impl() { tools::Rectangle aVisRect(GetBoundingBox()); @@ -2008,7 +2008,7 @@ OUString return sName; } -AbsoluteScreenPixelRectangle ScAccessibleDocument::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleDocument::GetBoundingBoxOnScreen() { AbsoluteScreenPixelRectangle aRect; if (mpViewShell) @@ -2020,7 +2020,7 @@ AbsoluteScreenPixelRectangle ScAccessibleDocument::GetBoundingBoxOnScreen() cons return aRect; } -tools::Rectangle ScAccessibleDocument::GetBoundingBox() const +tools::Rectangle ScAccessibleDocument::GetBoundingBox() { tools::Rectangle aRect; if (mpViewShell) diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index 5b3248ba079b..32f74e8bd240 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -1456,7 +1456,7 @@ OUString ScAccessibleDocumentPagePreview::createAccessibleName() return sName; } -AbsoluteScreenPixelRectangle ScAccessibleDocumentPagePreview::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleDocumentPagePreview::GetBoundingBoxOnScreen() { AbsoluteScreenPixelRectangle aRect; if (mpViewShell) @@ -1468,7 +1468,7 @@ AbsoluteScreenPixelRectangle ScAccessibleDocumentPagePreview::GetBoundingBoxOnSc return aRect; } -tools::Rectangle ScAccessibleDocumentPagePreview::GetBoundingBox() const +tools::Rectangle ScAccessibleDocumentPagePreview::GetBoundingBox() { tools::Rectangle aRect; if (mpViewShell) diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx index cccae7991bf8..116aa043c329 100644 --- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx +++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx @@ -183,7 +183,7 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleEditObject::getAccessibleAtPo return xRet; } -AbsoluteScreenPixelRectangle ScAccessibleEditObject::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleEditObject::GetBoundingBoxOnScreen() { AbsoluteScreenPixelRectangle aScreenBounds; @@ -211,7 +211,7 @@ AbsoluteScreenPixelRectangle ScAccessibleEditObject::GetBoundingBoxOnScreen() co return aScreenBounds; } -tools::Rectangle ScAccessibleEditObject::GetBoundingBox() const +tools::Rectangle ScAccessibleEditObject::GetBoundingBox() { tools::Rectangle aBounds( GetBoundingBoxOnScreen() ); @@ -531,7 +531,7 @@ uno::Reference< XAccessibleRelationSet > ScAccessibleEditObject::getAccessibleRe return uno::Reference< XAccessibleRelationSet >(); } -AbsoluteScreenPixelRectangle ScAccessibleEditControlObject::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleEditControlObject::GetBoundingBoxOnScreen() { AbsoluteScreenPixelRectangle aScreenBounds; @@ -544,11 +544,11 @@ AbsoluteScreenPixelRectangle ScAccessibleEditControlObject::GetBoundingBoxOnScre return aScreenBounds; } -tools::Rectangle ScAccessibleEditControlObject::GetBoundingBox() const +tools::Rectangle ScAccessibleEditControlObject::GetBoundingBox() { tools::Rectangle aBounds( GetBoundingBoxOnScreen() ); - uno::Reference< XAccessibleContext > xContext(const_cast<ScAccessibleEditControlObject*>(this)->getAccessibleContext()); + uno::Reference<XAccessibleContext> xContext = getAccessibleContext(); if ( xContext.is() ) { uno::Reference< XAccessible > xParent( xContext->getAccessibleParent() ); diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx index beb373429475..70947036669d 100644 --- a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx +++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx @@ -290,7 +290,7 @@ OUString ScAccessiblePageHeader::createAccessibleName() return sName.replaceFirst("%1", ScResId(SCSTR_UNKNOWN)); } -AbsoluteScreenPixelRectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() { tools::Rectangle aCellRect(GetBoundingBox()); if (mpViewShell) @@ -305,7 +305,7 @@ AbsoluteScreenPixelRectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() co return AbsoluteScreenPixelRectangle(aCellRect); } -tools::Rectangle ScAccessiblePageHeader::GetBoundingBox() const +tools::Rectangle ScAccessiblePageHeader::GetBoundingBox() { tools::Rectangle aRect; if (mpViewShell) diff --git a/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx b/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx index c807a01661dd..cde9d59a6550 100644 --- a/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx +++ b/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx @@ -219,7 +219,7 @@ OUString ScAccessiblePageHeaderArea::createAccessibleName() return sName; } -AbsoluteScreenPixelRectangle ScAccessiblePageHeaderArea::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePageHeaderArea::GetBoundingBoxOnScreen() { AbsoluteScreenPixelRectangle aRect; if (mxParent.is()) @@ -239,7 +239,7 @@ AbsoluteScreenPixelRectangle ScAccessiblePageHeaderArea::GetBoundingBoxOnScreen( return aRect; } -tools::Rectangle ScAccessiblePageHeaderArea::GetBoundingBox() const +tools::Rectangle ScAccessiblePageHeaderArea::GetBoundingBox() { tools::Rectangle aRect; if (mxParent.is()) diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx index 469ecab7ca85..12b553ea56b0 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx @@ -191,7 +191,7 @@ uno::Sequence<sal_Int8> SAL_CALL //==== internal ========================================================= -AbsoluteScreenPixelRectangle ScAccessiblePreviewCell::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePreviewCell::GetBoundingBoxOnScreen() { tools::Rectangle aCellRect; if (mpViewShell) @@ -207,13 +207,13 @@ AbsoluteScreenPixelRectangle ScAccessiblePreviewCell::GetBoundingBoxOnScreen() c return AbsoluteScreenPixelRectangle(aCellRect); } -tools::Rectangle ScAccessiblePreviewCell::GetBoundingBox() const +tools::Rectangle ScAccessiblePreviewCell::GetBoundingBox() { tools::Rectangle aCellRect; if (mpViewShell) { mpViewShell->GetLocationData().GetCellPosition( maCellAddress, aCellRect ); - uno::Reference<XAccessible> xAccParent = const_cast<ScAccessiblePreviewCell*>(this)->getAccessibleParent(); + uno::Reference<XAccessible> xAccParent = getAccessibleParent(); if (xAccParent.is()) { uno::Reference<XAccessibleContext> xAccParentContext = xAccParent->getAccessibleContext(); diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx index 843e61f611e1..41128a36d0ed 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx @@ -283,7 +283,7 @@ uno::Sequence<sal_Int8> SAL_CALL //==== internal ========================================================= -AbsoluteScreenPixelRectangle ScAccessiblePreviewHeaderCell::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePreviewHeaderCell::GetBoundingBoxOnScreen() { tools::Rectangle aCellRect; @@ -309,7 +309,7 @@ AbsoluteScreenPixelRectangle ScAccessiblePreviewHeaderCell::GetBoundingBoxOnScre return AbsoluteScreenPixelRectangle(aCellRect); } -tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBox() const +tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBox() { FillTableInfo(); @@ -319,7 +319,7 @@ tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBox() const const ScPreviewColRowInfo& rRowInfo = mpTableInfo->GetRowInfo()[maCellPos.Row()]; tools::Rectangle aCellRect( rColInfo.nPixelStart, rRowInfo.nPixelStart, rColInfo.nPixelEnd, rRowInfo.nPixelEnd ); - uno::Reference<XAccessible> xAccParent = const_cast<ScAccessiblePreviewHeaderCell*>(this)->getAccessibleParent(); + uno::Reference<XAccessible> xAccParent = getAccessibleParent(); if (xAccParent.is()) { uno::Reference<XAccessibleContext> xAccParentContext = xAccParent->getAccessibleContext(); diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx index f1c788646736..30acfbbd086e 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx @@ -574,7 +574,7 @@ OUString ScAccessiblePreviewTable::createAccessibleName() return sName; } -AbsoluteScreenPixelRectangle ScAccessiblePreviewTable::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePreviewTable::GetBoundingBoxOnScreen() { tools::Rectangle aCellRect(GetBoundingBox()); if (mpViewShell) @@ -589,7 +589,7 @@ AbsoluteScreenPixelRectangle ScAccessiblePreviewTable::GetBoundingBoxOnScreen() return AbsoluteScreenPixelRectangle(aCellRect); } -tools::Rectangle ScAccessiblePreviewTable::GetBoundingBox() const +tools::Rectangle ScAccessiblePreviewTable::GetBoundingBox() { FillTableInfo(); diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index b3198242eaf1..3e00f653cd5a 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -1318,7 +1318,7 @@ uno::Sequence<sal_Int8> SAL_CALL //==== internal ========================================================= -AbsoluteScreenPixelRectangle ScAccessibleSpreadsheet::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleSpreadsheet::GetBoundingBoxOnScreen() { AbsoluteScreenPixelRectangle aRect; if (mpViewShell) @@ -1330,7 +1330,7 @@ AbsoluteScreenPixelRectangle ScAccessibleSpreadsheet::GetBoundingBoxOnScreen() c return aRect; } -tools::Rectangle ScAccessibleSpreadsheet::GetBoundingBox() const +tools::Rectangle ScAccessibleSpreadsheet::GetBoundingBox() { tools::Rectangle aRect; if (mpViewShell) diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 8867a952be19..a0e113fc2457 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -375,9 +375,9 @@ public: } VclPtr<AbstractScInsertCellDlg> ScAbstractDialogFactory_Impl::CreateScInsertCellDlg(weld::Window* pParent, - bool bDisallowCellMove) + ScViewData& rViewData, bool bDisallowCellMove) { - return VclPtr<AbstractScInsertCellDlg_Impl>::Create(pParent, bDisallowCellMove); + return VclPtr<AbstractScInsertCellDlg_Impl>::Create(pParent, rViewData, bDisallowCellMove); } namespace diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index c5083fbbb632..3e246df150d1 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -74,6 +74,7 @@ public: virtual VclPtr<AbstractScGroupDlg> CreateAbstractScGroupDlg(weld::Window* pParent, bool bUnGroup = false) override; virtual VclPtr<AbstractScInsertCellDlg> CreateScInsertCellDlg(weld::Window* pParent, + ScViewData& rViewData, bool bDisallowCellMove) override; virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent, diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index cff0de599843..23aa5dcf3a79 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -1216,25 +1216,28 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell ) if ( aFinder.Find() ) { ScConflictsListHelper::TransformConflictsList( aConflictsList, nullptr, &aOwnInverseMergeMap ); - bool bLoop = true; - while ( bLoop ) + if (ScViewData* pViewData = GetViewData()) { - bLoop = false; - weld::Window* pWin = GetActiveDialogParent(); - ScConflictsDlg aDlg(pWin, GetViewData(), &rSharedDoc, aConflictsList); - if (aDlg.run() == RET_CANCEL) + bool bLoop = true; + while ( bLoop ) { - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin, - VclMessageType::Question, VclButtonsType::YesNo, - ScResId(STR_DOC_WILLNOTBESAVED))); - xQueryBox->set_default_response(RET_YES); - if (xQueryBox->run() == RET_YES) + bLoop = false; + weld::Window* pWin = GetActiveDialogParent(); + ScConflictsDlg aDlg(pWin, *pViewData, rSharedDoc, aConflictsList); + if (aDlg.run() == RET_CANCEL) { - return false; - } - else - { - bLoop = true; + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin, + VclMessageType::Question, VclButtonsType::YesNo, + ScResId(STR_DOC_WILLNOTBESAVED))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_YES) + { + return false; + } + else + { + bLoop = true; + } } } } diff --git a/sc/source/ui/inc/AccessibleCell.hxx b/sc/source/ui/inc/AccessibleCell.hxx index 69764db893b5..0df06614d38f 100644 --- a/sc/source/ui/inc/AccessibleCell.hxx +++ b/sc/source/ui/inc/AccessibleCell.hxx @@ -91,10 +91,10 @@ public: protected: /// Return the object's current bounding box relative to the desktop. - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; /// Return the object's current bounding box relative to the parent object. - virtual tools::Rectangle GetBoundingBox() const override; + virtual tools::Rectangle GetBoundingBox() override; public: ///===== XAccessibleContext ============================================== diff --git a/sc/source/ui/inc/AccessibleContextBase.hxx b/sc/source/ui/inc/AccessibleContextBase.hxx index 526727e4a242..db795a0bc122 100644 --- a/sc/source/ui/inc/AccessibleContextBase.hxx +++ b/sc/source/ui/inc/AccessibleContextBase.hxx @@ -147,12 +147,12 @@ protected: /// Return the object's current bounding box relative to the desktop. /// /// @throws css::uno::RuntimeException - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const = 0; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() = 0; /// Return the object's current bounding box relative to the parent object. /// /// @throws css::uno::RuntimeException - virtual tools::Rectangle GetBoundingBox() const = 0; + virtual tools::Rectangle GetBoundingBox() = 0; public: /// Calls all listeners to notify them about the change. diff --git a/sc/source/ui/inc/AccessibleDocument.hxx b/sc/source/ui/inc/AccessibleDocument.hxx index 7ef7882efa79..707724d31cb6 100644 --- a/sc/source/ui/inc/AccessibleDocument.hxx +++ b/sc/source/ui/inc/AccessibleDocument.hxx @@ -217,10 +217,10 @@ protected: createAccessibleName() override; /// Return the object's current bounding box relative to the desktop. - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; /// Return the object's current bounding box relative to the parent object. - virtual tools::Rectangle GetBoundingBox() const override; + virtual tools::Rectangle GetBoundingBox() override; private: ScTabViewShell* mpViewShell; @@ -248,7 +248,7 @@ private: OUString GetCurrentCellName() const; static const OUString & GetCurrentCellDescription(); - tools::Rectangle GetVisibleArea_Impl() const; + tools::Rectangle GetVisibleArea_Impl(); public: ScDocument *GetDocument() const ; ScAddress GetCurCellAddress() const; diff --git a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx index 956825a2dc20..8b5284e52bd7 100644 --- a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx +++ b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx @@ -106,11 +106,11 @@ protected: public: // needed in ScShapeChildren /// Return the object's current bounding box relative to the desktop. - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; protected: /// Return the object's current bounding box relative to the parent object. - virtual tools::Rectangle GetBoundingBox() const override; + virtual tools::Rectangle GetBoundingBox() override; private: ScPreviewShell* mpViewShell; diff --git a/sc/source/ui/inc/AccessibleEditObject.hxx b/sc/source/ui/inc/AccessibleEditObject.hxx index 159fa2eeb77e..451d28ee71ab 100644 --- a/sc/source/ui/inc/AccessibleEditObject.hxx +++ b/sc/source/ui/inc/AccessibleEditObject.hxx @@ -94,10 +94,10 @@ public: protected: /// Return the object's current bounding box relative to the desktop. - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; /// Return the object's current bounding box relative to the parent object. - virtual tools::Rectangle GetBoundingBox() const override; + virtual tools::Rectangle GetBoundingBox() override; public: ///===== XAccessibleContext ============================================== @@ -198,10 +198,10 @@ private: protected: /// Return the object's current bounding box relative to the desktop. - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; /// Return the object's current bounding box relative to the parent object. - virtual tools::Rectangle GetBoundingBox() const override; + virtual tools::Rectangle GetBoundingBox() override; public: ScAccessibleEditControlObject(weld::CustomWidgetController* pController, EditObjectType eObjectType) diff --git a/sc/source/ui/inc/AccessiblePageHeader.hxx b/sc/source/ui/inc/AccessiblePageHeader.hxx index d08db8dacdb7..ddba68248cb5 100644 --- a/sc/source/ui/inc/AccessiblePageHeader.hxx +++ b/sc/source/ui/inc/AccessiblePageHeader.hxx @@ -69,8 +69,8 @@ protected: virtual OUString createAccessibleDescription() override; virtual OUString createAccessibleName() override; - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; - virtual tools::Rectangle GetBoundingBox() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; + virtual tools::Rectangle GetBoundingBox() override; private: ScPreviewShell* mpViewShell; diff --git a/sc/source/ui/inc/AccessiblePageHeaderArea.hxx b/sc/source/ui/inc/AccessiblePageHeaderArea.hxx index a1e813ec67e0..75d1b12b46c6 100644 --- a/sc/source/ui/inc/AccessiblePageHeaderArea.hxx +++ b/sc/source/ui/inc/AccessiblePageHeaderArea.hxx @@ -97,8 +97,8 @@ protected: virtual OUString createAccessibleDescription() override; virtual OUString createAccessibleName() override; - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; - virtual tools::Rectangle GetBoundingBox() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; + virtual tools::Rectangle GetBoundingBox() override; private: std::unique_ptr<EditTextObject> mpEditObj; diff --git a/sc/source/ui/inc/AccessiblePreviewCell.hxx b/sc/source/ui/inc/AccessiblePreviewCell.hxx index b40b65242df3..9c128c844f4b 100644 --- a/sc/source/ui/inc/AccessiblePreviewCell.hxx +++ b/sc/source/ui/inc/AccessiblePreviewCell.hxx @@ -77,8 +77,8 @@ public: getImplementationId() override; protected: - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; - virtual tools::Rectangle GetBoundingBox() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; + virtual tools::Rectangle GetBoundingBox() override; private: ScPreviewShell* mpViewShell; diff --git a/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx b/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx index f3317b41331b..01b1171120cd 100644 --- a/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx +++ b/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx @@ -107,8 +107,8 @@ protected: virtual OUString createAccessibleDescription() override; virtual OUString createAccessibleName() override; - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; - virtual tools::Rectangle GetBoundingBox() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; + virtual tools::Rectangle GetBoundingBox() override; private: ScPreviewShell* mpViewShell; diff --git a/sc/source/ui/inc/AccessiblePreviewTable.hxx b/sc/source/ui/inc/AccessiblePreviewTable.hxx index 34fa7a8d3643..49f9b5183c0a 100644 --- a/sc/source/ui/inc/AccessiblePreviewTable.hxx +++ b/sc/source/ui/inc/AccessiblePreviewTable.hxx @@ -116,8 +116,8 @@ protected: virtual OUString createAccessibleDescription() override; virtual OUString createAccessibleName() override; - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; - virtual tools::Rectangle GetBoundingBox() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; + virtual tools::Rectangle GetBoundingBox() override; private: ScPreviewShell* mpViewShell; diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx index d1d906dda622..7a966905331d 100644 --- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx +++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx @@ -206,10 +206,10 @@ private: virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) override; /// Return the object's current bounding box relative to the desktop. - virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() override; /// Return the object's current bounding box relative to the parent object. - virtual tools::Rectangle GetBoundingBox() const override; + virtual tools::Rectangle GetBoundingBox() override; bool IsDefunc(sal_Int64 nParentStates); bool IsEditable(); diff --git a/sc/source/ui/inc/conflictsdlg.hxx b/sc/source/ui/inc/conflictsdlg.hxx index f0ab643e0533..2c2c0c6d576b 100644 --- a/sc/source/ui/inc/conflictsdlg.hxx +++ b/sc/source/ui/inc/conflictsdlg.hxx @@ -107,11 +107,9 @@ class ScConflictsDlg : public weld::GenericDialogController private: OUString maStrUnknownUser; - ScViewData* const mpViewData; - ScDocument* mpOwnDoc; - ScChangeTrack* mpOwnTrack; - ScDocument* const mpSharedDoc; - ScChangeTrack* mpSharedTrack; + ScViewData& mrViewData; + ScDocument& mrOwnDoc; + ScDocument& mrSharedDoc; ScConflictsList& mrConflictsList; Idle maSelectionIdle; @@ -124,7 +122,7 @@ private: std::unique_ptr<SvxRedlinTable> m_xLbConflicts; OUString GetConflictString( const ScConflictsListEntry& rConflictEntry ); - void SetActionString(const ScChangeAction* pAction, ScDocument* pDoc, const weld::TreeIter& rEntry); + void SetActionString(ScChangeAction& rAction, ScDocument& rDoc, const weld::TreeIter& rEntry); void HandleListBoxSelection(); void SetConflictAction(const weld::TreeIter& rRootEntry, ScConflictAction eConflictAction); @@ -139,7 +137,7 @@ private: DECL_LINK( KeepAllOthersHandle, weld::Button&, void ); public: - ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList); + ScConflictsDlg(weld::Window* pParent, ScViewData& rViewData, ScDocument& rSharedDoc, ScConflictsList& rConflictsList); virtual ~ScConflictsDlg() override; void UpdateView(); diff --git a/sc/source/ui/inc/inscldlg.hxx b/sc/source/ui/inc/inscldlg.hxx index c9de99edc2be..c8906ece36bc 100644 --- a/sc/source/ui/inc/inscldlg.hxx +++ b/sc/source/ui/inc/inscldlg.hxx @@ -22,6 +22,7 @@ #include <vcl/weld.hxx> #include <global.hxx> +#include "viewdata.hxx" class ScInsertCellDlg : public weld::GenericDialogController { @@ -38,7 +39,7 @@ private: static constexpr size_t MAX_INS_COLS = 4000; public: - ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove); + ScInsertCellDlg(weld::Window* pParent, ScViewData& rViewData, bool bDisallowCellMove); virtual ~ScInsertCellDlg() override; InsCellCmd GetInsCellCmd() const; diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index 524b887816da..f461995d1c9a 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -319,14 +319,12 @@ void ScConflictsResolver::HandleAction( ScChangeAction* pAction, bool bIsSharedA } -ScConflictsDlg::ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList) +ScConflictsDlg::ScConflictsDlg(weld::Window* pParent, ScViewData& rViewData, ScDocument& rSharedDoc, ScConflictsList& rConflictsList) : GenericDialogController(pParent, u"modules/scalc/ui/conflictsdialog.ui"_ustr, u"ConflictsDialog"_ustr) , maStrUnknownUser ( ScResId( STR_UNKNOWN_USER_CONFLICT ) ) - , mpViewData ( pViewData ) - , mpOwnDoc ( nullptr ) - , mpOwnTrack ( nullptr ) - , mpSharedDoc ( pSharedDoc ) - , mpSharedTrack ( nullptr ) + , mrViewData ( rViewData ) + , mrOwnDoc ( mrViewData.GetDocument() ) + , mrSharedDoc ( rSharedDoc ) , mrConflictsList ( rConflictsList ) , maSelectionIdle ( "ScConflictsDlg maSelectionIdle" ) , mbInSelectHdl ( false ) @@ -337,14 +335,6 @@ ScConflictsDlg::ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScD , m_xLbConflicts(new SvxRedlinTable(m_xBuilder->weld_tree_view(u"container"_ustr), nullptr, nullptr)) { - OSL_ENSURE( mpViewData, "ScConflictsDlg CTOR: mpViewData is null!" ); - mpOwnDoc = ( mpViewData ? &mpViewData->GetDocument() : nullptr ); - OSL_ENSURE( mpOwnDoc, "ScConflictsDlg CTOR: mpOwnDoc is null!" ); - mpOwnTrack = ( mpOwnDoc ? mpOwnDoc->GetChangeTrack() : nullptr ); - OSL_ENSURE( mpOwnTrack, "ScConflictsDlg CTOR: mpOwnTrack is null!" ); - OSL_ENSURE( mpSharedDoc, "ScConflictsDlg CTOR: mpSharedDoc is null!" ); - mpSharedTrack = ( mpSharedDoc ? mpSharedDoc->GetChangeTrack() : nullptr ); - OSL_ENSURE( mpSharedTrack, "ScConflictsDlg CTOR: mpSharedTrack is null!" ); weld::TreeView& rTreeView = m_xLbConflicts->GetWidget(); @@ -382,37 +372,33 @@ ScConflictsDlg::~ScConflictsDlg() OUString ScConflictsDlg::GetConflictString( const ScConflictsListEntry& rConflictEntry ) { OUString aString; - if ( mpOwnTrack ) + if ( ScChangeTrack* pOwnTrack = mrOwnDoc.GetChangeTrack() ) { - const ScChangeAction* pAction = mpOwnTrack->GetAction( rConflictEntry.maOwnActions[ 0 ] ); - if ( pAction && mpOwnDoc ) + const ScChangeAction* pAction = pOwnTrack->GetAction( rConflictEntry.maOwnActions[ 0 ] ); + if ( pAction ) { - SCTAB nTab = pAction->GetBigRange().MakeRange( *mpOwnDoc ).aStart.Tab(); - mpOwnDoc->GetName( nTab, aString ); + SCTAB nTab = pAction->GetBigRange().MakeRange( mrOwnDoc ).aStart.Tab(); + mrOwnDoc.GetName( nTab, aString ); } } return aString; } -void ScConflictsDlg::SetActionString(const ScChangeAction* pAction, ScDocument* pDoc, const weld::TreeIter& rEntry) +void ScConflictsDlg::SetActionString(ScChangeAction& rAction, ScDocument& rDoc, const weld::TreeIter& rEntry) { - OSL_ENSURE( pAction, "ScConflictsDlg::GetActionString(): pAction is null!" ); - OSL_ENSURE( pDoc, "ScConflictsDlg::GetActionString(): pDoc is null!" ); - if (!pAction || !pDoc) - return; weld::TreeView& rTreeView = m_xLbConflicts->GetWidget(); - OUString aDesc = pAction->GetDescription(*pDoc, true, false); + OUString aDesc = rAction.GetDescription(rDoc, true, false); rTreeView.set_text(rEntry, aDesc, 0); - OUString aUser = comphelper::string::strip(pAction->GetUser(), ' '); + OUString aUser = comphelper::string::strip(rAction.GetUser(), ' '); if ( aUser.isEmpty() ) { aUser = maStrUnknownUser; } rTreeView.set_text(rEntry, aUser, 1); - DateTime aDateTime = pAction->GetDateTime(); + DateTime aDateTime = rAction.GetDateTime(); OUString aString = ScGlobal::getLocaleData().getDate( aDateTime ) + " " + ScGlobal::getLocaleData().getTime( aDateTime, false ); rTreeView.set_text(rEntry, aString, 2); @@ -460,12 +446,7 @@ IMPL_LINK_NOARG(ScConflictsDlg, SelectHandle, weld::TreeView&, void) IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void) { - if ( !mpViewData || !mpOwnDoc ) - { - return; - } - - ScTabView* pTabView = mpViewData->GetView(); + ScTabView* pTabView = mrViewData.GetView(); pTabView->DoneBlockMode(); std::vector<const ScChangeAction*> aActions; @@ -492,10 +473,10 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void) for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i) { const ScBigRange& rBigRange = aActions[i]->GetBigRange(); - if (rBigRange.IsValid(*mpOwnDoc)) + if (rBigRange.IsValid(mrOwnDoc)) { bool bSetCursor = i == nCount - 1; - pTabView->MarkRange(rBigRange.MakeRange( *mpOwnDoc ), bSetCursor, bContMark); + pTabView->MarkRange(rBigRange.MakeRange( mrOwnDoc ), bSetCursor, bContMark); bContMark = true; } } @@ -595,44 +576,48 @@ void ScConflictsDlg::UpdateView() for ( const auto& aSharedAction : rConflictEntry.maSharedActions ) { - ScChangeAction* pAction = mpSharedTrack ? mpSharedTrack->GetAction(aSharedAction) : nullptr; - if ( pAction ) + if ( ScChangeTrack* pSharedTrack = mrSharedDoc.GetChangeTrack() ) { - // only display shared top content entries - if ( pAction->GetType() == SC_CAT_CONTENT ) + if (ScChangeAction* pAction = pSharedTrack->GetAction(aSharedAction)) { - ScChangeActionContent* pNextContent = dynamic_cast<ScChangeActionContent&>(*pAction).GetNextContent(); - if ( pNextContent && rConflictEntry.HasSharedAction( pNextContent->GetActionNumber() ) ) + // only display shared top content entries + if ( pAction->GetType() == SC_CAT_CONTENT ) { - continue; + ScChangeActionContent* pNextContent = dynamic_cast<ScChangeActionContent&>(*pAction).GetNextContent(); + if ( pNextContent && rConflictEntry.HasSharedAction( pNextContent->GetActionNumber() ) ) + { + continue; + } } - } - rTreeView.insert(xRootEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); - SetActionString(pAction, mpSharedDoc, *xEntry); + rTreeView.insert(xRootEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); + SetActionString(*pAction, mrSharedDoc, *xEntry); + } } } for ( const auto& aOwnAction : rConflictEntry.maOwnActions ) { - ScChangeAction* pAction = mpOwnTrack ? mpOwnTrack->GetAction(aOwnAction) : nullptr; - if ( pAction ) + if ( ScChangeTrack* pOwnTrack = mrOwnDoc.GetChangeTrack() ) { - // only display own top content entries - if ( pAction->GetType() == SC_CAT_CONTENT ) + if (ScChangeAction* pAction = pOwnTrack->GetAction(aOwnAction)) { - ScChangeActionContent* pNextContent = dynamic_cast<ScChangeActionContent&>(*pAction).GetNextContent(); - if ( pNextContent && rConflictEntry.HasOwnAction( pNextContent->GetActionNumber() ) ) + // only display own top content entries + if ( pAction->GetType() == SC_CAT_CONTENT ) { - continue; + ScChangeActionContent* pNextContent = dynamic_cast<ScChangeActionContent&>(*pAction).GetNextContent(); + if ( pNextContent && rConflictEntry.HasOwnAction( pNextContent->GetActionNumber() ) ) + { + continue; + } } - } - std::unique_ptr<RedlinData> pUserData(new RedlinData()); - pUserData->pData = static_cast< void* >( pAction ); - OUString aId(weld::toId(pUserData.release())); - rTreeView.insert(xRootEntry.get(), -1, nullptr, &aId, nullptr, nullptr, false, xEntry.get()); - SetActionString(pAction, mpOwnDoc, *xEntry); + std::unique_ptr<RedlinData> pUserData(new RedlinData()); + pUserData->pData = static_cast< void* >( pAction ); + OUString aId(weld::toId(pUserData.release())); + rTreeView.insert(xRootEntry.get(), -1, nullptr, &aId, nullptr, nullptr, false, xEntry.get()); + SetActionString(*pAction, mrOwnDoc, *xEntry); + } } } diff --git a/sc/source/ui/miscdlgs/inscldlg.cxx b/sc/source/ui/miscdlgs/inscldlg.cxx index 21ede36e8f3b..bf11574c3ded 100644 --- a/sc/source/ui/miscdlgs/inscldlg.cxx +++ b/sc/source/ui/miscdlgs/inscldlg.cxx @@ -26,7 +26,8 @@ static sal_uInt8 nInsItemChecked = 0; -ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove) +ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, ScViewData& rViewData, + bool bDisallowCellMove) : GenericDialogController(pParent, u"modules/scalc/ui/insertcells.ui"_ustr, u"InsertCellsDialog"_ustr) , m_xBtnCellsDown(m_xBuilder->weld_radio_button(u"down"_ustr)) @@ -36,8 +37,7 @@ ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove) , m_xNumberOfRows(m_xBuilder->weld_spin_button(u"number_of_rows"_ustr)) , m_xNumberOfCols(m_xBuilder->weld_spin_button(u"number_of_columns"_ustr)) { - const ScViewData* pViewData = ScDocShell::GetViewData(); - if (pViewData && pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo())) + if (rViewData.GetDocument().IsLayoutRTL(rViewData.GetTabNo())) m_xBtnCellsRight->set_label(ScResId(SCSTR_INSERT_RTL)); m_xNumberOfRows->set_range(1, MAX_INS_ROWS); @@ -96,7 +96,7 @@ ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove) } // if some cells are selected, then disable the SpinButtons - const bool bMarked = pViewData && pViewData->GetMarkData().IsMarked(); + const bool bMarked = rViewData.GetMarkData().IsMarked(); m_xNumberOfCols->set_sensitive(bColCount && !bMarked); m_xNumberOfRows->set_sensitive(bRowsCount && !bMarked); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a7818ad31b9e..b86f03e6df06 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1475,6 +1475,8 @@ const ScMarkData* ScCellRangesBase::GetMarkData() return pMarkData.get(); } +void ScCellRangesBase::AdjustUpdatedRanges(UpdateRefMode) {} + void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) { const SfxHintId nId = rHint.GetId(); @@ -1546,18 +1548,7 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) if ( aRanges.UpdateReference( pRefHint->GetMode(), &rDoc, pRefHint->GetRange(), pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() ) ) { - if ( pRefHint->GetMode() == URM_INSDEL - && aRanges.size() == 1 - && dynamic_cast<ScTableSheetObj*>(this) - ) - { - // #101755#; the range size of a sheet does not change - ScRange & rR = aRanges.front(); - rR.aStart.SetCol(0); - rR.aStart.SetRow(0); - rR.aEnd.SetCol(rDoc.MaxCol()); - rR.aEnd.SetRow(rDoc.MaxRow()); - } + AdjustUpdatedRanges(pRefHint->GetMode()); RefChanged(); // any change of the range address is broadcast to value (modify) listeners @@ -6392,6 +6383,17 @@ SCTAB ScTableSheetObj::GetTab_Impl() const return 0; } +void ScTableSheetObj::AdjustUpdatedRanges(UpdateRefMode mode) +{ + if (mode == URM_INSDEL) + { + ScRangeList& rRanges = AccessRanges(); + // #101755#, tdf#47479: the range of a sheet does not change + rRanges.RemoveAll(); + rRanges.push_back(GetRange()); + } +} + // former XSheet uno::Reference<table::XTableCharts> SAL_CALL ScTableSheetObj::getCharts() @@ -8195,6 +8197,17 @@ const SfxItemPropertyMap& ScTableColumnObj::GetItemPropertyMap() return pColPropSet->getPropertyMap(); } +void ScTableColumnObj::AdjustUpdatedRanges(UpdateRefMode mode) +{ + if (mode == URM_INSDEL) + { + ScRangeList& rRanges = AccessRanges(); + // tdf#47479: the range of a column does not change + rRanges.RemoveAll(); + rRanges.push_back(GetRange()); + } +} + ScTableRowObj::ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab) : ScCellRangeObj( pDocSh, ScRange(0,nRow,nTab, pDocSh->GetDocument().MaxCol(),nRow,nTab) ), pRowPropSet(lcl_GetRowPropertySet()) @@ -8344,6 +8357,17 @@ const SfxItemPropertyMap& ScTableRowObj::GetItemPropertyMap() return pRowPropSet->getPropertyMap(); } +void ScTableRowObj::AdjustUpdatedRanges(UpdateRefMode mode) +{ + if (mode == URM_INSDEL) + { + ScRangeList& rRanges = AccessRanges(); + // tdf#47479: the range of a row does not change + rRanges.RemoveAll(); + rRanges.push_back(GetRange()); + } +} + ScCellsObj::ScCellsObj(ScDocShell* pDocSh, ScRangeList aR) : pDocShell( pDocSh ), aRanges(std::move( aR )) diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 91a1143f2695..2c73556bac87 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -386,7 +386,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - VclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), bTheFlag)); + VclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), GetViewData(), bTheFlag)); pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){ if (nResult == RET_OK) { diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 68c4a9b736d6..380b9d0b0cc0 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -4384,16 +4384,27 @@ void ScViewData::OverrideWithLOKFreeze(ScSplitMode& eExHSplitMode, ScSplitMode& SCCOL& nExFixPosX, SCROW& nExFixPosY, tools::Long& nExHSplitPos, tools::Long& nExVSplitPos, SCTAB nForTab) const { - SCCOL nFreezeCol = mrDoc.GetLOKFreezeCol(nForTab); - SCROW nFreezeRow = mrDoc.GetLOKFreezeRow(nForTab); + // split mode to potentially use based on original: if it was split, use split mode to preserve that, otherwise use freeze + // whether there is actual split/freeze will depend on GetLOKFreezeCol/Row + const ScSplitMode aExSplitMode = (eExHSplitMode == SC_SPLIT_NORMAL || eExVSplitMode == SC_SPLIT_NORMAL) ? SC_SPLIT_NORMAL : SC_SPLIT_FIX; + + // initialize split modes and positions in case no split/freeze is set + eExHSplitMode = SC_SPLIT_NONE; + eExVSplitMode = SC_SPLIT_NONE; + nExFixPosX = 0; + nExFixPosY = 0; + nExHSplitPos = 0; + nExVSplitPos = 0; bool bConvertToScrPosX = false; bool bConvertToScrPosY = false; - if (nFreezeCol >= 0) + SCCOL nFreezeCol = mrDoc.GetLOKFreezeCol(nForTab); + SCROW nFreezeRow = mrDoc.GetLOKFreezeRow(nForTab); + + if (nFreezeCol > 0) { - if (eExHSplitMode == SC_SPLIT_NONE) - eExHSplitMode = SC_SPLIT_FIX; + eExHSplitMode = aExSplitMode; if (eExHSplitMode == SC_SPLIT_FIX) { @@ -4404,10 +4415,9 @@ void ScViewData::OverrideWithLOKFreeze(ScSplitMode& eExHSplitMode, ScSplitMode& bConvertToScrPosX = true; } - if (nFreezeRow >= 0) + if (nFreezeRow > 0) { - if (eExVSplitMode == SC_SPLIT_NONE) - eExVSplitMode = SC_SPLIT_FIX; + eExVSplitMode = aExSplitMode; if (eExVSplitMode == SC_SPLIT_FIX) { |