1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "textconnectionsettings.hxx"
31 #include "TextConnectionHelper.hxx"
32 #include "dbu_resource.hrc"
33 #include "moduledbu.hxx"
34 #include "dsitems.hxx"
35 #include "dbustrings.hrc"
37 /** === begin UNO includes === **/
38 /** === end UNO includes === **/
40 #include <vcl/msgbox.hxx>
42 //........................................................................
45 //........................................................................
47 /** === begin UNO using === **/
48 /** === end UNO using === **/
50 //====================================================================
51 //= TextConnectionSettingsDialog
52 //====================================================================
53 //--------------------------------------------------------------------
54 TextConnectionSettingsDialog::TextConnectionSettingsDialog( Window
* _pParent
, SfxItemSet
& _rItems
)
55 :ModalDialog( _pParent
, ModuleRes( DLG_TEXT_CONNECTION_SETTINGS
) )
56 ,m_aOK( this, ModuleRes( 1 ) )
57 ,m_aCancel( this, ModuleRes( 1 ) )
60 m_pTextConnectionHelper
.reset( new OTextConnectionHelper( this, TC_HEADER
| TC_SEPARATORS
| TC_CHARSET
) );
63 m_aOK
.SetClickHdl( LINK( this, TextConnectionSettingsDialog
, OnOK
) );
66 //--------------------------------------------------------------------
67 TextConnectionSettingsDialog::~TextConnectionSettingsDialog()
71 //--------------------------------------------------------------------
72 void TextConnectionSettingsDialog::bindItemStorages( SfxItemSet
& _rSet
, PropertyValues
& _rValues
)
74 _rValues
[ PROPERTY_ID_HEADER_LINE
].reset( new SetItemPropertyStorage( _rSet
, DSID_TEXTFILEHEADER
) );
75 _rValues
[ PROPERTY_ID_FIELD_DELIMITER
].reset( new SetItemPropertyStorage( _rSet
, DSID_FIELDDELIMITER
) );
76 _rValues
[ PROPERTY_ID_STRING_DELIMITER
].reset( new SetItemPropertyStorage( _rSet
, DSID_TEXTDELIMITER
) );
77 _rValues
[ PROPERTY_ID_DECIMAL_DELIMITER
].reset( new SetItemPropertyStorage( _rSet
, DSID_DECIMALDELIMITER
) );
78 _rValues
[ PROPERTY_ID_THOUSAND_DELIMITER
].reset( new SetItemPropertyStorage( _rSet
, DSID_THOUSANDSDELIMITER
) );
79 _rValues
[ PROPERTY_ID_ENCODING
].reset( new SetItemPropertyStorage( _rSet
, DSID_CHARSET
) );
82 //--------------------------------------------------------------------
83 short TextConnectionSettingsDialog::Execute()
85 m_pTextConnectionHelper
->implInitControls( m_rItems
, sal_True
);
86 return ModalDialog::Execute();
89 //--------------------------------------------------------------------
90 IMPL_LINK( TextConnectionSettingsDialog
, OnOK
, PushButton
*, /*_pButton*/ )
92 if ( m_pTextConnectionHelper
->prepareLeave() )
94 sal_Bool bUnused
= sal_False
;
95 m_pTextConnectionHelper
->FillItemSet( m_rItems
, bUnused
);
103 //........................................................................
105 //........................................................................
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */