diff options
author | Thomas Benisch <tbe@openoffice.org> | 2001-03-02 13:02:06 +0000 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2001-03-02 13:02:06 +0000 |
commit | 6ab1b8798b0198332c14f0f507b0b9904dcfb3b6 (patch) | |
tree | 79ba07b1d950b04e445145ac3d9455b3104775de /basctl | |
parent | fc2d8975a2e1229a8a4c7e22998fa679136b1e45 (diff) |
moved setting of parent form from factory to DlgEdObj::EndCreate
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/dlged/dlgedfac.cxx | 57 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedobj.cxx | 76 |
2 files changed, 47 insertions, 86 deletions
diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx index 11249f465feb..51074e2be504 100644 --- a/basctl/source/dlged/dlgedfac.cxx +++ b/basctl/source/dlged/dlgedfac.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dlgedfac.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: tbe $ $Date: 2001-02-26 10:40:01 $ + * last change: $Author: tbe $ $Date: 2001-03-02 14:01:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -138,42 +138,23 @@ IMPL_LINK( VCDlgEditFactory, MakeObject, SdrObjFactory *, pObjFactory ) (pObjFactory->nIdentifier >=OBJ_DLG_CHECKBOX) && (pObjFactory->nIdentifier <= OBJ_DLG_URLBUTTON) ) { - DlgEdForm* pForm = pDlgEditor->GetDlgEdForm(); - StarBASIC* pBasic = pDlgEditor->GetBasic(); - switch( pObjFactory->nIdentifier ) { - case OBJ_DLG_CHECKBOX: - pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlCheckBoxModel") - ,xDialogSFact, pForm); - break; - case OBJ_DLG_RADIOBUTTON: - pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel") - ,xDialogSFact, pForm); - break; case OBJ_DLG_PUSHBUTTON: - pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel") - ,xDialogSFact, pForm); + pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel"), xDialogSFact); break; - case OBJ_DLG_SPINBUTTON: - //pControl = new VCSbxSpinButton( TRUE ); - break; - case OBJ_DLG_FIXEDTEXT: - pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlFixedTextModel") - ,xDialogSFact, pForm); + case OBJ_DLG_RADIOBUTTON: + pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel"), xDialogSFact); break; - case OBJ_DLG_GROUPBOX: - pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlGroupBoxModel") - ,xDialogSFact, pForm); + case OBJ_DLG_CHECKBOX: + pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlCheckBoxModel"), xDialogSFact); break; case OBJ_DLG_LISTBOX: - pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel") - ,xDialogSFact, pForm); + pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel"), xDialogSFact); break; case OBJ_DLG_COMBOBOX: { - DlgEdObj* pNew = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel") - ,xDialogSFact, pForm); + DlgEdObj* pNew = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel"), xDialogSFact); pObjFactory->pNewObj = pNew; try { @@ -188,20 +169,26 @@ IMPL_LINK( VCDlgEditFactory, MakeObject, SdrObjFactory *, pObjFactory ) { } } break; + case OBJ_DLG_GROUPBOX: + pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlGroupBoxModel"), xDialogSFact); + break; case OBJ_DLG_EDIT: - pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlEditModel") - ,xDialogSFact, pForm); + pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlEditModel"), xDialogSFact); + break; + case OBJ_DLG_FIXEDTEXT: + pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlFixedTextModel"), xDialogSFact); + break; + case OBJ_DLG_PREVIEW: + pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlImageControlModel"), xDialogSFact); + break; + case OBJ_DLG_SPINBUTTON: + //pControl = new VCSbxSpinButton( TRUE ); break; case OBJ_DLG_HSCROLLBAR: //pControl = new VCSbxHScrollBar( TRUE ); - //pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton")); break; case OBJ_DLG_VSCROLLBAR: //pControl = new VCSbxVScrollBar( TRUE ); - //pObjFactory->pNewObj = new DlgEdObj(rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton")); - break; - case OBJ_DLG_PREVIEW: - //pControl = new VCSbxPreview( TRUE ); break; case OBJ_DLG_URLBUTTON: //pControl = new VCSbxURLButton( TRUE ); diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index 3f40b9fc85e6..775adfdead7a 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dlgedobj.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: tbe $ $Date: 2001-03-01 09:47:01 $ + * last change: $Author: tbe $ $Date: 2001-03-02 14:02:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -146,16 +146,6 @@ DlgEdObj::DlgEdObj() //---------------------------------------------------------------------------- -DlgEdObj::DlgEdObj(DlgEdForm* pForm) - :SdrUnoObj(String(), sal_False) - ,bIsListening(sal_False) - ,pDlgEdForm(pForm) -{ - DBG_CTOR(DlgEdObj, NULL); -} - -//---------------------------------------------------------------------------- - DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName) :SdrUnoObj(rModelName, sal_False) ,bIsListening(sal_False) @@ -165,16 +155,6 @@ DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName) //---------------------------------------------------------------------------- -DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName, DlgEdForm* pForm) - :SdrUnoObj(rModelName, sal_False) - ,bIsListening(sal_False) - ,pDlgEdForm(pForm) -{ - DBG_CTOR(DlgEdObj, NULL); -} - -//---------------------------------------------------------------------------- - DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac) :SdrUnoObj(rModelName, rxSFac, sal_False) @@ -185,18 +165,6 @@ DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName, //---------------------------------------------------------------------------- -DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName, - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac, - DlgEdForm* pForm) - :SdrUnoObj(rModelName, rxSFac, sal_False) - ,bIsListening(sal_False) - ,pDlgEdForm(pForm) -{ - DBG_CTOR(DlgEdObj, NULL); -} - -//---------------------------------------------------------------------------- - DlgEdObj::~DlgEdObj() { DBG_DTOR(DlgEdObj, NULL); @@ -311,26 +279,29 @@ void DlgEdObj::SetPropsFromRect() void SAL_CALL DlgEdObj::SetNameFromProp( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException) { - // get old name - ::rtl::OUString aOldName; - evt.OldValue >>= aOldName; + if ( !ISA(DlgEdForm) ) + { + // get old name + ::rtl::OUString aOldName; + evt.OldValue >>= aOldName; - // get new name - ::rtl::OUString aNewName; - evt.NewValue >>= aNewName; + // get new name + ::rtl::OUString aNewName; + evt.NewValue >>= aNewName; - // remove the control by the old name and insert the control by the new name in the container - uno::Reference< container::XNameAccess > xNameAcc((GetDlgEdForm()->GetUnoControlModel()), uno::UNO_QUERY); - if ( xNameAcc.is() && xNameAcc->hasByName(aOldName) ) - { - uno::Reference< container::XNameContainer > xCont(xNameAcc, uno::UNO_QUERY ); - if ( xCont.is() ) + // remove the control by the old name and insert the control by the new name in the container + uno::Reference< container::XNameAccess > xNameAcc((GetDlgEdForm()->GetUnoControlModel()), uno::UNO_QUERY); + if ( xNameAcc.is() && xNameAcc->hasByName(aOldName) ) { - uno::Reference< awt::XControlModel > xCtrl(GetUnoControlModel(), uno::UNO_QUERY); - uno::Any aAny; - aAny <<= xCtrl; - xCont->removeByName( aOldName ); - xCont->insertByName( aNewName , aAny ); + uno::Reference< container::XNameContainer > xCont(xNameAcc, uno::UNO_QUERY ); + if ( xCont.is() ) + { + uno::Reference< awt::XControlModel > xCtrl(GetUnoControlModel(), uno::UNO_QUERY); + uno::Any aAny; + aAny <<= xCtrl; + xCont->removeByName( aOldName ); + xCont->insertByName( aNewName , aAny ); + } } } } @@ -482,6 +453,9 @@ FASTBOOL DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) { sal_Bool bResult = SdrUnoObj::EndCreate(rStat, eCmd); + // set parent form + pDlgEdForm = ((DlgEdPage*)GetPage())->GetDlgEd()->GetDlgEdForm(); + // get unique name ::rtl::OUString aOUniqueName( GetUniqueName() ); |