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
e2d92d64
Kaydet (Commit)
e2d92d64
authored
Kas 11, 2015
tarafından
Noel Grandin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcl: boost::ptr_vector->std::vector
Change-Id: Ib75e4dffb35032f273b9482341a438ccb9b00397
üst
6cc4118a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
27 deletions
+29
-27
svdata.cxx
vcl/source/app/svdata.cxx
+0
-1
textdoc.cxx
vcl/source/edit/textdoc.cxx
+23
-21
textdoc.hxx
vcl/source/edit/textdoc.hxx
+6
-5
No files found.
vcl/source/app/svdata.cxx
Dosyayı görüntüle @
e2d92d64
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
*/
*/
#include <string.h>
#include <string.h>
#include <boost/ptr_container/ptr_vector.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <comphelper/string.hxx>
...
...
vcl/source/edit/textdoc.cxx
Dosyayı görüntüle @
e2d92d64
...
@@ -19,13 +19,12 @@
...
@@ -19,13 +19,12 @@
#include <textdoc.hxx>
#include <textdoc.hxx>
#include <stdlib.h>
#include <stdlib.h>
#include <boost/mem_fn.hpp>
#include <osl/diagnose.h>
#include <osl/diagnose.h>
// compare function called by QuickSort
// compare function called by QuickSort
static
bool
CompareStart
(
const
TextCharAttrib
&
pFirst
,
const
TextCharAttrib
&
pSecond
)
static
bool
CompareStart
(
const
std
::
unique_ptr
<
TextCharAttrib
>&
pFirst
,
const
std
::
unique_ptr
<
TextCharAttrib
>
&
pSecond
)
{
{
return
pFirst
.
GetStart
()
<
pSecond
.
GetStart
();
return
pFirst
->
GetStart
()
<
pSecond
->
GetStart
();
}
}
TextCharAttrib
::
TextCharAttrib
(
const
TextAttrib
&
rAttr
,
sal_Int32
nStart
,
sal_Int32
nEnd
)
TextCharAttrib
::
TextCharAttrib
(
const
TextAttrib
&
rAttr
,
sal_Int32
nStart
,
sal_Int32
nEnd
)
...
@@ -71,31 +70,31 @@ void TextCharAttribList::InsertAttrib( TextCharAttrib* pAttrib )
...
@@ -71,31 +70,31 @@ void TextCharAttribList::InsertAttrib( TextCharAttrib* pAttrib )
bool
bInserted
=
false
;
bool
bInserted
=
false
;
for
(
TextCharAttribs
::
iterator
it
=
maAttribs
.
begin
();
it
!=
maAttribs
.
end
();
++
it
)
for
(
TextCharAttribs
::
iterator
it
=
maAttribs
.
begin
();
it
!=
maAttribs
.
end
();
++
it
)
{
{
if
(
it
->
GetStart
()
>
nStart
)
if
(
(
*
it
)
->
GetStart
()
>
nStart
)
{
{
maAttribs
.
insert
(
it
,
pAttrib
);
maAttribs
.
insert
(
it
,
std
::
unique_ptr
<
TextCharAttrib
>
(
pAttrib
)
);
bInserted
=
true
;
bInserted
=
true
;
break
;
break
;
}
}
}
}
if
(
!
bInserted
)
if
(
!
bInserted
)
maAttribs
.
push_back
(
pAttrib
);
maAttribs
.
push_back
(
std
::
unique_ptr
<
TextCharAttrib
>
(
pAttrib
)
);
}
}
void
TextCharAttribList
::
ResortAttribs
()
void
TextCharAttribList
::
ResortAttribs
()
{
{
maAttribs
.
sort
(
CompareStart
);
std
::
sort
(
maAttribs
.
begin
(),
maAttribs
.
end
(),
CompareStart
);
}
}
TextCharAttrib
*
TextCharAttribList
::
FindAttrib
(
sal_uInt16
nWhich
,
sal_Int32
nPos
)
TextCharAttrib
*
TextCharAttribList
::
FindAttrib
(
sal_uInt16
nWhich
,
sal_Int32
nPos
)
{
{
for
(
TextCharAttribs
::
reverse_iterator
it
=
maAttribs
.
rbegin
();
it
!=
maAttribs
.
rend
();
++
it
)
for
(
TextCharAttribs
::
reverse_iterator
it
=
maAttribs
.
rbegin
();
it
!=
maAttribs
.
rend
();
++
it
)
{
{
if
(
it
->
GetEnd
()
<
nPos
)
if
(
(
*
it
)
->
GetEnd
()
<
nPos
)
return
nullptr
;
return
nullptr
;
if
(
(
it
->
Which
()
==
nWhich
)
&&
it
->
IsIn
(
nPos
)
)
if
(
(
(
*
it
)
->
Which
()
==
nWhich
)
&&
(
*
it
)
->
IsIn
(
nPos
)
)
return
&*
it
;
return
it
->
get
()
;
}
}
return
nullptr
;
return
nullptr
;
}
}
...
@@ -105,10 +104,10 @@ const TextCharAttrib* TextCharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal
...
@@ -105,10 +104,10 @@ const TextCharAttrib* TextCharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal
DBG_ASSERT
(
nWhich
,
"FindNextAttrib: Which?"
);
DBG_ASSERT
(
nWhich
,
"FindNextAttrib: Which?"
);
for
(
TextCharAttribs
::
const_iterator
it
=
maAttribs
.
begin
();
it
!=
maAttribs
.
end
();
++
it
)
for
(
TextCharAttribs
::
const_iterator
it
=
maAttribs
.
begin
();
it
!=
maAttribs
.
end
();
++
it
)
{
{
if
(
(
it
->
GetStart
()
>=
nFromPos
)
&&
if
(
(
(
*
it
)
->
GetStart
()
>=
nFromPos
)
&&
(
it
->
GetEnd
()
<=
nMaxPos
)
&&
(
(
*
it
)
->
GetEnd
()
<=
nMaxPos
)
&&
(
it
->
Which
()
==
nWhich
)
)
(
(
*
it
)
->
Which
()
==
nWhich
)
)
return
&*
it
;
return
it
->
get
()
;
}
}
return
nullptr
;
return
nullptr
;
}
}
...
@@ -117,7 +116,7 @@ bool TextCharAttribList::HasAttrib( sal_uInt16 nWhich ) const
...
@@ -117,7 +116,7 @@ bool TextCharAttribList::HasAttrib( sal_uInt16 nWhich ) const
{
{
for
(
TextCharAttribs
::
const_reverse_iterator
it
=
maAttribs
.
rbegin
();
it
!=
maAttribs
.
rend
();
++
it
)
for
(
TextCharAttribs
::
const_reverse_iterator
it
=
maAttribs
.
rbegin
();
it
!=
maAttribs
.
rend
();
++
it
)
{
{
if
(
it
->
Which
()
==
nWhich
)
if
(
(
*
it
)
->
Which
()
==
nWhich
)
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -127,10 +126,10 @@ bool TextCharAttribList::HasBoundingAttrib( sal_Int32 nBound )
...
@@ -127,10 +126,10 @@ bool TextCharAttribList::HasBoundingAttrib( sal_Int32 nBound )
{
{
for
(
TextCharAttribs
::
reverse_iterator
it
=
maAttribs
.
rbegin
();
it
!=
maAttribs
.
rend
();
++
it
)
for
(
TextCharAttribs
::
reverse_iterator
it
=
maAttribs
.
rbegin
();
it
!=
maAttribs
.
rend
();
++
it
)
{
{
if
(
it
->
GetEnd
()
<
nBound
)
if
(
(
*
it
)
->
GetEnd
()
<
nBound
)
return
false
;
return
false
;
if
(
(
it
->
GetStart
()
==
nBound
)
||
(
it
->
GetEnd
()
==
nBound
)
)
if
(
(
(
*
it
)
->
GetStart
()
==
nBound
)
||
(
(
*
it
)
->
GetEnd
()
==
nBound
)
)
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -143,18 +142,21 @@ TextCharAttrib* TextCharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int3
...
@@ -143,18 +142,21 @@ TextCharAttrib* TextCharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int3
for
(
TextCharAttribs
::
iterator
it
=
maAttribs
.
begin
();
it
!=
maAttribs
.
end
();
++
it
)
for
(
TextCharAttribs
::
iterator
it
=
maAttribs
.
begin
();
it
!=
maAttribs
.
end
();
++
it
)
{
{
if
(
it
->
GetStart
()
>
nPos
)
if
(
(
*
it
)
->
GetStart
()
>
nPos
)
return
nullptr
;
return
nullptr
;
if
(
(
it
->
GetStart
()
==
nPos
)
&&
(
it
->
GetEnd
()
==
nPos
)
&&
(
it
->
Which
()
==
nWhich
)
)
if
(
(
(
*
it
)
->
GetStart
()
==
nPos
)
&&
(
(
*
it
)
->
GetEnd
()
==
nPos
)
&&
(
(
*
it
)
->
Which
()
==
nWhich
)
)
return
&*
it
;
return
it
->
get
()
;
}
}
return
nullptr
;
return
nullptr
;
}
}
void
TextCharAttribList
::
DeleteEmptyAttribs
()
void
TextCharAttribList
::
DeleteEmptyAttribs
()
{
{
maAttribs
.
erase_if
(
boost
::
mem_fn
(
&
TextCharAttrib
::
IsEmpty
));
maAttribs
.
erase
(
std
::
remove_if
(
maAttribs
.
begin
(),
maAttribs
.
end
(),
[]
(
const
std
::
unique_ptr
<
TextCharAttrib
>&
rAttrib
)
{
return
rAttrib
->
IsEmpty
();
}
),
maAttribs
.
end
()
);
mbHasEmptyAttribs
=
false
;
mbHasEmptyAttribs
=
false
;
}
}
...
...
vcl/source/edit/textdoc.hxx
Dosyayı görüntüle @
e2d92d64
...
@@ -23,7 +23,8 @@
...
@@ -23,7 +23,8 @@
#include <rtl/ustring.hxx>
#include <rtl/ustring.hxx>
#include <vcl/textdata.hxx>
#include <vcl/textdata.hxx>
#include <vcl/txtattr.hxx>
#include <vcl/txtattr.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <vector>
#include <memory>
class
TextCharAttribList
class
TextCharAttribList
{
{
...
@@ -31,7 +32,7 @@ private:
...
@@ -31,7 +32,7 @@ private:
TextCharAttribList
(
const
TextCharAttribList
&
)
=
delete
;
TextCharAttribList
(
const
TextCharAttribList
&
)
=
delete
;
TextCharAttribList
&
operator
=
(
const
TextCharAttribList
&
)
=
delete
;
TextCharAttribList
&
operator
=
(
const
TextCharAttribList
&
)
=
delete
;
typedef
boost
::
ptr_vector
<
TextCharAttrib
>
TextCharAttribs
;
typedef
std
::
vector
<
std
::
unique_ptr
<
TextCharAttrib
>
>
TextCharAttribs
;
TextCharAttribs
maAttribs
;
TextCharAttribs
maAttribs
;
bool
mbHasEmptyAttribs
;
bool
mbHasEmptyAttribs
;
...
@@ -42,9 +43,9 @@ public:
...
@@ -42,9 +43,9 @@ public:
void
Clear
();
void
Clear
();
sal_uInt16
Count
()
const
{
return
maAttribs
.
size
();
}
sal_uInt16
Count
()
const
{
return
maAttribs
.
size
();
}
const
TextCharAttrib
&
GetAttrib
(
sal_uInt16
n
)
const
{
return
maAttribs
[
n
]
;
}
const
TextCharAttrib
&
GetAttrib
(
sal_uInt16
n
)
const
{
return
*
maAttribs
[
n
].
get
()
;
}
TextCharAttrib
&
GetAttrib
(
sal_uInt16
n
)
{
return
maAttribs
[
n
]
;
}
TextCharAttrib
&
GetAttrib
(
sal_uInt16
n
)
{
return
*
maAttribs
[
n
].
get
()
;
}
void
RemoveAttrib
(
sal_uInt16
n
)
{
maAttribs
.
release
(
maAttribs
.
begin
()
+
n
).
release
(
);
}
void
RemoveAttrib
(
sal_uInt16
n
)
{
maAttribs
[
n
].
release
();
maAttribs
.
erase
(
maAttribs
.
begin
()
+
n
);
}
void
InsertAttrib
(
TextCharAttrib
*
pAttrib
);
void
InsertAttrib
(
TextCharAttrib
*
pAttrib
);
...
...
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