Discussion:
CVS update [cws_ooo300_hotmac]: /gsl/fpicker/source/win32/filepicker/
a***@openoffice.org
2008-08-29 11:43:20 UTC
Permalink
Tag: cws_ooo300_hotmac
User: as
Date: 2008-08-29 11:43:20+0000
Modified:
gsl/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx
gsl/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.hxx
gsl/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
gsl/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx

Log:
#i92438# handle AutoExtension toggle right

File Changes:

Directory: /gsl/fpicker/source/win32/filepicker/
================================================

File [changed]: VistaFilePickerEventHandler.cxx
Url: http://gsl.openoffice.org/source/browse/gsl/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx?r1=1.4.16.1&r2=1.4.16.1.6.1
Delta lines: +30 -4
--------------------
--- VistaFilePickerEventHandler.cxx 2008-08-06 15:35:17+0000 1.4.16.1
+++ VistaFilePickerEventHandler.cxx 2008-08-29 11:43:18+0000 1.4.16.1.6.1
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: VistaFilePickerEventHandler.cxx,v $
- * $Revision: 1.4.16.1 $
+ * $Revision: 1.4.16.1.6.1 $
*
* This file is part of OpenOffice.org.
*
@@ -66,11 +66,12 @@
//------------------------------------------------------------------------

//-----------------------------------------------------------------------------------------
-VistaFilePickerEventHandler::VistaFilePickerEventHandler()
+VistaFilePickerEventHandler::VistaFilePickerEventHandler(IVistaFilePickerInternalNotify* pInternalNotify)
: m_nRefCount (0 )
, m_nListenerHandle (0 )
, m_pDialog ( )
, m_lListener (m_aMutex)
+ , m_pInternalNotify (pInternalNotify)
{
}

@@ -120,7 +121,7 @@
}

//-----------------------------------------------------------------------------------------
-STDMETHODIMP VistaFilePickerEventHandler::OnFileOk(IFileDialog* pDialog)
+STDMETHODIMP VistaFilePickerEventHandler::OnFileOk(IFileDialog* /*pDialog*/)
{
return E_NOTIMPL;
}
@@ -326,6 +327,31 @@
DWORD nIDCtl ,
BOOL bChecked )
{
+ /*
+ if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
+ {
+ LPCWSTR lpFilterExt = 0;
+ if ( bChecked )
+ {
+ UINT nIndex;
+ if (m_pDialog)
+ {
+ m_pDialog->GetFileTypeIndex( &nIndex );
+ lpFilterExt = lFilters[nIndex].pszSpec;
+ lpFilterExt = wcschr( lpFilterExt, '.' );
+ if ( lpFilterExt )
+ lpFilterExt++;
+ }
+ }
+
+ if (m_pDialog)
+ m_pDialog->SetDefaultExtension( lpFilterExt );
+ }
+ */
+
+ if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
+ m_pInternalNotify->onAutoExtensionChanged(bChecked);
+
impl_sendEvent(E_CONTROL_STATE_CHANGED, nIDCtl);
return S_OK;
}

File [changed]: VistaFilePickerEventHandler.hxx
Url: http://gsl.openoffice.org/source/browse/gsl/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.hxx?r1=1.3&r2=1.3.46.1
Delta lines: +7 -3
-------------------
--- VistaFilePickerEventHandler.hxx 2008-04-11 09:34:29+0000 1.3
+++ VistaFilePickerEventHandler.hxx 2008-08-29 11:43:18+0000 1.3.46.1
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: VistaFilePickerEventHandler.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.46.1 $
*
* This file is part of OpenOffice.org.
*
@@ -37,6 +37,7 @@

#include "comptr.hxx"
#include "vistatypes.h"
+#include "IVistaFilePickerInternalNotify.hxx"

#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
#include <com/sun/star/uno/Reference.hxx>
@@ -78,7 +79,7 @@
// ctor/dtor
//------------------------------------------------------------------------------------

