Kaydet (Commit) 0290ff79 authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst ae4f2c72
......@@ -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 \
......
......@@ -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 ------------------------------------
......
......@@ -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)
......
......@@ -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
......
......@@ -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();
}
......
......@@ -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;
......
......@@ -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;
}
// -----------------------------------------------------------------------
......
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