diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-03-05 15:35:07 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-03-05 15:35:07 +0000 |
commit | 0789c3d9ece3862b50cda8de945d376375b13d77 (patch) | |
tree | cde4d8d31516a17d3fbe4e347b74f43a0a0751d6 /fpicker | |
parent | 14bc62ad0d9e0179f4178d2913ebba7abf99755e (diff) |
INTEGRATION: CWS aquafilepicker02_DEV300 (1.2.40); FILE MERGED
2008/02/14 17:28:45 fheckl 1.2.40.3: Further changes concerning Autoextension
2008/01/14 08:23:23 fheckl 1.2.40.2: Code cleanup and some implementation details
2008/01/02 18:25:58 fheckl 1.2.40.1: issue #80399 more Cocoa
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/aqua/ControlHelper.hxx | 141 |
1 files changed, 96 insertions, 45 deletions
diff --git a/fpicker/source/aqua/ControlHelper.hxx b/fpicker/source/aqua/ControlHelper.hxx index 4d499e3fa2dd..2d6e623b069c 100644 --- a/fpicker/source/aqua/ControlHelper.hxx +++ b/fpicker/source/aqua/ControlHelper.hxx @@ -4,9 +4,9 @@ * * $RCSfile: ControlHelper.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: ihi $ $Date: 2007-07-11 10:57:54 $ + * last change: $Author: kz $ $Date: 2008-03-05 16:35:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,23 +36,33 @@ #ifndef _CONTROLHELPER_HXX_ #define _CONTROLHELPER_HXX_ -#ifndef _RTL_USTRING_H_ +#ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> #endif + #ifndef _COM_SUN_STAR_UNO_ANY_HXX_ #include <com/sun/star/uno/Any.hxx> #endif #include <list> +#include <map> #include <premac.h> -#include <Carbon/Carbon.h> +#include <Cocoa/Cocoa.h> #include <postmac.h> #ifndef _SALAQUACONSTANTS_H_ #include "SalAquaConstants.h" #endif +#ifndef _FILTERHELPER_HXX_ +#include "FilterHelper.hxx" +#endif + +#ifndef _AQUAFILEPICKERDELEGATE_HXX_ +#include "AquaFilePickerDelegate.hxx" +#endif + using namespace com::sun::star; using namespace rtl; @@ -69,35 +79,25 @@ public: //------------------------------------------------ // XInitialization delegate //------------------------------------------------ - void initialize(sal_Int16 templateId); + void initialize( sal_Int16 templateId ); //------------------------------------------------------------------------------------ // XFilePickerControlAccess function delegates //------------------------------------------------------------------------------------ void setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const uno::Any& rValue ); - uno::Any getValue(sal_Int16 nControlId, sal_Int16 nControlAction); - void enableControl(sal_Int16 nControlId, sal_Bool bEnable); - OUString getLabel(sal_Int16 nControlId); - void setLabel( sal_Int16 nControlId, const CFStringRef aLabel ); + uno::Any getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) const; + void enableControl( sal_Int16 nControlId, sal_Bool bEnable ) const; + OUString getLabel( sal_Int16 nControlId ); + void setLabel( sal_Int16 nControlId, const NSString* aLabel ); //------------------------------------------------------------------------------------ - // NavigationServices callback delegates + // other stuff //------------------------------------------------------------------------------------ - void handleStart(NavCBRecPtr callBackParms); - void handleCustomize(NavCBRecPtr callBackParms); - void handleEvent(NavCBRecPtr callBackParms, NavEventCallbackMessage aLatestEvent); - void handleAdjustRect(NavCBRecPtr callBackParms); + void updateFilterUI(); //------------------------------------------------------------------------------------ // Type definitions //------------------------------------------------------------------------------------ - enum ControlType { - NONE - , CHECKBOX - , POPUPMENU - , USERPANE - }; - enum ToggleType { AUTOEXTENSION, //but autoextension is handled differently on MacOSX PASSWORD, @@ -119,58 +119,109 @@ public: //------------------------------------------------------------------------------------ // inline functions //------------------------------------------------------------------------------------ - inline ControlRef getUserPane() { + inline NSView* getUserPane() { + if (m_bIsUserPaneLaidOut == false) { + createUserPane(); + } return m_pUserPane; } - inline bool getVisibility(ToggleType tToggle) { + inline bool getVisibility(ToggleType tToggle) { return m_bToggleVisibility[tToggle]; } - inline void setPopupPresent(bool bPresent) { - m_bIsFilterPopupPresent = bPresent; + inline void setFilterControlNeeded(bool bNeeded) { + m_bIsFilterControlNeeded = bNeeded; + if (bNeeded == true) { + m_bUserPaneNeeded = true; + } + } + + inline void setFilterHelper(FilterHelper* pFilterHelper) { + m_pFilterHelper = pFilterHelper; + } + + inline void setFilePickerDelegate(AquaFilePickerDelegate* pDelegate) { + m_pDelegate = pDelegate; + } + + inline bool isAutoExtensionEnabled() { + return m_bAutoFilenameExtension; } private: //------------------------------------------------------------------------------------ // private member variables //------------------------------------------------------------------------------------ - ControlRef m_pUserPane; - int m_nLastCustomizeTryWidth; - int m_nLastCustomizeTryHeight; + /** the native view object */ + NSView* m_pUserPane; + + /** the checkbox controls */ + NSControl* m_pToggles[ TOGGLE_LAST ]; - ControlRef m_pToggles[ TOGGLE_LAST ]; + /** the visibility flags for the checkboxes */ bool m_bToggleVisibility[TOGGLE_LAST]; -// enum tButtonType { -// PLAY, -// BUTTON_LAST -// }; -// -// ControlRef m_pButtons[ BUTTON_LAST ]; + /** the special filter control */ + NSPopUpButton *m_pFilterControl; + + /** the popup menu controls (except for the filter control) */ + NSControl* m_pListControls[ LIST_LAST ]; + + /** a map to store a control's label text */ + ::std::map<NSControl *, NSString *> m_aMapListLabels; + + /** a map to store a popup menu's label text field */ + ::std::map<NSPopUpButton *, NSTextField *> m_aMapListLabelFields; - ControlRef m_pListControls[ LIST_LAST ]; + /** the visibility flags for the popup menus */ bool m_bListVisibility[ LIST_LAST ]; + /** indicates if a user pane is needed */ bool m_bUserPaneNeeded; - ::std::list<ControlRef> m_aActiveControls; + /** indicates if the user pane was laid out already */ + bool m_bIsUserPaneLaidOut; - bool m_bIsFilterPopupPresent; + /** indicates if a filter control is needed */ + bool m_bIsFilterControlNeeded; + + /* + * With issue #78852 the GUI option to set automatic filename extension was removed but + * so far the setting is still in effect and so the value for has to be saved and possibly be restored + * also. + * But with issue #FILLME users were starting to get confused on Windows so we decided to have + * autoextension always on and have it selectable for the user again. + */ + /** indicates if a filename extension is to automatically be appended to a user entered file name */ + bool m_bAutoFilenameExtension; + + /** a list with all actively used controls */ + ::std::list<NSControl*> m_aActiveControls; + + /** the filter helper */ + FilterHelper *m_pFilterHelper; + + /** the save or open panel's delegate */ + AquaFilePickerDelegate *m_pDelegate; //------------------------------------------------------------------------------------ // private methods //------------------------------------------------------------------------------------ - void HandleSetListValue(const ControlRef pControl, const sal_Int16 nControlAction, const uno::Any& rValue); - uno::Any HandleGetListValue(const ControlRef pControl, const sal_Int16 nControlAction) const; + void HandleSetListValue(const NSControl* pControl, const sal_Int16 nControlAction, const uno::Any& rValue); + uno::Any HandleGetListValue(const NSControl* pControl, const sal_Int16 nControlAction) const; + + void createControls(); + void createFilterControl(); + void createUserPane(); + NSTextField* createLabelWithString(const NSString* label); - void createControls(); - void createUserPane(WindowRef parent); - int getControlElementName(ControlType type, int nControlId); - ControlRef getControl( const sal_Int16 nControlId ); + int getControlElementName(const Class clazz, const int nControlId) const; + NSControl* getControl( const sal_Int16 nControlId ) const; + static int getVerticalDistance(const NSControl* first, const NSControl* second); - void layoutControls(); + void layoutControls(); }; #endif //_CONTROLHELPER_HXX_ |