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
32ec7666
Kaydet (Commit)
32ec7666
authored
Mar 27, 2013
tarafından
Thomas Arnhold
Kaydeden (comit)
Thorsten Behrens
Mar 27, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#62525: use cow_wrapper for FontAttribute
Change-Id: Ic07da7c7cf225a910e6f0fa4f6d20c4700e7ec7a
üst
0bca4ccd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
63 deletions
+32
-63
fontattribute.hxx
drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx
+5
-1
fontattribute.cxx
drawinglayer/source/attribute/fontattribute.cxx
+27
-62
No files found.
drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx
Dosyayı görüntüle @
32ec7666
...
...
@@ -21,6 +21,7 @@
#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
#include <drawinglayer/drawinglayerdllapi.h>
#include <o3tl/cow_wrapper.hxx>
//////////////////////////////////////////////////////////////////////////////
// predefines
...
...
@@ -44,8 +45,11 @@ namespace drawinglayer
*/
class
DRAWINGLAYER_DLLPUBLIC
FontAttribute
{
public
:
typedef
o3tl
::
cow_wrapper
<
ImpFontAttribute
>
ImplType
;
private
:
Imp
FontAttribute
*
mpFontAttribute
;
Imp
lType
mpFontAttribute
;
public
:
/// constructors/assignmentoperator/destructor
...
...
drawinglayer/source/attribute/fontattribute.cxx
Dosyayı görüntüle @
32ec7666
...
...
@@ -18,6 +18,7 @@
*/
#include <drawinglayer/attribute/fontattribute.hxx>
#include <rtl/instance.hxx>
#include <tools/string.hxx>
//////////////////////////////////////////////////////////////////////////////
...
...
@@ -29,9 +30,6 @@ namespace drawinglayer
class
ImpFontAttribute
{
public
:
// refcounter
sal_uInt32
mnRefCount
;
/// core data
String
maFamilyName
;
// Font Family Name
String
maStyleName
;
// Font Style Name
...
...
@@ -57,8 +55,7 @@ namespace drawinglayer
bool
bOutline
,
bool
bRTL
,
bool
bBiDiStrong
)
:
mnRefCount
(
0
),
maFamilyName
(
rFamilyName
),
:
maFamilyName
(
rFamilyName
),
maStyleName
(
rStyleName
),
mnWeight
(
nWeight
),
mbSymbol
(
bSymbol
),
...
...
@@ -71,6 +68,20 @@ namespace drawinglayer
{
}
ImpFontAttribute
()
:
maFamilyName
(),
maStyleName
(),
mnWeight
(
0
),
mbSymbol
(
false
),
mbVertical
(
false
),
mbItalic
(
false
),
mbOutline
(
false
),
mbRTL
(
false
),
mbBiDiStrong
(
false
),
mbMonospaced
(
false
)
{
}
// data read access
const
String
&
getFamilyName
()
const
{
return
maFamilyName
;
}
const
String
&
getStyleName
()
const
{
return
maStyleName
;
}
...
...
@@ -96,26 +107,14 @@ namespace drawinglayer
&&
getBiDiStrong
()
==
rCompare
.
getBiDiStrong
()
&&
getMonospaced
()
==
rCompare
.
getMonospaced
());
}
static
ImpFontAttribute
*
get_global_default
()
{
static
ImpFontAttribute
*
pDefault
=
0
;
if
(
!
pDefault
)
{
pDefault
=
new
ImpFontAttribute
(
String
(),
String
(),
0
,
false
,
false
,
false
,
false
,
false
,
false
,
false
);
// never delete; start with RefCount 1, not 0
pDefault
->
mnRefCount
++
;
}
return
pDefault
;
}
};
namespace
{
struct
theGlobalDefault
:
public
rtl
::
Static
<
FontAttribute
::
ImplType
,
theGlobalDefault
>
{};
}
FontAttribute
::
FontAttribute
(
const
String
&
rFamilyName
,
const
String
&
rStyleName
,
...
...
@@ -127,73 +126,39 @@ namespace drawinglayer
bool
bOutline
,
bool
bRTL
,
bool
bBiDiStrong
)
:
mpFontAttribute
(
new
ImpFontAttribute
(
:
mpFontAttribute
(
ImpFontAttribute
(
rFamilyName
,
rStyleName
,
nWeight
,
bSymbol
,
bVertical
,
bItalic
,
bMonospaced
,
bOutline
,
bRTL
,
bBiDiStrong
))
{
}
FontAttribute
::
FontAttribute
()
:
mpFontAttribute
(
ImpFontAttribute
::
get_global_defaul
t
())
:
mpFontAttribute
(
theGlobalDefault
::
ge
t
())
{
mpFontAttribute
->
mnRefCount
++
;
}
FontAttribute
::
FontAttribute
(
const
FontAttribute
&
rCandidate
)
:
mpFontAttribute
(
rCandidate
.
mpFontAttribute
)
{
mpFontAttribute
->
mnRefCount
++
;
}
FontAttribute
::~
FontAttribute
()
{
if
(
mpFontAttribute
->
mnRefCount
)
{
mpFontAttribute
->
mnRefCount
--
;
}
else
{
delete
mpFontAttribute
;
}
}
bool
FontAttribute
::
isDefault
()
const
{
return
mpFontAttribute
==
ImpFontAttribute
::
get_global_default
(
);
return
mpFontAttribute
.
same_object
(
theGlobalDefault
::
get
()
);
}
FontAttribute
&
FontAttribute
::
operator
=
(
const
FontAttribute
&
rCandidate
)
{
if
(
rCandidate
.
mpFontAttribute
!=
mpFontAttribute
)
{
if
(
mpFontAttribute
->
mnRefCount
)
{
mpFontAttribute
->
mnRefCount
--
;
}
else
{
delete
mpFontAttribute
;
}
mpFontAttribute
=
rCandidate
.
mpFontAttribute
;
mpFontAttribute
->
mnRefCount
++
;
}
mpFontAttribute
=
rCandidate
.
mpFontAttribute
;
return
*
this
;
}
bool
FontAttribute
::
operator
==
(
const
FontAttribute
&
rCandidate
)
const
{
if
(
rCandidate
.
mpFontAttribute
==
mpFontAttribute
)
{
return
true
;
}
if
(
rCandidate
.
isDefault
()
!=
isDefault
())
{
return
false
;
}
return
(
*
rCandidate
.
mpFontAttribute
==
*
mpFontAttribute
);
return
rCandidate
.
mpFontAttribute
==
mpFontAttribute
;
}
const
String
&
FontAttribute
::
getFamilyName
()
const
...
...
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