[Libreoffice-commits] core.git: Branch 'feature/vclptr' - 2 commits - include/sfx2 sc/source sfx2/source slideshow/source starmath/inc starmath/source sw/source

Michael Meeks michael.meeks at collabora.com
Thu Apr 16 12:48:05 PDT 2015


 include/sfx2/viewsh.hxx                           |    4 ++--
 sc/source/ui/inc/prevwsh.hxx                      |    2 +-
 sc/source/ui/inc/tabvwsh.hxx                      |    2 +-
 sc/source/ui/view/prevwsh.cxx                     |    9 +++++----
 sc/source/ui/view/tabvwsh4.cxx                    |    7 ++++---
 sfx2/source/view/printer.cxx                      |    2 +-
 sfx2/source/view/viewprn.cxx                      |    4 ++--
 slideshow/source/engine/shapes/viewmediashape.cxx |    6 +++---
 starmath/inc/view.hxx                             |    4 ++--
 starmath/source/view.cxx                          |    4 ++--
 sw/source/uibase/inc/pview.hxx                    |    2 +-
 sw/source/uibase/inc/view.hxx                     |    8 ++++----
 sw/source/uibase/uiview/pview.cxx                 |    4 ++--
 sw/source/uibase/uiview/viewfunc.hxx              |    2 +-
 sw/source/uibase/uiview/viewprt.cxx               |   13 ++++++++-----
 15 files changed, 39 insertions(+), 34 deletions(-)

New commits:
commit 5430eb76db1ca40248717bcbee6b65e56c1a0e9b
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Apr 16 20:50:12 2015 +0100

    slideshow: convert new to ::Create to get initial ref-counting right.
    
    Change-Id: I513dacfa0dd2e902437578611b6d39575f2e7314

diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index afddec0..f026b21 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -471,20 +471,20 @@ namespace slideshow
 #else
                             if( avmedia::IsModel(rMimeType) )
                             {
-                                mpEventHandlerParent.reset(new vcl::Window(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL));
+                                mpEventHandlerParent.reset(VclPtr<vcl::Window>::Create(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL));
                                 mpEventHandlerParent->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
                                                            Size( aAWTRect.Width, aAWTRect.Height ) );
                                 mpEventHandlerParent->EnablePaint(false);
                                 mpEventHandlerParent->Show();
                                 SystemWindowData aWinData = OpenGLContext::generateWinData(mpEventHandlerParent.get(), false);
-                                mpMediaWindow.reset(new SystemChildWindow(mpEventHandlerParent.get(), 0, &aWinData));
+                                mpMediaWindow.reset(VclPtr<SystemChildWindow>::Create(mpEventHandlerParent.get(), 0, &aWinData));
                                 mpMediaWindow->SetPosSizePixel( Point( 0, 0 ),
                                                            Size( aAWTRect.Width, aAWTRect.Height ) );
                             }
                             else
 #endif
                             {
-                                mpMediaWindow.reset( new SystemChildWindow( pWindow, WB_CLIPCHILDREN ) );
+                                mpMediaWindow.reset( VclPtr<SystemChildWindow>::Create( pWindow, WB_CLIPCHILDREN ) );
                                 mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
                                                            Size( aAWTRect.Width, aAWTRect.Height ) );
                             }
commit f1879e200bf1ec60e4f56451e57517f6a42873eb
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Apr 16 20:43:49 2015 +0100

    make CreatePrinterOptionsPage returns a VclPtr<>.
    
    Change-Id: Iaa7814573b48b6c9ed10426b992c944393b23332

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index b1a00c8..df3bbc3 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -38,6 +38,7 @@
 #include <vcl/jobset.hxx>
 #include <o3tl/typed_flags_set.hxx>
 #include <vcl/vclptr.hxx>
+#include <sfx2/tabdlg.hxx>
 
 class SfxBaseController;
 class Size;
@@ -52,7 +53,6 @@ class SfxMedium;
 class SfxModule;
 class SfxViewFrame;
 class SfxItemPool;
-class SfxTabPage;
 class SfxFrameSetDescriptor;
 class Printer;
 class SfxPrinter;
@@ -229,7 +229,7 @@ public:
     virtual SfxPrinter*         GetPrinter( bool bCreate = false );
     virtual sal_uInt16          SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
     virtual bool                HasPrintOptionsPage() const;
