diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2006-11-22 09:14:13 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2006-11-22 09:14:13 +0000 |
commit | cacdd40efc8e8a9a0ee92f3c09b5e9e3b015630d (patch) | |
tree | 45497fbf6c599a09d1c18e2da359f60c9dafb63a | |
parent | 24e085e4caea3d062b9123f10a7babb75d78c222 (diff) |
INTEGRATION: CWS asyncdialogs (1.2.34); FILE MERGED
2006/09/20 10:49:31 pb 1.2.34.5: RESYNC: (1.8-1.9); FILE MERGED
2006/07/12 14:13:15 pb 1.2.34.4: RESYNC: (1.5-1.6); FILE MERGED
2006/05/31 09:02:52 pb 1.2.34.3: RESYNC: (1.4-1.5); FILE MERGED
2005/12/01 12:57:34 kso 1.2.34.2: RESYNC: (1.2-1.4); FILE MERGED
2005/11/01 14:24:41 kso 1.2.34.1: #i57125# - dialog adaptions for Threading Framework.
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.cxx | 189 |
1 files changed, 115 insertions, 74 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 6a6f9bda0a7b..ad80a403e391 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -4,9 +4,9 @@ * * $RCSfile: OfficeFilePicker.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: obo $ $Date: 2006-09-16 17:49:45 $ + * last change: $Author: vg $ $Date: 2006-11-22 10:14:13 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -215,6 +215,97 @@ ElementEntry_Impl::ElementEntry_Impl( sal_Int16 nId ) {} //------------------------------------------------------------------------------------ +void SvtFilePicker::prepareExecute() +{ + // set the default directory + // --**-- doesn't match the spec yet + if ( m_aDisplayDirectory.getLength() > 0 || m_aDefaultName.getLength() > 0 ) + { + if ( m_aDisplayDirectory.getLength() > 0 ) + { + + INetURLObject aPath( m_aDisplayDirectory ); + if ( m_aDefaultName.getLength() > 0 ) + { + aPath.insertName( m_aDefaultName ); + getDialog()->SetHasFilename( true ); + } + getDialog()->SetPath( aPath.GetMainURL( INetURLObject::NO_DECODE ) ); + } + else if ( m_aDefaultName.getLength() > 0 ) + { + getDialog()->SetPath( m_aDefaultName ); + getDialog()->SetHasFilename( true ); + } + } + else + { + // Default-Standard-Dir setzen + INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() ); + getDialog()->SetPath( aStdDirObj.GetMainURL( INetURLObject::NO_DECODE ) ); + } + + // set the control values and set the control labels, too + if ( m_pElemList && !m_pElemList->empty() ) + { + ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() ); + + ElementList::iterator aListIter; + for ( aListIter = m_pElemList->begin(); + aListIter != m_pElemList->end(); ++aListIter ) + { + ElementEntry_Impl& rEntry = *aListIter; + if ( rEntry.m_bHasValue ) + aAccess.setValue( rEntry.m_nElementID, rEntry.m_nControlAction, rEntry.m_aValue ); + if ( rEntry.m_bHasLabel ) + aAccess.setLabel( rEntry.m_nElementID, rEntry.m_aLabel ); + if ( rEntry.m_bHasEnabled ) + aAccess.enableControl( rEntry.m_nElementID, rEntry.m_bEnabled ); + } + + getDialog()->updateListboxLabelSizes(); + } + + if ( m_pFilterList && !m_pFilterList->empty() ) + { + for ( FilterList::iterator aListIter = m_pFilterList->begin(); + aListIter != m_pFilterList->end(); + ++aListIter + ) + { + if ( aListIter->hasSubFilters() ) + { // it's a filter group + UnoFilterList aSubFilters; + aListIter->getSubFilters( aSubFilters ); + + getDialog()->AddFilterGroup( aListIter->getTitle(), aSubFilters ); + } + else + // it's a single filter + getDialog()->AddFilter( aListIter->getTitle(), aListIter->getFilter() ); + } + } + + // set the default filter + if ( m_aCurrentFilter.getLength() > 0 ) + getDialog()->SetCurFilter( m_aCurrentFilter ); + +} + +//----------------------------------------------------------------------------- +IMPL_LINK( SvtFilePicker, DialogClosedHdl, Dialog*, pDlg ) +{ + if ( m_xDlgClosedListener.is() ) + { + sal_Int16 nRet = static_cast< sal_Int16 >( pDlg->GetResult() ); + ::com::sun::star::ui::dialogs::DialogClosedEvent aEvent( *this, nRet ); + m_xDlgClosedListener->dialogClosed( aEvent ); + m_xDlgClosedListener.clear(); + } + return 0; +} + +//------------------------------------------------------------------------------------ // SvtFilePicker //------------------------------------------------------------------------------------ @@ -431,79 +522,9 @@ sal_Int16 SvtFilePicker::implExecutePicker( ) { getDialog()->SetFileCallback( this ); - // set the default directory - // --**-- doesn't match the spec yet - if ( m_aDisplayDirectory.getLength() > 0 || m_aDefaultName.getLength() > 0 ) - { - if ( m_aDisplayDirectory.getLength() > 0 ) - { - - INetURLObject aPath( m_aDisplayDirectory ); - if ( m_aDefaultName.getLength() > 0 ) - { - aPath.insertName( m_aDefaultName ); - getDialog()->SetHasFilename( true ); - } - getDialog()->SetPath( aPath.GetMainURL( INetURLObject::NO_DECODE ) ); - } - else if ( m_aDefaultName.getLength() > 0 ) - { - getDialog()->SetPath( m_aDefaultName ); - getDialog()->SetHasFilename( true ); - } - } - else - { - // Default-Standard-Dir setzen - INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() ); - getDialog()->SetPath( aStdDirObj.GetMainURL( INetURLObject::NO_DECODE ) ); - } - - // set the control values and set the control labels, too - if ( m_pElemList && !m_pElemList->empty() ) - { - ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() ); - - ElementList::iterator aListIter; - for ( aListIter = m_pElemList->begin(); - aListIter != m_pElemList->end(); ++aListIter ) - { - ElementEntry_Impl& rEntry = *aListIter; - if ( rEntry.m_bHasValue ) - aAccess.setValue( rEntry.m_nElementID, rEntry.m_nControlAction, rEntry.m_aValue ); - if ( rEntry.m_bHasLabel ) - aAccess.setLabel( rEntry.m_nElementID, rEntry.m_aLabel ); - if ( rEntry.m_bHasEnabled ) - aAccess.enableControl( rEntry.m_nElementID, rEntry.m_bEnabled ); - } - - getDialog()->updateListboxLabelSizes(); - } - - if ( m_pFilterList && !m_pFilterList->empty() ) - { - for ( FilterList::iterator aListIter = m_pFilterList->begin(); - aListIter != m_pFilterList->end(); - ++aListIter - ) - { - if ( aListIter->hasSubFilters() ) - { // it's a filter group - UnoFilterList aSubFilters; - aListIter->getSubFilters( aSubFilters ); - - getDialog()->AddFilterGroup( aListIter->getTitle(), aSubFilters ); - } - else - // it's a single filter - getDialog()->AddFilter( aListIter->getTitle(), aListIter->getFilter() ); - } - } - - // set the default filter - if ( m_aCurrentFilter.getLength() > 0 ) - getDialog()->SetCurFilter( m_aCurrentFilter ); + prepareExecute(); + getDialog()->EnableAutocompletion( FALSE ); // now we are ready to execute the dialog sal_Int16 nRet = getDialog()->Execute(); @@ -550,6 +571,26 @@ sal_Int16 SAL_CALL SvtFilePicker::execute( ) throw (RuntimeException) } //------------------------------------------------------------------------------------ +// XAsynchronousExecutableDialog functions +//------------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------------ +void SAL_CALL SvtFilePicker::setDialogTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException) +{ + setTitle( _rTitle ); +} + +//------------------------------------------------------------------------------------ +void SAL_CALL SvtFilePicker::startExecuteModal( const Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener >& xListener ) throw (RuntimeException) +{ + m_xDlgClosedListener = xListener; + prepareDialog(); + prepareExecute(); + getDialog()->EnableAutocompletion( TRUE ); + getDialog()->StartExecuteModal( LINK( this, SvtFilePicker, DialogClosedHdl ) ); +} + +//------------------------------------------------------------------------------------ // XFilePicker functions //------------------------------------------------------------------------------------ |