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
af4aaa22
Kaydet (Commit)
af4aaa22
authored
Tem 09, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Let's not derive from std::vector.
Change-Id: I512d97d36c344df097cc5a1ac90aa9d3d219c1e9
üst
9c451090
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
19 deletions
+39
-19
svdetc.hxx
include/svx/svdetc.hxx
+8
-2
svdetc.cxx
svx/source/svdraw/svdetc.cxx
+31
-17
No files found.
include/svx/svdetc.hxx
Dosyayı görüntüle @
af4aaa22
...
@@ -195,9 +195,11 @@ SdrLinkList& ImpGetUserMakeObjUserDataHdl();
...
@@ -195,9 +195,11 @@ SdrLinkList& ImpGetUserMakeObjUserDataHdl();
class
SdrOle2Obj
;
class
SdrOle2Obj
;
class
AutoTimer
;
class
AutoTimer
;
class
OLEObjCache
:
public
std
::
vector
<
SdrOle2Obj
*>
class
OLEObjCache
{
{
sal_uIntPtr
nSize
;
std
::
vector
<
SdrOle2Obj
*>
maObjs
;
size_t
nSize
;
AutoTimer
*
pTimer
;
AutoTimer
*
pTimer
;
void
UnloadOnDemand
();
void
UnloadOnDemand
();
...
@@ -210,6 +212,10 @@ public:
...
@@ -210,6 +212,10 @@ public:
void
InsertObj
(
SdrOle2Obj
*
pObj
);
void
InsertObj
(
SdrOle2Obj
*
pObj
);
void
RemoveObj
(
SdrOle2Obj
*
pObj
);
void
RemoveObj
(
SdrOle2Obj
*
pObj
);
size_t
size
()
const
;
SdrOle2Obj
*
operator
[](
size_t
nPos
);
const
SdrOle2Obj
*
operator
[](
size_t
nPos
)
const
;
};
};
...
...
svx/source/svdraw/svdetc.cxx
Dosyayı görüntüle @
af4aaa22
...
@@ -95,7 +95,6 @@ const LocaleDataWrapper* SdrGlobalData::GetLocaleData()
...
@@ -95,7 +95,6 @@ const LocaleDataWrapper* SdrGlobalData::GetLocaleData()
OLEObjCache
::
OLEObjCache
()
OLEObjCache
::
OLEObjCache
()
:
std
::
vector
<
SdrOle2Obj
*>
()
{
{
nSize
=
officecfg
::
Office
::
Common
::
Cache
::
DrawingEngine
::
OLE_Objects
::
get
();
nSize
=
officecfg
::
Office
::
Common
::
Cache
::
DrawingEngine
::
OLE_Objects
::
get
();
pTimer
=
new
AutoTimer
();
pTimer
=
new
AutoTimer
();
...
@@ -116,15 +115,15 @@ OLEObjCache::~OLEObjCache()
...
@@ -116,15 +115,15 @@ OLEObjCache::~OLEObjCache()
void
OLEObjCache
::
UnloadOnDemand
()
void
OLEObjCache
::
UnloadOnDemand
()
{
{
if
(
nSize
<
size
()
)
if
(
nSize
<
maObjs
.
size
()
)
{
{
// more objects than configured cache size try to remove objects
// more objects than configured cache size try to remove objects
// of course not the freshly inserted one at nIndex=0
// of course not the freshly inserted one at nIndex=0
s
al_uIntPtr
nCount2
=
size
();
s
ize_t
nCount2
=
maObjs
.
size
();
s
al_uIntPtr
nIndex
=
nCount2
-
1
;
s
ize_t
nIndex
=
nCount2
-
1
;
while
(
nIndex
&&
nCount2
>
nSize
)
while
(
nIndex
&&
nCount2
>
nSize
)
{
{
SdrOle2Obj
*
pUnloadObj
=
(
*
this
)
[
nIndex
--
];
SdrOle2Obj
*
pUnloadObj
=
maObjs
[
nIndex
--
];
if
(
pUnloadObj
)
if
(
pUnloadObj
)
{
{
try
try
...
@@ -140,9 +139,9 @@ void OLEObjCache::UnloadOnDemand()
...
@@ -140,9 +139,9 @@ void OLEObjCache::UnloadOnDemand()
uno
::
Reference
<
frame
::
XModel
>
xUnloadModel
(
xUnloadObj
->
getComponent
(),
uno
::
UNO_QUERY
);
uno
::
Reference
<
frame
::
XModel
>
xUnloadModel
(
xUnloadObj
->
getComponent
(),
uno
::
UNO_QUERY
);
if
(
xUnloadModel
.
is
()
)
if
(
xUnloadModel
.
is
()
)
{
{
for
(
sal_uIntPtr
nCheckInd
=
0
;
nCheckInd
<
size
();
nCheckInd
++
)
for
(
size_t
nCheckInd
=
0
;
nCheckInd
<
maObjs
.
size
();
nCheckInd
++
)
{
{
SdrOle2Obj
*
pCacheObj
=
(
*
this
)
[
nCheckInd
];
SdrOle2Obj
*
pCacheObj
=
maObjs
[
nCheckInd
];
if
(
pCacheObj
&&
pCacheObj
!=
pUnloadObj
)
if
(
pCacheObj
&&
pCacheObj
!=
pUnloadObj
)
{
{
uno
::
Reference
<
frame
::
XModel
>
xParentModel
=
pCacheObj
->
GetParentXModel
();
uno
::
Reference
<
frame
::
XModel
>
xParentModel
=
pCacheObj
->
GetParentXModel
();
...
@@ -166,22 +165,22 @@ void OLEObjCache::UnloadOnDemand()
...
@@ -166,22 +165,22 @@ void OLEObjCache::UnloadOnDemand()
void
OLEObjCache
::
InsertObj
(
SdrOle2Obj
*
pObj
)
void
OLEObjCache
::
InsertObj
(
SdrOle2Obj
*
pObj
)
{
{
if
(
!
empty
()
)
if
(
!
maObjs
.
empty
()
)
{
{
SdrOle2Obj
*
pExistingObj
=
front
();
SdrOle2Obj
*
pExistingObj
=
maObjs
.
front
();
if
(
pObj
==
pExistingObj
)
if
(
pObj
==
pExistingObj
)
// the object is already on the top, nothing has to be changed
// the object is already on the top, nothing has to be changed
return
;
return
;
}
}
// get the old position of the object to know whether it is already in container
// get the old position of the object to know whether it is already in container
iterator
it
=
std
::
find
(
begin
(),
end
(),
pObj
);
std
::
vector
<
SdrOle2Obj
*>::
iterator
it
=
std
::
find
(
maObjs
.
begin
(),
maObjs
.
end
(),
pObj
);
bool
bFound
=
it
!=
end
();
bool
bFound
=
it
!=
maObjs
.
end
();
if
(
it
!=
end
()
)
if
(
bFound
)
erase
(
it
);
maObjs
.
erase
(
it
);
// insert object into first position
// insert object into first position
insert
(
begin
(),
pObj
);
maObjs
.
insert
(
maObjs
.
begin
(),
pObj
);
if
(
!
bFound
)
if
(
!
bFound
)
{
{
...
@@ -192,9 +191,24 @@ void OLEObjCache::InsertObj(SdrOle2Obj* pObj)
...
@@ -192,9 +191,24 @@ void OLEObjCache::InsertObj(SdrOle2Obj* pObj)
void
OLEObjCache
::
RemoveObj
(
SdrOle2Obj
*
pObj
)
void
OLEObjCache
::
RemoveObj
(
SdrOle2Obj
*
pObj
)
{
{
iterator
it
=
std
::
find
(
begin
(),
end
(),
pObj
);
std
::
vector
<
SdrOle2Obj
*>::
iterator
it
=
std
::
find
(
maObjs
.
begin
(),
maObjs
.
end
(),
pObj
);
if
(
it
!=
end
()
)
if
(
it
!=
maObjs
.
end
())
erase
(
it
);
maObjs
.
erase
(
it
);
}
size_t
OLEObjCache
::
size
()
const
{
return
maObjs
.
size
();
}
SdrOle2Obj
*
OLEObjCache
::
operator
[](
size_t
nPos
)
{
return
maObjs
[
nPos
];
}
const
SdrOle2Obj
*
OLEObjCache
::
operator
[](
size_t
nPos
)
const
{
return
maObjs
[
nPos
];
}
}
bool
OLEObjCache
::
UnloadObj
(
SdrOle2Obj
*
pObj
)
bool
OLEObjCache
::
UnloadObj
(
SdrOle2Obj
*
pObj
)
...
...
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