-    virtual SfxTabPage*         CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions );
+    virtual VclPtr<SfxTabPage>  CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions );
     JobSetup                    GetJobSetup() const;
     Printer*                    GetActivePrinter() const;
 
diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx
index 66c041f..fd49a0f 100644
--- a/sc/source/ui/inc/prevwsh.hxx
+++ b/sc/source/ui/inc/prevwsh.hxx
@@ -109,7 +109,7 @@ public:
     virtual SfxPrinter*     GetPrinter( bool bCreate = false ) SAL_OVERRIDE;
     virtual sal_uInt16      SetPrinter( SfxPrinter* pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ) SAL_OVERRIDE;
     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;
 
     void    AddAccessibilityObject( SfxListener& rObject );
     void    RemoveAccessibilityObject( SfxListener& rObject );
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 81e8004..f411397 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -348,7 +348,7 @@ public:
                                           SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false ) SAL_OVERRIDE;
 
     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;
 
     void            ConnectObject( SdrOle2Obj* pObj );
     bool            ActivateObject( SdrOle2Obj* pObj, long nVerb );
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 3ec7b48..225b003 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -531,14 +531,15 @@ bool ScPreviewShell::HasPrintOptionsPage() const
     return true;
 }
 
-SfxTabPage* ScPreviewShell::CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions )
+VclPtr<SfxTabPage> ScPreviewShell::CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions )
 {
     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
     OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
-    ::CreateTabPage ScTpPrintOptionsCreate =    pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT );
+    ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT );
     if ( ScTpPrintOptionsCreate )
-        return  (*ScTpPrintOptionsCreate)( pParent, &rOptions);
-    return 0;
+        return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions)
+                                  SAL_NO_ACQUIRE);
+    return VclPtr<SfxTabPage>();
 }
 
 void ScPreviewShell::Activate(bool bMDI)
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index a90605d..78dc752 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1063,14 +1063,15 @@ bool ScTabViewShell::HasPrintOptionsPage() const
     return true;
 }
 
-SfxTabPage* ScTabViewShell::CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions )
+VclPtr<SfxTabPage> ScTabViewShell::CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions )
 {
     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
     OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
     ::CreateTabPage ScTpPrintOptionsCreate =    pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT );
     if ( ScTpPrintOptionsCreate )
-        return  (*ScTpPrintOptionsCreate)( pParent, &rOptions);
-    return 0;
+        return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions),
+                                  SAL_NO_ACQUIRE);
+    return VclPtr<SfxTabPage>();
 }
 
 void ScTabViewShell::StopEditShell()
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index add92b0..47f3005 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -221,7 +221,7 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog(vcl::Window *pParent,
     VclContainer *pVBox = get_content_area();
 
     // Insert TabPage
-    pPage = pViewSh->CreatePrintOptionsPage(pVBox, *pOptions);
+    pPage.reset(pViewSh->CreatePrintOptionsPage(pVBox, *pOptions));
     DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" );
     if( pPage )
     {
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 2e9bb38..c440014 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -891,13 +891,13 @@ sal_uInt16 SfxViewShell::SetPrinter( SfxPrinter* /*pNewPrinter*/, SfxPrinterChan
     return 0;
 }
 
-SfxTabPage* SfxViewShell::CreatePrintOptionsPage
+VclPtr<SfxTabPage> SfxViewShell::CreatePrintOptionsPage
 (
     vcl::Window*             /*pParent*/,
     const SfxItemSet&   /*rOptions*/
 )
 {
-    return 0;
+    return VclPtr<SfxTabPage>();
 }
 
 bool SfxViewShell::HasPrintOptionsPage() const
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 63d71eb..52f6c1e 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -270,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;
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 7ad1fef..421796e 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1362,8 +1362,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);
 }
diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx
index 60668bf..c4b154c 100644
--- a/sw/source/uibase/inc/pview.hxx
+++ b/sw/source/uibase/inc/pview.hxx
@@ -192,7 +192,7 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell
     SAL_DLLPRIVATE virtual SfxPrinter*     GetPrinter( bool bCreate = false ) SAL_OVERRIDE;
     SAL_DLLPRIVATE virtual sal_uInt16      SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ) SAL_OVERRIDE;
     SAL_DLLPRIVATE virtual bool            HasPrintOptionsPage() const SAL_OVERRIDE;
