summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTino Rachui <tra@openoffice.org>2001-11-28 12:35:08 +0000
committerTino Rachui <tra@openoffice.org>2001-11-28 12:35:08 +0000
commitc5d87cff59723128118fa9aa858e4905129692de (patch)
tree28aee04aa18ed4ec9d0093ea4b2c405dc3a632ad
parentd94bd73b4e30a5fa9a0adc21ab9331ab28998bdc (diff)
#95345#calling setFilterIndex(1) in appendFilter to reflect default behavior of windows file open dialog
-rw-r--r--fpicker/source/win32/filepicker/WinFileOpenImpl.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
index 037bda2dd9e2..9e26bc86e73f 100644
--- a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
+++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WinFileOpenImpl.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: tra $ $Date: 2001-10-16 14:03:12 $
+ * last change: $Author: tra $ $Date: 2001-11-28 13:35:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -326,11 +326,22 @@ void SAL_CALL CWinFileOpenImpl::appendFilter( const OUString& aTitle, const OUSt
throw(IllegalArgumentException, RuntimeException)
{
sal_Bool bRet = m_filterContainer->addFilter( aTitle, aFilter );
+
if ( !bRet )
throw IllegalArgumentException(
OUString::createFromAscii("filter already exists"),
static_cast< XFilePicker* >( m_FilePicker ),
1 );
+
+ // #95345# see MSDN OPENFILENAME
+ // If nFilterIndex is zero and lpstrCustomFilter is NULL,
+ // the system uses the first filter in the lpstrFilter buffer.
+ // to reflect this we must set the filter index so that calls
+ // to getSelectedFilterIndex without explicitly calling
+ // setFilterIndex before does not return 0 which leads to a
+ // false state
+ if ( 0 == getSelectedFilterIndex() )
+ CFileOpenDialog::setFilterIndex( 1 );
}
//-----------------------------------------------------------------------------------------