diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 11:41:31 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:08:48 +0100 |
commit | e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch) | |
tree | b322529f4a54a6427862cb20cb4cf87fb6a5d065 /avmedia | |
parent | 2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff) | |
parent | 0cde74f788a054fa2b65107a030dd463b8d11c7a (diff) |
Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts.
Conflicts:
accessibility/source/extended/accessiblelistbox.cxx
accessibility/source/standard/vclxaccessiblecombobox.cxx
accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
accessibility/source/standard/vclxaccessiblelistbox.cxx
accessibility/source/standard/vclxaccessibletextfield.cxx
basctl/source/basicide/basidesh.cxx
cui/source/inc/chardlg.hxx
cui/source/tabpages/tpbitmap.cxx
dbaccess/source/ui/dlg/UserAdmin.cxx
dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
extensions/source/propctrlr/propertyeditor.hxx
extensions/source/scanner/sanedlg.cxx
filter/source/pdf/impdialog.cxx
include/sfx2/mgetempl.hxx
include/sfx2/sidebar/SidebarToolBox.hxx
include/sfx2/viewsh.hxx
include/svtools/brwbox.hxx
include/svtools/filectrl.hxx
include/svtools/scrwin.hxx
include/svx/dlgctrl.hxx
include/svx/sidebar/Popup.hxx
include/svx/sidebar/PopupContainer.hxx
include/svx/sidebar/PopupControl.hxx
include/svx/sidebar/SidebarDialControl.hxx
include/svx/sidebar/ValueSetWithTextControl.hxx
sc/source/ui/condformat/condformatdlgentry.cxx
sc/source/ui/navipi/navipi.cxx
sc/source/ui/sidebar/CellBorderStyleControl.hxx
sd/source/ui/animations/CustomAnimationDialog.cxx
sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/Ruler.hxx
sd/source/ui/inc/SlideSorter.hxx
sd/source/ui/inc/ViewTabBar.hxx
sd/source/ui/inc/Window.hxx
sd/source/ui/inc/morphdlg.hxx
sd/source/ui/inc/sdpreslt.hxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
sd/source/ui/sidebar/LayoutMenu.hxx
sd/source/ui/sidebar/MasterPagesSelector.hxx
sd/source/ui/sidebar/NavigatorWrapper.hxx
sd/source/ui/sidebar/PanelBase.hxx
sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
sd/source/ui/slideshow/showwindow.hxx
sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
sd/source/ui/view/ViewShellBase.cxx
sd/source/ui/view/drviewsa.cxx
sfx2/source/appl/fileobj.hxx
sfx2/source/appl/opengrf.cxx
sfx2/source/control/thumbnailviewacc.hxx
sfx2/source/dialog/securitypage.cxx
sfx2/source/dialog/templdlg.cxx
sfx2/source/doc/docinsert.cxx
sfx2/source/doc/guisaveas.cxx
sfx2/source/inc/alienwarn.hxx
sfx2/source/sidebar/Deck.cxx
sfx2/source/sidebar/Deck.hxx
sfx2/source/sidebar/DeckTitleBar.cxx
sfx2/source/sidebar/DeckTitleBar.hxx
sfx2/source/sidebar/MenuButton.cxx
sfx2/source/sidebar/MenuButton.hxx
sfx2/source/sidebar/Panel.cxx
sfx2/source/sidebar/Panel.hxx
sfx2/source/sidebar/PanelTitleBar.hxx
sfx2/source/sidebar/SidebarDockingWindow.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
sfx2/source/sidebar/TabBar.hxx
sfx2/source/sidebar/TabItem.cxx
sfx2/source/sidebar/TabItem.hxx
sfx2/source/sidebar/TitleBar.hxx
sfx2/source/toolbox/imgmgr.cxx
starmath/inc/edit.hxx
starmath/inc/smmod.hxx
starmath/qa/cppunit/test_starmath.cxx
starmath/source/edit.cxx
starmath/source/smmod.cxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/simptabl.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/valueimp.hxx
svx/inc/GalleryControl.hxx
svx/source/dialog/dlgctrl.cxx
svx/source/dialog/swframeexample.cxx
svx/source/fmcomp/fmgridif.cxx
svx/source/gallery2/GalleryControl.cxx
svx/source/sidebar/EmptyPanel.hxx
svx/source/sidebar/area/AreaPropertyPanel.hxx
svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
svx/source/sidebar/insert/InsertPropertyPanel.cxx
svx/source/sidebar/insert/InsertPropertyPanel.hxx
svx/source/sidebar/line/LinePropertyPanel.hxx
svx/source/sidebar/line/LineWidthControl.cxx
svx/source/sidebar/line/LineWidthControl.hxx
svx/source/sidebar/line/LineWidthValueSet.hxx
svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
svx/source/sidebar/possize/SidebarDialControl.cxx
svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
svx/source/sidebar/text/TextPropertyPanel.hxx
svx/source/sidebar/tools/PopupContainer.cxx
svx/source/sidebar/tools/PopupControl.cxx
svx/source/sidebar/tools/ValueSetWithTextControl.cxx
svx/source/svdraw/svdfmtf.hxx
svx/source/svdraw/svdibrow.cxx
svx/source/tbxctrls/colrctrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
sw/source/ui/dbui/mmaddressblockpage.cxx
sw/source/ui/dialog/uiregionsw.cxx
sw/source/ui/index/cnttab.cxx
sw/source/uibase/inc/drpcps.hxx
sw/source/uibase/sidebar/PageColumnControl.hxx
sw/source/uibase/sidebar/PageMarginControl.hxx
sw/source/uibase/sidebar/PageOrientationControl.hxx
sw/source/uibase/sidebar/PagePropertyPanel.hxx
sw/source/uibase/sidebar/PageSizeControl.hxx
sw/source/uibase/uiview/view2.cxx
sw/source/uibase/utlui/navipi.cxx
vcl/inc/svdata.hxx
vcl/source/control/combobox.cxx
vcl/source/control/lstbox.cxx
vcl/source/window/dockwin.cxx
vcl/source/window/winproc.cxx
Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/inc/mediacontrol.hxx | 15 | ||||
-rw-r--r-- | avmedia/source/framework/mediacontrol.cxx | 278 | ||||
-rw-r--r-- | avmedia/source/framework/mediaplayer.cxx | 10 | ||||
-rw-r--r-- | avmedia/source/framework/mediatoolbox.cxx | 11 | ||||
-rw-r--r-- | avmedia/source/viewer/mediaevent_impl.cxx | 14 | ||||
-rw-r--r-- | avmedia/source/viewer/mediaevent_impl.hxx | 3 | ||||
-rw-r--r-- | avmedia/source/viewer/mediawindow.cxx | 7 | ||||
-rw-r--r-- | avmedia/source/viewer/mediawindow_impl.cxx | 32 | ||||
-rw-r--r-- | avmedia/source/viewer/mediawindow_impl.hxx | 7 |
9 files changed, 195 insertions, 182 deletions
diff --git a/avmedia/inc/mediacontrol.hxx b/avmedia/inc/mediacontrol.hxx index c6e0622c5421..b24e1a590ee7 100644 --- a/avmedia/inc/mediacontrol.hxx +++ b/avmedia/inc/mediacontrol.hxx @@ -58,6 +58,7 @@ public: MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyle ); virtual ~MediaControl(); + virtual void dispose() SAL_OVERRIDE; const Size& getMinSizePixel() const; @@ -89,13 +90,13 @@ private: ImageList maImageList; Idle maIdle; MediaItem maItem; - ToolBox maPlayToolBox; - Slider maTimeSlider; - ToolBox maMuteToolBox; - Slider maVolumeSlider; - ToolBox maZoomToolBox; - ListBox* mpZoomListBox; - Edit maTimeEdit; + VclPtr<ToolBox> maPlayToolBox; + VclPtr<Slider> maTimeSlider; + VclPtr<ToolBox> maMuteToolBox; + VclPtr<Slider> maVolumeSlider; + VclPtr<ToolBox> maZoomToolBox; + VclPtr<ListBox> mpZoomListBox; + VclPtr<Edit> maTimeEdit; Size maMinSize; MediaControlStyle meControlStyle; bool mbLocked; diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index 13592611093f..5168c12e34e3 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -65,13 +65,13 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl Control( pParent ), maImageList( SvtMiscOptions().AreCurrentSymbolsLarge() ? AVMEDIA_RESID( AVMEDIA_IMGLST_L ) : AVMEDIA_RESID( AVMEDIA_IMGLST ) ), maItem( 0, AVMediaSetMask::ALL ), - maPlayToolBox( this, WB_3DLOOK ), - maTimeSlider( this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET ), - maMuteToolBox( this, WB_3DLOOK ), - maVolumeSlider( this, WB_HORZ | WB_DRAG | WB_SLIDERSET ), - maZoomToolBox( this, WB_3DLOOK ), - mpZoomListBox( new ListBox( &maZoomToolBox, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ), - maTimeEdit( this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY ), + maPlayToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ), + maTimeSlider( VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET) ), + maMuteToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ), + maVolumeSlider( VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_SLIDERSET) ), + maZoomToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ), + mpZoomListBox( VclPtr<ListBox>::Create( maZoomToolBox.get(), WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ), + maTimeEdit( VclPtr<Edit>::Create(this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY) ), meControlStyle( eControlStyle ), mbLocked( false ) { @@ -83,88 +83,88 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl if( MEDIACONTROLSTYLE_SINGLELINE != meControlStyle ) { - maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), OUString( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN ); + maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), OUString( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) ); + maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN ); - maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_INSERT, implGetImage( AVMEDIA_IMG_INSERT ), OUString( AVMEDIA_RESID( AVMEDIA_STR_INSERT ) ) ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, HID_AVMEDIA_TOOLBOXITEM_INSERT ); + maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_INSERT, implGetImage( AVMEDIA_IMG_INSERT ), OUString( AVMEDIA_RESID( AVMEDIA_STR_INSERT ) ) ); + maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, HID_AVMEDIA_TOOLBOXITEM_INSERT ); - maPlayToolBox.InsertSeparator(); + maPlayToolBox->InsertSeparator(); } else { mpZoomListBox->SetBackground(); - maZoomToolBox.SetBackground(); - maZoomToolBox.SetPaintTransparent( true ); - maPlayToolBox.SetBackground(); - maPlayToolBox.SetPaintTransparent( true ); - maMuteToolBox.SetBackground(); - maMuteToolBox.SetPaintTransparent( true ); + maZoomToolBox->SetBackground(); + maZoomToolBox->SetPaintTransparent( true ); + maPlayToolBox->SetBackground(); + maPlayToolBox->SetPaintTransparent( true ); + maMuteToolBox->SetBackground(); + maMuteToolBox->SetPaintTransparent( true ); } - maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PLAY, implGetImage( AVMEDIA_IMG_PLAY ), OUString( AVMEDIA_RESID( AVMEDIA_STR_PLAY ) ), ToolBoxItemBits::CHECKABLE ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, HID_AVMEDIA_TOOLBOXITEM_PLAY ); + maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_PLAY, implGetImage( AVMEDIA_IMG_PLAY ), OUString( AVMEDIA_RESID( AVMEDIA_STR_PLAY ) ), ToolBoxItemBits::CHECKABLE ); + maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, HID_AVMEDIA_TOOLBOXITEM_PLAY ); - maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PAUSE, implGetImage( AVMEDIA_IMG_PAUSE ), OUString( AVMEDIA_RESID( AVMEDIA_STR_PAUSE ) ), ToolBoxItemBits::CHECKABLE ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, HID_AVMEDIA_TOOLBOXITEM_PAUSE ); + maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_PAUSE, implGetImage( AVMEDIA_IMG_PAUSE ), OUString( AVMEDIA_RESID( AVMEDIA_STR_PAUSE ) ), ToolBoxItemBits::CHECKABLE ); + maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, HID_AVMEDIA_TOOLBOXITEM_PAUSE ); - maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_STOP, implGetImage( AVMEDIA_IMG_STOP ), OUString( AVMEDIA_RESID( AVMEDIA_STR_STOP ) ), ToolBoxItemBits::CHECKABLE ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, HID_AVMEDIA_TOOLBOXITEM_STOP ); + maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_STOP, implGetImage( AVMEDIA_IMG_STOP ), OUString( AVMEDIA_RESID( AVMEDIA_STR_STOP ) ), ToolBoxItemBits::CHECKABLE ); + maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, HID_AVMEDIA_TOOLBOXITEM_STOP ); - maPlayToolBox.InsertSeparator(); + maPlayToolBox->InsertSeparator(); - maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_LOOP, implGetImage( AVMEDIA_IMG_ENDLESS ), OUString( AVMEDIA_RESID( AVMEDIA_STR_ENDLESS ) ) ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, HID_AVMEDIA_TOOLBOXITEM_LOOP ); + maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_LOOP, implGetImage( AVMEDIA_IMG_ENDLESS ), OUString( AVMEDIA_RESID( AVMEDIA_STR_ENDLESS ) ) ); + maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, HID_AVMEDIA_TOOLBOXITEM_LOOP ); if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle ) - maPlayToolBox.InsertSeparator(); - - maPlayToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); - maPlayToolBox.SetSizePixel( maPlayToolBox.CalcWindowSizePixel() ); - maPlayToolBox.Show(); - maMinSize = maPlayToolBox.GetSizePixel(); - - maTimeSlider.SetSlideHdl( LINK( this, MediaControl, implTimeHdl ) ); - maTimeSlider.SetEndSlideHdl( LINK( this, MediaControl, implTimeEndHdl ) ); - maTimeSlider.SetRange( Range( 0, AVMEDIA_TIME_RANGE ) ); - maTimeSlider.SetHelpId( HID_AVMEDIA_TIMESLIDER ); - maTimeSlider.SetUpdateMode( true ); - maTimeSlider.SetSizePixel( Size( 128, maPlayToolBox.GetSizePixel().Height() ) ); - maTimeSlider.Show(); - maMinSize.Width() += maTimeSlider.GetSizePixel().Width(); - - maTimeEdit.SetText( aTimeText ); - maTimeEdit.SetUpdateMode( true ); - maTimeEdit.SetSizePixel( Size( maTimeEdit.GetTextWidth( aTimeText ) + 8, maPlayToolBox.GetSizePixel().Height() ) ); - maTimeEdit.SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() ); - maTimeEdit.SetHelpId( HID_AVMEDIA_TIMEEDIT ); - maTimeEdit.Disable(); - maTimeEdit.Show(); - maMinSize.Width() += maTimeEdit.GetSizePixel().Width(); + maPlayToolBox->InsertSeparator(); + + maPlayToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); + maPlayToolBox->SetSizePixel( maPlayToolBox->CalcWindowSizePixel() ); + maPlayToolBox->Show(); + maMinSize = maPlayToolBox->GetSizePixel(); + + maTimeSlider->SetSlideHdl( LINK( this, MediaControl, implTimeHdl ) ); + maTimeSlider->SetEndSlideHdl( LINK( this, MediaControl, implTimeEndHdl ) ); + maTimeSlider->SetRange( Range( 0, AVMEDIA_TIME_RANGE ) ); + maTimeSlider->SetHelpId( HID_AVMEDIA_TIMESLIDER ); + maTimeSlider->SetUpdateMode( true ); + maTimeSlider->SetSizePixel( Size( 128, maPlayToolBox->GetSizePixel().Height() ) ); + maTimeSlider->Show(); + maMinSize.Width() += maTimeSlider->GetSizePixel().Width(); + + maTimeEdit->SetText( aTimeText ); + maTimeEdit->SetUpdateMode( true ); + maTimeEdit->SetSizePixel( Size( maTimeEdit->GetTextWidth( aTimeText ) + 8, maPlayToolBox->GetSizePixel().Height() ) ); + maTimeEdit->SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() ); + maTimeEdit->SetHelpId( HID_AVMEDIA_TIMEEDIT ); + maTimeEdit->Disable(); + maTimeEdit->Show(); + maMinSize.Width() += maTimeEdit->GetSizePixel().Width(); if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle ) - maMuteToolBox.InsertSeparator(); - - maMuteToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_MUTE, implGetImage( AVMEDIA_IMG_MUTE ), OUString( AVMEDIA_RESID( AVMEDIA_STR_MUTE ) ) ); - maMuteToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, HID_AVMEDIA_TOOLBOXITEM_MUTE ); - - maMuteToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); - maMuteToolBox.SetSizePixel( maMuteToolBox.CalcWindowSizePixel() ); - maMuteToolBox.Show(); - maMinSize.Width() += maMuteToolBox.GetSizePixel().Width(); - - maVolumeSlider.SetSlideHdl( LINK( this, MediaControl, implVolumeHdl ) ); - maVolumeSlider.SetEndSlideHdl( LINK( this, MediaControl, implVolumeEndHdl ) ); - maVolumeSlider.SetRange( Range( AVMEDIA_DB_RANGE, 0 ) ); - maVolumeSlider.SetUpdateMode( true ); - maVolumeSlider.SetHelpId( HID_AVMEDIA_VOLUMESLIDER ); - maVolumeSlider.SetSizePixel( Size( 48, maPlayToolBox.GetSizePixel().Height() ) ); - maVolumeSlider.Show(); - maMinSize.Width() += maVolumeSlider.GetSizePixel().Width(); - - mpZoomListBox->SetSizePixel( Size( maTimeEdit.GetSizePixel().Width(), 260 ) ); + maMuteToolBox->InsertSeparator(); + + maMuteToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_MUTE, implGetImage( AVMEDIA_IMG_MUTE ), OUString( AVMEDIA_RESID( AVMEDIA_STR_MUTE ) ) ); + maMuteToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, HID_AVMEDIA_TOOLBOXITEM_MUTE ); + + maMuteToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); + maMuteToolBox->SetSizePixel( maMuteToolBox->CalcWindowSizePixel() ); + maMuteToolBox->Show(); + maMinSize.Width() += maMuteToolBox->GetSizePixel().Width(); + + maVolumeSlider->SetSlideHdl( LINK( this, MediaControl, implVolumeHdl ) ); + maVolumeSlider->SetEndSlideHdl( LINK( this, MediaControl, implVolumeEndHdl ) ); + maVolumeSlider->SetRange( Range( AVMEDIA_DB_RANGE, 0 ) ); + maVolumeSlider->SetUpdateMode( true ); + maVolumeSlider->SetHelpId( HID_AVMEDIA_VOLUMESLIDER ); + maVolumeSlider->SetSizePixel( Size( 48, maPlayToolBox->GetSizePixel().Height() ) ); + maVolumeSlider->Show(); + maMinSize.Width() += maVolumeSlider->GetSizePixel().Width(); + + mpZoomListBox->SetSizePixel( Size( maTimeEdit->GetSizePixel().Width(), 260 ) ); mpZoomListBox->InsertEntry( OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_50 ) ), AVMEDIA_ZOOMLEVEL_50 ); mpZoomListBox->InsertEntry( OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_100 ) ), AVMEDIA_ZOOMLEVEL_100 ); mpZoomListBox->InsertEntry( OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_200 ) ), AVMEDIA_ZOOMLEVEL_200 ); @@ -172,14 +172,14 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl mpZoomListBox->SetSelectHdl( LINK( this, MediaControl, implZoomSelectHdl ) ); mpZoomListBox->SetHelpId( HID_AVMEDIA_ZOOMLISTBOX ); - maZoomToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_ZOOM, OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM ) ) ); - maZoomToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, HID_AVMEDIA_ZOOMLISTBOX ); + maZoomToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_ZOOM, OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM ) ) ); + maZoomToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, HID_AVMEDIA_ZOOMLISTBOX ); - maZoomToolBox.SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, mpZoomListBox ); - maZoomToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); - maZoomToolBox.SetSizePixel( maZoomToolBox.CalcWindowSizePixel() ); - maZoomToolBox.Show(); - maMinSize.Width() += maZoomToolBox.GetSizePixel().Width(); + maZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, mpZoomListBox ); + maZoomToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); + maZoomToolBox->SetSizePixel( maZoomToolBox->CalcWindowSizePixel() ); + maZoomToolBox->Show(); + maMinSize.Width() += maZoomToolBox->GetSizePixel().Width(); if( MEDIACONTROLSTYLE_MULTILINE == meControlStyle ) { @@ -196,8 +196,20 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl MediaControl::~MediaControl() { - maZoomToolBox.SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL ); - delete mpZoomListBox; + disposeOnce(); +} + +void MediaControl::dispose() +{ + maZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL ); + mpZoomListBox.disposeAndClear(); + maTimeEdit.disposeAndClear(); + maZoomToolBox.disposeAndClear(); + maVolumeSlider.disposeAndClear(); + maMuteToolBox.disposeAndClear(); + maTimeSlider.disposeAndClear(); + maPlayToolBox.disposeAndClear(); + Control::dispose(); } @@ -212,56 +224,56 @@ const Size& MediaControl::getMinSizePixel() const void MediaControl::Resize() { Point aPos( 0, 0 ); - const sal_Int32 nPlayToolBoxWidth = maPlayToolBox.GetSizePixel().Width(); - const sal_Int32 nMuteToolBoxWidth = maMuteToolBox.GetSizePixel().Width(); - const sal_Int32 nVolumeSliderWidth = maVolumeSlider.GetSizePixel().Width(); - const sal_Int32 nZoomToolBoxWidth = maZoomToolBox.GetSizePixel().Width(); - const sal_Int32 nTimeEditWidth = maTimeEdit.GetSizePixel().Width(); - const sal_Int32 nTimeSliderHeight = maTimeSlider.GetSizePixel().Height(); + const sal_Int32 nPlayToolBoxWidth = maPlayToolBox->GetSizePixel().Width(); + const sal_Int32 nMuteToolBoxWidth = maMuteToolBox->GetSizePixel().Width(); + const sal_Int32 nVolumeSliderWidth = maVolumeSlider->GetSizePixel().Width(); + const sal_Int32 nZoomToolBoxWidth = maZoomToolBox->GetSizePixel().Width(); + const sal_Int32 nTimeEditWidth = maTimeEdit->GetSizePixel().Width(); + const sal_Int32 nTimeSliderHeight = maTimeSlider->GetSizePixel().Height(); if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle ) { const sal_Int32 nTimeSliderWidth = GetSizePixel().Width() - ( AVMEDIA_CONTROLOFFSET * 3 ) - nPlayToolBoxWidth - nMuteToolBoxWidth - nVolumeSliderWidth - nTimeEditWidth - nZoomToolBoxWidth; - maPlayToolBox.SetPosSizePixel( aPos, maPlayToolBox.GetSizePixel() ); + maPlayToolBox->SetPosSizePixel( aPos, maPlayToolBox->GetSizePixel() ); aPos.X() += nPlayToolBoxWidth; - maTimeSlider.SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) ); + maTimeSlider->SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) ); aPos.X() += nTimeSliderWidth + AVMEDIA_CONTROLOFFSET; - maTimeEdit.SetPosSizePixel( aPos, maTimeEdit.GetSizePixel() ); + maTimeEdit->SetPosSizePixel( aPos, maTimeEdit->GetSizePixel() ); aPos.X() += nTimeEditWidth + AVMEDIA_CONTROLOFFSET; - maMuteToolBox.SetPosSizePixel( aPos, maMuteToolBox.GetSizePixel() ); + maMuteToolBox->SetPosSizePixel( aPos, maMuteToolBox->GetSizePixel() ); aPos.X() += nMuteToolBoxWidth; - maVolumeSlider.SetPosSizePixel( aPos, maVolumeSlider.GetSizePixel() ); + maVolumeSlider->SetPosSizePixel( aPos, maVolumeSlider->GetSizePixel() ); aPos.X() += nVolumeSliderWidth + AVMEDIA_CONTROLOFFSET; - maZoomToolBox.SetPosSizePixel( aPos, maZoomToolBox.GetSizePixel() ); + maZoomToolBox->SetPosSizePixel( aPos, maZoomToolBox->GetSizePixel() ); } else { const sal_Int32 nTimeSliderWidth = GetSizePixel().Width() - AVMEDIA_CONTROLOFFSET - nTimeEditWidth; - maTimeSlider.SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) ); + maTimeSlider->SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) ); aPos.X() += nTimeSliderWidth + AVMEDIA_CONTROLOFFSET; - maTimeEdit.SetPosSizePixel( aPos, maTimeEdit.GetSizePixel() ); + maTimeEdit->SetPosSizePixel( aPos, maTimeEdit->GetSizePixel() ); aPos.X() = 0; aPos.Y() += nTimeSliderHeight + AVMEDIA_CONTROLOFFSET; - maPlayToolBox.SetPosSizePixel( aPos, maPlayToolBox.GetSizePixel() ); + maPlayToolBox->SetPosSizePixel( aPos, maPlayToolBox->GetSizePixel() ); aPos.X() = GetSizePixel().Width() - nVolumeSliderWidth - nMuteToolBoxWidth - nZoomToolBoxWidth - AVMEDIA_CONTROLOFFSET; - maMuteToolBox.SetPosSizePixel( aPos, maMuteToolBox.GetSizePixel() ); + maMuteToolBox->SetPosSizePixel( aPos, maMuteToolBox->GetSizePixel() ); aPos.X() += nMuteToolBoxWidth; - maVolumeSlider.SetPosSizePixel( aPos, maVolumeSlider.GetSizePixel() ); + maVolumeSlider->SetPosSizePixel( aPos, maVolumeSlider->GetSizePixel() ); aPos.X() = GetSizePixel().Width() - nZoomToolBoxWidth; - maZoomToolBox.SetPosSizePixel( aPos, maZoomToolBox.GetSizePixel() ); + maZoomToolBox->SetPosSizePixel( aPos, maZoomToolBox->GetSizePixel() ); } } @@ -286,48 +298,48 @@ void MediaControl::implUpdateToolboxes() { const bool bValidURL = !maItem.getURL().isEmpty(); - maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_INSERT, bValidURL ); - maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_PLAY, bValidURL ); - maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_PAUSE, bValidURL ); - maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_STOP, bValidURL ); - maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_LOOP, bValidURL ); - maMuteToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_MUTE, bValidURL ); + maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_INSERT, bValidURL ); + maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_PLAY, bValidURL ); + maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_PAUSE, bValidURL ); + maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_STOP, bValidURL ); + maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_LOOP, bValidURL ); + maMuteToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_MUTE, bValidURL ); if( !bValidURL || !IsEnabled() ) { mpZoomListBox->Disable(); if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle ) - maPlayToolBox.Disable(); + maPlayToolBox->Disable(); - maMuteToolBox.Disable(); + maMuteToolBox->Disable(); } else { - maPlayToolBox.Enable(); - maMuteToolBox.Enable(); + maPlayToolBox->Enable(); + maMuteToolBox->Enable(); if( MEDIASTATE_PLAY == maItem.getState() ) { - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, true ); - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false ); - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, true ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false ); } else if( maItem.getTime() > 0.0 && ( maItem.getTime() < maItem.getDuration() ) ) { - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false ); - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, true ); - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, true ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false ); } else { - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false ); - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false ); - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, true ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP, true ); } - maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_LOOP, maItem.isLoop() ); - maMuteToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_MUTE, maItem.isMute() ); + maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_LOOP, maItem.isLoop() ); + maMuteToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_MUTE, maItem.isMute() ); if( !mpZoomListBox->IsTravelSelect() && !mpZoomListBox->IsInDropDown() ) { @@ -360,10 +372,10 @@ void MediaControl::implUpdateToolboxes() void MediaControl::implUpdateTimeSlider() { if( maItem.getURL().isEmpty() || !IsEnabled() ) - maTimeSlider.Disable(); + maTimeSlider->Disable(); else { - maTimeSlider.Enable(); + maTimeSlider->Enable(); const double fDuration = maItem.getDuration(); @@ -371,13 +383,13 @@ void MediaControl::implUpdateTimeSlider() { const double fTime = ::std::min( maItem.getTime(), fDuration ); - if( !maTimeSlider.GetLineSize() ) - maTimeSlider.SetLineSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_LINEINCREMENT / fDuration ) ); + if( !maTimeSlider->GetLineSize() ) + maTimeSlider->SetLineSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_LINEINCREMENT / fDuration ) ); - if( !maTimeSlider.GetPageSize() ) - maTimeSlider.SetPageSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_PAGEINCREMENT / fDuration ) ); + if( !maTimeSlider->GetPageSize() ) + maTimeSlider->SetPageSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_PAGEINCREMENT / fDuration ) ); - maTimeSlider.SetThumbPos( static_cast< sal_Int32 >( fTime / fDuration * AVMEDIA_TIME_RANGE ) ); + maTimeSlider->SetThumbPos( static_cast< sal_Int32 >( fTime / fDuration * AVMEDIA_TIME_RANGE ) ); } } } @@ -387,14 +399,14 @@ void MediaControl::implUpdateTimeSlider() void MediaControl::implUpdateVolumeSlider() { if( maItem.getURL().isEmpty() || !IsEnabled() ) - maVolumeSlider.Disable(); + maVolumeSlider->Disable(); else { - maVolumeSlider.Enable(); + maVolumeSlider->Enable(); const sal_Int32 nVolumeDB = maItem.getVolumeDB(); - maVolumeSlider.SetThumbPos( ::std::min( ::std::max( nVolumeDB, static_cast< sal_Int32 >( AVMEDIA_DB_RANGE ) ), + maVolumeSlider->SetThumbPos( ::std::min( ::std::max( nVolumeDB, static_cast< sal_Int32 >( AVMEDIA_DB_RANGE ) ), static_cast< sal_Int32 >( 0 ) ) ); } } @@ -414,8 +426,8 @@ void MediaControl::implUpdateTimeField( double fCurTime ) " / " + rLocaleData.getDuration( tools::Time( 0, 0, static_cast< sal_uInt32 >( floor( maItem.getDuration() ) )) ); - if( maTimeEdit.GetText() != aTimeString ) - maTimeEdit.SetText( aTimeString ); + if( maTimeEdit->GetText() != aTimeString ) + maTimeEdit->SetText( aTimeString ); } } @@ -535,13 +547,13 @@ IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p ) case( AVMEDIA_TOOLBOXITEM_MUTE ): { - aExecItem.setMute( !maMuteToolBox.IsItemChecked( AVMEDIA_TOOLBOXITEM_MUTE ) ); + aExecItem.setMute( !maMuteToolBox->IsItemChecked( AVMEDIA_TOOLBOXITEM_MUTE ) ); } break; case( AVMEDIA_TOOLBOXITEM_LOOP ): { - aExecItem.setLoop( !maPlayToolBox.IsItemChecked( AVMEDIA_TOOLBOXITEM_LOOP ) ); + aExecItem.setLoop( !maPlayToolBox->IsItemChecked( AVMEDIA_TOOLBOXITEM_LOOP ) ); } break; diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index 6090b6289394..28adf1959c8e 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -40,9 +40,9 @@ namespace avmedia MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - pWindow = new MediaFloater( _pBindings, this, _pParent ); + pWindow.reset( VclPtr<MediaFloater>::Create( _pBindings, this, _pParent ) ); eChildAlignment = SfxChildAlignment::NOALIGNMENT; - static_cast< MediaFloater* >( pWindow )->Initialize( pInfo ); + static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo ); }; @@ -75,8 +75,14 @@ MediaFloater::MediaFloater( SfxBindings* _pBindings, SfxChildWindow* pCW, vcl::W MediaFloater::~MediaFloater() { + disposeOnce(); +} + +void MediaFloater::dispose() +{ delete mpMediaWindow; mpMediaWindow = NULL; + SfxDockingWindow::dispose(); } diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx index ea4131fe4713..4f20a781c676 100644 --- a/avmedia/source/framework/mediatoolbox.cxx +++ b/avmedia/source/framework/mediatoolbox.cxx @@ -42,7 +42,6 @@ class MediaToolBoxControl_Impl : public MediaControl public: MediaToolBoxControl_Impl( vcl::Window& rParent, MediaToolBoxControl& rControl ); - virtual ~MediaToolBoxControl_Impl(); void update() SAL_OVERRIDE; void execute( const MediaItem& rItem ) SAL_OVERRIDE; @@ -63,12 +62,6 @@ MediaToolBoxControl_Impl::MediaToolBoxControl_Impl( vcl::Window& rParent, MediaT -MediaToolBoxControl_Impl::~MediaToolBoxControl_Impl() -{ -} - - - void MediaToolBoxControl_Impl::update() { mpToolBoxControl->implUpdateMediaControl(); @@ -131,9 +124,9 @@ void MediaToolBoxControl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eSta -vcl::Window* MediaToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> MediaToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return( pParent ? new MediaToolBoxControl_Impl( *pParent, *this ) : NULL ); + return ( pParent ? VclPtr<MediaToolBoxControl_Impl>::Create( *pParent, *this ) : nullptr ); } diff --git a/avmedia/source/viewer/mediaevent_impl.cxx b/avmedia/source/viewer/mediaevent_impl.cxx index 86e18175101c..3e42ebb223b4 100644 --- a/avmedia/source/viewer/mediaevent_impl.cxx +++ b/avmedia/source/viewer/mediaevent_impl.cxx @@ -45,7 +45,7 @@ MediaEventListenersImpl::~MediaEventListenersImpl() void MediaEventListenersImpl::cleanUp() { - Application::RemoveMouseAndKeyEvents( reinterpret_cast< vcl::Window* >( mpNotifyWindow ) ); + Application::RemoveMouseAndKeyEvents( reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ) ); mpNotifyWindow = NULL; } @@ -72,7 +72,7 @@ void SAL_CALL MediaEventListenersImpl::keyPressed( const ::com::sun::star::awt:: ( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) ); KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode ); - Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLKeyEvt ); + Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLKeyEvt ); } } @@ -91,7 +91,7 @@ void SAL_CALL MediaEventListenersImpl::keyReleased( const ::com::sun::star::awt: ( ( e.Modifiers & 2 ) ? KEY_MOD1 : 0 ) | ( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) ); KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode ); - Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLKeyEvt ); + Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLKeyEvt ); } } @@ -112,7 +112,7 @@ void SAL_CALL MediaEventListenersImpl::mousePressed( const ::com::sun::star::awt ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) | ( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ), e.Modifiers ); - Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt ); + Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt ); } } @@ -133,7 +133,7 @@ void SAL_CALL MediaEventListenersImpl::mouseReleased( const ::com::sun::star::aw ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) | ( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ), e.Modifiers ); - Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt ); + Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt ); } } @@ -174,7 +174,7 @@ void SAL_CALL MediaEventListenersImpl::mouseDragged( const ::com::sun::star::awt if( mpNotifyWindow ) { MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, MouseEventModifiers::NONE, e.Buttons, e.Modifiers ); - Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt ); + Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt ); } } @@ -189,7 +189,7 @@ void SAL_CALL MediaEventListenersImpl::mouseMoved( const ::com::sun::star::awt:: if( mpNotifyWindow ) { MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, MouseEventModifiers::NONE, e.Buttons, e.Modifiers ); - Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt ); + Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt ); } } diff --git a/avmedia/source/viewer/mediaevent_impl.hxx b/avmedia/source/viewer/mediaevent_impl.hxx index 63e1a0d77ba2..27676c749d84 100644 --- a/avmedia/source/viewer/mediaevent_impl.hxx +++ b/avmedia/source/viewer/mediaevent_impl.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/awt/XMouseListener.hpp> #include <com/sun/star/awt/XMouseMotionListener.hpp> #include <com/sun/star/awt/XFocusListener.hpp> +#include <vcl/vclptr.hxx> namespace avmedia { @@ -69,7 +70,7 @@ namespace avmedia private: - vcl::Window* mpNotifyWindow; + VclPtr<vcl::Window> mpNotifyWindow; mutable ::osl::Mutex maMutex; }; } diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index a40d8a384be2..267e39fb7d6a 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -46,7 +46,7 @@ namespace avmedia { MediaWindow::MediaWindow( vcl::Window* parent, bool bInternalMediaControl ) : - mpImpl( new priv::MediaWindowImpl( parent, this, bInternalMediaControl ) ) + mpImpl( VclPtr<priv::MediaWindowImpl>::Create( parent, this, bInternalMediaControl ) ) { mpImpl->Show(); } @@ -327,9 +327,10 @@ bool MediaWindow::executeMediaURLDialog(vcl::Window* /* pParent */, void MediaWindow::executeFormatErrorBox( vcl::Window* pParent ) { - MessageDialog aErrBox( pParent, AVMEDIA_RESID( AVMEDIA_STR_ERR_URL ) ); + ScopedVclPtrInstance< MessageDialog > aErrBox( pParent, AVMEDIA_RESID( AVMEDIA_STR_ERR_URL ) ); - aErrBox.Execute(); + aErrBox->Execute(); + aErrBox.disposeAndClear(); } diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 7a6863b1b2bc..c84849b2dec3 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -56,12 +56,6 @@ MediaWindowControl::MediaWindowControl( vcl::Window* pParent ) : -MediaWindowControl::~MediaWindowControl() -{ -} - - - void MediaWindowControl::update() { MediaItem aItem; @@ -93,12 +87,6 @@ MediaChildWindow::MediaChildWindow( vcl::Window* pParent, SystemWindowData* pDat } #endif -MediaChildWindow::~MediaChildWindow() -{ -} - - - void MediaChildWindow::MouseMove( const MouseEvent& rMEvt ) { const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), @@ -168,7 +156,7 @@ MediaWindowImpl::MediaWindowImpl( vcl::Window* pParent, MediaWindow* pMediaWindo mpMediaWindow( pMediaWindow ), mpEvents( NULL ), mbEventTransparent(true), - mpMediaWindowControl( bInternalMediaControl ? new MediaWindowControl( this ) : NULL ), + mpMediaWindowControl( bInternalMediaControl ? VclPtr<MediaWindowControl>::Create( this ) : nullptr ), mpEmptyBmpEx( NULL ), mpAudioBmpEx( NULL ) { @@ -183,6 +171,11 @@ MediaWindowImpl::MediaWindowImpl( vcl::Window* pParent, MediaWindow* pMediaWindo MediaWindowImpl::~MediaWindowImpl() { + disposeOnce(); +} + +void MediaWindowImpl::dispose() +{ if( mpEvents ) mpEvents->cleanUp(); @@ -208,8 +201,13 @@ MediaWindowImpl::~MediaWindowImpl() mpMediaWindow = NULL; delete mpEmptyBmpEx; + mpEmptyBmpEx = NULL; delete mpAudioBmpEx; - delete mpMediaWindowControl; + mpAudioBmpEx = NULL; + mpMediaWindowControl.disposeAndClear(); + mpChildWindow.disposeAndClear(); + + Control::dispose(); } uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& rURL, const OUString& rReferer, const OUString* pMimeType ) @@ -510,13 +508,15 @@ void MediaWindowImpl::onURLChanged() { if( m_sMimeType == AVMEDIA_MIMETYPE_COMMON ) { - mpChildWindow.reset(new MediaChildWindow(this) ); + mpChildWindow.disposeAndClear(); + mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this) ); } #if HAVE_FEATURE_GLTF else if ( m_sMimeType == AVMEDIA_MIMETYPE_JSON ) { SystemWindowData aWinData = OpenGLContext::generateWinData(this, false); - mpChildWindow.reset(new MediaChildWindow(this,&aWinData)); + mpChildWindow.disposeAndClear(); + mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this,&aWinData)); mbEventTransparent = false; } #endif diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx index c5c65fa41aa0..c56558c375db 100644 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -49,7 +49,6 @@ namespace avmedia public: MediaWindowControl( vcl::Window* pParent ); - virtual ~MediaWindowControl(); protected: @@ -67,7 +66,6 @@ namespace avmedia MediaChildWindow( vcl::Window* pParent ); MediaChildWindow( vcl::Window* pParent, SystemWindowData* pData ); - virtual ~MediaChildWindow(); protected: @@ -94,6 +92,7 @@ namespace avmedia MediaWindowImpl( vcl::Window* parent, MediaWindow* pMediaWindow, bool bInternalMediaControl ); virtual ~MediaWindowImpl(); + virtual void dispose() SAL_OVERRIDE; static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer, const OUString* pMimeType = 0 ); @@ -173,8 +172,8 @@ namespace avmedia ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxEventsIf; MediaEventListenersImpl* mpEvents; bool mbEventTransparent; - std::unique_ptr<MediaChildWindow> mpChildWindow; - MediaWindowControl* mpMediaWindowControl; + VclPtr<MediaChildWindow> mpChildWindow; + VclPtr<MediaWindowControl> mpMediaWindowControl; BitmapEx* mpEmptyBmpEx; BitmapEx* mpAudioBmpEx; }; |