diff options
-rw-r--r-- | starmath/inc/ElementsDockingWindow.hxx | 1 | ||||
-rw-r--r-- | starmath/inc/dialog.hxx | 18 | ||||
-rw-r--r-- | starmath/inc/edit.hxx | 1 | ||||
-rw-r--r-- | starmath/inc/toolbox.hxx | 1 | ||||
-rw-r--r-- | starmath/inc/view.hxx | 12 | ||||
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 6 | ||||
-rw-r--r-- | starmath/source/dialog.cxx | 38 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 6 | ||||
-rw-r--r-- | starmath/source/toolbox.cxx | 6 | ||||
-rw-r--r-- | starmath/source/view.cxx | 53 |
10 files changed, 103 insertions, 39 deletions
diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 96dcfd61014d..bdb57ac37288 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -141,6 +141,7 @@ public: SfxChildWindow* pChildWindow, vcl::Window* pParent ); virtual ~SmElementsDockingWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void EndDocking( const Rectangle& rReactangle, bool bFloatMode) SAL_OVERRIDE; virtual void ToggleFloatingMode() SAL_OVERRIDE; diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 9c3987bb91fe..970edddd18e0 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -224,6 +224,7 @@ class SmDistanceDialog : public ModalDialog public: SmDistanceDialog(vcl::Window *pParent); virtual ~SmDistanceDialog(); + virtual void dispose() SAL_OVERRIDE; void ReadFrom(const SmFormat &rFormat); void WriteTo (SmFormat &rFormat) /*const*/; @@ -288,19 +289,21 @@ public: class SmShowSymbolSet : public VclHBox { - SmShowSymbolSetWindow aSymbolWindow; - ScrollBar aVScrollBar; + VclPtr<SmShowSymbolSetWindow> aSymbolWindow; + VclPtr<ScrollBar> aVScrollBar; public: SmShowSymbolSet(vcl::Window *pParent); + virtual ~SmShowSymbolSet(); + virtual void dispose() SAL_OVERRIDE; - void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet) { aSymbolWindow.SetSymbolSet(rSymbolSet); } + void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet) { aSymbolWindow->SetSymbolSet(rSymbolSet); } - void SelectSymbol(sal_uInt16 nSymbol) { aSymbolWindow.SelectSymbol(nSymbol); } - sal_uInt16 GetSelectSymbol() const { return aSymbolWindow.GetSelectSymbol(); } + void SelectSymbol(sal_uInt16 nSymbol) { aSymbolWindow->SelectSymbol(nSymbol); } + sal_uInt16 GetSelectSymbol() const { return aSymbolWindow->GetSelectSymbol(); } - void SetSelectHdl(const Link& rLink) { aSymbolWindow.SetSelectHdl(rLink); } - void SetDblClickHdl(const Link& rLink) { aSymbolWindow.SetDblClickHdl(rLink); } + void SetSelectHdl(const Link& rLink) { aSymbolWindow->SetSelectHdl(rLink); } + void SetDblClickHdl(const Link& rLink) { aSymbolWindow->SetDblClickHdl(rLink); } }; @@ -455,6 +458,7 @@ class SmSymDefineDialog : public ModalDialog public: SmSymDefineDialog(vcl::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr); virtual ~SmSymDefineDialog(); + virtual void dispose() SAL_OVERRIDE; using OutputDevice::SetFont; diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 601b3b9a1667..2bd99c6c0465 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -91,6 +91,7 @@ class SmEditWindow : public vcl::Window, public DropTargetHelper public: SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ); virtual ~SmEditWindow(); + virtual void dispose() SAL_OVERRIDE; SmDocShell * GetDoc(); SmViewShell * GetView(); diff --git a/starmath/inc/toolbox.hxx b/starmath/inc/toolbox.hxx index 472fe602c1a2..3b3f697890f7 100644 --- a/starmath/inc/toolbox.hxx +++ b/starmath/inc/toolbox.hxx @@ -65,6 +65,7 @@ public: SfxChildWindow *pChildWindow, Window *pParent); virtual ~SmToolBoxWindow(); + virtual void dispose() SAL_OVERRIDE; // Window virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 85bfbdb52194..8a1fdade04cf 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -95,6 +95,7 @@ private: public: SmGraphicWindow(SmViewShell* pShell); virtual ~SmGraphicWindow(); + virtual void dispose() SAL_OVERRIDE; // Window virtual void MouseButtonDown(const MouseEvent &rMEvt) SAL_OVERRIDE; @@ -159,7 +160,7 @@ public: class SmCmdBoxWindow : public SfxDockingWindow { - SmEditWindow aEdit; + VclPtr<SmEditWindow> aEdit; SmEditController aController; bool bExiting; @@ -187,10 +188,11 @@ public: Window *pParent); virtual ~SmCmdBoxWindow (); + virtual void dispose() SAL_OVERRIDE; void AdjustPosition(); - SmEditWindow& GetEditWindow() { return aEdit; } + SmEditWindow& GetEditWindow() { return *aEdit.get(); } SmViewShell *GetView(); }; @@ -231,7 +233,7 @@ class SmViewShell: public SfxViewShell std::unique_ptr<SmViewShell_Impl> pImpl; - SmGraphicWindow aGraphic; + VclPtr<SmGraphicWindow> aGraphic; SmGraphicController aGraphicController; OUString aStatusText; @@ -290,8 +292,8 @@ public: } SmEditWindow * GetEditWindow(); - SmGraphicWindow & GetGraphicWindow() { return aGraphic; } - const SmGraphicWindow & GetGraphicWindow() const { return aGraphic; } + SmGraphicWindow & GetGraphicWindow() { return *aGraphic.get(); } + const SmGraphicWindow & GetGraphicWindow() const { return *aGraphic.get(); } void SetStatusText(const OUString& rText); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 907d1480b020..17e0738e4be8 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -671,7 +671,13 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf SmElementsDockingWindow::~SmElementsDockingWindow () { + dispose(); +} + +void SmElementsDockingWindow::dispose() +{ delete mpElementsControl; + SfxDockingWindow::dispose(); } void SmElementsDockingWindow::ToggleFloatingMode() diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index b942d2bc6adc..93b66713ddc3 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -891,8 +891,14 @@ SmDistanceDialog::SmDistanceDialog(vcl::Window *pParent) SmDistanceDialog::~SmDistanceDialog() { + dispose(); +} + +void SmDistanceDialog::dispose() +{ for (int i = 0; i < NOCATEGORIES; i++) DELETEZ(Categories[i]); + ModalDialog::dispose(); } void SmDistanceDialog::DataChanged( const DataChangedEvent &rEvt ) @@ -1181,14 +1187,26 @@ void SmShowSymbolSetWindow::setScrollbar(ScrollBar *pVScrollBar) SmShowSymbolSet::SmShowSymbolSet(vcl::Window *pParent) : VclHBox(pParent, false, 6) - , aSymbolWindow(this, WB_TABSTOP) - , aVScrollBar(this, WinBits(WB_VSCROLL)) + , aSymbolWindow(new SmShowSymbolSetWindow(this, WB_TABSTOP)) + , aVScrollBar(new ScrollBar(this, WinBits(WB_VSCROLL))) +{ + aSymbolWindow->set_hexpand(true); + aSymbolWindow->set_vexpand(true); + aSymbolWindow->setScrollbar(aVScrollBar.get()); + aSymbolWindow->calccols(); + aSymbolWindow->Show(); +} + +SmShowSymbolSet::~SmShowSymbolSet() { - aSymbolWindow.set_hexpand(true); - aSymbolWindow.set_vexpand(true); - aSymbolWindow.setScrollbar(&aVScrollBar); - aSymbolWindow.calccols(); - aSymbolWindow.Show(); + dispose(); +} + +void SmShowSymbolSet::dispose() +{ + aSymbolWindow.disposeAndClear(); + aVScrollBar.disposeAndClear(); + VclHBox::dispose(); } extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSmShowSymbolSet(vcl::Window *pParent, VclBuilder::stringmap &) @@ -2032,6 +2050,12 @@ SmSymDefineDialog::SmSymDefineDialog(vcl::Window * pParent, SmSymDefineDialog::~SmSymDefineDialog() { + dispose(); +} + +void SmSymDefineDialog::dispose() +{ + ModalDialog::dispose(); } void SmSymDefineDialog::InitColor_Impl() diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index da0a420e9f9d..90fe7a0e5221 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -123,6 +123,11 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) : SmEditWindow::~SmEditWindow() { + dispose(); +} + +void SmEditWindow::dispose() +{ aModifyIdle.Stop(); StartCursorMove(); @@ -148,6 +153,7 @@ SmEditWindow::~SmEditWindow() delete pHScrollBar; delete pVScrollBar; delete pScrollBox; + vcl::Window::dispose(); } void SmEditWindow::StartCursorMove() diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx index d6ff88adbab8..01d49941313b 100644 --- a/starmath/source/toolbox.cxx +++ b/starmath/source/toolbox.cxx @@ -139,6 +139,11 @@ SmToolBoxWindow::SmToolBoxWindow(SfxBindings *pTmpBindings, SmToolBoxWindow::~SmToolBoxWindow() { + dispose(); +} + +void SmToolBoxWindow::dispose() +{ int i; for (i = 0; i < NUM_TBX_CATEGORIES; ++i) { @@ -147,6 +152,7 @@ SmToolBoxWindow::~SmToolBoxWindow() } for (i = 0; i < NUM_TBX_CATEGORIES + 1; ++i) delete aImageLists[i]; + SfxFloatingWindow::dispose(); } SmViewShell * SmToolBoxWindow::GetView() diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 5635f3c4e77d..0f7fa5b11071 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -119,11 +119,17 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell): SmGraphicWindow::~SmGraphicWindow() { + dispose(); +} + +void SmGraphicWindow::dispose() +{ if (pAccessible) pAccessible->ClearWin(); // make Accessible defunctional // Note: memory for pAccessible will be freed when the reference // xAccessible is released. CaretBlinkStop(); + ScrollableWindow::dispose(); } void SmGraphicWindow::StateChanged( StateChangedType eType ) @@ -706,8 +712,8 @@ void SmEditController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWindow, vcl::Window *pParent) : SfxDockingWindow(pBindings_, pChildWindow, pParent, WB_MOVEABLE|WB_CLOSEABLE|WB_SIZEABLE|WB_DOCKABLE), - aEdit (*this), - aController (aEdit, SID_TEXT, *pBindings_), + aEdit (new SmEditWindow(*this)), + aController (*(aEdit.get()), SID_TEXT, *pBindings_), bExiting (false) { SetHelpId( HID_SMA_COMMAND_WIN ); @@ -722,8 +728,15 @@ SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWi SmCmdBoxWindow::~SmCmdBoxWindow () { + dispose(); +} + +void SmCmdBoxWindow::dispose() +{ aInitialFocusTimer.Stop(); bExiting = true; + aEdit.disposeAndClear(); + SfxDockingWindow::dispose(); } SmViewShell * SmCmdBoxWindow::GetView() @@ -744,7 +757,7 @@ void SmCmdBoxWindow::Resize() DecorationView aView(this); aRect = aView.DrawFrame( aRect, FRAME_DRAW_IN | FRAME_DRAW_NODRAW ); - aEdit.SetPosSizePixel(aRect.TopLeft(), aRect.GetSize()); + aEdit->SetPosSizePixel(aRect.TopLeft(), aRect.GetSize()); SfxDockingWindow::Resize(); Invalidate(); } @@ -824,7 +837,7 @@ IMPL_LINK( SmCmdBoxWindow, InitialFocusTimerHdl, Timer *, EMPTYARG /*pTimer*/ ) { uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( comphelper::getProcessComponentContext() ); - aEdit.GrabFocus(); + aEdit->GrabFocus(); bool bInPlace = GetView()->GetViewFrame()->GetFrame().IsInPlace(); uno::Reference< frame::XFrame > xFrame( GetBindings().GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface()); @@ -876,7 +889,7 @@ void SmCmdBoxWindow::ToggleFloatingMode() void SmCmdBoxWindow::GetFocus() { if (!bExiting) - aEdit.GrabFocus(); + aEdit->GrabFocus(); } /**************************************************************************/ @@ -947,7 +960,7 @@ SFX_IMPL_NAMED_VIEWFACTORY(SmViewShell, "Default") void SmViewShell::AdjustPosSizePixel(const Point &rPos, const Size &rSize) { - aGraphic.SetPosSizePixel(rPos, rSize); + aGraphic->SetPosSizePixel(rPos, rSize); } @@ -1519,16 +1532,16 @@ void SmViewShell::Execute(SfxRequest& rReq) break; case SID_ZOOM_OPTIMAL: - aGraphic.ZoomToFitInWindow(); + aGraphic->ZoomToFitInWindow(); break; case SID_ZOOMIN: - aGraphic.SetZoom(aGraphic.GetZoom() + 25); + aGraphic->SetZoom(aGraphic->GetZoom() + 25); break; case SID_ZOOMOUT: - SAL_WARN_IF( aGraphic.GetZoom() < 25, "starmath", "incorrect sal_uInt16 argument" ); - aGraphic.SetZoom(aGraphic.GetZoom() - 25); + SAL_WARN_IF( aGraphic->GetZoom() < 25, "starmath", "incorrect sal_uInt16 argument" ); + aGraphic->SetZoom(aGraphic->GetZoom() - 25); break; case SID_COPYOBJECT: @@ -1743,7 +1756,7 @@ void SmViewShell::Execute(SfxRequest& rReq) if ( !pSet ) { SfxItemSet aSet( GetDoc()->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM); - aSet.Put( SvxZoomItem( SvxZoomType::PERCENT, aGraphic.GetZoom())); + aSet.Put( SvxZoomItem( SvxZoomType::PERCENT, aGraphic->GetZoom())); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { @@ -1760,11 +1773,11 @@ void SmViewShell::Execute(SfxRequest& rReq) switch( rZoom.GetType() ) { case SvxZoomType::PERCENT: - aGraphic.SetZoom((sal_uInt16)rZoom.GetValue ()); + aGraphic->SetZoom((sal_uInt16)rZoom.GetValue ()); break; case SvxZoomType::OPTIMAL: - aGraphic.ZoomToFitInWindow(); + aGraphic->ZoomToFitInWindow(); break; case SvxZoomType::PAGEWIDTH: @@ -1779,7 +1792,7 @@ void SmViewShell::Execute(SfxRequest& rReq) Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap)); sal_uInt16 nZ = (sal_uInt16) std::min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()), (long)Fraction(OutputSize.Height() * 100L, GraphicSize.Height())); - aGraphic.SetZoom (nZ); + aGraphic->SetZoom (nZ); break; } default: @@ -1798,7 +1811,7 @@ void SmViewShell::Execute(SfxRequest& rReq) if ( pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem ) ) { const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue(); - aGraphic.SetZoom( nCurrentZoom ); + aGraphic->SetZoom( nCurrentZoom ); } } break; @@ -1871,7 +1884,7 @@ void SmViewShell::GetState(SfxItemSet &rSet) break; case SID_ATTR_ZOOM: - rSet.Put(SvxZoomItem( SvxZoomType::PERCENT, aGraphic.GetZoom())); + rSet.Put(SvxZoomItem( SvxZoomType::PERCENT, aGraphic->GetZoom())); /* no break here */ case SID_ZOOMIN: case SID_ZOOMOUT: @@ -1882,7 +1895,7 @@ void SmViewShell::GetState(SfxItemSet &rSet) case SID_ATTR_ZOOMSLIDER : { - const sal_uInt16 nCurrentZoom = aGraphic.GetZoom(); + const sal_uInt16 nCurrentZoom = aGraphic->GetZoom(); SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM ); aZoomSliderItem.AddSnappingPoint( 100 ); rSet.Put( aZoomSliderItem ); @@ -1940,13 +1953,13 @@ void SmViewShell::GetState(SfxItemSet &rSet) SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *) : SfxViewShell(pFrame_, SFX_VIEW_HAS_PRINTOPTIONS | SFX_VIEW_CAN_PRINT) , pImpl(new SmViewShell_Impl) - , aGraphic(this) - , aGraphicController(aGraphic, SID_GAPHIC_SM, pFrame_->GetBindings()) + , aGraphic(new SmGraphicWindow(this)) + , aGraphicController(*aGraphic.get(), SID_GAPHIC_SM, pFrame_->GetBindings()) , bPasteState(false) , bInsertIntoEditWindow(false) { SetStatusText(OUString()); - SetWindow(&aGraphic); + SetWindow(aGraphic.get()); SfxShell::SetName(OUString("SmView")); SfxShell::SetUndoManager( &GetDoc()->GetEditEngine().GetUndoManager() ); SetHelpId( HID_SMA_VIEWSHELL_DOCUMENT ); |