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
a249cfc2
Kaydet (Commit)
a249cfc2
authored
Kas 10, 2015
tarafından
Noel Grandin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I562b1f7cd1e5e7f7fc03b8f54bd6117255703eb5
üst
ed381a77
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
24 deletions
+27
-24
editdoc.cxx
editeng/source/editeng/editdoc.cxx
+24
-21
editdoc.hxx
editeng/source/editeng/editdoc.hxx
+2
-3
editundo.hxx
editeng/source/editeng/editundo.hxx
+1
-0
No files found.
editeng/source/editeng/editdoc.cxx
Dosyayı görüntüle @
a249cfc2
...
@@ -708,7 +708,7 @@ sal_Int32 FastGetPos(const _Array& rArray, const _Val* p, sal_Int32& rLastPos)
...
@@ -708,7 +708,7 @@ sal_Int32 FastGetPos(const _Array& rArray, const _Val* p, sal_Int32& rLastPos)
for
(
sal_Int32
nIdx
=
rLastPos
-
2
;
nIdx
<
nEnd
;
++
nIdx
)
for
(
sal_Int32
nIdx
=
rLastPos
-
2
;
nIdx
<
nEnd
;
++
nIdx
)
{
{
if
(
&
rArray
.
at
(
nIdx
)
==
p
)
if
(
rArray
.
at
(
nIdx
).
get
(
)
==
p
)
{
{
rLastPos
=
nIdx
;
rLastPos
=
nIdx
;
return
nIdx
;
return
nIdx
;
...
@@ -717,7 +717,7 @@ sal_Int32 FastGetPos(const _Array& rArray, const _Val* p, sal_Int32& rLastPos)
...
@@ -717,7 +717,7 @@ sal_Int32 FastGetPos(const _Array& rArray, const _Val* p, sal_Int32& rLastPos)
}
}
// The world's lamest linear search from svarray...
// The world's lamest linear search from svarray...
for
(
sal_Int32
nIdx
=
0
;
nIdx
<
nArrayLen
;
++
nIdx
)
for
(
sal_Int32
nIdx
=
0
;
nIdx
<
nArrayLen
;
++
nIdx
)
if
(
&
rArray
.
at
(
nIdx
)
==
p
)
if
(
rArray
.
at
(
nIdx
).
get
(
)
==
p
)
return
rLastPos
=
nIdx
;
return
rLastPos
=
nIdx
;
// XXX "not found" condition for sal_Int32 indexes
// XXX "not found" condition for sal_Int32 indexes
...
@@ -741,12 +741,12 @@ sal_Int32 ParaPortionList::GetPos(const ParaPortion* p) const
...
@@ -741,12 +741,12 @@ sal_Int32 ParaPortionList::GetPos(const ParaPortion* p) const
ParaPortion
*
ParaPortionList
::
operator
[](
sal_Int32
nPos
)
ParaPortion
*
ParaPortionList
::
operator
[](
sal_Int32
nPos
)
{
{
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maPortions
.
size
()
?
&
maPortions
[
nPos
]
:
nullptr
;
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maPortions
.
size
()
?
maPortions
[
nPos
].
get
()
:
nullptr
;
}
}
const
ParaPortion
*
ParaPortionList
::
operator
[](
sal_Int32
nPos
)
const
const
ParaPortion
*
ParaPortionList
::
operator
[](
sal_Int32
nPos
)
const
{
{
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maPortions
.
size
()
?
&
maPortions
[
nPos
]
:
nullptr
;
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maPortions
.
size
()
?
maPortions
[
nPos
].
get
()
:
nullptr
;
}
}
ParaPortion
*
ParaPortionList
::
Release
(
sal_Int32
nPos
)
ParaPortion
*
ParaPortionList
::
Release
(
sal_Int32
nPos
)
...
@@ -756,7 +756,9 @@ ParaPortion* ParaPortionList::Release(sal_Int32 nPos)
...
@@ -756,7 +756,9 @@ ParaPortion* ParaPortionList::Release(sal_Int32 nPos)
SAL_WARN
(
"editeng"
,
"ParaPortionList::Release - out of bounds pos "
<<
nPos
);
SAL_WARN
(
"editeng"
,
"ParaPortionList::Release - out of bounds pos "
<<
nPos
);
return
nullptr
;
return
nullptr
;
}
}
return
maPortions
.
release
(
maPortions
.
begin
()
+
nPos
).
release
();
ParaPortion
*
p
=
maPortions
[
nPos
].
release
();
maPortions
.
erase
(
maPortions
.
begin
()
+
nPos
);
return
p
;
}
}
void
ParaPortionList
::
Remove
(
sal_Int32
nPos
)
void
ParaPortionList
::
Remove
(
sal_Int32
nPos
)
...
@@ -776,12 +778,12 @@ void ParaPortionList::Insert(sal_Int32 nPos, ParaPortion* p)
...
@@ -776,12 +778,12 @@ void ParaPortionList::Insert(sal_Int32 nPos, ParaPortion* p)
SAL_WARN
(
"editeng"
,
"ParaPortionList::Insert - out of bounds pos "
<<
nPos
);
SAL_WARN
(
"editeng"
,
"ParaPortionList::Insert - out of bounds pos "
<<
nPos
);
return
;
return
;
}
}
maPortions
.
insert
(
maPortions
.
begin
()
+
nPos
,
p
);
maPortions
.
insert
(
maPortions
.
begin
()
+
nPos
,
std
::
unique_ptr
<
ParaPortion
>
(
p
)
);
}
}
void
ParaPortionList
::
Append
(
ParaPortion
*
p
)
void
ParaPortionList
::
Append
(
ParaPortion
*
p
)
{
{
maPortions
.
push_back
(
p
);
maPortions
.
push_back
(
std
::
unique_ptr
<
ParaPortion
>
(
p
)
);
}
}
sal_Int32
ParaPortionList
::
Count
()
const
sal_Int32
ParaPortionList
::
Count
()
const
...
@@ -805,7 +807,7 @@ long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const
...
@@ -805,7 +807,7 @@ long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const
long
nHeight
=
0
;
long
nHeight
=
0
;
for
(
sal_Int32
i
=
0
,
n
=
maPortions
.
size
();
i
<
n
;
++
i
)
for
(
sal_Int32
i
=
0
,
n
=
maPortions
.
size
();
i
<
n
;
++
i
)
{
{
const
ParaPortion
*
pTmpPortion
=
&
maPortions
[
i
]
;
const
ParaPortion
*
pTmpPortion
=
maPortions
[
i
].
get
()
;
if
(
pTmpPortion
==
pPPortion
)
if
(
pTmpPortion
==
pPPortion
)
return
nHeight
;
return
nHeight
;
nHeight
+=
pTmpPortion
->
GetHeight
();
nHeight
+=
pTmpPortion
->
GetHeight
();
...
@@ -819,7 +821,7 @@ sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const
...
@@ -819,7 +821,7 @@ sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const
long
nY
=
0
;
long
nY
=
0
;
for
(
size_t
i
=
0
,
n
=
maPortions
.
size
();
i
<
n
;
++
i
)
for
(
size_t
i
=
0
,
n
=
maPortions
.
size
();
i
<
n
;
++
i
)
{
{
nY
+=
maPortions
[
i
]
.
GetHeight
();
// should also be correct even in bVisible!
nY
+=
maPortions
[
i
]
->
GetHeight
();
// should also be correct even in bVisible!
if
(
nY
>
nYOffset
)
if
(
nY
>
nYOffset
)
return
i
<=
SAL_MAX_INT32
?
static_cast
<
sal_Int32
>
(
i
)
:
SAL_MAX_INT32
;
return
i
<=
SAL_MAX_INT32
?
static_cast
<
sal_Int32
>
(
i
)
:
SAL_MAX_INT32
;
}
}
...
@@ -828,12 +830,12 @@ sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const
...
@@ -828,12 +830,12 @@ sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const
const
ParaPortion
*
ParaPortionList
::
SafeGetObject
(
sal_Int32
nPos
)
const
const
ParaPortion
*
ParaPortionList
::
SafeGetObject
(
sal_Int32
nPos
)
const
{
{
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maPortions
.
size
()
?
&
maPortions
[
nPos
]
:
nullptr
;
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maPortions
.
size
()
?
maPortions
[
nPos
].
get
()
:
nullptr
;
}
}
ParaPortion
*
ParaPortionList
::
SafeGetObject
(
sal_Int32
nPos
)
ParaPortion
*
ParaPortionList
::
SafeGetObject
(
sal_Int32
nPos
)
{
{
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maPortions
.
size
()
?
&
maPortions
[
nPos
]
:
nullptr
;
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maPortions
.
size
()
?
maPortions
[
nPos
].
get
()
:
nullptr
;
}
}
#if OSL_DEBUG_LEVEL > 0
#if OSL_DEBUG_LEVEL > 0
...
@@ -1982,22 +1984,22 @@ EditDoc::~EditDoc()
...
@@ -1982,22 +1984,22 @@ EditDoc::~EditDoc()
namespace
{
namespace
{
class
RemoveEachItemFromPool
:
std
::
unary_function
<
ContentNode
,
void
>
class
RemoveEachItemFromPool
:
std
::
unary_function
<
std
::
unique_ptr
<
ContentNode
>
,
void
>
{
{
EditDoc
&
mrDoc
;
EditDoc
&
mrDoc
;
public
:
public
:
explicit
RemoveEachItemFromPool
(
EditDoc
&
rDoc
)
:
mrDoc
(
rDoc
)
{}
explicit
RemoveEachItemFromPool
(
EditDoc
&
rDoc
)
:
mrDoc
(
rDoc
)
{}
void
operator
()
(
const
ContentNode
&
rNode
)
void
operator
()
(
const
std
::
unique_ptr
<
ContentNode
>
&
rNode
)
{
{
mrDoc
.
RemoveItemsFromPool
(
rNode
);
mrDoc
.
RemoveItemsFromPool
(
*
rNode
.
get
()
);
}
}
};
};
struct
ClearSpellErrorsHandler
:
std
::
unary_function
<
ContentNode
,
void
>
struct
ClearSpellErrorsHandler
:
std
::
unary_function
<
std
::
unique_ptr
<
ContentNode
>
,
void
>
{
{
void
operator
()
(
ContentNode
&
rNode
)
void
operator
()
(
std
::
unique_ptr
<
ContentNode
>
&
rNode
)
{
{
rNode
.
DestroyWrongList
();
rNode
->
DestroyWrongList
();
}
}
};
};
...
@@ -2118,12 +2120,12 @@ sal_Int32 EditDoc::GetPos(const ContentNode* p) const
...
@@ -2118,12 +2120,12 @@ sal_Int32 EditDoc::GetPos(const ContentNode* p) const
const
ContentNode
*
EditDoc
::
GetObject
(
sal_Int32
nPos
)
const
const
ContentNode
*
EditDoc
::
GetObject
(
sal_Int32
nPos
)
const
{
{
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maContents
.
size
()
?
&
maContents
[
nPos
]
:
nullptr
;
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maContents
.
size
()
?
maContents
[
nPos
].
get
()
:
nullptr
;
}
}
ContentNode
*
EditDoc
::
GetObject
(
sal_Int32
nPos
)
ContentNode
*
EditDoc
::
GetObject
(
sal_Int32
nPos
)
{
{
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maContents
.
size
()
?
&
maContents
[
nPos
]
:
nullptr
;
return
0
<=
nPos
&&
nPos
<
(
sal_Int32
)
maContents
.
size
()
?
maContents
[
nPos
].
get
()
:
nullptr
;
}
}
const
ContentNode
*
EditDoc
::
operator
[](
sal_Int32
nPos
)
const
const
ContentNode
*
EditDoc
::
operator
[](
sal_Int32
nPos
)
const
...
@@ -2143,7 +2145,7 @@ void EditDoc::Insert(sal_Int32 nPos, ContentNode* p)
...
@@ -2143,7 +2145,7 @@ void EditDoc::Insert(sal_Int32 nPos, ContentNode* p)
SAL_WARN
(
"editeng"
,
"EditDoc::Insert - overflow pos "
<<
nPos
);
SAL_WARN
(
"editeng"
,
"EditDoc::Insert - overflow pos "
<<
nPos
);
return
;
return
;
}
}
maContents
.
insert
(
maContents
.
begin
()
+
nPos
,
p
);
maContents
.
insert
(
maContents
.
begin
()
+
nPos
,
std
::
unique_ptr
<
ContentNode
>
(
p
)
);
}
}
void
EditDoc
::
Remove
(
sal_Int32
nPos
)
void
EditDoc
::
Remove
(
sal_Int32
nPos
)
...
@@ -2163,7 +2165,8 @@ void EditDoc::Release(sal_Int32 nPos)
...
@@ -2163,7 +2165,8 @@ void EditDoc::Release(sal_Int32 nPos)
SAL_WARN
(
"editeng"
,
"EditDoc::Release - out of bounds pos "
<<
nPos
);
SAL_WARN
(
"editeng"
,
"EditDoc::Release - out of bounds pos "
<<
nPos
);
return
;
return
;
}
}
maContents
.
release
(
maContents
.
begin
()
+
nPos
).
release
();
maContents
[
nPos
].
release
();
maContents
.
erase
(
maContents
.
begin
()
+
nPos
);
}
}
sal_Int32
EditDoc
::
Count
()
const
sal_Int32
EditDoc
::
Count
()
const
...
...
editeng/source/editeng/editdoc.hxx
Dosyayı görüntüle @
a249cfc2
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
#include <memory>
#include <memory>
#include <vector>
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp>
#include <boost/noncopyable.hpp>
class
ImpEditEngine
;
class
ImpEditEngine
;
...
@@ -655,7 +654,7 @@ public:
...
@@ -655,7 +654,7 @@ public:
class
ParaPortionList
class
ParaPortionList
{
{
mutable
sal_Int32
nLastCache
;
mutable
sal_Int32
nLastCache
;
boost
::
ptr_vector
<
ParaPortion
>
maPortions
;
std
::
vector
<
std
::
unique_ptr
<
ParaPortion
>
>
maPortions
;
public
:
public
:
ParaPortionList
();
ParaPortionList
();
~
ParaPortionList
();
~
ParaPortionList
();
...
@@ -743,7 +742,7 @@ class EditDoc
...
@@ -743,7 +742,7 @@ class EditDoc
{
{
private
:
private
:
mutable
sal_Int32
nLastCache
;
mutable
sal_Int32
nLastCache
;
boost
::
ptr_vector
<
ContentNode
>
maContents
;
std
::
vector
<
std
::
unique_ptr
<
ContentNode
>
>
maContents
;
SfxItemPool
*
pItemPool
;
SfxItemPool
*
pItemPool
;
Link
<
LinkParamNone
*
,
void
>
aModifyHdl
;
Link
<
LinkParamNone
*
,
void
>
aModifyHdl
;
...
...
editeng/source/editeng/editundo.hxx
Dosyayı görüntüle @
a249cfc2
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include <editdoc.hxx>
#include <editdoc.hxx>
#include <editeng/editund2.hxx>
#include <editeng/editund2.hxx>
#include <editeng/editdata.hxx>
#include <editeng/editdata.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
class
EditEngine
;
class
EditEngine
;
class
EditView
;
class
EditView
;
...
...
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