Commits

vg  committed cb587a3

CWS-TOOLING: integrate CWS fwk118
2009-09-22 17:19:38 +0200 cd r276361 : #i105263# GetFileTypeIndex() uses a 1 based index
2009-09-22 11:10:29 +0200 cd r276351 : #i105154# Fix bad element exists exception for ui configuration

  • Participants
  • Parent commits 5ba7469

Comments (0)

Files changed (2)

File fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx

         {
 		    if (m_sFilename.getLength())
             {
-                ::rtl::OUString aFileURL(m_sDirectory);
-                sal_Int32 nIndex = aFileURL.lastIndexOf('/');
-                if (nIndex != aFileURL.getLength()-1)
-                    aFileURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/"));
-                aFileURL += m_sFilename;
-                
+                ::rtl::OUString aFileURL(m_sDirectory);
+                sal_Int32 nIndex = aFileURL.lastIndexOf('/');
+                if (nIndex != aFileURL.getLength()-1)
+                    aFileURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/"));
+                aFileURL += m_sFilename;
+                
                 TFileDialogCustomize iCustom = impl_getCustomizeInterface();
                 
                 BOOL bValue = FALSE;
                 HRESULT hResult = iCustom->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue);
                 if ( bValue )
                 {
-                    ::rtl::OUString aExt;
-                    UINT nFileType;
-                    hResult = iDialog->GetFileTypeIndex(&nFileType);
+                    ::rtl::OUString aExt;
+                    UINT nFileType;
+                    hResult = iDialog->GetFileTypeIndex(&nFileType);
 		            if ( SUCCEEDED(hResult) )
-                    {
+                    {
+                        ::sal_Int32 nRealIndex = (nFileType-1); // COM dialog base on 1 ... filter container on 0 .-)
                         ::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters);
-		                LPCWSTR lpFilterExt = lFilters[nFileType].pszSpec;
+		                LPCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec;
 
 		                lpFilterExt = wcsrchr( lpFilterExt, '.' );
 		                if ( lpFilterExt )
                             aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt);
-                    }
+                    }
                 }
 
                 // Check existence of file. Set folder only for this special case
 
 			    WIN32_FIND_DATA	aFindFileData;
                 HANDLE	hFind = FindFirstFile( reinterpret_cast<LPCWSTR>(aSystemPath.getStr()), &aFindFileData );
-                if (hFind != INVALID_HANDLE_VALUE)
-                    iDialog->SetFolder(pFolder);
-                else
-                    hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
-
+                if (hFind != INVALID_HANDLE_VALUE)
+                    iDialog->SetFolder(pFolder);
+                else
+                    hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
+
                 FindClose( hFind );
-            }
-			else
-				hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
+            }
+			else
+				hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
 		}
 	}
 	

File framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx

                 bInsertData   = true;
             }
         }
-        if ( !pDataSettings )
+        if ( !pDataSettings || bInsertData )
         {
             aUIElementData.bDefault     = false;
             if ( !m_bUseDefault )