summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-13 09:51:20 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:48:28 +0100
commit00b4b4123aa87cc1a881fb13617dd4dc1c71b8dc (patch)
tree8789a9419bfed67a56f4b952db246d47a7baa65e /sfx2
parentdc601c038d193f09dfaa6901ef99400eab931221 (diff)
tweak SfxTabDialog so that it can use VclBuilder provided 'internal' widgets
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/tabdlg.hxx11
-rw-r--r--sfx2/source/dialog/tabdlg.cxx102
2 files changed, 84 insertions, 29 deletions
diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx
index a39f25415306..db72bf83ec30 100644
--- a/sfx2/inc/sfx2/tabdlg.hxx
+++ b/sfx2/inc/sfx2/tabdlg.hxx
@@ -66,7 +66,6 @@ friend class SfxTabDialogController;
SfxViewFrame* pFrame;
VclVBox *m_pVBox;
- VclVBox *m_pContentArea;
TabControl *m_pTabCtrl;
VclHButtonBox *m_pActionArea;
@@ -77,6 +76,16 @@ friend class SfxTabDialogController;
PushButton* m_pResetBtn;
PushButton* m_pBaseFmtBtn;
+ bool m_bOwnsVBox;
+ bool m_bOwnsTabCtrl;
+ bool m_bOwnsActionArea;
+ bool m_bOwnsOKBtn;
+ bool m_bOwnsUserBtn;
+ bool m_bOwnsCancelBtn;
+ bool m_bOwnsHelpBtn;
+ bool m_bOwnsResetBtn;
+ bool m_bOwnsBaseFmtBtn;
+
const SfxItemSet* pSet;
SfxItemSet* pOutSet;
TabDlg_Impl* pImpl;
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 4b4b75bb7113..5d19567df884 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -21,6 +21,7 @@
#include <limits.h>
#include <stdlib.h>
#include <algorithm>
+#include <vcl/builder.hxx>
#include <vcl/msgbox.hxx>
#include <unotools/viewoptions.hxx>
@@ -485,16 +486,24 @@ SfxTabDialog::~SfxTabDialog()
delete pExampleSet;
delete [] pRanges;
- delete m_pBaseFmtBtn;
- delete m_pResetBtn;
- delete m_pHelpBtn;
- delete m_pCancelBtn;
- delete m_pUserBtn;
- delete m_pOKBtn;
- delete m_pActionArea;
- delete m_pTabCtrl;
- delete m_pContentArea;
- delete m_pVBox;
+ if (m_bOwnsBaseFmtBtn)
+ delete m_pBaseFmtBtn;
+ if (m_bOwnsResetBtn)
+ delete m_pResetBtn;
+ if (m_bOwnsHelpBtn)
+ delete m_pHelpBtn;
+ if (m_bOwnsCancelBtn)
+ delete m_pCancelBtn;
+ if (m_bOwnsUserBtn)
+ delete m_pUserBtn;
+ if (m_bOwnsOKBtn)
+ delete m_pOKBtn;
+ if (m_bOwnsActionArea)
+ delete m_pActionArea;
+ if (m_bOwnsTabCtrl)
+ delete m_pTabCtrl;
+ if (m_bOwnsVBox)
+ delete m_pVBox;
}
// -----------------------------------------------------------------------
@@ -507,31 +516,68 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText,
*/
{
- m_pVBox = new VclVBox(this, false, 7);
- m_pContentArea = new VclVBox(m_pVBox);
- m_pTabCtrl = new TabControl(m_pContentArea, ResId(ID_TABCONTROL, *rResId.GetResMgr()));
- m_pActionArea = new VclHButtonBox(m_pVBox);
- m_pOKBtn = new OKButton(m_pActionArea);
- m_pUserBtn = pUserButtonText ? new PushButton(m_pActionArea) : 0;
- m_pCancelBtn = new CancelButton(m_pActionArea);
- m_pHelpBtn = new HelpButton(m_pActionArea);
- m_pResetBtn = new PushButton(m_pActionArea);
- m_pBaseFmtBtn = new PushButton(m_pActionArea);
- pImpl = new TabDlg_Impl(m_pTabCtrl->GetPageCount());
-
rtl::OString sFill(RTL_CONSTASCII_STRINGPARAM("fill"));
rtl::OString sExpand(RTL_CONSTASCII_STRINGPARAM("expand"));
rtl::OString sPackType(RTL_CONSTASCII_STRINGPARAM("pack-type"));
- m_pVBox->setChildProperty(sFill, true);
+ fprintf(stderr, "BUILDER is %p\n", m_pUIBuilder);
+ m_pVBox = m_pUIBuilder ? static_cast<VclVBox*>(m_pUIBuilder->get_by_name("dialog-vbox1")) : NULL;
+ m_bOwnsVBox = m_pVBox == NULL;
+ if (m_bOwnsVBox)
+ {
+ m_pVBox = new VclVBox(this, false, 7);
+ m_pVBox->setChildProperty(sFill, true);
+ m_pVBox->setChildProperty(sExpand, true);
+ }
- m_pActionArea->setChildProperty(sFill, true);
+ m_pTabCtrl = m_pUIBuilder ? static_cast<TabControl*>(m_pUIBuilder->get_by_name(SAL_STRINGIFY(ID_TABCONTROL))) : NULL;
+ m_bOwnsTabCtrl = m_pTabCtrl == NULL;
+ if (m_bOwnsTabCtrl)
+ {
+ m_pTabCtrl = new TabControl(m_pVBox, ResId(ID_TABCONTROL, *rResId.GetResMgr()));
+ m_pTabCtrl->setChildProperty(sFill, true);
+ m_pTabCtrl->setChildProperty(sExpand, true);
+ }
- m_pContentArea->setChildProperty(sFill, true);
- m_pContentArea->setChildProperty(sExpand, true);
+ m_pActionArea = m_pUIBuilder ? static_cast<VclHButtonBox*>(m_pUIBuilder->get_by_name("dialog-action_area1")) : NULL;
+ m_bOwnsActionArea = m_pActionArea == NULL;
+ if (m_bOwnsActionArea)
+ {
+ m_pActionArea = new VclHButtonBox(m_pVBox);
+ m_pActionArea->setChildProperty(sFill, true);
+ }
- m_pTabCtrl->setChildProperty(sFill, true);
- m_pTabCtrl->setChildProperty(sExpand, true);
+ m_pOKBtn = m_pUIBuilder ? static_cast<OKButton*>(m_pUIBuilder->get_by_name("ok")) : NULL;
+ m_bOwnsOKBtn = m_pOKBtn == NULL;
+ if (m_bOwnsOKBtn)
+ m_pOKBtn = new OKButton(m_pActionArea);
+
+ m_pUserBtn = m_pUIBuilder ? static_cast<PushButton*>(m_pUIBuilder->get_by_name("user")) : NULL;
+ m_bOwnsUserBtn = m_pUserBtn == NULL;
+ if (m_bOwnsUserBtn)
+ m_pUserBtn = pUserButtonText ? new PushButton(m_pActionArea) : 0;
+
+ m_pCancelBtn = m_pUIBuilder ? static_cast<CancelButton*>(m_pUIBuilder->get_by_name("cancel")) : NULL;
+ m_bOwnsCancelBtn = m_pCancelBtn == NULL;
+ if (m_bOwnsCancelBtn)
+ m_pCancelBtn = new CancelButton(m_pActionArea);
+
+ m_pHelpBtn = m_pUIBuilder ? static_cast<HelpButton*>(m_pUIBuilder->get_by_name("help")) : NULL;
+ m_bOwnsHelpBtn = m_pHelpBtn == NULL;
+ if (m_bOwnsHelpBtn)
+ m_pHelpBtn = new HelpButton(m_pActionArea);
+
+ m_pResetBtn = m_pUIBuilder ? static_cast<PushButton*>(m_pUIBuilder->get_by_name("reset")) : NULL;
+ m_bOwnsResetBtn = m_pResetBtn == NULL;
+ if (m_bOwnsResetBtn)
+ m_pResetBtn = new PushButton(m_pActionArea);
+
+ m_pBaseFmtBtn = m_pUIBuilder ? static_cast<PushButton*>(m_pUIBuilder->get_by_name("standard")) : NULL;
+ m_bOwnsBaseFmtBtn = m_pBaseFmtBtn == NULL;
+ if (m_bOwnsBaseFmtBtn)
+ m_pBaseFmtBtn = new PushButton(m_pActionArea);
+
+ pImpl = new TabDlg_Impl(m_pTabCtrl->GetPageCount());
m_pOKBtn->SetClickHdl( LINK( this, SfxTabDialog, OkHdl ) );
m_pCancelBtn->SetClickHdl( LINK( this, SfxTabDialog, CancelHdl ) );