- VistaFilePickerEventHandler();
+ VistaFilePickerEventHandler(IVistaFilePickerInternalNotify* pInternalNotify);
virtual ~VistaFilePickerEventHandler();

//------------------------------------------------------------------------------------
@@ -201,6 +202,9 @@
TFileDialog m_pDialog;

//---------------------------------------------------------------------
+ IVistaFilePickerInternalNotify* m_pInternalNotify;
+
+ //---------------------------------------------------------------------
/** used to inform file picker listener asynchronously.
* Those listener must be called asynchronously .. because
* every request will block the caller thread. Mostly that will be

File [changed]: VistaFilePickerImpl.cxx
Url: http://gsl.openoffice.org/source/browse/gsl/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx?r1=1.4.16.1&r2=1.4.16.1.6.1
Delta lines: +30 -3
--------------------
--- VistaFilePickerImpl.cxx 2008-08-06 15:35:28+0000 1.4.16.1
+++ VistaFilePickerImpl.cxx 2008-08-29 11:43:18+0000 1.4.16.1.6.1
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: VistaFilePickerImpl.cxx,v $
- * $Revision: 1.4.16.1 $
+ * $Revision: 1.4.16.1.6.1 $
*
* This file is part of OpenOffice.org.
*
@@ -118,7 +118,7 @@
, m_hLastResult ()
, m_lFilters ()
, m_lLastFiles ()
- , m_iEventHandler(new VistaFilePickerEventHandler())
+ , m_iEventHandler(new VistaFilePickerEventHandler(this))
, m_bInExecute (sal_False)
{
}
@@ -892,6 +892,33 @@
iCustom->SetControlState(nId, eState);
}

+//-------------------------------------------------------------------------------
+void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
+{
+ // SYNCHRONIZED->
+ ::osl::ResettableMutexGuard aLock(m_aMutex);
+
+ const ::rtl::OUString sFilter = m_lFilters.getCurrentFilter ();
+ ::rtl::OUString sExt ;
+ if ( !m_lFilters.getFilter (sFilter, sExt))
+ return;
+
+ TFileDialog iDialog = impl_getBaseDialogInterface();
+
+ aLock.clear();
+ // <- SYNCHRONIZED
+
+ LPCWSTR pExt = 0;
+ if ( bChecked )
+ {
+ pExt = reinterpret_cast<LPCTSTR>(sExt.getStr());
+ pExt = wcschr( pExt, '.' );
+ if ( pExt )
+ pExt++;
+ }
+ iDialog->SetDefaultExtension( pExt );
+}
+
} // namespace vista
} // namespace win32
} // namespace fpicker

File [changed]: VistaFilePickerImpl.hxx
Url: http://gsl.openoffice.org/source/browse/gsl/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx?r1=1.3&r2=1.3.46.1
Delta lines: +7 -2
-------------------
--- VistaFilePickerImpl.hxx 2008-04-11 09:35:03+0000 1.3
+++ VistaFilePickerImpl.hxx 2008-08-29 11:43:18+0000 1.3.46.1
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: VistaFilePickerImpl.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.46.1 $
*
* This file is part of OpenOffice.org.
*
@@ -41,6 +41,7 @@
#include "vistatypes.h"
#include "FilterContainer.hxx"
#include "VistaFilePickerEventHandler.hxx"
+#include "IVistaFilePickerInternalNotify.hxx"

#include <com/sun/star/uno/Sequence.hxx>

@@ -113,6 +114,7 @@
//-----------------------------------------------------------------------------
class VistaFilePickerImpl : private ::cppu::BaseMutex
, public RequestHandler
+ , public IVistaFilePickerInternalNotify
{
public:

@@ -158,6 +160,9 @@
virtual void doRequest(const RequestRef& rRequest);
virtual void after();

+ //---------------------------------------------------------------------
+ virtual void onAutoExtensionChanged (bool bChecked);
+
private:

//---------------------------------------------------------------------
Loading...