-    SAL_DLLPRIVATE virtual SfxTabPage*     CreatePrintOptionsPage( vcl::Window *pParent,
+    SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent,
                                                 const SfxItemSet &rOptions ) SAL_OVERRIDE;
 
     SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, bool bInner );
diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx
index c1a341e..1e76ee5 100644
--- a/sw/source/uibase/inc/view.hxx
+++ b/sw/source/uibase/inc/view.hxx
@@ -663,7 +663,7 @@ public:
     // methods for printing
     SAL_DLLPRIVATE virtual   SfxPrinter*     GetPrinter( bool bCreate = false ) SAL_OVERRIDE;
     SAL_DLLPRIVATE virtual bool  HasPrintOptionsPage() const SAL_OVERRIDE;
-    SAL_DLLPRIVATE virtual SfxTabPage*       CreatePrintOptionsPage( vcl::Window* pParent,
+    SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window* pParent,
                                                     const SfxItemSet& rSet) SAL_OVERRIDE;
 };
 
@@ -682,9 +682,9 @@ inline const SwDocShell *SwView::GetDocShell() const
     return const_cast<SwView*>(this)->GetDocShell();
 }
 
-SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent,
-                                    const SfxItemSet &rOptions,
-                                    bool bPreview);
+VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent,
+                                           const SfxItemSet &rOptions,
+                                           bool bPreview);
 
 #endif
 
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index ad29cdc..de3d79d 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1709,8 +1709,8 @@ bool SwPagePreview::HasPrintOptionsPage() const
     return true;
 }
 
-SfxTabPage*  SwPagePreview::CreatePrintOptionsPage( vcl::Window *pParent,
-                                                const SfxItemSet &rOptions )
+VclPtr<SfxTabPage> SwPagePreview::CreatePrintOptionsPage( vcl::Window *pParent,
+                                                          const SfxItemSet &rOptions )
 {
     return ::CreatePrintOptionsPage( pParent, rOptions, !bNormalPrint );
 }
diff --git a/sw/source/uibase/uiview/viewfunc.hxx b/sw/source/uibase/uiview/viewfunc.hxx
index 4102270..c66822e 100644
--- a/sw/source/uibase/uiview/viewfunc.hxx
+++ b/sw/source/uibase/uiview/viewfunc.hxx
@@ -33,7 +33,7 @@ namespace vcl { class Window; }
 
 // The following functions are available in viewprt.cxx
 void SetPrinter( IDocumentDeviceAccess*, SfxPrinter*, bool bWeb );
-SfxTabPage* CreatePrintOptionsPage( vcl::Window*, const SfxItemSet& );
+VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window*, const SfxItemSet& );
 void SetAppPrintOptions( SwViewShell* pSh, bool bWeb );
 
 // The following functions are available in viewport.cxx
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index 2309ea2..76cbdb3 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -147,8 +147,8 @@ bool SwView::HasPrintOptionsPage() const
 
 // TabPage for application-specific print options
 
-SfxTabPage* SwView::CreatePrintOptionsPage(vcl::Window* pParent,
-                                                    const SfxItemSet& rSet)
+VclPtr<SfxTabPage> SwView::CreatePrintOptionsPage(vcl::Window* pParent,
+                                                  const SfxItemSet& rSet)
 {
     return ::CreatePrintOptionsPage( pParent, rSet, false );
 }
@@ -245,8 +245,9 @@ void SwView::ExecutePrint(SfxRequest& rReq)
 
 // Create page printer/additions for SwView and SwPagePreview
 
-SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent,
-                                const SfxItemSet &rOptions, bool bPreview )
+VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent,
+                                           const SfxItemSet &rOptions,
+                                           bool bPreview )
 {
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     OSL_ENSURE(pFact, "No Print Dialog");
@@ -258,7 +259,9 @@ SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent,
     if (!fnCreatePage)
         return NULL;
 
-    SfxTabPage* pPage = (*fnCreatePage)(pParent, &rOptions);
+    VclPtr<SfxTabPage> pPage =
+        VclPtr<SfxTabPage>((*fnCreatePage)(pParent, &rOptions),
+                           SAL_NO_ACQUIRE);
     OSL_ENSURE(pPage, "No page");
     if (!pPage)
         return NULL;


More information about the Libreoffice-commits mailing list