From 538ba011d7b598737c898cfcce1e0d7b00b40c84 Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Thu, 21 Feb 2013 21:11:32 +0100 Subject: rewrite import CSV dialog to WidgetLayout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifa674dc3cf14c9633be10b2fb7b59fea55a6a2e4 Reviewed-on: https://gerrit.libreoffice.org/2332 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/AllLangResTarget_sc.mk | 1 - sc/UI_scalc.mk | 1 + sc/source/ui/dbgui/asciiopt.src | 268 -------------- sc/source/ui/dbgui/scuiasciiopt.cxx | 304 ++++++++-------- sc/source/ui/inc/scuiasciiopt.hxx | 52 ++- sc/uiconfig/scalc/ui/textimportcsv.ui | 633 ++++++++++++++++++++++++++++++++++ 6 files changed, 801 insertions(+), 458 deletions(-) delete mode 100644 sc/source/ui/dbgui/asciiopt.src create mode 100644 sc/uiconfig/scalc/ui/textimportcsv.ui (limited to 'sc') diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index df0d318fe6e0..e92e18c8c824 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -93,7 +93,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ sc/source/ui/pagedlg/hfedtdlg.src \ sc/source/ui/styleui/scstyles.src \ sc/source/ui/styleui/styledlg.src \ - sc/source/ui/dbgui/asciiopt.src \ sc/source/ui/dbgui/pivot.src \ sc/source/ui/dbgui/dpgroupdlg.src \ sc/source/ui/dbgui/consdlg.src \ diff --git a/sc/UI_scalc.mk b/sc/UI_scalc.mk index c10f2b875a7e..990fb2678a73 100644 --- a/sc/UI_scalc.mk +++ b/sc/UI_scalc.mk @@ -17,6 +17,7 @@ $(eval $(call gb_UI_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/sortkey \ sc/uiconfig/scalc/ui/sortoptionspage \ sc/uiconfig/scalc/ui/textimportoptions \ + sc/uiconfig/scalc/ui/textimportcsv \ )) # vim: set noet sw=4 ts=4: diff --git a/sc/source/ui/dbgui/asciiopt.src b/sc/source/ui/dbgui/asciiopt.src deleted file mode 100644 index f03c1ce26aaf..000000000000 --- a/sc/source/ui/dbgui/asciiopt.src +++ /dev/null @@ -1,268 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "asciiopt.hrc" - -ModalDialog RID_SCDLG_ASCII -{ - HelpID = "sc:ModalDialog:RID_SCDLG_ASCII"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 320 , 305 ) ; - Text [ en-US ] = "Text Import" ; - Moveable = TRUE ; - - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 264 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 264 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 264 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - - FixedLine FL_FIELDOPT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Import" ; - }; - - FixedText FT_CHARSET - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Ch~aracter set" ; - }; - - ListBox LB_CHARSET - { - HelpID = "sc:ListBox:RID_SCDLG_ASCII:LB_CHARSET"; - Pos = MAP_APPFONT ( 76 , 14 ) ; - Size = MAP_APPFONT ( 130 , 61 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE; - }; - - FixedText FT_CUSTOMLANG - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Language" ; - }; - - ListBox LB_CUSTOMLANG - { - HelpID = "sc:ListBox:RID_SCDLG_ASCII:LB_CUSTOMLANG"; - Pos = MAP_APPFONT ( 76 , 30 ) ; - Size = MAP_APPFONT ( 130 , 61 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE; - }; - - FixedText FT_AT_ROW - { - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "From ro~w" ; - }; - - NumericField NF_AT_ROW - { - HelpID = "sc:NumericField:RID_SCDLG_ASCII:NF_AT_ROW"; - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 76 , 46 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - Minimum = 1 ; - }; - - FixedLine FL_SEPOPT - { - Pos = MAP_APPFONT ( 6 , 63 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Separator options" ; - }; - RadioButton RB_FIXED - { - HelpID = "sc:RadioButton:RID_SCDLG_ASCII:RB_FIXED"; - Pos = MAP_APPFONT ( 12 , 75 ) ; - Size = MAP_APPFONT ( 243 , 10 ) ; - Text [ en-US ] = "~Fixed width" ; - TabStop = TRUE ; - }; - RadioButton RB_SEPARATED - { - HelpID = "sc:RadioButton:RID_SCDLG_ASCII:RB_SEPARATED"; - Pos = MAP_APPFONT ( 12 , 89 ) ; - Size = MAP_APPFONT ( 243 , 10 ) ; - Text [ en-US ] = "~Separated by" ; - TabStop = TRUE ; - Check = TRUE ; - }; - - CheckBox CKB_TAB - { - HelpID = "sc:CheckBox:RID_SCDLG_ASCII:CKB_TAB"; - Pos = MAP_APPFONT ( 20 , 102 ) ; - Size = MAP_APPFONT ( 68 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Tab" ; - }; - CheckBox CKB_COMMA - { - HelpID = "sc:CheckBox:RID_SCDLG_ASCII:CKB_COMMA"; - Pos = MAP_APPFONT ( 92 , 102 ) ; - Size = MAP_APPFONT ( 68 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Comma" ; - }; - CheckBox CKB_OTHER - { - HelpID = "sc:CheckBox:RID_SCDLG_ASCII:CKB_OTHER"; - Pos = MAP_APPFONT ( 164 , 102 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Other" ; - }; - Edit ED_OTHER - { - HelpID = "sc:Edit:RID_SCDLG_ASCII:ED_OTHER"; - Border = TRUE ; - Pos = MAP_APPFONT ( 218 , 100 ) ; - Size = MAP_APPFONT ( 37 , 12 ) ; - TabStop = TRUE ; - MaxTextLength = 10 ; - }; - - CheckBox CKB_SEMICOLON - { - HelpID = "sc:CheckBox:RID_SCDLG_ASCII:CKB_SEMICOLON"; - Pos = MAP_APPFONT ( 20 , 115 ) ; - Size = MAP_APPFONT ( 68 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "S~emicolon" ; - }; - CheckBox CKB_SPACE - { - HelpID = "sc:CheckBox:RID_SCDLG_ASCII:CKB_SPACE"; - Pos = MAP_APPFONT ( 92 , 115 ) ; - Size = MAP_APPFONT ( 68 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "S~pace" ; - }; - - CheckBox CB_ASONCE - { - HelpID = "sc:CheckBox:RID_SCDLG_ASCII:CB_ASONCE"; - Pos = MAP_APPFONT ( 20 , 130 ) ; - Size = MAP_APPFONT ( 130 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Merge ~delimiters" ; - }; - - ComboBox CB_TEXTSEP - { - HelpID = "sc:ComboBox:RID_SCDLG_ASCII:CB_TEXTSEP"; - Pos = MAP_APPFONT ( 218 , 128 ) ; - Size = MAP_APPFONT ( 37 , 94 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_TEXTSEP - { - Pos = MAP_APPFONT ( 156 , 130 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Te~xt delimiter" ; - }; - - FixedLine FL_OTHER_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 146 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Other options" ; - }; - - CheckBox CB_QUOTED_AS_TEXT - { - HelpID = "sc:CheckBox:RID_SCDLG_ASCII:CB_QUOTED_AS_TEXT"; - Pos = MAP_APPFONT ( 12 , 158 ) ; - Size = MAP_APPFONT ( 130 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Quoted field as text" ; - }; - - CheckBox CB_DETECT_SPECIAL_NUMBER - { - HelpID = "sc:CheckBox:RID_SCDLG_ASCII:CB_DETECT_SPECIAL_NUMBER"; - Pos = MAP_APPFONT ( 12 , 171 ) ; - Size = MAP_APPFONT ( 130 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Detect special numbers" ; - }; - - FixedLine FL_WIDTH - { - Pos = MAP_APPFONT ( 6 , 187 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Fields" ; - }; - FixedText FT_TYPE - { - Pos = MAP_APPFONT ( 12 , 200 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Column t~ype"; - }; - ListBox LB_TYPE1 - { - HelpID = "sc:ListBox:RID_SCDLG_ASCII:LB_TYPE1"; - Pos = MAP_APPFONT ( 76 , 198 ) ; - Size = MAP_APPFONT ( 60 , 68 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - Control CTR_TABLEBOX - { - HelpId = HID_SC_ASCII_TABCTR ; - Border = TRUE ; - DialogControl = TRUE ; - Pos = MAP_APPFONT ( 12 , 216 ) ; - Size = MAP_APPFONT ( 243 , 82 ) ; - }; - - String STR_TEXTTOCOLUMNS - { - Text [ en-US ] = "Text to Columns" ; - }; -}; diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 9624fde0c13a..c84229a0d713 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -237,51 +237,14 @@ static void save_Separators( ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, SvStream* pInStream, ScImportAsciiCall eCall ) : - ModalDialog ( pParent, ScResId( RID_SCDLG_ASCII ) ), + ModalDialog (pParent, "TextImportCsvDialog", + "modules/scalc/ui/textimportcsv.ui"), mpDatStream ( pInStream ), mnStreamPos( pInStream ? pInStream->Tell() : 0 ), mpRowPosArray( NULL ), mnRowPosCount(0), - aFlFieldOpt ( this, ScResId( FL_FIELDOPT ) ), - aFtCharSet ( this, ScResId( FT_CHARSET ) ), - aLbCharSet ( this, ScResId( LB_CHARSET ) ), - aFtCustomLang( this, ScResId( FT_CUSTOMLANG ) ), - aLbCustomLang( this, ScResId( LB_CUSTOMLANG ) ), - - aFtRow ( this, ScResId( FT_AT_ROW ) ), - aNfRow ( this, ScResId( NF_AT_ROW ) ), - - aFlSepOpt ( this, ScResId( FL_SEPOPT ) ), - aRbFixed ( this, ScResId( RB_FIXED ) ), - aRbSeparated( this, ScResId( RB_SEPARATED ) ), - - aCkbTab ( this, ScResId( CKB_TAB ) ), - aCkbSemicolon(this, ScResId( CKB_SEMICOLON ) ), - aCkbComma ( this, ScResId( CKB_COMMA ) ), - aCkbSpace ( this, ScResId( CKB_SPACE ) ), - aCkbOther ( this, ScResId( CKB_OTHER ) ), - aEdOther ( this, ScResId( ED_OTHER ) ), - aCkbAsOnce ( this, ScResId( CB_ASONCE) ), - aFlOtherOpt ( this, ScResId( FL_OTHER_OPTIONS ) ), - - aFtTextSep ( this, ScResId( FT_TEXTSEP ) ), - aCbTextSep ( this, ScResId( CB_TEXTSEP ) ), - - aCkbQuotedAsText( this, ScResId(CB_QUOTED_AS_TEXT) ), - aCkbDetectNumber( this, ScResId(CB_DETECT_SPECIAL_NUMBER) ), - - aFlWidth ( this, ScResId( FL_WIDTH ) ), - aFtType ( this, ScResId( FT_TYPE ) ), - aLbType ( this, ScResId( LB_TYPE1 ) ), - - maTableBox ( this, ScResId( CTR_TABLEBOX ) ), - - aBtnOk ( this, ScResId( BTN_OK ) ), - aBtnCancel ( this, ScResId( BTN_CANCEL ) ), - aBtnHelp ( this, ScResId( BTN_HELP ) ), - aCharSetUser( ScResId( SCSTR_CHARSET_USER ) ), aColumnUser ( ScResId( SCSTR_COLUMN_USER ) ), aTextSepList( ScResId( SCSTR_TEXTSEP ) ), @@ -289,7 +252,28 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) ), meCall(eCall) { - FreeResource(); + get(pFtCharSet, "textcharset"); + get(pLbCharSet, "charset"); + get(pFtCustomLang, "textlanguage"); + get(pLbCustomLang, "language"); + get(pFtRow, "textfromrow"); + get(pNfRow, "fromrow"); + get(pRbFixed, "tofixedwidth"); + get(pRbSeparated, "toseparatedby"); + get(pCkbTab, "tab"); + get(pCkbSemicolon, "semicolon"); + get(pCkbComma, "comma"); + get(pCkbSpace, "space"); + get(pCkbOther, "other"); + get(pEdOther, "inputother"); + get(pCkbAsOnce, "mergedelimiters"); + get(pFtTextSep, "texttextdelimiter"); + get(pCbTextSep, "textdelimiter"); + get(pCkbQuotedAsText, "quotedfieldastext"); + get(pCkbDetectNumber, "detectspecialnumbers"); + get(pFtType, "textcolumntype"); + get(pLbType, "columntype"); + get(mpTableBox, "scrolledwindowcolumntype"); String aName = GetText(); switch (meCall) @@ -321,15 +305,15 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, maFieldSeparators = String(sFieldSeparators); if( bMergeDelimiters ) - aCkbAsOnce.Check(); + pCkbAsOnce->Check(); if (bQuotedFieldAsText) - aCkbQuotedAsText.Check(); + pCkbQuotedAsText->Check(); if (bDetectSpecialNum) - aCkbDetectNumber.Check(); + pCkbDetectNumber->Check(); if( bFixedWidth ) - aRbFixed.Check(); + pRbFixed->Check(); if( nFromRow != 1 ) - aNfRow.SetValue( nFromRow ); + pNfRow->SetValue( nFromRow ); // Set Separators in the dialog from maFieldSeparators (empty are not set) SetSeparators(); @@ -381,90 +365,90 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, mnStreamPos = mpDatStream->Tell(); } - aNfRow.SetModifyHdl( LINK( this, ScImportAsciiDlg, FirstRowHdl ) ); + pNfRow->SetModifyHdl( LINK( this, ScImportAsciiDlg, FirstRowHdl ) ); // *** Separator characters *** - lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep ); - aCbTextSep.SetText( sTextSeparators ); + lcl_FillCombo( *pCbTextSep, aTextSepList, mcTextSep ); + pCbTextSep->SetText( sTextSeparators ); Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl ); - aCbTextSep.SetSelectHdl( aSeparatorHdl ); - aCbTextSep.SetModifyHdl( aSeparatorHdl ); - aCkbTab.SetClickHdl( aSeparatorHdl ); - aCkbSemicolon.SetClickHdl( aSeparatorHdl ); - aCkbComma.SetClickHdl( aSeparatorHdl ); - aCkbAsOnce.SetClickHdl( aSeparatorHdl ); - aCkbQuotedAsText.SetClickHdl( aSeparatorHdl ); - aCkbDetectNumber.SetClickHdl( aSeparatorHdl ); - aCkbSpace.SetClickHdl( aSeparatorHdl ); - aCkbOther.SetClickHdl( aSeparatorHdl ); - aEdOther.SetModifyHdl( aSeparatorHdl ); + pCbTextSep->SetSelectHdl( aSeparatorHdl ); + pCbTextSep->SetModifyHdl( aSeparatorHdl ); + pCkbTab->SetClickHdl( aSeparatorHdl ); + pCkbSemicolon->SetClickHdl( aSeparatorHdl ); + pCkbComma->SetClickHdl( aSeparatorHdl ); + pCkbAsOnce->SetClickHdl( aSeparatorHdl ); + pCkbQuotedAsText->SetClickHdl( aSeparatorHdl ); + pCkbDetectNumber->SetClickHdl( aSeparatorHdl ); + pCkbSpace->SetClickHdl( aSeparatorHdl ); + pCkbOther->SetClickHdl( aSeparatorHdl ); + pEdOther->SetModifyHdl( aSeparatorHdl ); // *** text encoding ListBox *** // all encodings allowed, including Unicode, but subsets are excluded - aLbCharSet.FillFromTextEncodingTable( sal_True ); + pLbCharSet->FillFromTextEncodingTable( sal_True ); // Insert one "SYSTEM" entry for compatibility in AsciiOptions and system // independent document linkage. - aLbCharSet.InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, aCharSetUser ); - aLbCharSet.SelectTextEncoding( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW ? + pLbCharSet->InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, aCharSetUser ); + pLbCharSet->SelectTextEncoding( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW ? osl_getThreadTextEncoding() : ePreselectUnicode ); if( nCharSet >= 0 && ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW ) - aLbCharSet.SelectEntryPos( static_cast(nCharSet) ); + pLbCharSet->SelectEntryPos( static_cast(nCharSet) ); SetSelectedCharSet(); - aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) ); + pLbCharSet->SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) ); - aLbCustomLang.SetLanguageList( + pLbCustomLang->SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false); - aLbCustomLang.InsertLanguage(LANGUAGE_SYSTEM); - aLbCustomLang.SelectLanguage(static_cast(nLanguage), true); + pLbCustomLang->InsertLanguage(LANGUAGE_SYSTEM); + pLbCustomLang->SelectLanguage(static_cast(nLanguage), true); // *** column type ListBox *** xub_StrLen nCount = comphelper::string::getTokenCount(aColumnUser, ';'); for (xub_StrLen i=0; iInsertEntry( aColumnUser.GetToken( i ) ); - aLbType.SetSelectHdl( LINK( this, ScImportAsciiDlg, LbColTypeHdl ) ); - aFtType.Disable(); - aLbType.Disable(); + pLbType->SetSelectHdl( LINK( this, ScImportAsciiDlg, LbColTypeHdl ) ); + pFtType->Disable(); + pLbType->Disable(); // *** table box preview *** - maTableBox.Init(); - maTableBox.SetUpdateTextHdl( LINK( this, ScImportAsciiDlg, UpdateTextHdl ) ); - maTableBox.InitTypes( aLbType ); - maTableBox.SetColTypeHdl( LINK( this, ScImportAsciiDlg, ColTypeHdl ) ); + mpTableBox->Init(); + mpTableBox->SetUpdateTextHdl( LINK( this, ScImportAsciiDlg, UpdateTextHdl ) ); + mpTableBox->InitTypes( *pLbType ); + mpTableBox->SetColTypeHdl( LINK( this, ScImportAsciiDlg, ColTypeHdl ) ); - aRbSeparated.SetClickHdl( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) ); - aRbFixed.SetClickHdl( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) ); + pRbSeparated->SetClickHdl( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) ); + pRbFixed->SetClickHdl( LINK( this, ScImportAsciiDlg, RbSepFixHdl ) ); SetupSeparatorCtrls(); - RbSepFixHdl( &aRbFixed ); + RbSepFixHdl( pRbFixed ); UpdateVertical(); - maTableBox.Execute( CSVCMD_NEWCELLTEXTS ); + mpTableBox->Execute( CSVCMD_NEWCELLTEXTS ); - aEdOther.SetAccessibleName(aCkbOther.GetText()); - aEdOther.SetAccessibleRelationLabeledBy(&aCkbOther); + pEdOther->SetAccessibleName(pCkbOther->GetText()); + pEdOther->SetAccessibleRelationLabeledBy(pCkbOther); if (meCall == SC_TEXTTOCOLUMNS) { - aFtCharSet.Disable(); - aLbCharSet.Disable(); - aFtCustomLang.Disable(); - aLbCustomLang.SelectLanguage(LANGUAGE_SYSTEM); - aLbCustomLang.Disable(); - aFtRow.Disable(); - aNfRow.Disable(); + pFtCharSet->Disable(); + pLbCharSet->Disable(); + pFtCustomLang->Disable(); + pLbCustomLang->SelectLanguage(LANGUAGE_SYSTEM); + pLbCustomLang->Disable(); + pFtRow->Disable(); + pNfRow->Disable(); // Quoted field as text option is not used for text-to-columns mode. - aCkbQuotedAsText.Check(false); - aCkbQuotedAsText.Disable(); + pCkbQuotedAsText->Check(false); + pCkbQuotedAsText->Disable(); // Always detect special numbers for text-to-columns mode. - aCkbDetectNumber.Check(); - aCkbDetectNumber.Disable(); + pCkbDetectNumber->Check(); + pCkbDetectNumber->Disable(); } } @@ -483,7 +467,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, rtl::OUString &rText ) return false; bool bRet = true; - bool bFixed = aRbFixed.IsChecked(); + bool bFixed = pRbFixed->IsChecked(); if (!mpRowPosArray) mpRowPosArray = new sal_uLong[ASCIIDLG_MAXROWS + 2]; @@ -550,29 +534,29 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt ) { rOpt.SetCharSet( meCharSet ); rOpt.SetCharSetSystem( mbCharSetSystem ); - rOpt.SetLanguage(aLbCustomLang.GetSelectLanguage()); - rOpt.SetFixedLen( aRbFixed.IsChecked() ); - rOpt.SetStartRow( (long)aNfRow.GetValue() ); - maTableBox.FillColumnData( rOpt ); - if( aRbSeparated.IsChecked() ) + rOpt.SetLanguage(pLbCustomLang->GetSelectLanguage()); + rOpt.SetFixedLen( pRbFixed->IsChecked() ); + rOpt.SetStartRow( (long)pNfRow->GetValue() ); + mpTableBox->FillColumnData( rOpt ); + if( pRbSeparated->IsChecked() ) { rOpt.SetFieldSeps( GetSeparators() ); - rOpt.SetMergeSeps( aCkbAsOnce.IsChecked() ); - rOpt.SetTextSep( lcl_CharFromCombo( aCbTextSep, aTextSepList ) ); + rOpt.SetMergeSeps( pCkbAsOnce->IsChecked() ); + rOpt.SetTextSep( lcl_CharFromCombo( *pCbTextSep, aTextSepList ) ); } - rOpt.SetQuotedAsText(aCkbQuotedAsText.IsChecked()); - rOpt.SetDetectSpecialNumber(aCkbDetectNumber.IsChecked()); + rOpt.SetQuotedAsText(pCkbQuotedAsText->IsChecked()); + rOpt.SetDetectSpecialNumber(pCkbDetectNumber->IsChecked()); } void ScImportAsciiDlg::SaveParameters() { - save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), - aCkbQuotedAsText.IsChecked(), aCkbDetectNumber.IsChecked(), - aRbFixed.IsChecked(), - static_cast(aNfRow.GetValue()), - static_cast(aLbCharSet.GetSelectEntryPos()), - static_cast(aLbCustomLang.GetSelectLanguage()), meCall ); + save_Separators( maFieldSeparators, pCbTextSep->GetText(), pCkbAsOnce->IsChecked(), + pCkbQuotedAsText->IsChecked(), pCkbDetectNumber->IsChecked(), + pRbFixed->IsChecked(), + static_cast(pNfRow->GetValue()), + static_cast(pLbCharSet->GetSelectEntryPos()), + static_cast(pLbCustomLang->GetSelectLanguage()), meCall ); } void ScImportAsciiDlg::SetSeparators() @@ -585,20 +569,20 @@ void ScImportAsciiDlg::SetSeparators() { switch( aSep[i] ) { - case '\t': aCkbTab.Check(); break; - case ';': aCkbSemicolon.Check(); break; - case ',': aCkbComma.Check(); break; - case ' ': aCkbSpace.Check(); break; + case '\t': pCkbTab->Check(); break; + case ';': pCkbSemicolon->Check(); break; + case ',': pCkbComma->Check(); break; + case ' ': pCkbSpace->Check(); break; default: - aCkbOther.Check(); - aEdOther.SetText( aEdOther.GetText() + OUString( aSep[i] ) ); + pCkbOther->Check(); + pEdOther->SetText( pEdOther->GetText() + OUString( aSep[i] ) ); } } } void ScImportAsciiDlg::SetSelectedCharSet() { - meCharSet = aLbCharSet.GetSelectTextEncoding(); + meCharSet = pLbCharSet->GetSelectTextEncoding(); mbCharSetSystem = (meCharSet == RTL_TEXTENCODING_DONTKNOW); if( mbCharSetSystem ) meCharSet = osl_getThreadTextEncoding(); @@ -607,31 +591,31 @@ void ScImportAsciiDlg::SetSelectedCharSet() String ScImportAsciiDlg::GetSeparators() const { String aSepChars; - if( aCkbTab.IsChecked() ) + if( pCkbTab->IsChecked() ) aSepChars += '\t'; - if( aCkbSemicolon.IsChecked() ) + if( pCkbSemicolon->IsChecked() ) aSepChars += ';'; - if( aCkbComma.IsChecked() ) + if( pCkbComma->IsChecked() ) aSepChars += ','; - if( aCkbSpace.IsChecked() ) + if( pCkbSpace->IsChecked() ) aSepChars += ' '; - if( aCkbOther.IsChecked() ) - aSepChars += aEdOther.GetText(); + if( pCkbOther->IsChecked() ) + aSepChars += pEdOther->GetText(); return aSepChars; } void ScImportAsciiDlg::SetupSeparatorCtrls() { - sal_Bool bEnable = aRbSeparated.IsChecked(); - aCkbTab.Enable( bEnable ); - aCkbSemicolon.Enable( bEnable ); - aCkbComma.Enable( bEnable ); - aCkbSpace.Enable( bEnable ); - aCkbOther.Enable( bEnable ); - aEdOther.Enable( bEnable ); - aCkbAsOnce.Enable( bEnable ); - aFtTextSep.Enable( bEnable ); - aCbTextSep.Enable( bEnable ); + sal_Bool bEnable = pRbSeparated->IsChecked(); + pCkbTab->Enable( bEnable ); + pCkbSemicolon->Enable( bEnable ); + pCkbComma->Enable( bEnable ); + pCkbSpace->Enable( bEnable ); + pCkbOther->Enable( bEnable ); + pEdOther->Enable( bEnable ); + pCkbAsOnce->Enable( bEnable ); + pFtTextSep->Enable( bEnable ); + pCbTextSep->Enable( bEnable ); } void ScImportAsciiDlg::UpdateVertical() @@ -648,13 +632,13 @@ IMPL_LINK( ScImportAsciiDlg, RbSepFixHdl, RadioButton*, pButton ) { OSL_ENSURE( pButton, "ScImportAsciiDlg::RbSepFixHdl - missing sender" ); - if( (pButton == &aRbFixed) || (pButton == &aRbSeparated) ) + if( (pButton == pRbFixed) || (pButton == pRbSeparated) ) { SetPointer( Pointer( POINTER_WAIT ) ); - if( aRbFixed.IsChecked() ) - maTableBox.SetFixedWidthMode(); + if( pRbFixed->IsChecked() ) + mpTableBox->SetFixedWidthMode(); else - maTableBox.SetSeparatorsMode(); + mpTableBox->SetSeparatorsMode(); SetPointer( Pointer( POINTER_ARROW ) ); SetupSeparatorCtrls(); @@ -665,25 +649,25 @@ IMPL_LINK( ScImportAsciiDlg, RbSepFixHdl, RadioButton*, pButton ) IMPL_LINK( ScImportAsciiDlg, SeparatorHdl, Control*, pCtrl ) { OSL_ENSURE( pCtrl, "ScImportAsciiDlg::SeparatorHdl - missing sender" ); - OSL_ENSURE( !aRbFixed.IsChecked(), "ScImportAsciiDlg::SeparatorHdl - not allowed in fixed width" ); + OSL_ENSURE( !pRbFixed->IsChecked(), "ScImportAsciiDlg::SeparatorHdl - not allowed in fixed width" ); /* #i41550# First update state of the controls. The GetSeparators() function needs final state of the check boxes. */ - if( (pCtrl == &aCkbOther) && aCkbOther.IsChecked() ) - aEdOther.GrabFocus(); - else if( pCtrl == &aEdOther ) - aCkbOther.Check( !aEdOther.GetText().isEmpty() ); + if( (pCtrl == pCkbOther) && pCkbOther->IsChecked() ) + pEdOther->GrabFocus(); + else if( pCtrl == pEdOther ) + pCkbOther->Check( !pEdOther->GetText().isEmpty() ); String aOldFldSeps( maFieldSeparators); maFieldSeparators = GetSeparators(); sal_Unicode cOldSep = mcTextSep; - mcTextSep = lcl_CharFromCombo( aCbTextSep, aTextSepList ); + mcTextSep = lcl_CharFromCombo( *pCbTextSep, aTextSepList ); // Any separator changed may result in completely different lines due to // embedded line breaks. if (cOldSep != mcTextSep || aOldFldSeps != maFieldSeparators) UpdateVertical(); - maTableBox.Execute( CSVCMD_NEWCELLTEXTS ); + mpTableBox->Execute( CSVCMD_NEWCELLTEXTS ); return 0; } @@ -691,7 +675,7 @@ IMPL_LINK( ScImportAsciiDlg, CharSetHdl, SvxTextEncodingBox*, pCharSetBox ) { OSL_ENSURE( pCharSetBox, "ScImportAsciiDlg::CharSetHdl - missing sender" ); - if( (pCharSetBox == &aLbCharSet) && (pCharSetBox->GetSelectEntryCount() == 1) ) + if( (pCharSetBox == pLbCharSet) && (pCharSetBox->GetSelectEntryCount() == 1) ) { SetPointer( Pointer( POINTER_WAIT ) ); CharSet eOldCharSet = meCharSet; @@ -700,7 +684,7 @@ IMPL_LINK( ScImportAsciiDlg, CharSetHdl, SvxTextEncodingBox*, pCharSetBox ) if (eOldCharSet != meCharSet) UpdateVertical(); - maTableBox.Execute( CSVCMD_NEWCELLTEXTS ); + mpTableBox->Execute( CSVCMD_NEWCELLTEXTS ); SetPointer( Pointer( POINTER_ARROW ) ); } return 0; @@ -709,22 +693,22 @@ IMPL_LINK( ScImportAsciiDlg, CharSetHdl, SvxTextEncodingBox*, pCharSetBox ) IMPL_LINK( ScImportAsciiDlg, FirstRowHdl, NumericField*, pNumField ) { OSL_ENSURE( pNumField, "ScImportAsciiDlg::FirstRowHdl - missing sender" ); - maTableBox.Execute( CSVCMD_SETFIRSTIMPORTLINE, sal::static_int_cast( pNumField->GetValue() - 1 ) ); + mpTableBox->Execute( CSVCMD_SETFIRSTIMPORTLINE, sal::static_int_cast( pNumField->GetValue() - 1 ) ); return 0; } IMPL_LINK( ScImportAsciiDlg, LbColTypeHdl, ListBox*, pListBox ) { OSL_ENSURE( pListBox, "ScImportAsciiDlg::LbColTypeHdl - missing sender" ); - if( pListBox == &aLbType ) - maTableBox.Execute( CSVCMD_SETCOLUMNTYPE, pListBox->GetSelectEntryPos() ); + if( pListBox == pLbType ) + mpTableBox->Execute( CSVCMD_SETCOLUMNTYPE, pListBox->GetSelectEntryPos() ); return 0; } IMPL_LINK_NOARG(ScImportAsciiDlg, UpdateTextHdl) { - sal_Int32 nBaseLine = maTableBox.GetFirstVisLine(); - sal_Int32 nRead = maTableBox.GetVisLineCount(); + sal_Int32 nBaseLine = mpTableBox->GetFirstVisLine(); + sal_Int32 nRead = mpTableBox->GetVisLineCount(); // If mnRowPosCount==0, this is an initializing call, read ahead for row // count and resulting scroll bar size and position to be able to scroll at // all. When adding lines, read only the amount of next lines to be @@ -741,9 +725,9 @@ IMPL_LINK_NOARG(ScImportAsciiDlg, UpdateTextHdl) for (; i < CSV_PREVIEW_LINES; i++) maPreviewLine[i] = rtl::OUString(); - maTableBox.Execute( CSVCMD_SETLINECOUNT, mnRowPosCount); - bool bMergeSep = (aCkbAsOnce.IsChecked() == sal_True); - maTableBox.SetUniStrings( maPreviewLine, maFieldSeparators, mcTextSep, bMergeSep); + mpTableBox->Execute( CSVCMD_SETLINECOUNT, mnRowPosCount); + bool bMergeSep = (pCkbAsOnce->IsChecked() == sal_True); + mpTableBox->SetUniStrings( maPreviewLine, maFieldSeparators, mcTextSep, bMergeSep); return 0; } @@ -753,20 +737,20 @@ IMPL_LINK( ScImportAsciiDlg, ColTypeHdl, ScCsvTableBox*, pTableBox ) OSL_ENSURE( pTableBox, "ScImportAsciiDlg::ColTypeHdl - missing sender" ); sal_Int32 nType = pTableBox->GetSelColumnType(); - sal_Int32 nTypeCount = aLbType.GetEntryCount(); + sal_Int32 nTypeCount = pLbType->GetEntryCount(); bool bEmpty = (nType == CSV_TYPE_MULTI); bool bEnable = ((0 <= nType) && (nType < nTypeCount)) || bEmpty; - aFtType.Enable( bEnable ); - aLbType.Enable( bEnable ); + pFtType->Enable( bEnable ); + pLbType->Enable( bEnable ); - Link aSelHdl = aLbType.GetSelectHdl(); - aLbType.SetSelectHdl( Link() ); + Link aSelHdl = pLbType->GetSelectHdl(); + pLbType->SetSelectHdl( Link() ); if( bEmpty ) - aLbType.SetNoSelection(); + pLbType->SetNoSelection(); else if( bEnable ) - aLbType.SelectEntryPos( static_cast< sal_uInt16 >( nType ) ); - aLbType.SetSelectHdl( aSelHdl ); + pLbType->SelectEntryPos( static_cast< sal_uInt16 >( nType ) ); + pLbType->SetSelectHdl( aSelHdl ); return 0; } diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx index cf93988ea43f..60db01388051 100644 --- a/sc/source/ui/inc/scuiasciiopt.hxx +++ b/sc/source/ui/inc/scuiasciiopt.hxx @@ -37,44 +37,38 @@ class ScImportAsciiDlg : public ModalDialog rtl::OUString maPreviewLine[ CSV_PREVIEW_LINES ]; - FixedLine aFlFieldOpt; - FixedText aFtCharSet; - SvxTextEncodingBox aLbCharSet; - FixedText aFtCustomLang; - SvxLanguageBox aLbCustomLang; + FixedText* pFtCharSet; - FixedText aFtRow; - NumericField aNfRow; + SvxTextEncodingBox* pLbCharSet; - FixedLine aFlSepOpt; - RadioButton aRbFixed; - RadioButton aRbSeparated; + FixedText* pFtCustomLang; - CheckBox aCkbTab; - CheckBox aCkbSemicolon; - CheckBox aCkbComma; - CheckBox aCkbSpace; - CheckBox aCkbOther; - Edit aEdOther; - CheckBox aCkbAsOnce; + SvxLanguageBox* pLbCustomLang; - FixedLine aFlOtherOpt; + FixedText* pFtRow; + NumericField* pNfRow; - FixedText aFtTextSep; - ComboBox aCbTextSep; + RadioButton* pRbFixed; + RadioButton* pRbSeparated; - CheckBox aCkbQuotedAsText; - CheckBox aCkbDetectNumber; + CheckBox* pCkbTab; + CheckBox* pCkbSemicolon; + CheckBox* pCkbComma; + CheckBox* pCkbSpace; + CheckBox* pCkbOther; + Edit* pEdOther; + CheckBox* pCkbAsOnce; - FixedLine aFlWidth; - FixedText aFtType; - ListBox aLbType; + FixedText* pFtTextSep; + ComboBox* pCbTextSep; - ScCsvTableBox maTableBox; + CheckBox* pCkbQuotedAsText; + CheckBox* pCkbDetectNumber; - OKButton aBtnOk; - CancelButton aBtnCancel; - HelpButton aBtnHelp; + FixedText* pFtType; + ListBox* pLbType; + + ScCsvTableBox* mpTableBox; String aCharSetUser; String aColumnUser; diff --git a/sc/uiconfig/scalc/ui/textimportcsv.ui b/sc/uiconfig/scalc/ui/textimportcsv.ui new file mode 100644 index 000000000000..262b614841d5 --- /dev/null +++ b/sc/uiconfig/scalc/ui/textimportcsv.ui @@ -0,0 +1,633 @@ + + + + + False + 5 + dialog + + + False + vertical + 2 + + + False + end + + + gtk-help + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + gtk-ok + True + True + True + True + True + True + + + False + True + 2 + + + + + False + True + end + 0 + + + + + True + False + vertical + + + True + False + True + True + 0 + none + + + True + False + 6 + 6 + 12 + + + True + False + 6 + + + True + False + 6 + Ch_aracter set + True + + + 0 + 0 + 1 + 1 + + + + + True + False + _Language + True + + + 0 + 1 + 1 + 1 + + + + + True + False + From ro_w + True + + + 0 + 2 + 1 + 1 + + + + + True + False + + + 1 + 0 + 1 + 1 + + + + + True + False + + + 1 + 1 + 1 + 1 + + + + + True + True + + + + 1 + 2 + 1 + 1 + + + + + + + + + True + False + Import + + + + + + + + False + True + 0 + + + + + True + False + True + True + 0 + none + + + True + False + 6 + 12 + 12 + + + True + False + vertical + + + _Fixed width + False + True + True + False + False + True + 0 + True + toseparatedby + + + False + True + 0 + + + + + _Separated by + False + True + True + False + False + True + 0 + True + True + tofixedwidth + + + False + True + 1 + + + + + True + False + 20 + + + _Tab + False + True + True + False + False + True + 0 + True + + + 0 + 0 + 1 + 1 + + + + + S_emicolon + False + True + True + False + False + True + 0 + True + + + 0 + 1 + 1 + 1 + + + + + Merge _delimiters + False + True + True + False + False + 0 + True + + + 0 + 2 + 1 + 1 + + + + + _Comma + False + True + True + False + False + True + 0 + True + + + 1 + 0 + 1 + 1 + + + + + S_pace + False + True + True + False + False + True + 0 + True + + + 1 + 1 + 1 + 1 + + + + + _Other + False + True + True + False + False + True + 0 + True + + + 2 + 0 + 1 + 1 + + + + + True + True + + + + 3 + 0 + 1 + 1 + + + + + True + False + 0 + 1 + + + 3 + 2 + 1 + 1 + + + + + True + False + Te_xt delimiter + True + + + 2 + 2 + 1 + 1 + + + + + + + + + + + + + + False + True + 2 + + + + + + + + + True + False + Separator options + + + + + + + + False + True + 1 + + + + + True + False + True + True + 0 + none + + + True + False + 6 + 12 + 12 + + + True + False + vertical + + + _Quoted field as text + False + True + True + False + False + True + 0.0099999997764825821 + True + + + False + True + 0 + + + + + Detect special _numbers + False + True + True + False + False + True + 0 + True + + + False + True + 1 + + + + + + + + + True + False + Other options + + + + + + + + False + False + 2 + + + + + True + False + True + True + 0 + none + + + True + False + 6 + 12 + 12 + + + True + False + vertical + + + True + False + + + True + False + Column t_ype + True + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + False + True + 0 + + + + + True + True + in + + + + + + False + True + 1 + + + + + + + + + True + False + Fields + + + + + + + + False + True + 3 + + + + + False + True + 1 + + + + + + help + cancel + ok + + + -- cgit