1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef DBAUI_TEXTCONNECTIONHELPER_HXX 25 #define DBAUI_TEXTCONNECTIONHELPER_HXX 26 27 #ifndef DBAUI_CONNECTIONPAGESETUP_HXX 28 #include "ConnectionPageSetup.hxx" 29 #endif 30 #ifndef _DBAUI_ADMINPAGES_HXX_ 31 #include "adminpages.hxx" 32 #endif 33 #ifndef CHARSETLISTBOX_HXX 34 #include "charsetlistbox.hxx" 35 #endif 36 #ifndef _UCBHELPER_CONTENT_HXX 37 #include <ucbhelper/content.hxx> 38 #endif 39 #ifndef _DBAUI_CURLEDIT_HXX_ 40 #include "curledit.hxx" 41 #endif 42 #ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX 43 #include <svtools/roadmapwizard.hxx> 44 #endif 45 #ifndef _SV_FIELD_HXX 46 #include <vcl/field.hxx> 47 #endif 48 #ifndef _RTL_USTRING_HXX_ 49 #include <rtl/ustring.hxx> 50 #endif 51 #ifndef _SV_LSTBOX_HXX 52 #include <vcl/lstbox.hxx> 53 #endif 54 55 56 //......................................................................... 57 namespace dbaui 58 59 { 60 //......................................................................... 61 62 #define TC_EXTENSION ((short)0x01) // a section specifying the extension of the files to connect to 63 #define TC_SEPARATORS ((short)0x02) // a section specifying the various separators 64 #define TC_HEADER ((short)0x04) // a section containing the "Text contains header" check box only 65 #define TC_CHARSET ((short)0x08) // not yet implemented 66 67 //======================================================================== 68 //= OTextConnectionPage 69 //======================================================================== 70 class OTextConnectionHelper : public Control 71 { 72 OTextConnectionHelper(); 73 74 Link m_aModifiedHandler; /// to be called if something on the page has been modified 75 76 public: 77 OTextConnectionHelper( Window* pParent, const short _nAvailableSections ); 78 virtual ~OTextConnectionHelper(); 79 80 private: 81 FixedText m_aFTExtensionHeader; 82 RadioButton m_aRBAccessTextFiles; 83 RadioButton m_aRBAccessCSVFiles; 84 RadioButton m_aRBAccessOtherFiles; 85 Edit m_aETOwnExtension; 86 FixedText m_aFTExtensionExample; 87 FixedLine m_aLineFormat; 88 FixedText m_aFieldSeparatorLabel; 89 ComboBox m_aFieldSeparator; 90 FixedText m_aTextSeparatorLabel; 91 ComboBox m_aTextSeparator; 92 FixedText m_aDecimalSeparatorLabel; 93 ComboBox m_aDecimalSeparator; 94 FixedText m_aThousandsSeparatorLabel; 95 ComboBox m_aThousandsSeparator; 96 CheckBox m_aRowHeader; 97 FixedLine m_aCharSetHeader; 98 FixedText m_aCharSetLabel; 99 CharSetListBox m_aCharSet; 100 String m_aFieldSeparatorList; 101 String m_aTextSeparatorList; 102 String m_aTextNone; 103 String m_aOldExtension; 104 Link m_aGetExtensionHandler; /// to be called if a new type is selected 105 106 short m_nAvailableSections; 107 108 protected: callModifiedHdl() const109 void callModifiedHdl() const { if (m_aModifiedHandler.IsSet()) m_aModifiedHandler.Call((void*)this); } getControlModifiedLink()110 Link getControlModifiedLink() { return LINK(this, OTextConnectionHelper, OnControlModified); } 111 DECL_LINK(OnSetExtensionHdl,RadioButton*); 112 DECL_LINK(OnControlModified,Control*); 113 DECL_LINK(OnEditModified,Edit*); 114 115 private: 116 String GetSeparator( const ComboBox& rBox, const String& rList ); 117 void SetSeparator( ComboBox& rBox, const String& rList, const String& rVal ); 118 void SetExtension(const String& _rVal); 119 120 121 public: 122 void implInitControls(const SfxItemSet& _rSet, sal_Bool _bValid); 123 void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 124 void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); SetClickHandler(const Link & _rHandler)125 void SetClickHandler(const Link& _rHandler) { m_aGetExtensionHandler = _rHandler; } 126 String GetExtension(); 127 sal_Bool FillItemSet( SfxItemSet& rSet, const sal_Bool bChangedSomething ); 128 sal_Bool prepareLeave(); 129 }; 130 131 //......................................................................... 132 } // namespace dbaui 133 //......................................................................... 134 135 #endif // DBAUI_DBWIZ2_HXX 136 137