diff options
-rw-r--r-- | sfx2/inc/sfx2/tabdlg.hxx | 20 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 71 |
2 files changed, 73 insertions, 18 deletions
diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx index a7068d85b306..69c7d892c722 100644 --- a/sfx2/inc/sfx2/tabdlg.hxx +++ b/sfx2/inc/sfx2/tabdlg.hxx @@ -130,22 +130,30 @@ protected: void SavePosAndId(); public: + SfxTabDialog( Window* pParent, + const OString& rID, const OUString& rUIXMLDescription, + const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False ); + SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent, + const OString& rID, const OUString& rUIXMLDescription, + const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False ); + + SfxTabDialog( Window* pParent, const ResId &rResId, const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False, const String *pUserButtonText = 0 ); 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, + sal_uInt16 AddTabPage( const OString& rName, // Name of the label for the page in the notebook .ui CreateTabPage pCreateFunc, // != 0 GetTabPageRanges pRangesFunc, // can be 0 sal_Bool bItemsOnDemand = sal_False); - sal_uInt16 AddTabPage( const OString& rName, + + sal_uInt16 AddTabPage ( const OString &rName, // Name of the label for the page in the notebook .ui + sal_uInt16 nPageCreateId ); // Identifier of the Factory Method to create the page + + void AddTabPage( sal_uInt16 nId, CreateTabPage pCreateFunc, // != 0 GetTabPageRanges pRangesFunc, // can be 0 sal_Bool bItemsOnDemand = sal_False); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index aca2b196fdac..68d001dbee3c 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -434,13 +434,11 @@ 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 OString& rID, const 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 + 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) @@ -453,7 +451,7 @@ SfxTabDialog::SfxTabDialog , bFmt(bEditFmt) , pExampleSet(0) { - Init_Impl( bFmt, pUserButtonText, NULL ); + Init_Impl( bFmt, NULL, NULL ); } // ----------------------------------------------------------------------- @@ -483,6 +481,36 @@ SfxTabDialog::SfxTabDialog DBG_WARNING( "Please use the Construtor with the ViewFrame" ); } +SfxTabDialog::SfxTabDialog + +/* [Description] + + Constructor, temporary without Frame +*/ + +( + Window* pParent, // Parent Window + const OString& rID, const 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 +) + : TabDialog(pParent, rID, rUIXMLDescription) + , pFrame(0) + , pSet(pItemSet) + , pOutSet(0) + , pRanges(0) + , nResId(0) + , nAppPageId(USHRT_MAX) + , bItemsReset(sal_False) + , bFmt(bEditFmt) + , pExampleSet(0) +{ + Init_Impl(bFmt, NULL, NULL); + DBG_WARNING( "Please use the Construtor with the ViewFrame" ); +} + // ----------------------------------------------------------------------- SfxTabDialog::~SfxTabDialog() @@ -629,7 +657,8 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText, if ( m_pUserBtn ) { - m_pUserBtn->SetText( *pUserButtonText ); + if (pUserButtonText) + m_pUserBtn->SetText(*pUserButtonText); m_pUserBtn->SetClickHdl( LINK( this, SfxTabDialog, UserHdl ) ); m_pUserBtn->Show(); } @@ -826,16 +855,14 @@ void SfxTabDialog::AddTabPage 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 +/* + Adds a page to the dialog. The Name must correspond to a entry in the TabControl in the dialog .ui */ - +sal_uInt16 SfxTabDialog::AddTabPage ( - const OString &rName, // Page ID + const OString &rName, // Page ID CreateTabPage pCreateFunc, // Pointer to the Factory Method GetTabPageRanges pRangesFunc, // Pointer to the Method for quering // Ranges onDemand @@ -849,6 +876,26 @@ sal_uInt16 SfxTabDialog::AddTabPage return nId; } +/* + Adds a page to the dialog. The Name must correspond to a entry in the + TabControl in the dialog .ui + */ +sal_uInt16 SfxTabDialog::AddTabPage +( + const OString &rName, // Page ID + sal_uInt16 nPageCreateId // Identifier of the Factory Method to create the page +) +{ + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + assert(pFact); + CreateTabPage pCreateFunc = pFact->GetTabPageCreatorFunc(nPageCreateId); + assert(pCreateFunc); + GetTabPageRanges pRangesFunc = pFact->GetTabPageRangesFunc(nPageCreateId); + sal_uInt16 nPageId = m_pTabCtrl->GetPageId(rName); + pImpl->pData->Append(new Data_Impl(nPageId, pCreateFunc, pRangesFunc, false)); + return nPageId; +} + // ----------------------------------------------------------------------- void SfxTabDialog::AddTabPage |