summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/docvw')
-rw-r--r--sw/source/uibase/docvw/AnnotationMenuButton.cxx6
-rw-r--r--sw/source/uibase/docvw/AnnotationMenuButton.hxx1
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx10
-rw-r--r--sw/source/uibase/docvw/FrameControlsManager.cxx5
-rw-r--r--sw/source/uibase/docvw/HeaderFooterWin.cxx10
-rw-r--r--sw/source/uibase/docvw/PageBreakWin.cxx17
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx14
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx6
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.hxx1
-rw-r--r--sw/source/uibase/docvw/SidebarWin.cxx35
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx24
-rw-r--r--sw/source/uibase/docvw/frmsidebarwincontainer.cxx2
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx21
13 files changed, 111 insertions, 41 deletions
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
index fbbed6ba7b40..14c486369ca8 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
@@ -58,7 +58,13 @@ AnnotationMenuButton::AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rS
AnnotationMenuButton::~AnnotationMenuButton()
{
+ disposeOnce();
+}
+
+void AnnotationMenuButton::dispose()
+{
RemoveEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) );
+ MenuButton::dispose();
}
void AnnotationMenuButton::Select()
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.hxx b/sw/source/uibase/docvw/AnnotationMenuButton.hxx
index 1bc2c13a56c1..9682bcf491fe 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.hxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.hxx
@@ -33,6 +33,7 @@ class AnnotationMenuButton : public MenuButton
public:
AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin );
virtual ~AnnotationMenuButton();
+ virtual void dispose() SAL_OVERRIDE;
// override MenuButton methods
virtual void Select() SAL_OVERRIDE;
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 5cff22259e9b..2ea841068127 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -70,7 +70,13 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
SwAnnotationWin::~SwAnnotationWin()
{
+ disposeOnce();
+}
+
+void SwAnnotationWin::dispose()
+{
delete mpButtonPopup;
+ sw::sidebarwindows::SwSidebarWin::dispose();
}
void SwAnnotationWin::SetPostItText()
@@ -207,7 +213,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing()
return aCount - 1;
}
-MenuButton* SwAnnotationWin::CreateMenuButton()
+VclPtr<MenuButton> SwAnnotationWin::CreateMenuButton()
{
mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON));
OUString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR );
@@ -215,7 +221,7 @@ MenuButton* SwAnnotationWin::CreateMenuButton()
aRewriter.AddRule(UndoArg1,GetAuthor());
aText = aRewriter.Apply(aText);
mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
- MenuButton* pMenuButton = new AnnotationMenuButton( *this );
+ VclPtr<MenuButton> pMenuButton( new AnnotationMenuButton( *this ), SAL_NO_ACQUIRE );
pMenuButton->SetPopupMenu( mpButtonPopup );
pMenuButton->Show();
return pMenuButton;
diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx
index 7cd0e7f53319..e16809626414 100644
--- a/sw/source/uibase/docvw/FrameControlsManager.cxx
+++ b/sw/source/uibase/docvw/FrameControlsManager.cxx
@@ -34,6 +34,11 @@ SwFrameControlsManager::SwFrameControlsManager( const SwFrameControlsManager& rC
{
}
+void SwFrameControlsManager::dispose()
+{
+ m_aControls.clear();
+}
+
const SwFrameControlsManager& SwFrameControlsManager::operator=( const SwFrameControlsManager& rCopy )
{
m_pEditWin = rCopy.m_pEditWin;
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 43dc81dac543..61dcbd21964e 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -143,7 +143,7 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag
SetMapMode( MapMode ( MAP_PIXEL ) );
// Create the line control
- m_pLine = new SwDashedLine( GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor );
+ m_pLine = VclPtr<SwDashedLine>::Create( GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor );
m_pLine->SetZOrder( this, WINDOW_ZORDER_BEFOR );
// Create and set the PopupMenu
@@ -169,8 +169,14 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag
SwHeaderFooterWin::~SwHeaderFooterWin( )
{
+ disposeOnce();
+}
+
+void SwHeaderFooterWin::dispose()
+{
delete m_pPopupMenu;
- delete m_pLine;
+ m_pLine.disposeAndClear();
+ MenuButton::dispose();
}
const SwPageFrm* SwHeaderFooterWin::GetPageFrame( )
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index 42027fbea9ed..d806eb332395 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -56,12 +56,14 @@ namespace
class SwBreakDashedLine : public SwDashedLine
{
private:
- SwPageBreakWin* m_pWin;
+ VclPtr<SwPageBreakWin> m_pWin;
public:
SwBreakDashedLine( vcl::Window* pParent, Color& ( *pColorFn )(), SwPageBreakWin* pWin ) :
SwDashedLine( pParent, pColorFn ),
m_pWin( pWin ) {};
+ virtual ~SwBreakDashedLine() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_pWin.clear(); SwDashedLine::dispose(); }
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
};
@@ -103,7 +105,7 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
SetMapMode( MapMode ( MAP_PIXEL ) );
// Create the line control
- m_pLine = new SwBreakDashedLine( GetEditWin(), &SwViewOption::GetPageBreakColor, this );
+ m_pLine = VclPtr<SwBreakDashedLine>::Create( GetEditWin(), &SwViewOption::GetPageBreakColor, this );
// Create the popup menu
m_pPopupMenu = new PopupMenu( SW_RES( MN_PAGEBREAK_BUTTON ) );
@@ -116,12 +118,21 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
SwPageBreakWin::~SwPageBreakWin( )
{
+ disposeOnce();
+}
+
+void SwPageBreakWin::dispose()
+{
m_bDestroyed = true;
m_aFadeTimer.Stop();
+ m_pLine.disposeAndClear();
delete m_pPopupMenu;
- delete m_pLine;
+ m_pPopupMenu = NULL;
delete m_pMousePt;
+ m_pMousePt = NULL;
+
+ MenuButton::dispose();
}
void SwPageBreakWin::Paint( const Rectangle& )
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 7b36acd7ccb3..09357e2b40b8 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -193,8 +193,7 @@ void SwPostItMgr::CheckForRemovedPostIts()
mvPostItFlds.remove(*it);
if (GetActiveSidebarWin() == p->pPostIt)
SetActiveSidebarWin(0);
- if (p->pPostIt)
- delete p->pPostIt;
+ p->pPostIt.disposeAndClear();
delete p;
bRemoved = true;
}
@@ -243,8 +242,8 @@ void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast )
SwSidebarItem* p = (*i);
if (GetActiveSidebarWin() == p->pPostIt)
SetActiveSidebarWin(0);
+ p->pPostIt.disposeAndClear();
mvPostItFlds.erase(i);
- delete p->pPostIt;
delete p;
break;
}
@@ -1178,8 +1177,7 @@ void SwPostItMgr::RemoveSidebarWin()
for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i)
{
EndListening( *(const_cast<SfxBroadcaster*>((*i)->GetBroadCaster())) );
- if ((*i)->pPostIt)
- delete (*i)->pPostIt;
+ (*i)->pPostIt.disposeAndClear();
delete (*i);
}
mvPostItFlds.clear();
@@ -1498,7 +1496,7 @@ sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItFie
for(const_iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i)
{
if ( (*i)->GetFmtFld().GetField() == pFld )
- return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt);
+ return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt.get());
}
return NULL;
}
@@ -2031,13 +2029,13 @@ void SwPostItMgr::AssureStdModeAtShell()
bool SwPostItMgr::HasActiveSidebarWin() const
{
- return mpActivePostIt != 0;
+ return mpActivePostIt != nullptr;
}
bool SwPostItMgr::HasActiveAnnotationWin() const
{
return HasActiveSidebarWin() &&
- dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt) != 0;
+ dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt.get()) != 0;
}
void SwPostItMgr::GrabFocusOnActiveSidebarWin()
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 88f5316b9ad9..fcb3eb65e4c7 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -70,7 +70,13 @@ SidebarTxtControl::SidebarTxtControl( SwSidebarWin& rSidebarWin,
SidebarTxtControl::~SidebarTxtControl()
{
+ disposeOnce();
+}
+
+void SidebarTxtControl::dispose()
+{
RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+ Control::dispose();
}
OutlinerView* SidebarTxtControl::GetTextView() const
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
index f14502031f98..4bd1fe89b7d8 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
@@ -58,6 +58,7 @@ class SidebarTxtControl : public Control
SwView& rDocView,
SwPostItMgr& rPostItMgr );
virtual ~SidebarTxtControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 93b3cae87068..d9485d76dda2 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -137,6 +137,14 @@ SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin,
SwSidebarWin::~SwSidebarWin()
{
+ disposeOnce();
+}
+
+void SwSidebarWin::dispose()
+{
+ if (IsDisposed())
+ return;
+
mrMgr.DisconnectSidebarWinFromFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
*this );
@@ -148,9 +156,8 @@ SwSidebarWin::~SwSidebarWin()
{
mpOutlinerView->SetWindow( 0 );
}
- delete mpSidebarTxtControl;
- mpSidebarTxtControl = 0;
}
+ mpSidebarTxtControl.disposeAndClear();
if ( mpOutlinerView )
{
@@ -167,23 +174,20 @@ SwSidebarWin::~SwSidebarWin()
if (mpMetadataAuthor)
{
mpMetadataAuthor->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
- delete mpMetadataAuthor;
- mpMetadataAuthor = 0;
}
+ mpMetadataAuthor.disposeAndClear();
if (mpMetadataDate)
{
mpMetadataDate->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
- delete mpMetadataDate;
- mpMetadataDate = 0;
}
+ mpMetadataDate.disposeAndClear();
if (mpVScrollbar)
{
mpVScrollbar->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
- delete mpVScrollbar;
- mpVScrollbar = 0;
}
+ mpVScrollbar.disposeAndClear();
RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
@@ -196,11 +200,12 @@ SwSidebarWin::~SwSidebarWin()
delete mpTextRangeOverlay;
mpTextRangeOverlay = NULL;
- delete mpMenuButton;
- mpMenuButton = 0;
+ mpMenuButton.disposeAndClear();
if (mnEventId)
Application::RemoveUserEvent( mnEventId );
+
+ vcl::Window::dispose();
}
void SwSidebarWin::Paint( const Rectangle& rRect)
@@ -351,13 +356,13 @@ void SwSidebarWin::InitControls()
AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
// actual window which holds the user text
- mpSidebarTxtControl = new SidebarTxtControl( *this,
+ mpSidebarTxtControl = VclPtr<SidebarTxtControl>::Create( *this,
WB_NODIALOGCONTROL,
mrView, mrMgr );
mpSidebarTxtControl->SetPointer(Pointer(POINTER_TEXT));
// window controls for author and date
- mpMetadataAuthor = new Edit( this, 0 );
+ mpMetadataAuthor = VclPtr<Edit>::Create( this, 0 );
mpMetadataAuthor->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
mpMetadataAuthor->EnableRTL(AllSettings::GetLayoutRTL());
mpMetadataAuthor->SetReadOnly();
@@ -376,7 +381,7 @@ void SwSidebarWin::InitControls()
mpMetadataAuthor->SetSettings(aSettings);
}
- mpMetadataDate = new Edit( this, 0 );
+ mpMetadataDate = VclPtr<Edit>::Create( this, 0 );
mpMetadataDate->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_DATE_NAME ) );
mpMetadataDate->EnableRTL(AllSettings::GetLayoutRTL());
mpMetadataDate->SetReadOnly();
@@ -410,7 +415,7 @@ void SwSidebarWin::InitControls()
mpOutlinerView->SetAttribs(DefaultItem());
//create Scrollbars
- mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ mpVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
mpVScrollbar->EnableNativeWidget(false);
mpVScrollbar->EnableRTL( false );
mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl));
@@ -1370,7 +1375,7 @@ void SwSidebarWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayo
bool SwSidebarWin::HasScrollbar() const
{
- return mpVScrollbar != 0;
+ return mpVScrollbar != nullptr;
}
bool SwSidebarWin::IsScrollbarVisible() const
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 22b968a1b4e3..71042f0aa7aa 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -4968,17 +4968,36 @@ SwEditWin::SwEditWin(vcl::Window *pParent, SwView &rMyView):
SwEditWin::~SwEditWin()
{
+ disposeOnce();
+}
+
+void SwEditWin::dispose()
+{
m_aKeyInputTimer.Stop();
+
delete m_pShadCrsr;
+ m_pShadCrsr = NULL;
+
delete m_pRowColumnSelectionStart;
+ m_pRowColumnSelectionStart = NULL;
+
if( m_pQuickHlpData->m_bIsDisplayed && m_rView.GetWrtShellPtr() )
m_pQuickHlpData->Stop( m_rView.GetWrtShell() );
g_bExecuteDrag = false;
delete m_pApplyTempl;
+ m_pApplyTempl = NULL;
+
m_rView.SetDrawFuncPtr(NULL);
delete m_pUserMarker;
+ m_pUserMarker = NULL;
+
delete m_pAnchorMarker;
+ m_pAnchorMarker = NULL;
+
+ m_aFrameControlsManager.dispose();
+
+ vcl::Window::dispose();
}
/**
@@ -5061,9 +5080,10 @@ void SwEditWin::GetFocus()
void SwEditWin::LoseFocus()
{
- m_rView.GetWrtShell().InvalidateAccessibleFocus();
+ if (m_rView.GetWrtShellPtr())
+ m_rView.GetWrtShell().InvalidateAccessibleFocus();
Window::LoseFocus();
- if( m_pQuickHlpData->m_bIsDisplayed )
+ if( m_pQuickHlpData && m_pQuickHlpData->m_bIsDisplayed )
m_pQuickHlpData->Stop( m_rView.GetWrtShell() );
}
diff --git a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
index 75ab9e95312b..2c037ffaf4bb 100644
--- a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
+++ b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
@@ -48,7 +48,7 @@ namespace {
}
};
- typedef ::std::map < SidebarWinKey, sw::sidebarwindows::SwSidebarWin*, SidebarWinOrder > SidebarWinContainer;
+ typedef ::std::map < SidebarWinKey, VclPtr<sw::sidebarwindows::SwSidebarWin>, SidebarWinOrder > SidebarWinContainer;
struct FrmKey
{
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index c4042d812873..5d2dac64c01f 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -268,7 +268,12 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView )
n->addPropertiesChangeListener(s, listener_.get());
}
- SwSrcEditWindow::~SwSrcEditWindow()
+SwSrcEditWindow::~SwSrcEditWindow()
+{
+ disposeOnce();
+}
+
+void SwSrcEditWindow::dispose()
{
css::uno::Reference< css::beans::XMultiPropertySet > n;
{
@@ -284,13 +289,13 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView )
EndListening( *pTextEngine );
pTextEngine->RemoveView( pTextView );
- delete pHScrollbar;
- delete pVScrollbar;
-
delete pTextView;
delete pTextEngine;
}
- delete pOutWin;
+ pHScrollbar.disposeAndClear();
+ pVScrollbar.disposeAndClear();
+ pOutWin.disposeAndClear();
+ vcl::Window::dispose();
}
void SwSrcEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
@@ -482,18 +487,18 @@ void TextViewOutWin::Paint( const Rectangle& rRect )
void SwSrcEditWindow::CreateTextEngine()
{
const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor();
- pOutWin = new TextViewOutWin(this, 0);
+ pOutWin = VclPtr<TextViewOutWin>::Create(this, 0);
pOutWin->SetBackground(Wallpaper(rCol));
pOutWin->SetPointer(Pointer(POINTER_TEXT));
pOutWin->Show();
// create Scrollbars
- pHScrollbar = new ScrollBar(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG);
+ pHScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG);
pHScrollbar->EnableRTL( false ); // --- RTL --- no mirroring for scrollbars
pHScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl));
pHScrollbar->Show();
- pVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ pVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
pVScrollbar->EnableRTL( false ); // --- RTL --- no mirroring for scrollbars
pVScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl));
pHScrollbar->EnableDrag();