sc/inc/textuno.hxx | 9 +++++---- sc/source/core/data/attarray.cxx | 9 +++++---- sc/source/ui/unoobj/fielduno.cxx | 9 ++++----- sc/source/ui/unoobj/textuno.cxx | 21 +++++++++------------ 4 files changed, 23 insertions(+), 25 deletions(-)
New commits: commit 5fdc026250c9d691730e2062a7b5e2d5a6a81575 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Sep 18 12:42:14 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Sep 19 08:00:56 2024 +0200 use more concrete UNO types in sc Change-Id: I5b70733fb5be0a4f9a51e48197454ff0452770bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173611 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx index e5ec1aca0cad..87faca864992 100644 --- a/sc/inc/textuno.hxx +++ b/sc/inc/textuno.hxx @@ -28,6 +28,7 @@ #include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/weakref.hxx> +#include <unotools/weakref.hxx> #include <rtl/ref.hxx> @@ -96,7 +97,7 @@ class ScHeaderFooterTextData { private: std::unique_ptr<EditTextObject> mpTextObj; - css::uno::WeakReference<css::sheet::XHeaderFooterContent> xContentObj; + unotools::WeakReference<ScHeaderFooterContentObj> xContentObj; ScHeaderFooterPart nPart; std::unique_ptr<ScEditEngineDefaulter> pEditEngine; std::unique_ptr<SvxEditEngineForwarder> pForwarder; @@ -106,7 +107,7 @@ public: ScHeaderFooterTextData(const ScHeaderFooterTextData&) = delete; const ScHeaderFooterTextData& operator=(const ScHeaderFooterTextData&) = delete; ScHeaderFooterTextData( - css::uno::WeakReference<css::sheet::XHeaderFooterContent> xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj); + unotools::WeakReference<ScHeaderFooterContentObj> xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj); ~ScHeaderFooterTextData(); // helper functions @@ -116,7 +117,7 @@ public: ScEditEngineDefaulter* GetEditEngine() { GetTextForwarder(); return pEditEngine.get(); } ScHeaderFooterPart GetPart() const { return nPart; } - css::uno::Reference<css::sheet::XHeaderFooterContent> GetContentObj() const { return xContentObj; } + rtl::Reference<ScHeaderFooterContentObj> GetContentObj() const { return xContentObj; } const EditTextObject* GetTextObject() const { return mpTextObj.get(); } }; @@ -142,7 +143,7 @@ private: public: ScHeaderFooterTextObj( - const css::uno::WeakReference<css::sheet::XHeaderFooterContent>& xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj); + const unotools::WeakReference<ScHeaderFooterContentObj>& xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj); virtual ~ScHeaderFooterTextObj() override; const EditTextObject* GetTextObject() const; diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index e14cfaa4cfcb..700cb97d4492 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -449,23 +449,22 @@ uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_In // Get the parent text range instance. uno::Reference<text::XTextRange> xTextRange; - uno::Reference<sheet::XHeaderFooterContent> xContentObj = mrData.GetContentObj(); + rtl::Reference<ScHeaderFooterContentObj> xContentObj = mrData.GetContentObj(); if (!xContentObj.is()) throw uno::RuntimeException(u""_ustr); - rtl::Reference<ScHeaderFooterContentObj> pContentObj = ScHeaderFooterContentObj::getImplementation(xContentObj); uno::Reference<text::XText> xText; switch ( mrData.GetPart() ) { case ScHeaderFooterPart::LEFT: - xText = pContentObj->getLeftText(); + xText = xContentObj->getLeftText(); break; case ScHeaderFooterPart::CENTER: - xText = pContentObj->getCenterText(); + xText = xContentObj->getCenterText(); break; case ScHeaderFooterPart::RIGHT: - xText = pContentObj->getRightText(); + xText = xContentObj->getRightText(); break; } diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 45deb7d9bb4a..30b67d411f9f 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -137,14 +137,13 @@ void ScHeaderFooterContentObj::Init( const EditTextObject* pLeft, const EditTextObject* pCenter, const EditTextObject* pRight ) { - uno::Reference<css::sheet::XHeaderFooterContent> xThis(this); - mxLeftText = rtl::Reference<ScHeaderFooterTextObj>(new ScHeaderFooterTextObj(xThis, ScHeaderFooterPart::LEFT, pLeft)); - mxCenterText = rtl::Reference<ScHeaderFooterTextObj>(new ScHeaderFooterTextObj(xThis, ScHeaderFooterPart::CENTER, pCenter)); - mxRightText = rtl::Reference<ScHeaderFooterTextObj>(new ScHeaderFooterTextObj(xThis, ScHeaderFooterPart::RIGHT, pRight)); + mxLeftText = rtl::Reference<ScHeaderFooterTextObj>(new ScHeaderFooterTextObj(this, ScHeaderFooterPart::LEFT, pLeft)); + mxCenterText = rtl::Reference<ScHeaderFooterTextObj>(new ScHeaderFooterTextObj(this, ScHeaderFooterPart::CENTER, pCenter)); + mxRightText = rtl::Reference<ScHeaderFooterTextObj>(new ScHeaderFooterTextObj(this, ScHeaderFooterPart::RIGHT, pRight)); } ScHeaderFooterTextData::ScHeaderFooterTextData( - uno::WeakReference<sheet::XHeaderFooterContent> xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj) : + unotools::WeakReference<ScHeaderFooterContentObj> xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj) : mpTextObj(pTextObj ? pTextObj->Clone() : nullptr), xContentObj(std::move( xContent )), nPart( nP ), @@ -233,7 +232,7 @@ void ScHeaderFooterTextData::UpdateData(EditEngine& rEditEngine) } ScHeaderFooterTextObj::ScHeaderFooterTextObj( - const uno::WeakReference<sheet::XHeaderFooterContent>& xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj) : + const unotools::WeakReference<ScHeaderFooterContentObj>& xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj) : aTextData(xContent, nP, pTextObj) { // ScHeaderFooterTextData acquires rContent @@ -299,23 +298,21 @@ OUString SAL_CALL ScHeaderFooterTextObj::getString() OUString aRet; const EditTextObject* pData; - uno::Reference<css::sheet::XHeaderFooterContent> xContentObj = aTextData.GetContentObj(); + rtl::Reference<ScHeaderFooterContentObj> xContentObj = aTextData.GetContentObj(); if (!xContentObj.is()) throw css::uno::RuntimeException( u"ScHeaderFooterTextObj::getString: no ContentObj"_ustr); - rtl::Reference<ScHeaderFooterContentObj> pObj = ScHeaderFooterContentObj::getImplementation(xContentObj); - switch ( aTextData.GetPart() ) { case ScHeaderFooterPart::LEFT: - pData = pObj->GetLeftEditObject(); + pData = xContentObj->GetLeftEditObject(); break; case ScHeaderFooterPart::CENTER: - pData = pObj->GetCenterEditObject(); + pData = xContentObj->GetCenterEditObject(); break; case ScHeaderFooterPart::RIGHT: - pData = pObj->GetRightEditObject(); + pData = xContentObj->GetRightEditObject(); break; default: SAL_WARN("sc.ui","unexpected enum value of ScHeaderFooterPart"); commit c629d8322d89e6c318a772f74a7be5370f830bef Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Sep 18 10:07:47 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Sep 19 08:00:47 2024 +0200 pull some code out of hot loop Change-Id: Ic19888296d1a7be7c691714b0353f18a1ea074f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173591 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 9f1e37913514..94b9153b1c41 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -2400,10 +2400,11 @@ void ScAttrArray::CopyArea( SCROW nDestEnd = std::min(static_cast<tools::Long>(static_cast<tools::Long>(nEndRow) + nDy), tools::Long(rDocument.MaxRow())); const bool bSameCellAttributeHelper(&rDocument.getCellAttributeHelper() == &rAttrArray.rDocument.getCellAttributeHelper()); + const ScPatternAttr* pSourceDefaultPattern = &rDocument.getCellAttributeHelper().getDefaultCellAttribute(); + const ScPatternAttr* pDestDefaultPattern = &rAttrArray.rDocument.getCellAttributeHelper().getDefaultCellAttribute(); if ( mvData.empty() ) { - const ScPatternAttr* pNewPattern = &rAttrArray.rDocument.getCellAttributeHelper().getDefaultCellAttribute(); - rAttrArray.SetPatternArea(nDestStart, nDestEnd, pNewPattern); + rAttrArray.SetPatternArea(nDestStart, nDestEnd, pDestDefaultPattern); return; } @@ -2414,10 +2415,10 @@ void ScAttrArray::CopyArea( const ScPatternAttr* pOldPattern = mvData[i].getScPatternAttr(); CellAttributeHolder aNewPattern; - if (ScPatternAttr::areSame(&rDocument.getCellAttributeHelper().getDefaultCellAttribute(), pOldPattern )) + if (ScPatternAttr::areSame(pSourceDefaultPattern, pOldPattern )) { // default: nothing changed - aNewPattern.setScPatternAttr(&rAttrArray.rDocument.getCellAttributeHelper().getDefaultCellAttribute()); + aNewPattern.setScPatternAttr(pDestDefaultPattern); } else if ( nStripFlags != ScMF::NONE ) {