Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
5af6437f
Kaydet (Commit)
5af6437f
authored
Agu 26, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
resolved fdo#53449 weight given separators to pick one for output
Change-Id: Iaef3ed270d870f7c26062cdbbc9bf243bc5b5a78
üst
d198d2fb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
19 deletions
+60
-19
asciiopt.cxx
sc/source/ui/dbgui/asciiopt.cxx
+44
-17
imoptdlg.cxx
sc/source/ui/dbgui/imoptdlg.cxx
+2
-1
impex.cxx
sc/source/ui/docshell/impex.cxx
+1
-1
asciiopt.hxx
sc/source/ui/inc/asciiopt.hxx
+13
-0
No files found.
sc/source/ui/dbgui/asciiopt.cxx
Dosyayı görüntüle @
5af6437f
...
@@ -179,6 +179,25 @@ bool ScAsciiOptions::operator==( const ScAsciiOptions& rCmp ) const
...
@@ -179,6 +179,25 @@ bool ScAsciiOptions::operator==( const ScAsciiOptions& rCmp ) const
return
false
;
return
false
;
}
}
String
lcl_decodeSepString
(
const
String
&
rSepNums
,
bool
&
o_bMergeFieldSeps
)
{
String
aFieldSeps
;
xub_StrLen
nSub
=
comphelper
::
string
::
getTokenCount
(
rSepNums
,
'/'
);
for
(
xub_StrLen
i
=
0
;
i
<
nSub
;
++
i
)
{
String
aCode
=
rSepNums
.
GetToken
(
i
,
'/'
);
if
(
aCode
.
EqualsAscii
(
pStrMrg
)
)
o_bMergeFieldSeps
=
true
;
else
{
sal_Int32
nVal
=
aCode
.
ToInt32
();
if
(
nVal
)
aFieldSeps
+=
(
sal_Unicode
)
nVal
;
}
}
return
aFieldSeps
;
}
// The options string must not contain semicolons (because of the pick list),
// The options string must not contain semicolons (because of the pick list),
// use comma as separator.
// use comma as separator.
...
@@ -186,31 +205,16 @@ void ScAsciiOptions::ReadFromString( const String& rString )
...
@@ -186,31 +205,16 @@ void ScAsciiOptions::ReadFromString( const String& rString )
{
{
xub_StrLen
nCount
=
comphelper
::
string
::
getTokenCount
(
rString
,
','
);
xub_StrLen
nCount
=
comphelper
::
string
::
getTokenCount
(
rString
,
','
);
String
aToken
;
String
aToken
;
xub_StrLen
nSub
;
xub_StrLen
i
;
// Field separator.
// Field separator.
if
(
nCount
>=
1
)
if
(
nCount
>=
1
)
{
{
bFixedLen
=
bMergeFieldSeps
=
false
;
bFixedLen
=
bMergeFieldSeps
=
false
;
aFieldSeps
.
Erase
();
aToken
=
rString
.
GetToken
(
0
,
','
);
aToken
=
rString
.
GetToken
(
0
,
','
);
if
(
aToken
.
EqualsAscii
(
pStrFix
)
)
if
(
aToken
.
EqualsAscii
(
pStrFix
)
)
bFixedLen
=
true
;
bFixedLen
=
true
;
nSub
=
comphelper
::
string
::
getTokenCount
(
aToken
,
'/'
);
aFieldSeps
=
lcl_decodeSepString
(
aToken
,
bMergeFieldSeps
);
for
(
i
=
0
;
i
<
nSub
;
i
++
)
{
String
aCode
=
aToken
.
GetToken
(
i
,
'/'
);
if
(
aCode
.
EqualsAscii
(
pStrMrg
)
)
bMergeFieldSeps
=
true
;
else
{
sal_Int32
nVal
=
aCode
.
ToInt32
();
if
(
nVal
)
aFieldSeps
+=
(
sal_Unicode
)
nVal
;
}
}
}
}
// Text separator.
// Text separator.
...
@@ -242,7 +246,7 @@ void ScAsciiOptions::ReadFromString( const String& rString )
...
@@ -242,7 +246,7 @@ void ScAsciiOptions::ReadFromString( const String& rString )
delete
[]
pColFormat
;
delete
[]
pColFormat
;
aToken
=
rString
.
GetToken
(
4
,
','
);
aToken
=
rString
.
GetToken
(
4
,
','
);
nSub
=
comphelper
::
string
::
getTokenCount
(
aToken
,
'/'
);
xub_StrLen
nSub
=
comphelper
::
string
::
getTokenCount
(
aToken
,
'/'
);
nInfoCount
=
nSub
/
2
;
nInfoCount
=
nSub
/
2
;
if
(
nInfoCount
)
if
(
nInfoCount
)
{
{
...
@@ -354,4 +358,27 @@ String ScAsciiOptions::WriteToString() const
...
@@ -354,4 +358,27 @@ String ScAsciiOptions::WriteToString() const
return
aOutStr
;
return
aOutStr
;
}
}
// static
sal_Unicode
ScAsciiOptions
::
GetWeightedFieldSep
(
const
String
&
rFieldSeps
,
bool
bDecodeNumbers
)
{
bool
bMergeFieldSeps
=
false
;
String
aFieldSeps
(
bDecodeNumbers
?
lcl_decodeSepString
(
rFieldSeps
,
bMergeFieldSeps
)
:
rFieldSeps
);
if
(
aFieldSeps
.
Len
()
<=
1
)
return
aFieldSeps
.
GetChar
(
0
);
else
{
// There can be only one separator for output. See also fdo#53449
if
(
aFieldSeps
.
Search
(
','
)
!=
STRING_NOTFOUND
)
return
','
;
else
if
(
aFieldSeps
.
Search
(
'\t'
)
!=
STRING_NOTFOUND
)
return
'\t'
;
else
if
(
aFieldSeps
.
Search
(
';'
)
!=
STRING_NOTFOUND
)
return
';'
;
else
if
(
aFieldSeps
.
Search
(
' '
)
!=
STRING_NOTFOUND
)
return
' '
;
else
return
aFieldSeps
.
GetChar
(
0
);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/ui/dbgui/imoptdlg.cxx
Dosyayı görüntüle @
5af6437f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
#include "imoptdlg.hxx"
#include "imoptdlg.hxx"
#include "asciiopt.hxx"
#include "scresid.hxx"
#include "scresid.hxx"
#include "imoptdlg.hrc"
#include "imoptdlg.hrc"
#include <comphelper/string.hxx>
#include <comphelper/string.hxx>
...
@@ -51,7 +52,7 @@ ScImportOptions::ScImportOptions( const String& rStr )
...
@@ -51,7 +52,7 @@ ScImportOptions::ScImportOptions( const String& rStr )
if
(
aToken
.
EqualsIgnoreCaseAscii
(
pStrFix
)
)
if
(
aToken
.
EqualsIgnoreCaseAscii
(
pStrFix
)
)
bFixedWidth
=
sal_True
;
bFixedWidth
=
sal_True
;
else
else
nFieldSepCode
=
(
sal_Unicode
)
aToken
.
ToInt32
(
);
nFieldSepCode
=
ScAsciiOptions
::
GetWeightedFieldSep
(
aToken
,
true
);
nTextSepCode
=
(
sal_Unicode
)
rStr
.
GetToken
(
1
,
','
).
ToInt32
();
nTextSepCode
=
(
sal_Unicode
)
rStr
.
GetToken
(
1
,
','
).
ToInt32
();
aStrFont
=
rStr
.
GetToken
(
2
,
','
);
aStrFont
=
rStr
.
GetToken
(
2
,
','
);
eCharSet
=
ScGlobal
::
GetCharsetValue
(
aStrFont
);
eCharSet
=
ScGlobal
::
GetCharsetValue
(
aStrFont
);
...
...
sc/source/ui/docshell/impex.cxx
Dosyayı görüntüle @
5af6437f
...
@@ -187,7 +187,7 @@ void ScImportExport::SetExtOptions( const ScAsciiOptions& rOpt )
...
@@ -187,7 +187,7 @@ void ScImportExport::SetExtOptions( const ScAsciiOptions& rOpt )
// "normale" Optionen uebernehmen
// "normale" Optionen uebernehmen
cSep
=
rOpt
.
GetFieldSeps
().
GetChar
(
0
);
cSep
=
ScAsciiOptions
::
GetWeightedFieldSep
(
rOpt
.
GetFieldSeps
(),
false
);
cStr
=
rOpt
.
GetTextSep
();
cStr
=
rOpt
.
GetTextSep
();
}
}
...
...
sc/source/ui/inc/asciiopt.hxx
Dosyayı görüntüle @
5af6437f
...
@@ -96,6 +96,19 @@ public:
...
@@ -96,6 +96,19 @@ public:
void
SetColInfo
(
sal_uInt16
nCount
,
const
sal_Int32
*
pStart
,
const
sal_uInt8
*
pFormat
);
void
SetColInfo
(
sal_uInt16
nCount
,
const
sal_Int32
*
pStart
,
const
sal_uInt8
*
pFormat
);
void
SetColumnInfo
(
const
ScCsvExpDataVec
&
rDataVec
);
void
SetColumnInfo
(
const
ScCsvExpDataVec
&
rDataVec
);
/** From the import field separators obtain the one most likely to be used
for export, if multiple separators weighted comma, tab, semicolon,
space and other.
@param bDecodeNumbers
If TRUE, the separators are encoded as numbers and need to be
decoded before characters can be extracted, for example "59/44"
to ";,".
If FALSE, the string is taken as is and each character is
expected to be one separator.
*/
static
sal_Unicode
GetWeightedFieldSep
(
const
String
&
rFieldSeps
,
bool
bDecodeNumbers
);
};
};
/// How ScImportAsciiDlg is called
/// How ScImportAsciiDlg is called
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment