summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-04-28 11:41:31 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-04-28 15:08:48 +0100
commite8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch)
treeb322529f4a54a6427862cb20cb4cf87fb6a5d065 /starmath
parent2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff)
parent0cde74f788a054fa2b65107a030dd463b8d11c7a (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 'starmath')
-rw-r--r--starmath/inc/ElementsDockingWindow.hxx8
-rw-r--r--starmath/inc/dialog.hxx182
-rw-r--r--starmath/inc/document.hxx12
-rw-r--r--starmath/inc/edit.hxx7
-rw-r--r--starmath/inc/smmod.hxx4
-rw-r--r--starmath/inc/toolbox.hxx7
-rw-r--r--starmath/inc/view.hxx18
-rw-r--r--starmath/inc/visitors.hxx2
-rw-r--r--starmath/qa/cppunit/test_nodetotextvisitors.cxx32
-rw-r--r--starmath/qa/cppunit/test_starmath.cxx12
-rw-r--r--starmath/source/ElementsDockingWindow.cxx24
-rw-r--r--starmath/source/accessibility.hxx4
-rw-r--r--starmath/source/dialog.cxx187
-rw-r--r--starmath/source/document.cxx16
-rw-r--r--starmath/source/edit.cxx26
-rw-r--r--starmath/source/smmod.cxx7
-rw-r--r--starmath/source/toolbox.cxx24
-rw-r--r--starmath/source/unomodel.cxx10
-rw-r--r--starmath/source/view.cxx62
19 files changed, 444 insertions, 200 deletions
diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index 96dcfd61014d..c29d85ca1a87 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -96,7 +96,7 @@ class SmElementsControl : public Control
SmElementList maElementList;
Size maMaxElementDimensions;
bool mbVerticalMode;
- std::unique_ptr<ScrollBar> mxScroll;
+ VclPtr< ScrollBar > mxScroll;
void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
@@ -109,6 +109,7 @@ class SmElementsControl : public Control
public:
SmElementsControl(vcl::Window *pParent);
virtual ~SmElementsControl();
+ virtual void dispose() SAL_OVERRIDE;
void setElementSetId(sal_uInt16 aSetId);
@@ -126,8 +127,8 @@ class SmElementsDockingWindow : public SfxDockingWindow
{
static const sal_uInt16 aCategories[];
- SmElementsControl* mpElementsControl;
- ListBox* mpElementListBox;
+ VclPtr<SmElementsControl> mpElementsControl;
+ VclPtr<ListBox> mpElementListBox;
virtual void Resize() SAL_OVERRIDE;
SmViewShell* GetView();
@@ -141,6 +142,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..8093b9be3d5c 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -52,15 +52,15 @@ void SetFontStyle(const OUString &rStyleName, vcl::Font &rFont);
class SmPrintOptionsTabPage : public SfxTabPage
{
- CheckBox* m_pTitle;
- CheckBox* m_pText;
- CheckBox* m_pFrame;
- RadioButton* m_pSizeNormal;
- RadioButton* m_pSizeScaled;
- RadioButton* m_pSizeZoomed;
- MetricField* m_pZoom;
- CheckBox* m_pNoRightSpaces;
- CheckBox* m_pSaveOnlyUsedSymbols;
+ VclPtr<CheckBox> m_pTitle;
+ VclPtr<CheckBox> m_pText;
+ VclPtr<CheckBox> m_pFrame;
+ VclPtr<RadioButton> m_pSizeNormal;
+ VclPtr<RadioButton> m_pSizeScaled;
+ VclPtr<RadioButton> m_pSizeZoomed;
+ VclPtr<MetricField> m_pZoom;
+ VclPtr<CheckBox> m_pNoRightSpaces;
+ VclPtr<CheckBox> m_pSaveOnlyUsedSymbols;
DECL_LINK(SizeButtonClickHdl, Button *);
@@ -68,9 +68,11 @@ class SmPrintOptionsTabPage : public SfxTabPage
virtual void Reset(const SfxItemSet* rSet) SAL_OVERRIDE;
public:
- static SfxTabPage* Create(vcl::Window *pWindow, const SfxItemSet &rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pWindow, const SfxItemSet &rSet);
SmPrintOptionsTabPage(vcl::Window *pParent, const SfxItemSet &rOptions);
+ virtual ~SmPrintOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
};
/**************************************************************************/
@@ -90,11 +92,11 @@ public:
class SmFontDialog : public ModalDialog
{
- ComboBox* m_pFontBox;
- VclContainer* m_pAttrFrame;
- CheckBox* m_pBoldCheckBox;
- CheckBox* m_pItalicCheckBox;
- SmShowFont* m_pShowFont;
+ VclPtr<ComboBox> m_pFontBox;
+ VclPtr<VclContainer> m_pAttrFrame;
+ VclPtr<CheckBox> m_pBoldCheckBox;
+ VclPtr<CheckBox> m_pItalicCheckBox;
+ VclPtr<SmShowFont> m_pShowFont;
vcl::Font Face;
@@ -108,6 +110,8 @@ class SmFontDialog : public ModalDialog
public:
SmFontDialog(vcl::Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes);
+ virtual ~SmFontDialog();
+ virtual void dispose() SAL_OVERRIDE;
const vcl::Font& GetFont() const { return Face; }
void SetFont(const vcl::Font &rFont);
@@ -117,18 +121,20 @@ public:
class SmFontSizeDialog : public ModalDialog
{
- MetricField* m_pBaseSize;
- MetricField* m_pTextSize;
- MetricField* m_pIndexSize;
- MetricField* m_pFunctionSize;
- MetricField* m_pOperatorSize;
- MetricField* m_pBorderSize;
- PushButton* m_pDefaultButton;
+ VclPtr<MetricField> m_pBaseSize;
+ VclPtr<MetricField> m_pTextSize;
+ VclPtr<MetricField> m_pIndexSize;
+ VclPtr<MetricField> m_pFunctionSize;
+ VclPtr<MetricField> m_pOperatorSize;
+ VclPtr<MetricField> m_pBorderSize;
+ VclPtr<PushButton> m_pDefaultButton;
DECL_LINK(DefaultButtonClickHdl, Button *);
public:
SmFontSizeDialog(vcl::Window *pParent);
+ virtual ~SmFontSizeDialog();
+ virtual void dispose() SAL_OVERRIDE;
void ReadFrom(const SmFormat &rFormat);
void WriteTo (SmFormat &rFormat) const;
@@ -138,17 +144,17 @@ public:
class SmFontTypeDialog : public ModalDialog
{
- SmFontPickListBox* m_pVariableFont;
- SmFontPickListBox* m_pFunctionFont;
- SmFontPickListBox* m_pNumberFont;
- SmFontPickListBox* m_pTextFont;
- SmFontPickListBox* m_pSerifFont;
- SmFontPickListBox* m_pSansFont;
- SmFontPickListBox* m_pFixedFont;
- MenuButton* m_pMenuButton;
- PushButton* m_pDefaultButton;
-
- OutputDevice *pFontListDev;
+ VclPtr<SmFontPickListBox> m_pVariableFont;
+ VclPtr<SmFontPickListBox> m_pFunctionFont;
+ VclPtr<SmFontPickListBox> m_pNumberFont;
+ VclPtr<SmFontPickListBox> m_pTextFont;
+ VclPtr<SmFontPickListBox> m_pSerifFont;
+ VclPtr<SmFontPickListBox> m_pSansFont;
+ VclPtr<SmFontPickListBox> m_pFixedFont;
+ VclPtr<MenuButton> m_pMenuButton;
+ VclPtr<PushButton> m_pDefaultButton;
+
+ VclPtr<OutputDevice> pFontListDev;
DECL_LINK(MenuSelectHdl, Menu *);
DECL_LINK(DefaultButtonClickHdl, Button *);
@@ -156,6 +162,8 @@ class SmFontTypeDialog : public ModalDialog
public:
SmFontTypeDialog(vcl::Window *pParent, OutputDevice *pFntListDevice);
+ virtual ~SmFontTypeDialog();
+ virtual void dispose() SAL_OVERRIDE;
void ReadFrom(const SmFormat &rFormat);
void WriteTo (SmFormat &rFormat) const;
@@ -194,19 +202,19 @@ public:
class SmDistanceDialog : public ModalDialog
{
- VclFrame* m_pFrame;
- FixedText* m_pFixedText1;
- MetricField* m_pMetricField1;
- FixedText* m_pFixedText2;
- MetricField* m_pMetricField2;
- FixedText* m_pFixedText3;
- MetricField* m_pMetricField3;
- CheckBox* m_pCheckBox1;
- FixedText* m_pFixedText4;
- MetricField* m_pMetricField4;
- MenuButton* m_pMenuButton;
- PushButton* m_pDefaultButton;
- FixedImage* m_pBitmap;
+ VclPtr<VclFrame> m_pFrame;
+ VclPtr<FixedText> m_pFixedText1;
+ VclPtr<MetricField> m_pMetricField1;
+ VclPtr<FixedText> m_pFixedText2;
+ VclPtr<MetricField> m_pMetricField2;
+ VclPtr<FixedText> m_pFixedText3;
+ VclPtr<MetricField> m_pMetricField3;
+ VclPtr<CheckBox> m_pCheckBox1;
+ VclPtr<FixedText> m_pFixedText4;
+ VclPtr<MetricField> m_pMetricField4;
+ VclPtr<MenuButton> m_pMenuButton;
+ VclPtr<PushButton> m_pDefaultButton;
+ VclPtr<FixedImage> m_pBitmap;
SmCategoryDesc *Categories[NOCATEGORIES];
sal_uInt16 nActiveCategory;
@@ -224,6 +232,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*/;
@@ -238,15 +247,17 @@ public:
class SmAlignDialog : public ModalDialog
{
- RadioButton* m_pLeft;
- RadioButton* m_pCenter;
- RadioButton* m_pRight;
- PushButton* m_pDefaultButton;
+ VclPtr<RadioButton> m_pLeft;
+ VclPtr<RadioButton> m_pCenter;
+ VclPtr<RadioButton> m_pRight;
+ VclPtr<PushButton> m_pDefaultButton;
DECL_LINK(DefaultButtonClickHdl, Button *);
public:
SmAlignDialog(vcl::Window *pParent);
+ virtual ~SmAlignDialog();
+ virtual void dispose() SAL_OVERRIDE;
void ReadFrom(const SmFormat &rFormat);
void WriteTo (SmFormat &rFormat) const;
@@ -256,7 +267,7 @@ public:
class SmShowSymbolSetWindow : public Control
{
- ScrollBar* m_pVScrollBar;
+ VclPtr<ScrollBar> m_pVScrollBar;
SymbolPtrVec_t aSymbolSet;
Link aSelectHdlLink;
Link aDblClickHdlLink;
@@ -277,6 +288,8 @@ class SmShowSymbolSetWindow : public Control
DECL_LINK( ScrollHdl, ScrollBar* );
public:
SmShowSymbolSetWindow(vcl::Window *pParent, WinBits nStyle);
+ virtual ~SmShowSymbolSetWindow();
+ virtual void dispose() SAL_OVERRIDE;
void setScrollbar(ScrollBar *pVScrollBar);
void calccols();
void SelectSymbol(sal_uInt16 nSymbol);
@@ -288,19 +301,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); }
};
@@ -331,12 +346,12 @@ class SmSymDefineDialog;
class SmSymbolDialog : public ModalDialog
{
- ListBox* m_pSymbolSets;
- SmShowSymbolSet* m_pSymbolSetDisplay;
- FixedText* m_pSymbolName;
- SmShowSymbol* m_pSymbolDisplay;
- PushButton* m_pGetBtn;
- PushButton* m_pEditBtn;
+ VclPtr<ListBox> m_pSymbolSets;
+ VclPtr<SmShowSymbolSet> m_pSymbolSetDisplay;
+ VclPtr<FixedText> m_pSymbolName;
+ VclPtr<SmShowSymbol> m_pSymbolDisplay;
+ VclPtr<PushButton> m_pGetBtn;
+ VclPtr<PushButton> m_pEditBtn;
SmViewShell &rViewSh;
SmSymbolManager &rSymbolMgr;
@@ -344,7 +359,7 @@ class SmSymbolDialog : public ModalDialog
OUString aSymbolSetName;
SymbolPtrVec_t aSymbolSet;
- OutputDevice *pFontListDev;
+ VclPtr<OutputDevice> pFontListDev;
DECL_LINK(SymbolSetChangeHdl, void*);
DECL_LINK(SymbolChangeHdl, void*);
@@ -362,6 +377,8 @@ class SmSymbolDialog : public ModalDialog
public:
SmSymbolDialog(vcl::Window * pParent, OutputDevice *pFntListDevice,
SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell);
+ virtual ~SmSymbolDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool SelectSymbolSet(const OUString &rSymbolSetName);
void SelectSymbol(sal_uInt16 nSymbolPos);
@@ -389,23 +406,23 @@ public:
class SmSymDefineDialog : public ModalDialog
{
- ComboBox* pOldSymbols;
- ComboBox* pOldSymbolSets;
- SvxShowCharSet* pCharsetDisplay;
- ComboBox* pSymbols;
- ComboBox* pSymbolSets;
- ListBox* pFonts;
- ListBox* pFontsSubsetLB;
- FontStyleBox* pStyles;
- FixedText* pOldSymbolName;
- SmShowChar* pOldSymbolDisplay;
- FixedText* pOldSymbolSetName;
- FixedText* pSymbolName;
- SmShowChar* pSymbolDisplay;
- FixedText* pSymbolSetName;
- PushButton* pAddBtn;
- PushButton* pChangeBtn;
- PushButton* pDeleteBtn;
+ VclPtr<ComboBox> pOldSymbols;
+ VclPtr<ComboBox> pOldSymbolSets;
+ VclPtr<SvxShowCharSet> pCharsetDisplay;
+ VclPtr<ComboBox> pSymbols;
+ VclPtr<ComboBox> pSymbolSets;
+ VclPtr<ListBox> pFonts;
+ VclPtr<ListBox> pFontsSubsetLB;
+ VclPtr<FontStyleBox> pStyles;
+ VclPtr<FixedText> pOldSymbolName;
+ VclPtr<SmShowChar> pOldSymbolDisplay;
+ VclPtr<FixedText> pOldSymbolSetName;
+ VclPtr<FixedText> pSymbolName;
+ VclPtr<SmShowChar> pSymbolDisplay;
+ VclPtr<FixedText> pSymbolSetName;
+ VclPtr<PushButton> pAddBtn;
+ VclPtr<PushButton> pChangeBtn;
+ VclPtr<PushButton> pDeleteBtn;
SmSymbolManager aSymbolMgrCopy,
&rSymbolMgr;
@@ -455,6 +472,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/document.hxx b/starmath/inc/document.hxx
index f439b135c26c..f12060490778 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -69,13 +69,13 @@ class EditEngine;
class SmPrinterAccess
{
- Printer* pPrinter;
- OutputDevice* pRefDev;
+ VclPtr<Printer> pPrinter;
+ VclPtr<OutputDevice> pRefDev;
public:
SmPrinterAccess( SmDocShell &rDocShell );
~SmPrinterAccess();
- Printer* GetPrinter() { return pPrinter; }
- OutputDevice* GetRefDev() { return pRefDev; }
+ Printer* GetPrinter() { return pPrinter.get(); }
+ OutputDevice* GetRefDev() { return pRefDev.get(); }
};
@@ -98,8 +98,8 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
SmNode *pTree;
SfxItemPool *pEditEngineItemPool;
EditEngine *pEditEngine;
- SfxPrinter *pPrinter; //q.v. comment to SmPrinter Access!
- Printer *pTmpPrinter; //ditto
+ VclPtr<SfxPrinter> pPrinter; //q.v. comment to SmPrinter Access!
+ VclPtr<Printer> pTmpPrinter; //ditto
sal_uInt16 nModifyCount;
bool bIsFormulaArranged;
SmCursor *pCursor;
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index dfb24e945c4f..17cea6de1857 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -55,9 +55,9 @@ class SmEditWindow : public vcl::Window, public DropTargetHelper
SmCmdBoxWindow &rCmdBox;
std::unique_ptr<EditView> pEditView;
- std::unique_ptr<ScrollBar> pHScrollBar;
- std::unique_ptr<ScrollBar> pVScrollBar;
- std::unique_ptr<ScrollBarBox> pScrollBox;
+ VclPtr<ScrollBar> pHScrollBar,
+ pVScrollBar;
+ VclPtr<ScrollBarBox> pScrollBox;
Idle aModifyIdle,
aCursorMoveIdle;
ESelection aOldSelection;
@@ -92,6 +92,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/smmod.hxx b/starmath/inc/smmod.hxx
index e324fe8fb15f..4b1c61c4e72c 100644
--- a/starmath/inc/smmod.hxx
+++ b/starmath/inc/smmod.hxx
@@ -91,7 +91,7 @@ class SmModule : public SfxModule, utl::ConfigurationListener
std::unique_ptr<SmConfig> mpConfig;
std::unique_ptr<SmLocalizedSymbolData> mpLocSymbolData;
std::unique_ptr<SvtSysLocale> mpSysLocale;
- std::unique_ptr<VirtualDevice> mpVirtualDev;
+ VclPtr<VirtualDevice> mpVirtualDev;
void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
@@ -125,7 +125,7 @@ public:
//virtual methods for options dialog
virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
- virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
+ virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
};
#define SM_MOD() ( *reinterpret_cast<SmModule**>(GetAppData(SHL_SM)) )
diff --git a/starmath/inc/toolbox.hxx b/starmath/inc/toolbox.hxx
index 472fe602c1a2..1af665e78954 100644
--- a/starmath/inc/toolbox.hxx
+++ b/starmath/inc/toolbox.hxx
@@ -32,7 +32,7 @@ class SmToolBoxWindow : public SfxFloatingWindow
{
protected:
- ToolBox* m_pToolBoxCat;
+ VclPtr<ToolBox> m_pToolBoxCat;
sal_uInt16 m_nUnbinopsId;
sal_uInt16 m_nRelationsId;
sal_uInt16 m_nSetoperationsId;
@@ -42,8 +42,8 @@ protected:
sal_uInt16 m_nBracketsId;
sal_uInt16 m_nFormatId;
sal_uInt16 m_nMiscId;
- ToolBox *pToolBoxCmd;
- ToolBox *vToolBoxCategories[NUM_TBX_CATEGORIES];
+ VclPtr<ToolBox> pToolBoxCmd;
+ VclPtr<ToolBox> vToolBoxCategories[NUM_TBX_CATEGORIES];
ImageList *aImageLists [NUM_TBX_CATEGORIES + 1]; /* regular */
sal_uInt16 nActiveCategoryRID;
@@ -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..52f6c1e1df37 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();
};
@@ -214,7 +216,7 @@ public:
SmEditWindow& GetEditWindow()
{
- return static_cast<SmCmdBoxWindow *>(pWindow)->GetEditWindow();
+ return static_cast<SmCmdBoxWindow *>(pWindow.get())->GetEditWindow();
}
};
@@ -231,7 +233,7 @@ class SmViewShell: public SfxViewShell
std::unique_ptr<SmViewShell_Impl> pImpl;
- SmGraphicWindow aGraphic;
+ VclPtr<SmGraphicWindow> aGraphic;
SmGraphicController aGraphicController;
OUString aStatusText;
@@ -268,8 +270,8 @@ protected:
void InsertFrom(SfxMedium &rMedium);
virtual bool HasPrintOptionsPage() const SAL_OVERRIDE;
- virtual SfxTabPage *CreatePrintOptionsPage(::vcl::Window *pParent,
- const SfxItemSet &rOptions) SAL_OVERRIDE;
+ virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(::vcl::Window *pParent,
+ const SfxItemSet &rOptions) SAL_OVERRIDE;
virtual void Deactivate(bool IsMDIActivate) SAL_OVERRIDE;
virtual void Activate(bool IsMDIActivate) SAL_OVERRIDE;
virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize) SAL_OVERRIDE;
@@ -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/inc/visitors.hxx b/starmath/inc/visitors.hxx
index adbab3b5c091..bf5bb2edcdaa 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -149,7 +149,7 @@ public:
}
private:
SmCaretLine line;
- OutputDevice *pDev;
+ VclPtr<OutputDevice> pDev;
SmCaretPos pos;
protected:
/** Default method for computing lines for pNodes */
diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
index 5189fc223aa5..2b105cbca164 100644
--- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx
+++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
@@ -519,12 +519,12 @@ void Test::testBinomInBinHor()
pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmCursor aCursor(pTree, xDocShRef);
- VirtualDevice aOutputDevice;
+ ScopedVclPtrInstance< VirtualDevice > pOutputDevice;
// move forward (more than) enough places to be at the end
int i;
for (i = 0; i < 8; ++i)
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
// tack +d on the end, which will put the binom into an SmBinHorNode
aCursor.InsertElement(PlusElement);
@@ -547,18 +547,18 @@ void Test::testBinVerInUnary()
pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmCursor aCursor(pTree, xDocShRef);
- VirtualDevice aOutputDevice;
+ ScopedVclPtrInstance< VirtualDevice > pOutputDevice;
// move forward (more than) enough places to be at the end
int i;
for (i = 0; i < 3; ++i)
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
// select the operand
- aCursor.Move(&aOutputDevice, MoveLeft, false);
+ aCursor.Move(pOutputDevice, MoveLeft, false);
// set up a fraction
aCursor.InsertFraction();
- aCursor.Move(&aOutputDevice, MoveDown);
+ aCursor.Move(pOutputDevice, MoveDown);
aCursor.InsertText("2");
sExpected += " - { 1 over 2 } ";
@@ -576,7 +576,7 @@ void Test::testBinHorInSubSup()
pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmCursor aCursor(pTree, xDocShRef);
- VirtualDevice aOutputDevice;
+ ScopedVclPtrInstance< VirtualDevice > pOutputDevice;
// Insert an RSup expression with a BinHor for the exponent
aCursor.InsertText("a");
@@ -586,7 +586,7 @@ void Test::testBinHorInSubSup()
aCursor.InsertText("c");
// Move to the end and add d to the expression
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
aCursor.InsertElement(PlusElement);
aCursor.InsertText("d");
@@ -604,30 +604,30 @@ void Test::testUnaryInMixedNumberAsNumerator()
pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmCursor aCursor(pTree, xDocShRef);
- VirtualDevice aOutputDevice;
+ ScopedVclPtrInstance< VirtualDevice > pOutputDevice;
// move forward (more than) enough places to be at the end
for (size_t i = 0; i < 3; ++i)
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
// Select the whole Unary Horizontal Node
- aCursor.Move(&aOutputDevice, MoveLeft, false);
- aCursor.Move(&aOutputDevice, MoveLeft, false);
+ aCursor.Move(pOutputDevice, MoveLeft, false);
+ aCursor.Move(pOutputDevice, MoveLeft, false);
// Set up a fraction
aCursor.InsertFraction();
- aCursor.Move(&aOutputDevice, MoveDown);
+ aCursor.Move(pOutputDevice, MoveDown);
aCursor.InsertText("2");
// Move left and turn this into a mixed number
// (bad form, but this could happen right?)
- aCursor.Move(&aOutputDevice, MoveLeft);
- aCursor.Move(&aOutputDevice, MoveLeft);
+ aCursor.Move(pOutputDevice, MoveLeft);
+ aCursor.Move(pOutputDevice, MoveLeft);
aCursor.InsertText("2");
// move forward (more than) enough places to be at the end
for (size_t i = 0; i < 8; ++i)
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
// add 4 to the end
aCursor.InsertElement(PlusElement);
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 4be2fd77ac50..5de607ce30b3 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -57,8 +57,8 @@ public:
private:
SfxBindings m_aBindings;
std::unique_ptr<SfxDispatcher> m_pDispatcher;
- std::unique_ptr<SmCmdBoxWindow> m_pSmCmdBoxWindow;
- std::unique_ptr<SmEditWindow> m_pEditWindow;
+ VclPtr<SmCmdBoxWindow> m_pSmCmdBoxWindow;
+ VclPtr<SmEditWindow> m_pEditWindow;
SmDocShellRef m_xDocShRef;
SmViewShell *m_pViewShell;
};
@@ -87,17 +87,17 @@ void Test::setUp()
m_pDispatcher.reset(new SfxDispatcher(pViewFrame));
m_aBindings.SetDispatcher(m_pDispatcher.get());
m_aBindings.EnterRegistrations();
- m_pSmCmdBoxWindow.reset(new SmCmdBoxWindow(&m_aBindings, NULL, NULL));
+ m_pSmCmdBoxWindow.reset(VclPtr<SmCmdBoxWindow>::Create(&m_aBindings, nullptr, nullptr));
m_aBindings.LeaveRegistrations();
- m_pEditWindow.reset(new SmEditWindow(*m_pSmCmdBoxWindow));
+ m_pEditWindow = VclPtr<SmEditWindow>::Create(*m_pSmCmdBoxWindow);
m_pViewShell = m_pEditWindow->GetView();
CPPUNIT_ASSERT_MESSAGE("Should have a SmViewShell", m_pViewShell);
}
void Test::tearDown()
{
- m_pEditWindow.reset();
- m_pSmCmdBoxWindow.reset();
+ m_pEditWindow.disposeAndClear();
+ m_pSmCmdBoxWindow.disposeAndClear();
m_pDispatcher.reset();
m_xDocShRef->DoClose();
m_xDocShRef.Clear();
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 12eb670136a1..4a5118a5b789 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -224,7 +224,7 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
, maCurrentSetId(0)
, mpCurrentElement(NULL)
, mbVerticalMode(true)
- , mxScroll(new ScrollBar(this, WB_VERT))
+ , mxScroll(VclPtr<ScrollBar>::Create(this, WB_VERT))
{
SetMapMode( MapMode(MAP_100TH_MM) );
SetDrawMode( DRAWMODE_DEFAULT );
@@ -239,7 +239,14 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
SmElementsControl::~SmElementsControl()
{
+ disposeOnce();
+}
+
+void SmElementsControl::dispose()
+{
mpDocShell->DoClose();
+ mxScroll.disposeAndClear();
+ Control::dispose();
}
void SmElementsControl::setVerticalMode(bool bVerticalMode)
@@ -646,7 +653,7 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf
SfxDockingWindow(pInputBindings, pChildWindow, pParent, "DockingElements",
"modules/smath/ui/dockingelements.ui")
{
- mpElementsControl = new SmElementsControl(get<vcl::Window>("box"));
+ mpElementsControl = VclPtr<SmElementsControl>::Create(get<vcl::Window>("box"));
mpElementsControl->set_hexpand(true);
mpElementsControl->set_vexpand(true);
mpElementsControl->Show();
@@ -672,7 +679,14 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf
SmElementsDockingWindow::~SmElementsDockingWindow ()
{
- delete mpElementsControl;
+ disposeOnce();
+}
+
+void SmElementsDockingWindow::dispose()
+{
+ mpElementsControl.disposeAndClear();
+ mpElementListBox.clear();
+ SfxDockingWindow::dispose();
}
void SmElementsDockingWindow::ToggleFloatingMode()
@@ -755,8 +769,8 @@ SmElementsDockingWindowWrapper::SmElementsDockingWindowWrapper(
SfxBindings *pBindings, SfxChildWinInfo *pInfo) :
SfxChildWindow(pParentWindow, nId)
{
- SmElementsDockingWindow* pDialog = new SmElementsDockingWindow(pBindings, this, pParentWindow);
- pWindow = pDialog;
+ VclPtrInstance<SmElementsDockingWindow> pDialog(pBindings, this, pParentWindow);
+ pWindow.reset(pDialog);
pDialog->setDeferredProperties();
pDialog->SetPosSizePixel(Point(0, 0), Size(300, 0));
pDialog->Show();
diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx
index ddac5836432f..b626064647b4 100644
--- a/starmath/source/accessibility.hxx
+++ b/starmath/source/accessibility.hxx
@@ -70,7 +70,7 @@ class SmGraphicAccessible :
/// client id in the AccessibleEventNotifier queue
sal_uInt32 nClientId;
- SmGraphicWindow *pWin;
+ VclPtr<SmGraphicWindow> pWin;
SmGraphicAccessible( const SmGraphicAccessible & ) SAL_DELETED_FUNCTION;
SmGraphicAccessible & operator = ( const SmGraphicAccessible & ) SAL_DELETED_FUNCTION;
@@ -316,7 +316,7 @@ class SmEditAccessible :
{
OUString aAccName;
::accessibility::AccessibleTextHelper *pTextHelper;
- SmEditWindow *pWin;
+ VclPtr<SmEditWindow> pWin;
SmEditAccessible( const SmEditAccessible & ) SAL_DELETED_FUNCTION;
SmEditAccessible & operator = ( const SmEditAccessible & ) SAL_DELETED_FUNCTION;
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index b942d2bc6adc..a78f528978ef 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -177,6 +177,25 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(vcl::Window *pParent, const SfxItem
Reset(&rOptions);
}
+SmPrintOptionsTabPage::~SmPrintOptionsTabPage()
+{
+ disposeOnce();
+}
+
+void SmPrintOptionsTabPage::dispose()
+{
+ m_pTitle.clear();
+ m_pText.clear();
+ m_pFrame.clear();
+ m_pSizeNormal.clear();
+ m_pSizeScaled.clear();
+ m_pSizeZoomed.clear();
+ m_pZoom.clear();
+ m_pNoRightSpaces.clear();
+ m_pSaveOnlyUsedSymbols.clear();
+ SfxTabPage::dispose();
+}
+
bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet)
{
@@ -220,9 +239,9 @@ void SmPrintOptionsTabPage::Reset(const SfxItemSet* rSet)
}
-SfxTabPage* SmPrintOptionsTabPage::Create(vcl::Window* pWindow, const SfxItemSet& rSet)
+VclPtr<SfxTabPage> SmPrintOptionsTabPage::Create(vcl::Window* pWindow, const SfxItemSet& rSet)
{
- return (new SmPrintOptionsTabPage(pWindow, rSet));
+ return VclPtr<SmPrintOptionsTabPage>::Create(pWindow, rSet).get();
}
/**************************************************************************/
@@ -366,6 +385,21 @@ SmFontDialog::SmFontDialog(vcl::Window * pParent, OutputDevice *pFntListDevice,
}
}
+SmFontDialog::~SmFontDialog()
+{
+ disposeOnce();
+}
+
+void SmFontDialog::dispose()
+{
+ m_pFontBox.clear();
+ m_pAttrFrame.clear();
+ m_pBoldCheckBox.clear();
+ m_pItalicCheckBox.clear();
+ m_pShowFont.clear();
+ ModalDialog::dispose();
+}
+
namespace
{
void getColors(vcl::Window &rRef, ColorData &rBgCol, ColorData &rTxtCol)
@@ -441,6 +475,23 @@ SmFontSizeDialog::SmFontSizeDialog(vcl::Window * pParent)
m_pDefaultButton->SetClickHdl(LINK(this, SmFontSizeDialog, DefaultButtonClickHdl));
}
+SmFontSizeDialog::~SmFontSizeDialog()
+{
+ disposeOnce();
+}
+
+void SmFontSizeDialog::dispose()
+{
+ m_pBaseSize.clear();
+ m_pTextSize.clear();
+ m_pIndexSize.clear();
+ m_pFunctionSize.clear();
+ m_pOperatorSize.clear();
+ m_pBorderSize.clear();
+ m_pDefaultButton.clear();
+ ModalDialog::dispose();
+}
+
void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat)
{
@@ -496,7 +547,7 @@ IMPL_LINK( SmFontTypeDialog, MenuSelectHdl, Menu *, pMenu )
if (pActiveListBox)
{
- std::unique_ptr<SmFontDialog> pFontDialog(new SmFontDialog(this, pFontListDev, bHideCheckboxes));
+ ScopedVclPtrInstance<SmFontDialog> pFontDialog(this, pFontListDev, bHideCheckboxes);
pActiveListBox->WriteTo(*pFontDialog);
if (pFontDialog->Execute() == RET_OK)
@@ -538,6 +589,25 @@ SmFontTypeDialog::SmFontTypeDialog(vcl::Window * pParent, OutputDevice *pFntList
m_pMenuButton->GetPopupMenu()->SetSelectHdl(LINK(this, SmFontTypeDialog, MenuSelectHdl));
}
+SmFontTypeDialog::~SmFontTypeDialog()
+{
+ disposeOnce();
+}
+
+void SmFontTypeDialog::dispose()
+{
+ m_pVariableFont.clear();
+ m_pFunctionFont.clear();
+ m_pNumberFont.clear();
+ m_pTextFont.clear();
+ m_pSerifFont.clear();
+ m_pSansFont.clear();
+ m_pFixedFont.clear();
+ m_pMenuButton.clear();
+ m_pDefaultButton.clear();
+ ModalDialog::dispose();
+}
+
void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat)
{
SmModule *pp = SM_MOD();
@@ -891,8 +961,27 @@ SmDistanceDialog::SmDistanceDialog(vcl::Window *pParent)
SmDistanceDialog::~SmDistanceDialog()
{
+ disposeOnce();
+}
+
+void SmDistanceDialog::dispose()
+{
for (int i = 0; i < NOCATEGORIES; i++)
DELETEZ(Categories[i]);
+ m_pFrame.clear();
+ m_pFixedText1.clear();
+ m_pMetricField1.clear();
+ m_pFixedText2.clear();
+ m_pMetricField2.clear();
+ m_pFixedText3.clear();
+ m_pMetricField3.clear();
+ m_pCheckBox1.clear();
+ m_pFixedText4.clear();
+ m_pMetricField4.clear();
+ m_pMenuButton.clear();
+ m_pDefaultButton.clear();
+ m_pBitmap.clear();
+ ModalDialog::dispose();
}
void SmDistanceDialog::DataChanged( const DataChangedEvent &rEvt )
@@ -995,6 +1084,19 @@ SmAlignDialog::SmAlignDialog(vcl::Window * pParent)
m_pDefaultButton->SetClickHdl(LINK(this, SmAlignDialog, DefaultButtonClickHdl));
}
+SmAlignDialog::~SmAlignDialog()
+{
+ disposeOnce();
+}
+
+void SmAlignDialog::dispose()
+{
+ m_pLeft.clear();
+ m_pCenter.clear();
+ m_pRight.clear();
+ m_pDefaultButton.clear();
+ ModalDialog::dispose();
+}
void SmAlignDialog::ReadFrom(const SmFormat &rFormat)
{
@@ -1054,6 +1156,17 @@ SmShowSymbolSetWindow::SmShowSymbolSetWindow(vcl::Window *pParent, WinBits nStyl
SetTextColor( aTxtColor );
}
+SmShowSymbolSetWindow::~SmShowSymbolSetWindow()
+{
+ disposeOnce();
+}
+
+void SmShowSymbolSetWindow::dispose()
+{
+ m_pVScrollBar.clear();
+ Control::dispose();
+}
+
Point SmShowSymbolSetWindow::OffsetPoint(const Point &rPoint) const
{
return Point(rPoint.X() + nXOffset, rPoint.Y() + nYOffset);
@@ -1181,14 +1294,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(VclPtr<SmShowSymbolSetWindow>::Create(this, WB_TABSTOP))
+ , aVScrollBar(VclPtr<ScrollBar>::Create(this, WinBits(WB_VSCROLL)))
+{
+ aSymbolWindow->set_hexpand(true);
+ aSymbolWindow->set_vexpand(true);
+ aSymbolWindow->setScrollbar(aVScrollBar.get());
+ aSymbolWindow->calccols();
+ aSymbolWindow->Show();
+}
+
+SmShowSymbolSet::~SmShowSymbolSet()
+{
+ disposeOnce();
+}
+
+void SmShowSymbolSet::dispose()
{
- aSymbolWindow.set_hexpand(true);
- aSymbolWindow.set_vexpand(true);
- aSymbolWindow.setScrollbar(&aVScrollBar);
- aSymbolWindow.calccols();
- aSymbolWindow.Show();
+ aSymbolWindow.disposeAndClear();
+ aVScrollBar.disposeAndClear();
+ VclHBox::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSmShowSymbolSet(vcl::Window *pParent, VclBuilder::stringmap &)
@@ -1379,7 +1504,7 @@ IMPL_LINK_NOARG( SmSymbolDialog, SymbolChangeHdl )
IMPL_LINK_NOARG(SmSymbolDialog, EditClickHdl)
{
- std::unique_ptr<SmSymDefineDialog> pDialog(new SmSymDefineDialog(this, pFontListDev, rSymbolMgr));
+ ScopedVclPtrInstance<SmSymDefineDialog> pDialog(this, pFontListDev, rSymbolMgr);
// set current symbol and SymbolSet for the new dialog
const OUString aSymSetName (m_pSymbolSets->GetSelectEntry()),
@@ -1483,6 +1608,21 @@ SmSymbolDialog::SmSymbolDialog(vcl::Window *pParent, OutputDevice *pFntListDevic
m_pGetBtn->SetClickHdl(LINK(this, SmSymbolDialog, GetClickHdl));
}
+SmSymbolDialog::~SmSymbolDialog()
+{
+ disposeOnce();
+}
+
+void SmSymbolDialog::dispose()
+{
+ m_pSymbolSets.clear();
+ m_pSymbolSetDisplay.clear();
+ m_pSymbolName.clear();
+ m_pSymbolDisplay.clear();
+ m_pGetBtn.clear();
+ m_pEditBtn.clear();
+ ModalDialog::dispose();
+}
void SmSymbolDialog::InitColor_Impl()
{
@@ -2032,6 +2172,31 @@ SmSymDefineDialog::SmSymDefineDialog(vcl::Window * pParent,
SmSymDefineDialog::~SmSymDefineDialog()
{
+ disposeOnce();
+}
+
+void SmSymDefineDialog::dispose()
+{
+ pSubsetMap.reset();
+ pOrigSymbol.reset();
+ pOldSymbols.clear();
+ pOldSymbolSets.clear();
+ pCharsetDisplay.clear();
+ pSymbols.clear();
+ pSymbolSets.clear();
+ pFonts.clear();
+ pFontsSubsetLB.clear();
+ pStyles.clear();
+ pOldSymbolName.clear();
+ pOldSymbolDisplay.clear();
+ pOldSymbolSetName.clear();
+ pSymbolName.clear();
+ pSymbolDisplay.clear();
+ pSymbolSetName.clear();
+ pAddBtn.clear();
+ pChangeBtn.clear();
+ pDeleteBtn.clear();
+ ModalDialog::dispose();
}
void SmSymDefineDialog::InitColor_Impl()
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 73e4fa47f2d5..c96cd46c8173 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -531,7 +531,7 @@ SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
}
}
}
- if ( 0 != (pRefDev = rDocShell.GetRefDev()) && pPrinter != pRefDev )
+ if ( !!(pRefDev = rDocShell.GetRefDev()) && pPrinter.get() != pRefDev.get() )
{
pRefDev->Push( PushFlags::MAPMODE );
if ( SfxObjectCreateMode::EMBEDDED == rDocShell.GetCreateMode() )
@@ -595,7 +595,7 @@ Printer* SmDocShell::GetPrt()
SmModule *pp = SM_MOD();
pp->GetConfig()->ConfigToItemSet(*pOptions);
- pPrinter = new SfxPrinter(pOptions);
+ pPrinter = VclPtr<SfxPrinter>::Create(pOptions);
pPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
}
return pPrinter;
@@ -616,7 +616,7 @@ OutputDevice* SmDocShell::GetRefDev()
void SmDocShell::SetPrinter( SfxPrinter *pNew )
{
- delete pPrinter;
+ pPrinter.disposeAndClear();
pPrinter = pNew; //Transfer ownership
pPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
SetFormulaArranged(false);
@@ -693,7 +693,7 @@ SmDocShell::~SmDocShell()
delete pEditEngine;
SfxItemPool::Free(pEditEngineItemPool);
delete pTree;
- delete pPrinter;
+ pPrinter.disposeAndClear();
}
bool SmDocShell::ConvertFrom(SfxMedium &rMedium)
@@ -989,7 +989,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
pDev = &SM_MOD()->GetDefaultVirtualDev();
OSL_ENSURE (pDev, "device for font list missing" );
- std::unique_ptr<SmFontTypeDialog> xFontTypeDialog(new SmFontTypeDialog( NULL, pDev ));
+ VclPtrInstance< SmFontTypeDialog > xFontTypeDialog( nullptr, pDev );
SmFormat aOldFormat = GetFormat();
xFontTypeDialog->ReadFrom( aOldFormat );
@@ -1011,7 +1011,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_FONTSIZE:
{
- std::unique_ptr<SmFontSizeDialog> xFontSizeDialog(new SmFontSizeDialog(NULL));
+ VclPtrInstance< SmFontSizeDialog > xFontSizeDialog(nullptr);
SmFormat aOldFormat = GetFormat();
xFontSizeDialog->ReadFrom( aOldFormat );
@@ -1034,7 +1034,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_DISTANCE:
{
- std::unique_ptr<SmDistanceDialog> xDistanceDialog(new SmDistanceDialog(NULL));
+ VclPtrInstance< SmDistanceDialog > xDistanceDialog(nullptr);
SmFormat aOldFormat = GetFormat();
xDistanceDialog->ReadFrom( aOldFormat );
@@ -1057,7 +1057,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_ALIGN:
{
- std::unique_ptr<SmAlignDialog> xAlignDialog(new SmAlignDialog(NULL));
+ VclPtrInstance< SmAlignDialog > xAlignDialog(nullptr);
SmFormat aOldFormat = GetFormat();
xAlignDialog->ReadFrom( aOldFormat );
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 34d4ecd29e0e..fa9ebaa138f9 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -95,7 +95,7 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) :
SetMapMode(MAP_PIXEL);
// Even RTL languages don't use RTL for math
- rCmdBox.GetEditWindow().EnableRTL( false );
+ EnableRTL( false );
ApplyColorConfigValues( SM_MOD()->GetColorConfig() );
@@ -119,6 +119,11 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) :
SmEditWindow::~SmEditWindow()
{
+ disposeOnce();
+}
+
+void SmEditWindow::dispose()
+{
aModifyIdle.Stop();
StartCursorMove();
@@ -127,9 +132,13 @@ SmEditWindow::~SmEditWindow()
// must be done before EditView (and thus EditEngine) is no longer
// available for those classes.
if (pAccessible)
+ {
pAccessible->ClearWin(); // make Accessible defunctional
+ pAccessible = NULL;
+ xAccessible.clear();
+ }
// Note: memory for pAccessible will be freed when the reference
- // xAccessible is released.
+ // xAccessible is released. FIXME: horribly redundant lifecycle ! ...
if (pEditView)
{
@@ -139,7 +148,14 @@ SmEditWindow::~SmEditWindow()
pEditEngine->SetStatusEventHdl( Link() );
pEditEngine->RemoveView( pEditView.get() );
}
+ pEditView.reset();
}
+
+ pHScrollBar.disposeAndClear();
+ pVScrollBar.disposeAndClear();
+ pScrollBox.disposeAndClear();
+
+ vcl::Window::dispose();
}
void SmEditWindow::StartCursorMove()
@@ -534,11 +550,11 @@ void SmEditWindow::CreateEditView()
pEditEngine->InsertView( pEditView.get() );
if (!pVScrollBar)
- pVScrollBar.reset(new ScrollBar(this, WinBits(WB_VSCROLL)));
+ pVScrollBar = VclPtr<ScrollBar>::Create(this, WinBits(WB_VSCROLL));
if (!pHScrollBar)
- pHScrollBar.reset(new ScrollBar(this, WinBits(WB_HSCROLL)));
+ pHScrollBar = VclPtr<ScrollBar>::Create(this, WinBits(WB_HSCROLL));
if (!pScrollBox)
- pScrollBox.reset(new ScrollBarBox(this));
+ pScrollBox = VclPtr<ScrollBarBox>::Create(this);
pVScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
pHScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
pVScrollBar->EnableDrag( true );
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 4c0e5e104f5d..ab09940a38ae 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -174,6 +174,7 @@ SmModule::~SmModule()
{
if (mpColorConfig)
mpColorConfig->RemoveListener(this);
+ mpVirtualDev.disposeAndClear();
}
void SmModule::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg )
@@ -241,7 +242,7 @@ VirtualDevice &SmModule::GetDefaultVirtualDev()
{
if (!mpVirtualDev)
{
- mpVirtualDev.reset(new VirtualDevice);
+ mpVirtualDev.reset( VclPtr<VirtualDevice>::Create() );
mpVirtualDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
}
return *mpVirtualDev;
@@ -287,9 +288,9 @@ void SmModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
GetConfig()->ItemSetToConfig(rSet);
}
}
-SfxTabPage* SmModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
+VclPtr<SfxTabPage> SmModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
{
- SfxTabPage* pRet = 0;
+ VclPtr<SfxTabPage> pRet;
if(nId == SID_SM_TP_PRINTOPTIONS)
pRet = SmPrintOptionsTabPage::Create( pParent, rSet );
return pRet;
diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx
index d6ff88adbab8..26a1fbe7db23 100644
--- a/starmath/source/toolbox.cxx
+++ b/starmath/source/toolbox.cxx
@@ -127,7 +127,7 @@ SmToolBoxWindow::SmToolBoxWindow(SfxBindings *pTmpBindings,
sal_uInt16 i;
for (i = 0; i < NUM_TBX_CATEGORIES; ++i)
{
- ToolBox *pBox = new ToolBox(get<vcl::Window>("box"), SmResId( TOOLBOX_CAT_A + i ));
+ VclPtrInstance<ToolBox> pBox(get<vcl::Window>("box"), SmResId( TOOLBOX_CAT_A + i ));
vToolBoxCategories[i] = pBox;
pBox->SetSelectHdl(LINK(this, SmToolBoxWindow, CmdSelectHdl));
}
@@ -139,14 +139,24 @@ SmToolBoxWindow::SmToolBoxWindow(SfxBindings *pTmpBindings,
SmToolBoxWindow::~SmToolBoxWindow()
{
+ disposeOnce();
+}
+
+void SmToolBoxWindow::dispose()
+{
int i;
for (i = 0; i < NUM_TBX_CATEGORIES; ++i)
- {
- ToolBox *pBox = vToolBoxCategories[i];
- delete pBox;
- }
+ vToolBoxCategories[i].disposeAndClear();
+
+ pToolBoxCmd = 0;
for (i = 0; i < NUM_TBX_CATEGORIES + 1; ++i)
+ {
delete aImageLists[i];
+ aImageLists[i] = 0;
+ }
+ m_pToolBoxCat.clear();
+ pToolBoxCmd.clear();
+ SfxFloatingWindow::dispose();
}
SmViewShell * SmToolBoxWindow::GetView()
@@ -351,8 +361,8 @@ SmToolBoxWrapper::SmToolBoxWrapper(vcl::Window *pParentWindow,
{
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- pWindow = new SmToolBoxWindow(pBindings, this, pParentWindow);
- static_cast<SfxFloatingWindow *>(pWindow)->Initialize(pInfo);
+ pWindow.reset(VclPtr<SmToolBoxWindow>::Create(pBindings, this, pParentWindow));
+ static_cast<SfxFloatingWindow *>(pWindow.get())->Initialize(pInfo);
}
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index f4bfcab8b8a9..74edb409a8a5 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -604,11 +604,11 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
{
if ( !sPrinterName.isEmpty() )
{
- SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
+ VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
if (pNewPrinter->IsKnown())
pDocSh->SetPrinter ( pNewPrinter );
else
- delete pNewPrinter;
+ pNewPrinter.disposeAndClear();
}
}
else
@@ -639,7 +639,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange );
SmModule *pp = SM_MOD();
pp->GetConfig()->ConfigToItemSet(*pItemSet);
- SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+ VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, pItemSet );
pDocSh->SetPrinter( pPrinter );
}
@@ -1020,8 +1020,8 @@ void SAL_CALL SmModel::render(
if (xRenderDevice.is())
{
VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
- OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
-
+ VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice()
+ : VclPtr< OutputDevice >();
if (!pOut)
throw RuntimeException();
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 4b22180b6ac3..e3b5f6f64df2 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -119,11 +119,17 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
SmGraphicWindow::~SmGraphicWindow()
{
+ disposeOnce();
+}
+
+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 (VclPtr<SmEditWindow>::Create(*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 ()
{
+ disposeOnce();
+}
+
+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();
}
/**************************************************************************/
@@ -889,11 +902,11 @@ SmCmdBoxWrapper::SmCmdBoxWrapper(vcl::Window *pParentWindow, sal_uInt16 nId,
SfxChildWinInfo *pInfo) :
SfxChildWindow(pParentWindow, nId)
{
- pWindow = new SmCmdBoxWindow(pBindings, this, pParentWindow);
+ pWindow.reset(VclPtr<SmCmdBoxWindow>::Create(pBindings, this, pParentWindow));
// make window docked to the bottom initially (after first start)
eChildAlignment = SfxChildAlignment::BOTTOM;
- static_cast<SfxDockingWindow *>(pWindow)->Initialize(pInfo);
+ static_cast<SfxDockingWindow *>(pWindow.get())->Initialize(pInfo);
}
@@ -936,7 +949,7 @@ SFX_IMPL_NAMED_VIEWFACTORY(SmViewShell, "Default")
void SmViewShell::AdjustPosSizePixel(const Point &rPos, const Size &rSize)
{
- aGraphic.SetPosSizePixel(rPos, rSize);
+ aGraphic->SetPosSizePixel(rPos, rSize);
}
@@ -1338,8 +1351,8 @@ bool SmViewShell::HasPrintOptionsPage() const
return true;
}
-SfxTabPage* SmViewShell::CreatePrintOptionsPage(vcl::Window *pParent,
- const SfxItemSet &rOptions)
+VclPtr<SfxTabPage> SmViewShell::CreatePrintOptionsPage(vcl::Window *pParent,
+ const SfxItemSet &rOptions)
{
return SmPrintOptionsTabPage::Create(pParent, rOptions);
}
@@ -1508,16 +1521,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:
@@ -1730,7 +1743,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)
{
@@ -1747,11 +1760,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:
@@ -1766,7 +1779,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:
@@ -1785,7 +1798,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;
@@ -1858,7 +1871,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:
@@ -1869,7 +1882,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 );
@@ -1927,13 +1940,13 @@ void SmViewShell::GetState(SfxItemSet &rSet)
SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *)
: SfxViewShell(pFrame_, SfxViewShellFlags::HAS_PRINTOPTIONS | SfxViewShellFlags::CAN_PRINT)
, pImpl(new SmViewShell_Impl)
- , aGraphic(this)
- , aGraphicController(aGraphic, SID_GAPHIC_SM, pFrame_->GetBindings())
+ , aGraphic(VclPtr<SmGraphicWindow>::Create(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 );
@@ -1948,6 +1961,7 @@ SmViewShell::~SmViewShell()
SmEditWindow *pEditWin = GetEditWindow();
if (pEditWin)
pEditWin->DeleteEditView( *this );
+ aGraphic.disposeAndClear();
}
void SmViewShell::Deactivate( bool bIsMDIActivate )