1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: textconnectionsettings.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #include "textconnectionsettings.hxx"
35 #include "TextConnectionHelper.hxx"
36 #include "dbu_resource.hrc"
37 #include "moduledbu.hxx"
38 #include "dsitems.hxx"
39 #include "dbustrings.hrc"
41 /** === begin UNO includes === **/
42 /** === end UNO includes === **/
44 #include <vcl/msgbox.hxx>
46 //........................................................................
49 //........................................................................
51 /** === begin UNO using === **/
52 /** === end UNO using === **/
54 //====================================================================
55 //= TextConnectionSettingsDialog
56 //====================================================================
57 //--------------------------------------------------------------------
58 TextConnectionSettingsDialog::TextConnectionSettingsDialog( Window
* _pParent
, SfxItemSet
& _rItems
)
59 :ModalDialog( _pParent
, ModuleRes( DLG_TEXT_CONNECTION_SETTINGS
) )
60 ,m_aOK( this, ModuleRes( 1 ) )
61 ,m_aCancel( this, ModuleRes( 1 ) )
64 m_pTextConnectionHelper
.reset( new OTextConnectionHelper( this, TC_HEADER
| TC_SEPARATORS
| TC_CHARSET
) );
67 m_aOK
.SetClickHdl( LINK( this, TextConnectionSettingsDialog
, OnOK
) );
70 //--------------------------------------------------------------------
71 TextConnectionSettingsDialog::~TextConnectionSettingsDialog()
75 //--------------------------------------------------------------------
76 void TextConnectionSettingsDialog::bindItemStorages( SfxItemSet
& _rSet
, PropertyValues
& _rValues
)
78 _rValues
[ PROPERTY_ID_HEADER_LINE
].reset( new SetItemPropertyStorage( _rSet
, DSID_TEXTFILEHEADER
) );
79 _rValues
[ PROPERTY_ID_FIELD_DELIMITER
].reset( new SetItemPropertyStorage( _rSet
, DSID_FIELDDELIMITER
) );
80 _rValues
[ PROPERTY_ID_STRING_DELIMITER
].reset( new SetItemPropertyStorage( _rSet
, DSID_TEXTDELIMITER
) );
81 _rValues
[ PROPERTY_ID_DECIMAL_DELIMITER
].reset( new SetItemPropertyStorage( _rSet
, DSID_DECIMALDELIMITER
) );
82 _rValues
[ PROPERTY_ID_THOUSAND_DELIMITER
].reset( new SetItemPropertyStorage( _rSet
, DSID_THOUSANDSDELIMITER
) );
83 _rValues
[ PROPERTY_ID_ENCODING
].reset( new SetItemPropertyStorage( _rSet
, DSID_CHARSET
) );
86 //--------------------------------------------------------------------
87 short TextConnectionSettingsDialog::Execute()
89 m_pTextConnectionHelper
->implInitControls( m_rItems
, sal_True
);
90 return ModalDialog::Execute();
93 //--------------------------------------------------------------------
94 IMPL_LINK( TextConnectionSettingsDialog
, OnOK
, PushButton
*, /*_pButton*/ )
96 if ( m_pTextConnectionHelper
->prepareLeave() )
98 sal_Bool bUnused
= sal_False
;
99 m_pTextConnectionHelper
->FillItemSet( m_rItems
, bUnused
);
107 //........................................................................
109 //........................................................................