diff options
author | Thomas Benisch <tbe@openoffice.org> | 2001-03-07 17:10:25 +0000 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2001-03-07 17:10:25 +0000 |
commit | 73fa79cb75c89e2ab4704dab90c73428e410f698 (patch) | |
tree | 2f731f2a0e945fa656ca4dfc8c514bad4665b9eb /basctl | |
parent | 5d44dd508f1086ec033abbfddef6449a383b3680 (diff) |
added step functionality
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 27 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedfunc.cxx | 19 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedobj.cxx | 82 | ||||
-rw-r--r-- | basctl/source/inc/dlgedobj.hxx | 10 |
4 files changed, 109 insertions, 29 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index a99a849426de..fba1a7464eef 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dlged.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tbe $ $Date: 2001-03-06 14:44:59 $ + * last change: $Author: tbe $ $Date: 2001-03-07 18:07:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -236,7 +236,7 @@ VCDlgEditor::VCDlgEditor( StarBASIC* pBas ) : SdrLayerAdmin& rAdmin = pSdrModel->GetLayerAdmin(); rAdmin.NewStandardLayer(); - rAdmin.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "VCHiddenLayer" ) ) ); + rAdmin.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ) ); pSdrPage = new DlgEdPage( *pSdrModel, pBasic, this ); pSdrModel->InsertPage( pSdrPage ); @@ -283,7 +283,7 @@ void VCDlgEditor::SetWindow( Window* pWindow ) pSdrView = new DlgEdView( pSdrModel, pWindow ); pSdrView->ShowPagePgNum( 0, Point() ); - pSdrView->SetLayerVisible( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "VCHiddenLayer" ) ), FALSE ); + pSdrView->SetLayerVisible( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ), FALSE ); pSdrView->SetMoveSnapOnlyTopLeft( TRUE ); //Size aGridSize( 60, 60 ); //Twips @@ -441,16 +441,17 @@ void VCDlgEditor::SetDialog( uno::Reference< container::XNameContainer > xUnoCon // set dialog model m_xUnoControlDialogModel = xUnoControlDialogModel; - + // create dialog form pDlgEdForm = new DlgEdForm(); uno::Reference< awt::XControlModel > xDlgMod( m_xUnoControlDialogModel, uno::UNO_QUERY ); pDlgEdForm->SetUnoControlModel(xDlgMod); pDlgEdForm->StartPropertyListening(); pDlgEdForm->SetDlgEditor( this ); pDlgEdForm->SetRectFromProps(); - pSdrModel->GetPage(0)->InsertObject( pDlgEdForm ); + pDlgEdForm->SendRepaintBroadcast(); //? + // create controls Reference< ::com::sun::star::container::XNameAccess > xNameAcc( m_xUnoControlDialogModel, UNO_QUERY ); if ( xNameAcc.is() ) { @@ -467,21 +468,17 @@ void VCDlgEditor::SetDialog( uno::Reference< container::XNameContainer > xUnoCon pCtrlObj->SetDlgEdForm(pDlgEdForm); pCtrlObj->SetUnoControlModel( xCtrlModel ); pCtrlObj->StartPropertyListening(); - pCtrlObj->SetChanged(); pCtrlObj->SetRectFromProps(); + pCtrlObj->SetChanged(); pSdrModel->GetPage(0)->InsertObject( pCtrlObj ); + pCtrlObj->UpdateStep(); + pCtrlObj->SendRepaintBroadcast(); //? } } - //pSdrModel->SetChanged( TRUE ); - - //pNewObj->SendRepaintBroadcast(); - bFirstDraw = TRUE; pSdrModel->SetChanged( FALSE ); - - //DBG_ASSERT(pWindow,"Window not set"); } //---------------------------------------------------------------------------- @@ -641,11 +638,11 @@ IMPL_LINK( VCDlgEditor, PaintTimeout, Timer *, EMPTYARG ) ULONG nObjCount; if ( pSdrPage && ( ( nObjCount = pSdrPage->GetObjCount() ) > 0 ) ) { - for ( ULONG i = 1 ; i < nObjCount ; i++ ) + for ( ULONG i = 0 ; i < nObjCount ; i++ ) { SdrObject* pObj = pSdrPage->GetObj(i); DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); - if (pDlgEdObj) + if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) pDlgEdObj->SetRectFromProps(); } } diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx index afe9f415f00b..c8c79cb744ea 100644 --- a/basctl/source/dlged/dlgedfunc.cxx +++ b/basctl/source/dlged/dlgedfunc.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dlgedfunc.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: tbe $ $Date: 2001-02-26 10:41:22 $ + * last change: $Author: tbe $ $Date: 2001-03-07 18:08:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -305,14 +305,13 @@ BOOL DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt ) SdrMark* pMark = rMarkList.GetMark(0); SdrObject* pObj = pMark->GetObj(); - //if( pObj->IsA( TYPE( VCSbxDrawObject ) ) ) - //{ - // VCSbxDialog* pDlg = pParent->GetVCSbxForm(); - // long nCurStep = pDlg->GetCurStep(); - // ((VCSbxDrawObject*)pObj)->GetControl()-> - // SetStep( pDlg->GetCurStep() ); - //} - + DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); + if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) + { + sal_Int32 nCurStep = pDlgEdObj->GetDlgEdForm()->GetStep(); + pDlgEdObj->SetStep( nCurStep ); + pDlgEdObj->UpdateStep(); + } } if ( !pView->HasMarkedObj() ) diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index 5b26f7bbdd9e..9d992f1b568e 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dlgedobj.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: tbe $ $Date: 2001-03-06 14:49:21 $ + * last change: $Author: tbe $ $Date: 2001-03-07 18:09:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -550,6 +550,60 @@ void SAL_CALL DlgEdObj::SetNameFromProp( const ::com::sun::star::beans::Propert //---------------------------------------------------------------------------- +sal_Int32 DlgEdObj::GetStep() const +{ + // get step property + sal_Int32 nStep; + uno::Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), uno::UNO_QUERY ); + if (xPSet.is()) + { + xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Step" ) ) ) >>= nStep; + } + return nStep; +} + +//---------------------------------------------------------------------------- + +void DlgEdObj::SetStep( sal_Int32 nStep ) +{ + // set step property + uno::Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), uno::UNO_QUERY ); + if (xPSet.is()) + { + uno::Any aStep; + aStep <<= nStep; + xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Step" ) ), aStep ); + } +} + +//---------------------------------------------------------------------------- + +void DlgEdObj::UpdateStep() +{ + sal_Int32 nCurStep = GetDlgEdForm()->GetStep(); + sal_Int32 nStep = GetStep(); + + if( nCurStep ) + { + SdrLayerAdmin& rLayerAdmin = GetModel()->GetLayerAdmin(); + SdrLayerID nLayerId = rLayerAdmin.GetLayerID( String( RTL_CONSTASCII_USTRINGPARAM( "HiddenLayer" ) ), FALSE ); + if ( nStep && (nStep != nCurStep) ) + { + SetLayer( nLayerId ); + } + else + { + SetLayer( 0 ); + } + } + else + { + SetLayer( 0 ); + } +} + +//---------------------------------------------------------------------------- + String DlgEdObj::GetDefaultName() { String aStr = GetUnoControlTypeName(); @@ -772,6 +826,11 @@ void SAL_CALL DlgEdObj::_propertyChange( const ::com::sun::star::beans::Propert { SetNameFromProp(evt); } + // update step + else if ( evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Step")) ) + { + UpdateStep(); + } } } @@ -881,6 +940,25 @@ DlgEdForm::~DlgEdForm() //---------------------------------------------------------------------------- +void DlgEdForm::UpdateStep() +{ + ULONG nObjCount; + SdrPage* pSdrPage = GetPage(); + + if ( pSdrPage && ( ( nObjCount = pSdrPage->GetObjCount() ) > 0 ) ) + { + for ( ULONG i = 0 ; i < nObjCount ; i++ ) + { + SdrObject* pObj = pSdrPage->GetObj(i); + DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); + if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) + pDlgEdObj->UpdateStep(); + } + } +} + +//---------------------------------------------------------------------------- + SdrObject* DlgEdForm::CheckHit( const Point& rPnt, USHORT nTol, const SetOfByte* pSet ) const { diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx index 2ac05362a226..f294b17412ce 100644 --- a/basctl/source/inc/dlgedobj.hxx +++ b/basctl/source/inc/dlgedobj.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dlgedobj.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: tbe $ $Date: 2001-03-02 14:02:51 $ + * last change: $Author: tbe $ $Date: 2001-03-07 18:10:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,6 +112,10 @@ public: virtual void SetPropsFromRect(); virtual void SAL_CALL SetNameFromProp( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 GetStep() const; + virtual void SetStep( sal_Int32 nStep ); + virtual void UpdateStep(); + String GetUniqueName(); virtual sal_uInt32 GetObjInventor() const; @@ -173,6 +177,8 @@ public: virtual void SetDlgEditor( VCDlgEditor* pEditor ) { pDlgEditor = pEditor; } virtual VCDlgEditor* GetDlgEditor() const { return pDlgEditor; } + virtual void UpdateStep(); + virtual SdrObject* CheckHit(const Point& rPnt,USHORT nTol,const SetOfByte*) const; protected: |