1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef DBAUI_TEXTCONNECTIONHELPER_HXX 29 #define DBAUI_TEXTCONNECTIONHELPER_HXX 30 31 #ifndef DBAUI_CONNECTIONPAGESETUP_HXX 32 #include "ConnectionPageSetup.hxx" 33 #endif 34 #ifndef _DBAUI_ADMINPAGES_HXX_ 35 #include "adminpages.hxx" 36 #endif 37 #ifndef CHARSETLISTBOX_HXX 38 #include "charsetlistbox.hxx" 39 #endif 40 #ifndef _UCBHELPER_CONTENT_HXX 41 #include <ucbhelper/content.hxx> 42 #endif 43 #ifndef _DBAUI_CURLEDIT_HXX_ 44 #include "curledit.hxx" 45 #endif 46 #ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX 47 #include <svtools/roadmapwizard.hxx> 48 #endif 49 #ifndef _SV_FIELD_HXX 50 #include <vcl/field.hxx> 51 #endif 52 #ifndef _RTL_USTRING_HXX_ 53 #include <rtl/ustring.hxx> 54 #endif 55 #ifndef _SV_LSTBOX_HXX 56 #include <vcl/lstbox.hxx> 57 #endif 58 59 60 //......................................................................... 61 namespace dbaui 62 63 { 64 //......................................................................... 65 66 #define TC_EXTENSION ((short)0x01) // a section specifying the extension of the files to connect to 67 #define TC_SEPARATORS ((short)0x02) // a section specifying the various separators 68 #define TC_HEADER ((short)0x04) // a section containing the "Text contains header" check box only 69 #define TC_CHARSET ((short)0x08) // not yet implemented 70 71 //======================================================================== 72 //= OTextConnectionPage 73 //======================================================================== 74 class OTextConnectionHelper : public Control 75 { 76 OTextConnectionHelper(); 77 78 Link m_aModifiedHandler; /// to be called if something on the page has been modified 79 80 public: 81 OTextConnectionHelper( Window* pParent, const short _nAvailableSections ); 82 virtual ~OTextConnectionHelper(); 83 84 private: 85 FixedText m_aFTExtensionHeader; 86 RadioButton m_aRBAccessTextFiles; 87 RadioButton m_aRBAccessCSVFiles; 88 RadioButton m_aRBAccessOtherFiles; 89 Edit m_aETOwnExtension; 90 FixedText m_aFTExtensionExample; 91 FixedLine m_aLineFormat; 92 FixedText m_aFieldSeparatorLabel; 93 ComboBox m_aFieldSeparator; 94 FixedText m_aTextSeparatorLabel; 95 ComboBox m_aTextSeparator; 96 FixedText m_aDecimalSeparatorLabel; 97 ComboBox m_aDecimalSeparator; 98 FixedText m_aThousandsSeparatorLabel; 99 ComboBox m_aThousandsSeparator; 100 CheckBox m_aRowHeader; 101 FixedLine m_aCharSetHeader; 102 FixedText m_aCharSetLabel; 103 CharSetListBox m_aCharSet; 104 String m_aFieldSeparatorList; 105 String m_aTextSeparatorList; 106 String m_aTextNone; 107 String m_aOldExtension; 108 Link m_aGetExtensionHandler; /// to be called if a new type is selected 109 110 short m_nAvailableSections; 111 112 protected: 113 void callModifiedHdl() const { if (m_aModifiedHandler.IsSet()) m_aModifiedHandler.Call((void*)this); } 114 Link getControlModifiedLink() { return LINK(this, OTextConnectionHelper, OnControlModified); } 115 DECL_LINK(OnSetExtensionHdl,RadioButton*); 116 DECL_LINK(OnControlModified,Control*); 117 DECL_LINK(OnEditModified,Edit*); 118 119 private: 120 String GetSeparator( const ComboBox& rBox, const String& rList ); 121 void SetSeparator( ComboBox& rBox, const String& rList, const String& rVal ); 122 void SetExtension(const String& _rVal); 123 124 125 public: 126 void implInitControls(const SfxItemSet& _rSet, sal_Bool _bValid); 127 void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 128 void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 129 void SetClickHandler(const Link& _rHandler) { m_aGetExtensionHandler = _rHandler; } 130 String GetExtension(); 131 sal_Bool FillItemSet( SfxItemSet& rSet, const sal_Bool bChangedSomething ); 132 sal_Bool prepareLeave(); 133 }; 134 135 //......................................................................... 136 } // namespace dbaui 137 //......................................................................... 138 139 #endif // DBAUI_DBWIZ2_HXX 140 141