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
71c56174
Kaydet (Commit)
71c56174
authored
May 11, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor Roadmap to use RenderContext, some cleanup
Change-Id: I4750c17ae7110b0102ebdd141a31ab2a52c4e774
üst
01f1a5b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
98 deletions
+91
-98
roadmap.hxx
svtools/inc/roadmap.hxx
+58
-68
roadmap.cxx
svtools/source/control/roadmap.cxx
+33
-30
No files found.
svtools/inc/roadmap.hxx
Dosyayı görüntüle @
71c56174
...
...
@@ -25,100 +25,90 @@
#include <svtools/hyperlabel.hxx>
class
Bitmap
;
namespace
svt
{
struct
RoadmapTypes
{
public
:
typedef
sal_Int16
ItemId
;
typedef
sal_Int32
ItemIndex
;
};
struct
RoadmapTypes
{
public
:
typedef
sal_Int16
ItemId
;
typedef
sal_Int32
ItemIndex
;
};
class
RoadmapImpl
;
class
RoadmapItem
;
//= Roadmap
class
SVT_DLLPUBLIC
ORoadmap
:
public
Control
,
public
RoadmapTypes
{
protected
:
RoadmapImpl
*
m_pImpl
;
// Window overridables
void
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
_rRect
)
SAL_OVERRIDE
;
void
implInit
();
public
:
ORoadmap
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
=
0
);
virtual
~
ORoadmap
(
);
virtual
void
dispose
()
SAL_OVERRIDE
;
class
RoadmapImpl
;
class
RoadmapItem
;
void
SetRoadmapBitmap
(
const
BitmapEx
&
maBitmap
,
bool
_bInvalidate
=
true
);
class
SVT_DLLPUBLIC
ORoadmap
:
public
Control
,
public
RoadmapTypes
{
protected
:
RoadmapImpl
*
m_pImpl
;
// Window overridables
void
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
_rRect
)
SAL_OVERRIDE
;
void
implInit
(
vcl
::
RenderContext
&
rRenderContext
);
void
EnableRoadmapItem
(
ItemId
_nItemId
,
bool
_bEnable
,
ItemIndex
_nStartIndex
=
0
);
public
:
ORoadmap
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
=
0
);
virtual
~
ORoadmap
(
);
virtual
void
dispose
()
SAL_OVERRIDE
;
void
ChangeRoadmapItemLabel
(
ItemId
_nID
,
const
OUString
&
sLabel
,
ItemIndex
_nStartIndex
=
0
);
void
ChangeRoadmapItemID
(
ItemId
_nID
,
ItemId
_NewID
,
ItemIndex
_nStartIndex
=
0
);
void
SetRoadmapBitmap
(
const
BitmapEx
&
maBitmap
,
bool
_bInvalidate
=
true
);
void
SetRoadmapInteractive
(
bool
_bInteractive
);
bool
IsRoadmapInteractive
();
void
EnableRoadmapItem
(
ItemId
_nItemId
,
bool
_bEnable
,
ItemIndex
_nStartIndex
=
0
);
void
SetRoadmapComplete
(
bool
_bComplete
);
bool
IsRoadmapComplete
()
const
;
void
ChangeRoadmapItemLabel
(
ItemId
_nID
,
const
OUString
&
sLabel
,
ItemIndex
_nStartIndex
=
0
);
void
ChangeRoadmapItemID
(
ItemId
_nID
,
ItemId
_NewID
,
ItemIndex
_nStartIndex
=
0
)
;
ItemIndex
GetItemCount
()
const
;
ItemId
GetItemID
(
ItemIndex
_nIndex
)
const
;
void
SetRoadmapInteractive
(
bool
_bInteractive
)
;
bool
IsRoadmapInteractive
()
;
void
InsertRoadmapItem
(
ItemIndex
_Index
,
const
OUString
&
_RoadmapItem
,
ItemId
_nUniqueId
,
bool
_bEnabled
=
true
);
void
ReplaceRoadmapItem
(
ItemIndex
_Index
,
const
OUString
&
_RoadmapItem
,
ItemId
_nUniqueId
,
bool
_bEnabled
);
void
DeleteRoadmapItem
(
ItemIndex
_nIndex
);
void
SetRoadmapComplete
(
bool
_bComplete
);
bool
IsRoadmapComplete
()
const
;
ItemId
GetCurrentRoadmapItemID
()
const
;
bool
SelectRoadmapItemByID
(
ItemId
_nItemID
)
;
ItemIndex
GetItemCount
()
const
;
ItemId
GetItemID
(
ItemIndex
_nIndex
)
const
;
void
SetItemSelectHdl
(
const
Link
<>&
_rHdl
);
Link
<>
GetItemSelectHdl
(
)
const
;
virtual
void
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
SAL_OVERRIDE
;
virtual
void
GetFocus
()
SAL_OVERRIDE
;
void
InsertRoadmapItem
(
ItemIndex
_Index
,
const
OUString
&
_RoadmapItem
,
ItemId
_nUniqueId
,
bool
_bEnabled
=
true
);
void
ReplaceRoadmapItem
(
ItemIndex
_Index
,
const
OUString
&
_RoadmapItem
,
ItemId
_nUniqueId
,
bool
_bEnabled
);
void
DeleteRoadmapItem
(
ItemIndex
_nIndex
);
ItemId
GetCurrentRoadmapItemID
()
const
;
bool
SelectRoadmapItemByID
(
ItemId
_nItemID
);
protected
:
bool
PreNotify
(
NotifyEvent
&
rNEvt
)
SAL_OVERRIDE
;
void
SetItemSelectHdl
(
const
Link
<>&
_rHdl
);
Link
<>
GetItemSelectHdl
(
)
const
;
virtual
void
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
SAL_OVERRIDE
;
virtual
void
GetFocus
()
SAL_OVERRIDE
;
protected
:
/// called when an item has been selected by any means
void
Select
();
protected
:
bool
PreNotify
(
NotifyEvent
&
rNEvt
)
SAL_OVERRIDE
;
private
:
DECL_LINK
(
ImplClickHdl
,
HyperLabel
*
);
protected
:
/// called when an item has been selected by any means
void
Select
();
RoadmapItem
*
GetByIndex
(
ItemIndex
_nItemIndex
);
const
RoadmapItem
*
GetByIndex
(
ItemIndex
_nItemIndex
)
const
;
private
:
DECL_LINK
(
ImplClickHdl
,
HyperLabel
*
)
;
RoadmapItem
*
GetByID
(
ItemId
_nID
,
ItemIndex
_nStartIndex
=
0
);
const
RoadmapItem
*
GetByID
(
ItemId
_nID
,
ItemIndex
_nStartIndex
=
0
)
const
;
RoadmapItem
*
GetPreviousHyperLabel
(
ItemIndex
_Index
);
RoadmapItem
*
GetByIndex
(
ItemIndex
_nItemIndex
);
const
RoadmapItem
*
GetByIndex
(
ItemIndex
_nItemIndex
)
const
;
void
DrawHeadline
();
void
DeselectOldRoadmapItems
();
ItemId
GetNextAvailableItemId
(
ItemIndex
_NewIndex
);
ItemId
GetPreviousAvailableItemId
(
ItemIndex
_NewIndex
);
RoadmapItem
*
GetByPointer
(
vcl
::
Window
*
pWindow
);
RoadmapItem
*
InsertHyperLabel
(
ItemIndex
_Index
,
const
OUString
&
_aStr
,
ItemId
_RMID
,
bool
_bEnabled
,
bool
_bIncomplete
);
void
UpdatefollowingHyperLabels
(
ItemIndex
_Index
);
};
RoadmapItem
*
GetByID
(
ItemId
_nID
,
ItemIndex
_nStartIndex
=
0
);
const
RoadmapItem
*
GetByID
(
ItemId
_nID
,
ItemIndex
_nStartIndex
=
0
)
const
;
RoadmapItem
*
GetPreviousHyperLabel
(
ItemIndex
_Index
);
void
DrawHeadline
(
vcl
::
RenderContext
&
rRenderContext
);
void
DeselectOldRoadmapItems
();
ItemId
GetNextAvailableItemId
(
ItemIndex
_NewIndex
);
ItemId
GetPreviousAvailableItemId
(
ItemIndex
_NewIndex
);
RoadmapItem
*
GetByPointer
(
vcl
::
Window
*
pWindow
);
RoadmapItem
*
InsertHyperLabel
(
ItemIndex
_Index
,
const
OUString
&
_aStr
,
ItemId
_RMID
,
bool
_bEnabled
,
bool
_bIncomplete
);
void
UpdatefollowingHyperLabels
(
ItemIndex
_Index
);
};
}
// namespace svt
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
svtools/source/control/roadmap.cxx
Dosyayı görüntüle @
71c56174
...
...
@@ -83,7 +83,6 @@ private:
void
ImplUpdatePosSize
();
};
//= RoadmapImpl
class
RoadmapImpl
:
public
RoadmapTypes
...
...
@@ -94,9 +93,11 @@ protected:
BitmapEx
m_aPicture
;
HL_Vector
m_aRoadmapSteps
;
ItemId
m_iCurItemID
;
bool
m_bInteractive
;
bool
m_bComplete
;
bool
m_bInteractive
:
1
;
bool
m_bComplete
:
1
;
Size
m_aItemSizePixel
;
public
:
bool
m_bPaintInitialized
:
1
;
public
:
RoadmapImpl
(
const
ORoadmap
&
rAntiImpl
)
...
...
@@ -104,6 +105,7 @@ public:
,
m_iCurItemID
(
-
1
)
,
m_bInteractive
(
true
)
,
m_bComplete
(
true
)
,
m_bPaintInitialized
(
false
)
,
InCompleteHyperLabel
(
NULL
)
{}
...
...
@@ -198,25 +200,23 @@ void RoadmapImpl::initItemSize()
ORoadmap
::
ORoadmap
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
)
:
Control
(
_pParent
,
_nWinStyle
)
,
m_pImpl
(
new
RoadmapImpl
(
*
this
))
{
implInit
();
}
void
ORoadmap
::
implInit
()
void
ORoadmap
::
implInit
(
vcl
::
RenderContext
&
rRenderContext
)
{
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
const
StyleSettings
&
rStyleSettings
=
rRenderContext
.
GetSettings
().
GetStyleSettings
();
Color
aTextColor
=
rStyleSettings
.
GetFieldTextColor
();
vcl
::
Font
aFont
=
GetFont
(
);
aFont
.
SetColor
(
aTextColor
);
aFont
.
SetWeight
(
WEIGHT_BOLD
);
aFont
.
SetUnderline
(
UNDERLINE_SINGLE
);
SetFont
(
aFont
);
SetBackground
(
Wallpaper
(
rStyleSettings
.
GetFieldColor
()
)
);
vcl
::
Font
aFont
=
rRenderContext
.
GetFont
(
);
aFont
.
SetColor
(
aTextColor
);
aFont
.
SetWeight
(
WEIGHT_BOLD
);
aFont
.
SetUnderline
(
UNDERLINE_SINGLE
);
rRenderContext
.
SetFont
(
aFont
);
rRenderContext
.
SetBackground
(
Wallpaper
(
rStyleSettings
.
GetFieldColor
())
);
m_pImpl
->
InCompleteHyperLabel
=
NULL
;
m_pImpl
->
setCurItemID
(
-
1
);
m_pImpl
->
setComplete
(
true
);
m_pImpl
->
setCurItemID
(
-
1
);
m_pImpl
->
setComplete
(
true
);
m_pImpl
->
m_bPaintInitialized
=
true
;
// Roadmap control should be reachable as one unit with a Tab key
// the next Tab key should spring out of the control.
...
...
@@ -232,7 +232,7 @@ void ORoadmap::implInit()
// on this with calculating a new bold font.
// Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font.
// So settings the font from outside is simply a forbidded scenario at the moment
EnableMapMode
(
false
);
rRenderContext
.
EnableMapMode
(
false
);
}
ORoadmap
::~
ORoadmap
()
...
...
@@ -561,36 +561,39 @@ bool ORoadmap::SelectRoadmapItemByID( ItemId _nNewID )
void
ORoadmap
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
_rRect
)
{
if
(
!
m_pImpl
->
m_bPaintInitialized
)
implInit
(
rRenderContext
);
Control
::
Paint
(
rRenderContext
,
_rRect
);
// draw the bitmap
if
(
!!
m_pImpl
->
getPicture
()
)
if
(
!!
m_pImpl
->
getPicture
()
)
{
Size
aBitmapSize
=
m_pImpl
->
getPicture
().
GetSizePixel
();
Size
aMySize
=
GetOutputSizePixel
();
Size
aMySize
=
rRenderContext
.
GetOutputSizePixel
();
Point
aBitmapPos
(
aMySize
.
Width
()
-
aBitmapSize
.
Width
(),
aMySize
.
Height
()
-
aBitmapSize
.
Height
()
);
Point
aBitmapPos
(
aMySize
.
Width
()
-
aBitmapSize
.
Width
(),
aMySize
.
Height
()
-
aBitmapSize
.
Height
()
);
// draw it
DrawBitmapEx
(
aBitmapPos
,
m_pImpl
->
getPicture
()
);
rRenderContext
.
DrawBitmapEx
(
aBitmapPos
,
m_pImpl
->
getPicture
()
);
}
// draw the headline
DrawHeadline
();
DrawHeadline
(
rRenderContext
);
}
void
ORoadmap
::
DrawHeadline
()
void
ORoadmap
::
DrawHeadline
(
vcl
::
RenderContext
&
rRenderContext
)
{
Point
aTextPos
=
LogicToPixel
(
Point
(
ROADMAP_INDENT_X
,
8
),
MAP_APPFONT
);
Point
aTextPos
=
LogicToPixel
(
Point
(
ROADMAP_INDENT_X
,
8
),
MAP_APPFONT
);
Size
aOutputSize
(
GetOutputSizePixel
()
);
Size
aOutputSize
(
rRenderContext
.
GetOutputSizePixel
()
);
// draw it
DrawText
(
Rectangle
(
aTextPos
,
aOutputSize
),
GetText
(),
TEXT_DRAW_LEFT
|
TEXT_DRAW_TOP
|
TEXT_DRAW_MULTILINE
|
TEXT_DRAW_WORDBREAK
);
DrawTextLine
(
aTextPos
,
aOutputSize
.
Width
(),
STRIKEOUT_NONE
,
UNDERLINE_SINGLE
,
UNDERLINE_NONE
,
false
);
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
SetLineColor
(
rStyleSettings
.
GetFieldTextColor
());
SetTextColor
(
rStyleSettings
.
GetFieldTextColor
());
rRenderContext
.
DrawText
(
Rectangle
(
aTextPos
,
aOutputSize
),
GetText
(),
TEXT_DRAW_LEFT
|
TEXT_DRAW_TOP
|
TEXT_DRAW_MULTILINE
|
TEXT_DRAW_WORDBREAK
);
rRenderContext
.
DrawTextLine
(
aTextPos
,
aOutputSize
.
Width
(),
STRIKEOUT_NONE
,
UNDERLINE_SINGLE
,
UNDERLINE_NONE
,
false
);
const
StyleSettings
&
rStyleSettings
=
rRenderContext
.
GetSettings
().
GetStyleSettings
();
rRenderContext
.
SetLineColor
(
rStyleSettings
.
GetFieldTextColor
());
rRenderContext
.
SetTextColor
(
rStyleSettings
.
GetFieldTextColor
());
}
RoadmapItem
*
ORoadmap
::
GetByPointer
(
vcl
::
Window
*
pWindow
)
...
...
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