summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-10-27 12:52:16 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-10-27 12:48:50 +0000
commite25669fcedcb7231254d3ba0e0224b2e3eb901d8 (patch)
tree05ce242744c88d9efcd5b685720b2178008c2c8c
parent96d03636a5f932151c7842ae34631258891fe807 (diff)
don't allocate uno::Reference on the heap
There is no point, since it's the size of a pointer anyway (found by temporarily making the new operator in uno::Reference deleted). Change-Id: I62a8b957fef9184f65d705600acfdab4116dcb34 Reviewed-on: https://gerrit.libreoffice.org/19603 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--forms/source/component/imgprod.cxx2
-rw-r--r--forms/source/component/imgprod.hxx6
-rw-r--r--include/sfx2/thumbnailviewitem.hxx2
-rw-r--r--include/toolkit/awt/vclxmenu.hxx2
-rw-r--r--sfx2/source/control/thumbnailviewacc.cxx2
-rw-r--r--sfx2/source/control/thumbnailviewitem.cxx13
-rw-r--r--stoc/source/javaloader/javaloader.cxx8
-rw-r--r--svtools/source/control/valueacc.cxx15
-rw-r--r--svtools/source/control/valueimp.hxx2
-rw-r--r--sw/inc/unostyle.hxx10
-rw-r--r--sw/inc/unotxdoc.hxx56
-rw-r--r--sw/source/core/unocore/unostyle.cxx50
-rw-r--r--sw/source/filter/html/htmlforw.cxx26
-rw-r--r--sw/source/filter/html/htmltabw.cxx2
-rw-r--r--sw/source/filter/html/wrthtml.cxx11
-rw-r--r--sw/source/filter/html/wrthtml.hxx2
-rw-r--r--sw/source/uibase/inc/uivwimp.hxx2
-rw-r--r--sw/source/uibase/inc/unomod.hxx4
-rw-r--r--sw/source/uibase/inc/unotxvw.hxx6
-rw-r--r--sw/source/uibase/uiview/uivwimp.cxx14
-rw-r--r--sw/source/uibase/uno/unomod.cxx20
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx355
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx30
-rw-r--r--toolkit/source/awt/vclxmenu.cxx15
24 files changed, 292 insertions, 363 deletions
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx
index b2b47b056b03..e2976519f8bc 100644
--- a/forms/source/component/imgprod.cxx
+++ b/forms/source/component/imgprod.cxx
@@ -204,7 +204,7 @@ void ImageProducer::addConsumer( const css::uno::Reference< css::awt::XImageCons
{
DBG_ASSERT( rxConsumer.is(), "::AddConsumer(...): No consumer referenced!" );
if( rxConsumer.is() )
- maConsList.push_back( new css::uno::Reference< css::awt::XImageConsumer > ( rxConsumer ));
+ maConsList.push_back( rxConsumer );
}
diff --git a/forms/source/component/imgprod.hxx b/forms/source/component/imgprod.hxx
index 23a60bcf310d..5bda64f12cfa 100644
--- a/forms/source/component/imgprod.hxx
+++ b/forms/source/component/imgprod.hxx
@@ -20,15 +20,13 @@
#ifndef INCLUDED_FORMS_SOURCE_COMPONENT_IMGPROD_HXX
#define INCLUDED_FORMS_SOURCE_COMPONENT_IMGPROD_HXX
-#include <boost/ptr_container/ptr_vector.hpp>
-
#include <tools/link.hxx>
#include <com/sun/star/awt/ImageStatus.hpp>
#include <com/sun/star/awt/XImageConsumer.hpp>
#include <com/sun/star/awt/XImageProducer.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <cppuhelper/weak.hxx>
-
+#include <vector>
// - ImageProducer -
@@ -50,7 +48,7 @@ class ImageProducer : public css::awt::XImageProducer,
{
private:
- typedef boost::ptr_vector< css::uno::Reference< css::awt::XImageConsumer > > ConsumerList_t;
+ typedef std::vector< css::uno::Reference< css::awt::XImageConsumer > > ConsumerList_t;
OUString maURL;
ConsumerList_t maConsList;
diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx
index 09340af9601b..310804030844 100644
--- a/include/sfx2/thumbnailviewitem.hxx
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -76,7 +76,7 @@ public:
bool mbHover;
BitmapEx maPreview1;
OUString maTitle;
- css::uno::Reference< css::accessibility::XAccessible >* mpxAcc;
+ css::uno::Reference< css::accessibility::XAccessible > mxAcc;
ThumbnailViewItem (ThumbnailView &rView, sal_uInt16 nId);
diff --git a/include/toolkit/awt/vclxmenu.hxx b/include/toolkit/awt/vclxmenu.hxx
index f41a5f6bd136..d092692a0110 100644
--- a/include/toolkit/awt/vclxmenu.hxx
+++ b/include/toolkit/awt/vclxmenu.hxx
@@ -43,7 +43,7 @@ class PopupMenu;
class VclMenuEvent;
typedef ::std::vector<
- css::uno::Reference< css::awt::XPopupMenu >*
+ css::uno::Reference< css::awt::XPopupMenu >
> PopupMenuRefList;
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index 445e703b77e9..30ee8bf6d013 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -723,7 +723,7 @@ sal_Int32 SAL_CALL ThumbnailViewItemAcc::getAccessibleIndexInParent()
}
// Do not create an accessible object for the test.
- if (pItem != NULL && pItem->mpxAcc != NULL)
+ if (pItem != NULL && pItem->mxAcc.is())
if (pItem->GetAccessible( mbIsTransientChildrenDisabled ).get() == this )
{
nIndexInParent = i;
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index 5ddb650018b0..db75ab60cc01 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -106,7 +106,7 @@ ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView, sal_uInt16 nId)
, mbVisible(true)
, mbSelected(false)
, mbHover(false)
- , mpxAcc(NULL)
+ , mxAcc()
, mbEditTitle(false)
, mpTitleED(NULL)
, maTextEditMaxArea()
@@ -117,10 +117,9 @@ ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView, sal_uInt16 nId)
ThumbnailViewItem::~ThumbnailViewItem()
{
mpTitleED.disposeAndClear();
- if( mpxAcc )
+ if( mxAcc.is() )
{
- static_cast< ThumbnailViewItemAcc* >( mpxAcc->get() )->ParentDestroyed();
- delete mpxAcc;
+ static_cast< ThumbnailViewItemAcc* >( mxAcc.get() )->ParentDestroyed();
}
}
@@ -218,10 +217,10 @@ void ThumbnailViewItem::setTitle (const OUString& rTitle)
uno::Reference< accessibility::XAccessible > ThumbnailViewItem::GetAccessible( bool bIsTransientChildrenDisabled )
{
- if( !mpxAcc )
- mpxAcc = new uno::Reference< accessibility::XAccessible >( new ThumbnailViewItemAcc( this, bIsTransientChildrenDisabled ) );
+ if( !mxAcc.is() )
+ mxAcc = new ThumbnailViewItemAcc( this, bIsTransientChildrenDisabled );
- return *mpxAcc;
+ return mxAcc;
}
void ThumbnailViewItem::setDrawArea (const Rectangle &area)
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index 3a454f16b5cb..7b80dbd492e7 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -372,15 +372,15 @@ css::uno::Reference<XInterface> SAL_CALL JavaComponentLoader_CreateInstance(cons
MutexGuard guard( getInitMutex() );
// The javaloader is never destroyed and there can be only one!
// Note that the first context wins ....
- static css::uno::Reference< XInterface > *pStaticRef = 0;
- if( pStaticRef )
+ static css::uno::Reference< XInterface > xStaticRef;
+ if( xStaticRef.is() )
{
- xRet = *pStaticRef;
+ xRet = xStaticRef;
}
else
{
xRet = *new JavaComponentLoader(xCtx);
- pStaticRef = new css::uno::Reference< XInterface > ( xRet );
+ xStaticRef = xRet;
}
}
catch(const RuntimeException & runtimeException) {
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 0f8a0a13e2eb..f932092933ea 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -42,7 +42,7 @@ ValueSetItem::ValueSetItem( ValueSet& rParent )
, mbVisible(true)
, mpData(NULL)
, mbSelected(false)
- , mpxAcc(NULL)
+ , mxAcc()
{
}
@@ -50,10 +50,9 @@ ValueSetItem::ValueSetItem( ValueSet& rParent )
ValueSetItem::~ValueSetItem()
{
- if( mpxAcc )
+ if( mxAcc.is() )
{
- static_cast< ValueItemAcc* >( mpxAcc->get() )->ParentDestroyed();
- delete mpxAcc;
+ static_cast< ValueItemAcc* >( mxAcc.get() )->ParentDestroyed();
}
}
@@ -61,10 +60,10 @@ ValueSetItem::~ValueSetItem()
uno::Reference< accessibility::XAccessible > ValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled )
{
- if( !mpxAcc )
- mpxAcc = new uno::Reference< accessibility::XAccessible >( new ValueItemAcc( this, bIsTransientChildrenDisabled ) );
+ if( !mxAcc.is() )
+ mxAcc = new ValueItemAcc( this, bIsTransientChildrenDisabled );
- return *mpxAcc;
+ return mxAcc;
}
@@ -897,7 +896,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent()
}
// Do not create an accessible object for the test.
- if (pItem != NULL && pItem->mpxAcc != NULL)
+ if (pItem != NULL && pItem->mxAcc.is())
if (pItem->GetAccessible( mbIsTransientChildrenDisabled ).get() == this )
{
nIndexInParent = i;
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index d86336dff618..f1c1ac54311b 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -59,7 +59,7 @@ struct ValueSetItem
OUString maText;
void* mpData;
bool mbSelected;
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc;
+ css::uno::Reference< css::accessibility::XAccessible > mxAcc;
explicit ValueSetItem( ValueSet& rParent );
~ValueSetItem();
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx
index 6ebc358a0b05..c83f40fd9a99 100644
--- a/sw/inc/unostyle.hxx
+++ b/sw/inc/unostyle.hxx
@@ -62,11 +62,11 @@ class SwXStyleFamilies : public cppu::WeakImplHelper
{
SwDocShell* m_pDocShell;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * m_pxCharStyles;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * m_pxParaStyles;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * m_pxFrameStyles;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * m_pxPageStyles;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * m_pxNumberingStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xCharStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xParaStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xFrameStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xPageStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xNumberingStyles;
protected:
virtual ~SwXStyleFamilies();
public:
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index f34d0a9172a4..196f60d81286 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -143,34 +143,34 @@ private:
bool bObjectValid;
SwXDrawPage* pDrawPage;
- css::uno::Reference< css::drawing::XDrawPage > * pxXDrawPage;
-
- css::uno::Reference< css::text::XText > xBodyText;
- SwXBodyText* pBodyText;
- css::uno::Reference< css::uno::XAggregation > xNumFormatAgg;
-
- css::uno::Reference< css::container::XIndexAccess > * pxXNumberingRules;
- css::uno::Reference< css::container::XIndexAccess > * pxXFootnotes;
- css::uno::Reference< css::beans::XPropertySet > * pxXFootnoteSettings;
- css::uno::Reference< css::container::XIndexAccess > * pxXEndnotes;
- css::uno::Reference< css::beans::XPropertySet > * pxXEndnoteSettings;
- css::uno::Reference< css::container::XNameAccess > * pxXReferenceMarks;
- css::uno::Reference< css::container::XEnumerationAccess > * pxXTextFieldTypes;
- css::uno::Reference< css::container::XNameAccess > * pxXTextFieldMasters;
- css::uno::Reference< css::container::XNameAccess > * pxXTextSections;
- css::uno::Reference< css::container::XNameAccess > * pxXBookmarks;
- css::uno::Reference< css::container::XNameAccess > * pxXTextTables;
- css::uno::Reference< css::container::XNameAccess > * pxXTextFrames;
- css::uno::Reference< css::container::XNameAccess > * pxXGraphicObjects;
- css::uno::Reference< css::container::XNameAccess > * pxXEmbeddedObjects;
- css::uno::Reference< css::container::XNameAccess > * pxXStyleFamilies;
- mutable css::uno::Reference< css::style::XAutoStyles > * pxXAutoStyles;
- css::uno::Reference< css::container::XIndexReplace > * pxXChapterNumbering;
- css::uno::Reference< css::container::XIndexAccess > * pxXDocumentIndexes;
-
- css::uno::Reference< css::beans::XPropertySet > * pxXLineNumberingProperties;
- css::uno::Reference< css::container::XNameAccess > * pxLinkTargetSupplier;
- css::uno::Reference< css::container::XEnumerationAccess >* pxXRedlines;
+ css::uno::Reference< css::drawing::XDrawPage > mxXDrawPage;
+
+ css::uno::Reference< css::text::XText > xBodyText;
+ SwXBodyText* pBodyText;
+ css::uno::Reference< css::uno::XAggregation > xNumFormatAgg;
+
+ css::uno::Reference< css::container::XIndexAccess > mxXNumberingRules;
+ css::uno::Reference< css::container::XIndexAccess > mxXFootnotes;
+ css::uno::Reference< css::beans::XPropertySet > mxXFootnoteSettings;
+ css::uno::Reference< css::container::XIndexAccess > mxXEndnotes;
+ css::uno::Reference< css::beans::XPropertySet > mxXEndnoteSettings;
+ css::uno::Reference< css::container::XNameAccess > mxXReferenceMarks;
+ css::uno::Reference< css::container::XEnumerationAccess > mxXTextFieldTypes;
+ css::uno::Reference< css::container::XNameAccess > mxXTextFieldMasters;
+ css::uno::Reference< css::container::XNameAccess > mxXTextSections;
+ css::uno::Reference< css::container::XNameAccess > mxXBookmarks;
+ css::uno::Reference< css::container::XNameAccess > mxXTextTables;
+ css::uno::Reference< css::container::XNameAccess > mxXTextFrames;
+ css::uno::Reference< css::container::XNameAccess > mxXGraphicObjects;
+ css::uno::Reference< css::container::XNameAccess > mxXEmbeddedObjects;
+ css::uno::Reference< css::container::XNameAccess > mxXStyleFamilies;
+ mutable css::uno::Reference< css::style::XAutoStyles > mxXAutoStyles;
+ css::uno::Reference< css::container::XIndexReplace > mxXChapterNumbering;
+ css::uno::Reference< css::container::XIndexAccess > mxXDocumentIndexes;
+
+ css::uno::Reference< css::beans::XPropertySet > mxXLineNumberingProperties;
+ css::uno::Reference< css::container::XNameAccess > mxLinkTargetSupplier;
+ css::uno::Reference< css::container::XEnumerationAccess > mxXRedlines;
css::uno::Reference< css::container::XNameContainer> xXFormsContainer;
//temporary frame to enable PDF export if no valid view is available
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index d2039b21d878..2372c75a1053 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -167,22 +167,17 @@ uno::Sequence< OUString > SwXStyleFamilies::getSupportedServiceNames() throw( un
SwXStyleFamilies::SwXStyleFamilies(SwDocShell& rDocShell) :
SwUnoCollection(rDocShell.GetDoc()),
m_pDocShell(&rDocShell),
- m_pxCharStyles(0),
- m_pxParaStyles(0),
- m_pxFrameStyles(0),
- m_pxPageStyles(0),
- m_pxNumberingStyles(0)
+ m_xCharStyles(),
+ m_xParaStyles(),
+ m_xFrameStyles(),
+ m_xPageStyles(),
+ m_xNumberingStyles()
{
}
SwXStyleFamilies::~SwXStyleFamilies()
{
- delete m_pxCharStyles;
- delete m_pxParaStyles;
- delete m_pxFrameStyles;
- delete m_pxPageStyles;
- delete m_pxNumberingStyles;
}
uno::Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name)
@@ -255,52 +250,47 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex)
{
case SFX_STYLE_FAMILY_CHAR:
{
- if(!m_pxCharStyles)
+ if(!m_xCharStyles.is())
{
- static_cast<SwXStyleFamilies*>(this)->m_pxCharStyles = new uno::Reference< container::XNameContainer > ();
- *m_pxCharStyles = new SwXStyleFamily(m_pDocShell, nType);
+ m_xCharStyles = new SwXStyleFamily(m_pDocShell, nType);
}
- aRef = *m_pxCharStyles;
+ aRef = m_xCharStyles;
}
break;
case SFX_STYLE_FAMILY_PARA:
{
- if(!m_pxParaStyles)
+ if(!m_xParaStyles.is())
{
- static_cast<SwXStyleFamilies*>(this)->m_pxParaStyles = new uno::Reference< container::XNameContainer > ();
- *m_pxParaStyles = new SwXStyleFamily(m_pDocShell, nType);
+ m_xParaStyles = new SwXStyleFamily(m_pDocShell, nType);
}
- aRef = *m_pxParaStyles;
+ aRef = m_xParaStyles;
}
break;
case SFX_STYLE_FAMILY_PAGE :
{
- if(!m_pxPageStyles)
+ if(!m_xPageStyles.is())
{
- static_cast<SwXStyleFamilies*>(this)->m_pxPageStyles = new uno::Reference< container::XNameContainer > ();
- *m_pxPageStyles = new SwXStyleFamily(m_pDocShell, nType);
+ m_xPageStyles = new SwXStyleFamily(m_pDocShell, nType);
}
- aRef = *m_pxPageStyles;
+ aRef = m_xPageStyles;
}
break;
case SFX_STYLE_FAMILY_FRAME :
{
- if(!m_pxFrameStyles)
+ if(!m_xFrameStyles.is())
{
- static_cast<SwXStyleFamilies*>(this)->m_pxFrameStyles = new uno::Reference< container::XNameContainer > ();
- *m_pxFrameStyles = new SwXStyleFamily(m_pDocShell, nType);
+ m_xFrameStyles = new SwXStyleFamily(m_pDocShell, nType);
}
- aRef = *m_pxFrameStyles;
+ aRef = m_xFrameStyles;
}
break;
case SFX_STYLE_FAMILY_PSEUDO:
{
- if(!m_pxNumberingStyles)
+ if(!m_xNumberingStyles.is())
{
- static_cast<SwXStyleFamilies*>(this)->m_pxNumberingStyles = new uno::Reference< container::XNameContainer > ();
- *m_pxNumberingStyles = new SwXStyleFamily(m_pDocShell, nType);
+ m_xNumberingStyles = new SwXStyleFamily(m_pDocShell, nType);
}
- aRef = *m_pxNumberingStyles;
+ aRef = m_xNumberingStyles;
}
break;
}
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 0efb13096355..e4ff1a58eab6 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -232,11 +232,11 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd )
if( !bTag_On )
{
// die Form beenden wenn alle Controls ausgegeben wurden
- if( pxFormComps && pxFormComps->is() &&
- (*pxFormComps)->getCount() == nFormCntrlCnt )
+ if( mxFormComps.is() &&
+ mxFormComps->getCount() == nFormCntrlCnt )
{
- OutForm( false, *pxFormComps );
- (*pxFormComps) = 0;
+ OutForm( false, mxFormComps );
+ mxFormComps.clear();
}
return;
}
@@ -321,26 +321,24 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd )
}
if( xNewFormComps.is() &&
- (!pxFormComps || !(xNewFormComps == *pxFormComps)) )
+ (!mxFormComps.is() || !(xNewFormComps == mxFormComps)) )
{
// Es soll eine Form aufgemacht werden ...
- if( pxFormComps && pxFormComps->is() )
+ if( mxFormComps.is() )
{
// .. es ist aber noch eine Form offen: Das ist in
// jedem Fall eine Fehler, aber wir schliessen die alte
// Form trotzdem
- OutForm( false, *pxFormComps );
+ OutForm( false, mxFormComps );
//!!!nWarn = 1; // Control wird falscher Form zugeordnet
}
- if( !pxFormComps )
- pxFormComps = new uno::Reference< container::XIndexContainer > ;
- *pxFormComps = xNewFormComps;
+ mxFormComps = xNewFormComps;
- OutForm( true, *pxFormComps );
+ OutForm( true, mxFormComps );
uno::Reference< beans::XPropertySet > xTmp;
- OutHiddenControls( *pxFormComps, xTmp );
+ OutHiddenControls( mxFormComps, xTmp );
}
}
@@ -1270,8 +1268,8 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
// Controls sind nicht absatz-gebunden, deshalb kein LF mehr ausgeben!
rHTMLWrt.bLFPossible = false;
- if( rHTMLWrt.pxFormComps && rHTMLWrt.pxFormComps->is() )
- rHTMLWrt.OutHiddenControls( *rHTMLWrt.pxFormComps, xPropSet );
+ if( rHTMLWrt.mxFormComps.is() )
+ rHTMLWrt.OutHiddenControls( rHTMLWrt.mxFormComps, xPropSet );
return rWrt;
}
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 9a1a3c447260..5926b067f0c4 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -920,7 +920,7 @@ Writer& OutHTML_SwTableNode( Writer& rWrt, SwTableNode & rNode,
if( !rHTMLWrt.bPreserveForm )
{
rHTMLWrt.OutForm( true, &rNode );
- bPreserveForm = (rHTMLWrt.pxFormComps && rHTMLWrt.pxFormComps->is() );
+ bPreserveForm = rHTMLWrt.mxFormComps.is();
rHTMLWrt.bPreserveForm = bPreserveForm;
}
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 6a6782cd5342..ee9c2ef1a873 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -97,7 +97,7 @@ SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL )
, nHTMLMode(0)
, eCSS1Unit(FUNIT_NONE)
, pFootEndNotes(NULL)
- , pxFormComps(NULL)
+ , mxFormComps()
, pTemplate(NULL)
, pDfltColor(NULL)
, pStartNdIdx(NULL)
@@ -285,7 +285,7 @@ sal_uLong SwHTMLWriter::WriteStream()
pFootEndNotes = 0;
pFormatFootnote = 0;
bOutTable = bOutHeader = bOutFooter = bOutFlyFrame = false;
- pxFormComps = 0;
+ mxFormComps.clear();
nFormCntrlCnt = 0;
bPreserveForm = false;
bClearLeft = bClearRight = false;
@@ -412,8 +412,8 @@ sal_uLong SwHTMLWriter::WriteStream()
Out_SwDoc( pOrigPam );
nTextAttrsToIgnore = 0;
- if( pxFormComps && pxFormComps->is() )
- OutForm( false, *pxFormComps );
+ if( mxFormComps.is() )
+ OutForm( false, mxFormComps );
if( pFootEndNotes )
OutFootEndNotes();
@@ -474,8 +474,7 @@ sal_uLong SwHTMLWriter::WriteStream()
delete pStartNdIdx;
pStartNdIdx = 0;
- delete pxFormComps;
- pxFormComps = 0;
+ mxFormComps.clear();
OSL_ENSURE( !pFootEndNotes,
"SwHTMLWriter::Write: Footnotes nicht durch OutFootEndNotes geloescht" );
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 30ea6cca7711..2f8fe1bedee9 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -300,7 +300,7 @@ public:
OUString aNonConvertableCharacters;
OUString aBulletGrfs[MAXLEVEL]; // die Grafiken fuer Listen
- css::uno::Reference<css::container::XIndexContainer>* pxFormComps; // die aktuelle Form
+ css::uno::Reference<css::container::XIndexContainer> mxFormComps; // die aktuelle Form
SwDoc *pTemplate; // die HTML-Vorlage
Color *pDfltColor; // default Farbe
diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index a1558fd82298..94c1401a44e2 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -93,7 +93,7 @@ class SwView_Impl
::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > xScanEvtLstnr;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > xClipEvtLstnr;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > xDisProvInterceptor;
- ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > *pxXTextView; // UNO object
+ ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > mxXTextView; // UNO object
com::sun::star::uno::WeakReference< com::sun::star::lang::XUnoTunnel > xTransferable;
// temporary document for printing text of selection / multi selection
diff --git a/sw/source/uibase/inc/unomod.hxx b/sw/source/uibase/inc/unomod.hxx
index b629a16b242a..70877da36abb 100644
--- a/sw/source/uibase/inc/unomod.hxx
+++ b/sw/source/uibase/inc/unomod.hxx
@@ -44,8 +44,8 @@ class SwXModule : public cppu::WeakImplHelper
>
{
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxViewSettings;
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxPrintSettings;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxViewSettings;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxPrintSettings;
protected:
virtual ~SwXModule();
diff --git a/sw/source/uibase/inc/unotxvw.hxx b/sw/source/uibase/inc/unotxvw.hxx
index 806d11da27b9..dfa6721a7796 100644
--- a/sw/source/uibase/inc/unotxvw.hxx
+++ b/sw/source/uibase/inc/unotxvw.hxx
@@ -62,10 +62,10 @@ class SwXTextView :
SwView* m_pView;
const SfxItemPropertySet* m_pPropSet; // property map for SwXTextView properties
- // (not related to pxViewSettings!)
+ // (not related to mxViewSettings!)
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxViewSettings;
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextViewCursor > * pxTextViewCursor;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxViewSettings;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextViewCursor > mxTextViewCursor;
SdrObject* GetControl(
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & Model,
diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx
index 7bb139335027..23ec3205ab97 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -55,7 +55,7 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::datatransfer::clipboard;
SwView_Impl::SwView_Impl(SwView* pShell)
- : pxXTextView(new uno::Reference<view::XSelectionSupplier>)
+ : mxXTextView()
, pView(pShell)
, pScanEvtLstnr(0)
, pClipEvtLstnr(0)
@@ -71,7 +71,7 @@ SwView_Impl::SwView_Impl(SwView* pShell)
, m_bSelectObject(false)
, m_bEditingPositionSet(false)
{
- *pxXTextView = new SwXTextView(pView);
+ mxXTextView = new SwXTextView(pView);
xDisProvInterceptor = new SwXDispatchProviderInterceptor(*pView);
}
@@ -86,9 +86,9 @@ SwView_Impl::~SwView_Impl()
{
pInterceptor->Invalidate();
}
- view::XSelectionSupplier* pTextView = pxXTextView->get();
+ view::XSelectionSupplier* pTextView = mxXTextView.get();
static_cast<SwXTextView*>(pTextView)->Invalidate();
- delete pxXTextView;
+ mxXTextView.clear();
if( xScanEvtLstnr.is() )
pScanEvtLstnr->ViewDestroyed();
if( xClipEvtLstnr.is() )
@@ -110,13 +110,13 @@ void SwView_Impl::SetShellMode(ShellModes eSet)
view::XSelectionSupplier* SwView_Impl::GetUNOObject()
{
- return pxXTextView->get();
+ return mxXTextView.get();
}
SwXTextView* SwView_Impl::GetUNOObject_Impl()
{
- view::XSelectionSupplier* pTextView = pxXTextView->get();
- return static_cast<SwXTextView*>(pTextView);
+ view::XSelectionSupplier* pTextView = mxXTextView.get();
+ return static_cast<SwXTextView*>(pTextView);
}
void SwView_Impl::ExecuteScan( SfxRequest& rReq )
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 88374824f15f..57fba72ea608 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -194,39 +194,35 @@ static ChainablePropertySetInfo * lcl_createPrintSettingsInfo()
}
SwXModule::SwXModule() :
- pxViewSettings(0),
- pxPrintSettings(0)
+ mxViewSettings(),
+ mxPrintSettings()
{
}
SwXModule::~SwXModule()
{
- delete pxViewSettings;
- delete pxPrintSettings;
}
Reference< XPropertySet > SwXModule::getViewSettings() throw( uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
- if(!pxViewSettings)
+ if(!mxViewSettings.is())
{
- static_cast<SwXModule*>(this)->pxViewSettings = new Reference< XPropertySet > ;
OSL_FAIL("Web or Text?");
- *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( false, 0 ) );
+ mxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( false, 0 ) );
}
- return *pxViewSettings;
+ return mxViewSettings;
}
Reference< XPropertySet > SwXModule::getPrintSettings() throw( uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
- if(!pxPrintSettings)
+ if(!mxPrintSettings.is())
{
- static_cast<SwXModule*>(this)->pxPrintSettings = new Reference< XPropertySet > ;
OSL_FAIL("Web or Text?");
- *pxPrintSettings = static_cast < HelperBaseNoState * > ( new SwXPrintSettings ( PRINT_SETTINGS_MODULE ) );
+ mxPrintSettings = static_cast < HelperBaseNoState * > ( new SwXPrintSettings ( PRINT_SETTINGS_MODULE ) );
}
- return *pxPrintSettings;
+ return mxPrintSettings;
}
OUString SwXModule::getImplementationName() throw( RuntimeException, std::exception )
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 52dfcc7fcc80..683119886911 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -378,30 +378,30 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell)
bObjectValid(pShell != 0),
pDrawPage(0),
- pxXDrawPage(0),
+ mxXDrawPage(),
pBodyText(0),
- pxXNumberingRules(0),
- pxXFootnotes(0),
- pxXFootnoteSettings(0),
- pxXEndnotes(0),
- pxXEndnoteSettings(0),
- pxXReferenceMarks(0),
- pxXTextFieldTypes(0),
- pxXTextFieldMasters(0),
- pxXTextSections(0),
- pxXBookmarks(0),
- pxXTextTables(0),
- pxXTextFrames(0),
- pxXGraphicObjects(0),
- pxXEmbeddedObjects(0),
- pxXStyleFamilies(0),
- pxXAutoStyles(0),
- pxXChapterNumbering(0),
- pxXDocumentIndexes(0),
-
- pxXLineNumberingProperties(0),
- pxLinkTargetSupplier(0),
- pxXRedlines(0),
+ mxXNumberingRules(),
+ mxXFootnotes(),
+ mxXFootnoteSettings(),
+ mxXEndnotes(),
+ mxXEndnoteSettings(),
+ mxXReferenceMarks(),
+ mxXTextFieldTypes(),
+ mxXTextFieldMasters(),
+ mxXTextSections(),
+ mxXBookmarks(),
+ mxXTextTables(),
+ mxXTextFrames(),
+ mxXGraphicObjects(),
+ mxXEmbeddedObjects(),
+ mxXStyleFamilies(),
+ mxXAutoStyles(),
+ mxXChapterNumbering(),
+ mxXDocumentIndexes(),
+
+ mxXLineNumberingProperties(),
+ mxLinkTargetSupplier(),
+ mxXRedlines(),
m_pHiddenViewFrame(0),
pPropertyHelper(0),
m_pPrintUIOptions( NULL ),
@@ -613,15 +613,14 @@ Reference< XPropertySet > SwXTextDocument::getLineNumberingProperties()
SolarMutexGuard aGuard;
if(IsValid())
{
- if(!pxXLineNumberingProperties)
+ if(!mxXLineNumberingProperties.is())
{
- pxXLineNumberingProperties = new Reference<XPropertySet>;
- (*pxXLineNumberingProperties) = new SwXLineNumberingProperties(pDocShell->GetDoc());
+ mxXLineNumberingProperties = new SwXLineNumberingProperties(pDocShell->GetDoc());
}
}
else
throw RuntimeException();
- return *pxXLineNumberingProperties;
+ return mxXLineNumberingProperties;
}
Reference< XIndexReplace > SwXTextDocument::getChapterNumberingRules()
@@ -630,12 +629,11 @@ Reference< XIndexReplace > SwXTextDocument::getChapterNumberingRules()
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXChapterNumbering)
+ if(!mxXChapterNumbering.is())
{
- pxXChapterNumbering = new Reference< XIndexReplace > ;
- *pxXChapterNumbering = new SwXChapterNumbering(*pDocShell);
+ mxXChapterNumbering = new SwXChapterNumbering(*pDocShell);
}
- return *pxXChapterNumbering;
+ return mxXChapterNumbering;
}
Reference< XIndexAccess > SwXTextDocument::getNumberingRules() throw( RuntimeException, std::exception )
@@ -643,12 +641,11 @@ Reference< XIndexAccess > SwXTextDocument::getNumberingRules() throw( RuntimeEx
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXNumberingRules )
+ if(!mxXNumberingRules.is() )
{
- static_cast<SwXTextDocument*>(this)->pxXNumberingRules = new Reference< XIndexAccess > ;
- *pxXNumberingRules = new SwXNumberingRulesCollection( pDocShell->GetDoc() );
+ mxXNumberingRules = new SwXNumberingRulesCollection( pDocShell->GetDoc() );
}
- return *pxXNumberingRules;
+ return mxXNumberingRules;
}
Reference< XIndexAccess > SwXTextDocument::getFootnotes() throw( RuntimeException, std::exception )
@@ -656,12 +653,11 @@ Reference< XIndexAccess > SwXTextDocument::getFootnotes() throw( RuntimeExcepti
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXFootnotes)
+ if(!mxXFootnotes.is())
{
- static_cast<SwXTextDocument*>(this)->pxXFootnotes = new Reference< XIndexAccess > ;
- *pxXFootnotes = new SwXFootnotes(false, pDocShell->GetDoc());
+ mxXFootnotes = new SwXFootnotes(false, pDocShell->GetDoc());
}
- return *pxXFootnotes;
+ return mxXFootnotes;
}
Reference< XPropertySet > SAL_CALL
@@ -670,12 +666,11 @@ Reference< XPropertySet > SAL_CALL
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXFootnoteSettings)
+ if(!mxXFootnoteSettings.is())
{
- static_cast<SwXTextDocument*>(this)->pxXFootnoteSettings = new Reference< XPropertySet > ;
- *pxXFootnoteSettings = new SwXFootnoteProperties(pDocShell->GetDoc());
+ mxXFootnoteSettings = new SwXFootnoteProperties(pDocShell->GetDoc());
}
- return *pxXFootnoteSettings;
+ return mxXFootnoteSettings;
}
Reference< XIndexAccess > SwXTextDocument::getEndnotes() throw( RuntimeException, std::exception )
@@ -683,12 +678,11 @@ Reference< XIndexAccess > SwXTextDocument::getEndnotes() throw( RuntimeExceptio
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXEndnotes)
+ if(!mxXEndnotes.is())
{
- static_cast<SwXTextDocument*>(this)->pxXEndnotes = new Reference< XIndexAccess > ;
- *pxXEndnotes = new SwXFootnotes(true, pDocShell->GetDoc());
+ mxXEndnotes = new SwXFootnotes(true, pDocShell->GetDoc());
}
- return *pxXEndnotes;
+ return mxXEndnotes;
}
Reference< XPropertySet > SwXTextDocument::getEndnoteSettings() throw( RuntimeException, std::exception )
@@ -696,12 +690,11 @@ Reference< XPropertySet > SwXTextDocument::getEndnoteSettings() throw( RuntimeE
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXEndnoteSettings)
+ if(!mxXEndnoteSettings.is())
{
- static_cast<SwXTextDocument*>(this)->pxXEndnoteSettings = new Reference< XPropertySet > ;
- *pxXEndnoteSettings = new SwXEndnoteProperties(pDocShell->GetDoc());
+ mxXEndnoteSettings = new SwXEndnoteProperties(pDocShell->GetDoc());
}
- return *pxXEndnoteSettings;
+ return mxXEndnoteSettings;
}
Reference< util::XReplaceDescriptor > SwXTextDocument::createReplaceDescriptor()
@@ -1227,12 +1220,11 @@ Reference< XNameAccess > SwXTextDocument::getReferenceMarks()
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXReferenceMarks)
+ if(!mxXReferenceMarks.is())
{
- static_cast<SwXTextDocument*>(this)->pxXReferenceMarks = new Reference< XNameAccess > ;
- *pxXReferenceMarks = new SwXReferenceMarks(pDocShell->GetDoc());
+ mxXReferenceMarks = new SwXReferenceMarks(pDocShell->GetDoc());
}
- return *pxXReferenceMarks;
+ return mxXReferenceMarks;
}
Reference< XEnumerationAccess > SwXTextDocument::getTextFields() throw( RuntimeException, std::exception )
@@ -1240,12 +1232,11 @@ Reference< XEnumerationAccess > SwXTextDocument::getTextFields() throw( Runtime
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXTextFieldTypes)
+ if(!mxXTextFieldTypes.is())
{
- static_cast<SwXTextDocument*>(this)->pxXTextFieldTypes = new Reference< XEnumerationAccess > ;
- *pxXTextFieldTypes = new SwXTextFieldTypes(pDocShell->GetDoc());
+ mxXTextFieldTypes = new SwXTextFieldTypes(pDocShell->GetDoc());
}
- return *pxXTextFieldTypes;
+ return mxXTextFieldTypes;
}
Reference< XNameAccess > SwXTextDocument::getTextFieldMasters()
@@ -1254,12 +1245,11 @@ Reference< XNameAccess > SwXTextDocument::getTextFieldMasters()
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXTextFieldMasters)
+ if(!mxXTextFieldMasters.is())
{
- static_cast<SwXTextDocument*>(this)->pxXTextFieldMasters = new Reference< XNameAccess > ;
- *pxXTextFieldMasters = new SwXTextFieldMasters(pDocShell->GetDoc());
+ mxXTextFieldMasters = new SwXTextFieldMasters(pDocShell->GetDoc());
}
- return *pxXTextFieldMasters;
+ return mxXTextFieldMasters;
}
Reference< XNameAccess > SwXTextDocument::getEmbeddedObjects() throw( RuntimeException, std::exception )
@@ -1267,12 +1257,11 @@ Reference< XNameAccess > SwXTextDocument::getEmbeddedObjects() throw( RuntimeEx
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXEmbeddedObjects)
+ if(!mxXEmbeddedObjects.is())
{
- static_cast<SwXTextDocument*>(this)->pxXEmbeddedObjects = new Reference< XNameAccess > ;
- *pxXEmbeddedObjects = new SwXTextEmbeddedObjects(pDocShell->GetDoc());
+ mxXEmbeddedObjects = new SwXTextEmbeddedObjects(pDocShell->GetDoc());
}
- return *pxXEmbeddedObjects;
+ return mxXEmbeddedObjects;
}
Reference< XNameAccess > SwXTextDocument::getBookmarks() throw( RuntimeException, std::exception )
@@ -1280,12 +1269,11 @@ Reference< XNameAccess > SwXTextDocument::getBookmarks() throw( RuntimeExceptio
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXBookmarks)
+ if(!mxXBookmarks.is())
{
- static_cast<SwXTextDocument*>(this)->pxXBookmarks = new Reference< XNameAccess > ;
- *pxXBookmarks = new SwXBookmarks(pDocShell->GetDoc());
+ mxXBookmarks = new SwXBookmarks(pDocShell->GetDoc());
}
- return *pxXBookmarks;
+ return mxXBookmarks;
}
Reference< XNameAccess > SwXTextDocument::getTextSections() throw( RuntimeException, std::exception )
@@ -1293,12 +1281,11 @@ Reference< XNameAccess > SwXTextDocument::getTextSections() throw( RuntimeExcep
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXTextSections)
+ if(!mxXTextSections.is())
{
- static_cast<SwXTextDocument*>(this)->pxXTextSections = new Reference< XNameAccess > ;
- *pxXTextSections = new SwXTextSections(pDocShell->GetDoc());
+ mxXTextSections = new SwXTextSections(pDocShell->GetDoc());
}
- return *pxXTextSections;
+ return mxXTextSections;
}
Reference< XNameAccess > SwXTextDocument::getTextTables() throw( RuntimeException, std::exception )
@@ -1306,12 +1293,11 @@ Reference< XNameAccess > SwXTextDocument::getTextTables() throw( RuntimeExcepti
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXTextTables)
+ if(!mxXTextTables.is())
{
- static_cast<SwXTextDocument*>(this)->pxXTextTables = new Reference< XNameAccess > ;
- *pxXTextTables = new SwXTextTables(pDocShell->GetDoc());
+ mxXTextTables = new SwXTextTables(pDocShell->GetDoc());
}
- return *pxXTextTables;
+ return mxXTextTables;
}
Reference< XNameAccess > SwXTextDocument::getGraphicObjects() throw( RuntimeException, std::exception )
@@ -1319,12 +1305,11 @@ Reference< XNameAccess > SwXTextDocument::getGraphicObjects() throw( RuntimeExc
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXGraphicObjects)
+ if(!mxXGraphicObjects.is())
{
- static_cast<SwXTextDocument*>(this)->pxXGraphicObjects = new Reference< XNameAccess > ;
- *pxXGraphicObjects = new SwXTextGraphicObjects(pDocShell->GetDoc());
+ mxXGraphicObjects = new SwXTextGraphicObjects(pDocShell->GetDoc());
}
- return *pxXGraphicObjects;
+ return mxXGraphicObjects;
}
Reference< XNameAccess > SwXTextDocument::getTextFrames() throw( RuntimeException, std::exception )
@@ -1332,12 +1317,11 @@ Reference< XNameAccess > SwXTextDocument::getTextFrames() throw( RuntimeExcepti
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXTextFrames)
+ if(!mxXTextFrames.is())
{
- static_cast<SwXTextDocument*>(this)->pxXTextFrames = new Reference< XNameAccess > ;
- *pxXTextFrames = new SwXTextFrames(pDocShell->GetDoc());
+ mxXTextFrames = new SwXTextFrames(pDocShell->GetDoc());
}
- return *pxXTextFrames;
+ return mxXTextFrames;
}
Reference< XNameAccess > SwXTextDocument::getStyleFamilies() throw( RuntimeException, std::exception )
@@ -1345,12 +1329,11 @@ Reference< XNameAccess > SwXTextDocument::getStyleFamilies() throw( RuntimeExce
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXStyleFamilies)
+ if(!mxXStyleFamilies.is())
{
- static_cast<SwXTextDocument*>(this)->pxXStyleFamilies = new Reference< XNameAccess > ;
- *pxXStyleFamilies = new SwXStyleFamilies(*pDocShell);
+ mxXStyleFamilies = new SwXStyleFamilies(*pDocShell);
}
- return *pxXStyleFamilies;
+ return mxXStyleFamilies;
}
uno::Reference< style::XAutoStyles > SwXTextDocument::getAutoStyles( )
@@ -1359,12 +1342,11 @@ uno::Reference< style::XAutoStyles > SwXTextDocument::getAutoStyles( )
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXAutoStyles)
+ if(!mxXAutoStyles.is())
{
- pxXAutoStyles = new Reference< style::XAutoStyles > ;
- *pxXAutoStyles = new SwXAutoStyles(*pDocShell);
+ mxXAutoStyles = new SwXAutoStyles(*pDocShell);
}
- return *pxXAutoStyles;
+ return mxXAutoStyles;
}
@@ -1373,17 +1355,17 @@ Reference< drawing::XDrawPage > SwXTextDocument::getDrawPage() throw( RuntimeEx
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXDrawPage)
+ if(!mxXDrawPage.is())
{
static_cast<SwXTextDocument*>(this)->pDrawPage = new SwXDrawPage(pDocShell->GetDoc());
- static_cast<SwXTextDocument*>(this)->pxXDrawPage = new Reference< drawing::XDrawPage >(pDrawPage);
+ static_cast<SwXTextDocument*>(this)->mxXDrawPage = pDrawPage;
// Create a Reference to trigger the complete initialization of the
// object. Otherwise in some corner cases it would get initialized
// at ::InitNewDoc -> which would get called during
// close() or dispose() -> n#681746
- uno::Reference<lang::XComponent> xComp( *pxXDrawPage, uno::UNO_QUERY );
+ uno::Reference<lang::XComponent> xComp( mxXDrawPage, uno::UNO_QUERY );
}
- return *pxXDrawPage;
+ return mxXDrawPage;
}
void SwXTextDocument::Invalidate()
@@ -1420,36 +1402,32 @@ void SwXTextDocument::Reactivate(SwDocShell* pNewDocShell)
void SwXTextDocument::InitNewDoc()
{
// first invalidate all collections, then delete references and Set to zero
- if(pxXTextTables)
+ if(mxXTextTables.is())
{
- XNameAccess* pTables = pxXTextTables->get();
+ XNameAccess* pTables = mxXTextTables.get();
static_cast<SwXTextTables*>(pTables)->Invalidate();
- delete pxXTextTables;
- pxXTextTables = 0;
+ mxXTextTables.clear();
}
- if(pxXTextFrames)
+ if(mxXTextFrames.is())
{
- XNameAccess* pFrms = pxXTextFrames->get();
+ XNameAccess* pFrms = mxXTextFrames.get();
static_cast<SwXTextFrames*>(pFrms)->Invalidate();
- delete pxXTextFrames;
- pxXTextFrames = 0;
+ mxXTextFrames.clear();
}
- if(pxXGraphicObjects)
+ if(mxXGraphicObjects.is())
{
- XNameAccess* pFrms = pxXGraphicObjects->get();
+ XNameAccess* pFrms = mxXGraphicObjects.get();
static_cast<SwXTextGraphicObjects*>(pFrms)->Invalidate();
- delete pxXGraphicObjects;
- pxXGraphicObjects = 0;
+ mxXGraphicObjects.clear();
}
- if(pxXEmbeddedObjects)
+ if(mxXEmbeddedObjects.is())
{
- XNameAccess* pOLE = pxXEmbeddedObjects->get();
+ XNameAccess* pOLE = mxXEmbeddedObjects.get();
static_cast<SwXTextEmbeddedObjects*>(pOLE)->Invalidate();
- delete pxXEmbeddedObjects;
- pxXEmbeddedObjects = 0;
+ mxXEmbeddedObjects.clear();
}
if(xBodyText.is())
@@ -1475,147 +1453,129 @@ void SwXTextDocument::InitNewDoc()
pNumFormat->SetNumberFormatter(0);
}
- if(pxXTextFieldTypes)
+ if(mxXTextFieldTypes.is())
{
- XEnumerationAccess* pT = pxXTextFieldTypes->get();
+ XEnumerationAccess* pT = mxXTextFieldTypes.get();
static_cast<SwXTextFieldTypes*>(pT)->Invalidate();
- delete pxXTextFieldTypes;
- pxXTextFieldTypes = 0;
+ mxXTextFieldTypes.clear();
}
- if(pxXTextFieldMasters)
+ if(mxXTextFieldMasters.is())
{
- XNameAccess* pT = pxXTextFieldMasters->get();
+ XNameAccess* pT = mxXTextFieldMasters.get();
static_cast<SwXTextFieldMasters*>(pT)->Invalidate();
- delete pxXTextFieldMasters;
- pxXTextFieldMasters = 0;
+ mxXTextFieldMasters.clear();
}
- if(pxXTextSections)
+ if(mxXTextSections.is())
{
- XNameAccess* pSect = pxXTextSections->get();
+ XNameAccess* pSect = mxXTextSections.get();
static_cast<SwXTextSections*>(pSect)->Invalidate();
- delete pxXTextSections;
- pxXTextSections = 0;
+ mxXTextSections.clear();
}
- if(pxXDrawPage)
+ if(mxXDrawPage.is())
{
// #i91798#, #i91895#
// dispose XDrawPage here. We are the owner and know that it is no longer in a valid condition.
- uno::Reference<lang::XComponent> xComp( *pxXDrawPage, uno::UNO_QUERY );
+ uno::Reference<lang::XComponent> xComp( mxXDrawPage, uno::UNO_QUERY );
xComp->dispose();
pDrawPage->InvalidateSwDoc();
- delete pxXDrawPage;
- pxXDrawPage = 0;
+ mxXDrawPage.clear();
}
- if ( pxXNumberingRules )
+ if ( mxXNumberingRules.is() )
{
- XIndexAccess* pNum = pxXNumberingRules->get();
+ XIndexAccess* pNum = mxXNumberingRules.get();
static_cast<SwXNumberingRulesCollection*>(pNum)->Invalidate();
- delete pxXNumberingRules;
- pxXNumberingRules = 0;
+ mxXNumberingRules.clear();
}
- if(pxXFootnotes)
+ if(mxXFootnotes.is())
{
- XIndexAccess* pFootnote = pxXFootnotes->get();
+ XIndexAccess* pFootnote = mxXFootnotes.get();
static_cast<SwXFootnotes*>(pFootnote)->Invalidate();
- delete pxXFootnotes;
- pxXFootnotes = 0;
+ mxXFootnotes.clear();
}
- if(pxXEndnotes)
+ if(mxXEndnotes.is())
{
- XIndexAccess* pFootnote = pxXEndnotes->get();
+ XIndexAccess* pFootnote = mxXEndnotes.get();
static_cast<SwXFootnotes*>(pFootnote)->Invalidate();
- delete pxXEndnotes;
- pxXEndnotes = 0;
+ mxXEndnotes.clear();
}
- if(pxXDocumentIndexes)
+ if(mxXDocumentIndexes.is())
{
- XIndexAccess* pIdxs = pxXDocumentIndexes->get();
+ XIndexAccess* pIdxs = mxXDocumentIndexes.get();
static_cast<SwXDocumentIndexes*>(pIdxs)->Invalidate();
- delete pxXDocumentIndexes;
- pxXDocumentIndexes = 0;
+ mxXDocumentIndexes.clear();
}
- if(pxXStyleFamilies)
+ if(mxXStyleFamilies.is())
{
- XNameAccess* pStyles = pxXStyleFamilies->get();
+ XNameAccess* pStyles = mxXStyleFamilies.get();
static_cast<SwXStyleFamilies*>(pStyles)->Invalidate();
- delete pxXStyleFamilies;
- pxXStyleFamilies = 0;
+ mxXStyleFamilies.clear();
}
- if(pxXAutoStyles)
+ if(mxXAutoStyles.is())
{
- XNameAccess* pStyles = pxXAutoStyles->get();
+ XNameAccess* pStyles = mxXAutoStyles.get();
static_cast<SwXAutoStyles*>(pStyles)->Invalidate();
- delete pxXAutoStyles;
- pxXAutoStyles = 0;
+ mxXAutoStyles.clear();
}
- if(pxXBookmarks)
+ if(mxXBookmarks.is())
{
- XNameAccess* pBm = pxXBookmarks->get();
+ XNameAccess* pBm = mxXBookmarks.get();
static_cast<SwXBookmarks*>(pBm)->Invalidate();
- delete pxXBookmarks;
- pxXBookmarks = 0;
+ mxXBookmarks.clear();
}
- if(pxXChapterNumbering)
+ if(mxXChapterNumbering.is())
{
- XIndexReplace* pCh = pxXChapterNumbering->get();
+ XIndexReplace* pCh = mxXChapterNumbering.get();
static_cast<SwXChapterNumbering*>(pCh)->Invalidate();
- delete pxXChapterNumbering;
- pxXChapterNumbering = 0;
+ mxXChapterNumbering.clear();
}
- if(pxXFootnoteSettings)
+ if(mxXFootnoteSettings.is())
{
- XPropertySet* pFntSet = pxXFootnoteSettings->get();
+ XPropertySet* pFntSet = mxXFootnoteSettings.get();
static_cast<SwXFootnoteProperties*>(pFntSet)->Invalidate();
- delete pxXFootnoteSettings;
- pxXFootnoteSettings = 0;
+ mxXFootnoteSettings.clear();
}
- if(pxXEndnoteSettings)
+ if(mxXEndnoteSettings.is())
{
- XPropertySet* pEndSet = pxXEndnoteSettings->get();
+ XPropertySet* pEndSet = mxXEndnoteSettings.get();
static_cast<SwXEndnoteProperties*>(pEndSet)->Invalidate();
- delete pxXEndnoteSettings;
- pxXEndnoteSettings = 0;
+ mxXEndnoteSettings.clear();
}
- if(pxXLineNumberingProperties)
+ if(mxXLineNumberingProperties.is())
{
- XPropertySet* pLine = pxXLineNumberingProperties->get();
+ XPropertySet* pLine = mxXLineNumberingProperties.get();
static_cast<SwXLineNumberingProperties*>(pLine)->Invalidate();
- delete pxXLineNumberingProperties;
- pxXLineNumberingProperties = 0;
+ mxXLineNumberingProperties.clear();
}
- if(pxXReferenceMarks)
+ if(mxXReferenceMarks.is())
{
- XNameAccess* pMarks = pxXReferenceMarks->get();
+ XNameAccess* pMarks = mxXReferenceMarks.get();
static_cast<SwXReferenceMarks*>(pMarks)->Invalidate();
- delete pxXReferenceMarks;
- pxXReferenceMarks = 0;
+ mxXReferenceMarks.clear();
}
- if(pxLinkTargetSupplier)
+ if(mxLinkTargetSupplier.is())
{
- XNameAccess* pAccess = (*pxLinkTargetSupplier).get();
+ XNameAccess* pAccess = mxLinkTargetSupplier.get();
static_cast<SwXLinkTargetSupplier*>(pAccess)->Invalidate();
- delete pxLinkTargetSupplier;
- pxLinkTargetSupplier = 0;
+ mxLinkTargetSupplier.clear();
}
- if(pxXRedlines)
+ if(mxXRedlines.is())
{
- XEnumerationAccess* pMarks = pxXRedlines->get();
+ XEnumerationAccess* pMarks = mxXRedlines.get();
static_cast<SwXRedlines*>(pMarks)->Invalidate();
- delete pxXRedlines;
- pxXRedlines = 0;
+ mxXRedlines.clear();
}
if(xPropertyHelper.is())
{
@@ -1805,12 +1765,11 @@ Reference< XIndexAccess > SwXTextDocument::getDocumentIndexes() throw( RuntimeE
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
- if(!pxXDocumentIndexes)
+ if(!mxXDocumentIndexes.is())
{
- static_cast<SwXTextDocument*>(this)->pxXDocumentIndexes = new Reference< XIndexAccess > ;
- *pxXDocumentIndexes = new SwXDocumentIndexes(pDocShell->GetDoc());
+ mxXDocumentIndexes = new SwXDocumentIndexes(pDocShell->GetDoc());
}
- return *pxXDocumentIndexes;
+ return mxXDocumentIndexes;
}
Reference< XPropertySetInfo > SwXTextDocument::getPropertySetInfo() throw( RuntimeException, std::exception )
@@ -2186,22 +2145,20 @@ void SwXTextDocument::removeVetoableChangeListener(const OUString& /*PropertyNam
Reference< XNameAccess > SwXTextDocument::getLinks() throw( RuntimeException, std::exception )
{
- if(!pxLinkTargetSupplier)
+ if(!mxLinkTargetSupplier.is())
{
- pxLinkTargetSupplier = new Reference< XNameAccess > ;
- (*pxLinkTargetSupplier) = new SwXLinkTargetSupplier(*this);
+ mxLinkTargetSupplier = new SwXLinkTargetSupplier(*this);
}
- return (*pxLinkTargetSupplier);
+ return mxLinkTargetSupplier;
}
Reference< XEnumerationAccess > SwXTextDocument::getRedlines( ) throw(RuntimeException, std::exception)
{
- if(!pxXRedlines)
+ if(!mxXRedlines.is())
{
- pxXRedlines = new Reference< XEnumerationAccess > ;
- (*pxXRedlines) = new SwXRedlines(pDocShell->GetDoc());
+ mxXRedlines = new SwXRedlines(pDocShell->GetDoc());
}
- return *pxXRedlines;
+ return mxXRedlines;
}
void SwXTextDocument::NotifyRefreshListeners()
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 9b8a22effcf2..2871760addac 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -92,8 +92,8 @@ SwXTextView::SwXTextView(SwView* pSwView) :
m_SelChangedListeners(m_aMutex),
m_pView(pSwView),
m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_VIEW ) ),
- pxViewSettings(0),
- pxTextViewCursor(0)
+ mxViewSettings(),
+ mxTextViewCursor()
{
}
@@ -105,17 +105,17 @@ SwXTextView::~SwXTextView()
void SwXTextView::Invalidate()
{
- if(pxViewSettings)
+ if(mxViewSettings.is())
{
- HelperBaseNoState *pSettings = static_cast < HelperBaseNoState * > ( pxViewSettings->get() );
+ HelperBaseNoState *pSettings = static_cast < HelperBaseNoState * > ( mxViewSettings.get() );
static_cast < SwXViewSettings* > ( pSettings )->Invalidate();
- DELETEZ(pxViewSettings);
+ mxViewSettings.clear();
}
- if(pxTextViewCursor)
+ if(mxTextViewCursor.is())
{
- text::XTextViewCursor* pCrsr = pxTextViewCursor->get();
+ text::XTextViewCursor* pCrsr = mxTextViewCursor.get();
static_cast<SwXTextViewCursor*>(pCrsr)->Invalidate();
- DELETEZ(pxTextViewCursor);
+ mxTextViewCursor.clear();
}
m_refCount++; //prevent second d'tor call
@@ -497,12 +497,11 @@ uno::Reference< text::XTextViewCursor > SwXTextView::getViewCursor() throw( uno
SolarMutexGuard aGuard;
if(GetView())
{
- if(!pxTextViewCursor)
+ if(!mxTextViewCursor.is())
{
- static_cast<SwXTextView*>(this)->pxTextViewCursor = new uno::Reference< text::XTextViewCursor > ;
- *pxTextViewCursor = new SwXTextViewCursor(GetView());
+ mxTextViewCursor = new SwXTextViewCursor(GetView());
}
- return *pxTextViewCursor;
+ return mxTextViewCursor;
}
else
throw uno::RuntimeException();
@@ -513,15 +512,14 @@ uno::Reference< beans::XPropertySet > SwXTextView::getViewSettings() throw( uno
SolarMutexGuard aGuard;
if(m_pView)
{
- if(!pxViewSettings)
+ if(!mxViewSettings.is())
{
- static_cast<SwXTextView*>(this)->pxViewSettings = new uno::Reference< beans::XPropertySet > ;
- *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( false, m_pView ) );
+ mxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( false, m_pView ) );
}
}
else
throw uno::RuntimeException();
- return *pxViewSettings;
+ return mxViewSettings;
}
Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAutomatic*/ )
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index b1b809e6e899..4c6c20adb897 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -52,9 +52,7 @@ VCLXMenu::VCLXMenu( Menu* pMenu )
VCLXMenu::~VCLXMenu()
{
- for ( size_t n = maPopupMenuRefs.size(); n; ) {
- delete maPopupMenuRefs[ --n ];
- }
+ maPopupMenuRefs.clear();
if ( mpMenu )
{
mpMenu->RemoveEventListener( LINK( this, VCLXMenu, MenuEventListener ) );
@@ -425,10 +423,7 @@ throw(css::uno::RuntimeException, std::exception)
if ( mpMenu && pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu() )
{
- // Selbst eine Ref halten!
- css::uno::Reference< css::awt::XPopupMenu > * pNewRef = new css::uno::Reference< css::awt::XPopupMenu > ;
- *pNewRef = rxPopupMenu;
- maPopupMenuRefs.push_back( pNewRef );
+ maPopupMenuRefs.push_back( rxPopupMenu );
mpMenu->SetPopupMenu( nItemId, static_cast<PopupMenu*>( pVCLMenu->GetMenu() ) );
}
@@ -447,11 +442,11 @@ throw(css::uno::RuntimeException, std::exception)
{
for ( size_t n = maPopupMenuRefs.size(); n; )
{
- css::uno::Reference< css::awt::XPopupMenu > * pRef = maPopupMenuRefs[ --n ];
- Menu* pM = static_cast<VCLXMenu*>(pRef->get())->GetMenu();
+ css::uno::Reference< css::awt::XPopupMenu >& rRef = maPopupMenuRefs[ --n ];
+ Menu* pM = static_cast<VCLXMenu*>(rRef.get())->GetMenu();
if ( pM == pMenu )
{
- aRef = *pRef;
+ aRef = rRef;
break;
}
}