diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-12-19 14:47:17 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-12-19 15:23:16 +0000 |
commit | 0290ff79eacb02c800976ac13408354624811008 (patch) | |
tree | 597ea01eb36b0a1ca56511ad1d8fd6cc556fd8f3 /sfx2 | |
parent | ae4f2c72b7a93085025859cbf1698651831e1b44 (diff) |
convert document properties tabdialog to .ui format
this includes allow us to add tabpages to SfxTabDialogs by name (and getting
back the matching pageid) where the name of a tabpage is the name of the label
widget for the page in the .ui notebook.
Change-Id: I48bfaa9ac8daa443ca72540e2024ddb9df34faa5
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/UI_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/inc/sfx2/dinfdlg.hxx | 4 | ||||
-rw-r--r-- | sfx2/inc/sfx2/sfx.hrc | 5 | ||||
-rw-r--r-- | sfx2/inc/sfx2/tabdlg.hxx | 12 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 24 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.src | 42 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 63 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/documentpropertiesdialog.ui (renamed from sfx2/uiconfig/ui/documentproperties.ui) | 196 |
8 files changed, 178 insertions, 169 deletions
diff --git a/sfx2/UI_sfx.mk b/sfx2/UI_sfx.mk index 6d50bc8221af..a00ed9849a3c 100644 --- a/sfx2/UI_sfx.mk +++ b/sfx2/UI_sfx.mk @@ -14,6 +14,7 @@ $(eval $(call gb_UI_add_uifiles,sfx,\ sfx2/uiconfig/ui/custominfopage \ sfx2/uiconfig/ui/descriptioninfopage \ sfx2/uiconfig/ui/documentinfopage \ + sfx2/uiconfig/ui/documentpropertiesdialog \ sfx2/uiconfig/ui/internetinfopage \ sfx2/uiconfig/ui/password \ sfx2/uiconfig/ui/printeroptionsdialog \ diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx index 94f196a605ba..d365e5e91f0f 100644 --- a/sfx2/inc/sfx2/dinfdlg.hxx +++ b/sfx2/inc/sfx2/dinfdlg.hxx @@ -303,11 +303,13 @@ public: class SFX2_DLLPUBLIC SfxDocumentInfoDialog : public SfxTabDialog { +private: + sal_uInt16 m_nDocInfoId; protected: virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage ); public: - SfxDocumentInfoDialog( Window* pParent, const SfxItemSet& ); + SfxDocumentInfoDialog( Window* pParent, const SfxItemSet& ); }; // class CustomPropertiesRemoveButton ------------------------------------ diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc index cb31562a25ec..d92b301cddec 100644 --- a/sfx2/inc/sfx2/sfx.hrc +++ b/sfx2/inc/sfx2/sfx.hrc @@ -130,11 +130,6 @@ #define RID_DOCALREADYLOADED_DLG (RID_SFX_START+1) -#define TP_DOCINFODESC (RID_SFX_START+3) -#define TP_DOCINFODOC (RID_SFX_START+4) -#define TP_DOCINFORELOAD (RID_SFX_START+13) -#define TP_CUSTOMPROPERTIES (RID_SFX_START+14) -#define TP_DOCINFOSECURITY (RID_SFX_START+215) #define DLG_DOCINFO_EDT (RID_SFX_START+6) #define TP_MANAGE_STYLES (RID_SFX_START+7) #define DLG_STYLE_DESIGNER (RID_SFX_START+8) diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx index c07c012e840b..a7068d85b306 100644 --- a/sfx2/inc/sfx2/tabdlg.hxx +++ b/sfx2/inc/sfx2/tabdlg.hxx @@ -103,7 +103,7 @@ friend class SfxTabDialogController; DECL_DLLPRIVATE_LINK(BaseFmtHdl, void *); DECL_DLLPRIVATE_LINK(UserHdl, void *); DECL_DLLPRIVATE_LINK(CancelHdl, void *); - SAL_DLLPRIVATE void Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText, const ResId& rResId ); + SAL_DLLPRIVATE void Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText, const ResId* pResId ); protected: virtual short Ok(); @@ -135,12 +135,22 @@ public: SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent, const ResId &rResId, const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False, const String *pUserButtonText = 0 ); + SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent, + const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, + const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False, + const String *pUserButtonText = 0 ); ~SfxTabDialog(); void AddTabPage( sal_uInt16 nId, CreateTabPage pCreateFunc, // != 0 GetTabPageRanges pRangesFunc, // can be 0 sal_Bool bItemsOnDemand = sal_False); + sal_uInt16 AddTabPage( const OString& rName, + CreateTabPage pCreateFunc, // != 0 + GetTabPageRanges pRangesFunc, // can be 0 + sal_Bool bItemsOnDemand = sal_False); + + void AddTabPage( sal_uInt16 nId, const String &rRiderText, CreateTabPage pCreateFunc, // != 0 diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 6de396d7d8da..20f7bb70b122 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1428,14 +1428,12 @@ int SfxInternetPage::DeactivatePage( SfxItemSet* /*pSet*/ ) //------------------------------------------------------------------------ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent, - const SfxItemSet& rItemSet ) : - - SfxTabDialog( 0, pParent, SfxResId( SID_DOCINFO ), &rItemSet ) - + const SfxItemSet& rItemSet ) + : SfxTabDialog(0, pParent, "DocumentPropertiesDialog", + "sfx/ui/documentpropertiesdialog.ui", &rItemSet) + , m_nDocInfoId(0) { - FreeResource(); - - const SfxDocumentInfoItem* m_pInfoItem = + const SfxDocumentInfoItem* m_pInfoItem = &(const SfxDocumentInfoItem &)rItemSet.Get( SID_DOCINFO ); #ifdef DBG_UTIL @@ -1475,18 +1473,18 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent, SetText( aTitle ); // Property Pages - AddTabPage(TP_DOCINFODESC, SfxDocumentDescPage::Create, 0); - AddTabPage(TP_DOCINFODOC, SfxDocumentPage::Create, 0); - AddTabPage(TP_CUSTOMPROPERTIES, SfxCustomPropertiesPage::Create, 0); - AddTabPage(TP_DOCINFORELOAD, SfxInternetPage::Create, 0); - AddTabPage(TP_DOCINFOSECURITY, SfxSecurityPage::Create, 0); + m_nDocInfoId = AddTabPage("general", SfxDocumentPage::Create, 0); + AddTabPage("description", SfxDocumentDescPage::Create, 0); + AddTabPage("customprops", SfxCustomPropertiesPage::Create, 0); + AddTabPage("internet", SfxInternetPage::Create, 0); + AddTabPage("security", SfxSecurityPage::Create, 0); } // ----------------------------------------------------------------------- void SfxDocumentInfoDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { - if ( TP_DOCINFODOC == nId ) + if ( m_nDocInfoId == nId ) ( (SfxDocumentPage&)rPage ).EnableUseUserData(); } diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src index a90e271ea1d1..e177f45e994e 100644 --- a/sfx2/source/dialog/dinfdlg.src +++ b/sfx2/source/dialog/dinfdlg.src @@ -23,7 +23,6 @@ #include "dinfdlg.hrc" #include "dialog.hrc" - // TP_DOCINFODESC -------------------------------------------------------- String STR_SFX_NEWOFFICEDOC { Text [ en-US ] = "%PRODUCTNAME document" ; @@ -179,47 +178,6 @@ QueryBox SFX_QB_WRONG_TYPE Message [ en-US ] = "The value entered does not match the specified type.\nThe value will be stored as text." ; }; -TabDialog SID_DOCINFO -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Sizeable = TRUE ; - Text [ en-US ] = "Properties of " ; - TabControl 1 - { - SVLook = TRUE ; - PageList = - { - PageItem - { - Identifier = TP_DOCINFODOC ; - Text [ en-US ] = "General" ; - }; - PageItem - { - Identifier = TP_DOCINFODESC ; - Text [ en-US ] = "Description" ; - }; - PageItem - { - Identifier = TP_CUSTOMPROPERTIES ; - Text [ en-US ] = "Custom Properties" ; - }; - PageItem - { - Identifier = TP_DOCINFORELOAD ; - Text [ en-US ] = "Internet" ; - }; - PageItem - { - Identifier = TP_DOCINFOSECURITY ; - Text [ en-US ] = "Security" ; - }; - }; - }; -}; - ModalDialog RID_EDIT_DURATIONS { HelpId = HID_DLG_CUSTOMPROPS_DURATION; diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index f3514ed437ac..aca2b196fdac 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -427,7 +427,33 @@ SfxTabDialog::SfxTabDialog , pFrame(pViewFrame) , INI_LIST(pItemSet) { - Init_Impl( bFmt, pUserButtonText, rResId ); + Init_Impl( bFmt, pUserButtonText, &rResId ); +} + +SfxTabDialog::SfxTabDialog +( + SfxViewFrame* pViewFrame, // Frame, to which the Dialog belongs + Window* pParent, // Parent Window + const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, //Dialog Name, Dialog .ui path + const SfxItemSet* pItemSet, // Itemset with the data; + // can be NULL, when Pages are onDemand + sal_Bool bEditFmt, // Flag: templates are processed + // when yes -> additional Button for standard + const String* pUserButtonText // Text for UserButton; + // if != 0, the UserButton is created +) + : TabDialog(pParent, rID, rUIXMLDescription) + , pFrame(pViewFrame) + , pSet(pItemSet) + , pOutSet(0) + , pRanges(0) + , nResId(0) + , nAppPageId(USHRT_MAX) + , bItemsReset(sal_False) + , bFmt(bEditFmt) + , pExampleSet(0) +{ + Init_Impl( bFmt, pUserButtonText, NULL ); } // ----------------------------------------------------------------------- @@ -453,7 +479,7 @@ SfxTabDialog::SfxTabDialog , pFrame(0) , INI_LIST(pItemSet) { - Init_Impl( bFmt, pUserButtonText, rResId ); + Init_Impl( bFmt, pUserButtonText, &rResId ); DBG_WARNING( "Please use the Construtor with the ViewFrame" ); } @@ -518,7 +544,7 @@ SfxTabDialog::~SfxTabDialog() // ----------------------------------------------------------------------- -void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText, const ResId& rResId ) +void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText, const ResId *pResId ) /* [Description] @@ -534,11 +560,11 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText, m_pBox->set_expand(true); } - m_pTabCtrl = m_pUIBuilder ? m_pUIBuilder->get<TabControl>(SAL_STRINGIFY(ID_TABCONTROL)) : NULL; + m_pTabCtrl = m_pUIBuilder ? m_pUIBuilder->get<TabControl>("tabcontrol") : NULL; m_bOwnsTabCtrl = m_pTabCtrl == NULL; if (m_bOwnsTabCtrl) { - m_pTabCtrl = new TabControl(m_pBox, ResId(ID_TABCONTROL, *rResId.GetResMgr())); + m_pTabCtrl = new TabControl(m_pBox, ResId(ID_TABCONTROL, *pResId->GetResMgr())); m_pTabCtrl->set_expand(true); } @@ -788,16 +814,39 @@ void SfxTabDialog::AddTabPage */ ( - sal_uInt16 nId, // Page ID + sal_uInt16 nId, // Page ID + CreateTabPage pCreateFunc, // Pointer to the Factory Method + GetTabPageRanges pRangesFunc, // Pointer to the Method for quering + // Ranges onDemand + sal_Bool bItemsOnDemand // indicates whether the set of this page is + // requested when created +) +{ + pImpl->pData->Append( + new Data_Impl( nId, pCreateFunc, pRangesFunc, bItemsOnDemand ) ); +} + +sal_uInt16 SfxTabDialog::AddTabPage + +/* [Description] + + Adding a page to the dialogue. Must correspond to a entry in the + TabControl in the dialog .ui +*/ + +( + const OString &rName, // Page ID CreateTabPage pCreateFunc, // Pointer to the Factory Method GetTabPageRanges pRangesFunc, // Pointer to the Method for quering // Ranges onDemand - sal_Bool bItemsOnDemand // indicates whether the set of this page is + sal_Bool bItemsOnDemand // indicates whether the set of this page is // requested when created ) { + sal_uInt16 nId = m_pTabCtrl->GetPageId(rName); pImpl->pData->Append( new Data_Impl( nId, pCreateFunc, pRangesFunc, bItemsOnDemand ) ); + return nId; } // ----------------------------------------------------------------------- diff --git a/sfx2/uiconfig/ui/documentproperties.ui b/sfx2/uiconfig/ui/documentpropertiesdialog.ui index 946e0ae7c568..322429b996d3 100644 --- a/sfx2/uiconfig/ui/documentproperties.ui +++ b/sfx2/uiconfig/ui/documentpropertiesdialog.ui @@ -1,83 +1,107 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> + <object class="GtkDialog" id="DocumentPropertiesDialog"> <property name="can_focus">False</property> - <child> - <object class="GtkBox" id="box1"> - <property name="visible">True</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Properties of </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> - <child> - <object class="GtkNotebook" id="notebook1"> - <property name="visible">True</property> - <property name="can_focus">True</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> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label1"> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">General </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_action_appearance">False</property> + <property name="use_stock">True</property> </object> <packing> - <property name="tab_fill">False</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label2"> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Description</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> </object> <packing> + <property name="expand">False</property> + <property name="fill">True</property> <property name="position">1</property> - <property name="tab_fill">False</property> </packing> </child> <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label55"> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Custom Properties</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> </object> <packing> + <property name="expand">False</property> + <property name="fill">True</property> <property name="position">2</property> - <property name="tab_fill">False</property> </packing> </child> <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label48"> + <object class="GtkButton" id="reset"> + <property name="label" translatable="yes">Reset</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Internet </property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> </object> <packing> + <property name="expand">False</property> + <property name="fill">True</property> <property name="position">3</property> - <property name="tab_fill">False</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> + <object class="GtkNotebook" id="tabcontrol"> + <property name="visible">True</property> + <property name="can_focus">True</property> <child> <placeholder/> </child> <child type="tab"> - <object class="GtkLabel" id="label46"> + <object class="GtkLabel" id="general"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Security</property> + <property name="label" translatable="yes">General </property> </object> <packing> - <property name="position">4</property> <property name="tab_fill">False</property> </packing> </child> @@ -85,100 +109,72 @@ <placeholder/> </child> <child type="tab"> - <object class="GtkLabel" id="label3"> + <object class="GtkLabel" id="description"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Statistics</property> + <property name="label" translatable="yes">Description</property> </object> <packing> - <property name="position">5</property> + <property name="position">1</property> <property name="tab_fill">False</property> </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButtonBox" id="buttonbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">5</property> - <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_action_appearance">False</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> + <placeholder/> </child> - <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> - <property name="use_action_appearance">False</property> + <child type="tab"> + <object class="GtkLabel" id="customprops"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_action_appearance">False</property> - <property name="use_stock">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Custom Properties</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> + <property name="tab_fill">False</property> </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> - <property name="use_action_appearance">False</property> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="internet"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_action_appearance">False</property> - <property name="use_stock">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Internet </property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> + <property name="tab_fill">False</property> </packing> </child> <child> - <object class="GtkButton" id="reset"> - <property name="label" translatable="yes">Reset</property> - <property name="use_action_appearance">False</property> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="security"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_action_appearance">False</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Security</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> + <property name="tab_fill">False</property> </packing> </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">1</property> </packing> </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-widget response="0">reset</action-widget> + </action-widgets> </object> </interface> |