restore title on Format Number single tab dialogs

Allow a .ui to be given to the SingleTabDialog ctor. There are *three*
single-tab Format Number dialogs, we really should combine them together into
one dialog.

Change-Id: I1021c9b968764bd9ad35832958ef2bd067fca798
This commit is contained in:
Caolán McNamara
2013-07-02 20:16:40 +01:00
parent 61db96daa8
commit e8fdd77a66
7 changed files with 114 additions and 20 deletions

View File

@@ -40,7 +40,8 @@ namespace chart
using namespace ::com::sun::star; using namespace ::com::sun::star;
NumberFormatDialog::NumberFormatDialog(Window* pParent, SfxItemSet& rSet) NumberFormatDialog::NumberFormatDialog(Window* pParent, SfxItemSet& rSet)
: SfxSingleTabDialog(pParent, rSet) : SfxSingleTabDialog(pParent, rSet, "FormatNumberDialog",
"cui/ui/formatnumberdialog.ui")
{ {
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ); ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );

View File

@@ -21,6 +21,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/charnamepage \ cui/uiconfig/ui/charnamepage \
cui/uiconfig/ui/colorpage \ cui/uiconfig/ui/colorpage \
cui/uiconfig/ui/comment \ cui/uiconfig/ui/comment \
cui/uiconfig/ui/formatnumberdialog \
cui/uiconfig/ui/gradientpage \ cui/uiconfig/ui/gradientpage \
cui/uiconfig/ui/colorconfigwin \ cui/uiconfig/ui/colorconfigwin \
cui/uiconfig/ui/effectspage \ cui/uiconfig/ui/effectspage \

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="FormatNumberDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Format Number</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="orientation">vertical</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="layout_style">end</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>

View File

@@ -2716,7 +2716,9 @@ namespace pcr
aCoreSet.Put( aFormatter ); aCoreSet.Put( aFormatter );
// a tab dialog with a single page // a tab dialog with a single page
boost::scoped_ptr< SfxSingleTabDialog > xDialog(new SfxSingleTabDialog(impl_getDefaultDialogParent_nothrow(), aCoreSet)); boost::scoped_ptr< SfxSingleTabDialog > xDialog(new SfxSingleTabDialog(
impl_getDefaultDialogParent_nothrow(), aCoreSet,
"FormatNumberDialog", "cui/ui/formatnumberdialog.ui"));
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT( pFact, "CreateFactory fail!" ); DBG_ASSERT( pFact, "CreateFactory fail!" );
::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ); ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );

View File

@@ -182,7 +182,8 @@ class SFX2_DLLPUBLIC SfxSingleTabDialogBase : public SfxModalDialog
{ {
public: public:
//layout ctor //layout ctor
SfxSingleTabDialogBase(Window* pParent, const SfxItemSet& rOptionsSet); SfxSingleTabDialogBase(Window *pParent, const SfxItemSet& rOptionsSet,
const OString& rID, const OUString& rUIXMLDescription);
//non-layout ctors //non-layout ctors
SfxSingleTabDialogBase( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId ); SfxSingleTabDialogBase( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId );
@@ -210,8 +211,10 @@ protected:
class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxSingleTabDialogBase class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxSingleTabDialogBase
{ {
public: public:
SfxSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet) SfxSingleTabDialog(Window *pParent, const SfxItemSet& rOptionsSet,
: SfxSingleTabDialogBase(pParent, rOptionsSet) const OString& rID = OString("SingleTabDialog"),
const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"))
: SfxSingleTabDialogBase(pParent, rOptionsSet, rID, rUIXMLDescription)
{ {
} }
void setTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0); void setTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0);

View File

@@ -749,8 +749,9 @@ SfxSingleTabDialogBase::SfxSingleTabDialogBase
SetInputSet( pInSet ); SetInputSet( pInSet );
} }
SfxSingleTabDialogBase::SfxSingleTabDialogBase(Window *pParent, const SfxItemSet& rSet) SfxSingleTabDialogBase::SfxSingleTabDialogBase(Window *pParent, const SfxItemSet& rSet,
: SfxModalDialog(pParent, "SingleTabDialog", "sfx/ui/singletabdialog.ui") const OString& rID, const OUString& rUIXMLDescription)
: SfxModalDialog(pParent, rID, rUIXMLDescription)
, pImpl(new SingleTabDlgImpl) , pImpl(new SingleTabDlgImpl)
{ {
get(pOKBtn, "ok"); get(pOKBtn, "ok");
@@ -788,23 +789,27 @@ void SfxSingleTabDialog::setTabPage(SfxTabPage* pTabPage,
{ {
// First obtain the user data, only then Reset() // First obtain the user data, only then Reset()
SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( GetUniqId() ) ); SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( GetUniqId() ) );
String sUserData;
Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME );
OUString aTemp; OUString sUserData;
if ( aUserItem >>= aTemp ) aUserItem >>= sUserData;
sUserData = String( aTemp ); pImpl->m_pSfxPage->SetUserData(sUserData);
pImpl->m_pSfxPage->SetUserData( sUserData );
pImpl->m_pSfxPage->Reset( *GetInputItemSet() ); pImpl->m_pSfxPage->Reset( *GetInputItemSet() );
pImpl->m_pSfxPage->Show(); pImpl->m_pSfxPage->Show();
pHelpBtn->Show(Help::IsContextHelpEnabled()); pHelpBtn->Show(Help::IsContextHelpEnabled());
// Set TabPage text in the Dialog // Set TabPage text in the Dialog if there is any
SetText( pImpl->m_pSfxPage->GetText() ); OUString sTitle(pImpl->m_pSfxPage->GetText());
if (!sTitle.isEmpty())
SetText(sTitle);
// Dialog recieves the HelpId of TabPage // Dialog recieves the HelpId of TabPage if there is any
SetHelpId( pImpl->m_pSfxPage->GetHelpId() ); OString sHelpId(pImpl->m_pSfxPage->GetHelpId());
SetUniqueId( pImpl->m_pSfxPage->GetUniqueId() ); if (!sHelpId.isEmpty())
SetHelpId(sHelpId);
OString sUniqueId(pImpl->m_pSfxPage->GetUniqueId());
if (!sUniqueId.isEmpty())
SetUniqueId(sUniqueId);
} }
} }

View File

@@ -30,7 +30,8 @@
#include <sfx2/tabdlg.hxx> #include <sfx2/tabdlg.hxx>
SwNumFmtDlg::SwNumFmtDlg(Window* pParent, const SfxItemSet& rSet) SwNumFmtDlg::SwNumFmtDlg(Window* pParent, const SfxItemSet& rSet)
: SfxSingleTabDialog(pParent, rSet) : SfxSingleTabDialog(pParent, rSet, "FormatNumberDialog",
"cui/ui/formatnumberdialog.ui")
{ {
// Create TabPage // Create TabPage
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();