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 ************************************************************************/
28 #include "moduledbu.hxx"
30 #include "TextConnectionHelper.hxx"
32 #include "sqlmessage.hxx"
33 #include "dbu_dlg.hrc"
34 #include "dbu_resource.hrc"
35 #include "AutoControls.hrc"
37 #include <svl/itemset.hxx>
38 #include <svl/stritem.hxx>
39 #include <svl/eitem.hxx>
40 #include <svl/intitem.hxx>
41 #include "dsitems.hxx"
42 #include "dbfindex.hxx"
43 #include "dbaccess_helpid.hrc"
44 #include "localresaccess.hxx"
45 #include <vcl/msgbox.hxx>
46 #include <vcl/mnemonic.hxx>
47 #include <svl/cjkoptions.hxx>
48 #include <jvmaccess/virtualmachine.hxx>
49 #include <connectivity/CommonTools.hxx>
50 #include "DriverSettings.hxx"
51 #include "dbadmin.hxx"
52 #include <comphelper/string.hxx>
53 #include <comphelper/types.hxx>
55 #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
56 #include <com/sun/star/task/XInteractionHandler.hpp>
58 #include <svl/filenotation.hxx>
60 #include <unotools/localfilehelper.hxx>
61 #include <unotools/ucbhelper.hxx>
62 #include <ucbhelper/commandenvironment.hxx>
63 #include "finteraction.hxx"
65 #include "DBSetupConnectionPages.hxx"
67 #include <unotools/pathoptions.hxx>
69 #include <svtools/roadmapwizard.hxx>
75 //========================================================================
76 //= OTextConnectionPageSetup
77 //========================================================================
78 DBG_NAME(OTextConnectionHelper
)
79 //------------------------------------------------------------------------
80 OTextConnectionHelper::OTextConnectionHelper( Window
* pParent
, const short _nAvailableSections
)
81 :Control( pParent
, WB_DIALOGCONTROL
)
82 ,m_aFTExtensionHeader (this, ModuleRes(FT_AUTOEXTENSIONHEADER
))
83 ,m_aRBAccessTextFiles (this, ModuleRes(RB_AUTOACCESSCTEXTFILES
))
84 ,m_aRBAccessCSVFiles (this, ModuleRes(RB_AUTOACCESSCCSVFILES
))
85 ,m_aRBAccessOtherFiles (this, ModuleRes(RB_AUTOACCESSOTHERS
))
86 ,m_aETOwnExtension (this, ModuleRes(ET_AUTOOWNEXTENSION
))
87 ,m_aFTExtensionExample (this, ModuleRes(FT_AUTOOWNEXTENSIONAPPENDIX
))
88 ,m_aLineFormat (this, ModuleRes(FL_AUTOSEPARATOR2
))
89 ,m_aFieldSeparatorLabel (this, ModuleRes(FT_AUTOFIELDSEPARATOR
))
90 ,m_aFieldSeparator (this, ModuleRes(CM_AUTOFIELDSEPARATOR
))
91 ,m_aTextSeparatorLabel (this, ModuleRes(FT_AUTOTEXTSEPARATOR
))
92 ,m_aTextSeparator (this, ModuleRes(CM_AUTOTEXTSEPARATOR
))
93 ,m_aDecimalSeparatorLabel (this, ModuleRes(FT_AUTODECIMALSEPARATOR
))
94 ,m_aDecimalSeparator (this, ModuleRes(CM_AUTODECIMALSEPARATOR
))
95 ,m_aThousandsSeparatorLabel (this, ModuleRes(FT_AUTOTHOUSANDSSEPARATOR
))
96 ,m_aThousandsSeparator (this, ModuleRes(CM_AUTOTHOUSANDSSEPARATOR
))
97 ,m_aRowHeader (this, ModuleRes(CB_AUTOHEADER
))
98 ,m_aCharSetHeader (this, ModuleRes(FL_DATACONVERT
))
99 ,m_aCharSetLabel (this, ModuleRes(FT_CHARSET
))
100 ,m_aCharSet (this, ModuleRes(LB_CHARSET
))
101 ,m_aFieldSeparatorList (ModuleRes(STR_AUTOFIELDSEPARATORLIST
))
102 ,m_aTextSeparatorList (ModuleRes(STR_AUTOTEXTSEPARATORLIST
))
103 ,m_aTextNone (ModuleRes(STR_AUTOTEXT_FIELD_SEP_NONE
))
104 ,m_nAvailableSections( _nAvailableSections
)
106 DBG_CTOR(OTextConnectionHelper
,NULL
);
108 xub_StrLen nCnt
= comphelper::string::getTokenCount(m_aFieldSeparatorList
, '\t');
111 for( i
= 0 ; i
< nCnt
; i
+= 2 )
112 m_aFieldSeparator
.InsertEntry( m_aFieldSeparatorList
.GetToken( i
, '\t' ) );
114 nCnt
= comphelper::string::getTokenCount(m_aTextSeparatorList
, '\t');
115 for( i
=0 ; i
<nCnt
; i
+=2 )
116 m_aTextSeparator
.InsertEntry( m_aTextSeparatorList
.GetToken( i
, '\t' ) );
117 m_aTextSeparator
.InsertEntry(m_aTextNone
);
119 // set the modify handlers
120 m_aFieldSeparator
.SetUpdateDataHdl(getControlModifiedLink());
121 m_aFieldSeparator
.SetSelectHdl(getControlModifiedLink());
122 m_aTextSeparator
.SetUpdateDataHdl(getControlModifiedLink());
123 m_aTextSeparator
.SetSelectHdl(getControlModifiedLink());
124 m_aCharSet
.SetSelectHdl(getControlModifiedLink());
126 m_aFieldSeparator
.SetModifyHdl(getControlModifiedLink());
127 m_aTextSeparator
.SetModifyHdl(getControlModifiedLink());
128 m_aDecimalSeparator
.SetModifyHdl(getControlModifiedLink());
129 m_aThousandsSeparator
.SetModifyHdl(getControlModifiedLink());
130 m_aETOwnExtension
.SetModifyHdl(LINK(this, OTextConnectionHelper
, OnEditModified
));
131 m_aRBAccessTextFiles
.SetToggleHdl(LINK(this, OTextConnectionHelper
, OnSetExtensionHdl
));
132 m_aRBAccessCSVFiles
.SetToggleHdl(LINK(this, OTextConnectionHelper
, OnSetExtensionHdl
));
133 m_aRBAccessOtherFiles
.SetToggleHdl(LINK(this, OTextConnectionHelper
, OnSetExtensionHdl
));
134 m_aRBAccessCSVFiles
.Check(sal_True
);
136 struct SectionDescriptor
139 Window
* pFirstControl
;
141 { TC_EXTENSION
, &m_aFTExtensionHeader
},
142 { TC_SEPARATORS
, &m_aLineFormat
},
143 { TC_HEADER
, &m_aRowHeader
},
144 { TC_CHARSET
, &m_aCharSetHeader
},
148 for ( size_t section
=0; section
< sizeof( aSections
) / sizeof( aSections
[0] ) - 1; ++section
)
150 if ( ( m_nAvailableSections
& aSections
[section
].nFlag
) != 0 )
152 // the section is visible, no need to do anything here
156 Window
* pThisSection
= aSections
[section
].pFirstControl
;
157 Window
* pNextSection
= aSections
[section
+1].pFirstControl
;
159 // hide all elements from this section
160 Window
* pControl
= pThisSection
;
161 while ( ( pControl
!= pNextSection
) && pControl
)
163 Window
* pRealWindow
= pControl
->GetWindow( WINDOW_CLIENT
);
164 #if OSL_DEBUG_LEVEL > 0
165 String
sWindowText( pRealWindow
->GetText() );
169 pControl
= pControl
->GetWindow( WINDOW_NEXT
);
172 // move all controls in following sections up
175 const long nThisSectionStart
= pThisSection
->GetPosPixel().Y();
176 const long nNextSectionStart
= pNextSection
->GetPosPixel().Y();
177 const long nMoveOffset( nThisSectionStart
- nNextSectionStart
);
180 Point aPos
= pControl
->GetPosPixel();
181 aPos
.Move( 0, nMoveOffset
);
182 pControl
->SetPosPixel( aPos
);
183 pControl
= pControl
->GetWindow( WINDOW_NEXT
);
187 Rectangle aControlRectUnion
;
188 for ( Window
* pControl
= aSections
[0].pFirstControl
;
190 pControl
= pControl
->GetWindow( WINDOW_NEXT
)
193 aControlRectUnion
= aControlRectUnion
.Union( Rectangle( pControl
->GetPosPixel(), pControl
->GetSizePixel() ) );
196 // need some adjustments to the positions, since the resource-specified
197 // positions for the control were relative to *our* parent, while by now
198 // the controls have |this| as parent.
200 // first, move ourself to the upper left of the area occupied by all controls
201 SetPosPixel( aControlRectUnion
.TopLeft() );
203 // then, compensate in the control positions, by moving them the up/left
204 for ( Window
* pControl
= aSections
[0].pFirstControl
;
206 pControl
= pControl
->GetWindow( WINDOW_NEXT
)
209 Point
aPos( pControl
->GetPosPixel() );
210 aPos
.Move( -aControlRectUnion
.Left(), -aControlRectUnion
.Top() );
211 pControl
->SetPosPixel( aPos
);
213 // while we are here ... the controls should not have an own background
214 // (this would not be needed when our outer dialog were also the parent
216 pControl
->SetBackground();
219 // now, change our own size so all controls fit
220 SetSizePixel( aControlRectUnion
.GetSize() );
226 // -----------------------------------------------------------------------
227 OTextConnectionHelper::~OTextConnectionHelper()
230 DBG_DTOR(OTextConnectionHelper
,NULL
);
234 // -----------------------------------------------------------------------
235 IMPL_LINK(OTextConnectionHelper
, OnControlModified
, Control
*, /*EMPTYARG*/)
241 // -----------------------------------------------------------------------
242 IMPL_LINK(OTextConnectionHelper
, OnEditModified
, Edit
*, /*_pEdit*/)
244 m_aGetExtensionHandler
.Call(this);
249 IMPL_LINK(OTextConnectionHelper
, OnSetExtensionHdl
, RadioButton
*, /*_pRadioButton*/)
251 sal_Bool bDoEnable
= m_aRBAccessOtherFiles
.IsChecked();
252 m_aETOwnExtension
.Enable(bDoEnable
);
253 m_aFTExtensionExample
.Enable(bDoEnable
);
254 m_aGetExtensionHandler
.Call(this);
259 // -----------------------------------------------------------------------
260 void OTextConnectionHelper::fillControls(::std::vector
< ISaveValueWrapper
* >& _rControlList
)
262 _rControlList
.push_back(new OSaveValueWrapper
<ComboBox
>(&m_aFieldSeparator
));
263 _rControlList
.push_back(new OSaveValueWrapper
<ComboBox
>(&m_aTextSeparator
));
264 _rControlList
.push_back(new OSaveValueWrapper
<ComboBox
>(&m_aDecimalSeparator
));
265 _rControlList
.push_back(new OSaveValueWrapper
<ComboBox
>(&m_aThousandsSeparator
));
266 _rControlList
.push_back(new OSaveValueWrapper
<CheckBox
>(&m_aRowHeader
));
267 _rControlList
.push_back(new OSaveValueWrapper
<ListBox
>(&m_aCharSet
));
269 // -----------------------------------------------------------------------
270 void OTextConnectionHelper::fillWindows(::std::vector
< ISaveValueWrapper
* >& _rControlList
)
272 _rControlList
.push_back(new ODisableWrapper
<FixedText
>(&m_aFieldSeparatorLabel
));
273 _rControlList
.push_back(new ODisableWrapper
<FixedText
>(&m_aTextSeparatorLabel
));
274 _rControlList
.push_back(new ODisableWrapper
<FixedText
>(&m_aDecimalSeparatorLabel
));
275 _rControlList
.push_back(new ODisableWrapper
<FixedText
>(&m_aThousandsSeparatorLabel
));
276 _rControlList
.push_back(new ODisableWrapper
<FixedLine
>(&m_aCharSetHeader
));
277 _rControlList
.push_back(new ODisableWrapper
<FixedText
>(&m_aCharSetLabel
));
278 _rControlList
.push_back(new ODisableWrapper
<ListBox
>(&m_aCharSet
));
281 // -----------------------------------------------------------------------
282 void OTextConnectionHelper::implInitControls(const SfxItemSet
& _rSet
, sal_Bool _bValid
)
287 SFX_ITEMSET_GET( _rSet
, pDelItem
, SfxStringItem
, DSID_FIELDDELIMITER
, sal_True
);
288 SFX_ITEMSET_GET( _rSet
, pStrItem
, SfxStringItem
, DSID_TEXTDELIMITER
, sal_True
);
289 SFX_ITEMSET_GET( _rSet
, pDecdelItem
, SfxStringItem
, DSID_DECIMALDELIMITER
, sal_True
);
290 SFX_ITEMSET_GET( _rSet
, pThodelItem
, SfxStringItem
, DSID_THOUSANDSDELIMITER
, sal_True
);
291 SFX_ITEMSET_GET( _rSet
, pExtensionItem
, SfxStringItem
, DSID_TEXTFILEEXTENSION
, sal_True
);
292 SFX_ITEMSET_GET( _rSet
, pCharsetItem
, SfxStringItem
, DSID_CHARSET
, sal_True
);
294 if ( ( m_nAvailableSections
& TC_EXTENSION
) != 0 )
296 m_aOldExtension
= pExtensionItem
->GetValue();
297 SetExtension( m_aOldExtension
);
300 if ( ( m_nAvailableSections
& TC_HEADER
) != 0 )
302 SFX_ITEMSET_GET( _rSet
, pHdrItem
, SfxBoolItem
, DSID_TEXTFILEHEADER
, sal_True
);
303 m_aRowHeader
.Check( pHdrItem
->GetValue() );
306 if ( ( m_nAvailableSections
& TC_SEPARATORS
) != 0 )
308 SetSeparator( m_aFieldSeparator
, m_aFieldSeparatorList
, pDelItem
->GetValue() );
309 SetSeparator( m_aTextSeparator
, m_aTextSeparatorList
, pStrItem
->GetValue() );
310 m_aDecimalSeparator
.SetText( pDecdelItem
->GetValue() );
311 m_aThousandsSeparator
.SetText( pThodelItem
->GetValue() );
314 if ( ( m_nAvailableSections
& TC_CHARSET
) != 0 )
316 m_aCharSet
.SelectEntryByIanaName( pCharsetItem
->GetValue() );
322 // -----------------------------------------------------------------------
323 sal_Bool
OTextConnectionHelper::prepareLeave()
325 LocalResourceAccess
aStringResAccess(PAGE_TEXT
, RSC_TABPAGE
);
326 // for accessing the strings which are local to our own resource block
327 String sExtension
= GetExtension();
329 Control
* pErrorWin
= NULL
;
330 String
aDelText(m_aFieldSeparator
.GetText());
332 { // Kein FeldTrenner
333 aErrorText
= String(ModuleRes(STR_AUTODELIMITER_MISSING
));
334 aErrorText
.SearchAndReplaceAscii("#1",m_aFieldSeparatorLabel
.GetText());
335 pErrorWin
= &m_aFieldSeparator
;
337 else if (!m_aDecimalSeparator
.GetText().Len())
338 { // kein Decimaltrenner
339 aErrorText
= String(ModuleRes(STR_AUTODELIMITER_MISSING
));
340 aErrorText
.SearchAndReplaceAscii("#1",m_aDecimalSeparatorLabel
.GetText());
341 pErrorWin
= &m_aDecimalSeparator
;
343 else if (m_aTextSeparator
.GetText() == m_aFieldSeparator
.GetText())
344 { // Feld und TextTrenner duerfen nicht gleich sein
345 aErrorText
= String(ModuleRes(STR_AUTODELIMITER_MUST_DIFFER
));
346 aErrorText
.SearchAndReplaceAscii("#1",m_aTextSeparatorLabel
.GetText());
347 aErrorText
.SearchAndReplaceAscii("#2",m_aFieldSeparatorLabel
.GetText());
348 pErrorWin
= &m_aTextSeparator
;
350 else if (m_aDecimalSeparator
.GetText() == m_aThousandsSeparator
.GetText())
351 { // Tausender und DecimalTrenner duerfen nicht gleich sein
352 aErrorText
= String(ModuleRes(STR_AUTODELIMITER_MUST_DIFFER
));
353 aErrorText
.SearchAndReplaceAscii("#1",m_aDecimalSeparatorLabel
.GetText());
354 aErrorText
.SearchAndReplaceAscii("#2",m_aThousandsSeparatorLabel
.GetText());
355 pErrorWin
= &m_aDecimalSeparator
;
357 else if (m_aFieldSeparator
.GetText() == m_aThousandsSeparator
.GetText())
358 { // Tausender und FeldTrenner duerfen nicht gleich sein
359 aErrorText
= String(ModuleRes(STR_AUTODELIMITER_MUST_DIFFER
));
360 aErrorText
.SearchAndReplaceAscii("#1",m_aFieldSeparatorLabel
.GetText());
361 aErrorText
.SearchAndReplaceAscii("#2",m_aThousandsSeparatorLabel
.GetText());
362 pErrorWin
= &m_aFieldSeparator
;
364 else if (m_aFieldSeparator
.GetText() == m_aDecimalSeparator
.GetText())
365 { // Zehner und FeldTrenner duerfen nicht gleich sein
366 aErrorText
= String(ModuleRes(STR_AUTODELIMITER_MUST_DIFFER
));
367 aErrorText
.SearchAndReplaceAscii("#1",m_aFieldSeparatorLabel
.GetText());
368 aErrorText
.SearchAndReplaceAscii("#2",m_aDecimalSeparatorLabel
.GetText());
369 pErrorWin
= &m_aFieldSeparator
;
371 else if (m_aTextSeparator
.GetText() == m_aThousandsSeparator
.GetText())
372 { // Tausender und TextTrenner duerfen nicht gleich sein
373 aErrorText
= String(ModuleRes(STR_AUTODELIMITER_MUST_DIFFER
));
374 aErrorText
.SearchAndReplaceAscii("#1",m_aTextSeparatorLabel
.GetText());
375 aErrorText
.SearchAndReplaceAscii("#2",m_aThousandsSeparatorLabel
.GetText());
376 pErrorWin
= &m_aTextSeparator
;
378 else if (m_aTextSeparator
.GetText() == m_aDecimalSeparator
.GetText())
379 { // Zehner und TextTrenner duerfen nicht gleich sein
380 aErrorText
= String(ModuleRes(STR_AUTODELIMITER_MUST_DIFFER
));
381 aErrorText
.SearchAndReplaceAscii("#1",m_aTextSeparatorLabel
.GetText());
382 aErrorText
.SearchAndReplaceAscii("#2",m_aDecimalSeparatorLabel
.GetText());
383 pErrorWin
= &m_aTextSeparator
;
385 else if ((sExtension
.Search('*') != STRING_NOTFOUND
) || (sExtension
.Search('?') != STRING_NOTFOUND
))
387 aErrorText
= String(ModuleRes(STR_AUTONO_WILDCARDS
));
388 aErrorText
.SearchAndReplaceAscii("#1",sExtension
);
389 pErrorWin
= &m_aETOwnExtension
;
393 ErrorBox(NULL
, WB_OK
, MnemonicGenerator::EraseAllMnemonicChars( aErrorText
)).Execute();
394 pErrorWin
->GrabFocus();
399 // -----------------------------------------------------------------------
400 sal_Bool
OTextConnectionHelper::FillItemSet( SfxItemSet
& rSet
, const sal_Bool _bChangedSomething
)
402 sal_Bool bChangedSomething
= _bChangedSomething
;
404 if ( ( m_nAvailableSections
& TC_EXTENSION
) != 0 )
406 String sExtension
= GetExtension();
407 if( !m_aOldExtension
.Equals( sExtension
) )
409 rSet
.Put( SfxStringItem( DSID_TEXTFILEEXTENSION
, sExtension
) );
410 bChangedSomething
= sal_True
;
414 if ( ( m_nAvailableSections
& TC_HEADER
) != 0 )
416 if( (m_aRowHeader
.GetState() != m_aRowHeader
.GetSavedValue()) )
418 rSet
.Put(SfxBoolItem(DSID_TEXTFILEHEADER
, m_aRowHeader
.IsChecked()));
419 bChangedSomething
= sal_True
;
423 if ( ( m_nAvailableSections
& TC_SEPARATORS
) != 0 )
425 if( m_aFieldSeparator
.GetText() != m_aFieldSeparator
.GetSavedValue() )
427 rSet
.Put( SfxStringItem(DSID_FIELDDELIMITER
, GetSeparator( m_aFieldSeparator
, m_aFieldSeparatorList
) ) );
428 bChangedSomething
= sal_True
;
430 if( m_aTextSeparator
.GetText() != m_aTextSeparator
.GetSavedValue() )
432 rSet
.Put( SfxStringItem(DSID_TEXTDELIMITER
, GetSeparator( m_aTextSeparator
, m_aTextSeparatorList
) ) );
433 bChangedSomething
= sal_True
;
436 if( m_aDecimalSeparator
.GetText() != m_aDecimalSeparator
.GetSavedValue() )
438 rSet
.Put( SfxStringItem(DSID_DECIMALDELIMITER
, m_aDecimalSeparator
.GetText().Copy(0, 1) ) );
439 bChangedSomething
= sal_True
;
441 if( m_aThousandsSeparator
.GetText() != m_aThousandsSeparator
.GetSavedValue() )
443 rSet
.Put( SfxStringItem(DSID_THOUSANDSDELIMITER
, m_aThousandsSeparator
.GetText().Copy(0,1) ) );
444 bChangedSomething
= sal_True
;
448 if ( ( m_nAvailableSections
& TC_CHARSET
) != 0 )
450 if ( m_aCharSet
.StoreSelectedCharSet( rSet
, DSID_CHARSET
) )
451 bChangedSomething
= sal_True
;
454 return bChangedSomething
;
458 void OTextConnectionHelper::SetExtension(const String
& _rVal
)
460 if (_rVal
.EqualsAscii("txt"))
461 m_aRBAccessTextFiles
.Check(sal_True
);
462 else if (_rVal
.EqualsAscii( "csv" ))
463 m_aRBAccessCSVFiles
.Check(sal_True
);
466 m_aRBAccessOtherFiles
.Check(sal_True
);
467 m_aFTExtensionExample
.SetText(_rVal
);
472 String
OTextConnectionHelper::GetExtension()
475 if (m_aRBAccessTextFiles
.IsChecked())
476 sExtension
= String::CreateFromAscii("txt");
477 else if (m_aRBAccessCSVFiles
.IsChecked())
478 sExtension
= String::CreateFromAscii("csv");
481 sExtension
= m_aETOwnExtension
.GetText();
482 if ( sExtension
.GetToken(0,'.').Equals('*') )
483 sExtension
.Erase(0,2);
489 //------------------------------------------------------------------------
490 String
OTextConnectionHelper::GetSeparator( const ComboBox
& rBox
, const String
& rList
)
492 sal_Unicode nTok
= '\t';
493 xub_StrLen
nPos(rBox
.GetEntryPos( rBox
.GetText() ));
495 if( nPos
== COMBOBOX_ENTRY_NOTFOUND
)
496 return rBox
.GetText().Copy(0);
498 if ( !( &m_aTextSeparator
== &rBox
&& nPos
== (rBox
.GetEntryCount()-1) ) )
500 static_cast< sal_Unicode
>(
501 rList
.GetToken(((nPos
*2)+1), nTok
).ToInt32()));
502 // somewhat strange ... translates for instance an "32" into " "
506 //------------------------------------------------------------------------
507 void OTextConnectionHelper::SetSeparator( ComboBox
& rBox
, const String
& rList
, const String
& rVal
)
510 xub_StrLen
nCnt(comphelper::string::getTokenCount(rList
, nTok
));
513 for( i
=0 ; i
<nCnt
; i
+=2 )
516 static_cast< sal_Unicode
>(
517 rList
.GetToken( (i
+1), nTok
).ToInt32()));
521 rBox
.SetText( rList
.GetToken( i
, nTok
) );
528 if ( &m_aTextSeparator
== &rBox
&& !rVal
.Len() )
529 rBox
.SetText(m_aTextNone
);
531 rBox
.SetText( rVal
.Copy(0, 1) );
535 //.........................................................................
537 //.........................................................................
539 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */