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
2c945010
Kaydet (Commit)
2c945010
authored
Kas 11, 2013
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
datastreams: implement moving the import range down until the limit is reached
Change-Id: Iaaed4399a980697c37683d838fcb1f99208233e8
üst
ac435437
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
22 deletions
+45
-22
datastreams.hxx
sc/source/ui/inc/datastreams.hxx
+11
-5
datastreams.cxx
sc/source/ui/miscdlgs/datastreams.cxx
+34
-17
No files found.
sc/source/ui/inc/datastreams.hxx
Dosyayı görüntüle @
2c945010
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_ptr.hpp>
namespace
datastreams
{
class
CallerThread
;
}
namespace
datastreams
{
class
CallerThread
;
}
namespace
{
class
DataStreamsDlg
;
}
class
ScDocShell
;
class
ScDocShell
;
class
ScDocument
;
class
ScDocument
;
class
ScRange
;
class
ScRange
;
...
@@ -24,26 +25,31 @@ class Window;
...
@@ -24,26 +25,31 @@ class Window;
class
DataStreams
:
boost
::
noncopyable
class
DataStreams
:
boost
::
noncopyable
{
{
friend
DataStreamsDlg
;
enum
MoveEnum
{
NO_MOVE
,
RANGE_DOWN
,
MOVE_DOWN
,
MOVE_UP
};
ScDocShell
*
mpScDocShell
;
ScDocShell
*
mpScDocShell
;
ScDocument
*
mpScDocument
;
ScDocument
*
mpScDocument
;
bool
mb
Move
;
MoveEnum
me
Move
;
bool
mbRunning
;
bool
mbRunning
;
bool
mbIsUndoEnabled
;
bool
mbIsUndoEnabled
;
boost
::
scoped_ptr
<
ScRange
>
mpRange
;
boost
::
scoped_ptr
<
ScRange
>
mpRange
;
boost
::
scoped_ptr
<
ScRange
>
mpStartRange
;
boost
::
scoped_ptr
<
ScRange
>
mpEndRange
;
boost
::
scoped_ptr
<
ScRange
>
mpEndRange
;
boost
::
scoped_ptr
<
SvStream
>
mpStream
;
boost
::
scoped_ptr
<
SvStream
>
mpStream
;
rtl
::
Reference
<
datastreams
::
CallerThread
>
mxThread
;
rtl
::
Reference
<
datastreams
::
CallerThread
>
mxThread
;
public
:
public
:
DataStreams
(
ScDocShell
*
pScDocShell
);
DataStreams
(
ScDocShell
*
pScDocShell
);
virtual
~
DataStreams
();
~
DataStreams
();
bool
ImportData
();
bool
ImportData
();
void
Move
();
void
ShowDialog
(
Window
*
pParent
);
void
ShowDialog
(
Window
*
pParent
);
private
:
void
MoveData
();
void
Set
(
const
OUString
&
rUrl
,
bool
bIsScript
,
const
OUString
&
rRange
,
sal_Int32
nLimit
,
MoveEnum
eMove
);
void
Start
();
void
Start
();
void
Stop
();
void
Stop
();
void
Set
(
const
OUString
&
rUrl
,
bool
bIsScript
,
const
OUString
&
rRange
);
void
SetMove
(
sal_Int32
nLimit
);
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/ui/miscdlgs/datastreams.cxx
Dosyayı görüntüle @
2c945010
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
#include <asciiopt.hxx>
#include <asciiopt.hxx>
#include <docsh.hxx>
#include <docsh.hxx>
#include <impex.hxx>
#include <impex.hxx>
#include <viewdata.hxx>
#include <dbfunc.hxx>
namespace
datastreams
{
namespace
datastreams
{
...
@@ -54,7 +56,7 @@ private:
...
@@ -54,7 +56,7 @@ private:
DataStreams
::
DataStreams
(
ScDocShell
*
pScDocShell
)
:
DataStreams
::
DataStreams
(
ScDocShell
*
pScDocShell
)
:
mpScDocShell
(
pScDocShell
)
mpScDocShell
(
pScDocShell
)
,
mpScDocument
(
mpScDocShell
->
GetDocument
())
,
mpScDocument
(
mpScDocShell
->
GetDocument
())
,
m
bMove
(
false
)
,
m
eMove
(
NO_MOVE
)
{
{
mxThread
=
new
datastreams
::
CallerThread
(
this
);
mxThread
=
new
datastreams
::
CallerThread
(
this
);
mxThread
->
launch
();
mxThread
->
launch
();
...
@@ -81,23 +83,21 @@ void DataStreams::Stop()
...
@@ -81,23 +83,21 @@ void DataStreams::Stop()
{
{
mbRunning
=
false
;
mbRunning
=
false
;
mpScDocument
->
EnableUndo
(
mbIsUndoEnabled
);
mpScDocument
->
EnableUndo
(
mbIsUndoEnabled
);
mbMove
=
false
;
}
}
void
DataStreams
::
Set
(
const
OUString
&
rUrl
,
bool
bIsScript
,
const
OUString
&
rRange
)
void
DataStreams
::
Set
(
const
OUString
&
rUrl
,
bool
bIsScript
,
const
OUString
&
rRange
,
sal_Int32
nLimit
,
MoveEnum
eMove
)
{
{
mpRange
.
reset
(
new
ScRange
()
);
mpRange
.
reset
(
new
ScRange
()
);
mpRange
->
Parse
(
rRange
,
mpScDocument
);
mpRange
->
Parse
(
rRange
,
mpScDocument
);
mpStartRange
.
reset
(
new
ScRange
(
*
mpRange
.
get
())
);
if
(
bIsScript
)
if
(
bIsScript
)
mpStream
.
reset
(
new
SvScriptStream
(
rUrl
)
);
mpStream
.
reset
(
new
SvScriptStream
(
rUrl
)
);
else
else
mpStream
.
reset
(
new
SvFileStream
(
rUrl
,
STREAM_READ
)
);
mpStream
.
reset
(
new
SvFileStream
(
rUrl
,
STREAM_READ
)
);
}
void
DataStreams
::
SetMove
(
sal_Int32
nLimit
)
{
mpEndRange
.
reset
(
NULL
);
mpEndRange
.
reset
(
NULL
);
m
bMove
=
tru
e
;
m
eMove
=
eMov
e
;
sal_Int32
nHeight
=
mpRange
->
aEnd
.
Row
()
-
mpRange
->
aStart
.
Row
()
+
1
;
sal_Int32
nHeight
=
mpRange
->
aEnd
.
Row
()
-
mpRange
->
aStart
.
Row
()
+
1
;
nLimit
=
nHeight
*
(
nLimit
/
nHeight
);
nLimit
=
nHeight
*
(
nLimit
/
nHeight
);
if
(
nLimit
&&
mpRange
->
aStart
.
Row
()
+
nLimit
-
1
<
MAXROW
)
if
(
nLimit
&&
mpRange
->
aStart
.
Row
()
+
nLimit
-
1
<
MAXROW
)
...
@@ -107,15 +107,26 @@ void DataStreams::SetMove(sal_Int32 nLimit)
...
@@ -107,15 +107,26 @@ void DataStreams::SetMove(sal_Int32 nLimit)
}
}
}
}
void
DataStreams
::
Move
()
void
DataStreams
::
Move
Data
()
{
{
if
(
!
mbMove
)
switch
(
meMove
)
return
;
if
(
mpEndRange
.
get
())
{
{
mpScDocument
->
DeleteRow
(
*
mpEndRange
);
case
RANGE_DOWN
:
if
(
mpRange
->
aStart
==
mpEndRange
->
aStart
)
meMove
=
MOVE_UP
;
break
;
case
MOVE_UP
:
mpScDocument
->
DeleteRow
(
*
mpStartRange
);
mpScDocument
->
InsertRow
(
*
mpEndRange
);
break
;
case
MOVE_DOWN
:
if
(
mpEndRange
.
get
())
mpScDocument
->
DeleteRow
(
*
mpEndRange
);
mpScDocument
->
InsertRow
(
*
mpRange
);
break
;
case
NO_MOVE
:
break
;
}
}
mpScDocument
->
InsertRow
(
*
mpRange
);
}
}
bool
DataStreams
::
ImportData
()
bool
DataStreams
::
ImportData
()
...
@@ -127,8 +138,6 @@ bool DataStreams::ImportData()
...
@@ -127,8 +138,6 @@ bool DataStreams::ImportData()
return
mbRunning
;
return
mbRunning
;
}
}
SolarMutexGuard
aGuard
;
Move
();
SCROW
nHeight
=
mpRange
->
aEnd
.
Row
()
-
mpRange
->
aStart
.
Row
()
+
1
;
SCROW
nHeight
=
mpRange
->
aEnd
.
Row
()
-
mpRange
->
aStart
.
Row
()
+
1
;
OStringBuffer
aBuf
;
OStringBuffer
aBuf
;
OString
sTmp
;
OString
sTmp
;
...
@@ -138,17 +147,25 @@ bool DataStreams::ImportData()
...
@@ -138,17 +147,25 @@ bool DataStreams::ImportData()
aBuf
.
append
(
sTmp
);
aBuf
.
append
(
sTmp
);
aBuf
.
append
(
'\n'
);
aBuf
.
append
(
'\n'
);
}
}
SolarMutexGuard
aGuard
;
MoveData
();
SvMemoryStream
aMemoryStream
((
void
*
)
aBuf
.
getStr
(),
aBuf
.
getLength
(),
STREAM_READ
);
SvMemoryStream
aMemoryStream
((
void
*
)
aBuf
.
getStr
(),
aBuf
.
getLength
(),
STREAM_READ
);
ScImportExport
aImport
(
mpScDocument
,
*
mpRange
);
ScImportExport
aImport
(
mpScDocument
,
*
mpRange
);
aImport
.
SetSeparator
(
','
);
aImport
.
SetSeparator
(
','
);
aImport
.
ImportStream
(
aMemoryStream
,
OUString
(),
FORMAT_STRING
);
aImport
.
ImportStream
(
aMemoryStream
,
OUString
(),
FORMAT_STRING
);
// ImportStream calls PostPaint for relevant area,
// ImportStream calls PostPaint for relevant area,
// we need to call it explicitly only when moving rows.
// we need to call it explicitly only when moving rows.
if
(
!
mbMove
)
if
(
meMove
==
NO_MOVE
)
return
mbRunning
;
return
mbRunning
;
if
(
meMove
==
RANGE_DOWN
)
{
mpRange
->
Move
(
0
,
mpRange
->
aEnd
.
Row
()
-
mpRange
->
aStart
.
Row
()
+
1
,
0
);
mpScDocShell
->
GetViewData
()
->
GetView
()
->
AlignToCursor
(
mpRange
->
aStart
.
Col
(),
mpRange
->
aStart
.
Row
(),
SC_FOLLOW_JUMP
);
}
SCROW
aEndRow
=
mpEndRange
.
get
()
?
mpEndRange
->
aEnd
.
Row
()
:
MAXROW
;
SCROW
aEndRow
=
mpEndRange
.
get
()
?
mpEndRange
->
aEnd
.
Row
()
:
MAXROW
;
mpScDocShell
->
PostPaint
(
ScRange
(
mpRange
->
aStart
,
ScAddress
(
mpRange
->
aEnd
.
Col
(),
mpScDocShell
->
PostPaint
(
ScRange
(
mp
Start
Range
->
aStart
,
ScAddress
(
mpRange
->
aEnd
.
Col
(),
aEndRow
,
mpRange
->
aStart
.
Tab
())
),
PAINT_GRID
);
aEndRow
,
mpRange
->
aStart
.
Tab
())
),
PAINT_GRID
);
return
mbRunning
;
return
mbRunning
;
...
...
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