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
249386ec
Kaydet (Commit)
249386ec
authored
May 20, 2011
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
make these a well-behaved non-leaky singleton
üst
7d9d3dbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
38 deletions
+54
-38
imgmgr.cxx
sfx2/source/toolbox/imgmgr.cxx
+54
-38
No files found.
sfx2/source/toolbox/imgmgr.cxx
Dosyayı görüntüle @
249386ec
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdio.h>
#include <boost/unordered_map.hpp>
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include "sfx2/imgmgr.hxx"
#include "sfx2/imgmgr.hxx"
#include <sfx2/sfx.hrc>
#include <sfx2/sfx.hrc>
...
@@ -60,54 +61,46 @@ struct ToolBoxInf_Impl
...
@@ -60,54 +61,46 @@ struct ToolBoxInf_Impl
class
SfxImageManager_Impl
class
SfxImageManager_Impl
{
{
public
:
public
:
sal_Int16
m_nSymbolsSize
;
SvtMiscOptions
m_aOpt
;
SvtMiscOptions
m_aOpt
;
std
::
vector
<
ToolBoxInf_Impl
*
>
m_aToolBoxes
;
std
::
vector
<
ToolBoxInf_Impl
*
>
m_aToolBoxes
;
sal_Int16
m_nSymbolsSize
;
ImageList
*
m_pImageList
[
IMAGELIST_COUNT
];
ImageList
*
m_pImageList
[
IMAGELIST_COUNT
];
SfxModule
*
m_pModule
;
SfxModule
*
m_pModule
;
bool
m_bAppEventListener
;
ImageList
*
GetImageList
(
bool
bBig
);
ImageList
*
GetImageList
(
bool
bBig
);
Image
GetImage
(
sal_uInt16
nId
,
bool
bBig
);
Image
GetImage
(
sal_uInt16
nId
,
bool
bBig
);
void
SetSymbolsSize_Impl
(
sal_Int16
);
void
SetSymbolsSize_Impl
(
sal_Int16
);
DECL_LINK
(
OptionsChanged_Impl
,
void
*
);
DECL_LINK
(
OptionsChanged_Impl
,
void
*
);
DECL_LINK
(
SettingsChanged_Impl
,
void
*
);
DECL_LINK
(
SettingsChanged_Impl
,
VclWindowEvent
*
);
SfxImageManager_Impl
(
SfxModule
*
pModule
);
SfxImageManager_Impl
(
SfxModule
*
pModule
);
~
SfxImageManager_Impl
();
~
SfxImageManager_Impl
();
};
};
typedef
boost
::
unordered_map
<
sal_Int64
,
sal_Int64
>
SfxImageManagerMap
;
// global image lists
static
SfxImageManager_Impl
*
pGlobalImageManager
=
0
;
static
SfxImageManagerMap
m_ImageManager_ImplMap
;
static
SfxImageManagerMap
m_ImageManagerMap
;
static
SfxImageManager_Impl
*
GetImageManager
(
SfxModule
*
pModule
)
static
SfxImageManager_Impl
*
GetImageManager
(
SfxModule
*
pModule
)
{
{
SolarMutexGuard
aGuard
;
SolarMutexGuard
aGuard
;
if
(
pModule
==
0
)
if
(
pModule
==
0
)
{
{
if
(
!
pGlobalImageManager
)
static
SfxImageManager_Impl
aGlobalImageManager
(
0
);
pGlobalImageManager
=
new
SfxImageManager_Impl
(
0
);
return
&
aGlobalImageManager
;
return
pGlobalImageManager
;
}
}
else
else
{
{
typedef
boost
::
unordered_map
<
SfxModule
*
,
boost
::
shared_ptr
<
SfxImageManager_Impl
>
>
SfxImageManagerImplMap
;
static
SfxImageManagerImplMap
m_ImageManager_ImplMap
;
SfxImageManager_Impl
*
pImpl
(
0
);
SfxImageManager_Impl
*
pImpl
(
0
);
SfxImageManager
Map
::
const_iterator
pIter
=
m_ImageManager_ImplMap
.
find
(
sal
::
static_int_cast
<
sal_Int64
>
(
reinterpret_cast
<
sal_IntPtr
>
(
pModule
))
);
SfxImageManager
ImplMap
::
const_iterator
pIter
=
m_ImageManager_ImplMap
.
find
(
pModule
);
if
(
pIter
!=
m_ImageManager_ImplMap
.
end
()
)
if
(
pIter
!=
m_ImageManager_ImplMap
.
end
()
)
pImpl
=
reinterpret_cast
<
SfxImageManager_Impl
*
>
(
sal
::
static_int_cast
<
sal_IntPtr
>
(
pIter
->
second
)
);
pImpl
=
pIter
->
second
.
get
(
);
else
else
{
{
pImpl
=
new
SfxImageManager_Impl
(
pModule
);
m_ImageManager_ImplMap
[
pModule
].
reset
(
new
SfxImageManager_Impl
(
pModule
));
m_ImageManager_ImplMap
.
insert
(
pImpl
=
m_ImageManager_ImplMap
[
pModule
].
get
();
SfxImageManagerMap
::
value_type
(
sal
::
static_int_cast
<
sal_Int64
>
(
reinterpret_cast
<
sal_IntPtr
>
(
pModule
)),
sal
::
static_int_cast
<
sal_Int64
>
(
reinterpret_cast
<
sal_IntPtr
>
(
pImpl
))
));
}
}
return
pImpl
;
return
pImpl
;
}
}
...
@@ -145,15 +138,18 @@ static sal_Int16 impl_convertBools( sal_Bool bLarge )
...
@@ -145,15 +138,18 @@ static sal_Int16 impl_convertBools( sal_Bool bLarge )
//=========================================================================
//=========================================================================
SfxImageManager_Impl
::
SfxImageManager_Impl
(
SfxModule
*
pModule
)
:
SfxImageManager_Impl
::
SfxImageManager_Impl
(
SfxModule
*
pModule
)
m_nSymbolsSize
(
SvtMiscOptions
().
GetCurrentSymbolsSize
()
),
:
m_pModule
(
pModule
)
m_pModule
(
pModule
)
,
m_bAppEventListener
(
false
)
{
{
m_nSymbolsSize
=
m_aOpt
.
GetCurrentSymbolsSize
();
for
(
sal_uInt32
i
=
0
;
i
<
IMAGELIST_COUNT
;
i
++
)
for
(
sal_uInt32
i
=
0
;
i
<
IMAGELIST_COUNT
;
i
++
)
m_pImageList
[
i
]
=
0
;
m_pImageList
[
i
]
=
0
;
m_aOpt
.
AddListenerLink
(
LINK
(
this
,
SfxImageManager_Impl
,
OptionsChanged_Impl
)
);
m_aOpt
.
AddListenerLink
(
LINK
(
this
,
SfxImageManager_Impl
,
OptionsChanged_Impl
)
);
Application
::
AddEventListener
(
LINK
(
this
,
SfxImageManager_Impl
,
SettingsChanged_Impl
)
);
Application
::
AddEventListener
(
LINK
(
this
,
SfxImageManager_Impl
,
SettingsChanged_Impl
)
);
m_bAppEventListener
=
true
;
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
...
@@ -161,8 +157,8 @@ SfxImageManager_Impl::SfxImageManager_Impl( SfxModule* pModule ) :
...
@@ -161,8 +157,8 @@ SfxImageManager_Impl::SfxImageManager_Impl( SfxModule* pModule ) :
SfxImageManager_Impl
::~
SfxImageManager_Impl
()
SfxImageManager_Impl
::~
SfxImageManager_Impl
()
{
{
m_aOpt
.
RemoveListenerLink
(
LINK
(
this
,
SfxImageManager_Impl
,
OptionsChanged_Impl
)
);
m_aOpt
.
RemoveListenerLink
(
LINK
(
this
,
SfxImageManager_Impl
,
OptionsChanged_Impl
)
);
Application
::
RemoveEventListener
(
LINK
(
this
,
SfxImageManager_Impl
,
SettingsChanged_Impl
)
);
if
(
m_bAppEventListener
)
Application
::
RemoveEventListener
(
LINK
(
this
,
SfxImageManager_Impl
,
SettingsChanged_Impl
)
);
for
(
sal_uInt32
i
=
0
;
i
<
m_aToolBoxes
.
size
();
i
++
)
for
(
sal_uInt32
i
=
0
;
i
<
m_aToolBoxes
.
size
();
i
++
)
delete
m_aToolBoxes
[
i
];
delete
m_aToolBoxes
[
i
];
}
}
...
@@ -243,18 +239,37 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize )
...
@@ -243,18 +239,37 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize )
IMPL_LINK
(
SfxImageManager_Impl
,
OptionsChanged_Impl
,
void
*
,
EMPTYARG
)
IMPL_LINK
(
SfxImageManager_Impl
,
OptionsChanged_Impl
,
void
*
,
EMPTYARG
)
{
{
SetSymbolsSize_Impl
(
SvtMiscOptions
()
.
GetCurrentSymbolsSize
()
);
SetSymbolsSize_Impl
(
m_aOpt
.
GetCurrentSymbolsSize
()
);
return
0L
;
return
0L
;
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
IMPL_LINK
(
SfxImageManager_Impl
,
SettingsChanged_Impl
,
void
*
,
EMPTYARG
)
IMPL_LINK
(
SfxImageManager_Impl
,
SettingsChanged_Impl
,
VclWindowEvent
*
,
pEvent
)
{
{
// Check if toolbar button size have changed and we have to use system settings
if
(
pEvent
)
sal_Int16
nSymbolsSize
=
SvtMiscOptions
().
GetCurrentSymbolsSize
();
{
if
(
m_nSymbolsSize
!=
nSymbolsSize
)
switch
(
pEvent
->
GetId
())
SetSymbolsSize_Impl
(
nSymbolsSize
);
{
case
VCLEVENT_OBJECT_DYING
:
if
(
m_bAppEventListener
)
{
Application
::
RemoveEventListener
(
LINK
(
this
,
SfxImageManager_Impl
,
SettingsChanged_Impl
)
);
m_bAppEventListener
=
false
;
}
break
;
case
VCLEVENT_APPLICATION_DATACHANGED
:
// Check if toolbar button size have changed and we have to use system settings
{
sal_Int16
nSymbolsSize
=
m_aOpt
.
GetCurrentSymbolsSize
();
if
(
m_nSymbolsSize
!=
nSymbolsSize
)
SetSymbolsSize_Impl
(
nSymbolsSize
);
}
break
;
default
:
break
;
}
}
return
0L
;
return
0L
;
}
}
...
@@ -278,19 +293,20 @@ SfxImageManager::~SfxImageManager()
...
@@ -278,19 +293,20 @@ SfxImageManager::~SfxImageManager()
SfxImageManager
*
SfxImageManager
::
GetImageManager
(
SfxModule
*
pModule
)
SfxImageManager
*
SfxImageManager
::
GetImageManager
(
SfxModule
*
pModule
)
{
{
SolarMutexGuard
aGuard
;
SolarMutexGuard
aGuard
;
SfxImageManager
*
pSfxImageManager
(
0
);
typedef
boost
::
unordered_map
<
SfxModule
*
,
boost
::
shared_ptr
<
SfxImageManager
>
>
SfxImageManagerMap
;
static
SfxImageManagerMap
m_ImageManagerMap
;
SfxImageManagerMap
::
const_iterator
pIter
=
SfxImageManagerMap
::
const_iterator
pIter
=
m_ImageManagerMap
.
find
(
pModule
);
m_ImageManagerMap
.
find
(
sal
::
static_int_cast
<
sal_Int64
>
(
reinterpret_cast
<
sal_IntPtr
>
(
pModule
)));
if
(
pIter
!=
m_ImageManagerMap
.
end
()
)
if
(
pIter
!=
m_ImageManagerMap
.
end
()
)
return
reinterpret_cast
<
SfxImageManager
*
>
(
sal
::
static_int_cast
<
sal_IntPtr
>
(
pIter
->
second
)
);
pSfxImageManager
=
pIter
->
second
.
get
(
);
else
else
{
{
SfxImageManager
*
pSfxImageManager
=
new
SfxImageManager
(
pModule
);
m_ImageManagerMap
[
pModule
].
reset
(
new
SfxImageManager
(
pModule
));
m_ImageManagerMap
.
insert
(
SfxImageManagerMap
::
value_type
(
pSfxImageManager
=
m_ImageManagerMap
[
pModule
].
get
();
sal
::
static_int_cast
<
sal_Int64
>
(
reinterpret_cast
<
sal_IntPtr
>
(
pModule
)),
sal
::
static_int_cast
<
sal_Int64
>
(
reinterpret_cast
<
sal_IntPtr
>
(
pSfxImageManager
))
));
return
pSfxImageManager
;
}
}
return
pSfxImageManager
;
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
...
...
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