2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
|
2014-05-15 12:06:32 +02:00
|
|
|
#ifndef INCLUDED_FPICKER_SOURCE_WIN32_FILEPICKER_WINFILEOPENIMPL_HXX
|
|
|
|
#define INCLUDED_FPICKER_SOURCE_WIN32_FILEPICKER_WINFILEOPENIMPL_HXX
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
|
|
|
|
#include <com/sun/star/ui/dialogs/FilePickerEvent.hpp>
|
2001-10-16 13:03:12 +00:00
|
|
|
#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
|
2001-06-28 10:17:00 +00:00
|
|
|
#include "FilterContainer.hxx"
|
|
|
|
#include "FileOpenDlg.hxx"
|
2002-03-21 06:37:13 +00:00
|
|
|
#include "previewadapter.hxx"
|
2001-08-03 13:07:53 +00:00
|
|
|
#include "helppopupwindow.hxx"
|
2002-03-21 06:37:13 +00:00
|
|
|
#include "customcontrol.hxx"
|
2011-07-20 22:26:55 +03:00
|
|
|
#include "../misc/resourceprovider.hxx"
|
2007-07-03 12:57:47 +00:00
|
|
|
|
2001-06-28 10:17:00 +00:00
|
|
|
#include <utility>
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
2001-10-09 05:57:38 +00:00
|
|
|
#include <osl/conditn.hxx>
|
|
|
|
|
2001-06-28 10:17:00 +00:00
|
|
|
class CFilePicker;
|
2001-08-10 11:24:27 +00:00
|
|
|
class CFilePickerState;
|
|
|
|
class CExecuteFilePickerState;
|
|
|
|
class CNonExecuteFilePickerState;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
class CWinFileOpenImpl : public CFileOpenDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CWinFileOpenImpl(
|
|
|
|
CFilePicker* aFilePicker,
|
2016-10-14 16:55:19 +02:00
|
|
|
bool bFileOpenDialog = true,
|
2001-06-28 10:17:00 +00:00
|
|
|
sal_uInt32 dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
|
|
|
sal_uInt32 dwTemplateId = 0,
|
2016-10-14 16:55:19 +02:00
|
|
|
HINSTANCE hInstance = nullptr );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual ~CWinFileOpenImpl( ) override;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
// XExecutableDialog
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
virtual sal_Int16 SAL_CALL execute( ) throw( css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
// XFilePicker
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual void SAL_CALL setDefaultName( const OUString& aName )
|
2016-10-14 16:55:19 +02:00
|
|
|
throw( css::lang::IllegalArgumentException, css::uno::RuntimeException ) override;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
virtual css::uno::Sequence< OUString > SAL_CALL getFiles( )
|
|
|
|
throw(css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual void SAL_CALL setDisplayDirectory( const OUString& aDirectory )
|
2016-10-14 16:55:19 +02:00
|
|
|
throw( css::lang::IllegalArgumentException, css::uno::RuntimeException ) override;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
virtual OUString SAL_CALL getDisplayDirectory( ) throw ( css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
// XFilterManager
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual void SAL_CALL appendFilter( const OUString& aTitle, const OUString& aFilter )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw( css::lang::IllegalArgumentException, css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual void SAL_CALL setCurrentFilter( const OUString& aTitle )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw( css::lang::IllegalArgumentException, css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual OUString SAL_CALL getCurrentFilter( )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw( css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2001-10-16 13:03:12 +00:00
|
|
|
// XFilterGroupManager
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
virtual void SAL_CALL appendFilterGroup( const OUString& sGroupTitle, const css::uno::Sequence< css::beans::StringPair >& aFilters )
|
|
|
|
throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
|
2001-10-16 13:03:12 +00:00
|
|
|
|
2001-07-02 07:09:57 +00:00
|
|
|
// XFilePickerControlAccess
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const css::uno::Any& aValue )
|
|
|
|
throw( css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
virtual css::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction )
|
|
|
|
throw( css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual void SAL_CALL enableControl( sal_Int16 aControlId, bool bEnable )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw( css::uno::RuntimeException );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual void SAL_CALL setLabel( sal_Int16 aControlId, const OUString& aLabel )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw (css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual OUString SAL_CALL getLabel( sal_Int16 aControlId )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw ( css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
// XFilePreview
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( )
|
|
|
|
throw (css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
virtual sal_Int32 SAL_CALL getTargetColorDepth( )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw (css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
virtual sal_Int32 SAL_CALL getAvailableWidth( )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw (css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
virtual sal_Int32 SAL_CALL getAvailableHeight( )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw (css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const css::uno::Any& aImage )
|
|
|
|
throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual bool SAL_CALL setShowState( bool bShowState )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw (css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual bool SAL_CALL getShowState( )
|
2015-10-13 14:19:14 +02:00
|
|
|
throw (css::uno::RuntimeException);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2002-03-21 06:37:13 +00:00
|
|
|
// XCancelable
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2001-10-09 05:57:38 +00:00
|
|
|
virtual void SAL_CALL cancel( );
|
|
|
|
|
2002-03-21 06:37:13 +00:00
|
|
|
// Implementation details
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2001-06-28 10:17:00 +00:00
|
|
|
protected:
|
2016-10-14 16:55:19 +02:00
|
|
|
static sal_Int16 SAL_CALL getFocused( );
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual bool SAL_CALL preModal( ) override;
|
|
|
|
virtual void SAL_CALL postModal( sal_Int16 nDialogResult ) override;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual sal_uInt32 SAL_CALL onFileOk() override;
|
|
|
|
virtual void SAL_CALL onSelChanged( HWND hwndListBox ) override;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
// only called back if OFN_EXPLORER is set
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual void SAL_CALL onInitDone() override;
|
|
|
|
virtual void SAL_CALL onFolderChanged() override;
|
|
|
|
virtual void SAL_CALL onTypeChanged( sal_uInt32 nFilterIndex ) override;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2015-01-08 23:08:34 +01:00
|
|
|
// call base class method first when overriding
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual void SAL_CALL onInitDialog( HWND hwndDlg ) override;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2016-10-14 16:55:19 +02:00
|
|
|
virtual sal_uInt32 SAL_CALL onCtrlCommand( HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode ) override;
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2006-10-12 09:49:31 +00:00
|
|
|
void onWMSize();
|
2016-10-14 16:55:19 +02:00
|
|
|
void onWMShow(bool bShow);
|
2006-10-12 09:49:31 +00:00
|
|
|
void onWMWindowPosChanged();
|
|
|
|
void onCustomControlHelpRequest(LPHELPINFO lphi);
|
2002-03-21 06:37:13 +00:00
|
|
|
|
2001-06-28 10:17:00 +00:00
|
|
|
private:
|
2001-10-16 13:03:12 +00:00
|
|
|
inline void SAL_CALL appendFilterGroupSeparator( );
|
|
|
|
|
2016-10-14 16:55:19 +02:00
|
|
|
static inline bool SAL_CALL IsCustomControlHelpRequested(LPHELPINFO lphi);
|
2002-03-21 06:37:13 +00:00
|
|
|
|
2005-02-16 14:35:01 +00:00
|
|
|
void EnlargeStdControlLabels() const;
|
|
|
|
|
2001-06-28 10:17:00 +00:00
|
|
|
// initialize all controls from cache
|
2001-08-10 11:24:27 +00:00
|
|
|
void SAL_CALL InitControlLabel( HWND hWnd );
|
2002-03-21 06:37:13 +00:00
|
|
|
void SAL_CALL InitCustomControlContainer(HWND hCustomControl);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
// save the control state
|
2003-03-25 17:05:07 +00:00
|
|
|
void SAL_CALL CacheControlState(HWND hWnd);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
2003-03-25 17:05:07 +00:00
|
|
|
void SAL_CALL SetDefaultExtension();
|
|
|
|
void SAL_CALL InitialSetDefaultName();
|
2001-07-09 11:58:25 +00:00
|
|
|
|
2003-03-25 17:05:07 +00:00
|
|
|
static LRESULT CALLBACK SubClassFunc(HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam);
|
2001-06-28 10:17:00 +00:00
|
|
|
|
|
|
|
static BOOL CALLBACK EnumChildWndProc( HWND hWnd, LPARAM lParam );
|
|
|
|
|
|
|
|
private:
|
2014-10-02 15:20:46 +02:00
|
|
|
std::unique_ptr<CFilterContainer> m_filterContainer;
|
|
|
|
std::unique_ptr<CPreviewAdapter> m_Preview;
|
|
|
|
std::unique_ptr<CCustomControl> m_CustomControls;
|
2002-03-21 06:37:13 +00:00
|
|
|
CFilePicker* m_FilePicker;
|
2003-03-25 17:05:07 +00:00
|
|
|
WNDPROC m_pfnOldDlgProc;
|
2015-10-13 14:19:14 +02:00
|
|
|
OUString m_defaultName;
|
2016-10-14 16:55:19 +02:00
|
|
|
bool m_bInitialSelChanged;
|
2002-03-21 06:37:13 +00:00
|
|
|
CHelpPopupWindow m_HelpPopupWindow;
|
|
|
|
CFilePickerState* m_FilePickerState;
|
|
|
|
CExecuteFilePickerState* m_ExecuteFilePickerState;
|
|
|
|
CNonExecuteFilePickerState* m_NonExecuteFilePickerState;
|
2007-07-03 12:57:47 +00:00
|
|
|
CResourceProvider m_ResProvider;
|
2001-06-28 10:17:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2010-10-27 13:11:31 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|