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
7e862a2d
Kaydet (Commit)
7e862a2d
authored
Kas 23, 2012
tarafından
Jan Holesovsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Apply Style: Preview styles directly in the Apply Style combo box.
Change-Id: I5042b5bc61da65dc85cb406e5137e0395b699fbf
üst
10370f3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
3 deletions
+103
-3
tbcontrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
+103
-3
No files found.
svx/source/tbxctrls/tbcontrl.cxx
Dosyayı görüntüle @
7e862a2d
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <tools/color.hxx>
#include <tools/color.hxx>
#include <svl/poolitem.hxx>
#include <svl/poolitem.hxx>
#include <svl/eitem.hxx>
#include <svl/eitem.hxx>
#include <svl/itemset.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/bmpacc.hxx>
#include <svtools/valueset.hxx>
#include <svtools/valueset.hxx>
...
@@ -66,13 +67,15 @@
...
@@ -66,13 +67,15 @@
#include "helpid.hrc"
#include "helpid.hrc"
#include "svx/htmlmode.hxx"
#include "svx/htmlmode.hxx"
#include <svx/xtable.hxx>
#include <svx/xtable.hxx>
#include
"editeng/fontitem.hxx"
#include
<editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/brshitem.hxx>
#include <editeng/brshitem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/colritem.hxx>
#include <editeng/colritem.hxx>
#include "editeng/flstitem.hxx"
#include <editeng/flstitem.hxx>
#include "editeng/bolnitem.hxx"
#include <editeng/bolnitem.hxx>
#include <editeng/postitem.hxx>
#include <editeng/wghtitem.hxx>
#include "svx/drawitem.hxx"
#include "svx/drawitem.hxx"
#include <svx/tbcontrl.hxx>
#include <svx/tbcontrl.hxx>
#include "svx/dlgutil.hxx"
#include "svx/dlgutil.hxx"
...
@@ -140,6 +143,8 @@ public:
...
@@ -140,6 +143,8 @@ public:
virtual
void
DataChanged
(
const
DataChangedEvent
&
rDCEvt
);
virtual
void
DataChanged
(
const
DataChangedEvent
&
rDCEvt
);
virtual
void
StateChanged
(
StateChangedType
nStateChange
);
virtual
void
StateChanged
(
StateChangedType
nStateChange
);
virtual
void
UserDraw
(
const
UserDrawEvent
&
rUDEvt
);
inline
void
SetVisibilityListener
(
const
Link
&
aVisListener
)
{
aVisibilityListener
=
aVisListener
;
}
inline
void
SetVisibilityListener
(
const
Link
&
aVisListener
)
{
aVisibilityListener
=
aVisListener
;
}
inline
void
RemoveVisibilityListener
()
{
aVisibilityListener
=
Link
();
}
inline
void
RemoveVisibilityListener
()
{
aVisibilityListener
=
Link
();
}
...
@@ -339,6 +344,8 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(
...
@@ -339,6 +344,8 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(
{
{
aLogicalSize
=
PixelToLogic
(
GetSizePixel
(),
MAP_APPFONT
);
aLogicalSize
=
PixelToLogic
(
GetSizePixel
(),
MAP_APPFONT
);
EnableAutocomplete
(
sal_True
);
EnableAutocomplete
(
sal_True
);
EnableUserDraw
(
true
);
SetUserItemSize
(
Size
(
0
,
30
)
);
}
}
SvxStyleBox_Impl
::~
SvxStyleBox_Impl
()
SvxStyleBox_Impl
::~
SvxStyleBox_Impl
()
...
@@ -516,6 +523,99 @@ void SvxStyleBox_Impl::StateChanged( StateChangedType nStateChange )
...
@@ -516,6 +523,99 @@ void SvxStyleBox_Impl::StateChanged( StateChangedType nStateChange )
}
}
}
}
void
SvxStyleBox_Impl
::
UserDraw
(
const
UserDrawEvent
&
rUDEvt
)
{
sal_uInt16
nItem
=
rUDEvt
.
GetItemId
();
if
(
nItem
==
0
||
nItem
==
GetEntryCount
()
-
1
)
{
// draw the non-style entries, ie. "Clear Formatting" or "More..."
DrawEntry
(
rUDEvt
,
true
,
true
);
}
else
{
SfxObjectShell
*
pShell
=
SfxObjectShell
::
Current
();
SfxStyleSheetBasePool
*
pPool
=
pShell
->
GetStyleSheetPool
();
SfxStyleSheetBase
*
pStyle
=
NULL
;
OUString
aStyleName
(
GetEntry
(
nItem
)
);
if
(
pPool
)
{
pPool
->
SetSearchMask
(
eStyleFamily
,
SFXSTYLEBIT_ALL
);
pStyle
=
pPool
->
First
();
while
(
pStyle
&&
OUString
(
pStyle
->
GetName
()
)
!=
aStyleName
)
pStyle
=
pPool
->
Next
();
}
if
(
!
pStyle
)
{
// cannot find the style for whatever reason
DrawEntry
(
rUDEvt
,
true
,
true
);
}
else
{
const
SfxItemSet
&
aItemSet
=
pStyle
->
GetItemSet
();
// all the font properties
//const SvxColorItem *pColorItem = static_cast< const SvxColorItem* >( aItemSet.GetItem( SID_ATTR_CHAR_COLOR ) );
const
SvxFontItem
*
pFontItem
=
static_cast
<
const
SvxFontItem
*
>
(
aItemSet
.
GetItem
(
SID_ATTR_CHAR_FONT
)
);
const
SvxFontHeightItem
*
pFontHeightItem
=
static_cast
<
const
SvxFontHeightItem
*
>
(
aItemSet
.
GetItem
(
SID_ATTR_CHAR_FONTHEIGHT
)
);
if
(
pFontItem
&&
pFontHeightItem
)
{
OutputDevice
*
pDevice
=
rUDEvt
.
GetDevice
();
Size
aFontSize
(
pFontHeightItem
->
GetHeight
(),
pFontHeightItem
->
GetHeight
()
);
Size
aPixelSize
(
pDevice
->
LogicToPixel
(
aFontSize
,
pShell
->
GetMapUnit
()
)
);
// setup the font properties
Font
aFont
(
pFontItem
->
GetFamilyName
(),
pFontItem
->
GetStyleName
(),
aPixelSize
);
const
SfxPoolItem
*
pItem
=
aItemSet
.
GetItem
(
SID_ATTR_CHAR_POSTURE
);
if
(
pItem
)
aFont
.
SetItalic
(
static_cast
<
const
SvxPostureItem
*
>
(
pItem
)
->
GetPosture
()
);
pItem
=
aItemSet
.
GetItem
(
SID_ATTR_CHAR_WEIGHT
);
if
(
pItem
)
aFont
.
SetWeight
(
static_cast
<
const
SvxWeightItem
*
>
(
pItem
)
->
GetWeight
()
);
// TODO more properties
// setup the device & draw
Font
aOldFont
(
pDevice
->
GetFont
()
);
//Color aOldColor( pDevice->GetTextColor() );
pDevice
->
SetFont
(
aFont
);
//pDevice->SetTextColor( pColorItem->GetValue() );
// IMG_TXT_DISTANCE in ilstbox.hxx is 6, then 1 is added as
// nBorder, and we are adding 1 in order to look better when
// italics is present
const
int
nLeftDistance
=
8
;
Rectangle
aTextRect
;
pDevice
->
GetTextBoundRect
(
aTextRect
,
aStyleName
);
Point
aPos
(
rUDEvt
.
GetRect
().
TopLeft
()
);
aPos
.
X
()
+=
nLeftDistance
;
aPos
.
Y
()
+=
std
::
max
(
0L
,
(
rUDEvt
.
GetRect
().
GetHeight
()
-
aTextRect
.
Bottom
()
)
/
2
);
pDevice
->
DrawText
(
aPos
,
aStyleName
);
//pDevice->SetTextColor( aOldColor );
pDevice
->
SetFont
(
aOldFont
);
// draw separator, if present
DrawEntry
(
rUDEvt
,
false
,
false
);
}
else
DrawEntry
(
rUDEvt
,
true
,
true
);
}
}
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
IMPL_STATIC_LINK
(
SvxStyleBox_Impl
,
FocusHdl_Impl
,
Control
*
,
_pCtrl
)
IMPL_STATIC_LINK
(
SvxStyleBox_Impl
,
FocusHdl_Impl
,
Control
*
,
_pCtrl
)
...
...
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