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
ba785e0c
Kaydet (Commit)
ba785e0c
authored
Eyl 30, 2015
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I913648a8dd407c5629df7a0355d2cfdf66240cf9
üst
d119c840
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
21 deletions
+27
-21
UndoSort.hxx
sw/source/core/inc/UndoSort.hxx
+5
-3
unsort.cxx
sw/source/core/undo/unsort.cxx
+22
-18
No files found.
sw/source/core/inc/UndoSort.hxx
Dosyayı görüntüle @
ba785e0c
...
@@ -21,9 +21,12 @@
...
@@ -21,9 +21,12 @@
#define INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
#define INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
#include <undobj.hxx>
#include <undobj.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <rtl/ustring.hxx>
#include <rtl/ustring.hxx>
#include <memory>
#include <vector>
struct
SwSortOptions
;
struct
SwSortOptions
;
class
SwTableNode
;
class
SwTableNode
;
class
SwUndoAttrTable
;
class
SwUndoAttrTable
;
...
@@ -59,8 +62,7 @@ typedef std::vector<SwNodeIndex*> SwUndoSortList;
...
@@ -59,8 +62,7 @@ typedef std::vector<SwNodeIndex*> SwUndoSortList;
class
SwUndoSort
:
public
SwUndo
,
private
SwUndRng
class
SwUndoSort
:
public
SwUndo
,
private
SwUndRng
{
{
SwSortOptions
*
pSortOpt
;
SwSortOptions
*
pSortOpt
;
boost
::
ptr_vector
<
SwSortUndoElement
>
std
::
vector
<
std
::
unique_ptr
<
SwSortUndoElement
>>
m_SortList
;
aSortList
;
SwUndoAttrTable
*
pUndoTableAttr
;
SwUndoAttrTable
*
pUndoTableAttr
;
SwRedlineData
*
pRedlData
;
SwRedlineData
*
pRedlData
;
sal_uLong
nTableNd
;
sal_uLong
nTableNd
;
...
...
sw/source/core/undo/unsort.cxx
Dosyayı görüntüle @
ba785e0c
...
@@ -94,12 +94,12 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
...
@@ -94,12 +94,12 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
const
SwTable
&
rTable
=
pTableNd
->
GetTable
();
const
SwTable
&
rTable
=
pTableNd
->
GetTable
();
SwMovedBoxes
aMovedList
;
SwMovedBoxes
aMovedList
;
for
(
size_t
i
=
0
;
i
<
a
SortList
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
m_
SortList
.
size
();
i
++
)
{
{
const
SwTableBox
*
pSource
=
rTable
.
GetTableBox
(
const
SwTableBox
*
pSource
=
rTable
.
GetTableBox
(
*
aSortList
[
i
].
SORT_TXT_TBL
.
TBL
.
pSource
);
*
m_SortList
[
i
]
->
SORT_TXT_TBL
.
TBL
.
pSource
);
const
SwTableBox
*
pTarget
=
rTable
.
GetTableBox
(
const
SwTableBox
*
pTarget
=
rTable
.
GetTableBox
(
*
aSortList
[
i
].
SORT_TXT_TBL
.
TBL
.
pTarget
);
*
m_SortList
[
i
]
->
SORT_TXT_TBL
.
TBL
.
pTarget
);
// move back
// move back
MoveCell
(
&
rDoc
,
pTarget
,
pSource
,
MoveCell
(
&
rDoc
,
pTarget
,
pSource
,
...
@@ -125,17 +125,21 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
...
@@ -125,17 +125,21 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
// The IndexList must be created based on (asc.) sorted SourcePosition.
// The IndexList must be created based on (asc.) sorted SourcePosition.
SwUndoSortList
aIdxList
;
SwUndoSortList
aIdxList
;
for
(
size_t
i
=
0
;
i
<
aSortList
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
m_SortList
.
size
();
++
i
)
for
(
size_t
ii
=
0
;
ii
<
aSortList
.
size
();
++
ii
)
{
if
(
aSortList
[
ii
].
SORT_TXT_TBL
.
TXT
.
nSource
==
nSttNode
+
i
)
for
(
size_t
ii
=
0
;
ii
<
m_SortList
.
size
();
++
ii
)
{
if
(
m_SortList
[
ii
]
->
SORT_TXT_TBL
.
TXT
.
nSource
==
nSttNode
+
i
)
{
{
SwNodeIndex
*
pIdx
=
new
SwNodeIndex
(
rDoc
.
GetNodes
(),
SwNodeIndex
*
pIdx
=
new
SwNodeIndex
(
rDoc
.
GetNodes
(),
aSortList
[
ii
].
SORT_TXT_TBL
.
TXT
.
nTarget
);
m_SortList
[
ii
]
->
SORT_TXT_TBL
.
TXT
.
nTarget
);
aIdxList
.
insert
(
aIdxList
.
begin
()
+
i
,
pIdx
);
aIdxList
.
insert
(
aIdxList
.
begin
()
+
i
,
pIdx
);
break
;
break
;
}
}
}
}
for
(
size_t
i
=
0
;
i
<
a
SortList
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
m_
SortList
.
size
();
++
i
)
{
{
SwNodeIndex
aIdx
(
rDoc
.
GetNodes
(),
nSttNode
+
i
);
SwNodeIndex
aIdx
(
rDoc
.
GetNodes
(),
nSttNode
+
i
);
SwNodeRange
aRg
(
*
aIdxList
[
i
],
0
,
*
aIdxList
[
i
],
1
);
SwNodeRange
aRg
(
*
aIdxList
[
i
],
0
,
*
aIdxList
[
i
],
1
);
...
@@ -169,12 +173,12 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
...
@@ -169,12 +173,12 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
const
SwTable
&
rTable
=
pTableNd
->
GetTable
();
const
SwTable
&
rTable
=
pTableNd
->
GetTable
();
SwMovedBoxes
aMovedList
;
SwMovedBoxes
aMovedList
;
for
(
size_t
i
=
0
;
i
<
a
SortList
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
m_
SortList
.
size
();
++
i
)
{
{
const
SwTableBox
*
pSource
=
rTable
.
GetTableBox
(
const
SwTableBox
*
pSource
=
rTable
.
GetTableBox
(
*
aSortList
[
i
].
SORT_TXT_TBL
.
TBL
.
pSource
);
*
m_SortList
[
i
]
->
SORT_TXT_TBL
.
TBL
.
pSource
);
const
SwTableBox
*
pTarget
=
rTable
.
GetTableBox
(
const
SwTableBox
*
pTarget
=
rTable
.
GetTableBox
(
*
aSortList
[
i
].
SORT_TXT_TBL
.
TBL
.
pTarget
);
*
m_SortList
[
i
]
->
SORT_TXT_TBL
.
TBL
.
pTarget
);
// move back
// move back
MoveCell
(
&
rDoc
,
pSource
,
pTarget
,
MoveCell
(
&
rDoc
,
pSource
,
pTarget
,
...
@@ -203,14 +207,14 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
...
@@ -203,14 +207,14 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
SwUndoSortList
aIdxList
;
SwUndoSortList
aIdxList
;
for
(
size_t
i
=
0
;
i
<
a
SortList
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
m_
SortList
.
size
();
++
i
)
{
// current position is starting point
{
// current position is starting point
SwNodeIndex
*
pIdx
=
new
SwNodeIndex
(
rDoc
.
GetNodes
(),
SwNodeIndex
*
pIdx
=
new
SwNodeIndex
(
rDoc
.
GetNodes
(),
aSortList
[
i
].
SORT_TXT_TBL
.
TXT
.
nSource
);
m_SortList
[
i
]
->
SORT_TXT_TBL
.
TXT
.
nSource
);
aIdxList
.
insert
(
aIdxList
.
begin
()
+
i
,
pIdx
);
aIdxList
.
insert
(
aIdxList
.
begin
()
+
i
,
pIdx
);
}
}
for
(
size_t
i
=
0
;
i
<
a
SortList
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
m_
SortList
.
size
();
++
i
)
{
{
SwNodeIndex
aIdx
(
rDoc
.
GetNodes
(),
nSttNode
+
i
);
SwNodeIndex
aIdx
(
rDoc
.
GetNodes
(),
nSttNode
+
i
);
SwNodeRange
aRg
(
*
aIdxList
[
i
],
0
,
*
aIdxList
[
i
],
1
);
SwNodeRange
aRg
(
*
aIdxList
[
i
],
0
,
*
aIdxList
[
i
],
1
);
...
@@ -245,14 +249,14 @@ void SwUndoSort::RepeatImpl(::sw::RepeatContext & rContext)
...
@@ -245,14 +249,14 @@ void SwUndoSort::RepeatImpl(::sw::RepeatContext & rContext)
void
SwUndoSort
::
Insert
(
const
OUString
&
rOrgPos
,
const
OUString
&
rNewPos
)
void
SwUndoSort
::
Insert
(
const
OUString
&
rOrgPos
,
const
OUString
&
rNewPos
)
{
{
SwSortUndoElement
*
pEle
=
new
SwSortUndoElement
(
rOrgPos
,
rNewPos
);
std
::
unique_ptr
<
SwSortUndoElement
>
p
(
new
SwSortUndoElement
(
rOrgPos
,
rNewPos
)
);
aSortList
.
push_back
(
pEle
);
m_SortList
.
push_back
(
std
::
move
(
p
)
);
}
}
void
SwUndoSort
::
Insert
(
sal_uLong
nOrgPos
,
sal_uLong
nNewPos
)
void
SwUndoSort
::
Insert
(
sal_uLong
nOrgPos
,
sal_uLong
nNewPos
)
{
{
SwSortUndoElement
*
pEle
=
new
SwSortUndoElement
(
nOrgPos
,
nNewPos
);
std
::
unique_ptr
<
SwSortUndoElement
>
p
(
new
SwSortUndoElement
(
nOrgPos
,
nNewPos
)
);
aSortList
.
push_back
(
pEle
);
m_SortList
.
push_back
(
std
::
move
(
p
)
);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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