summaryrefslogtreecommitdiff
path: root/basctl/source/dlged
diff options
context:
space:
mode:
authorThomas Benisch <tbe@openoffice.org>2002-08-01 14:06:29 +0000
committerThomas Benisch <tbe@openoffice.org>2002-08-01 14:06:29 +0000
commitd9680c687f39e47231301a2a9b61897f60799c9d (patch)
treeb21e146e18a3910b2d0a42f19016992a83d6a4dc /basctl/source/dlged
parenta86d339b52ca8a5c53d280ddcbf02458aac025e3 (diff)
#101437# crash when D&D a control on a basic dialog with hold STRG key
Diffstat (limited to 'basctl/source/dlged')
-rw-r--r--basctl/source/dlged/dlged.cxx7
-rw-r--r--basctl/source/dlged/dlgedfac.cxx10
-rw-r--r--basctl/source/dlged/dlgedobj.cxx67
3 files changed, 53 insertions, 31 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 353fc87a0d71..13f5d71e23b6 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dlged.cxx,v $
*
- * $Revision: 1.24 $
+ * $Revision: 1.25 $
*
- * last change: $Author: sb $ $Date: 2002-07-16 16:09:53 $
+ * last change: $Author: tbe $ $Date: 2002-08-01 15:06:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -617,6 +617,9 @@ void DlgEditor::CreateDefaultObject()
// insert object into drawing page
SdrPageView* pPageView = pSdrView->GetPageViewPvNum(0);
pSdrView->InsertObject( pDlgEdObj, *pPageView, 0 );
+
+ // start listening
+ pDlgEdObj->StartListening();
}
}
diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx
index 01ad653f85e3..482c21e44782 100644
--- a/basctl/source/dlged/dlgedfac.cxx
+++ b/basctl/source/dlged/dlgedfac.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dlgedfac.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: tbe $ $Date: 2002-01-22 09:06:37 $
+ * last change: $Author: tbe $ $Date: 2002-08-01 15:06:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -239,12 +239,6 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlFileControlModel") , xDialogSFact );
break;
}
-
- DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObjFactory->pNewObj);
- if (pDlgEdObj)
- {
- pDlgEdObj->StartListening();
- }
}
return 0;
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 8d246babd5ea..0f58f670ef04 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dlgedobj.cxx,v $
*
- * $Revision: 1.28 $
+ * $Revision: 1.29 $
*
- * last change: $Author: tbe $ $Date: 2002-04-24 14:51:10 $
+ * last change: $Author: tbe $ $Date: 2002-08-01 15:06:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -192,7 +192,8 @@ DlgEdObj::~DlgEdObj()
{
DBG_DTOR(DlgEdObj, NULL);
- EndListening();
+ if ( isListening() )
+ EndListening();
}
//----------------------------------------------------------------------------
@@ -276,8 +277,6 @@ void DlgEdObj::SetRectFromProps()
void DlgEdObj::SetPropsFromRect()
{
- //EndListening(sal_False);
-
// get control property set
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
if (xPSet.is())
@@ -340,8 +339,6 @@ void DlgEdObj::SetPropsFromRect()
aValue <<= aSize.Height();
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ), aValue );
}
-
- //StartListening();
}
//----------------------------------------------------------------------------
@@ -747,20 +744,54 @@ sal_uInt16 DlgEdObj::GetObjIdentifier() const
//----------------------------------------------------------------------------
-void DlgEdObj::clonedFrom(const DlgEdObj* _pSource) // not working yet
+void DlgEdObj::clonedFrom(const DlgEdObj* _pSource)
{
+ // set parent form
+ pDlgEdForm = _pSource->pDlgEdForm;
+
+ // add child to parent form
+ pDlgEdForm->AddChild( this );
+
+ Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
+ if ( xPSet.is() )
+ {
+ // set new name
+ ::rtl::OUString aOUniqueName( GetUniqueName() );
+ Any aUniqueName;
+ aUniqueName <<= aOUniqueName;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), aUniqueName );
+
+ Reference< container::XNameContainer > xCont( GetDlgEdForm()->GetUnoControlModel() , UNO_QUERY );
+ if ( xCont.is() )
+ {
+ // set tabindex
+ Sequence< OUString > aNames = xCont->getElementNames();
+ Any aTabIndex;
+ aTabIndex <<= (sal_Int16) aNames.getLength();
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ), aTabIndex );
+
+ // insert control model in dialog model
+ Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY );
+ Any aCtrl;
+ aCtrl <<= xCtrl;
+ xCont->insertByName( aOUniqueName , aCtrl );
+ }
+ }
+
+ // start listening
+ StartListening();
}
//----------------------------------------------------------------------------
-SdrObject* DlgEdObj::Clone() const // not working yet
+SdrObject* DlgEdObj::Clone() const
{
SdrObject* pReturn = SdrUnoObj::Clone();
- DlgEdObj* pFormObject = PTR_CAST(DlgEdObj, pReturn);
- DBG_ASSERT(pFormObject != NULL, "DlgEdObj::Clone : invalid clone !");
- if (pFormObject)
- pFormObject->clonedFrom(this);
+ DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pReturn);
+ DBG_ASSERT( pDlgEdObj != NULL, "DlgEdObj::Clone: invalid clone!" );
+ if ( pDlgEdObj )
+ pDlgEdObj->clonedFrom( this );
return pReturn;
}
@@ -778,10 +809,9 @@ SdrObject* DlgEdObj::Clone(SdrPage* _pPage, SdrModel* _pModel) const // not work
//----------------------------------------------------------------------------
-void DlgEdObj::operator= (const SdrObject& rObj) // not working yet
+void DlgEdObj::operator= (const SdrObject& rObj)
{
SdrUnoObj::operator= (rObj);
-
}
//----------------------------------------------------------------------------
@@ -843,6 +873,7 @@ FASTBOOL DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
sal_Bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
SetDefaults();
+ StartListening();
return bResult;
}
@@ -851,9 +882,6 @@ FASTBOOL DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
void DlgEdObj::SetDefaults()
{
- // stop listening
- EndListening( sal_False );
-
// set parent form
pDlgEdForm = ((DlgEdPage*)GetPage())->GetDlgEdForm();
@@ -924,9 +952,6 @@ void DlgEdObj::SetDefaults()
// dialog model changed
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged( TRUE );
-
- // start listening
- StartListening();
}
//----------------------------------------------------------------------------