include/svx/svdoole2.hxx | 4 +- sd/source/core/sdpage.cxx | 8 ++-- sd/source/ui/table/TableDesignPane.cxx | 2 - sd/source/ui/table/TableDesignPane.hxx | 17 ++++++---- sd/source/ui/unoidl/unoobj.cxx | 2 - sd/source/ui/view/viewshe2.cxx | 2 - svx/source/svdraw/svdoole2.cxx | 53 +++++++++------------------------ svx/source/unodraw/unoshap4.cxx | 2 - vcl/source/outdev/map.cxx | 4 -- 9 files changed, 35 insertions(+), 59 deletions(-)
New commits: commit 6483d363d1d8418a8c6bcf99f304161bee48d579 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 7 17:06:12 2017 +0100 drop unnecessary GraphicObject Change-Id: Iadc741260b3c9f16248c817530b1630b22c626ee diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 402bf801b7d3..7f26842fa0b7 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -596,8 +596,6 @@ public: svt::EmbeddedObjectRef mxObjRef; std::unique_ptr<Graphic> mxGraphic; - // TODO/LATER: do we really need this pointer? - std::unique_ptr<GraphicObject> mxGraphicObject; OUString maProgName; OUString aPersistName; // name of object in persist SdrLightEmbeddedClient_Impl* pLightClient; // must be registered as client only using AddOwnLightClient() call @@ -647,7 +645,6 @@ public: ~SdrOle2ObjImpl() { mxGraphic.reset(); - mxGraphicObject.reset(); if (mxModifyListener.is()) { @@ -758,7 +755,6 @@ void SdrOle2Obj::SetGraphic(const Graphic& rGrf) { // only for setting a preview graphic mpImpl->mxGraphic.reset(new Graphic(rGrf)); - mpImpl->mxGraphicObject.reset(new GraphicObject(*mpImpl->mxGraphic)); SetChanged(); BroadcastObjectChange(); @@ -767,7 +763,6 @@ void SdrOle2Obj::SetGraphic(const Graphic& rGrf) void SdrOle2Obj::ClearGraphic() { mpImpl->mxGraphic.reset(); - mpImpl->mxGraphicObject.reset(); SetChanged(); BroadcastObjectChange(); @@ -1519,7 +1514,6 @@ SdrOle2Obj& SdrOle2Obj::assignFrom(const SdrOle2Obj& rObj) if (rOle2Obj.mpImpl->mxGraphic) { mpImpl->mxGraphic.reset(new Graphic(*rOle2Obj.mpImpl->mxGraphic)); - mpImpl->mxGraphicObject.reset(new GraphicObject(*mpImpl->mxGraphic)); } if( pModel && rObj.GetModel() && !IsEmptyPresObj() ) commit bd6efb29d7b588669a27a7132b357e692c571a60 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 7 17:05:12 2017 +0100 convert to use std::unique_ptr Change-Id: If675a1d506d30ea05c3b2113d114f416b2947466 diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 1ab690845bb2..402bf801b7d3 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -595,9 +595,9 @@ class SdrOle2ObjImpl public: svt::EmbeddedObjectRef mxObjRef; - Graphic* mpGraphic; + std::unique_ptr<Graphic> mxGraphic; // TODO/LATER: do we really need this pointer? - GraphicObject* mpGraphicObject; + std::unique_ptr<GraphicObject> mxGraphicObject; OUString maProgName; OUString aPersistName; // name of object in persist SdrLightEmbeddedClient_Impl* pLightClient; // must be registered as client only using AddOwnLightClient() call @@ -616,8 +616,6 @@ public: rtl::Reference<SvxUnoShapeModifyListener> mxModifyListener; explicit SdrOle2ObjImpl( bool bFrame ) : - mpGraphic(nullptr), - mpGraphicObject(nullptr), pLightClient (nullptr), mbFrame(bFrame), mbInDestruction(false), @@ -633,8 +631,6 @@ public: SdrOle2ObjImpl( bool bFrame, const svt::EmbeddedObjectRef& rObjRef ) : mxObjRef(rObjRef), - mpGraphic(nullptr), - mpGraphicObject(nullptr), pLightClient (nullptr), mbFrame(bFrame), mbInDestruction(false), @@ -650,8 +646,8 @@ public: ~SdrOle2ObjImpl() { - delete mpGraphic; - delete mpGraphicObject; + mxGraphic.reset(); + mxGraphicObject.reset(); if (mxModifyListener.is()) { @@ -761,16 +757,8 @@ bool SdrOle2Obj::isUiActive() const void SdrOle2Obj::SetGraphic(const Graphic& rGrf) { // only for setting a preview graphic - if (mpImpl->mpGraphic) - { - delete mpImpl->mpGraphic; - mpImpl->mpGraphic = nullptr; - delete mpImpl->mpGraphicObject; - mpImpl->mpGraphicObject = nullptr; - } - - mpImpl->mpGraphic = new Graphic(rGrf); - mpImpl->mpGraphicObject = new GraphicObject(*mpImpl->mpGraphic); + mpImpl->mxGraphic.reset(new Graphic(rGrf)); + mpImpl->mxGraphicObject.reset(new GraphicObject(*mpImpl->mxGraphic)); SetChanged(); BroadcastObjectChange(); @@ -778,13 +766,8 @@ void SdrOle2Obj::SetGraphic(const Graphic& rGrf) void SdrOle2Obj::ClearGraphic() { - if (mpImpl->mpGraphic) - { - delete mpImpl->mpGraphic; - mpImpl->mpGraphic = nullptr; - delete mpImpl->mpGraphicObject; - mpImpl->mpGraphicObject = nullptr; - } + mpImpl->mxGraphic.reset(); + mpImpl->mxGraphicObject.reset(); SetChanged(); BroadcastObjectChange(); @@ -1409,7 +1392,7 @@ void SdrOle2Obj::SetObjRef( const css::uno::Reference < css::embed::XEmbeddedObj if ( mpImpl->mxObjRef.is() ) { - DELETEZ(mpImpl->mpGraphic); + mpImpl->mxGraphic.reset(); if ( (mpImpl->mxObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) ) SetResizeProtect(true); @@ -1533,16 +1516,10 @@ SdrOle2Obj& SdrOle2Obj::assignFrom(const SdrOle2Obj& rObj) mpImpl->maProgName = rOle2Obj.mpImpl->maProgName; mpImpl->mbFrame = rOle2Obj.mpImpl->mbFrame; - if (rOle2Obj.mpImpl->mpGraphic) + if (rOle2Obj.mpImpl->mxGraphic) { - if (mpImpl->mpGraphic) - { - delete mpImpl->mpGraphic; - delete mpImpl->mpGraphicObject; - } - - mpImpl->mpGraphic = new Graphic(*rOle2Obj.mpImpl->mpGraphic); - mpImpl->mpGraphicObject = new GraphicObject(*mpImpl->mpGraphic); + mpImpl->mxGraphic.reset(new Graphic(*rOle2Obj.mpImpl->mxGraphic)); + mpImpl->mxGraphicObject.reset(new GraphicObject(*mpImpl->mxGraphic)); } if( pModel && rObj.GetModel() && !IsEmptyPresObj() ) @@ -1764,7 +1741,7 @@ const Graphic* SdrOle2Obj::GetGraphic() const { if ( mpImpl->mxObjRef.is() ) return mpImpl->mxObjRef.GetGraphic(); - return mpImpl->mpGraphic; + return mpImpl->mxGraphic.get(); } void SdrOle2Obj::GetNewReplacement() commit 0e99a36c695d6349c8096654ddad70f962f312d0 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 7 15:42:35 2017 +0100 split clear and set graphic Change-Id: I3e98e872574e9edbe97099e93d787cbbcced60dd diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx index fc9af9e3651a..80fb05ed1b9a 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -55,7 +55,6 @@ private: SVX_DLLPRIVATE void AddListeners_Impl(); SVX_DLLPRIVATE void RemoveListeners_Impl(); SVX_DLLPRIVATE void GetObjRef_Impl(); - SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf); // #i118485# helper added SVX_DLLPRIVATE SdrObject* createSdrGrafObjReplacement(bool bAddText) const; @@ -81,7 +80,8 @@ public: // An OLE graphic object can contain a StarView graphic, // which will be displayed if the OLE object is empty. - void SetGraphic(const Graphic* pGrf); + void SetGraphic(const Graphic& rGrf); + void ClearGraphic(); const Graphic* GetGraphic() const; void GetNewReplacement(); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 1395fe678ae1..d0220f6b631f 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -357,7 +357,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t pSdrObj = new SdrOle2Obj(); BitmapEx aBmpEx(BMP_PRESOBJ_OBJECT); Graphic aGraphic( aBmpEx ); - static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(&aGraphic); + static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(aGraphic); } break; @@ -367,7 +367,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarChart" ); BitmapEx aBmpEx(BMP_PRESOBJ_CHART); Graphic aGraphic( aBmpEx ); - static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(&aGraphic); + static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(aGraphic); } break; @@ -377,7 +377,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarOrg" ); BitmapEx aBmpEx(BMP_PRESOBJ_ORGCHART); Graphic aGraphic( aBmpEx ); - static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(&aGraphic); + static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(aGraphic); } break; @@ -388,7 +388,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarCalc" ); BitmapEx aBmpEx(BMP_PRESOBJ_TABLE); Graphic aGraphic( aBmpEx ); - static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(&aGraphic); + static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(aGraphic); } break; diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index da02589c0526..685bd6f5de1e 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -951,7 +951,7 @@ void SdXShape::SetEmptyPresObj(bool bEmpty) SdrOle2Obj* pOleObj = dynamic_cast< SdrOle2Obj* >( pObj ); if( pOleObj ) { - pOleObj->SetGraphic( nullptr ); + pOleObj->ClearGraphic(); } } } diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index c56e19ac138e..7d409d7021bf 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -779,7 +779,7 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) // OLE object is no longer empty pObj->SetEmptyPresObj(false); pObj->SetOutlinerParaObject(nullptr); - pObj->SetGraphic(nullptr); + pObj->ClearGraphic(); // the empty OLE object gets a new IPObj if (!aName.isEmpty()) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index b331d5d848d7..1ab690845bb2 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -758,8 +758,9 @@ bool SdrOle2Obj::isUiActive() const return mpImpl->mxObjRef.is() && embed::EmbedStates::UI_ACTIVE == mpImpl->mxObjRef->getCurrentState(); } -void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf) +void SdrOle2Obj::SetGraphic(const Graphic& rGrf) { + // only for setting a preview graphic if (mpImpl->mpGraphic) { delete mpImpl->mpGraphic; @@ -768,20 +769,25 @@ void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf) mpImpl->mpGraphicObject = nullptr; } - if (pGrf) - { - mpImpl->mpGraphic = new Graphic(*pGrf); - mpImpl->mpGraphicObject = new GraphicObject(*mpImpl->mpGraphic); - } + mpImpl->mpGraphic = new Graphic(rGrf); + mpImpl->mpGraphicObject = new GraphicObject(*mpImpl->mpGraphic); SetChanged(); BroadcastObjectChange(); } -void SdrOle2Obj::SetGraphic(const Graphic* pGrf) +void SdrOle2Obj::ClearGraphic() { - // only for setting a preview graphic - SetGraphic_Impl( pGrf ); + if (mpImpl->mpGraphic) + { + delete mpImpl->mpGraphic; + mpImpl->mpGraphic = nullptr; + delete mpImpl->mpGraphicObject; + mpImpl->mpGraphicObject = nullptr; + } + + SetChanged(); + BroadcastObjectChange(); } void SdrOle2Obj::SetProgName( const OUString& rName ) @@ -1896,7 +1902,7 @@ void SdrOle2Obj::GetObjRef_Impl() // perhaps preview not valid anymore // This line changes the modified state of the model - SetGraphic_Impl( nullptr ); + ClearGraphic(); // if status was not set before, force it back // to not set, so that SetGraphic(0L) above does not diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 46e76c35f9a8..59f39cbbb702 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -143,7 +143,7 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro if( rValue >>= aURL ) { GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) ); - static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &aGrafObj.GetGraphic() ); + static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic(aGrafObj.GetGraphic()); return true; } break; commit 274e3ec0c06e667868eca1b75193500ba92d7c14 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 7 16:09:36 2017 +0100 coverity#1399034 Unrecoverable parse warning emit.cpp:1472: assertion failure: emit-ast.cpp:1123: assertion failed: Ran out of fields in aggregate initializer have a guess as what it might be Change-Id: I0a93e2529c7d03e837e269f0903038b160540c84 diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 4a84a52be381..a1356f40d83e 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -77,7 +77,7 @@ static const sal_Int32 nCellHeight = 7; // one pixel is shared with the next cel static const sal_Int32 nBitmapWidth = (nCellWidth * nPreviewColumns) - (nPreviewColumns - 1); static const sal_Int32 nBitmapHeight = (nCellHeight * nPreviewRows) - (nPreviewRows - 1); -static const OUStringLiteral gPropNames[ CB_COUNT ] = +static const OUStringLiteral gPropNames[CB_COUNT] = { "UseFirstRowStyle", "UseLastRowStyle", diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx index e8dbbe305247..6450674e60c5 100644 --- a/sd/source/ui/table/TableDesignPane.hxx +++ b/sd/source/ui/table/TableDesignPane.hxx @@ -43,13 +43,16 @@ class EventMultiplexerEvent; class ViewShellBase; -#define CB_HEADER_ROW 0 -#define CB_TOTAL_ROW 1 -#define CB_BANDED_ROWS 2 -#define CB_FIRST_COLUMN 3 -#define CB_LAST_COLUMN 4 -#define CB_BANDED_COLUMNS 5 -#define CB_COUNT CB_BANDED_COLUMNS-CB_HEADER_ROW+1 +enum TableCheckBox : sal_uInt16 +{ + CB_HEADER_ROW = 0, + CB_TOTAL_ROW = 1, + CB_BANDED_ROWS = 2, + CB_FIRST_COLUMN = 3, + CB_LAST_COLUMN = 4, + CB_BANDED_COLUMNS = 5, + CB_COUNT = CB_BANDED_COLUMNS + 1 +}; class TableValueSet : public ValueSet { commit 657e6ad745d740520e04ae6da56c7607683a1395 Author: Caolán McNamara <caol...@redhat.com> Date: Sun May 7 15:33:20 2017 +0100 Revert "coverity#1250405 Division or modulo by float zero" This reverts commit 445ac42cc2f2f759a43d97198039b980026ed70e. Change-Id: I4f106a67385776262f187e63c445ea8c0cb0207b diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index c2c65b341ece..619107c40978 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <o3tl/numeric.hxx> #include <tools/bigint.hxx> #include <vcl/virdev.hxx> @@ -257,9 +256,6 @@ static void ImplCalcMapResolution( const MapMode& rMapMode, } else { - if (!aScaleX.GetNumerator() || !aScaleY.GetNumerator()) - throw o3tl::divide_by_zero(); - rMapRes.mfOffsetX *= aScaleX.GetDenominator(); rMapRes.mfOffsetX /= aScaleX.GetNumerator(); rMapRes.mfOffsetX += aOrigin.X();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits