Kaydet (Commit) 2a94fddc authored tarafından Michael Stahl's avatar Michael Stahl

sw: convert DELETEZ to std::unique_ptr in SwXFrame

Change-Id: I1aa9d0fc8712773ea87ea8419c384f6f23258387
üst 23961ff6
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include "frmfmt.hxx" #include "frmfmt.hxx"
#include "unotext.hxx" #include "unotext.hxx"
#include <memory>
class SdrObject; class SdrObject;
class SwDoc; class SwDoc;
class SwFormat; class SwFormat;
...@@ -65,7 +67,7 @@ private: ...@@ -65,7 +67,7 @@ private:
const FlyCntType eType; const FlyCntType eType;
// Descriptor-interface // Descriptor-interface
BaseFrameProperties_Impl* pProps; std::unique_ptr<BaseFrameProperties_Impl> m_pProps;
bool bIsDescriptor; bool bIsDescriptor;
OUString m_sName; OUString m_sName;
......
...@@ -1222,27 +1222,27 @@ SwXFrame::SwXFrame(FlyCntType eSet, const ::SfxItemPropertySet* pSet, SwDoc *pDo ...@@ -1222,27 +1222,27 @@ SwXFrame::SwXFrame(FlyCntType eSet, const ::SfxItemPropertySet* pSet, SwDoc *pDo
{ {
uno::Any aAny2 = mxStyleFamily->getByName ("Frame"); uno::Any aAny2 = mxStyleFamily->getByName ("Frame");
aAny2 >>= mxStyleData; aAny2 >>= mxStyleData;
pProps = new SwFrameProperties_Impl( ); m_pProps.reset(new SwFrameProperties_Impl);
} }
break; break;
case FLYCNTTYPE_GRF: case FLYCNTTYPE_GRF:
{ {
uno::Any aAny2 = mxStyleFamily->getByName ("Graphics"); uno::Any aAny2 = mxStyleFamily->getByName ("Graphics");
aAny2 >>= mxStyleData; aAny2 >>= mxStyleData;
pProps = new SwGraphicProperties_Impl( ); m_pProps.reset(new SwGraphicProperties_Impl);
} }
break; break;
case FLYCNTTYPE_OLE: case FLYCNTTYPE_OLE:
{ {
uno::Any aAny2 = mxStyleFamily->getByName ("OLE"); uno::Any aAny2 = mxStyleFamily->getByName ("OLE");
aAny2 >>= mxStyleData; aAny2 >>= mxStyleData;
pProps = new SwOLEProperties_Impl( ); m_pProps.reset(new SwOLEProperties_Impl);
} }
break; break;
default: default:
pProps = nullptr; m_pProps.reset();
; break;
} }
} }
...@@ -1252,7 +1252,6 @@ SwXFrame::SwXFrame(SwFrameFormat& rFrameFormat, FlyCntType eSet, const ::SfxItem ...@@ -1252,7 +1252,6 @@ SwXFrame::SwXFrame(SwFrameFormat& rFrameFormat, FlyCntType eSet, const ::SfxItem
, m_pPropSet(pSet) , m_pPropSet(pSet)
, m_pDoc(nullptr) , m_pDoc(nullptr)
, eType(eSet) , eType(eSet)
, pProps(nullptr)
, bIsDescriptor(false) , bIsDescriptor(false)
, m_pCopySource(nullptr) , m_pCopySource(nullptr)
, m_nDrawAspect(embed::Aspects::MSOLE_CONTENT) , m_nDrawAspect(embed::Aspects::MSOLE_CONTENT)
...@@ -1263,7 +1262,7 @@ SwXFrame::~SwXFrame() ...@@ -1263,7 +1262,7 @@ SwXFrame::~SwXFrame()
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
delete m_pCopySource; delete m_pCopySource;
delete pProps; m_pProps.reset();
EndListeningAll(); EndListeningAll();
} }
...@@ -1957,7 +1956,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& ...@@ -1957,7 +1956,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
} }
else if(IsDescriptor()) else if(IsDescriptor())
{ {
pProps->SetProperty(pEntry->nWID, nMemberId, aValue); m_pProps->SetProperty(pEntry->nWID, nMemberId, aValue);
if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID ) if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID )
{ {
OUString sStyleName; OUString sStyleName;
...@@ -2295,7 +2294,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) ...@@ -2295,7 +2294,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
if(WID_LAYOUT_SIZE != pEntry->nWID) // there is no LayoutSize in a descriptor if(WID_LAYOUT_SIZE != pEntry->nWID) // there is no LayoutSize in a descriptor
{ {
const uno::Any* pAny = nullptr; const uno::Any* pAny = nullptr;
if( !pProps->GetProperty( pEntry->nWID, nMemberId, pAny ) ) if (!m_pProps->GetProperty(pEntry->nWID, nMemberId, pAny))
aAny = mxStyleData->getPropertyValue( rPropertyName ); aAny = mxStyleData->getPropertyValue( rPropertyName );
else if ( pAny ) else if ( pAny )
aAny = *pAny; aAny = *pAny;
...@@ -2666,7 +2665,7 @@ void SwXFrame::ResetDescriptor() ...@@ -2666,7 +2665,7 @@ void SwXFrame::ResetDescriptor()
bIsDescriptor = false; bIsDescriptor = false;
mxStyleData.clear(); mxStyleData.clear();
mxStyleFamily.clear(); mxStyleFamily.clear();
DELETEZ(pProps); m_pProps.reset();
} }
void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRange) void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
...@@ -2721,7 +2720,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan ...@@ -2721,7 +2720,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
// no the related items need to be added to the set // no the related items need to be added to the set
bool bSizeFound; bool bSizeFound;
if(!pProps->AnyToItemSet( pDoc, aFrameSet, aGrSet, bSizeFound)) if (!m_pProps->AnyToItemSet(pDoc, aFrameSet, aGrSet, bSizeFound))
throw lang::IllegalArgumentException(); throw lang::IllegalArgumentException();
// a TextRange is handled separately // a TextRange is handled separately
*aPam.GetPoint() = *aIntPam.GetPoint(); *aPam.GetPoint() = *aIntPam.GetPoint();
...@@ -2754,7 +2753,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan ...@@ -2754,7 +2753,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
const ::uno::Any* pStyle; const ::uno::Any* pStyle;
SwFrameFormat *pParentFrameFormat = nullptr; SwFrameFormat *pParentFrameFormat = nullptr;
if(pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle)) if (m_pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle))
pParentFrameFormat = lcl_GetFrameFormat( *pStyle, pDoc ); pParentFrameFormat = lcl_GetFrameFormat( *pStyle, pDoc );
SwFlyFrameFormat* pFormat = nullptr; SwFlyFrameFormat* pFormat = nullptr;
...@@ -2808,7 +2807,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan ...@@ -2808,7 +2807,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
const ::uno::Any* pGraphicURL; const ::uno::Any* pGraphicURL;
OUString sGraphicURL; OUString sGraphicURL;
std::unique_ptr<GraphicObject> pGrfObj; std::unique_ptr<GraphicObject> pGrfObj;
if(pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL)) if (m_pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL))
{ {
(*pGraphicURL) >>= sGraphicURL; (*pGraphicURL) >>= sGraphicURL;
if( sGraphicURL.startsWith(sPackageProtocol) ) if( sGraphicURL.startsWith(sPackageProtocol) )
...@@ -2828,7 +2827,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan ...@@ -2828,7 +2827,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
} }
Graphic aGraphic; Graphic aGraphic;
const ::uno::Any* pGraphic; const ::uno::Any* pGraphic;
const bool bHasGraphic = pProps->GetProperty( FN_UNO_GRAPHIC, 0, pGraphic ); const bool bHasGraphic = m_pProps->GetProperty(FN_UNO_GRAPHIC, 0, pGraphic);
if( bHasGraphic ) if( bHasGraphic )
{ {
uno::Reference< graphic::XGraphic > xGraphic; uno::Reference< graphic::XGraphic > xGraphic;
...@@ -2838,7 +2837,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan ...@@ -2838,7 +2837,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
OUString sFltName; OUString sFltName;
const ::uno::Any* pFilter; const ::uno::Any* pFilter;
if(pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter)) if (m_pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter))
{ {
(*pFilter) >>= sFltName; (*pFilter) >>= sFltName;
} }
...@@ -2862,19 +2861,19 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan ...@@ -2862,19 +2861,19 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
} }
const ::uno::Any* pSurroundContour; const ::uno::Any* pSurroundContour;
if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour)) if (m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour))
setPropertyValue(UNO_NAME_SURROUND_CONTOUR, *pSurroundContour); setPropertyValue(UNO_NAME_SURROUND_CONTOUR, *pSurroundContour);
const ::uno::Any* pContourOutside; const ::uno::Any* pContourOutside;
if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside)) if (m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside))
setPropertyValue(UNO_NAME_CONTOUR_OUTSIDE, *pContourOutside); setPropertyValue(UNO_NAME_CONTOUR_OUTSIDE, *pContourOutside);
const ::uno::Any* pContourPoly; const ::uno::Any* pContourPoly;
if(pProps->GetProperty(FN_PARAM_CONTOUR_PP, 0, pContourPoly)) if (m_pProps->GetProperty(FN_PARAM_CONTOUR_PP, 0, pContourPoly))
setPropertyValue(UNO_NAME_CONTOUR_POLY_POLYGON, *pContourPoly); setPropertyValue(UNO_NAME_CONTOUR_POLY_POLYGON, *pContourPoly);
const ::uno::Any* pPixelContour; const ::uno::Any* pPixelContour;
if(pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour)) if (m_pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour))
setPropertyValue(UNO_NAME_IS_PIXEL_CONTOUR, *pPixelContour); setPropertyValue(UNO_NAME_IS_PIXEL_CONTOUR, *pPixelContour);
const ::uno::Any* pAutoContour; const ::uno::Any* pAutoContour;
if(pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour)) if (m_pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
setPropertyValue(UNO_NAME_IS_AUTOMATIC_CONTOUR, *pAutoContour); setPropertyValue(UNO_NAME_IS_AUTOMATIC_CONTOUR, *pAutoContour);
} }
else else
...@@ -2882,10 +2881,12 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan ...@@ -2882,10 +2881,12 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
const ::uno::Any* pCLSID = nullptr; const ::uno::Any* pCLSID = nullptr;
const ::uno::Any* pStreamName = nullptr; const ::uno::Any* pStreamName = nullptr;
const ::uno::Any* pEmbeddedObject = nullptr; const ::uno::Any* pEmbeddedObject = nullptr;
if(!pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID) if (!m_pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID)
&& !pProps->GetProperty( FN_UNO_STREAM_NAME, 0, pStreamName ) && !m_pProps->GetProperty(FN_UNO_STREAM_NAME, 0, pStreamName)
&& !pProps->GetProperty( FN_EMBEDDED_OBJECT, 0, pEmbeddedObject )) && !m_pProps->GetProperty(FN_EMBEDDED_OBJECT, 0, pEmbeddedObject))
{
throw uno::RuntimeException(); throw uno::RuntimeException();
}
if(pCLSID) if(pCLSID)
{ {
OUString aCLSID; OUString aCLSID;
...@@ -3034,27 +3035,27 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan ...@@ -3034,27 +3035,27 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
if( pFormat && pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) if( pFormat && pDoc->getIDocumentDrawModelAccess().GetDrawModel() )
GetOrCreateSdrObject(*pFormat); GetOrCreateSdrObject(*pFormat);
const ::uno::Any* pOrder; const ::uno::Any* pOrder;
if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) ) if (m_pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder))
setPropertyValue(UNO_NAME_Z_ORDER, *pOrder); setPropertyValue(UNO_NAME_Z_ORDER, *pOrder);
const ::uno::Any* pReplacement; const ::uno::Any* pReplacement;
if( pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement) ) if (m_pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement))
setPropertyValue(UNO_NAME_GRAPHIC, *pReplacement); setPropertyValue(UNO_NAME_GRAPHIC, *pReplacement);
// new attribute Title // new attribute Title
const ::uno::Any* pTitle; const ::uno::Any* pTitle;
if ( pProps->GetProperty(FN_UNO_TITLE, 0, pTitle) ) if (m_pProps->GetProperty(FN_UNO_TITLE, 0, pTitle))
{ {
setPropertyValue(UNO_NAME_TITLE, *pTitle); setPropertyValue(UNO_NAME_TITLE, *pTitle);
} }
// new attribute Description // new attribute Description
const ::uno::Any* pDescription; const ::uno::Any* pDescription;
if ( pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription) ) if (m_pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription))
{ {
setPropertyValue(UNO_NAME_DESCRIPTION, *pDescription); setPropertyValue(UNO_NAME_DESCRIPTION, *pDescription);
} }
// For grabbag // For grabbag
const uno::Any* pFrameIntropgrabbagItem; const uno::Any* pFrameIntropgrabbagItem;
if( pProps->GetProperty(RES_FRMATR_GRABBAG, 0, pFrameIntropgrabbagItem) ) if (m_pProps->GetProperty(RES_FRMATR_GRABBAG, 0, pFrameIntropgrabbagItem))
{ {
setPropertyValue(UNO_NAME_FRAME_INTEROP_GRAB_BAG, *pFrameIntropgrabbagItem); setPropertyValue(UNO_NAME_FRAME_INTEROP_GRAB_BAG, *pFrameIntropgrabbagItem);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment