summaryrefslogtreecommitdiff
path: root/sd/source/ui/annotations
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/annotations')
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx7
-rw-r--r--sd/source/ui/annotations/annotationtag.cxx22
-rw-r--r--sd/source/ui/annotations/annotationtag.hxx4
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx25
-rw-r--r--sd/source/ui/annotations/annotationwindow.hxx10
5 files changed, 41 insertions, 27 deletions
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index b856cb1e0b89..21614cd73662 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -694,10 +694,9 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward)
// Pop up question box that asks the user whether to wrap around.
// The dialog is made modal with respect to the whole application.
- QueryBox aQuestionBox ( NULL, (WB_YES_NO | WB_DEF_YES), SD_RESSTR(nStringId));
- aQuestionBox.SetImage (QueryBox::GetStandardImage());
- short nBoxResult = aQuestionBox.Execute();
- if (nBoxResult != RET_YES)
+ ScopedVclPtrInstance< QueryBox > aQuestionBox( nullptr, (WB_YES_NO | WB_DEF_YES), SD_RESSTR(nStringId));
+ aQuestionBox->SetImage( QueryBox::GetStandardImage() );
+ if (aQuestionBox->Execute() != RET_YES)
break;
}
while( true );
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 610ed613588f..ae9dc833b3fe 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -515,19 +515,19 @@ void AnnotationTag::deselect()
BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected )
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
OUString sAuthor( getInitials( mxAnnotation->getAuthor() ) );
sAuthor += OUString( ' ' );
sAuthor += OUString::number( mnIndex );
- aVDev.SetFont( mrFont );
+ pVDev->SetFont( mrFont );
const int BORDER_X = 4; // pixels
const int BORDER_Y = 4; // pixels
- maSize = Size( aVDev.GetTextWidth( sAuthor ) + 2*BORDER_X, aVDev.GetTextHeight() + 2*BORDER_Y );
- aVDev.SetOutputSizePixel( maSize, false );
+ maSize = Size( pVDev->GetTextWidth( sAuthor ) + 2*BORDER_X, pVDev->GetTextHeight() + 2*BORDER_Y );
+ pVDev->SetOutputSizePixel( maSize, false );
Color aBorderColor( maColor );
@@ -549,14 +549,14 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected )
Point aPos;
Rectangle aBorderRect( aPos, maSize );
- aVDev.SetLineColor(aBorderColor);
- aVDev.SetFillColor(maColor);
- aVDev.DrawRect( aBorderRect );
+ pVDev->SetLineColor(aBorderColor);
+ pVDev->SetFillColor(maColor);
+ pVDev->DrawRect( aBorderRect );
- aVDev.SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK );
- aVDev.DrawText( Point( BORDER_X, BORDER_Y ), sAuthor );
+ pVDev->SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK );
+ pVDev->DrawText( Point( BORDER_X, BORDER_Y ), sAuthor );
- return aVDev.GetBitmapEx( aPos, maSize );
+ return pVDev->GetBitmapEx( aPos, maSize );
}
void AnnotationTag::OpenPopup( bool bEdit )
@@ -577,7 +577,7 @@ void AnnotationTag::OpenPopup( bool bEdit )
Rectangle aRect( aPos, maSize );
- mpAnnotationWindow.reset( new AnnotationWindow( mrManager, mrView.GetDocSh(), pWindow->GetWindow(WINDOW_FRAME) ) );
+ mpAnnotationWindow.reset( VclPtr<AnnotationWindow>::Create( mrManager, mrView.GetDocSh(), pWindow->GetWindow(WINDOW_FRAME) ) );
mpAnnotationWindow->InitControls();
mpAnnotationWindow->setAnnotation(mxAnnotation);
diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx
index 96085f253fcb..d53c5445f4d7 100644
--- a/sd/source/ui/annotations/annotationtag.hxx
+++ b/sd/source/ui/annotations/annotationtag.hxx
@@ -79,13 +79,13 @@ protected:
private:
AnnotationManagerImpl& mrManager;
css::uno::Reference< css::office::XAnnotation > mxAnnotation;
- std::unique_ptr<AnnotationWindow> mpAnnotationWindow;
+ VclPtr<AnnotationWindow> mpAnnotationWindow;
Color maColor;
int mnIndex;
const ::vcl::Font& mrFont;
Size maSize;
ImplSVEvent * mnClosePopupEvent;
- vcl::Window* mpListenWindow;
+ VclPtr<vcl::Window> mpListenWindow;
Point maMouseDownPos;
};
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 9129ca8f952b..830180347e13 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -118,6 +118,13 @@ AnnotationTextWindow::AnnotationTextWindow( AnnotationWindow* pParent, WinBits n
AnnotationTextWindow::~AnnotationTextWindow()
{
+ disposeOnce();
+}
+
+void AnnotationTextWindow::dispose()
+{
+ mpAnnotationWindow.clear();
+ Control::dispose();
}
void AnnotationTextWindow::Paint( const Rectangle& rRect)
@@ -284,21 +291,27 @@ AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShel
AnnotationWindow::~AnnotationWindow()
{
- delete mpMeta;
+ disposeOnce();
+}
+
+void AnnotationWindow::dispose()
+{
+ mpMeta.disposeAndClear();
delete mpOutlinerView;
delete mpOutliner;
- delete mpVScrollbar;
- delete mpTextWindow;
+ mpVScrollbar.disposeAndClear();
+ mpTextWindow.disposeAndClear();
+ FloatingWindow::dispose();
}
void AnnotationWindow::InitControls()
{
// actual window which holds the user text
- mpTextWindow = new AnnotationTextWindow(this, WB_NODIALOGCONTROL);
+ mpTextWindow = VclPtr<AnnotationTextWindow>::Create(this, WB_NODIALOGCONTROL);
mpTextWindow->SetPointer(Pointer(POINTER_TEXT));
// window control for author and date
- mpMeta = new MultiLineEdit(this,0);
+ mpMeta = VclPtr<MultiLineEdit>::Create(this,0);
mpMeta->SetReadOnly();
mpMeta->SetRightToLeft(AllSettings::GetLayoutRTL());
mpMeta->AlwaysDisableInput(true);
@@ -332,7 +345,7 @@ void AnnotationWindow::InitControls()
mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
//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, AnnotationWindow, ScrollHdl));
diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx
index f8adcdf99a81..766ea975b31f 100644
--- a/sd/source/ui/annotations/annotationwindow.hxx
+++ b/sd/source/ui/annotations/annotationwindow.hxx
@@ -50,7 +50,7 @@ class AnnotationTextWindow : public Control
{
private:
OutlinerView* mpOutlinerView;
- AnnotationWindow* mpAnnotationWindow;
+ VclPtr<AnnotationWindow> mpAnnotationWindow;
protected:
virtual void Paint( const Rectangle& rRect) SAL_OVERRIDE;
@@ -64,6 +64,7 @@ protected:
public:
AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits );
virtual ~AnnotationTextWindow();
+ virtual void dispose() SAL_OVERRIDE;
void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; }
@@ -83,13 +84,13 @@ class AnnotationWindow : public FloatingWindow
OutlinerView* mpOutlinerView;
Outliner* mpOutliner;
- ScrollBar* mpVScrollbar;
+ VclPtr<ScrollBar> mpVScrollbar;
::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation;
bool mbReadonly;
bool mbProtected;
bool mbMouseOverButton;
- AnnotationTextWindow* mpTextWindow;
- MultiLineEdit* mpMeta;
+ VclPtr<AnnotationTextWindow> mpTextWindow;
+ VclPtr<MultiLineEdit> mpMeta;
Rectangle maRectMetaButton;
basegfx::B2DPolygon maPopupTriangle;
@@ -102,6 +103,7 @@ class AnnotationWindow : public FloatingWindow
public:
AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, vcl::Window* pParent );
virtual ~AnnotationWindow();
+ virtual void dispose() SAL_OVERRIDE;
void StartEdit();