summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorTino Rachui <tra@openoffice.org>2002-03-28 07:57:33 +0000
committerTino Rachui <tra@openoffice.org>2002-03-28 07:57:33 +0000
commit9921a2d507793bff4a231c74d95d2cc32905cf5e (patch)
treeccb9447968127612d1882a82f64d8304afcecc46 /fpicker
parent2293e29f431ae6737e9b7f0ec2ff7c914a78de4c (diff)
#98418#
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/filepicker/FileOpenDlg.cxx457
-rw-r--r--fpicker/source/win32/filepicker/FileOpenDlg.hxx130
-rw-r--r--fpicker/source/win32/filepicker/FilePicker.cxx397
-rw-r--r--fpicker/source/win32/filepicker/FilePicker.hxx17
-rw-r--r--fpicker/source/win32/filepicker/WinFileOpenImpl.cxx229
-rw-r--r--fpicker/source/win32/filepicker/WinFileOpenImpl.hxx6
-rw-r--r--fpicker/source/win32/filepicker/asynceventnotifier.cxx45
-rw-r--r--fpicker/source/win32/filepicker/asynceventnotifier.hxx9
-rw-r--r--fpicker/source/win32/filepicker/getfilenamewrapper.cxx214
-rw-r--r--fpicker/source/win32/filepicker/getfilenamewrapper.hxx91
-rw-r--r--fpicker/source/win32/filepicker/previewadapter.cxx24
-rw-r--r--fpicker/source/win32/filepicker/previewadapter.hxx8
12 files changed, 690 insertions, 937 deletions
diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.cxx b/fpicker/source/win32/filepicker/FileOpenDlg.cxx
index 5a6b7a332aaa..d921561676b7 100644
--- a/fpicker/source/win32/filepicker/FileOpenDlg.cxx
+++ b/fpicker/source/win32/filepicker/FileOpenDlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FileOpenDlg.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: tra $ $Date: 2002-03-21 07:32:14 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,12 +79,6 @@
#include <systools/win32/user9x.h>
//------------------------------------------------------------------------
-// namespace directives
-//------------------------------------------------------------------------
-
-using rtl::OUString;
-
-//------------------------------------------------------------------------
// constants
//------------------------------------------------------------------------
@@ -112,18 +106,18 @@ namespace /* private */
//------------------------------------------------------------------------
CFileOpenDialog::CFileOpenDialog(
- sal_Bool bFileOpenDialog,
+ bool bFileOpenDialog,
sal_uInt32 dwFlags,
sal_uInt32 dwTemplateId,
- HINSTANCE hInstance ) :
- m_filterBuffer( MAX_FILTER_BUFF_SIZE, sal_True ),
- m_fileNameBuffer( MAX_FILENAME_BUFF_SIZE ),
- m_fileTitleBuffer( MAX_FILETITLE_BUFF_SIZE ),
- m_helperBuffer( MAX_FILENAME_BUFF_SIZE ),
- m_hwndFileOpenDlg( 0 ),
- m_hwndFileOpenDlgChild( 0 ),
- m_bFileOpenDialog( bFileOpenDialog ),
- m_GetFileNameWrapper( CGetFileNameWrapper::create( ) )
+ HINSTANCE hInstance) :
+ m_hwndFileOpenDlg(0),
+ m_hwndFileOpenDlgChild(0),
+ m_bFileOpenDialog(bFileOpenDialog),
+ m_filterBuffer(MAX_FILTER_BUFF_SIZE),
+ m_fileTitleBuffer(MAX_FILETITLE_BUFF_SIZE),
+ m_helperBuffer(MAX_FILENAME_BUFF_SIZE),
+ m_fileNameBuffer(MAX_FILENAME_BUFF_SIZE),
+ m_pfnBaseDlgProc(0)
{
// initialize the OPENFILENAME struct
if (IsWindows2000Platform())
@@ -152,36 +146,33 @@ CFileOpenDialog::CFileOpenDialog(
// we get a parent window (using a vcl window?)
m_ofn.hwndOwner = GetForegroundWindow( );
- // we don't use custom filters
- m_ofn.lpstrCustomFilter = 0;
-
- m_ofn.lpstrFile = m_fileNameBuffer;
- m_ofn.nMaxFile = m_fileNameBuffer.size( );
+ m_ofn.lpstrFile = const_cast<sal_Unicode*>(m_fileNameBuffer.getStr());
+ m_ofn.nMaxFile = m_fileNameBuffer.getCapacity();
- m_ofn.lpstrFileTitle = m_fileTitleBuffer;
- m_ofn.nMaxFileTitle = m_fileTitleBuffer.size( );
+ m_ofn.lpstrFileTitle = const_cast<sal_Unicode*>(m_fileTitleBuffer.getStr());
+ m_ofn.nMaxFileTitle = m_fileTitleBuffer.getCapacity();
m_ofn.lpfnHook = CFileOpenDialog::ofnHookProc;
// set a custom template
- if ( dwTemplateId )
+ if (dwTemplateId)
{
- OSL_ASSERT( hInstance );
+ OSL_ASSERT(hInstance);
m_ofn.Flags |= OFN_ENABLETEMPLATE;
- m_ofn.lpTemplateName = MAKEINTRESOURCEW( dwTemplateId );
+ m_ofn.lpTemplateName = MAKEINTRESOURCEW(dwTemplateId);
m_ofn.hInstance = hInstance;
}
// set a pointer to myself as ofn parameter
- m_ofn.lCustData = reinterpret_cast< long > ( this );
+ m_ofn.lCustData = reinterpret_cast<long>(this);
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-CFileOpenDialog::~CFileOpenDialog( )
+CFileOpenDialog::~CFileOpenDialog()
{
}
@@ -189,30 +180,31 @@ CFileOpenDialog::~CFileOpenDialog( )
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::setTitle( const OUString& aTitle )
+void SAL_CALL CFileOpenDialog::setTitle(const rtl::OUString& aTitle)
{
- m_dialogTitle = aTitle.getStr( );
- m_ofn.lpstrTitle = m_dialogTitle.getStr( );
+ m_dialogTitle = aTitle;
+ m_ofn.lpstrTitle = m_dialogTitle.getStr();
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-void CFileOpenDialog::setFilter( const OUString& aFilter )
+void CFileOpenDialog::setFilter(const rtl::OUString& aFilter)
{
- m_filterBuffer.resize( aFilter.getLength( ) + 1 );
- m_filterBuffer.fill( aFilter.getStr( ), aFilter.getLength( ) );
- m_ofn.lpstrFilter = m_filterBuffer;
+ m_filterBuffer.ensureCapacity(aFilter.getLength());
+ m_filterBuffer.setLength(0);
+ m_filterBuffer.append(aFilter);
+ m_ofn.lpstrFilter = m_filterBuffer.getStr();
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-sal_Bool CFileOpenDialog::setFilterIndex( sal_uInt32 aIndex )
+bool CFileOpenDialog::setFilterIndex(sal_uInt32 aIndex)
{
- OSL_ASSERT( aIndex > 0 );
+ OSL_ASSERT(aIndex > 0);
m_ofn.nFilterIndex = aIndex;
return sal_True;
}
@@ -221,7 +213,7 @@ sal_Bool CFileOpenDialog::setFilterIndex( sal_uInt32 aIndex )
//
//------------------------------------------------------------------------
-sal_uInt32 CFileOpenDialog::getSelectedFilterIndex( ) const
+sal_uInt32 CFileOpenDialog::getSelectedFilterIndex() const
{
return m_ofn.nFilterIndex;
}
@@ -230,18 +222,18 @@ sal_uInt32 CFileOpenDialog::getSelectedFilterIndex( ) const
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::setDefaultName( const OUString& aName )
+void SAL_CALL CFileOpenDialog::setDefaultName(const rtl::OUString& aName)
{
- m_fileNameBuffer.empty( );
- m_fileNameBuffer.fill( aName.getStr( ), aName.getLength( ) );
- m_ofn.lpstrFile = m_fileNameBuffer;
+ m_fileNameBuffer.setLength(0);
+ m_fileNameBuffer.append(aName);
+ m_ofn.lpstrFile = const_cast<sal_Unicode*>(m_fileNameBuffer.getStr());
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::setDisplayDirectory( const OUString& aDirectory )
+void SAL_CALL CFileOpenDialog::setDisplayDirectory(const rtl::OUString& aDirectory)
{
m_displayDirectory = aDirectory;
m_ofn.lpstrInitialDir = m_displayDirectory;
@@ -251,7 +243,7 @@ void SAL_CALL CFileOpenDialog::setDisplayDirectory( const OUString& aDirectory )
//
//------------------------------------------------------------------------
-rtl::OUString SAL_CALL CFileOpenDialog::getLastDisplayDirectory( ) const
+rtl::OUString SAL_CALL CFileOpenDialog::getLastDisplayDirectory() const
{
return m_displayDirectory;
}
@@ -260,141 +252,92 @@ rtl::OUString SAL_CALL CFileOpenDialog::getLastDisplayDirectory( ) const
//
//------------------------------------------------------------------------
-rtl::OUString SAL_CALL CFileOpenDialog::getFullFileName( ) const
+rtl::OUString SAL_CALL CFileOpenDialog::getFullFileName() const
{
- return OUString( &m_fileNameBuffer, _wcslenex( &m_fileNameBuffer ) );
+ return rtl::OUString(m_fileNameBuffer.getStr(),
+ _wcslenex(m_fileNameBuffer.getStr()));
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-rtl::OUString SAL_CALL CFileOpenDialog::getFileName( ) const
+rtl::OUString SAL_CALL CFileOpenDialog::getFileName() const
{
- return OUString( &m_fileTitleBuffer, wcslen( &m_fileTitleBuffer ) + 1 );
+ return rtl::OUString(m_fileTitleBuffer);
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-rtl::OUString CFileOpenDialog::getFileExtension( )
+rtl::OUString CFileOpenDialog::getFileExtension()
{
- OUString fileExt;
+ if (m_ofn.nFileExtension)
+ return rtl::OUString(m_fileNameBuffer.getStr() + m_ofn.nFileExtension,
+ wcslen(m_fileNameBuffer.getStr() + m_ofn.nFileExtension));
- if ( m_ofn.nFileExtension )
- fileExt = OUString( m_fileNameBuffer + m_ofn.nFileExtension,
- wcslen( m_fileNameBuffer + m_ofn.nFileExtension ) );
-
- return fileExt;
+ return rtl::OUString();
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-void CFileOpenDialog::setDefaultFileExtension( const OUString& aExtension )
+void CFileOpenDialog::setDefaultFileExtension(const rtl::OUString& aExtension)
{
m_defaultExtension = aExtension;
- m_ofn.lpstrDefExt = m_defaultExtension.getStr( );
+ m_ofn.lpstrDefExt = m_defaultExtension.getStr();
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::setMultiSelectionMode( sal_Bool bMode )
+void SAL_CALL CFileOpenDialog::setMultiSelectionMode(bool bMode)
{
- if ( bMode )
+ if (bMode)
m_ofn.Flags |= OFN_ALLOWMULTISELECT;
- else if ( m_ofn.Flags & OFN_ALLOWMULTISELECT )
- m_ofn.Flags ^= OFN_ALLOWMULTISELECT;
-}
-
-//------------------------------------------------------------------------
-//
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL CFileOpenDialog::getMultiSelectionMode( ) const
-{
- return ( m_ofn.Flags & OFN_ALLOWMULTISELECT );
-}
-
-//------------------------------------------------------------------------
-//
-//------------------------------------------------------------------------
-
-sal_Bool CFileOpenDialog::setControlLabel( sal_Int16 ElementID, const OUString& aLabel )
-{
- return sal_True;
-}
-
-//------------------------------------------------------------------------
-//
-//------------------------------------------------------------------------
-
-void SAL_CALL CFileOpenDialog::enableControl( sal_Int16 ElementID, sal_Bool bEnabled )
-{
-
-}
-
-//------------------------------------------------------------------------
-//
-//------------------------------------------------------------------------
-
-sal_Bool CFileOpenDialog::showControl( sal_Int16 ElementID, sal_Bool bShow )
-{
- return sal_True;
-}
-
-//------------------------------------------------------------------------
-//
-//------------------------------------------------------------------------
-
-CFileOpenDialog::POSITION SAL_CALL CFileOpenDialog::beginEnumFileNames( )
-{
- return 0;
+ else
+ m_ofn.Flags &= ~OFN_ALLOWMULTISELECT;
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-sal_Bool SAL_CALL CFileOpenDialog::getNextFileName(
- POSITION& pos, OUString& aNextFileName )
+bool SAL_CALL CFileOpenDialog::getMultiSelectionMode() const
{
- return sal_False;
+ return ((m_ofn.Flags & OFN_ALLOWMULTISELECT) > 0);
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-sal_Int16 SAL_CALL CFileOpenDialog::doModal( )
+sal_Int16 SAL_CALL CFileOpenDialog::doModal()
{
sal_Int16 nRC = -1;
// pre-processing
- if ( preModal( ) )
+ if (preModal())
{
- sal_Bool bRet;
+ bool bRet;
- OSL_ASSERT( m_GetFileNameWrapper.get( ) );
+ if (m_bFileOpenDialog)
+ bRet = m_GetFileNameWrapper.getOpenFileName(
+ reinterpret_cast<LPOPENFILENAMEW>(&m_ofn));
+ else
+ bRet = m_GetFileNameWrapper.getSaveFileName(
+ reinterpret_cast<LPOPENFILENAMEW>(&m_ofn));
- if ( m_GetFileNameWrapper.get( ) )
- {
- if ( m_bFileOpenDialog )
- bRet = m_GetFileNameWrapper->getOpenFileName( (LPOPENFILENAMEW)&m_ofn );
- else
- bRet = m_GetFileNameWrapper->getSaveFileName( (LPOPENFILENAMEW)&m_ofn );
-
- nRC = 1;
- if ( !bRet )
- nRC = (0 == m_GetFileNameWrapper->commDlgExtendedError( )) ? 0 : -1;
- }
+ nRC = 1;
+
+ if (!bRet)
+ nRC = (0 == m_GetFileNameWrapper.commDlgExtendedError()) ? 0 : -1;
// post-processing
- postModal( nRC );
+ postModal(nRC);
}
return nRC;
@@ -404,16 +347,16 @@ sal_Int16 SAL_CALL CFileOpenDialog::doModal( )
//
//------------------------------------------------------------------------
-sal_uInt32 SAL_CALL CFileOpenDialog::getLastDialogError( ) const
+sal_uInt32 SAL_CALL CFileOpenDialog::getLastDialogError() const
{
- return CommDlgExtendedError( );
+ return CommDlgExtendedError();
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-sal_Bool SAL_CALL CFileOpenDialog::preModal( )
+bool SAL_CALL CFileOpenDialog::preModal()
{
return sal_True;
}
@@ -422,20 +365,16 @@ sal_Bool SAL_CALL CFileOpenDialog::preModal( )
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::postModal( sal_Int16 nDialogResult )
+void SAL_CALL CFileOpenDialog::postModal(sal_Int16 nDialogResult)
{
- OSL_ASSERT( (-1 <= nDialogResult) && (nDialogResult <= 1) );
+ OSL_ASSERT((-1 <= nDialogResult) && (nDialogResult <= 1));
- if ( m_ofn.lpstrFile )
+ if (1 == nDialogResult)
{
- OUString lastDir;
- sal_Unicode* pLastDirChar = m_ofn.lpstrFile + m_ofn.nFileOffset - 1;
- if ( m_ofn.nFileOffset && 0 == *pLastDirChar )
- lastDir = OUString( m_ofn.lpstrFile, m_ofn.nFileOffset - 1 );
- else if ( m_ofn.nFileOffset )
- lastDir = OUString( m_ofn.lpstrFile, m_ofn.nFileOffset );
-
- m_displayDirectory = lastDir;
+ // Attention: assuming that nFileOffset is always greater 0 because under
+ // Windows there is always a drive letter or a server in a complete path
+ // the OPENFILENAME docu never says that nFileOffset can be 0
+ m_displayDirectory = rtl::OUString(m_ofn.lpstrFile,m_ofn.nFileOffset);
}
}
@@ -443,53 +382,55 @@ void SAL_CALL CFileOpenDialog::postModal( sal_Int16 nDialogResult )
//
//------------------------------------------------------------------------
-OUString SAL_CALL CFileOpenDialog::getCurrentFilePath( ) const
+rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFilePath() const
{
- OSL_ASSERT( IsWindow( m_hwndFileOpenDlg ) );
+ OSL_ASSERT(IsWindow(m_hwndFileOpenDlg));
LPARAM nLen = SendMessageW(
m_hwndFileOpenDlg,
CDM_GETFILEPATH,
- m_helperBuffer.size( ),
- reinterpret_cast< LPARAM >( &m_helperBuffer ) );
+ m_helperBuffer.getCapacity(),
+ reinterpret_cast<LPARAM>(m_helperBuffer.getStr()));
- OUString filePath;
-
- if ( nLen > 0 )
- filePath = OUString( &m_helperBuffer, (nLen - 1) );
+ if (nLen > 0)
+ {
+ m_helperBuffer.setLength(nLen - 1);
+ return rtl::OUString(m_helperBuffer);
+ }
- return filePath;
+ return rtl::OUString();
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-OUString SAL_CALL CFileOpenDialog::getCurrentFolderPath( ) const
+rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFolderPath() const
{
- OSL_ASSERT( IsWindow( m_hwndFileOpenDlg ) );
+ OSL_ASSERT(IsWindow(m_hwndFileOpenDlg));
LPARAM nLen = SendMessageW(
m_hwndFileOpenDlg,
CDM_GETFOLDERPATH,
- m_helperBuffer.size( ),
- reinterpret_cast< LPARAM >( &m_helperBuffer ) );
-
- OUString folderPath;
+ m_helperBuffer.getCapacity(),
+ reinterpret_cast<LPARAM>(m_helperBuffer.getStr()));
- if ( nLen > 0 )
- folderPath = OUString( &m_helperBuffer, (nLen -1) );
+ if (nLen > 0)
+ {
+ m_helperBuffer.setLength(nLen - 1);
+ return rtl::OUString(m_helperBuffer);
+ }
- return folderPath;
+ return rtl::OUString();
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-OUString SAL_CALL CFileOpenDialog::getCurrentFileName( ) const
+rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFileName() const
{
- OSL_ASSERT( IsWindow( m_hwndFileOpenDlg ) );
+ OSL_ASSERT(IsWindow(m_hwndFileOpenDlg));
// this is an ugly hack because beause
// CDM_GETSPEC and BFFM_SETSTATUSTEXT
@@ -499,32 +440,33 @@ OUString SAL_CALL CFileOpenDialog::getCurrentFileName( ) const
OSVERSIONINFO OSVerInfo;
- OSVerInfo.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
+ OSVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx( &OSVerInfo );
// if windows 95/98
- if ( VER_PLATFORM_WIN32_WINDOWS == OSVerInfo.dwPlatformId )
+ if (VER_PLATFORM_WIN32_WINDOWS == OSVerInfo.dwPlatformId)
MsgId = CDM_GETSPEC + 100;
LPARAM nLen = SendMessageW(
m_hwndFileOpenDlg,
MsgId,
- m_helperBuffer.size( ),
- reinterpret_cast< LPARAM >( &m_helperBuffer ) );
+ m_helperBuffer.getCapacity(),
+ reinterpret_cast<LPARAM>(m_helperBuffer.getStr()));
- OUString fileName;
-
- if ( nLen > 0 )
- fileName = OUString( &m_helperBuffer, (nLen - 1) );
+ if (nLen > 0)
+ {
+ m_helperBuffer.setLength(nLen - 1);
+ return rtl::OUString(m_helperBuffer);
+ }
- return fileName;
+ return rtl::OUString();
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-sal_uInt32 SAL_CALL CFileOpenDialog::onShareViolation( const OUString& aPathName)
+sal_uInt32 SAL_CALL CFileOpenDialog::onShareViolation(const rtl::OUString& aPathName)
{
return 0;
}
@@ -542,7 +484,7 @@ sal_uInt32 SAL_CALL CFileOpenDialog::onFileOk()
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::onSelChanged( HWND hwndListBox )
+void SAL_CALL CFileOpenDialog::onSelChanged(HWND hwndListBox)
{
}
@@ -550,7 +492,7 @@ void SAL_CALL CFileOpenDialog::onSelChanged( HWND hwndListBox )
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::onHelp( )
+void SAL_CALL CFileOpenDialog::onHelp()
{
}
@@ -560,7 +502,7 @@ void SAL_CALL CFileOpenDialog::onHelp( )
void SAL_CALL CFileOpenDialog::onInitDone()
{
- centerPositionToParent( );
+ centerPositionToParent();
}
//------------------------------------------------------------------------
@@ -575,7 +517,7 @@ void SAL_CALL CFileOpenDialog::onFolderChanged()
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::onTypeChanged( sal_uInt32 nFilterIndex )
+void SAL_CALL CFileOpenDialog::onTypeChanged(sal_uInt32 nFilterIndex)
{
}
@@ -583,7 +525,7 @@ void SAL_CALL CFileOpenDialog::onTypeChanged( sal_uInt32 nFilterIndex )
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::onInitDialog( HWND hwndDlg, HWND hwndChild )
+void SAL_CALL CFileOpenDialog::onInitDialog(HWND hwndDlg, HWND hwndChild)
{
}
@@ -592,7 +534,7 @@ void SAL_CALL CFileOpenDialog::onInitDialog( HWND hwndDlg, HWND hwndChild )
//------------------------------------------------------------------------
sal_uInt32 SAL_CALL CFileOpenDialog::onCtrlCommand(
- HWND hwndChild, sal_uInt16 ctrlId, sal_uInt16 notifyCode )
+ HWND hwndChild, sal_uInt16 ctrlId, sal_uInt16 notifyCode)
{
return 0;
}
@@ -601,35 +543,35 @@ sal_uInt32 SAL_CALL CFileOpenDialog::onCtrlCommand(
//
//------------------------------------------------------------------------
-sal_uInt32 SAL_CALL CFileOpenDialog::onWMNotify( HWND hwndChild, LPOFNOTIFYW lpOfNotify )
+sal_uInt32 SAL_CALL CFileOpenDialog::onWMNotify(HWND hwndChild, LPOFNOTIFYW lpOfNotify)
{
- switch( lpOfNotify->hdr.code )
+ switch(lpOfNotify->hdr.code)
{
case CDN_SHAREVIOLATION:
- return onShareViolation( lpOfNotify->pszFile );
+ return onShareViolation(lpOfNotify->pszFile);
case CDN_FILEOK:
- return onFileOk( );
+ return onFileOk();
case CDN_SELCHANGE:
- onSelChanged( lpOfNotify->hdr.hwndFrom );
+ onSelChanged(lpOfNotify->hdr.hwndFrom);
break;
case CDN_HELP:
- onHelp( );
+ onHelp();
break;
case CDN_INITDONE:
- onInitDone( );
+ onInitDone();
break;
case CDN_FOLDERCHANGE:
- onFolderChanged( );
+ onFolderChanged();
break;
case CDN_TYPECHANGE:
m_ofn.nFilterIndex = lpOfNotify->lpOFN->nFilterIndex;
- onTypeChanged( lpOfNotify->lpOFN->nFilterIndex );
+ onTypeChanged(lpOfNotify->lpOFN->nFilterIndex);
break;
}
@@ -640,16 +582,16 @@ sal_uInt32 SAL_CALL CFileOpenDialog::onWMNotify( HWND hwndChild, LPOFNOTIFYW lpO
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::handleInitDialog( HWND hwndDlg, HWND hwndChild )
+void SAL_CALL CFileOpenDialog::handleInitDialog(HWND hwndDlg, HWND hwndChild)
{
m_hwndFileOpenDlg = hwndDlg;
m_hwndFileOpenDlgChild = hwndChild;
- OSL_ASSERT( GetParent( hwndChild ) == hwndDlg );
+ OSL_ASSERT(GetParent(hwndChild) == hwndDlg);
// calling virtual function which the
// client can overload
- onInitDialog( hwndDlg, hwndChild );
+ onInitDialog(hwndDlg, hwndChild);
}
//------------------------------------------------------------------------
@@ -657,7 +599,7 @@ void SAL_CALL CFileOpenDialog::handleInitDialog( HWND hwndDlg, HWND hwndChild )
//------------------------------------------------------------------------
unsigned int CALLBACK CFileOpenDialog::ofnHookProc(
- HWND hChildDlg, unsigned int uiMsg, WPARAM wParam, LPARAM lParam )
+ HWND hChildDlg, unsigned int uiMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwndDlg = GetParent( hChildDlg );
CFileOpenDialog* pImpl = NULL;
@@ -666,38 +608,38 @@ unsigned int CALLBACK CFileOpenDialog::ofnHookProc(
{
case WM_INITDIALOG:
{
- _OPENFILENAMEW* lpofn = reinterpret_cast< _OPENFILENAMEW* >( lParam );
- pImpl = reinterpret_cast< CFileOpenDialog* >( lpofn->lCustData );
- OSL_ASSERT( pImpl );
+ _OPENFILENAMEW* lpofn = reinterpret_cast<_OPENFILENAMEW*>(lParam);
+ pImpl = reinterpret_cast<CFileOpenDialog*>(lpofn->lCustData);
+ OSL_ASSERT(pImpl);
// subclass the base dialog for WM_NCDESTROY processing
pImpl->m_pfnBaseDlgProc =
reinterpret_cast< DLGPROC >(
SetWindowLong( hwndDlg,
DWL_DLGPROC,
- reinterpret_cast< DWORD >( CFileOpenDialog::BaseDlgProc ) ) );
+ reinterpret_cast<DWORD>(CFileOpenDialog::BaseDlgProc)));
// connect the instance handle to the window
- SetPropA( hwndDlg, CURRENT_INSTANCE, pImpl );
+ SetPropA(hwndDlg, CURRENT_INSTANCE, pImpl);
- pImpl->handleInitDialog( hwndDlg, hChildDlg );
+ pImpl->handleInitDialog(hwndDlg, hChildDlg);
}
return 0;
case WM_NOTIFY:
{
- pImpl = getCurrentInstance( hwndDlg );
+ pImpl = getCurrentInstance(hwndDlg);
return pImpl->onWMNotify(
- hChildDlg, reinterpret_cast< LPOFNOTIFYW >( lParam ) );
+ hChildDlg, reinterpret_cast<LPOFNOTIFYW>(lParam));
}
case WM_COMMAND:
{
- pImpl = getCurrentInstance( hwndDlg );
- OSL_ASSERT( pImpl );
+ pImpl = getCurrentInstance(hwndDlg);
+ OSL_ASSERT(pImpl);
return pImpl->onCtrlCommand(
- hChildDlg, LOWORD( wParam ), HIWORD( lParam ) );
+ hChildDlg, LOWORD(wParam), HIWORD(lParam));
}
}
@@ -709,111 +651,88 @@ unsigned int CALLBACK CFileOpenDialog::ofnHookProc(
//------------------------------------------------------------------------
unsigned int CALLBACK CFileOpenDialog::BaseDlgProc(
- HWND hWnd, WORD wMessage, WPARAM wParam, LPARAM lParam )
+ HWND hWnd, WORD wMessage, WPARAM wParam, LPARAM lParam)
{
- unsigned int lResult = 0;
- CFileOpenDialog* pImpl = NULL;
+ CFileOpenDialog* pImpl = 0;
- switch( wMessage )
+ if (WM_NCDESTROY == wMessage)
{
- case WM_NCDESTROY:
-
- // RemoveProp returns the saved value on success
- pImpl = reinterpret_cast< CFileOpenDialog* >(
- RemovePropA( hWnd, CURRENT_INSTANCE ) );
- OSL_ASSERT( pImpl );
-
- // fall through in order to call the
- // base dlg proc
- default:
- if ( !pImpl )
- {
- pImpl = getCurrentInstance( hWnd );
- OSL_ASSERT( pImpl );
- }
-
- // !!! we use CallWindowProcA
- lResult = CallWindowProcA(
- reinterpret_cast< WNDPROC >( pImpl->m_pfnBaseDlgProc ),
- hWnd, wMessage, wParam, lParam );
+ pImpl = reinterpret_cast<CFileOpenDialog*>(
+ RemovePropA(hWnd,CURRENT_INSTANCE));
- break;
-
- } // switch
+ SetWindowLong(hWnd, DWL_DLGPROC,
+ reinterpret_cast<DWORD>(pImpl->m_pfnBaseDlgProc));
+ }
+ else
+ {
+ pImpl = getCurrentInstance(hWnd);
+ }
- return lResult;
+ OSL_ASSERT(pImpl);
+ return CallWindowProcA(
+ reinterpret_cast<WNDPROC>(pImpl->m_pfnBaseDlgProc),
+ hWnd,wMessage,wParam,lParam);
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-CFileOpenDialog* SAL_CALL CFileOpenDialog::getCurrentInstance( HWND hwnd )
+CFileOpenDialog* SAL_CALL CFileOpenDialog::getCurrentInstance(HWND hwnd)
{
- OSL_ASSERT( IsWindow( hwnd ) );
- return reinterpret_cast< CFileOpenDialog* >(
- GetPropA( hwnd, CURRENT_INSTANCE ) );
+ OSL_ASSERT(IsWindow(hwnd));
+
+ return reinterpret_cast<CFileOpenDialog*>(
+ GetPropA(hwnd, CURRENT_INSTANCE));
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
-void SAL_CALL CFileOpenDialog::centerPositionToParent( ) const
+void SAL_CALL CFileOpenDialog::centerPositionToParent() const
{
- OSL_PRECOND( IsWindow( m_hwndFileOpenDlg ), "no dialog window, call method only after or in onInitDone" );
-
- HDC hdc = GetDC( m_hwndFileOpenDlg );
+ OSL_PRECOND(IsWindow(m_hwndFileOpenDlg), "no dialog window, call method only after or in onInitDone");
HWND hwndParent = m_ofn.hwndOwner;
- if ( !IsWindow( hwndParent ) )
- hwndParent = GetDesktopWindow( );
+ if (!IsWindow(hwndParent))
+ hwndParent = GetDesktopWindow();
- OSL_ASSERT( IsWindow( hwndParent ) );
+ OSL_ASSERT(IsWindow(hwndParent));
- RECT rcParent;
- GetWindowRect( hwndParent, &rcParent );
+ RECT rcPar;
+ GetWindowRect(hwndParent, &rcPar);
- RECT rcDialog;
- GetWindowRect( m_hwndFileOpenDlg, &rcDialog );
+ RECT rcDlg;
+ GetWindowRect(m_hwndFileOpenDlg, &rcDlg);
- LONG lParentWidth = rcParent.right - rcParent.left;
- LONG lParentHeight = rcParent.bottom - rcParent.top;
+ int lDlgW = rcDlg.right - rcDlg.left;
+ int lDlgH = rcDlg.bottom - rcDlg.top;
- LONG lDialogWidth = rcDialog.right - rcDialog.left;
- LONG lDialogHeight = rcDialog.bottom - rcDialog.top;
+ int x = (rcPar.left + rcPar.right - lDlgW) / 2;
+ int y = (rcPar.top + rcPar.bottom - lDlgH) / 2;
- int xParentMid = rcParent.left + (lParentWidth / 2);
- int yParentMid = rcParent.top + (lParentHeight / 2);
+ HDC hdc = GetDC(m_hwndFileOpenDlg);
- int x = xParentMid - (lDialogWidth / 2);
- int y = yParentMid - (lDialogHeight / 2);
+ int hResol = GetDeviceCaps(hdc, HORZRES);
+ int vResol = GetDeviceCaps(hdc, VERTRES);
- int xScreen = GetDeviceCaps( hdc, HORZRES );
- int yScreen = GetDeviceCaps( hdc, VERTRES );
+ ReleaseDC(m_hwndFileOpenDlg, hdc);
- if ( x < 0 )
+ if (x < 0)
x = 0;
+ else if ((x + lDlgW) > hResol)
+ x = hResol - lDlgW;
- if ( y < 0 )
+ if (y < 0)
y = 0;
-
- if ( (x + lDialogWidth) > xScreen )
- x = xScreen - lDialogWidth;
-
- if ( (y + lDialogHeight) > yScreen )
- y = yScreen - lDialogHeight;
+ else if ((y + lDlgH) > vResol)
+ y = vResol - lDlgH;
SetWindowPos(
m_hwndFileOpenDlg,
- NULL,
- x,
- y,
- 0,
- 0,
+ NULL, x, y, 0, 0,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE );
-
- ReleaseDC( m_hwndFileOpenDlg, hdc );
} \ No newline at end of file
diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.hxx b/fpicker/source/win32/filepicker/FileOpenDlg.hxx
index 1e966b979d15..e2e3f3521713 100644
--- a/fpicker/source/win32/filepicker/FileOpenDlg.hxx
+++ b/fpicker/source/win32/filepicker/FileOpenDlg.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FileOpenDlg.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: tra $ $Date: 2001-10-04 11:10:45 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,12 +74,10 @@
#include <rtl/ustring>
#endif
-#ifndef _AUTO_BUFFER_HXX_
-#include "..\misc\AutoBuffer.hxx"
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
#endif
-#include <memory>
-
#include <windows.h>
#ifndef _GETFILENAMEWRAPPER_HXX_
@@ -117,10 +115,6 @@ typedef struct _tagOFNW {
LPARAM lCustData;
LPOFNHOOKPROC lpfnHook;
LPCWSTR lpTemplateName;
-#ifdef _MAC
- LPEDITMENU lpEditInfo;
- LPCSTR lpstrPrompt;
-#endif
#if (_WIN32_WINNT >= 0x0500)
void * pvReserved;
DWORD dwReserved;
@@ -142,10 +136,6 @@ typedef struct _tagOFNW {
class CFileOpenDialog
{
public:
- typedef sal_Unicode* POSITION;
-
-public:
-
// ctor
// bFileOpenDialog idicates if we want a FileOpen or FileSave
// dialog
@@ -155,92 +145,63 @@ public:
// which provides the custom template, unused if dwTemplateId
// is 0
CFileOpenDialog(
- sal_Bool bFileOpenDialog = sal_True,
+ bool bFileOpenDialog = sal_True,
sal_uInt32 dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
sal_uInt32 dwTemplateId = 0,
- HINSTANCE hInstance = 0 );
+ HINSTANCE hInstance = 0);
- virtual ~CFileOpenDialog( );
+ virtual ~CFileOpenDialog();
- virtual void SAL_CALL setTitle( const rtl::OUString& aTitle );
+ virtual void SAL_CALL setTitle(const rtl::OUString& aTitle);
// to set a filter string using the M$ format
// e.g. FltName\0*.txt;*.rtf\0...\0\0
- void SAL_CALL setFilter( const rtl::OUString& aFilter );
+ void SAL_CALL setFilter(const rtl::OUString& aFilter);
// set the index of the current filter when the
// dialog is about to shown, the index starts with 1
// the function succeeded if the given filter index
// is greater than zero and is a valid position
// within filter string that was previously set
- sal_Bool SAL_CALL setFilterIndex( sal_uInt32 aIndex );
+ bool SAL_CALL setFilterIndex(sal_uInt32 aIndex);
// get the index of the currently selected filter
// the index of the returned filter starts with 1
- sal_uInt32 SAL_CALL getSelectedFilterIndex( ) const;
+ sal_uInt32 SAL_CALL getSelectedFilterIndex() const;
// set the name and optional the path of the
// file that will be initially be shown when
// the dialog will be displayed
- virtual void SAL_CALL setDefaultName( const rtl::OUString& aName );
+ virtual void SAL_CALL setDefaultName(const rtl::OUString& aName);
// set the initial directory
- virtual void SAL_CALL setDisplayDirectory( const rtl::OUString& aDirectory );
+ virtual void SAL_CALL setDisplayDirectory(const rtl::OUString& aDirectory);
// returns only the path of the selected file
- virtual rtl::OUString SAL_CALL getLastDisplayDirectory( ) const;
+ virtual rtl::OUString SAL_CALL getLastDisplayDirectory() const;
// returns the full file name including drive letter, path
// file name and file extension
- virtual rtl::OUString SAL_CALL getFullFileName( ) const;
+ virtual rtl::OUString SAL_CALL getFullFileName() const;
// returns the file name and the file extension without
// drive letter and path
- rtl::OUString SAL_CALL getFileName( ) const;
+ rtl::OUString SAL_CALL getFileName() const;
// returns the file extension of the selected file
- rtl::OUString SAL_CALL getFileExtension( );
+ rtl::OUString SAL_CALL getFileExtension();
// set a default extension, only the first three letters of
// the given extension will be used; the given extension
// should not contain a '.'
- void SAL_CALL setDefaultFileExtension( const rtl::OUString& aExtension );
+ void SAL_CALL setDefaultFileExtension(const rtl::OUString& aExtension);
// enables or disables the multiselection mode for
// the FileOpen/FileSave dialog
- void SAL_CALL setMultiSelectionMode( sal_Bool bMode );
+ void SAL_CALL setMultiSelectionMode(bool bMode);
// returns whether multi-selection mode is enabled or not
- sal_Bool SAL_CALL getMultiSelectionMode( ) const;
-
- // sets the label of the specified control
- // returns true on success or false if the control id
- // is invalid or another error occured
- sal_Bool SAL_CALL setControlLabel( sal_Int16 ElementID, const rtl::OUString& aLabel );
-
- // enables or disables the specified control
- virtual void SAL_CALL enableControl( sal_Int16 ElementID, sal_Bool bEnabled );
-
- // shows or hides a control ( bShow = true shows the control
- // and bShow = false hides the control )
- // returns true on success and false if the control id
- // is invalid or another error occured
- sal_Bool SAL_CALL showControl( sal_Int16 ElementID, sal_Bool bShow );
-
- // starts enumerating the selected file names if
- // the multiselection mode is enabled
- POSITION SAL_CALL beginEnumFileNames( );
-
- // returns true if multiselection mode is enabled and
- // another file name was copied to aNextFileName
- // else returns false
- // on success the function returns the complete
- // file name including drive letter and path
- // pos is an in-out parameter and receives the next
- // position when there are further file names or
- // 0 if there aren't
- sal_Bool SAL_CALL getNextFileName(
- /*in|out*/ POSITION& pos, rtl::OUString& aNextFileName );
+ bool SAL_CALL getMultiSelectionMode() const;
// shows the dialog, calls preModal before
// showing the dialog and postModal after
@@ -249,23 +210,23 @@ public:
// 0 - when the dialog was canceled by the user
// 1 - when the dialog was closed with ok
// -1 - when an error occured
- sal_Int16 SAL_CALL doModal( );
+ sal_Int16 SAL_CALL doModal();
// returns the last dialog error that occured
- sal_uInt32 SAL_CALL getLastDialogError( ) const;
+ sal_uInt32 SAL_CALL getLastDialogError() const;
// retrievs the currently selected file
// including path and drive information
// can be called only if the dialog is
// already displayed
- rtl::OUString SAL_CALL getCurrentFilePath( ) const;
+ rtl::OUString SAL_CALL getCurrentFilePath() const;
// retrievs the currently selected folder
- rtl::OUString SAL_CALL getCurrentFolderPath( ) const;
+ rtl::OUString SAL_CALL getCurrentFolderPath() const;
// retrievs the currently selected file name
// without drive and path
- rtl::OUString SAL_CALL getCurrentFileName( ) const;
+ rtl::OUString SAL_CALL getCurrentFileName() const;
protected:
// have to be overwritten when subclasses
@@ -275,34 +236,34 @@ protected:
// if preModal return true processing will
// continue else doModal exit without showing
// a dialog and returns -1
- virtual sal_Bool SAL_CALL preModal( );
+ virtual bool SAL_CALL preModal();
// post modal processing
// the function should accept only values returned from
// doModal and act appropriately
- virtual void SAL_CALL postModal( sal_Int16 nDialogResult );
+ virtual void SAL_CALL postModal(sal_Int16 nDialogResult);
// message handler, to be overwritten by subclasses
- virtual sal_uInt32 SAL_CALL onShareViolation( const rtl::OUString& aPathName );
+ virtual sal_uInt32 SAL_CALL onShareViolation(const rtl::OUString& aPathName);
virtual sal_uInt32 SAL_CALL onFileOk();
- virtual void SAL_CALL onSelChanged( HWND hwndListBox );
- virtual void SAL_CALL onHelp( );
+ virtual void SAL_CALL onSelChanged(HWND hwndListBox);
+ virtual void SAL_CALL onHelp();
// only called back if OFN_EXPLORER is set
virtual void SAL_CALL onInitDone();
virtual void SAL_CALL onFolderChanged();
- virtual void SAL_CALL onTypeChanged( sal_uInt32 nFilterIndex );
+ virtual void SAL_CALL onTypeChanged(sal_uInt32 nFilterIndex);
// call base class method first when overloading
- virtual void SAL_CALL onInitDialog( HWND hwndDlg, HWND hwndChild );
+ virtual void SAL_CALL onInitDialog(HWND hwndDlg, HWND hwndChild);
- virtual sal_uInt32 SAL_CALL onCtrlCommand( HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode );
+ virtual sal_uInt32 SAL_CALL onCtrlCommand(HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode);
- sal_uInt32 SAL_CALL onWMNotify( HWND hwndChild, LPOFNOTIFYW lpOfNotify );
+ sal_uInt32 SAL_CALL onWMNotify(HWND hwndChild, LPOFNOTIFYW lpOfNotify);
// we use non-virtual functions to do necessary work before
// calling the virtual funtions (see Gamma: Template method)
- void SAL_CALL handleInitDialog( HWND hwndDlg, HWND hwndChild );
+ void SAL_CALL handleInitDialog(HWND hwndDlg, HWND hwndChild);
protected:
@@ -319,23 +280,23 @@ protected:
// we connect the instance with the dialog window using
// SetProp, with this function we can reconnect from
// callback functions to this instance
- static CFileOpenDialog* SAL_CALL getCurrentInstance( HWND hwnd );
+ static CFileOpenDialog* SAL_CALL getCurrentInstance(HWND hwnd);
- void SAL_CALL centerPositionToParent( ) const;
+ void SAL_CALL centerPositionToParent() const;
private:
// FileOpen or FileSaveDialog
- BOOL m_bFileOpenDialog;
+ bool m_bFileOpenDialog;
rtl::OUString m_dialogTitle;
rtl::OUString m_displayDirectory;
rtl::OUString m_defaultExtension;
- CAutoUnicodeBuffer m_filterBuffer;
- CAutoUnicodeBuffer m_fileNameBuffer;
- CAutoUnicodeBuffer m_fileTitleBuffer;
- CAutoUnicodeBuffer m_helperBuffer;
+ mutable rtl::OUStringBuffer m_filterBuffer;
+ mutable rtl::OUStringBuffer m_fileTitleBuffer;
+ mutable rtl::OUStringBuffer m_helperBuffer;
+ mutable rtl::OUStringBuffer m_fileNameBuffer;
- ::std::auto_ptr< CGetFileNameWrapper > m_GetFileNameWrapper;
+ CGetFileNameWrapper m_GetFileNameWrapper;
DLGPROC m_pfnBaseDlgProc;
@@ -355,10 +316,9 @@ private:
HWND hWnd, WORD wMessage, WPARAM wParam, LPARAM lParam );
private:
-
// avoid copy and assignment
- CFileOpenDialog( const CFileOpenDialog& );
- CFileOpenDialog& operator=( const CFileOpenDialog& );
+ CFileOpenDialog(const CFileOpenDialog&);
+ CFileOpenDialog& operator=(const CFileOpenDialog&);
};
#endif
diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx
index 89d28c090772..e2baed55e1d5 100644
--- a/fpicker/source/win32/filepicker/FilePicker.cxx
+++ b/fpicker/source/win32/filepicker/FilePicker.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FilePicker.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: tra $ $Date: 2002-03-21 08:20:57 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,6 +79,10 @@
#include "filepicker.hxx"
#endif
+#ifndef _WINFILEOPENIMPL_HXX_
+#include "WinFileOpenImpl.hxx"
+#endif
+
#include "FPServiceInfo.hxx"
#include "..\misc\WinImplHelper.hxx"
@@ -94,31 +98,11 @@
// namespace directives
//------------------------------------------------------------------------
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::lang::IllegalArgumentException;
-using ::com::sun::star::lang::XEventListener;
-using ::com::sun::star::lang::XServiceInfo;
-using ::com::sun::star::lang::DisposedException;
-using ::com::sun::star::lang::XInitialization;
-using ::com::sun::star::lang::EventObject;
-using ::com::sun::star::util::XCancellable;
-
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Sequence;
+using namespace com::sun::star;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
-using ::cppu::WeakComponentImplHelper9;
-using ::rtl::OUString;
-using ::osl::MutexGuard;
-
-using ::com::sun::star::beans::StringPair;
-
//------------------------------------------------------------------------
// defines
//------------------------------------------------------------------------
@@ -131,11 +115,11 @@ using ::com::sun::star::beans::StringPair;
namespace
{
- Sequence< OUString > SAL_CALL FilePicker_getSupportedServiceNames()
+ uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames()
{
- Sequence< OUString > aRet(2);
- aRet[0] = OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker");
- aRet[1] = OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker");
+ uno::Sequence<rtl::OUString> aRet(2);
+ aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker");
+ aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker");
return aRet;
}
}
@@ -144,17 +128,18 @@ namespace
//
//-----------------------------------------------------------------------------------------
-CFilePicker::CFilePicker( const Reference< XMultiServiceFactory >& xServiceMgr ) :
- WeakComponentImplHelper9<
+CFilePicker::CFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) :
+ cppu::WeakComponentImplHelper9<
XFilterManager,
XFilterGroupManager,
XFilePickerControlAccess,
XFilePickerNotifier,
XFilePreview,
- XInitialization,
- XCancellable,
- XEventListener,
- XServiceInfo >( m_rbHelperMtx ),
+ lang::XInitialization,
+ util::XCancellable,
+ lang::XEventListener,
+ lang::XServiceInfo>(m_rbHelperMtx),
+ m_xServiceMgr(xServiceMgr),
m_aAsyncEventNotifier(rBHelper)
{
HINSTANCE hInstance = GetModuleHandleA( FILE_PICKER_DLL_NAME );
@@ -174,12 +159,12 @@ CFilePicker::CFilePicker( const Reference< XMultiServiceFactory >& xServiceMgr )
// XFPEventListenerManager
//------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::addFilePickerListener( const Reference< XFilePickerListener >& xListener )
- throw( RuntimeException )
+void SAL_CALL CFilePicker::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener)
+ throw(uno::RuntimeException)
{
if ( rBHelper.bDisposed )
- throw DisposedException(
- OUString::createFromAscii( "object is already disposed" ),
+ throw lang::DisposedException(
+ rtl::OUString::createFromAscii( "object is already disposed" ),
static_cast< XFilePicker* >( this ) );
if ( !rBHelper.bInDispose && !rBHelper.bDisposed )
@@ -190,12 +175,12 @@ void SAL_CALL CFilePicker::addFilePickerListener( const Reference< XFilePickerLi
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::removeFilePickerListener( const Reference< XFilePickerListener >& xListener )
- throw( RuntimeException )
+void SAL_CALL CFilePicker::removeFilePickerListener(const uno::Reference<XFilePickerListener>& xListener )
+ throw(uno::RuntimeException)
{
if ( rBHelper.bDisposed )
- throw DisposedException(
- OUString::createFromAscii( "object is already disposed" ),
+ throw lang::DisposedException(
+ rtl::OUString::createFromAscii( "object is already disposed" ),
static_cast< XFilePicker* >( this ) );
rBHelper.aLC.removeInterface( getCppuType( &xListener ), xListener );
@@ -205,9 +190,9 @@ void SAL_CALL CFilePicker::removeFilePickerListener( const Reference< XFilePicke
// XEventListener
// -------------------------------------------------
-void SAL_CALL CFilePicker::disposing( const EventObject& aEvent ) throw(RuntimeException)
+void SAL_CALL CFilePicker::disposing(const lang::EventObject& aEvent) throw(uno::RuntimeException)
{
- Reference< XFilePickerListener > xFilePickerListener( aEvent.Source, ::com::sun::star::uno::UNO_QUERY );
+ uno::Reference<XFilePickerListener> xFilePickerListener(aEvent.Source, ::com::sun::star::uno::UNO_QUERY);
if (xFilePickerListener.is())
removeFilePickerListener(xFilePickerListener);
@@ -217,9 +202,9 @@ void SAL_CALL CFilePicker::disposing( const EventObject& aEvent ) throw(RuntimeE
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::fileSelectionChanged( FilePickerEvent aEvent )
+void SAL_CALL CFilePicker::fileSelectionChanged(FilePickerEvent aEvent)
{
- aEvent.Source = Reference<XInterface>(static_cast<XFilePickerNotifier*>(this));
+ aEvent.Source = uno::Reference<uno::XInterface>(static_cast<XFilePickerNotifier*>(this));
m_aAsyncEventNotifier.notifyEvent(
new CFilePickerParamEventNotification(&XFilePickerListener::fileSelectionChanged,aEvent));
}
@@ -228,9 +213,9 @@ void SAL_CALL CFilePicker::fileSelectionChanged( FilePickerEvent aEvent )
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::directoryChanged( FilePickerEvent aEvent )
+void SAL_CALL CFilePicker::directoryChanged(FilePickerEvent aEvent)
{
- aEvent.Source = Reference<XInterface>(static_cast<XFilePickerNotifier*>(this));
+ aEvent.Source = uno::Reference<uno::XInterface>(static_cast<XFilePickerNotifier*>(this));
m_aAsyncEventNotifier.notifyEvent(
new CFilePickerParamEventNotification(&XFilePickerListener::directoryChanged,aEvent));
}
@@ -239,9 +224,9 @@ void SAL_CALL CFilePicker::directoryChanged( FilePickerEvent aEvent )
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::controlStateChanged( FilePickerEvent aEvent )
+void SAL_CALL CFilePicker::controlStateChanged(FilePickerEvent aEvent)
{
- aEvent.Source = Reference<XInterface>(static_cast<XFilePickerNotifier*>(this));
+ aEvent.Source = uno::Reference<uno::XInterface>(static_cast<XFilePickerNotifier*>(this));
m_aAsyncEventNotifier.notifyEvent(
new CFilePickerParamEventNotification(&XFilePickerListener::controlStateChanged,aEvent));
}
@@ -250,7 +235,7 @@ void SAL_CALL CFilePicker::controlStateChanged( FilePickerEvent aEvent )
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::dialogSizeChanged( )
+void SAL_CALL CFilePicker::dialogSizeChanged()
{
m_aAsyncEventNotifier.notifyEvent(
new CFilePickerEventNotification(&XFilePickerListener::dialogSizeChanged));
@@ -260,51 +245,41 @@ void SAL_CALL CFilePicker::dialogSizeChanged( )
// If there are more then one listener the return value of the last one wins
//-----------------------------------------------------------------------------------------
-OUString SAL_CALL CFilePicker::helpRequested( FilePickerEvent aEvent ) const
+rtl::OUString SAL_CALL CFilePicker::helpRequested(FilePickerEvent aEvent) const
{
- OUString aHelpText;
+ rtl::OUString aHelpText;
- if ( !rBHelper.bDisposed )
+ ::cppu::OInterfaceContainerHelper* pICHelper =
+ rBHelper.getContainer( getCppuType((uno::Reference<XFilePickerListener>*)0));
+
+ if (pICHelper)
{
- ::osl::ClearableMutexGuard aGuard( rBHelper.rMutex );
+ ::cppu::OInterfaceIteratorHelper iter(*pICHelper);
- if ( !rBHelper.bDisposed )
+ while(iter.hasMoreElements())
{
- aGuard.clear( );
-
- ::cppu::OInterfaceContainerHelper* pICHelper =
- rBHelper.getContainer( getCppuType((Reference<XFilePickerListener>*)0));
-
- if ( pICHelper )
+ try
{
- ::cppu::OInterfaceIteratorHelper iter(*pICHelper);
+ /*
+ if there are multiple listeners responding
+ to this notification the next response
+ overwrittes the one before if it is not empty
+ */
+
+ rtl::OUString temp;
- while(iter.hasMoreElements())
+ uno::Reference<XFilePickerListener> xFPListener(iter.next(), uno::UNO_QUERY);
+ if (xFPListener.is())
{
- try
- {
- /*
- if there are multiple listeners responding
- to this notification the next response
- overwrittes the one before if it is not empty
- */
-
- OUString temp;
-
- Reference< XFilePickerListener > xFPListener( iter.next( ), ::com::sun::star::uno::UNO_QUERY );
- if ( xFPListener.is( ) )
- {
- temp = xFPListener->helpRequested( aEvent );
- if ( temp.getLength( ) )
- aHelpText = temp;
- }
-
- }
- catch( RuntimeException& )
- {
- OSL_ENSURE( false, "RuntimeException during event dispatching" );
- }
+ temp = xFPListener->helpRequested(aEvent);
+ if (temp.getLength())
+ aHelpText = temp;
}
+
+ }
+ catch(uno::RuntimeException&)
+ {
+ OSL_ENSURE( false, "RuntimeException during event dispatching" );
}
}
}
@@ -316,122 +291,122 @@ OUString SAL_CALL CFilePicker::helpRequested( FilePickerEvent aEvent ) const
// XFilePicker functions
//------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw(RuntimeException)
+void SAL_CALL CFilePicker::setMultiSelectionMode(sal_Bool bMode) throw(uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- m_pImpl->setMultiSelectionMode( bMode );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->setMultiSelectionMode(bMode);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::setTitle( const OUString& aTitle ) throw(RuntimeException)
+void SAL_CALL CFilePicker::setTitle(const rtl::OUString& aTitle) throw(uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- m_pImpl->setTitle( aTitle );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->setTitle(aTitle);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::appendFilter( const OUString& aTitle, const OUString& aFilter )
- throw(IllegalArgumentException, RuntimeException)
+void SAL_CALL CFilePicker::appendFilter(const rtl::OUString& aTitle, const rtl::OUString& aFilter)
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- m_pImpl->appendFilter( aTitle, aFilter );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->appendFilter(aTitle, aFilter);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::setCurrentFilter( const OUString& aTitle )
- throw(IllegalArgumentException, RuntimeException)
+void SAL_CALL CFilePicker::setCurrentFilter(const rtl::OUString& aTitle)
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- m_pImpl->setCurrentFilter( aTitle );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->setCurrentFilter(aTitle);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-OUString SAL_CALL CFilePicker::getCurrentFilter( ) throw(RuntimeException)
+rtl::OUString SAL_CALL CFilePicker::getCurrentFilter() throw(uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getCurrentFilter( );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getCurrentFilter();
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::appendFilterGroup( const OUString& sGroupTitle, const Sequence< StringPair >& aFilters )
- throw (IllegalArgumentException, RuntimeException)
+void SAL_CALL CFilePicker::appendFilterGroup(const rtl::OUString& sGroupTitle, const uno::Sequence<beans::StringPair>& aFilters)
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- m_pImpl->appendFilterGroup( sGroupTitle, aFilters );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->appendFilterGroup(sGroupTitle, aFilters);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::setDefaultName( const OUString& aName )
- throw(IllegalArgumentException, RuntimeException)
+void SAL_CALL CFilePicker::setDefaultName(const rtl::OUString& aName)
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- m_pImpl->setDefaultName( aName );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->setDefaultName(aName);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::setDisplayDirectory( const OUString& aDirectory )
- throw(IllegalArgumentException, RuntimeException)
+void SAL_CALL CFilePicker::setDisplayDirectory(const rtl::OUString& aDirectory)
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- m_pImpl->setDisplayDirectory( aDirectory );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->setDisplayDirectory(aDirectory);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-OUString SAL_CALL CFilePicker::getDisplayDirectory( ) throw(RuntimeException)
+rtl::OUString SAL_CALL CFilePicker::getDisplayDirectory() throw(uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getDisplayDirectory( );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getDisplayDirectory();
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-Sequence< OUString > SAL_CALL CFilePicker::getFiles( ) throw(RuntimeException)
+uno::Sequence<rtl::OUString> SAL_CALL CFilePicker::getFiles() throw(uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getFiles( );
+ OSL_ASSERT(0 != m_pImpl.get());
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getFiles();
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-sal_Int16 SAL_CALL CFilePicker::execute( ) throw(RuntimeException)
+sal_Int16 SAL_CALL CFilePicker::execute() throw(uno::RuntimeException)
{
OSL_ASSERT(0 != m_pImpl.get());
@@ -451,8 +426,8 @@ sal_Int16 SAL_CALL CFilePicker::execute( ) throw(RuntimeException)
{
OSL_ENSURE(sal_False, "Could not start event notifier thread!");
- throw RuntimeException(
- OUString::createFromAscii("Error executing dialog"),
+ throw uno::RuntimeException(
+ rtl::OUString::createFromAscii("Error executing dialog"),
static_cast<XFilePicker*>(this));
}
@@ -463,38 +438,38 @@ sal_Int16 SAL_CALL CFilePicker::execute( ) throw(RuntimeException)
// XFilePicker functions
//------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const Any& aValue )
- throw(RuntimeException)
+void SAL_CALL CFilePicker::setValue(sal_Int16 aControlId, sal_Int16 aControlAction, const uno::Any& aValue)
+ throw(uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- m_pImpl->setValue( aControlId, aControlAction, aValue );
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->setValue(aControlId, aControlAction, aValue);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-Any SAL_CALL CFilePicker::getValue( sal_Int16 aControlId, sal_Int16 aControlAction )
- throw(RuntimeException)
+uno::Any SAL_CALL CFilePicker::getValue(sal_Int16 aControlId, sal_Int16 aControlAction)
+ throw(uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getValue( aControlId, aControlAction );
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getValue(aControlId, aControlAction);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::enableControl( sal_Int16 aControlId, sal_Bool bEnable )
- throw(RuntimeException)
+void SAL_CALL CFilePicker::enableControl(sal_Int16 aControlId, sal_Bool bEnable)
+throw(uno::RuntimeException)
{
OSL_ASSERT( 0 != m_pImpl.get( ) );
- MutexGuard aGuard( m_aMutex );
+ osl::MutexGuard aGuard( m_aMutex );
m_pImpl->enableControl( aControlId, bEnable );
}
@@ -502,136 +477,134 @@ void SAL_CALL CFilePicker::enableControl( sal_Int16 aControlId, sal_Bool bEnable
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel )
- throw (RuntimeException)
+void SAL_CALL CFilePicker::setLabel(sal_Int16 aControlId, const ::rtl::OUString& aLabel)
+ throw (uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- m_pImpl->setLabel( aControlId, aLabel );
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->setLabel(aControlId, aLabel);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-OUString SAL_CALL CFilePicker::getLabel( sal_Int16 aControlId )
- throw (RuntimeException)
+rtl::OUString SAL_CALL CFilePicker::getLabel(sal_Int16 aControlId)
+ throw (uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getLabel( aControlId );
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getLabel(aControlId);
}
//------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------
-Sequence< sal_Int16 > SAL_CALL CFilePicker::getSupportedImageFormats( ) throw (RuntimeException)
+uno::Sequence<sal_Int16> SAL_CALL CFilePicker::getSupportedImageFormats() throw (uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getSupportedImageFormats( );
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getSupportedImageFormats();
}
//------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------
-sal_Int32 SAL_CALL CFilePicker::getTargetColorDepth( ) throw (RuntimeException)
+sal_Int32 SAL_CALL CFilePicker::getTargetColorDepth() throw (uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getTargetColorDepth( );
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getTargetColorDepth();
}
//------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------
-sal_Int32 SAL_CALL CFilePicker::getAvailableWidth( ) throw (RuntimeException)
+sal_Int32 SAL_CALL CFilePicker::getAvailableWidth() throw (uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getAvailableWidth( );
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getAvailableWidth();
}
//------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------
-sal_Int32 SAL_CALL CFilePicker::getAvailableHeight( ) throw (RuntimeException)
+sal_Int32 SAL_CALL CFilePicker::getAvailableHeight() throw (uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getAvailableHeight( );
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getAvailableHeight();
}
//------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::setImage( sal_Int16 aImageFormat, const Any& aImage )
- throw (IllegalArgumentException, RuntimeException)
+void SAL_CALL CFilePicker::setImage(sal_Int16 aImageFormat, const uno::Any& aImage)
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- m_pImpl->setImage( aImageFormat, aImage );
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->setImage(aImageFormat, aImage);
}
//------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------
-sal_Bool SAL_CALL CFilePicker::setShowState( sal_Bool bShowState ) throw (RuntimeException)
+sal_Bool SAL_CALL CFilePicker::setShowState(sal_Bool bShowState) throw (uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->setShowState( bShowState );
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->setShowState(bShowState);
}
//------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------
-sal_Bool SAL_CALL CFilePicker::getShowState( ) throw (RuntimeException)
+sal_Bool SAL_CALL CFilePicker::getShowState() throw (uno::RuntimeException)
{
- OSL_ASSERT( 0 != m_pImpl.get( ) );
+ OSL_ASSERT(0 != m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- return m_pImpl->getShowState( );
+ osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->getShowState();
}
//------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::initialize( const Sequence< Any >& aArguments )
- throw( Exception, RuntimeException)
+void SAL_CALL CFilePicker::initialize(const uno::Sequence<uno::Any>& aArguments)
+ throw( uno::Exception, uno::RuntimeException)
{
// parameter checking
- Any aAny;
+ uno::Any aAny;
if ( 0 == aArguments.getLength( ) )
- throw IllegalArgumentException(
- OUString::createFromAscii( "no arguments" ),
- static_cast< XFilePicker* >( this ),
- 1 );
+ throw lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii( "no arguments" ),
+ static_cast<XFilePicker*>(this), 1);
aAny = aArguments[0];
if ( (aAny.getValueType() != ::getCppuType((sal_Int16*)0)) &&
(aAny.getValueType() != ::getCppuType((sal_Int8*)0)) )
- throw IllegalArgumentException(
- OUString::createFromAscii( "invalid argument type" ),
- static_cast< XFilePicker* >( this ),
- 1 );
+ throw lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii("invalid argument type"),
+ static_cast<XFilePicker*>(this), 1);
sal_Int16 templateId = -1;
aAny >>= templateId;
@@ -719,8 +692,8 @@ void SAL_CALL CFilePicker::initialize( const Sequence< Any >& aArguments )
break;
default:
- throw IllegalArgumentException(
- OUString::createFromAscii( "Unknown template" ),
+ throw lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii( "Unknown template" ),
static_cast< XFilePicker* >( this ),
1 );
}
@@ -744,34 +717,34 @@ void SAL_CALL CFilePicker::initialize( const Sequence< Any >& aArguments )
//
//------------------------------------------------------------------------------------
-void SAL_CALL CFilePicker::cancel( )
+void SAL_CALL CFilePicker::cancel()
{
- OSL_ASSERT( m_pImpl.get( ) );
+ OSL_ASSERT(m_pImpl.get());
- MutexGuard aGuard( m_aMutex );
- m_pImpl->cancel( );
+ osl::MutexGuard aGuard(m_aMutex);
+ m_pImpl->cancel();
}
// -------------------------------------------------
// XServiceInfo
// -------------------------------------------------
-OUString SAL_CALL CFilePicker::getImplementationName( )
- throw( RuntimeException )
+rtl::OUString SAL_CALL CFilePicker::getImplementationName()
+ throw(uno::RuntimeException)
{
- return OUString::createFromAscii( FILE_PICKER_IMPL_NAME );
+ return rtl::OUString::createFromAscii(FILE_PICKER_IMPL_NAME);
}
// -------------------------------------------------
// XServiceInfo
// -------------------------------------------------
-sal_Bool SAL_CALL CFilePicker::supportsService( const OUString& ServiceName )
- throw( RuntimeException )
+sal_Bool SAL_CALL CFilePicker::supportsService(const rtl::OUString& ServiceName)
+ throw(uno::RuntimeException )
{
- Sequence < OUString > SupportedServicesNames = FilePicker_getSupportedServiceNames();
+ uno::Sequence <rtl::OUString> SupportedServicesNames = FilePicker_getSupportedServiceNames();
- for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
+ for (sal_Int32 n = SupportedServicesNames.getLength(); n--;)
if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
return sal_True;
@@ -782,8 +755,8 @@ sal_Bool SAL_CALL CFilePicker::supportsService( const OUString& ServiceName )
// XServiceInfo
// -------------------------------------------------
-Sequence< OUString > SAL_CALL CFilePicker::getSupportedServiceNames( )
- throw( RuntimeException )
+uno::Sequence<rtl::OUString> SAL_CALL CFilePicker::getSupportedServiceNames()
+ throw(uno::RuntimeException)
{
return FilePicker_getSupportedServiceNames();
} \ No newline at end of file
diff --git a/fpicker/source/win32/filepicker/FilePicker.hxx b/fpicker/source/win32/filepicker/FilePicker.hxx
index 94f76928bab5..3a82db79c262 100644
--- a/fpicker/source/win32/filepicker/FilePicker.hxx
+++ b/fpicker/source/win32/filepicker/FilePicker.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FilePicker.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: tra $ $Date: 2002-03-21 07:33:32 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,10 +107,6 @@
#include <com/sun/star/util/XCancellable.hpp>
#endif
-#ifndef _WINFILEOPENIMPL_HXX_
-#include "WinFileOpenImpl.hxx"
-#endif
-
#ifndef _ASYNCEVENTNOTIFIER_HXX_
#include "asynceventnotifier.hxx"
#endif
@@ -129,8 +125,7 @@
// forward declarations
//----------------------------------------------------------
-//class OFPImplBase;
-class CFPImplFactory;
+class CWinFileOpenImpl;
//----------------------------------------------------------
// class declaration
@@ -305,9 +300,9 @@ private:
CFilePicker& operator=( const CFilePicker& );
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; // to instanciate own services
- std::auto_ptr< CWinFileOpenImpl > m_pImpl;
- CAsyncEventNotifier m_aAsyncEventNotifier;
+ ::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> m_xServiceMgr; // to instanciate own services
+ CAsyncEventNotifier m_aAsyncEventNotifier;
+ std::auto_ptr<CWinFileOpenImpl> m_pImpl;
};
#endif
diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
index 0d59f35ad1b9..15a1c66cb41d 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.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: tra $ $Date: 2002-03-27 10:35:59 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -138,20 +138,11 @@
// namespace directives
//------------------------------------------------------------------------
-using namespace std;
-using rtl::OUString;
-using rtl::OUStringBuffer;
+using namespace com::sun::star;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::ui::dialogs::FilePickerEvent;
-using ::com::sun::star::lang::IllegalArgumentException;
-using ::com::sun::star::ui::dialogs::XFilePicker;
-
-using ::com::sun::star::beans::StringPair;
+using com::sun::star::ui::dialogs::FilePickerEvent;
+using com::sun::star::lang::IllegalArgumentException;
+using com::sun::star::ui::dialogs::XFilePicker;
using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
@@ -182,9 +173,9 @@ struct EnumParam
//
//-------------------------------------------------------------------------
-const OUString BACKSLASH = OUString::createFromAscii( "\\" );
-const OUString FILTER_SEPARATOR = OUString::createFromAscii( "------------------------------------------" );
-const OUString ALL_FILES_WILDCARD = OUString::createFromAscii( "*.*" );
+const rtl::OUString BACKSLASH = rtl::OUString::createFromAscii( "\\" );
+const rtl::OUString FILTER_SEPARATOR = rtl::OUString::createFromAscii( "------------------------------------------" );
+const rtl::OUString ALL_FILES_WILDCARD = rtl::OUString::createFromAscii( "*.*" );
const sal_Bool ALLOW_DUPLICATES = sal_True;
//-------------------------------------------------------------------------
@@ -225,16 +216,16 @@ CWinFileOpenImpl::~CWinFileOpenImpl()
// we expect the directory in URL format
//------------------------------------------------------------------------
-void CWinFileOpenImpl::setDisplayDirectory( const OUString& aDirectory )
- throw( IllegalArgumentException, RuntimeException )
+void CWinFileOpenImpl::setDisplayDirectory(const rtl::OUString& aDirectory)
+ throw( IllegalArgumentException, uno::RuntimeException )
{
- OUString aSysDirectory;
- if( aDirectory.getLength( ) > 0 )
+ rtl::OUString aSysDirectory;
+ if( aDirectory.getLength() > 0)
{
if ( ::osl::FileBase::E_None !=
::osl::FileBase::getSystemPathFromFileURL(aDirectory,aSysDirectory))
throw IllegalArgumentException(
- OUString::createFromAscii("Invalid directory"),
+ rtl::OUString::createFromAscii("Invalid directory"),
static_cast<XFilePicker*>(m_FilePicker), 1);
// we ensure that there is a trailing '/' at the end of
@@ -255,17 +246,17 @@ void CWinFileOpenImpl::setDisplayDirectory( const OUString& aDirectory )
// we return the directory in URL format
//------------------------------------------------------------------------
-OUString CWinFileOpenImpl::getDisplayDirectory( ) throw( RuntimeException )
+rtl::OUString CWinFileOpenImpl::getDisplayDirectory() throw(uno::RuntimeException)
{
- return m_FilePickerState->getDisplayDirectory( this );
+ return m_FilePickerState->getDisplayDirectory(this);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CWinFileOpenImpl::setDefaultName( const OUString& aName )
- throw( IllegalArgumentException, RuntimeException )
+void SAL_CALL CWinFileOpenImpl::setDefaultName(const rtl::OUString& aName)
+ throw( IllegalArgumentException, uno::RuntimeException )
{
// we don't set the default name directly
// because this influences how the file open
@@ -285,27 +276,28 @@ void SAL_CALL CWinFileOpenImpl::setDefaultName( const OUString& aName )
// the first entry is the path url, all other entries are file names
//-----------------------------------------------------------------------------------------
-Sequence< OUString > SAL_CALL CWinFileOpenImpl::getFiles( ) throw(RuntimeException)
+uno::Sequence<rtl::OUString> SAL_CALL CWinFileOpenImpl::getFiles()
+ throw(uno::RuntimeException)
{
- return m_FilePickerState->getFiles( this );
+ return m_FilePickerState->getFiles(this);
}
//-----------------------------------------------------------------------------------------
// shows the FileOpen/FileSave dialog
//-----------------------------------------------------------------------------------------
-sal_Int16 SAL_CALL CWinFileOpenImpl::execute( ) throw(RuntimeException)
+sal_Int16 SAL_CALL CWinFileOpenImpl::execute( ) throw(uno::RuntimeException)
{
sal_Int16 rc = CFileOpenDialog::doModal();
- if ( 1 == rc )
+ if (1 == rc)
rc = ::com::sun::star::ui::dialogs::ExecutableDialogResults::OK;
- else if ( 0 == rc )
+ else if (0 == rc)
rc = ::com::sun::star::ui::dialogs::ExecutableDialogResults::CANCEL;
else
- throw RuntimeException(
- OUString::createFromAscii( "Error executing dialog" ),
- static_cast< XFilePicker* >( m_FilePicker ) );
+ throw uno::RuntimeException(
+ rtl::OUString::createFromAscii("Error executing dialog"),
+ static_cast<XFilePicker*>(m_FilePicker));
return rc;
}
@@ -316,16 +308,15 @@ sal_Int16 SAL_CALL CWinFileOpenImpl::execute( ) throw(RuntimeException)
// empty
//-----------------------------------------------------------------------------------------
-void SAL_CALL CWinFileOpenImpl::appendFilter( const OUString& aTitle, const OUString& aFilter )
- throw(IllegalArgumentException, RuntimeException)
+void SAL_CALL CWinFileOpenImpl::appendFilter(const rtl::OUString& aTitle, const rtl::OUString& aFilter)
+ throw(IllegalArgumentException, uno::RuntimeException)
{
- sal_Bool bRet = m_filterContainer->addFilter( aTitle, aFilter );
+ sal_Bool bRet = m_filterContainer->addFilter(aTitle, aFilter);
- if ( !bRet )
+ if (!bRet)
throw IllegalArgumentException(
- OUString::createFromAscii("filter already exists"),
- static_cast< XFilePicker* >( m_FilePicker ),
- 1 );
+ rtl::OUString::createFromAscii("filter already exists"),
+ static_cast<XFilePicker*>(m_FilePicker), 1);
// #95345# see MSDN OPENFILENAME
// If nFilterIndex is zero and lpstrCustomFilter is NULL,
@@ -334,43 +325,42 @@ void SAL_CALL CWinFileOpenImpl::appendFilter( const OUString& aTitle, const OUSt
// to getSelectedFilterIndex without explicitly calling
// setFilterIndex before does not return 0 which leads to a
// false state
- if ( 0 == getSelectedFilterIndex() )
- CFileOpenDialog::setFilterIndex( 1 );
+ if (0 == getSelectedFilterIndex())
+ CFileOpenDialog::setFilterIndex(1);
}
//-----------------------------------------------------------------------------------------
// sets a current filter
//-----------------------------------------------------------------------------------------
-void SAL_CALL CWinFileOpenImpl::setCurrentFilter( const OUString& aTitle )
- throw( IllegalArgumentException, RuntimeException)
+void SAL_CALL CWinFileOpenImpl::setCurrentFilter(const rtl::OUString& aTitle)
+ throw( IllegalArgumentException, uno::RuntimeException)
{
- sal_Int32 filterPos = m_filterContainer->getFilterPos( aTitle );
+ sal_Int32 filterPos = m_filterContainer->getFilterPos(aTitle);
- if ( filterPos < 0 )
+ if (filterPos < 0)
throw IllegalArgumentException(
- OUString::createFromAscii( "filter doesn't exist"),
- static_cast< XFilePicker* >( m_FilePicker ),
- 1 );
+ rtl::OUString::createFromAscii("filter doesn't exist"),
+ static_cast<XFilePicker*>(m_FilePicker), 1);
// filter index of the base class starts with 1
- CFileOpenDialog::setFilterIndex( filterPos + 1 );
+ CFileOpenDialog::setFilterIndex(filterPos + 1);
}
//-----------------------------------------------------------------------------------------
// returns the currently selected filter
//-----------------------------------------------------------------------------------------
-OUString SAL_CALL CWinFileOpenImpl::getCurrentFilter( ) throw(RuntimeException)
+rtl::OUString SAL_CALL CWinFileOpenImpl::getCurrentFilter() throw(uno::RuntimeException)
{
- sal_uInt32 nIndex = getSelectedFilterIndex( );
+ sal_uInt32 nIndex = getSelectedFilterIndex();
- OUString currentFilter;
- if ( nIndex > 0 )
+ rtl::OUString currentFilter;
+ if (nIndex > 0)
{
// filter index of the base class starts with 1
- sal_Bool bRet = m_filterContainer->getFilter( nIndex - 1, currentFilter );
- OSL_ASSERT( bRet );
+ sal_Bool bRet = m_filterContainer->getFilter(nIndex - 1, currentFilter);
+ OSL_ASSERT(bRet);
}
return currentFilter;
@@ -380,33 +370,33 @@ OUString SAL_CALL CWinFileOpenImpl::getCurrentFilter( ) throw(RuntimeException)
//
//-----------------------------------------------------------------------------------------
-inline void SAL_CALL CWinFileOpenImpl::appendFilterGroupSeparator( )
+inline void SAL_CALL CWinFileOpenImpl::appendFilterGroupSeparator()
{
- m_filterContainer->addFilter( FILTER_SEPARATOR, ALL_FILES_WILDCARD, ALLOW_DUPLICATES );
+ m_filterContainer->addFilter(FILTER_SEPARATOR, ALL_FILES_WILDCARD, ALLOW_DUPLICATES);
}
//-----------------------------------------------------------------------------------------
// XFilterGroupManager
//-----------------------------------------------------------------------------------------
-void SAL_CALL CWinFileOpenImpl::appendFilterGroup( const OUString& sGroupTitle, const Sequence< StringPair >& aFilters )
- throw (IllegalArgumentException, RuntimeException)
+void SAL_CALL CWinFileOpenImpl::appendFilterGroup(const rtl::OUString& sGroupTitle, const uno::Sequence<beans::StringPair>& aFilters)
+ throw (IllegalArgumentException, uno::RuntimeException)
{
- OSL_ENSURE( 0 == sGroupTitle.getLength( ), "appendFilterGroup: Parameter 'GroupTitle' currently ignored" );
+ OSL_ENSURE(0 == sGroupTitle.getLength(), "appendFilterGroup: Parameter 'GroupTitle' currently ignored");
- sal_Int32 nFilters = aFilters.getLength( );
+ sal_Int32 nFilters = aFilters.getLength();
- OSL_PRECOND( nFilters > 0, "Empty filter list" );
+ OSL_PRECOND(nFilters > 0, "Empty filter list");
- if ( nFilters > 0 )
+ if (nFilters > 0)
{
// append a separator before the next group if
// there is already a group of filters
- if ( m_filterContainer->numFilter( ) > 0 )
- appendFilterGroupSeparator( );
+ if (m_filterContainer->numFilter() > 0)
+ appendFilterGroupSeparator();
- for ( int i = 0; i < nFilters; i++ )
- appendFilter( aFilters[i].First, aFilters[i].Second );
+ for (int i = 0; i < nFilters; i++)
+ appendFilter(aFilters[i].First, aFilters[i].Second);
}
}
@@ -414,11 +404,11 @@ void SAL_CALL CWinFileOpenImpl::appendFilterGroup( const OUString& sGroupTitle,
// XExtendedFilePicker
//=================================================================================================================
-void SAL_CALL CWinFileOpenImpl::setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const Any& aValue )
- throw(RuntimeException)
+void SAL_CALL CWinFileOpenImpl::setValue(sal_Int16 aControlId, sal_Int16 aControlAction, const uno::Any& aValue)
+ throw(uno::RuntimeException)
{
- OSL_ASSERT( m_FilePickerState );
- m_FilePickerState->setValue( aControlId, aControlAction, aValue );
+ OSL_ASSERT(m_FilePickerState);
+ m_FilePickerState->setValue(aControlId, aControlAction, aValue);
}
//-----------------------------------------------------------------------------------------
@@ -426,50 +416,50 @@ void SAL_CALL CWinFileOpenImpl::setValue( sal_Int16 aControlId, sal_Int16 aContr
// we assume that there are only checkboxes or comboboxes
//-----------------------------------------------------------------------------------------
-Any SAL_CALL CWinFileOpenImpl::getValue( sal_Int16 aControlId, sal_Int16 aControlAction )
- throw(RuntimeException)
+uno::Any SAL_CALL CWinFileOpenImpl::getValue(sal_Int16 aControlId, sal_Int16 aControlAction)
+ throw(uno::RuntimeException)
{
- OSL_ASSERT( m_FilePickerState );
- return m_FilePickerState->getValue( aControlId, aControlAction );
+ OSL_ASSERT(m_FilePickerState);
+ return m_FilePickerState->getValue(aControlId, aControlAction);
}
//-----------------------------------------------------------------------------------------
// enables a custom template element
//-----------------------------------------------------------------------------------------
-void SAL_CALL CWinFileOpenImpl::enableControl( sal_Int16 ControlID, sal_Bool bEnable )
- throw(RuntimeException)
+void SAL_CALL CWinFileOpenImpl::enableControl(sal_Int16 ControlID, sal_Bool bEnable)
+ throw(uno::RuntimeException)
{
- OSL_ASSERT( m_FilePickerState );
- m_FilePickerState->enableControl( ControlID, bEnable );
+ OSL_ASSERT(m_FilePickerState);
+ m_FilePickerState->enableControl(ControlID, bEnable);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CWinFileOpenImpl::setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel )
- throw (RuntimeException)
+void SAL_CALL CWinFileOpenImpl::setLabel( sal_Int16 aControlId, const rtl::OUString& aLabel )
+ throw (uno::RuntimeException)
{
- m_FilePickerState->setLabel( aControlId, aLabel );
+ m_FilePickerState->setLabel(aControlId, aLabel);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-OUString SAL_CALL CWinFileOpenImpl::getLabel( sal_Int16 aControlId )
- throw (RuntimeException)
+rtl::OUString SAL_CALL CWinFileOpenImpl::getLabel( sal_Int16 aControlId )
+ throw (uno::RuntimeException)
{
- return m_FilePickerState->getLabel( aControlId );
+ return m_FilePickerState->getLabel(aControlId);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
-Sequence< sal_Int16 > SAL_CALL CWinFileOpenImpl::getSupportedImageFormats()
- throw (RuntimeException)
+uno::Sequence<sal_Int16> SAL_CALL CWinFileOpenImpl::getSupportedImageFormats()
+ throw (uno::RuntimeException)
{
return m_Preview->getSupportedImageFormats();
}
@@ -479,7 +469,7 @@ Sequence< sal_Int16 > SAL_CALL CWinFileOpenImpl::getSupportedImageFormats()
//-----------------------------------------------------------------------------------------
sal_Int32 SAL_CALL CWinFileOpenImpl::getTargetColorDepth()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
return m_Preview->getTargetColorDepth();
}
@@ -489,7 +479,7 @@ sal_Int32 SAL_CALL CWinFileOpenImpl::getTargetColorDepth()
//-----------------------------------------------------------------------------------------
sal_Int32 SAL_CALL CWinFileOpenImpl::getAvailableWidth()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
return m_Preview->getAvailableWidth();
}
@@ -499,7 +489,7 @@ sal_Int32 SAL_CALL CWinFileOpenImpl::getAvailableWidth()
//-----------------------------------------------------------------------------------------
sal_Int32 SAL_CALL CWinFileOpenImpl::getAvailableHeight()
- throw (::com::sun::star::uno::RuntimeException)
+ throw (uno::RuntimeException)
{
return m_Preview->getAvailableHeight();
}
@@ -508,8 +498,8 @@ sal_Int32 SAL_CALL CWinFileOpenImpl::getAvailableHeight()
//
//-----------------------------------------------------------------------------------------
-void SAL_CALL CWinFileOpenImpl::setImage(sal_Int16 aImageFormat, const Any& aImage)
- throw (IllegalArgumentException, RuntimeException)
+void SAL_CALL CWinFileOpenImpl::setImage(sal_Int16 aImageFormat, const uno::Any& aImage)
+ throw (IllegalArgumentException, uno::RuntimeException)
{
m_Preview->setImage(aImageFormat,aImage);
}
@@ -519,7 +509,7 @@ void SAL_CALL CWinFileOpenImpl::setImage(sal_Int16 aImageFormat, const Any& aIma
//-----------------------------------------------------------------------------------------
sal_Bool SAL_CALL CWinFileOpenImpl::setShowState(sal_Bool bShowState)
- throw (::com::sun::star::uno::RuntimeException)
+ throw (uno::RuntimeException)
{
return m_Preview->setShowState(bShowState);
}
@@ -529,7 +519,7 @@ sal_Bool SAL_CALL CWinFileOpenImpl::setShowState(sal_Bool bShowState)
//-----------------------------------------------------------------------------------------
sal_Bool SAL_CALL CWinFileOpenImpl::getShowState()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
return m_Preview->getShowState();
}
@@ -630,6 +620,16 @@ unsigned int CALLBACK CWinFileOpenImpl::SubClassFunc(
pImpl->onWMShow(hWnd,(BOOL)wParam,(int)lParam);
break;
+ case WM_NCDESTROY:
+ // restore the old window proc
+ SetWindowLong(hWnd, DWL_DLGPROC,
+ reinterpret_cast<DWORD>(pImpl->m_pfnOldDlgProc));
+
+ lResult = CallWindowProcA(
+ reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc),
+ hWnd,wMessage,wParam,lParam);
+ break;
+
default:
// !!! we use CallWindowProcA
lResult = CallWindowProcA(
@@ -646,7 +646,7 @@ unsigned int CALLBACK CWinFileOpenImpl::SubClassFunc(
//
//-----------------------------------------------------------------
-void SAL_CALL CWinFileOpenImpl::InitControlLabel( HWND hWnd )
+void SAL_CALL CWinFileOpenImpl::InitControlLabel(HWND hWnd)
{
CResourceProvider aResProvider;
@@ -655,9 +655,9 @@ void SAL_CALL CWinFileOpenImpl::InitControlLabel( HWND hWnd )
//-----------------------------------------
sal_Int16 aCtrlId = GetDlgCtrlID(hWnd);
- OUString aLabel = aResProvider.getResString(aCtrlId);
- if ( aLabel.getLength( ) )
- setLabel( aCtrlId, aLabel );
+ rtl::OUString aLabel = aResProvider.getResString(aCtrlId);
+ if (aLabel.getLength())
+ setLabel(aCtrlId, aLabel);
}
//-----------------------------------------------------------------
@@ -874,7 +874,7 @@ LRESULT SAL_CALL CWinFileOpenImpl::onWMShow(HWND hwnd, BOOL bShow, int fState)
LRESULT SAL_CALL CWinFileOpenImpl::onWMWindowPosChanged(HWND hwnd)
{
LONG wl = GetWindowLong(hwnd,GWL_STYLE);
- m_Preview->notifyParentWindowPosChanged(wl & WS_VISIBLE);
+ m_Preview->notifyParentWindowPosChanged((wl & WS_VISIBLE) > 0);
return 0;
}
@@ -887,7 +887,7 @@ LRESULT SAL_CALL CWinFileOpenImpl::onCustomControlHelpRequest(LPHELPINFO lphi)
FilePickerEvent evt;
evt.ElementId = lphi->iCtrlId;
- OUString aPopupHelpText = m_FilePicker->helpRequested(evt);
+ rtl::OUString aPopupHelpText = m_FilePicker->helpRequested(evt);
if (aPopupHelpText.getLength())
{
@@ -908,9 +908,8 @@ void SAL_CALL CWinFileOpenImpl::onInitDialog(HWND hwndDlg, HWND hwndChild)
{
// subclass the dialog window
m_pfnOldDlgProc =
- reinterpret_cast< DLGPROC >(
- SetWindowLong( hwndDlg,
- DWL_DLGPROC,
+ reinterpret_cast<DLGPROC>(
+ SetWindowLong( hwndDlg, DWL_DLGPROC,
reinterpret_cast<DWORD>(SubClassFunc)));
}
@@ -918,12 +917,12 @@ void SAL_CALL CWinFileOpenImpl::onInitDialog(HWND hwndDlg, HWND hwndChild)
// processing before showing the dialog
//-----------------------------------------------------------------------------------------
-sal_Bool SAL_CALL CWinFileOpenImpl::preModal( )
+bool SAL_CALL CWinFileOpenImpl::preModal()
{
CFileOpenDialog::setFilter(
makeWinFilterBuffer(*m_filterContainer.get()));
- return sal_True;
+ return true;
}
//-----------------------------------------------------------------------------------------
@@ -933,6 +932,12 @@ sal_Bool SAL_CALL CWinFileOpenImpl::preModal( )
void CWinFileOpenImpl::postModal(sal_Int16 nDialogResult)
{
CFileOpenDialog::postModal(nDialogResult);
+
+ // empty the container in order to get rid off
+ // invalid controls in case someone calls execute
+ // twice in sequence with the same instance
+ m_CustomControls->RemoveAllControls();
+
m_FilePickerState = m_NonExecuteFilePickerState;
}
@@ -956,14 +961,14 @@ void SAL_CALL CWinFileOpenImpl::SetDefaultExtension()
if ( hwndChkSaveWithExt )
{
- Any aAny = CheckboxGetState( hwndChkSaveWithExt );
+ uno::Any aAny = CheckboxGetState( hwndChkSaveWithExt );
sal_Bool bChecked = *reinterpret_cast< const sal_Bool* >( aAny.getValue( ) );
if ( bChecked )
{
sal_uInt32 nIndex = getSelectedFilterIndex( );
- OUString currentFilter;
+ rtl::OUString currentFilter;
if ( nIndex > 0 )
{
// filter index of the base class starts with 1
@@ -971,7 +976,7 @@ void SAL_CALL CWinFileOpenImpl::SetDefaultExtension()
if ( currentFilter.getLength( ) )
{
- OUString FilterExt;
+ rtl::OUString FilterExt;
m_filterContainer->getFilter( currentFilter, FilterExt );
sal_Int32 posOfPoint = FilterExt.indexOf( L'.' );
@@ -981,7 +986,7 @@ void SAL_CALL CWinFileOpenImpl::SetDefaultExtension()
if ( posOfSemiColon < 0 )
posOfSemiColon = FilterExt.getLength( ) - 1;
- FilterExt = OUString( pFirstExtStart, posOfSemiColon - posOfPoint );
+ FilterExt = rtl::OUString( pFirstExtStart, posOfSemiColon - posOfPoint );
if ( bIsWin9x )
{
diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx
index 7ea6247787e1..ce186eadfb9e 100644
--- a/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx
+++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WinFileOpenImpl.hxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: tra $ $Date: 2002-03-21 07:37:13 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -231,7 +231,7 @@ public:
protected:
sal_Int16 SAL_CALL getFocused( );
- virtual sal_Bool SAL_CALL preModal( );
+ virtual bool SAL_CALL preModal( );
virtual void SAL_CALL postModal( sal_Int16 nDialogResult );
virtual sal_uInt32 SAL_CALL onFileOk();
diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.cxx b/fpicker/source/win32/filepicker/asynceventnotifier.cxx
index 222e7cc689e4..763d5f4e5830 100644
--- a/fpicker/source/win32/filepicker/asynceventnotifier.cxx
+++ b/fpicker/source/win32/filepicker/asynceventnotifier.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: asynceventnotifier.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: tra $ $Date: 2002-03-21 07:35:14 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,25 +75,19 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#endif
-#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERNOTIFIER_HPP_
-#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
+#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERLISTENER_HPP_
+#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
#endif
#include <process.h>
-#include <windows.h>
#include <memory>
//------------------------------------------------
//
//------------------------------------------------
-using namespace osl;
-using namespace com::sun::star::uno;
-using ::com::sun::star::uno::Reference;
+using namespace com::sun::star;
using ::com::sun::star::ui::dialogs::XFilePickerListener;
-using ::com::sun::star::ui::dialogs::XFilePickerNotifier;
-using ::com::sun::star::ui::dialogs::FilePickerEvent;
-using ::cppu::OBroadcastHelper;
//------------------------------------------------
//
@@ -111,16 +105,25 @@ CAsyncEventNotifier::CAsyncEventNotifier(cppu::OBroadcastHelper& rBroadcastHelpe
//
//------------------------------------------------
+CAsyncEventNotifier::~CAsyncEventNotifier()
+{
+ OSL_ENSURE(0 == m_hThread,"Thread not stopped, destroying this instance leads to desaster");
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
bool SAL_CALL CAsyncEventNotifier::start()
{
- MutexGuard aGuard(m_Mutex);
+ osl::MutexGuard aGuard(m_Mutex);
// m_bRun may already be false because of a
// call to stop but the thread did not yet
// terminate so m_hEventNotifierThread is
// yet a valid thread handle that should
// not be overwritten
- if ( !m_bRun && 0==m_hThread )
+ if (!m_bRun)
{
m_hThread = (HANDLE)_beginthreadex(
NULL, 0, CAsyncEventNotifier::ThreadProc, this, 0, &m_ThreadId);
@@ -144,7 +147,7 @@ void SAL_CALL CAsyncEventNotifier::stop()
{
OSL_PRECOND(GetCurrentThreadId() != m_ThreadId, "Method called in wrong thread context!");
- ResettableMutexGuard aGuard(m_Mutex);
+ osl::ResettableMutexGuard aGuard(m_Mutex);
OSL_PRECOND(m_bRun,"Event notifier does not run!");
@@ -176,7 +179,7 @@ void SAL_CALL CAsyncEventNotifier::stop()
void SAL_CALL CAsyncEventNotifier::notifyEvent(CEventNotification* EventNotification)
{
- MutexGuard aGuard(m_Mutex);
+ osl::MutexGuard aGuard(m_Mutex);
OSL_ENSURE(m_bRun,"Event notifier is not running!");
@@ -193,7 +196,7 @@ void SAL_CALL CAsyncEventNotifier::notifyEvent(CEventNotification* EventNotifica
size_t SAL_CALL CAsyncEventNotifier::getEventListSize()
{
- MutexGuard aGuard(m_Mutex);
+ osl::MutexGuard aGuard(m_Mutex);
return m_EventList.size();
}
@@ -203,7 +206,7 @@ size_t SAL_CALL CAsyncEventNotifier::getEventListSize()
void SAL_CALL CAsyncEventNotifier::resetNotifyEvent()
{
- MutexGuard aGuard(m_Mutex);
+ osl::MutexGuard aGuard(m_Mutex);
if (0 == m_EventList.size())
m_NotifyEvent.reset();
}
@@ -214,7 +217,7 @@ void SAL_CALL CAsyncEventNotifier::resetNotifyEvent()
CEventNotification* SAL_CALL CAsyncEventNotifier::getNextEventRecord()
{
- MutexGuard aGuard(m_Mutex);
+ osl::MutexGuard aGuard(m_Mutex);
return m_EventList.front();
}
@@ -224,7 +227,7 @@ CEventNotification* SAL_CALL CAsyncEventNotifier::getNextEventRecord()
void SAL_CALL CAsyncEventNotifier::removeNextEventRecord()
{
- MutexGuard aGuard(m_Mutex);
+ osl::MutexGuard aGuard(m_Mutex);
m_EventList.pop_front();
}
@@ -246,7 +249,7 @@ void SAL_CALL CAsyncEventNotifier::run()
removeNextEventRecord();
::cppu::OInterfaceContainerHelper* pICHelper =
- m_rBroadcastHelper.getContainer(getCppuType((Reference<XFilePickerListener>*)0));
+ m_rBroadcastHelper.getContainer(getCppuType((uno::Reference<XFilePickerListener>*)0));
if (pICHelper)
{
@@ -258,7 +261,7 @@ void SAL_CALL CAsyncEventNotifier::run()
{
EventNotification->notifyEventListener(iter.next());
}
- catch(RuntimeException&)
+ catch(uno::RuntimeException&)
{
OSL_ENSURE(sal_False,"RuntimeException during event dispatching");
}
diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.hxx b/fpicker/source/win32/filepicker/asynceventnotifier.hxx
index aa40b5f5fdf8..84597c1bdc2c 100644
--- a/fpicker/source/win32/filepicker/asynceventnotifier.hxx
+++ b/fpicker/source/win32/filepicker/asynceventnotifier.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: asynceventnotifier.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: tra $ $Date: 2002-03-21 07:35:14 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,10 +74,6 @@
#include <osl/conditn.hxx>
#endif
-#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERLISTENER_HPP_
-#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
-#endif
-
#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
#include <cppuhelper/interfacecontainer.h>
#endif
@@ -99,6 +95,7 @@ class CAsyncEventNotifier
{
public:
CAsyncEventNotifier(cppu::OBroadcastHelper& rBroadcastHelper);
+ ~CAsyncEventNotifier();
bool SAL_CALL start();
void SAL_CALL stop();
diff --git a/fpicker/source/win32/filepicker/getfilenamewrapper.cxx b/fpicker/source/win32/filepicker/getfilenamewrapper.cxx
index b67256b3f3c8..c990a62057d6 100644
--- a/fpicker/source/win32/filepicker/getfilenamewrapper.cxx
+++ b/fpicker/source/win32/filepicker/getfilenamewrapper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: getfilenamewrapper.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: tra $ $Date: 2001-10-04 11:08:11 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,188 +67,162 @@
#include <osl/diagnose.h>
#endif
-
#ifndef _GETFILENAMEWRAPPER_HXX_
#include "getfilenamewrapper.hxx"
#endif
-
#include <process.h>
-//-----------------------------------------------
-// Simple struct for automatically init/deinit
-// of a STA
-//-----------------------------------------------
-struct STAInit
+namespace /* private */
{
- STAInit( ) { CoInitialize( NULL ); }
- ~STAInit( ) { CoUninitialize( ); }
-};
-//-----------------------------------------------
-// This function returns true if either the
-// calling thread belongs to an STA or to no
-// apartment at all
-//-----------------------------------------------
-
-bool IsThreadContextSTA( )
-{
- HRESULT hr = CoInitialize( NULL );
- bool bRet = false;
+ //-----------------------------------------------
+ //
+ //-----------------------------------------------
- if ( SUCCEEDED( hr ) )
+ struct GetFileNameParam
{
- bRet = true;
- CoUninitialize( );
- }
-
- return bRet;
-}
+ GetFileNameParam(bool bOpen, LPOPENFILENAMEW lpofn) :
+ m_bOpen(bOpen),
+ m_lpofn(lpofn),
+ m_bRet(false),
+ m_ExtErr(0)
+ {}
+
+ bool m_bOpen;
+ LPOPENFILENAMEW m_lpofn;
+ bool m_bRet;
+ int m_ExtErr;
+ };
+
+ //-----------------------------------------------
+ //
+ //-----------------------------------------------
+
+ unsigned __stdcall ThreadProc(void* pParam)
+ {
+ GetFileNameParam* lpgfnp =
+ reinterpret_cast<GetFileNameParam*>(pParam);
-//-----------------------------------------------
-// Someone may extend this method on demand and
-// even create the appropriate instance depending
-// on the OS version etc.
-//-----------------------------------------------
+ if (lpgfnp->m_bOpen)
+ lpgfnp->m_bRet = GetOpenFileNameW(lpgfnp->m_lpofn);
+ else
+ lpgfnp->m_bRet = GetSaveFileNameW(lpgfnp->m_lpofn);
-CGetFileNameWrapper* CGetFileNameWrapper::create( )
-{
- CGetFileNameWrapper* pGetFileNameWrapper = new CSTAGetFileNameWrapper( );
+ lpgfnp->m_ExtErr = CommDlgExtendedError();
- OSL_POSTCOND( pGetFileNameWrapper, "can't create instance, not enough memory" );
+ return 0;
+ }
- return pGetFileNameWrapper;
-}
+ //-----------------------------------------------
+ // exceutes GetOpenFileName/GetSaveFileName in
+ // a separat thread
+ //-----------------------------------------------
+ bool ThreadExecGetFileName(LPOPENFILENAMEW lpofn, bool bOpen, /*out*/ int& ExtErr)
+ {
+ GetFileNameParam gfnp(bOpen,lpofn);
+ unsigned id;
-//###############################################
+ HANDLE hThread = reinterpret_cast<HANDLE>(
+ _beginthreadex(0, 0, ThreadProc, &gfnp, 0, &id));
+ OSL_POSTCOND(hThread, "could not create STA thread");
-//-----------------------------------------------
-//
-//-----------------------------------------------
+ WaitForSingleObject(hThread, INFINITE);
+ CloseHandle(hThread);
-CSTAGetFileNameWrapper::CSTAGetFileNameWrapper( )
-{
-}
+ ExtErr = gfnp.m_ExtErr;
-//-----------------------------------------------
-//
-//-----------------------------------------------
+ return gfnp.m_bRet;
+ }
-CSTAGetFileNameWrapper::~CSTAGetFileNameWrapper( )
-{
-}
+ //-----------------------------------------------
+ // This function returns true if the calling
+ // thread belongs to a Multithreaded Appartment
+ // (MTA)
+ //-----------------------------------------------
-//-----------------------------------------------
-//
-//-----------------------------------------------
+ bool IsMTA()
+ {
+ HRESULT hr = CoInitialize(NULL);
-BOOL SAL_CALL CSTAGetFileNameWrapper::getOpenFileName( LPOPENFILENAMEW lpofn )
-{
- executeGetFileName( true, lpofn );
- return m_bResult;
-}
+ if (RPC_E_CHANGED_MODE == hr)
+ return true;
-//-----------------------------------------------
-//
-//-----------------------------------------------
+ if(SUCCEEDED(hr))
+ CoUninitialize();
-BOOL SAL_CALL CSTAGetFileNameWrapper::getSaveFileName( LPOPENFILENAMEW lpofn )
-{
- executeGetFileName( false, lpofn );
- return m_bResult;
-}
+ return false;
+ }
-//-----------------------------------------------
-//
-//-----------------------------------------------
+} // namespace private
-DWORD SAL_CALL CSTAGetFileNameWrapper::commDlgExtendedError( )
-{
- return m_LastError;
-}
//-----------------------------------------------
//
//-----------------------------------------------
-void SAL_CALL CSTAGetFileNameWrapper::executeGetFileName( )
+CGetFileNameWrapper::CGetFileNameWrapper() :
+ m_ExtendedDialogError(0)
{
- if ( m_bFileOpenDialog )
- m_bResult = CGetFileNameWrapper::getOpenFileName( m_lpofn );
- else
- m_bResult = CGetFileNameWrapper::getSaveFileName( m_lpofn );
-
- if ( !m_bResult )
- m_LastError = CGetFileNameWrapper::commDlgExtendedError( );
}
//-----------------------------------------------
//
//-----------------------------------------------
-void SAL_CALL CSTAGetFileNameWrapper::executeGetFileName( BOOL bFileOpenDialog, LPOPENFILENAMEW lpofn )
+bool CGetFileNameWrapper::getOpenFileName(LPOPENFILENAMEW lpofn)
{
- m_bFileOpenDialog = bFileOpenDialog;
- m_lpofn = lpofn;
- m_bResult = false;
+ OSL_PRECOND(lpofn,"invalid parameter");
+
+ bool bRet = false;
- if ( !IsThreadContextSTA( ) && threadExecuteGetFileName( ) )
+ if (IsMTA())
{
- return;
+ bRet = ThreadExecGetFileName(
+ lpofn, true, m_ExtendedDialogError);
}
else
{
- // execute in the context of the calling thread
- // if it lives in an STA or the execution in a
- // separat thread failed
- executeGetFileName( );
+ bRet = GetOpenFileNameW(lpofn);
+ m_ExtendedDialogError = CommDlgExtendedError();
}
+
+ return bRet;
}
//-----------------------------------------------
//
//-----------------------------------------------
-bool SAL_CALL CSTAGetFileNameWrapper::threadExecuteGetFileName( )
+bool CGetFileNameWrapper::getSaveFileName(LPOPENFILENAMEW lpofn)
{
- unsigned ThreadId;
- bool bSuccess = false;
-
- HANDLE hThread = reinterpret_cast< HANDLE >(
- _beginthreadex( 0, 0, CSTAGetFileNameWrapper::threadProc, this, 0, &ThreadId ) );
+ OSL_PRECOND(lpofn,"invalid parameter");
- OSL_POSTCOND( hThread, "could not create STA thread" );
+ bool bRet = false;
- if ( hThread )
+ if (IsMTA())
+ {
+ bRet = ThreadExecGetFileName(
+ lpofn, false, m_ExtendedDialogError);
+ }
+ else
{
- // stop the calling thread until the sta thread
- // has ended
- WaitForSingleObject( hThread, INFINITE );
- CloseHandle( hThread );
- bSuccess = true;
+ bRet = GetSaveFileNameW(lpofn);
+ m_ExtendedDialogError = CommDlgExtendedError();
}
- return bSuccess;
+ return bRet;
}
//-----------------------------------------------
//
//-----------------------------------------------
-unsigned __stdcall CSTAGetFileNameWrapper::threadProc( void* pParam )
+int CGetFileNameWrapper::commDlgExtendedError( )
{
- CSTAGetFileNameWrapper* pImpl =
- reinterpret_cast< CSTAGetFileNameWrapper* >( pParam );
-
- OSL_ASSERT( pImpl );
-
- // setup a STA environment
- STAInit staInit;
-
- pImpl->executeGetFileName( );
-
- return 0;
+ return m_ExtendedDialogError;
}
+
diff --git a/fpicker/source/win32/filepicker/getfilenamewrapper.hxx b/fpicker/source/win32/filepicker/getfilenamewrapper.hxx
index 790b0937f225..2606ad020012 100644
--- a/fpicker/source/win32/filepicker/getfilenamewrapper.hxx
+++ b/fpicker/source/win32/filepicker/getfilenamewrapper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: getfilenamewrapper.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: tra $ $Date: 2001-10-04 11:08:05 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-
#ifndef _GETFILENAMEWRAPPER_HXX_
#define _GETFILENAMEWRAPPER_HXX_
@@ -67,97 +66,25 @@
// includes
//------------------------------------------------------------------------
-#ifndef _SAL_TYPES_H_
-#include <sal/types.h>
-#endif
-
#include <systools/win32/comdlg9x.h>
/*
A simple wrapper around the GetOpenFileName/GetSaveFileName API.
- This wrapper serves as base class because currently the Win32
- API functions GetOpenFileName/GetSaveFileName work only properly
- in an STA. If this changes in the future we simply use the base
- class else we use an derived class which calls the API functions
- from within an STA.
+ Because currently the Win32 API functions GetOpenFileName/GetSaveFileName
+ work only properly in an Single Threaded Appartment.
*/
class CGetFileNameWrapper
{
public:
- virtual ~CGetFileNameWrapper( ) { };
-
- virtual BOOL SAL_CALL getOpenFileName( LPOPENFILENAMEW lpofn )
- {
- return ::GetOpenFileNameW( lpofn );
- }
-
- virtual BOOL SAL_CALL getSaveFileName( LPOPENFILENAMEW lpofn )
- {
- return ::GetSaveFileNameW( lpofn );
- }
-
- virtual DWORD SAL_CALL commDlgExtendedError( )
- {
- return ::CommDlgExtendedError( );
- }
-
- // a factory method, so it's possible to create
- // different instances of this class depending
- // on the apartment model of the calling thread,
- // the OS version etc.
- // the client owns the returned instance and
- // should destroy it using delete
- static CGetFileNameWrapper* create( );
+ CGetFileNameWrapper();
-protected:
-
- // let instances only be created through
- // the create method
- CGetFileNameWrapper( ) { };
-};
-
-/*
- The wrapper always calls the GetOpenFileName/GetSaveFileName in
- a STA thread because a lot of features of the system file dialogs
- are disabled when the calling thread is an MTA thread
- (this is a MS Bug at least that they don't document this).
- This class is not thread-safe.
-*/
-
-class CSTAGetFileNameWrapper : public CGetFileNameWrapper
-{
-public:
- virtual ~CSTAGetFileNameWrapper( );
-
- virtual BOOL SAL_CALL getOpenFileName( LPOPENFILENAMEW lpofn );
-
- virtual BOOL SAL_CALL getSaveFileName( LPOPENFILENAMEW lpofn );
-
- virtual DWORD SAL_CALL commDlgExtendedError( );
-
-protected:
- CSTAGetFileNameWrapper( );
+ bool getOpenFileName(LPOPENFILENAMEW lpofn);
+ bool getSaveFileName(LPOPENFILENAMEW lpofn);
+ int commDlgExtendedError();
private:
- void SAL_CALL executeGetFileName( );
- void SAL_CALL executeGetFileName( BOOL bFileOpenDialog, LPOPENFILENAMEW lpofn );
- bool SAL_CALL threadExecuteGetFileName( );
-
- static unsigned __stdcall threadProc( void * pParam );
-
-private:
- DWORD m_LastError;
- BOOL m_bFileOpenDialog;
- BOOL m_bResult;
- LPOPENFILENAMEW m_lpofn;
-
-// prevent copy/assignment
-private:
- CSTAGetFileNameWrapper( const CSTAGetFileNameWrapper& );
- CSTAGetFileNameWrapper& operator=( const CSTAGetFileNameWrapper& );
-
- friend class CGetFileNameWrapper;
+ int m_ExtendedDialogError;
};
#endif
diff --git a/fpicker/source/win32/filepicker/previewadapter.cxx b/fpicker/source/win32/filepicker/previewadapter.cxx
index 9108927786d5..e25f41775aa7 100644
--- a/fpicker/source/win32/filepicker/previewadapter.cxx
+++ b/fpicker/source/win32/filepicker/previewadapter.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: previewadapter.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: tra $ $Date: 2002-03-21 07:11:50 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,11 +118,11 @@ public:
// parent notification handler
//-------------------------------------
- virtual void SAL_CALL notifyParentShow(sal_Bool bShow);
+ virtual void SAL_CALL notifyParentShow(bool bShow);
virtual void SAL_CALL notifyParentSizeChanged();
- virtual void SAL_CALL notifyParentWindowPosChanged(sal_Bool bIsVisible);
+ virtual void SAL_CALL notifyParentWindowPosChanged(bool bIsVisible);
protected:
virtual void SAL_CALL calcRightMargin();
@@ -280,7 +280,7 @@ void SAL_CALL CPreviewAdapterImpl::calcRightMargin()
//
//-----------------------------------------
-void SAL_CALL CPreviewAdapterImpl::notifyParentShow(sal_Bool bShow)
+void SAL_CALL CPreviewAdapterImpl::notifyParentShow(bool bShow)
{
}
@@ -297,7 +297,7 @@ void SAL_CALL CPreviewAdapterImpl::notifyParentSizeChanged()
//
//-----------------------------------------
-void SAL_CALL CPreviewAdapterImpl::notifyParentWindowPosChanged(sal_Bool bIsVisible)
+void SAL_CALL CPreviewAdapterImpl::notifyParentWindowPosChanged(bool bIsVisible)
{
}
@@ -453,7 +453,7 @@ class CWin98PreviewAdapterImpl : public CPreviewAdapterImpl
public:
CWin98PreviewAdapterImpl(HINSTANCE instance);
- virtual void SAL_CALL notifyParentWindowPosChanged(sal_Bool bIsVisible);
+ virtual void SAL_CALL notifyParentWindowPosChanged(bool bIsVisible);
protected:
virtual void SAL_CALL rearrangeLayout();
@@ -486,7 +486,7 @@ CWin98PreviewAdapterImpl::CWin98PreviewAdapterImpl(HINSTANCE instance) :
//
//--------------------------------------------
-void SAL_CALL CWin98PreviewAdapterImpl::notifyParentWindowPosChanged(sal_Bool bIsVisible)
+void SAL_CALL CWin98PreviewAdapterImpl::notifyParentWindowPosChanged(bool bIsVisible)
{
try
{
@@ -593,7 +593,7 @@ class CWin95NTPreviewAdapterImpl : public CPreviewAdapterImpl
public:
CWin95NTPreviewAdapterImpl(HINSTANCE instance);
- virtual void SAL_CALL notifyParentShow(sal_Bool bShow);
+ virtual void SAL_CALL notifyParentShow(bool bShow);
};
//--------------------------------------------
@@ -609,7 +609,7 @@ CWin95NTPreviewAdapterImpl::CWin95NTPreviewAdapterImpl(HINSTANCE instance) :
//
//--------------------------------------------
-void SAL_CALL CWin95NTPreviewAdapterImpl::notifyParentShow(sal_Bool bShow)
+void SAL_CALL CWin95NTPreviewAdapterImpl::notifyParentShow(bool bShow)
{
try
{
@@ -727,7 +727,7 @@ void SAL_CALL CPreviewAdapter::setParent(HWND parent)
//
//-------------------------------
-void SAL_CALL CPreviewAdapter::notifyParentShow(sal_Bool bShow)
+void SAL_CALL CPreviewAdapter::notifyParentShow(bool bShow)
{
m_pImpl->notifyParentShow(bShow);
}
@@ -745,7 +745,7 @@ void SAL_CALL CPreviewAdapter::notifyParentSizeChanged()
//
//-------------------------------
-void SAL_CALL CPreviewAdapter::notifyParentWindowPosChanged(sal_Bool bIsVisible)
+void SAL_CALL CPreviewAdapter::notifyParentWindowPosChanged(bool bIsVisible)
{
m_pImpl->notifyParentWindowPosChanged(bIsVisible);
}
diff --git a/fpicker/source/win32/filepicker/previewadapter.hxx b/fpicker/source/win32/filepicker/previewadapter.hxx
index 39e114da4ce3..bb21e5ba9f4a 100644
--- a/fpicker/source/win32/filepicker/previewadapter.hxx
+++ b/fpicker/source/win32/filepicker/previewadapter.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: previewadapter.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: tra $ $Date: 2002-03-21 07:11:58 $
+ * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -128,11 +128,11 @@ public:
// notification from parent
//--------------------------------------
- void SAL_CALL notifyParentShow(sal_Bool bShow);
+ void SAL_CALL notifyParentShow(bool bShow);
void SAL_CALL notifyParentSizeChanged();
- void SAL_CALL notifyParentWindowPosChanged(sal_Bool bIsVisible);
+ void SAL_CALL notifyParentWindowPosChanged(bool bIsVisible);
private:
// hide implementation details using the