diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/UI_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/inc/sfx2/basedlgs.hxx | 42 | ||||
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 72 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/singletabdialog.ui | 80 |
4 files changed, 180 insertions, 15 deletions
diff --git a/sfx2/UI_sfx.mk b/sfx2/UI_sfx.mk index c5077bb27bf4..ca89a1c1ae94 100644 --- a/sfx2/UI_sfx.mk +++ b/sfx2/UI_sfx.mk @@ -19,6 +19,7 @@ $(eval $(call gb_UI_add_uifiles,sfx,\ sfx2/uiconfig/ui/password \ sfx2/uiconfig/ui/printeroptionsdialog \ sfx2/uiconfig/ui/securityinfopage \ + sfx2/uiconfig/ui/singletabdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/sfx2/inc/sfx2/basedlgs.hxx b/sfx2/inc/sfx2/basedlgs.hxx index 141f082e1e2a..c3684e5a883c 100644 --- a/sfx2/inc/sfx2/basedlgs.hxx +++ b/sfx2/inc/sfx2/basedlgs.hxx @@ -64,6 +64,7 @@ protected: String& GetExtraData() { return aExtraData; } sal_uInt32 GetUniqId() const { return nUniqId; } + void SetUniqId(sal_uInt32 nSettingsId) { nUniqId = nSettingsId; } SfxItemSet* GetItemSet() { return pOutputSet; } void CreateOutputItemSet( SfxItemPool& rPool ); void CreateOutputItemSet( const SfxItemSet& rInput ); @@ -167,21 +168,24 @@ struct SingleTabDlgImpl typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte -class SFX2_DLLPUBLIC SfxNoLayoutSingleTabDialog : public SfxModalDialog +class SFX2_DLLPUBLIC SfxSingleTabDialogBase : public SfxModalDialog { public: - SfxNoLayoutSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId ); - SfxNoLayoutSingleTabDialog( Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0 ); + //layout ctor + SfxSingleTabDialogBase(Window* pParent, const SfxItemSet& rOptionsSet); - virtual ~SfxNoLayoutSingleTabDialog(); + //non-layout ctors + SfxSingleTabDialogBase( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId ); + SfxSingleTabDialogBase( Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0 ); + + virtual ~SfxSingleTabDialogBase(); - void SetTabPage( SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0 ); SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; } OKButton* GetOKButton() const { return pOKBtn; } CancelButton* GetCancelButton() const { return pCancelBtn; } -private: +protected: GetTabPageRanges fnGetRanges; OKButton* pOKBtn; @@ -193,6 +197,32 @@ private: DECL_DLLPRIVATE_LINK(OKHdl_Impl, void *); }; +class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxSingleTabDialogBase +{ +public: + SfxSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet) + : SfxSingleTabDialogBase(pParent, rOptionsSet) + { + } + void setTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0); +}; + +//Old school deprecated non-layout aware version +class SFX2_DLLPUBLIC SfxNoLayoutSingleTabDialog : public SfxSingleTabDialogBase +{ +public: + SfxNoLayoutSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId) + : SfxSingleTabDialogBase(pParent, rOptionsSet, nUniqueId) + { + } + SfxNoLayoutSingleTabDialog(Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0) + : SfxSingleTabDialogBase(pParent, nUniqueId, pInSet) + { + } + ~SfxNoLayoutSingleTabDialog(); + void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0); +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 31b39bd067e1..06a361afa08a 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -668,9 +668,9 @@ void SfxFloatingWindow::FillInfo(SfxChildWinInfo& rInfo) const rInfo.nFlags |= SFX_CHILDWIN_ZOOMIN; } -// SfxNoLayoutSingleTabDialog ---------------------------------------------------- +// SfxSingleTabDialogBase ---------------------------------------------------- -IMPL_LINK_NOARG(SfxNoLayoutSingleTabDialog, OKHdl_Impl) +IMPL_LINK_NOARG(SfxSingleTabDialogBase, OKHdl_Impl) /* [Description] @@ -718,7 +718,7 @@ IMPL_LINK_NOARG(SfxNoLayoutSingleTabDialog, OKHdl_Impl) // ----------------------------------------------------------------------- -SfxNoLayoutSingleTabDialog::SfxNoLayoutSingleTabDialog +SfxSingleTabDialogBase::SfxSingleTabDialogBase ( Window *pParent, const SfxItemSet& rSet, @@ -744,7 +744,7 @@ SfxNoLayoutSingleTabDialog::SfxNoLayoutSingleTabDialog // ----------------------------------------------------------------------- -SfxNoLayoutSingleTabDialog::SfxNoLayoutSingleTabDialog +SfxSingleTabDialogBase::SfxSingleTabDialogBase ( Window* pParent, sal_uInt16 nUniqueId, @@ -769,18 +769,65 @@ SfxNoLayoutSingleTabDialog::SfxNoLayoutSingleTabDialog SetInputSet( pInSet ); } +SfxSingleTabDialogBase::SfxSingleTabDialogBase(Window *pParent, const SfxItemSet& rSet) + : SfxModalDialog(pParent, "SingleTabDialog", "sfx/ui/singletabdialog.ui") + , pImpl(new SingleTabDlgImpl) +{ + get(pOKBtn, "ok"); + pOKBtn->SetClickHdl( LINK( this, SfxSingleTabDialogBase, OKHdl_Impl ) ); + get(pCancelBtn, "cancel"); + get(pHelpBtn, "help"); + SetInputSet( &rSet ); +} + // ----------------------------------------------------------------------- -SfxNoLayoutSingleTabDialog::~SfxNoLayoutSingleTabDialog() +SfxSingleTabDialogBase::~SfxSingleTabDialogBase() { - delete pOKBtn; - delete pCancelBtn; - delete pHelpBtn; delete pImpl->m_pSfxPage; delete pImpl->m_pLine; delete pImpl; } +void SfxSingleTabDialog::setTabPage(SfxTabPage* pTabPage, + GetTabPageRanges pRangesFunc, sal_uInt32 nSettingsId) +/* [Description] + + Insert a (new) TabPage; an existing page is deleted. + The passed on page is initialized with the initially given Itemset + through calling Reset(). +*/ + +{ + SetUniqId(nSettingsId); + delete pImpl->m_pSfxPage; + pImpl->m_pSfxPage = pTabPage; + fnGetRanges = pRangesFunc; + + if ( pImpl->m_pSfxPage ) + { + // First obtain the user data, only then Reset() + SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( GetUniqId() ) ); + String sUserData; + Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); + OUString aTemp; + if ( aUserItem >>= aTemp ) + sUserData = String( aTemp ); + pImpl->m_pSfxPage->SetUserData( sUserData ); + pImpl->m_pSfxPage->Reset( *GetInputItemSet() ); + pImpl->m_pSfxPage->Show(); + + pHelpBtn->Show(Help::IsContextHelpEnabled()); + + // Set TabPage text in the Dialog + SetText( pImpl->m_pSfxPage->GetText() ); + + // Dialog recieves the HelpId of TabPage + SetHelpId( pImpl->m_pSfxPage->GetHelpId() ); + SetUniqueId( pImpl->m_pSfxPage->GetUniqueId() ); + } +} + // ----------------------------------------------------------------------- void SfxNoLayoutSingleTabDialog::SetTabPage( SfxTabPage* pTabPage, @@ -796,7 +843,7 @@ void SfxNoLayoutSingleTabDialog::SetTabPage( SfxTabPage* pTabPage, if ( !pOKBtn ) { pOKBtn = new OKButton( this, WB_DEFBUTTON ); - pOKBtn->SetClickHdl( LINK( this, SfxNoLayoutSingleTabDialog, OKHdl_Impl ) ); + pOKBtn->SetClickHdl( LINK( this, SfxSingleTabDialogBase, OKHdl_Impl ) ); } if ( !pCancelBtn ) pCancelBtn = new CancelButton( this ); @@ -847,4 +894,11 @@ void SfxNoLayoutSingleTabDialog::SetTabPage( SfxTabPage* pTabPage, } } +SfxNoLayoutSingleTabDialog::~SfxNoLayoutSingleTabDialog() +{ + delete pOKBtn; + delete pCancelBtn; + delete pHelpBtn; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/uiconfig/ui/singletabdialog.ui b/sfx2/uiconfig/ui/singletabdialog.ui new file mode 100644 index 000000000000..fca895700351 --- /dev/null +++ b/sfx2/uiconfig/ui/singletabdialog.ui @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="SingleTabDialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="layout_style">start</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</action-widget> + </action-widgets> + </object> +</interface> |