summaryrefslogtreecommitdiff
path: root/starmath/source
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/source
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/source')
-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
9 files changed, 290 insertions, 70 deletions
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 )