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
a0ba87f9
Kaydet (Commit)
a0ba87f9
authored
May 11, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor HeadBar to use RenderContext
Change-Id: Ica05591754633fc64216aecbdf8010800133dfd4
üst
7d890d04
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
178 additions
and
212 deletions
+178
-212
headbar.hxx
include/svtools/headbar.hxx
+5
-9
headbar.cxx
svtools/source/control/headbar.cxx
+173
-203
No files found.
include/svtools/headbar.hxx
Dosyayı görüntüle @
a0ba87f9
...
@@ -271,14 +271,10 @@ private:
...
@@ -271,14 +271,10 @@ private:
using
Window
::
ImplHitTest
;
using
Window
::
ImplHitTest
;
SVT_DLLPRIVATE
sal_uInt16
ImplHitTest
(
const
Point
&
rPos
,
long
&
nMouseOff
,
sal_uInt16
&
nPos
)
const
;
SVT_DLLPRIVATE
sal_uInt16
ImplHitTest
(
const
Point
&
rPos
,
long
&
nMouseOff
,
sal_uInt16
&
nPos
)
const
;
SVT_DLLPRIVATE
void
ImplInvertDrag
(
sal_uInt16
nStartPos
,
sal_uInt16
nEndPos
);
SVT_DLLPRIVATE
void
ImplInvertDrag
(
sal_uInt16
nStartPos
,
sal_uInt16
nEndPos
);
SVT_DLLPRIVATE
void
ImplDrawItem
(
OutputDevice
*
pDev
,
SVT_DLLPRIVATE
void
ImplDrawItem
(
vcl
::
RenderContext
&
rRenderContext
,
sal_uInt16
nPos
,
bool
bHigh
,
bool
bDrag
,
sal_uInt16
nPos
,
bool
bHigh
,
bool
bDrag
,
const
Rectangle
&
rItemRect
,
const
Rectangle
*
pRect
,
sal_uLong
nFlags
);
const
Rectangle
&
rItemRect
,
SVT_DLLPRIVATE
void
ImplDrawItem
(
vcl
::
RenderContext
&
rRenderContext
,
sal_uInt16
nPos
,
bool
bHigh
=
false
,
const
Rectangle
*
pRect
,
bool
bDrag
=
false
,
const
Rectangle
*
pRect
=
NULL
);
sal_uLong
nFlags
);
SVT_DLLPRIVATE
void
ImplDrawItem
(
sal_uInt16
nPos
,
bool
bHigh
=
false
,
bool
bDrag
=
false
,
const
Rectangle
*
pRect
=
NULL
);
SVT_DLLPRIVATE
void
ImplUpdate
(
sal_uInt16
nPos
,
SVT_DLLPRIVATE
void
ImplUpdate
(
sal_uInt16
nPos
,
bool
bEnd
=
false
,
bool
bDirect
=
false
);
bool
bEnd
=
false
,
bool
bDirect
=
false
);
SVT_DLLPRIVATE
void
ImplStartDrag
(
const
Point
&
rPos
,
bool
bCommand
);
SVT_DLLPRIVATE
void
ImplStartDrag
(
const
Point
&
rPos
,
bool
bCommand
);
...
@@ -293,7 +289,7 @@ public:
...
@@ -293,7 +289,7 @@ public:
virtual
void
MouseButtonDown
(
const
MouseEvent
&
rMEvt
)
SAL_OVERRIDE
;
virtual
void
MouseButtonDown
(
const
MouseEvent
&
rMEvt
)
SAL_OVERRIDE
;
virtual
void
MouseMove
(
const
MouseEvent
&
rMEvt
)
SAL_OVERRIDE
;
virtual
void
MouseMove
(
const
MouseEvent
&
rMEvt
)
SAL_OVERRIDE
;
virtual
void
Tracking
(
const
TrackingEvent
&
rTEvt
)
SAL_OVERRIDE
;
virtual
void
Tracking
(
const
TrackingEvent
&
rTEvt
)
SAL_OVERRIDE
;
virtual
void
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
virtual
void
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
virtual
void
Draw
(
OutputDevice
*
pDev
,
const
Point
&
rPos
,
const
Size
&
rSize
,
sal_uLong
nFlags
)
SAL_OVERRIDE
;
virtual
void
Draw
(
OutputDevice
*
pDev
,
const
Point
&
rPos
,
const
Size
&
rSize
,
sal_uLong
nFlags
)
SAL_OVERRIDE
;
virtual
void
Resize
()
SAL_OVERRIDE
;
virtual
void
Resize
()
SAL_OVERRIDE
;
virtual
void
Command
(
const
CommandEvent
&
rCEvt
)
SAL_OVERRIDE
;
virtual
void
Command
(
const
CommandEvent
&
rCEvt
)
SAL_OVERRIDE
;
...
...
svtools/source/control/headbar.cxx
Dosyayı görüntüle @
a0ba87f9
...
@@ -302,13 +302,9 @@ void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos )
...
@@ -302,13 +302,9 @@ void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos )
void
HeaderBar
::
ImplDrawItem
(
OutputDevice
*
pDev
,
void
HeaderBar
::
ImplDrawItem
(
vcl
::
RenderContext
&
rRenderContext
,
sal_uInt16
nPos
,
bool
bHigh
,
bool
bDrag
,
sal_uInt16
nPos
,
bool
bHigh
,
bool
bDrag
,
const
Rectangle
&
rItemRect
,
const
Rectangle
*
pRect
,
sal_uLong
)
const
Rectangle
&
rItemRect
,
const
Rectangle
*
pRect
,
sal_uLong
)
{
{
vcl
::
Window
*
const
pWin
=
(
pDev
->
GetOutDevType
()
==
OUTDEV_WINDOW
)
?
static_cast
<
vcl
::
Window
*>
(
pDev
)
:
NULL
;
ImplControlValue
aControlValue
(
0
);
ImplControlValue
aControlValue
(
0
);
Rectangle
aCtrlRegion
;
Rectangle
aCtrlRegion
;
ControlState
nState
(
ControlState
::
NONE
);
ControlState
nState
(
ControlState
::
NONE
);
...
@@ -316,35 +312,34 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
...
@@ -316,35 +312,34 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
Rectangle
aRect
=
rItemRect
;
Rectangle
aRect
=
rItemRect
;
// do not display if there is no space
// do not display if there is no space
if
(
aRect
.
GetWidth
()
<=
1
)
if
(
aRect
.
GetWidth
()
<=
1
)
return
;
return
;
// check of rectangle is visible
// check of rectangle is visible
if
(
pRect
)
if
(
pRect
)
{
{
if
(
aRect
.
Right
()
<
pRect
->
Left
()
)
if
(
aRect
.
Right
()
<
pRect
->
Left
()
)
return
;
return
;
else
if
(
aRect
.
Left
()
>
pRect
->
Right
()
)
else
if
(
aRect
.
Left
()
>
pRect
->
Right
()
)
return
;
return
;
}
}
else
else
{
{
if
(
aRect
.
Right
()
<
0
)
if
(
aRect
.
Right
()
<
0
)
return
;
return
;
else
if
(
aRect
.
Left
()
>
mnDX
)
else
if
(
aRect
.
Left
()
>
mnDX
)
return
;
return
;
}
}
ImplHeadItem
*
pItem
=
(
*
mpItemList
)[
nPos
];
ImplHeadItem
*
pItem
=
(
*
mpItemList
)[
nPos
];
HeaderBarItemBits
nBits
=
pItem
->
mnBits
;
HeaderBarItemBits
nBits
=
pItem
->
mnBits
;
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
const
StyleSettings
&
rStyleSettings
=
rRenderContext
.
GetSettings
().
GetStyleSettings
();
if
(
pWin
&&
pWin
->
IsNativeControlSupported
(
CTRL_WINDOW_BACKGROUND
,
PART_ENTIRE_CONTROL
)
)
if
(
rRenderContext
.
IsNativeControlSupported
(
CTRL_WINDOW_BACKGROUND
,
PART_ENTIRE_CONTROL
)
)
{
{
aCtrlRegion
=
aRect
;
aCtrlRegion
=
aRect
;
pWin
->
DrawNativeControl
(
CTRL_WINDOW_BACKGROUND
,
PART_ENTIRE_CONTROL
,
rRenderContext
.
DrawNativeControl
(
CTRL_WINDOW_BACKGROUND
,
PART_ENTIRE_CONTROL
,
aCtrlRegion
,
nState
,
aControlValue
,
aCtrlRegion
,
nState
,
aControlValue
,
OUString
());
OUString
()
);
}
}
else
else
...
@@ -356,64 +351,62 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
...
@@ -356,64 +351,62 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
// delete background
// delete background
if
(
!
pRect
||
bDrag
)
if
(
!
pRect
||
bDrag
)
{
{
if
(
bDrag
)
if
(
bDrag
)
{
{
pDev
->
SetLineColor
();
rRenderContext
.
SetLineColor
();
pDev
->
SetFillColor
(
rStyleSettings
.
GetCheckedColor
()
);
rRenderContext
.
SetFillColor
(
rStyleSettings
.
GetCheckedColor
()
);
pDev
->
DrawRect
(
aRect
);
rRenderContext
.
DrawRect
(
aRect
);
}
}
else
else
pDev
->
DrawWallpaper
(
aRect
,
GetBackground
()
);
rRenderContext
.
DrawWallpaper
(
aRect
,
rRenderContext
.
GetBackground
()
);
}
}
}
}
Color
aSelectionTextColor
(
COL_TRANSPARENT
);
Color
aSelectionTextColor
(
COL_TRANSPARENT
);
if
(
pWin
&&
pWin
->
IsNativeControlSupported
(
CTRL_LISTHEADER
,
PART_BUTTON
)
)
if
(
rRenderContext
.
IsNativeControlSupported
(
CTRL_LISTHEADER
,
PART_BUTTON
)
)
{
{
aCtrlRegion
=
aRect
;
aCtrlRegion
=
aRect
;
aControlValue
.
setTristateVal
(
BUTTONVALUE_ON
);
aControlValue
.
setTristateVal
(
BUTTONVALUE_ON
);
nState
|=
ControlState
::
ENABLED
;
nState
|=
ControlState
::
ENABLED
;
if
(
bHigh
)
if
(
bHigh
)
nState
|=
ControlState
::
PRESSED
;
nState
|=
ControlState
::
PRESSED
;
pWin
->
DrawNativeControl
(
CTRL_LISTHEADER
,
PART_BUTTON
,
rRenderContext
.
DrawNativeControl
(
CTRL_LISTHEADER
,
PART_BUTTON
,
aCtrlRegion
,
nState
,
aControlValue
,
aCtrlRegion
,
nState
,
aControlValue
,
OUString
());
OUString
()
);
}
}
else
else
{
{
// draw separation line
// draw separation line
pDev
->
SetLineColor
(
rStyleSettings
.
GetDarkShadowColor
()
);
rRenderContext
.
SetLineColor
(
rStyleSettings
.
GetDarkShadowColor
());
pDev
->
DrawLine
(
Point
(
aRect
.
Right
(),
aRect
.
Top
()
),
rRenderContext
.
DrawLine
(
Point
(
aRect
.
Right
(),
aRect
.
Top
()),
Point
(
aRect
.
Right
(),
aRect
.
Bottom
()));
Point
(
aRect
.
Right
(),
aRect
.
Bottom
()
)
);
// draw ButtonStyle
// draw ButtonStyle
// avoid 3D borders
// avoid 3D borders
if
(
bHigh
)
if
(
bHigh
)
DrawSelectionBackground
(
aRect
,
1
,
true
,
false
,
false
,
&
aSelectionTextColor
);
DrawSelectionBackground
(
aRect
,
1
,
true
,
false
,
false
,
&
aSelectionTextColor
);
else
if
(
!
mbButtonStyle
||
(
nBits
&
HeaderBarItemBits
::
FLAT
)
)
else
if
(
!
mbButtonStyle
||
(
nBits
&
HeaderBarItemBits
::
FLAT
)
)
DrawSelectionBackground
(
aRect
,
0
,
true
,
false
,
false
,
&
aSelectionTextColor
);
DrawSelectionBackground
(
aRect
,
0
,
true
,
false
,
false
,
&
aSelectionTextColor
);
}
}
// do not draw if there is no space
// do not draw if there is no space
if
(
aRect
.
GetWidth
()
<
1
)
if
(
aRect
.
GetWidth
()
<
1
)
return
;
return
;
// calculate size and position and draw content
// calculate size and position and draw content
pItem
->
maOutText
=
pItem
->
maText
;
pItem
->
maOutText
=
pItem
->
maText
;
Size
aImageSize
=
pItem
->
maImage
.
GetSizePixel
();
Size
aImageSize
=
pItem
->
maImage
.
GetSizePixel
();
Size
aTxtSize
(
pDev
->
GetTextWidth
(
pItem
->
maOutText
),
0
);
Size
aTxtSize
(
rRenderContext
.
GetTextWidth
(
pItem
->
maOutText
),
0
);
if
(
!
pItem
->
maOutText
.
isEmpty
())
if
(
!
pItem
->
maOutText
.
isEmpty
())
aTxtSize
.
Height
()
=
pDev
->
GetTextHeight
();
aTxtSize
.
Height
()
=
rRenderContext
.
GetTextHeight
();
long
nArrowWidth
=
0
;
long
nArrowWidth
=
0
;
if
(
nBits
&
(
HeaderBarItemBits
::
UPARROW
|
HeaderBarItemBits
::
DOWNARROW
)
)
if
(
nBits
&
(
HeaderBarItemBits
::
UPARROW
|
HeaderBarItemBits
::
DOWNARROW
)
)
nArrowWidth
=
HEAD_ARROWSIZE2
+
HEADERBAR_ARROWOFF
;
nArrowWidth
=
HEAD_ARROWSIZE2
+
HEADERBAR_ARROWOFF
;
// do not draw if there is not enough space for the image
// do not draw if there is not enough space for the image
long
nTestHeight
=
aImageSize
.
Height
();
long
nTestHeight
=
aImageSize
.
Height
();
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
nTestHeight
+=
aTxtSize
.
Height
();
nTestHeight
+=
aTxtSize
.
Height
();
if
(
(
aImageSize
.
Width
()
>
aRect
.
GetWidth
())
||
(
nTestHeight
>
aRect
.
GetHeight
())
)
if
(
(
aImageSize
.
Width
()
>
aRect
.
GetWidth
())
||
(
nTestHeight
>
aRect
.
GetHeight
())
)
{
{
aImageSize
.
Width
()
=
0
;
aImageSize
.
Width
()
=
0
;
aImageSize
.
Height
()
=
0
;
aImageSize
.
Height
()
=
0
;
...
@@ -421,83 +414,82 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
...
@@ -421,83 +414,82 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
// cut text to correct length
// cut text to correct length
bool
bLeftText
=
false
;
bool
bLeftText
=
false
;
long
nMaxTxtWidth
=
aRect
.
GetWidth
()
-
(
HEADERBAR_TEXTOFF
*
2
)
-
nArrowWidth
;
long
nMaxTxtWidth
=
aRect
.
GetWidth
()
-
(
HEADERBAR_TEXTOFF
*
2
)
-
nArrowWidth
;
if
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
)
)
if
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
)
)
nMaxTxtWidth
-=
aImageSize
.
Width
();
nMaxTxtWidth
-=
aImageSize
.
Width
();
long
nTxtWidth
=
aTxtSize
.
Width
();
long
nTxtWidth
=
aTxtSize
.
Width
();
if
(
nTxtWidth
>
nMaxTxtWidth
)
if
(
nTxtWidth
>
nMaxTxtWidth
)
{
{
bLeftText
=
true
;
bLeftText
=
true
;
OUStringBuffer
aBuf
(
pItem
->
maOutText
);
OUStringBuffer
aBuf
(
pItem
->
maOutText
);
aBuf
.
append
(
"..."
);
aBuf
.
append
(
"..."
);
do
do
{
{
aBuf
.
remove
(
aBuf
.
getLength
()
-
3
-
1
,
1
);
aBuf
.
remove
(
aBuf
.
getLength
()
-
3
-
1
,
1
);
nTxtWidth
=
pDev
->
GetTextWidth
(
aBuf
.
toString
()
);
nTxtWidth
=
rRenderContext
.
GetTextWidth
(
aBuf
.
toString
()
);
}
}
while
(
(
nTxtWidth
>
nMaxTxtWidth
)
&&
(
aBuf
.
getLength
()
>
3
)
);
while
(
(
nTxtWidth
>
nMaxTxtWidth
)
&&
(
aBuf
.
getLength
()
>
3
)
);
pItem
->
maOutText
=
aBuf
.
makeStringAndClear
();
pItem
->
maOutText
=
aBuf
.
makeStringAndClear
();
if
(
pItem
->
maOutText
.
getLength
()
==
3
)
if
(
pItem
->
maOutText
.
getLength
()
==
3
)
{
{
nTxtWidth
=
0
;
nTxtWidth
=
0
;
(
pItem
->
maOutText
)
.
clear
();
pItem
->
maOutText
.
clear
();
}
}
}
}
// calculate text/imageposition
// calculate text/imageposition
long
nTxtPos
;
long
nTxtPos
;
if
(
!
bLeftText
&&
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
)
if
(
!
bLeftText
&&
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
)
{
{
nTxtPos
=
aRect
.
Right
()
-
nTxtWidth
-
HEADERBAR_TEXTOFF
;
nTxtPos
=
aRect
.
Right
()
-
nTxtWidth
-
HEADERBAR_TEXTOFF
;
if
(
nBits
&
HeaderBarItemBits
::
RIGHTIMAGE
)
if
(
nBits
&
HeaderBarItemBits
::
RIGHTIMAGE
)
nTxtPos
-=
aImageSize
.
Width
();
nTxtPos
-=
aImageSize
.
Width
();
}
}
else
if
(
!
bLeftText
&&
(
nBits
&
HeaderBarItemBits
::
CENTER
)
)
else
if
(
!
bLeftText
&&
(
nBits
&
HeaderBarItemBits
::
CENTER
)
)
{
{
long
nTempWidth
=
nTxtWidth
;
long
nTempWidth
=
nTxtWidth
;
if
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
)
)
if
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
)
)
nTempWidth
+=
aImageSize
.
Width
();
nTempWidth
+=
aImageSize
.
Width
();
nTxtPos
=
aRect
.
Left
()
+
(
aRect
.
GetWidth
()
-
nTempWidth
)
/
2
;
nTxtPos
=
aRect
.
Left
()
+
(
aRect
.
GetWidth
()
-
nTempWidth
)
/
2
;
if
(
nBits
&
HeaderBarItemBits
::
LEFTIMAGE
)
if
(
nBits
&
HeaderBarItemBits
::
LEFTIMAGE
)
nTxtPos
+=
aImageSize
.
Width
();
nTxtPos
+=
aImageSize
.
Width
();
if
(
nArrowWidth
)
if
(
nArrowWidth
)
{
{
if
(
nTxtPos
+
nTxtWidth
+
nArrowWidth
>=
aRect
.
Right
()
)
if
(
nTxtPos
+
nTxtWidth
+
nArrowWidth
>=
aRect
.
Right
()
)
{
{
nTxtPos
=
aRect
.
Left
()
+
HEADERBAR_TEXTOFF
;
nTxtPos
=
aRect
.
Left
()
+
HEADERBAR_TEXTOFF
;
if
(
nBits
&
HeaderBarItemBits
::
LEFTIMAGE
)
if
(
nBits
&
HeaderBarItemBits
::
LEFTIMAGE
)
nTxtPos
+=
aImageSize
.
Width
();
nTxtPos
+=
aImageSize
.
Width
();
}
}
}
}
}
}
else
else
{
{
nTxtPos
=
aRect
.
Left
()
+
HEADERBAR_TEXTOFF
;
nTxtPos
=
aRect
.
Left
()
+
HEADERBAR_TEXTOFF
;
if
(
nBits
&
HeaderBarItemBits
::
LEFTIMAGE
)
if
(
nBits
&
HeaderBarItemBits
::
LEFTIMAGE
)
nTxtPos
+=
aImageSize
.
Width
();
nTxtPos
+=
aImageSize
.
Width
();
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
nTxtPos
+=
nArrowWidth
;
nTxtPos
+=
nArrowWidth
;
}
}
// calculate text/imageposition
// calculate text/imageposition
long
nTxtPosY
=
0
;
long
nTxtPosY
=
0
;
if
(
!
pItem
->
maOutText
.
isEmpty
()
||
(
nArrowWidth
&&
aTxtSize
.
Height
())
)
if
(
!
pItem
->
maOutText
.
isEmpty
()
||
(
nArrowWidth
&&
aTxtSize
.
Height
())
)
{
{
if
(
nBits
&
HeaderBarItemBits
::
TOP
)
if
(
nBits
&
HeaderBarItemBits
::
TOP
)
{
{
nTxtPosY
=
aRect
.
Top
();
nTxtPosY
=
aRect
.
Top
();
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
nTxtPosY
+=
aImageSize
.
Height
();
nTxtPosY
+=
aImageSize
.
Height
();
}
}
else
if
(
nBits
&
HeaderBarItemBits
::
BOTTOM
)
else
if
(
nBits
&
HeaderBarItemBits
::
BOTTOM
)
nTxtPosY
=
aRect
.
Bottom
()
-
aTxtSize
.
Height
();
nTxtPosY
=
aRect
.
Bottom
()
-
aTxtSize
.
Height
();
else
else
{
{
long
nTempHeight
=
aTxtSize
.
Height
();
long
nTempHeight
=
aTxtSize
.
Height
();
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
nTempHeight
+=
aImageSize
.
Height
();
nTempHeight
+=
aImageSize
.
Height
();
nTxtPosY
=
aRect
.
Top
()
+
((
aRect
.
GetHeight
()
-
nTempHeight
)
/
2
);
nTxtPosY
=
aRect
.
Top
()
+
((
aRect
.
GetHeight
()
-
nTempHeight
)
/
2
);
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
nTxtPosY
+=
aImageSize
.
Height
();
nTxtPosY
+=
aImageSize
.
Height
();
}
}
}
}
...
@@ -505,80 +497,80 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
...
@@ -505,80 +497,80 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
// display text
// display text
if
(
!
pItem
->
maOutText
.
isEmpty
())
if
(
!
pItem
->
maOutText
.
isEmpty
())
{
{
if
(
aSelectionTextColor
!=
Color
(
COL_TRANSPARENT
)
)
if
(
aSelectionTextColor
!=
Color
(
COL_TRANSPARENT
)
)
{
{
pDev
->
Push
(
PushFlags
::
TEXTCOLOR
);
rRenderContext
.
Push
(
PushFlags
::
TEXTCOLOR
);
pDev
->
SetTextColor
(
aSelectionTextColor
);
rRenderContext
.
SetTextColor
(
aSelectionTextColor
);
}
}
if
(
IsEnabled
()
)
if
(
IsEnabled
()
)
pDev
->
DrawText
(
Point
(
nTxtPos
,
nTxtPosY
),
pItem
->
maOutText
);
rRenderContext
.
DrawText
(
Point
(
nTxtPos
,
nTxtPosY
),
pItem
->
maOutText
);
else
else
pDev
->
DrawCtrlText
(
Point
(
nTxtPos
,
nTxtPosY
),
pItem
->
maOutText
,
0
,
pItem
->
maOutText
.
getLength
(),
TEXT_DRAW_DISABLE
);
rRenderContext
.
DrawCtrlText
(
Point
(
nTxtPos
,
nTxtPosY
),
pItem
->
maOutText
,
0
,
pItem
->
maOutText
.
getLength
(),
TEXT_DRAW_DISABLE
);
if
(
aSelectionTextColor
!=
Color
(
COL_TRANSPARENT
)
)
if
(
aSelectionTextColor
!=
Color
(
COL_TRANSPARENT
)
)
pDev
->
Pop
();
rRenderContext
.
Pop
();
}
}
// calculate the position and draw image if it is available
// calculate the position and draw image if it is available
long
nImagePosY
=
0
;
long
nImagePosY
=
0
;
if
(
aImageSize
.
Width
()
&&
aImageSize
.
Height
()
)
if
(
aImageSize
.
Width
()
&&
aImageSize
.
Height
()
)
{
{
long
nImagePos
=
nTxtPos
;
long
nImagePos
=
nTxtPos
;
if
(
nBits
&
HeaderBarItemBits
::
LEFTIMAGE
)
if
(
nBits
&
HeaderBarItemBits
::
LEFTIMAGE
)
{
{
nImagePos
-=
aImageSize
.
Width
();
nImagePos
-=
aImageSize
.
Width
();
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
nImagePos
-=
nArrowWidth
;
nImagePos
-=
nArrowWidth
;
}
}
else
if
(
nBits
&
HeaderBarItemBits
::
RIGHTIMAGE
)
else
if
(
nBits
&
HeaderBarItemBits
::
RIGHTIMAGE
)
{
{
nImagePos
+=
nTxtWidth
;
nImagePos
+=
nTxtWidth
;
if
(
!
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
)
if
(
!
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
)
nImagePos
+=
nArrowWidth
;
nImagePos
+=
nArrowWidth
;
}
}
else
else
{
{
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
nImagePos
=
aRect
.
Right
()
-
aImageSize
.
Width
();
nImagePos
=
aRect
.
Right
()
-
aImageSize
.
Width
();
else
if
(
nBits
&
HeaderBarItemBits
::
CENTER
)
else
if
(
nBits
&
HeaderBarItemBits
::
CENTER
)
nImagePos
=
aRect
.
Left
()
+
(
aRect
.
GetWidth
()
-
aImageSize
.
Width
())
/
2
;
nImagePos
=
aRect
.
Left
()
+
(
aRect
.
GetWidth
()
-
aImageSize
.
Width
())
/
2
;
else
else
nImagePos
=
aRect
.
Left
()
+
HEADERBAR_TEXTOFF
;
nImagePos
=
aRect
.
Left
()
+
HEADERBAR_TEXTOFF
;
}
}
if
(
nBits
&
HeaderBarItemBits
::
TOP
)
if
(
nBits
&
HeaderBarItemBits
::
TOP
)
nImagePosY
=
aRect
.
Top
();
nImagePosY
=
aRect
.
Top
();
else
if
(
nBits
&
HeaderBarItemBits
::
BOTTOM
)
else
if
(
nBits
&
HeaderBarItemBits
::
BOTTOM
)
{
{
nImagePosY
=
aRect
.
Bottom
()
-
aImageSize
.
Height
();
nImagePosY
=
aRect
.
Bottom
()
-
aImageSize
.
Height
();
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
nImagePosY
-=
aTxtSize
.
Height
();
nImagePosY
-=
aTxtSize
.
Height
();
}
}
else
else
{
{
long
nTempHeight
=
aImageSize
.
Height
();
long
nTempHeight
=
aImageSize
.
Height
();
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
)
nTempHeight
+=
aTxtSize
.
Height
();
nTempHeight
+=
aTxtSize
.
Height
();
nImagePosY
=
aRect
.
Top
()
+
((
aRect
.
GetHeight
()
-
nTempHeight
)
/
2
);
nImagePosY
=
aRect
.
Top
()
+
((
aRect
.
GetHeight
()
-
nTempHeight
)
/
2
);
}
}
if
(
nImagePos
+
aImageSize
.
Width
()
<=
aRect
.
Right
()
)
if
(
nImagePos
+
aImageSize
.
Width
()
<=
aRect
.
Right
()
)
{
{
sal_uInt16
nStyle
=
0
;
sal_uInt16
nStyle
=
0
;
if
(
!
IsEnabled
()
)
if
(
!
IsEnabled
()
)
nStyle
|=
IMAGE_DRAW_DISABLE
;
nStyle
|=
IMAGE_DRAW_DISABLE
;
pDev
->
DrawImage
(
Point
(
nImagePos
,
nImagePosY
),
pItem
->
maImage
,
nStyle
);
rRenderContext
.
DrawImage
(
Point
(
nImagePos
,
nImagePosY
),
pItem
->
maImage
,
nStyle
);
}
}
}
}
if
(
nBits
&
(
HeaderBarItemBits
::
UPARROW
|
HeaderBarItemBits
::
DOWNARROW
)
)
if
(
nBits
&
(
HeaderBarItemBits
::
UPARROW
|
HeaderBarItemBits
::
DOWNARROW
)
)
{
{
long
nArrowX
=
nTxtPos
;
long
nArrowX
=
nTxtPos
;
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
nArrowX
-=
nArrowWidth
;
nArrowX
-=
nArrowWidth
;
else
else
nArrowX
+=
nTxtWidth
+
HEADERBAR_ARROWOFF
;
nArrowX
+=
nTxtWidth
+
HEADERBAR_ARROWOFF
;
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
&&
pItem
->
maText
.
isEmpty
()
)
if
(
!
(
nBits
&
(
HeaderBarItemBits
::
LEFTIMAGE
|
HeaderBarItemBits
::
RIGHTIMAGE
))
&&
pItem
->
maText
.
isEmpty
()
)
{
{
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
if
(
nBits
&
HeaderBarItemBits
::
RIGHT
)
nArrowX
-=
aImageSize
.
Width
();
nArrowX
-=
aImageSize
.
Width
();
else
else
nArrowX
+=
aImageSize
.
Width
();
nArrowX
+=
aImageSize
.
Width
();
...
@@ -586,63 +578,62 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
...
@@ -586,63 +578,62 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
// is there enough space to draw the item?
// is there enough space to draw the item?
bool
bDraw
=
true
;
bool
bDraw
=
true
;
if
(
nArrowX
<
aRect
.
Left
()
+
HEADERBAR_TEXTOFF
)
if
(
nArrowX
<
aRect
.
Left
()
+
HEADERBAR_TEXTOFF
)
bDraw
=
false
;
bDraw
=
false
;
else
if
(
nArrowX
+
HEAD_ARROWSIZE2
>
aRect
.
Right
()
)
else
if
(
nArrowX
+
HEAD_ARROWSIZE2
>
aRect
.
Right
()
)
bDraw
=
false
;
bDraw
=
false
;
if
(
bDraw
)
if
(
bDraw
)
{
{
if
(
pWin
&&
pWin
->
IsNativeControlSupported
(
CTRL_LISTHEADER
,
PART_ARROW
)
)
if
(
rRenderContext
.
IsNativeControlSupported
(
CTRL_LISTHEADER
,
PART_ARROW
)
)
{
{
aCtrlRegion
=
Rectangle
(
Point
(
nArrowX
,
aRect
.
Top
()),
Size
(
nArrowWidth
,
aRect
.
GetHeight
()));
aCtrlRegion
=
Rectangle
(
Point
(
nArrowX
,
aRect
.
Top
()),
Size
(
nArrowWidth
,
aRect
.
GetHeight
()));
// control value passes 1 if arrow points down, 0 otherwise
// control value passes 1 if arrow points down, 0 otherwise
aControlValue
.
setNumericVal
((
nBits
&
HeaderBarItemBits
::
DOWNARROW
)
?
1
:
0
);
aControlValue
.
setNumericVal
((
nBits
&
HeaderBarItemBits
::
DOWNARROW
)
?
1
:
0
);
nState
|=
ControlState
::
ENABLED
;
nState
|=
ControlState
::
ENABLED
;
if
(
bHigh
)
if
(
bHigh
)
nState
|=
ControlState
::
PRESSED
;
nState
|=
ControlState
::
PRESSED
;
pWin
->
DrawNativeControl
(
CTRL_LISTHEADER
,
PART_ARROW
,
rRenderContext
.
DrawNativeControl
(
CTRL_LISTHEADER
,
PART_ARROW
,
aCtrlRegion
,
aCtrlRegion
,
nState
,
aControlValue
,
nState
,
aControlValue
,
OUString
());
OUString
()
);
}
}
else
else
{
{
long
nArrowY
;
long
nArrowY
;
if
(
aTxtSize
.
Height
()
)
if
(
aTxtSize
.
Height
()
)
nArrowY
=
nTxtPosY
+
(
aTxtSize
.
Height
()
/
2
);
nArrowY
=
nTxtPosY
+
(
aTxtSize
.
Height
()
/
2
);
else
if
(
aImageSize
.
Width
()
&&
aImageSize
.
Height
()
)
else
if
(
aImageSize
.
Width
()
&&
aImageSize
.
Height
()
)
nArrowY
=
nImagePosY
+
(
aImageSize
.
Height
()
/
2
);
nArrowY
=
nImagePosY
+
(
aImageSize
.
Height
()
/
2
);
else
else
{
{
if
(
nBits
&
HeaderBarItemBits
::
TOP
)
if
(
nBits
&
HeaderBarItemBits
::
TOP
)
nArrowY
=
aRect
.
Top
()
+
1
;
nArrowY
=
aRect
.
Top
()
+
1
;
else
if
(
nBits
&
HeaderBarItemBits
::
BOTTOM
)
else
if
(
nBits
&
HeaderBarItemBits
::
BOTTOM
)
nArrowY
=
aRect
.
Bottom
()
-
HEAD_ARROWSIZE2
-
1
;
nArrowY
=
aRect
.
Bottom
()
-
HEAD_ARROWSIZE2
-
1
;
else
else
nArrowY
=
aRect
.
Top
()
+
((
aRect
.
GetHeight
()
-
HEAD_ARROWSIZE2
)
/
2
);
nArrowY
=
aRect
.
Top
()
+
((
aRect
.
GetHeight
()
-
HEAD_ARROWSIZE2
)
/
2
);
}
}
nArrowY
-=
HEAD_ARROWSIZE1
-
1
;
nArrowY
-=
HEAD_ARROWSIZE1
-
1
;
if
(
nBits
&
HeaderBarItemBits
::
DOWNARROW
)
if
(
nBits
&
HeaderBarItemBits
::
DOWNARROW
)
{
{
pDev
->
SetLineColor
(
rStyleSettings
.
GetLightColor
()
);
rRenderContext
.
SetLineColor
(
rStyleSettings
.
GetLightColor
()
);
pDev
->
DrawLine
(
Point
(
nArrowX
,
nArrowY
),
rRenderContext
.
DrawLine
(
Point
(
nArrowX
,
nArrowY
),
Point
(
nArrowX
+
HEAD_ARROWSIZE2
,
nArrowY
)
);
Point
(
nArrowX
+
HEAD_ARROWSIZE2
,
nArrowY
)
);
pDev
->
DrawLine
(
Point
(
nArrowX
,
nArrowY
),
rRenderContext
.
DrawLine
(
Point
(
nArrowX
,
nArrowY
),
Point
(
nArrowX
+
HEAD_ARROWSIZE1
,
nArrowY
+
HEAD_ARROWSIZE2
)
);
Point
(
nArrowX
+
HEAD_ARROWSIZE1
,
nArrowY
+
HEAD_ARROWSIZE2
)
);
pDev
->
SetLineColor
(
rStyleSettings
.
GetShadowColor
()
);
rRenderContext
.
SetLineColor
(
rStyleSettings
.
GetShadowColor
()
);
pDev
->
DrawLine
(
Point
(
nArrowX
+
HEAD_ARROWSIZE1
,
nArrowY
+
HEAD_ARROWSIZE2
),
rRenderContext
.
DrawLine
(
Point
(
nArrowX
+
HEAD_ARROWSIZE1
,
nArrowY
+
HEAD_ARROWSIZE2
),
Point
(
nArrowX
+
HEAD_ARROWSIZE2
,
nArrowY
)
);
Point
(
nArrowX
+
HEAD_ARROWSIZE2
,
nArrowY
)
);
}
}
else
else
{
{
pDev
->
SetLineColor
(
rStyleSettings
.
GetLightColor
()
);
rRenderContext
.
SetLineColor
(
rStyleSettings
.
GetLightColor
()
);
pDev
->
DrawLine
(
Point
(
nArrowX
,
nArrowY
+
HEAD_ARROWSIZE2
),
rRenderContext
.
DrawLine
(
Point
(
nArrowX
,
nArrowY
+
HEAD_ARROWSIZE2
),
Point
(
nArrowX
+
HEAD_ARROWSIZE1
,
nArrowY
)
);
Point
(
nArrowX
+
HEAD_ARROWSIZE1
,
nArrowY
)
);
pDev
->
SetLineColor
(
rStyleSettings
.
GetShadowColor
()
);
rRenderContext
.
SetLineColor
(
rStyleSettings
.
GetShadowColor
()
);
pDev
->
DrawLine
(
Point
(
nArrowX
,
nArrowY
+
HEAD_ARROWSIZE2
),
rRenderContext
.
DrawLine
(
Point
(
nArrowX
,
nArrowY
+
HEAD_ARROWSIZE2
),
Point
(
nArrowX
+
HEAD_ARROWSIZE2
,
nArrowY
+
HEAD_ARROWSIZE2
)
);
Point
(
nArrowX
+
HEAD_ARROWSIZE2
,
nArrowY
+
HEAD_ARROWSIZE2
)
);
pDev
->
DrawLine
(
Point
(
nArrowX
+
HEAD_ARROWSIZE2
,
nArrowY
+
HEAD_ARROWSIZE2
),
rRenderContext
.
DrawLine
(
Point
(
nArrowX
+
HEAD_ARROWSIZE2
,
nArrowY
+
HEAD_ARROWSIZE2
),
Point
(
nArrowX
+
HEAD_ARROWSIZE1
,
nArrowY
)
);
Point
(
nArrowX
+
HEAD_ARROWSIZE1
,
nArrowY
)
);
}
}
}
}
}
}
...
@@ -651,54 +642,34 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
...
@@ -651,54 +642,34 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
void
HeaderBar
::
ImplDrawItem
(
sal_uInt16
nPos
,
bool
bHigh
,
bool
bDrag
,
void
HeaderBar
::
ImplDrawItem
(
vcl
::
RenderContext
&
rRenderContext
,
sal_uInt16
nPos
,
const
Rectangle
*
pRect
)
bool
bHigh
,
bool
bDrag
,
const
Rectangle
*
pRect
)
{
{
Rectangle
aRect
=
ImplGetItemRect
(
nPos
);
Rectangle
aRect
=
ImplGetItemRect
(
nPos
);
ImplDrawItem
(
this
,
nPos
,
bHigh
,
bDrag
,
aRect
,
pRect
,
0
);
ImplDrawItem
(
rRenderContext
,
nPos
,
bHigh
,
bDrag
,
aRect
,
pRect
,
0
);
}
}
void
HeaderBar
::
ImplUpdate
(
sal_uInt16
nPos
,
bool
bEnd
,
bool
bDirect
)
void
HeaderBar
::
ImplUpdate
(
sal_uInt16
nPos
,
bool
bEnd
,
bool
/*bDirect*/
)
{
{
if
(
IsVisible
()
&&
IsUpdateMode
()
)
if
(
IsVisible
()
&&
IsUpdateMode
())
{
if
(
!
bDirect
)
{
{
Rectangle
aRect
;
Rectangle
aRect
;
size_t
nItemCount
=
mpItemList
->
size
();
size_t
nItemCount
=
mpItemList
->
size
();
if
(
nPos
<
nItemCount
)
if
(
nPos
<
nItemCount
)
aRect
=
ImplGetItemRect
(
nPos
);
aRect
=
ImplGetItemRect
(
nPos
);
else
else
{
{
aRect
.
Bottom
()
=
mnDY
-
1
;
aRect
.
Bottom
()
=
mnDY
-
1
;
if
(
nItemCount
)
if
(
nItemCount
)
aRect
.
Left
()
=
ImplGetItemRect
(
nItemCount
-
1
).
Right
();
aRect
.
Left
()
=
ImplGetItemRect
(
nItemCount
-
1
).
Right
();
}
if
(
bEnd
)
aRect
.
Right
()
=
mnDX
-
1
;
aRect
.
Top
()
+=
mnBorderOff1
;
aRect
.
Bottom
()
-=
mnBorderOff2
;
Invalidate
(
aRect
);
}
}
else
if
(
bEnd
)
{
aRect
.
Right
()
=
mnDX
-
1
;
for
(
size_t
i
=
nPos
;
i
<
mpItemList
->
size
();
i
++
)
ImplDrawItem
(
i
);
if
(
bEnd
)
{
Rectangle
aRect
=
ImplGetItemRect
(
(
sal_uInt16
)
mpItemList
->
size
()
);
aRect
.
Left
()
=
aRect
.
Right
();
aRect
.
Right
()
=
mnDX
-
1
;
if
(
aRect
.
Left
()
<
aRect
.
Right
()
)
{
aRect
.
Top
()
+=
mnBorderOff1
;
aRect
.
Top
()
+=
mnBorderOff1
;
aRect
.
Bottom
()
-=
mnBorderOff2
;
aRect
.
Bottom
()
-=
mnBorderOff2
;
Erase
(
aRect
);
Invalidate
(
aRect
);
}
}
}
}
}
}
}
...
@@ -752,8 +723,8 @@ void HeaderBar::ImplStartDrag( const Point& rMousePos, bool bCommand )
...
@@ -752,8 +723,8 @@ void HeaderBar::ImplStartDrag( const Point& rMousePos, bool bCommand )
mnStartPos
=
rMousePos
.
X
()
-
mnMouseOff
;
mnStartPos
=
rMousePos
.
X
()
-
mnMouseOff
;
mnDragPos
=
mnStartPos
;
mnDragPos
=
mnStartPos
;
StartDrag
();
StartDrag
();
if
(
mbItemMode
)
if
(
mbItemMode
)
I
mplDrawItem
(
nPos
,
true
,
mbItemDrag
);
I
nvalidate
(
);
else
else
{
{
Rectangle
aSizeRect
(
mnDragPos
,
0
,
mnDragPos
,
mnDragSize
+
mnDY
);
Rectangle
aSizeRect
(
mnDragPos
,
0
,
mnDragPos
,
mnDragSize
+
mnDY
);
...
@@ -789,7 +760,7 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
...
@@ -789,7 +760,7 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
if
(
(
rMousePos
.
Y
()
>=
aItemRect
.
Top
())
&&
(
rMousePos
.
Y
()
<=
aItemRect
.
Bottom
())
)
if
(
(
rMousePos
.
Y
()
>=
aItemRect
.
Top
())
&&
(
rMousePos
.
Y
()
<=
aItemRect
.
Bottom
())
)
{
{
mbItemDrag
=
true
;
mbItemDrag
=
true
;
I
mplDrawItem
(
nPos
,
true
,
mbItemDrag
);
I
nvalidate
(
);
}
}
}
}
...
@@ -836,12 +807,12 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
...
@@ -836,12 +807,12 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
(
nOldItemDragPos
!=
HEADERBAR_ITEM_NOTFOUND
)
)
(
nOldItemDragPos
!=
HEADERBAR_ITEM_NOTFOUND
)
)
{
{
ImplInvertDrag
(
nPos
,
nOldItemDragPos
);
ImplInvertDrag
(
nPos
,
nOldItemDragPos
);
I
mplDrawItem
(
nOldItemDragPos
);
I
nvalidate
(
);
}
}
}
}
if
(
bNewOutDrag
!=
mbOutDrag
)
if
(
bNewOutDrag
!=
mbOutDrag
)
I
mplDrawItem
(
nPos
,
!
bNewOutDrag
,
mbItemDrag
);
I
nvalidate
(
);
if
(
mbItemDrag
)
if
(
mbItemDrag
)
{
{
...
@@ -849,7 +820,7 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
...
@@ -849,7 +820,7 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
(
mnItemDragPos
!=
nPos
)
&&
(
mnItemDragPos
!=
nPos
)
&&
(
mnItemDragPos
!=
HEADERBAR_ITEM_NOTFOUND
)
)
(
mnItemDragPos
!=
HEADERBAR_ITEM_NOTFOUND
)
)
{
{
I
mplDrawItem
(
mnItemDragPos
,
false
,
true
);
I
nvalidate
(
);
ImplInvertDrag
(
nPos
,
mnItemDragPos
);
ImplInvertDrag
(
nPos
,
mnItemDragPos
);
}
}
}
}
...
@@ -883,8 +854,7 @@ void HeaderBar::ImplEndDrag( bool bCancel )
...
@@ -883,8 +854,7 @@ void HeaderBar::ImplEndDrag( bool bCancel )
{
{
if
(
mbItemMode
&&
(
!
mbOutDrag
||
mbItemDrag
)
)
if
(
mbItemMode
&&
(
!
mbOutDrag
||
mbItemDrag
)
)
{
{
sal_uInt16
nPos
=
GetItemPos
(
mnCurItemId
);
Invalidate
();
ImplDrawItem
(
nPos
);
}
}
mnCurItemId
=
0
;
mnCurItemId
=
0
;
...
@@ -905,7 +875,7 @@ void HeaderBar::ImplEndDrag( bool bCancel )
...
@@ -905,7 +875,7 @@ void HeaderBar::ImplEndDrag( bool bCancel )
MoveItem
(
mnCurItemId
,
mnItemDragPos
);
MoveItem
(
mnCurItemId
,
mnItemDragPos
);
}
}
else
else
I
mplDrawItem
(
nPos
);
I
nvalidate
(
);
}
}
else
else
{
{
...
@@ -992,31 +962,31 @@ void HeaderBar::Tracking( const TrackingEvent& rTEvt )
...
@@ -992,31 +962,31 @@ void HeaderBar::Tracking( const TrackingEvent& rTEvt )
void
HeaderBar
::
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
rRect
)
void
HeaderBar
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
{
{
if
(
mnBorderOff1
||
mnBorderOff2
)
if
(
mnBorderOff1
||
mnBorderOff2
)
{
{
SetLineColor
(
GetSettings
().
GetStyleSettings
().
GetDarkShadowColor
()
);
rRenderContext
.
SetLineColor
(
rRenderContext
.
GetSettings
().
GetStyleSettings
().
GetDarkShadowColor
()
);
if
(
mnBorderOff1
)
if
(
mnBorderOff1
)
DrawLine
(
Point
(
0
,
0
),
Point
(
mnDX
-
1
,
0
)
);
rRenderContext
.
DrawLine
(
Point
(
0
,
0
),
Point
(
mnDX
-
1
,
0
)
);
if
(
mnBorderOff2
)
if
(
mnBorderOff2
)
DrawLine
(
Point
(
0
,
mnDY
-
1
),
Point
(
mnDX
-
1
,
mnDY
-
1
)
);
rRenderContext
.
DrawLine
(
Point
(
0
,
mnDY
-
1
),
Point
(
mnDX
-
1
,
mnDY
-
1
)
);
// #i40393# draw left and right border, if WB_BORDER was set in ImplInit()
// #i40393# draw left and right border, if WB_BORDER was set in ImplInit()
if
(
mnBorderOff1
&&
mnBorderOff2
)
if
(
mnBorderOff1
&&
mnBorderOff2
)
{
{
DrawLine
(
Point
(
0
,
0
),
Point
(
0
,
mnDY
-
1
)
);
rRenderContext
.
DrawLine
(
Point
(
0
,
0
),
Point
(
0
,
mnDY
-
1
)
);
DrawLine
(
Point
(
mnDX
-
1
,
0
),
Point
(
mnDX
-
1
,
mnDY
-
1
)
);
rRenderContext
.
DrawLine
(
Point
(
mnDX
-
1
,
0
),
Point
(
mnDX
-
1
,
mnDY
-
1
)
);
}
}
}
}
sal_uInt16
nCurItemPos
;
sal_uInt16
nCurItemPos
;
if
(
mbDrag
)
if
(
mbDrag
)
nCurItemPos
=
GetItemPos
(
mnCurItemId
);
nCurItemPos
=
GetItemPos
(
mnCurItemId
);
else
else
nCurItemPos
=
HEADERBAR_ITEM_NOTFOUND
;
nCurItemPos
=
HEADERBAR_ITEM_NOTFOUND
;
sal_uInt16
nItemCount
=
(
sal_uInt16
)
mpItemList
->
size
(
);
sal_uInt16
nItemCount
=
static_cast
<
sal_uInt16
>
(
mpItemList
->
size
()
);
for
(
sal_uInt16
i
=
0
;
i
<
nItemCount
;
i
++
)
for
(
sal_uInt16
i
=
0
;
i
<
nItemCount
;
i
++
)
ImplDrawItem
(
i
,
(
i
==
nCurItemPos
),
false
,
&
rRect
);
ImplDrawItem
(
rRenderContext
,
i
,
(
i
==
nCurItemPos
),
false
,
&
rRect
);
}
}
...
@@ -1068,7 +1038,7 @@ void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
...
@@ -1068,7 +1038,7 @@ void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
aItemRect
.
Right
()
=
16000
;
aItemRect
.
Right
()
=
16000
;
vcl
::
Region
aRegion
(
aRect
);
vcl
::
Region
aRegion
(
aRect
);
pDev
->
SetClipRegion
(
aRegion
);
pDev
->
SetClipRegion
(
aRegion
);
ImplDrawItem
(
pDev
,
i
,
false
,
false
,
aItemRect
,
&
aRect
,
nFlags
);
ImplDrawItem
(
*
pDev
,
i
,
false
,
false
,
aItemRect
,
&
aRect
,
nFlags
);
pDev
->
SetClipRegion
();
pDev
->
SetClipRegion
();
}
}
...
...
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