Kaydet (Commit) f1879e20 authored tarafından Michael Meeks's avatar Michael Meeks

make CreatePrinterOptionsPage returns a VclPtr<>.

Change-Id: Iaa7814573b48b6c9ed10426b992c944393b23332
üst 5be108ee
......@@ -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;
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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)
......
......@@ -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()
......
......@@ -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 )
{
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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 );
......
......@@ -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
......
......@@ -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 );
}
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment