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
01f1a5b1
Kaydet (Commit)
01f1a5b1
authored
May 11, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
remove whitespace, decrease indent level, cleanup
Change-Id: I618ca9c26e5d5371262d50782ea3396f11931892
üst
285d5c52
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
605 additions
and
635 deletions
+605
-635
roadmap.cxx
svtools/source/control/roadmap.cxx
+605
-635
No files found.
svtools/source/control/roadmap.cxx
Dosyayı görüntüle @
01f1a5b1
...
...
@@ -31,846 +31,816 @@
#define ROADMAP_INDENT_Y 27
#define ROADMAP_ITEM_DISTANCE_Y 6
namespace
svt
{
typedef
std
::
vector
<
RoadmapItem
*
>
HL_Vector
;
typedef
std
::
vector
<
RoadmapItem
*
>
HL_Vector
;
//= ColorChanger
class
IDLabel
:
public
FixedText
{
public
:
IDLabel
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
=
0
);
virtual
void
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
SAL_OVERRIDE
;
};
class
RoadmapItem
:
public
RoadmapTypes
{
private
:
VclPtr
<
IDLabel
>
mpID
;
VclPtr
<
HyperLabel
>
mpDescription
;
const
Size
m_aItemPlayground
;
public
:
RoadmapItem
(
ORoadmap
&
_rParent
,
const
Size
&
_rItemPlayground
);
~
RoadmapItem
();
void
SetID
(
sal_Int16
_ID
);
sal_Int16
GetID
()
const
;
void
SetIndex
(
ItemIndex
_Index
);
ItemIndex
GetIndex
()
const
;
//= ColorChanger
void
Update
(
ItemIndex
_RMIndex
,
const
OUString
&
_rText
);
void
SetPosition
(
RoadmapItem
*
OldHyperLabel
);
void
ToggleBackgroundColor
(
const
Color
&
_rGBColor
);
void
SetInteractive
(
bool
_bInteractive
);
void
SetClickHdl
(
const
Link
<>&
rLink
);
void
Enable
(
bool
bEnable
=
true
);
bool
IsEnabled
()
const
;
void
GrabFocus
();
bool
Contains
(
const
vcl
::
Window
*
_pWindow
)
const
;
HyperLabel
*
GetDescriptionHyperLabel
()
const
{
return
mpDescription
;
}
class
IDLabel
:
public
FixedText
{
public
:
IDLabel
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
=
0
);
virtual
void
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
SAL_OVERRIDE
;
};
private
:
void
ImplUpdateIndex
(
const
ItemIndex
_nIndex
);
void
ImplUpdatePosSize
();
};
class
RoadmapItem
:
public
RoadmapTypes
{
private
:
VclPtr
<
IDLabel
>
mpID
;
VclPtr
<
HyperLabel
>
mpDescription
;
const
Size
m_aItemPlayground
;
public
:
RoadmapItem
(
ORoadmap
&
_rParent
,
const
Size
&
_rItemPlayground
);
~
RoadmapItem
();
//= RoadmapImpl
void
SetID
(
sal_Int16
_ID
);
sal_Int16
GetID
()
const
;
class
RoadmapImpl
:
public
RoadmapTypes
{
protected
:
const
ORoadmap
&
m_rAntiImpl
;
Link
<>
m_aSelectHdl
;
BitmapEx
m_aPicture
;
HL_Vector
m_aRoadmapSteps
;
ItemId
m_iCurItemID
;
bool
m_bInteractive
;
bool
m_bComplete
;
Size
m_aItemSizePixel
;
public
:
RoadmapImpl
(
const
ORoadmap
&
_rAntiImpl
)
:
m_rAntiImpl
(
_rAntiImpl
)
,
m_iCurItemID
(
-
1
)
,
m_bInteractive
(
true
)
,
m_bComplete
(
true
)
,
InCompleteHyperLabel
(
NULL
)
{
}
void
SetIndex
(
ItemIndex
_Index
);
ItemIndex
GetIndex
()
const
;
RoadmapItem
*
InCompleteHyperLabel
;
void
Update
(
ItemIndex
_RMIndex
,
const
OUString
&
_rText
)
;
HL_Vector
&
getHyperLabels
()
{
return
m_aRoadmapSteps
;
}
void
SetPosition
(
RoadmapItem
*
OldHyperLabel
);
void
insertHyperLabel
(
ItemIndex
_Index
,
RoadmapItem
*
_rRoadmapStep
)
{
m_aRoadmapSteps
.
insert
(
m_aRoadmapSteps
.
begin
()
+
_Index
,
_rRoadmapStep
);
}
void
ToggleBackgroundColor
(
const
Color
&
_rGBColor
);
void
SetInteractive
(
bool
_bInteractive
);
ItemIndex
getItemCount
()
const
{
return
m_aRoadmapSteps
.
size
();}
void
SetClickHdl
(
const
Link
<>&
rLink
);
void
Enable
(
bool
bEnable
=
true
);
bool
IsEnabled
()
const
;
void
GrabFocus
();
void
setCurItemID
(
ItemId
i
)
{
m_iCurItemID
=
i
;
}
ItemId
getCurItemID
()
const
{
return
m_iCurItemID
;
}
bool
Contains
(
const
vcl
::
Window
*
_pWindow
)
const
;
void
setInteractive
(
const
bool
_bInteractive
)
{
m_bInteractive
=
_bInteractive
;
}
bool
isInteractive
()
const
{
return
m_bInteractive
;
};
HyperLabel
*
GetDescriptionHyperLabel
()
const
{
return
mpDescription
;
}
void
setComplete
(
const
bool
_bComplete
)
{
m_bComplete
=
_bComplete
;
}
bool
isComplete
()
const
{
return
m_bComplete
;
};
private
:
void
ImplUpdateIndex
(
const
ItemIndex
_nIndex
);
void
ImplUpdatePosSize
();
};
void
setPicture
(
const
BitmapEx
&
_rPic
)
{
m_aPicture
=
_rPic
;
}
const
BitmapEx
&
getPicture
(
)
const
{
return
m_aPicture
;
}
void
setSelectHdl
(
const
Link
<>&
_rHdl
)
{
m_aSelectHdl
=
_rHdl
;
}
const
Link
<>&
getSelectHdl
(
)
const
{
return
m_aSelectHdl
;
}
//= RoadmapImpl
void
initItemSize
();
const
Size
&
getItemSize
()
const
{
return
m_aItemSizePixel
;
}
class
RoadmapImpl
:
public
RoadmapTypes
{
protected
:
const
ORoadmap
&
m_rAntiImpl
;
Link
<>
m_aSelectHdl
;
BitmapEx
m_aPicture
;
HL_Vector
m_aRoadmapSteps
;
ItemId
m_iCurItemID
;
bool
m_bInteractive
;
bool
m_bComplete
;
Size
m_aItemSizePixel
;
void
removeHyperLabel
(
ItemIndex
_Index
)
{
if
(
(
_Index
>
-
1
)
&&
(
_Index
<
getItemCount
()
)
)
{
delete
m_aRoadmapSteps
[
_Index
];
m_aRoadmapSteps
.
erase
(
m_aRoadmapSteps
.
begin
()
+
_Index
);
}
}
};
public
:
RoadmapImpl
(
const
ORoadmap
&
rAntiImpl
)
:
m_rAntiImpl
(
rAntiImpl
)
,
m_iCurItemID
(
-
1
)
,
m_bInteractive
(
true
)
,
m_bComplete
(
true
)
,
InCompleteHyperLabel
(
NULL
)
{}
RoadmapItem
*
InCompleteHyperLabel
;
void
RoadmapImpl
::
initItemSize
()
HL_Vector
&
getHyperLabels
()
{
Size
aLabelSize
(
m_rAntiImpl
.
GetOutputSizePixel
()
);
aLabelSize
.
Height
()
=
m_rAntiImpl
.
LogicToPixel
(
Size
(
0
,
LABELBASEMAPHEIGHT
),
MAP_APPFONT
).
Height
();
aLabelSize
.
Width
()
-=
m_rAntiImpl
.
LogicToPixel
(
Size
(
2
*
ROADMAP_INDENT_X
,
0
),
MAP_APPFONT
).
Width
();
m_aItemSizePixel
=
aLabelSize
;
return
m_aRoadmapSteps
;
}
//= Roadmap
ORoadmap
::
ORoadmap
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
)
:
Control
(
_pParent
,
_nWinStyle
)
,
m_pImpl
(
new
RoadmapImpl
(
*
this
)
)
void
insertHyperLabel
(
ItemIndex
_Index
,
RoadmapItem
*
_rRoadmapStep
)
{
implInit
(
);
m_aRoadmapSteps
.
insert
(
m_aRoadmapSteps
.
begin
()
+
_Index
,
_rRoadmapStep
);
}
void
ORoadmap
::
implInit
()
ItemIndex
getItemCount
()
const
{
const
StyleSettings
&
rStyleSettings
=
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
()
)
);
m_pImpl
->
InCompleteHyperLabel
=
NULL
;
m_pImpl
->
setCurItemID
(
-
1
);
m_pImpl
->
setComplete
(
true
);
// Roadmap control should be reachable as one unit with a Tab key
// the next Tab key should spring out of the control.
// To reach it the control itself should get focus and set it
// on entries. The entries themself should not be reachable with
// the Tab key directly. So each entry should have WB_NOTABSTOP.
// In other words the creator should create the control with the following
// flags:
// SetStyle( ( GetStyle() | WB_TABSTOP ) & ~WB_DIALOGCONTROL );
// TODO: if somebody sets a new font from outside (OutputDevice::SetFont), we would have to react
// 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
);
return
m_aRoadmapSteps
.
size
();
}
ORoadmap
::~
ORoadmap
(
)
void
setCurItemID
(
ItemId
i
)
{
disposeOnce
()
;
m_iCurItemID
=
i
;
}
void
ORoadmap
::
dispose
()
ItemId
getCurItemID
()
const
{
HL_Vector
aItemsCopy
=
m_pImpl
->
getHyperLabels
();
m_pImpl
->
getHyperLabels
().
clear
();
for
(
HL_Vector
::
iterator
i
=
aItemsCopy
.
begin
();
i
!=
aItemsCopy
.
end
();
++
i
)
{
delete
*
i
;
}
if
(
!
m_pImpl
->
isComplete
()
)
delete
m_pImpl
->
InCompleteHyperLabel
;
delete
m_pImpl
;
m_pImpl
=
NULL
;
Control
::
dispose
();
return
m_iCurItemID
;
}
RoadmapTypes
::
ItemId
ORoadmap
::
GetCurrentRoadmapItemID
()
const
void
setInteractive
(
const
bool
_bInteractive
)
{
return
m_pImpl
->
getCurItemID
()
;
m_bInteractive
=
_bInteractive
;
}
RoadmapItem
*
ORoadmap
::
GetPreviousHyperLabel
(
ItemIndex
_Index
)
bool
isInteractive
()
const
{
RoadmapItem
*
pOldItem
=
NULL
;
if
(
_Index
>
0
)
pOldItem
=
m_pImpl
->
getHyperLabels
().
at
(
_Index
-
1
);
return
pOldItem
;
return
m_bInteractive
;
}
RoadmapItem
*
ORoadmap
::
InsertHyperLabel
(
ItemIndex
_Index
,
const
OUString
&
_sLabel
,
ItemId
_RMID
,
bool
_bEnabled
,
bool
_bIncomplete
)
void
setComplete
(
const
bool
_bComplete
)
{
if
(
m_pImpl
->
getItemCount
()
==
0
)
m_pImpl
->
initItemSize
();
RoadmapItem
*
pItem
=
NULL
;
RoadmapItem
*
pOldItem
=
GetPreviousHyperLabel
(
_Index
);
pItem
=
new
RoadmapItem
(
*
this
,
m_pImpl
->
getItemSize
()
);
if
(
_bIncomplete
)
{
pItem
->
SetInteractive
(
false
);
}
else
{
pItem
->
SetInteractive
(
m_pImpl
->
isInteractive
()
);
m_pImpl
->
insertHyperLabel
(
_Index
,
pItem
);
}
pItem
->
SetPosition
(
pOldItem
);
pItem
->
Update
(
_Index
,
_sLabel
);
pItem
->
SetClickHdl
(
LINK
(
this
,
ORoadmap
,
ImplClickHdl
)
);
pItem
->
SetID
(
_RMID
);
pItem
->
SetIndex
(
_Index
);
if
(
!
_bEnabled
)
pItem
->
Enable
(
_bEnabled
);
return
pItem
;
m_bComplete
=
_bComplete
;
}
void
ORoadmap
::
SetRoadmapBitmap
(
const
BitmapEx
&
_rBmp
,
bool
_bInvalidate
)
bool
isComplete
()
const
{
m_pImpl
->
setPicture
(
_rBmp
);
if
(
_bInvalidate
)
Invalidate
(
);
return
m_bComplete
;
}
void
ORoadmap
::
SetRoadmapInteractive
(
bool
_bInteractive
)
void
setPicture
(
const
BitmapEx
&
_rPic
)
{
m_pImpl
->
setInteractive
(
_bInteractive
);
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
();
i
!=
rItems
.
end
();
++
i
)
{
(
*
i
)
->
SetInteractive
(
_bInteractive
);
}
m_aPicture
=
_rPic
;
}
const
BitmapEx
&
getPicture
()
const
{
return
m_aPicture
;
}
bool
ORoadmap
::
IsRoadmapInteractive
()
void
setSelectHdl
(
const
Link
<>&
_rHdl
)
{
return
m_pImpl
->
isInteractive
();
m_aSelectHdl
=
_rHdl
;
}
const
Link
<>&
getSelectHdl
()
const
{
return
m_aSelectHdl
;
}
void
initItemSize
();
const
Size
&
getItemSize
()
const
{
return
m_aItemSizePixel
;
}
void
ORoadmap
::
SetRoadmapComplete
(
bool
_bComplete
)
void
removeHyperLabel
(
ItemIndex
_Index
)
{
bool
bWasComplete
=
m_pImpl
->
isComplete
();
m_pImpl
->
setComplete
(
_bComplete
);
if
(
_bComplete
)
if
((
_Index
>
-
1
)
&&
(
_Index
<
getItemCount
()))
{
if
(
m_pImpl
->
InCompleteHyperLabel
!=
NULL
)
{
delete
m_pImpl
->
InCompleteHyperLabel
;
m_pImpl
->
InCompleteHyperLabel
=
NULL
;
}
delete
m_aRoadmapSteps
[
_Index
];
m_aRoadmapSteps
.
erase
(
m_aRoadmapSteps
.
begin
()
+
_Index
);
}
else
if
(
bWasComplete
)
m_pImpl
->
InCompleteHyperLabel
=
InsertHyperLabel
(
m_pImpl
->
getItemCount
(),
OUString
(
"..."
),
-
1
,
true
/*bEnabled*/
,
true
/*bIncomplete*/
);
}
};
void
RoadmapImpl
::
initItemSize
()
{
Size
aLabelSize
(
m_rAntiImpl
.
GetOutputSizePixel
()
);
aLabelSize
.
Height
()
=
m_rAntiImpl
.
LogicToPixel
(
Size
(
0
,
LABELBASEMAPHEIGHT
),
MAP_APPFONT
).
Height
();
aLabelSize
.
Width
()
-=
m_rAntiImpl
.
LogicToPixel
(
Size
(
2
*
ROADMAP_INDENT_X
,
0
),
MAP_APPFONT
).
Width
();
m_aItemSizePixel
=
aLabelSize
;
}
void
ORoadmap
::
UpdatefollowingHyperLabels
(
ItemIndex
_nIndex
)
{
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
if
(
_nIndex
<
(
ItemIndex
)
rItems
.
size
()
)
{
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
()
+
_nIndex
;
i
!=
rItems
.
end
();
++
i
,
++
_nIndex
)
{
RoadmapItem
*
pItem
=
*
i
;
//= Roadmap
pItem
->
SetIndex
(
_nIndex
);
pItem
->
SetPosition
(
GetPreviousHyperLabel
(
_nIndex
)
);
}
}
if
(
!
m_pImpl
->
isComplete
()
)
{
RoadmapItem
*
pOldItem
=
GetPreviousHyperLabel
(
m_pImpl
->
getItemCount
()
);
m_pImpl
->
InCompleteHyperLabel
->
SetPosition
(
pOldItem
);
m_pImpl
->
InCompleteHyperLabel
->
Update
(
m_pImpl
->
getItemCount
(),
OUString
(
"..."
)
);
}
}
ORoadmap
::
ORoadmap
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
)
:
Control
(
_pParent
,
_nWinStyle
)
,
m_pImpl
(
new
RoadmapImpl
(
*
this
))
{
implInit
();
}
void
ORoadmap
::
ReplaceRoadmapItem
(
ItemIndex
_Index
,
const
OUString
&
_RoadmapItem
,
ItemId
_RMID
,
bool
_bEnabled
)
{
RoadmapItem
*
pItem
=
GetByIndex
(
_Index
);
if
(
pItem
!=
NULL
)
{
pItem
->
Update
(
_Index
,
_RoadmapItem
);
pItem
->
SetID
(
_RMID
);
pItem
->
Enable
(
_bEnabled
);
}
}
void
ORoadmap
::
implInit
()
{
const
StyleSettings
&
rStyleSettings
=
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
()
)
);
m_pImpl
->
InCompleteHyperLabel
=
NULL
;
m_pImpl
->
setCurItemID
(
-
1
);
m_pImpl
->
setComplete
(
true
);
// Roadmap control should be reachable as one unit with a Tab key
// the next Tab key should spring out of the control.
// To reach it the control itself should get focus and set it
// on entries. The entries themself should not be reachable with
// the Tab key directly. So each entry should have WB_NOTABSTOP.
// In other words the creator should create the control with the following
// flags:
// SetStyle( ( GetStyle() | WB_TABSTOP ) & ~WB_DIALOGCONTROL );
RoadmapTypes
::
ItemIndex
ORoadmap
::
GetItemCount
()
const
{
return
m_pImpl
->
getItemCount
();
}
// TODO: if somebody sets a new font from outside (OutputDevice::SetFont), we would have to react
// 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
);
}
ORoadmap
::~
ORoadmap
()
{
disposeOnce
();
}
RoadmapTypes
::
ItemId
ORoadmap
::
GetItemID
(
ItemIndex
_nIndex
)
const
void
ORoadmap
::
dispose
()
{
HL_Vector
aItemsCopy
=
m_pImpl
->
getHyperLabels
();
m_pImpl
->
getHyperLabels
().
clear
();
for
(
HL_Vector
::
iterator
i
=
aItemsCopy
.
begin
();
i
!=
aItemsCopy
.
end
();
++
i
)
{
const
RoadmapItem
*
pHyperLabel
=
GetByIndex
(
_nIndex
);
if
(
pHyperLabel
)
return
pHyperLabel
->
GetID
();
return
-
1
;
delete
*
i
;
}
if
(
!
m_pImpl
->
isComplete
()
)
delete
m_pImpl
->
InCompleteHyperLabel
;
delete
m_pImpl
;
m_pImpl
=
NULL
;
Control
::
dispose
();
}
RoadmapTypes
::
ItemId
ORoadmap
::
GetCurrentRoadmapItemID
()
const
{
return
m_pImpl
->
getCurItemID
();
}
void
ORoadmap
::
InsertRoadmapItem
(
ItemIndex
_Index
,
const
OUString
&
_RoadmapItem
,
ItemId
_nUniqueId
,
bool
_bEnabled
)
{
InsertHyperLabel
(
_Index
,
_RoadmapItem
,
_nUniqueId
,
_bEnabled
,
false
/*bIncomplete*/
);
// TODO YPos is superfluous, if items are always appended
UpdatefollowingHyperLabels
(
_Index
+
1
);
}
RoadmapItem
*
ORoadmap
::
GetPreviousHyperLabel
(
ItemIndex
_Index
)
{
RoadmapItem
*
pOldItem
=
NULL
;
if
(
_Index
>
0
)
pOldItem
=
m_pImpl
->
getHyperLabels
().
at
(
_Index
-
1
);
return
pOldItem
;
}
RoadmapItem
*
ORoadmap
::
InsertHyperLabel
(
ItemIndex
_Index
,
const
OUString
&
_sLabel
,
ItemId
_RMID
,
bool
_bEnabled
,
bool
_bIncomplete
)
{
if
(
m_pImpl
->
getItemCount
()
==
0
)
m_pImpl
->
initItemSize
();
RoadmapItem
*
pItem
=
NULL
;
RoadmapItem
*
pOldItem
=
GetPreviousHyperLabel
(
_Index
);
void
ORoadmap
::
DeleteRoadmapItem
(
ItemIndex
_Index
)
pItem
=
new
RoadmapItem
(
*
this
,
m_pImpl
->
getItemSize
()
);
if
(
_bIncomplete
)
{
if
(
m_pImpl
->
getItemCount
()
>
0
&&
(
_Index
>
-
1
)
&&
(
_Index
<
m_pImpl
->
getItemCount
()
)
)
{
m_pImpl
->
removeHyperLabel
(
_Index
);
UpdatefollowingHyperLabels
(
_Index
);
}
pItem
->
SetInteractive
(
false
);
}
bool
ORoadmap
::
IsRoadmapComplete
(
)
const
else
{
return
m_pImpl
->
isComplete
();
pItem
->
SetInteractive
(
m_pImpl
->
isInteractive
()
);
m_pImpl
->
insertHyperLabel
(
_Index
,
pItem
);
}
pItem
->
SetPosition
(
pOldItem
);
pItem
->
Update
(
_Index
,
_sLabel
);
pItem
->
SetClickHdl
(
LINK
(
this
,
ORoadmap
,
ImplClickHdl
)
);
pItem
->
SetID
(
_RMID
);
pItem
->
SetIndex
(
_Index
);
if
(
!
_bEnabled
)
pItem
->
Enable
(
_bEnabled
);
return
pItem
;
}
void
ORoadmap
::
SetRoadmapBitmap
(
const
BitmapEx
&
_rBmp
,
bool
_bInvalidate
)
{
m_pImpl
->
setPicture
(
_rBmp
);
if
(
_bInvalidate
)
Invalidate
(
);
}
void
ORoadmap
::
SetRoadmapInteractive
(
bool
_bInteractive
)
{
m_pImpl
->
setInteractive
(
_bInteractive
);
void
ORoadmap
::
EnableRoadmapItem
(
ItemId
_nItemId
,
bool
_bEnable
,
ItemIndex
_nStartIndex
)
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
();
i
!=
rItems
.
end
();
++
i
)
{
RoadmapItem
*
pItem
=
GetByID
(
_nItemId
,
_nStartIndex
);
if
(
pItem
!=
NULL
)
pItem
->
Enable
(
_bEnable
);
(
*
i
)
->
SetInteractive
(
_bInteractive
);
}
}
bool
ORoadmap
::
IsRoadmapInteractive
()
{
return
m_pImpl
->
isInteractive
();
}
void
ORoadmap
::
ChangeRoadmapItemLabel
(
ItemId
_nID
,
const
OUString
&
_sLabel
,
ItemIndex
_nStartIndex
)
void
ORoadmap
::
SetRoadmapComplete
(
bool
_bComplete
)
{
bool
bWasComplete
=
m_pImpl
->
isComplete
();
m_pImpl
->
setComplete
(
_bComplete
);
if
(
_bComplete
)
{
RoadmapItem
*
pItem
=
GetByID
(
_nID
,
_nStartIndex
);
if
(
pItem
!=
NULL
)
if
(
m_pImpl
->
InCompleteHyperLabel
!=
NULL
)
{
pItem
->
Update
(
pItem
->
GetIndex
(),
_sLabel
);
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
()
+
_nStartIndex
;
i
!=
rItems
.
end
();
++
i
)
{
(
*
i
)
->
SetPosition
(
GetPreviousHyperLabel
(
i
-
rItems
.
begin
()
)
);
}
delete
m_pImpl
->
InCompleteHyperLabel
;
m_pImpl
->
InCompleteHyperLabel
=
NULL
;
}
}
else
if
(
bWasComplete
)
m_pImpl
->
InCompleteHyperLabel
=
InsertHyperLabel
(
m_pImpl
->
getItemCount
(),
OUString
(
"..."
),
-
1
,
true
/*bEnabled*/
,
true
/*bIncomplete*/
);
}
void
ORoadmap
::
ChangeRoadmapItemID
(
ItemId
_nID
,
ItemId
_NewID
,
ItemIndex
_nStartIndex
)
{
RoadmapItem
*
pItem
=
GetByID
(
_nID
,
_nStartIndex
);
if
(
pItem
!=
NULL
)
pItem
->
SetID
(
_NewID
);
}
RoadmapItem
*
ORoadmap
::
GetByID
(
ItemId
_nID
,
ItemIndex
_nStartIndex
)
void
ORoadmap
::
UpdatefollowingHyperLabels
(
ItemIndex
_nIndex
)
{
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
if
(
_nIndex
<
(
ItemIndex
)
rItems
.
size
()
)
{
ItemId
nLocID
=
0
;
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
()
+
_nStartIndex
;
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
()
+
_nIndex
;
i
!=
rItems
.
end
();
++
i
++
i
,
++
_nIndex
)
{
nLocID
=
(
*
i
)
->
GetID
();
if
(
nLocID
==
_nID
)
return
*
i
;
RoadmapItem
*
pItem
=
*
i
;
pItem
->
SetIndex
(
_nIndex
);
pItem
->
SetPosition
(
GetPreviousHyperLabel
(
_nIndex
)
);
}
return
NULL
;
}
const
RoadmapItem
*
ORoadmap
::
GetByID
(
ItemId
_nID
,
ItemIndex
_nStartIndex
)
const
if
(
!
m_pImpl
->
isComplete
()
)
{
return
const_cast
<
ORoadmap
*
>
(
this
)
->
GetByID
(
_nID
,
_nStartIndex
);
RoadmapItem
*
pOldItem
=
GetPreviousHyperLabel
(
m_pImpl
->
getItemCount
()
);
m_pImpl
->
InCompleteHyperLabel
->
SetPosition
(
pOldItem
);
m_pImpl
->
InCompleteHyperLabel
->
Update
(
m_pImpl
->
getItemCount
(),
OUString
(
"..."
)
);
}
}
RoadmapItem
*
ORoadmap
::
GetByIndex
(
ItemIndex
_nItemIndex
)
void
ORoadmap
::
ReplaceRoadmapItem
(
ItemIndex
_Index
,
const
OUString
&
_RoadmapItem
,
ItemId
_RMID
,
bool
_bEnabled
)
{
RoadmapItem
*
pItem
=
GetByIndex
(
_Index
);
if
(
pItem
!=
NULL
)
{
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
if
(
(
_nItemIndex
>
-
1
)
&&
(
_nItemIndex
<
(
ItemIndex
)
rItems
.
size
()
)
)
{
return
rItems
.
at
(
_nItemIndex
);
}
return
NULL
;
pItem
->
Update
(
_Index
,
_RoadmapItem
);
pItem
->
SetID
(
_RMID
);
pItem
->
Enable
(
_bEnabled
);
}
}
RoadmapTypes
::
ItemIndex
ORoadmap
::
GetItemCount
()
const
{
return
m_pImpl
->
getItemCount
();
}
const
RoadmapItem
*
ORoadmap
::
GetByIndex
(
ItemIndex
_nItemIndex
)
const
{
return
const_cast
<
ORoadmap
*
>
(
this
)
->
GetByIndex
(
_nItemIndex
);
}
RoadmapTypes
::
ItemId
ORoadmap
::
GetItemID
(
ItemIndex
_nIndex
)
const
{
const
RoadmapItem
*
pHyperLabel
=
GetByIndex
(
_nIndex
);
if
(
pHyperLabel
)
return
pHyperLabel
->
GetID
();
return
-
1
;
}
void
ORoadmap
::
InsertRoadmapItem
(
ItemIndex
_Index
,
const
OUString
&
_RoadmapItem
,
ItemId
_nUniqueId
,
bool
_bEnabled
)
{
InsertHyperLabel
(
_Index
,
_RoadmapItem
,
_nUniqueId
,
_bEnabled
,
false
/*bIncomplete*/
);
// TODO YPos is superfluous, if items are always appended
UpdatefollowingHyperLabels
(
_Index
+
1
);
}
RoadmapTypes
::
ItemId
ORoadmap
::
GetNextAvailableItemId
(
ItemIndex
_nNewIndex
)
void
ORoadmap
::
DeleteRoadmapItem
(
ItemIndex
_Index
)
{
if
(
m_pImpl
->
getItemCount
()
>
0
&&
(
_Index
>
-
1
)
&&
(
_Index
<
m_pImpl
->
getItemCount
()
)
)
{
ItemIndex
searchIndex
=
++
_nNewIndex
;
while
(
searchIndex
<
m_pImpl
->
getItemCount
()
)
{
RoadmapItem
*
pItem
=
GetByIndex
(
searchIndex
);
if
(
pItem
->
IsEnabled
()
)
return
pItem
->
GetID
(
);
++
searchIndex
;
}
return
-
1
;
m_pImpl
->
removeHyperLabel
(
_Index
);
UpdatefollowingHyperLabels
(
_Index
);
}
}
bool
ORoadmap
::
IsRoadmapComplete
()
const
{
return
m_pImpl
->
isComplete
();
}
RoadmapTypes
::
ItemId
ORoadmap
::
GetPreviousAvailableItemId
(
ItemIndex
_nNewIndex
)
{
ItemIndex
searchIndex
=
--
_nNewIndex
;
while
(
searchIndex
>
-
1
)
{
RoadmapItem
*
pItem
=
GetByIndex
(
searchIndex
);
if
(
pItem
->
IsEnabled
()
)
return
pItem
->
GetID
(
);
searchIndex
--
;
}
return
-
1
;
}
void
ORoadmap
::
EnableRoadmapItem
(
ItemId
_nItemId
,
bool
_bEnable
,
ItemIndex
_nStartIndex
)
{
RoadmapItem
*
pItem
=
GetByID
(
_nItemId
,
_nStartIndex
);
if
(
pItem
!=
NULL
)
pItem
->
Enable
(
_bEnable
);
}
void
ORoadmap
::
DeselectOldRoadmapItems
()
void
ORoadmap
::
ChangeRoadmapItemLabel
(
ItemId
_nID
,
const
OUString
&
_sLabel
,
ItemIndex
_nStartIndex
)
{
RoadmapItem
*
pItem
=
GetByID
(
_nID
,
_nStartIndex
);
if
(
pItem
!=
NULL
)
{
pItem
->
Update
(
pItem
->
GetIndex
(),
_sLabel
);
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
()
+
_nStartIndex
;
i
!=
rItems
.
end
();
++
i
)
{
(
*
i
)
->
ToggleBackgroundColor
(
COL_TRANSPARENT
);
(
*
i
)
->
SetPosition
(
GetPreviousHyperLabel
(
i
-
rItems
.
begin
()
)
);
}
}
}
void
ORoadmap
::
ChangeRoadmapItemID
(
ItemId
_nID
,
ItemId
_NewID
,
ItemIndex
_nStartIndex
)
{
RoadmapItem
*
pItem
=
GetByID
(
_nID
,
_nStartIndex
);
if
(
pItem
!=
NULL
)
pItem
->
SetID
(
_NewID
);
}
void
ORoadmap
::
SetItemSelectHdl
(
const
Link
<>&
_rHdl
)
RoadmapItem
*
ORoadmap
::
GetByID
(
ItemId
_nID
,
ItemIndex
_nStartIndex
)
{
ItemId
nLocID
=
0
;
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
()
+
_nStartIndex
;
i
!=
rItems
.
end
();
++
i
)
{
m_pImpl
->
setSelectHdl
(
_rHdl
);
nLocID
=
(
*
i
)
->
GetID
();
if
(
nLocID
==
_nID
)
return
*
i
;
}
return
NULL
;
}
const
RoadmapItem
*
ORoadmap
::
GetByID
(
ItemId
_nID
,
ItemIndex
_nStartIndex
)
const
{
return
const_cast
<
ORoadmap
*
>
(
this
)
->
GetByID
(
_nID
,
_nStartIndex
);
}
Link
<>
ORoadmap
::
GetItemSelectHdl
(
)
const
RoadmapItem
*
ORoadmap
::
GetByIndex
(
ItemIndex
_nItemIndex
)
{
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
if
(
(
_nItemIndex
>
-
1
)
&&
(
_nItemIndex
<
(
ItemIndex
)
rItems
.
size
()
)
)
{
return
m_pImpl
->
getSelectHdl
(
);
return
rItems
.
at
(
_nItemIndex
);
}
return
NULL
;
}
const
RoadmapItem
*
ORoadmap
::
GetByIndex
(
ItemIndex
_nItemIndex
)
const
{
return
const_cast
<
ORoadmap
*
>
(
this
)
->
GetByIndex
(
_nItemIndex
);
}
void
ORoadmap
::
Select
()
RoadmapTypes
::
ItemId
ORoadmap
::
GetNextAvailableItemId
(
ItemIndex
_nNewIndex
)
{
ItemIndex
searchIndex
=
++
_nNewIndex
;
while
(
searchIndex
<
m_pImpl
->
getItemCount
()
)
{
GetItemSelectHdl
().
Call
(
this
);
CallEventListeners
(
VCLEVENT_ROADMAP_ITEMSELECTED
);
}
RoadmapItem
*
pItem
=
GetByIndex
(
searchIndex
);
if
(
pItem
->
IsEnabled
()
)
return
pItem
->
GetID
(
);
++
searchIndex
;
}
return
-
1
;
}
void
ORoadmap
::
GetFocus
()
RoadmapTypes
::
ItemId
ORoadmap
::
GetPreviousAvailableItemId
(
ItemIndex
_nNewIndex
)
{
ItemIndex
searchIndex
=
--
_nNewIndex
;
while
(
searchIndex
>
-
1
)
{
RoadmapItem
*
pCurHyperLabel
=
GetByID
(
GetCurrentRoadmapItemID
()
);
if
(
pCurHyperLabel
!=
NULL
)
pCurHyperLabel
->
GrabFocus
();
}
RoadmapItem
*
pItem
=
GetByIndex
(
searchIndex
);
if
(
pItem
->
IsEnabled
()
)
return
pItem
->
GetID
(
);
searchIndex
--
;
}
return
-
1
;
}
bool
ORoadmap
::
SelectRoadmapItemByID
(
ItemId
_nNewID
)
void
ORoadmap
::
DeselectOldRoadmapItems
()
{
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
();
i
!=
rItems
.
end
();
++
i
)
{
DeselectOldRoadmapItems
();
RoadmapItem
*
pItem
=
GetByID
(
_nNewID
);
if
(
pItem
!=
NULL
)
{
if
(
pItem
->
IsEnabled
()
)
{
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
pItem
->
ToggleBackgroundColor
(
rStyleSettings
.
GetHighlightColor
()
);
//HighlightColor
(
*
i
)
->
ToggleBackgroundColor
(
COL_TRANSPARENT
);
}
}
pItem
->
GrabFocus
();
m_pImpl
->
setCurItemID
(
_nNewID
);
void
ORoadmap
::
SetItemSelectHdl
(
const
Link
<>&
_rHdl
)
{
m_pImpl
->
setSelectHdl
(
_rHdl
);
}
Select
();
return
true
;
}
}
return
false
;
}
Link
<>
ORoadmap
::
GetItemSelectHdl
()
const
{
return
m_pImpl
->
getSelectHdl
();
}
void
ORoadmap
::
Select
()
{
GetItemSelectHdl
().
Call
(
this
);
CallEventListeners
(
VCLEVENT_ROADMAP_ITEMSELECTED
);
}
void
ORoadmap
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
_rRect
)
{
Control
::
Paint
(
rRenderContext
,
_rRect
);
void
ORoadmap
::
GetFocus
()
{
RoadmapItem
*
pCurHyperLabel
=
GetByID
(
GetCurrentRoadmapItemID
()
);
if
(
pCurHyperLabel
!=
NULL
)
pCurHyperLabel
->
GrabFocus
();
}
// draw the bitmap
if
(
!!
m_pImpl
->
getPicture
()
)
bool
ORoadmap
::
SelectRoadmapItemByID
(
ItemId
_nNewID
)
{
DeselectOldRoadmapItems
();
RoadmapItem
*
pItem
=
GetByID
(
_nNewID
);
if
(
pItem
!=
NULL
)
{
if
(
pItem
->
IsEnabled
()
)
{
Size
aBitmapSize
=
m_pImpl
->
getPicture
().
GetSizePixel
();
Size
aMySize
=
GetOutputSizePixel
();
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
pItem
->
ToggleBackgroundColor
(
rStyleSettings
.
GetHighlightColor
()
);
//HighlightColor
Point
aBitmapPos
(
aMySize
.
Width
()
-
aBitmapSize
.
Width
(),
aMySize
.
Height
()
-
aBitmapSize
.
Height
()
);
pItem
->
GrabFocus
();
m_pImpl
->
setCurItemID
(
_nNewID
);
// draw it
DrawBitmapEx
(
aBitmapPos
,
m_pImpl
->
getPicture
()
)
;
Select
();
return
true
;
}
// draw the headline
DrawHeadline
();
}
return
false
;
}
void
ORoadmap
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
_rRect
)
{
Control
::
Paint
(
rRenderContext
,
_rRect
);
void
ORoadmap
::
DrawHeadline
()
// draw the bitmap
if
(
!!
m_pImpl
->
getPicture
()
)
{
Point
aTextPos
=
LogicToPixel
(
Point
(
ROADMAP_INDENT_X
,
8
),
MAP_APPFONT
);
Size
aBitmapSize
=
m_pImpl
->
getPicture
().
GetSizePixel
();
Size
aMySize
=
GetOutputSizePixel
();
Size
aOutputSize
(
GetOutputSizePixel
()
);
Point
aBitmapPos
(
aMySize
.
Width
()
-
aBitmapSize
.
Width
(),
aMySize
.
Height
()
-
aBitmapSize
.
Height
()
);
// 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
());
DrawBitmapEx
(
aBitmapPos
,
m_pImpl
->
getPicture
()
);
}
// draw the headline
DrawHeadline
();
}
RoadmapItem
*
ORoadmap
::
GetByPointer
(
vcl
::
Window
*
pWindow
)
{
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
();
i
!=
rItems
.
end
();
++
i
)
{
if
(
(
*
i
)
->
Contains
(
pWindow
)
)
return
*
i
;
}
return
NULL
;
}
void
ORoadmap
::
DrawHeadline
()
{
Point
aTextPos
=
LogicToPixel
(
Point
(
ROADMAP_INDENT_X
,
8
),
MAP_APPFONT
);
bool
ORoadmap
::
PreNotify
(
NotifyEvent
&
_rNEvt
)
{
// capture KeyEvents for taskpane cycling
if
(
_rNEvt
.
GetType
()
==
MouseNotifyEvent
::
KEYINPUT
)
{
vcl
::
Window
*
pWindow
=
_rNEvt
.
GetWindow
();
RoadmapItem
*
pItem
=
GetByPointer
(
pWindow
);
if
(
pItem
!=
NULL
)
{
sal_Int16
nKeyCode
=
_rNEvt
.
GetKeyEvent
()
->
GetKeyCode
().
GetCode
();
switch
(
nKeyCode
)
{
case
KEY_UP
:
{
// Note: Performancewise this is not optimal, because we search for an ID in the labels
// and afterwards we search again for a label with the appropriate ID ->
// unnecessarily we search twice!!!
ItemId
nPrevItemID
=
GetPreviousAvailableItemId
(
pItem
->
GetIndex
()
);
if
(
nPrevItemID
!=
-
1
)
return
SelectRoadmapItemByID
(
nPrevItemID
);
}
break
;
case
KEY_DOWN
:
{
ItemId
nNextItemID
=
GetNextAvailableItemId
(
pItem
->
GetIndex
()
);
if
(
nNextItemID
!=
-
1
)
return
SelectRoadmapItemByID
(
nNextItemID
);
}
break
;
case
KEY_SPACE
:
return
SelectRoadmapItemByID
(
pItem
->
GetID
()
);
}
}
}
return
Window
::
PreNotify
(
_rNEvt
);
}
Size
aOutputSize
(
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
());
}
IMPL_LINK
(
ORoadmap
,
ImplClickHdl
,
HyperLabel
*
,
_CurHyperLabel
)
RoadmapItem
*
ORoadmap
::
GetByPointer
(
vcl
::
Window
*
pWindow
)
{
const
HL_Vector
&
rItems
=
m_pImpl
->
getHyperLabels
();
for
(
HL_Vector
::
const_iterator
i
=
rItems
.
begin
();
i
!=
rItems
.
end
();
++
i
)
{
return
SelectRoadmapItemByID
(
_CurHyperLabel
->
GetID
()
)
?
1
:
0
;
if
(
(
*
i
)
->
Contains
(
pWindow
)
)
return
*
i
;
}
return
NULL
;
}
void
ORoadmap
::
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
bool
ORoadmap
::
PreNotify
(
NotifyEvent
&
_rNEvt
)
{
// capture KeyEvents for taskpane cycling
if
(
_rNEvt
.
GetType
()
==
MouseNotifyEvent
::
KEYINPUT
)
{
if
(((
rDCEvt
.
GetType
()
==
DataChangedEventType
::
SETTINGS
)
||
(
rDCEvt
.
GetType
()
==
DataChangedEventType
::
DISPLAY
))
&&
(
rDCEvt
.
GetFlags
()
&
AllSettingsFlags
::
STYLE
)
)
vcl
::
Window
*
pWindow
=
_rNEvt
.
GetWindow
();
RoadmapItem
*
pItem
=
GetByPointer
(
pWindow
);
if
(
pItem
!=
NULL
)
{
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
SetBackground
(
Wallpaper
(
rStyleSettings
.
GetFieldColor
()
)
);
Color
aTextColor
=
rStyleSettings
.
GetFieldTextColor
();
vcl
::
Font
aFont
=
GetFont
();
aFont
.
SetColor
(
aTextColor
);
SetFont
(
aFont
);
RoadmapTypes
::
ItemId
curItemID
=
GetCurrentRoadmapItemID
();
RoadmapItem
*
pLabelItem
=
GetByID
(
curItemID
);
if
(
pLabelItem
!=
NULL
)
sal_Int16
nKeyCode
=
_rNEvt
.
GetKeyEvent
()
->
GetKeyCode
().
GetCode
();
switch
(
nKeyCode
)
{
pLabelItem
->
ToggleBackgroundColor
(
rStyleSettings
.
GetHighlightColor
());
case
KEY_UP
:
{
// Note: Performancewise this is not optimal, because we search for an ID in the labels
// and afterwards we search again for a label with the appropriate ID ->
// unnecessarily we search twice!!!
ItemId
nPrevItemID
=
GetPreviousAvailableItemId
(
pItem
->
GetIndex
()
);
if
(
nPrevItemID
!=
-
1
)
return
SelectRoadmapItemByID
(
nPrevItemID
);
}
break
;
case
KEY_DOWN
:
{
ItemId
nNextItemID
=
GetNextAvailableItemId
(
pItem
->
GetIndex
()
);
if
(
nNextItemID
!=
-
1
)
return
SelectRoadmapItemByID
(
nNextItemID
);
}
break
;
case
KEY_SPACE
:
return
SelectRoadmapItemByID
(
pItem
->
GetID
()
);
}
Invalidate
();
}
}
return
Window
::
PreNotify
(
_rNEvt
);
}
IMPL_LINK
(
ORoadmap
,
ImplClickHdl
,
HyperLabel
*
,
_CurHyperLabel
)
{
return
SelectRoadmapItemByID
(
_CurHyperLabel
->
GetID
()
)
?
1
:
0
;
}
RoadmapItem
::
RoadmapItem
(
ORoadmap
&
_rParent
,
const
Size
&
_rItemPlayground
)
:
m_aItemPlayground
(
_rItemPlayground
)
{
mpID
=
VclPtr
<
IDLabel
>::
Create
(
&
_rParent
,
WB_WORDBREAK
);
mpID
->
SetTextColor
(
mpID
->
GetSettings
().
GetStyleSettings
().
GetFieldTextColor
(
)
);
mpID
->
Show
();
mpDescription
=
VclPtr
<
HyperLabel
>::
Create
(
&
_rParent
,
WB_NOTABSTOP
|
WB_WORDBREAK
);
mpDescription
->
Show
();
}
RoadmapItem
::~
RoadmapItem
()
{
mpID
.
disposeAndClear
();
mpDescription
.
disposeAndClear
();
}
bool
RoadmapItem
::
Contains
(
const
vcl
::
Window
*
_pWindow
)
const
{
return
(
mpID
==
_pWindow
)
||
(
mpDescription
==
_pWindow
);
}
void
RoadmapItem
::
GrabFocus
()
{
if
(
mpDescription
)
mpDescription
->
GrabFocus
();
}
void
RoadmapItem
::
SetInteractive
(
bool
_bInteractive
)
void
ORoadmap
::
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
{
if
(((
rDCEvt
.
GetType
()
==
DataChangedEventType
::
SETTINGS
)
||
(
rDCEvt
.
GetType
()
==
DataChangedEventType
::
DISPLAY
))
&&
(
rDCEvt
.
GetFlags
()
&
AllSettingsFlags
::
STYLE
))
{
if
(
mpDescription
)
mpDescription
->
SetInteractive
(
_bInteractive
);
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
SetBackground
(
Wallpaper
(
rStyleSettings
.
GetFieldColor
()
)
);
Color
aTextColor
=
rStyleSettings
.
GetFieldTextColor
();
vcl
::
Font
aFont
=
GetFont
();
aFont
.
SetColor
(
aTextColor
);
SetFont
(
aFont
);
RoadmapTypes
::
ItemId
curItemID
=
GetCurrentRoadmapItemID
();
RoadmapItem
*
pLabelItem
=
GetByID
(
curItemID
);
if
(
pLabelItem
!=
NULL
)
{
pLabelItem
->
ToggleBackgroundColor
(
rStyleSettings
.
GetHighlightColor
());
}
Invalidate
();
}
}
RoadmapItem
::
RoadmapItem
(
ORoadmap
&
_rParent
,
const
Size
&
_rItemPlayground
)
:
m_aItemPlayground
(
_rItemPlayground
)
{
mpID
=
VclPtr
<
IDLabel
>::
Create
(
&
_rParent
,
WB_WORDBREAK
);
mpID
->
SetTextColor
(
mpID
->
GetSettings
().
GetStyleSettings
().
GetFieldTextColor
(
)
);
mpID
->
Show
();
mpDescription
=
VclPtr
<
HyperLabel
>::
Create
(
&
_rParent
,
WB_NOTABSTOP
|
WB_WORDBREAK
);
mpDescription
->
Show
();
}
RoadmapItem
::~
RoadmapItem
()
{
mpID
.
disposeAndClear
();
mpDescription
.
disposeAndClear
();
}
void
RoadmapItem
::
SetID
(
sal_Int16
_ID
)
{
if
(
mpDescription
)
mpDescription
->
SetID
(
_ID
);
}
bool
RoadmapItem
::
Contains
(
const
vcl
::
Window
*
_pWindow
)
const
{
return
(
mpID
==
_pWindow
)
||
(
mpDescription
==
_pWindow
);
}
void
RoadmapItem
::
GrabFocus
()
{
if
(
mpDescription
)
mpDescription
->
GrabFocus
();
}
sal_Int16
RoadmapItem
::
GetID
()
const
{
return
mpDescription
?
mpDescription
->
GetID
()
:
sal_Int16
(
-
1
);
}
void
RoadmapItem
::
SetInteractive
(
bool
_bInteractive
)
{
if
(
mpDescription
)
mpDescription
->
SetInteractive
(
_bInteractive
);
}
void
RoadmapItem
::
SetID
(
sal_Int16
_ID
)
{
if
(
mpDescription
)
mpDescription
->
SetID
(
_ID
);
}
void
RoadmapItem
::
ImplUpdateIndex
(
const
ItemIndex
_nIndex
)
{
mpDescription
->
SetIndex
(
_nIndex
);
sal_Int16
RoadmapItem
::
GetID
()
const
{
return
mpDescription
?
mpDescription
->
GetID
()
:
sal_Int16
(
-
1
);
}
OUString
aIDText
=
OUString
::
number
(
_nIndex
+
1
)
+
"."
;
mpID
->
SetText
(
aIDText
);
void
RoadmapItem
::
ImplUpdateIndex
(
const
ItemIndex
_nIndex
)
{
mpDescription
->
SetIndex
(
_nIndex
);
// update the geometry of both controls
ImplUpdatePosSize
();
}
OUString
aIDText
=
OUString
::
number
(
_nIndex
+
1
)
+
"."
;
mpID
->
SetText
(
aIDText
);
// update the geometry of both controls
ImplUpdatePosSize
();
}
void
RoadmapItem
::
SetIndex
(
ItemIndex
_Index
)
{
ImplUpdateIndex
(
_Index
);
}
void
RoadmapItem
::
SetIndex
(
ItemIndex
_Index
)
{
ImplUpdateIndex
(
_Index
);
}
RoadmapTypes
::
ItemIndex
RoadmapItem
::
GetIndex
()
const
{
return
mpDescription
?
mpDescription
->
GetIndex
()
:
ItemIndex
(
-
1
);
}
RoadmapTypes
::
ItemIndex
RoadmapItem
::
GetIndex
()
const
void
RoadmapItem
::
SetPosition
(
RoadmapItem
*
_pOldItem
)
{
Point
aIDPos
;
if
(
_pOldItem
==
NULL
)
{
return
mpDescription
?
mpDescription
->
GetIndex
()
:
ItemIndex
(
-
1
);
aIDPos
=
mpID
->
LogicToPixel
(
Point
(
ROADMAP_INDENT_X
,
ROADMAP_INDENT_Y
),
MAP_APPFONT
);
}
void
RoadmapItem
::
SetPosition
(
RoadmapItem
*
_pOldItem
)
else
{
Point
aIDPos
;
if
(
_pOldItem
==
NULL
)
{
aIDPos
=
mpID
->
LogicToPixel
(
Point
(
ROADMAP_INDENT_X
,
ROADMAP_INDENT_Y
),
MAP_APPFONT
);
}
else
{
Size
aOldSize
=
_pOldItem
->
GetDescriptionHyperLabel
()
->
GetSizePixel
();
aIDPos
=
_pOldItem
->
mpID
->
GetPosPixel
();
aIDPos
.
Y
()
+=
aOldSize
.
Height
();
aIDPos
.
Y
()
+=
mpID
->
GetParent
()
->
LogicToPixel
(
Size
(
0
,
ROADMAP_ITEM_DISTANCE_Y
)
).
Height
();
}
mpID
->
SetPosPixel
(
aIDPos
);
sal_Int32
nDescPos
=
aIDPos
.
X
()
+
mpID
->
GetSizePixel
().
Width
();
mpDescription
->
SetPosPixel
(
Point
(
nDescPos
,
aIDPos
.
Y
()
)
);
}
Size
aOldSize
=
_pOldItem
->
GetDescriptionHyperLabel
()
->
GetSizePixel
();
void
RoadmapItem
::
Enable
(
bool
_bEnable
)
{
mpID
->
Enable
(
_bEnable
);
mpDescription
->
Enable
(
_bEnable
);
aIDPos
=
_pOldItem
->
mpID
->
GetPosPixel
();
aIDPos
.
Y
()
+=
aOldSize
.
Height
();
aIDPos
.
Y
()
+=
mpID
->
GetParent
()
->
LogicToPixel
(
Size
(
0
,
ROADMAP_ITEM_DISTANCE_Y
)
).
Height
();
}
mpID
->
SetPosPixel
(
aIDPos
);
sal_Int32
nDescPos
=
aIDPos
.
X
()
+
mpID
->
GetSizePixel
().
Width
();
mpDescription
->
SetPosPixel
(
Point
(
nDescPos
,
aIDPos
.
Y
()
)
);
}
bool
RoadmapItem
::
IsEnabled
()
const
{
return
mpID
->
IsEnabled
();
}
void
RoadmapItem
::
Enable
(
bool
_bEnable
)
{
mpID
->
Enable
(
_bEnable
);
mpDescription
->
Enable
(
_bEnable
);
}
bool
RoadmapItem
::
IsEnabled
()
const
{
return
mpID
->
IsEnabled
();
}
void
RoadmapItem
::
ToggleBackgroundColor
(
const
Color
&
_rGBColor
)
void
RoadmapItem
::
ToggleBackgroundColor
(
const
Color
&
_rGBColor
)
{
if
(
_rGBColor
==
COL_TRANSPARENT
)
{
if
(
_rGBColor
==
COL_TRANSPARENT
)
{
mpID
->
SetTextColor
(
mpID
->
GetSettings
().
GetStyleSettings
().
GetFieldTextColor
(
)
);
mpID
->
SetControlBackground
(
COL_TRANSPARENT
);
}
else
{
mpID
->
SetControlBackground
(
mpID
->
GetSettings
().
GetStyleSettings
().
GetHighlightColor
()
);
mpID
->
SetTextColor
(
mpID
->
GetSettings
().
GetStyleSettings
().
GetHighlightTextColor
(
)
);
}
mpDescription
->
ToggleBackgroundColor
(
_rGBColor
);
mpID
->
SetTextColor
(
mpID
->
GetSettings
().
GetStyleSettings
().
GetFieldTextColor
(
)
);
mpID
->
SetControlBackground
(
COL_TRANSPARENT
);
}
void
RoadmapItem
::
ImplUpdatePosSize
()
else
{
// calculate widths
long
nIDWidth
=
mpID
->
GetTextWidth
(
mpID
->
GetText
()
);
long
nMaxIDWidth
=
mpID
->
GetTextWidth
(
OUString
(
"100."
)
);
nIDWidth
=
::
std
::
min
(
nIDWidth
,
nMaxIDWidth
);
// check how many space the description would need
Size
aDescriptionSize
=
mpDescription
->
CalcMinimumSize
(
m_aItemPlayground
.
Width
()
-
nIDWidth
);
// position and size both controls
Size
aIDSize
(
nIDWidth
,
aDescriptionSize
.
Height
()
);
mpID
->
SetSizePixel
(
aIDSize
);
Point
aIDPos
=
mpID
->
GetPosPixel
();
mpDescription
->
SetPosPixel
(
Point
(
aIDPos
.
X
()
+
nIDWidth
,
aIDPos
.
Y
()
)
);
mpDescription
->
SetSizePixel
(
aDescriptionSize
);
mpID
->
SetControlBackground
(
mpID
->
GetSettings
().
GetStyleSettings
().
GetHighlightColor
()
);
mpID
->
SetTextColor
(
mpID
->
GetSettings
().
GetStyleSettings
().
GetHighlightTextColor
(
)
);
}
mpDescription
->
ToggleBackgroundColor
(
_rGBColor
);
}
void
RoadmapItem
::
ImplUpdatePosSize
()
{
// calculate widths
long
nIDWidth
=
mpID
->
GetTextWidth
(
mpID
->
GetText
()
);
long
nMaxIDWidth
=
mpID
->
GetTextWidth
(
OUString
(
"100."
)
);
nIDWidth
=
::
std
::
min
(
nIDWidth
,
nMaxIDWidth
);
void
RoadmapItem
::
Update
(
ItemIndex
_RMIndex
,
const
OUString
&
_rText
)
{
// update description label
mpDescription
->
SetLabel
(
_rText
);
// check how many space the description would need
Size
aDescriptionSize
=
mpDescription
->
CalcMinimumSize
(
m_aItemPlayground
.
Width
()
-
nIDWidth
);
// update the index in both controls, which triggers updating the geometry of both
ImplUpdateIndex
(
_RMIndex
);
}
// position and size both controls
Size
aIDSize
(
nIDWidth
,
aDescriptionSize
.
Height
()
);
mpID
->
SetSizePixel
(
aIDSize
);
Point
aIDPos
=
mpID
->
GetPosPixel
();
mpDescription
->
SetPosPixel
(
Point
(
aIDPos
.
X
()
+
nIDWidth
,
aIDPos
.
Y
()
)
);
mpDescription
->
SetSizePixel
(
aDescriptionSize
);
}
void
RoadmapItem
::
SetClickHdl
(
const
Link
<>&
rLink
)
{
if
(
mpDescription
)
mpDescription
->
SetClickHdl
(
rLink
);
}
void
RoadmapItem
::
Update
(
ItemIndex
_RMIndex
,
const
OUString
&
_rText
)
{
// update description label
mpDescription
->
SetLabel
(
_rText
);
IDLabel
::
IDLabel
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
)
:
FixedText
(
_pParent
,
_nWinStyle
)
{
// update the index in both controls, which triggers updating the geometry of both
ImplUpdateIndex
(
_RMIndex
);
}
}
void
RoadmapItem
::
SetClickHdl
(
const
Link
<>&
rLink
)
{
if
(
mpDescription
)
mpDescription
->
SetClickHdl
(
rLink
);
}
IDLabel
::
IDLabel
(
vcl
::
Window
*
_pParent
,
WinBits
_nWinStyle
)
:
FixedText
(
_pParent
,
_nWinStyle
)
{
}
void
IDLabel
::
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
{
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
FixedText
::
DataChanged
(
rDCEvt
);
if
(((
rDCEvt
.
GetType
()
==
DataChangedEventType
::
SETTINGS
)
||
(
rDCEvt
.
GetType
()
==
DataChangedEventType
::
DISPLAY
))
&&
(
rDCEvt
.
GetFlags
()
&
AllSettingsFlags
::
STYLE
))
void
IDLabel
::
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
{
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
FixedText
::
DataChanged
(
rDCEvt
);
if
(((
rDCEvt
.
GetType
()
==
DataChangedEventType
::
SETTINGS
)
||
(
rDCEvt
.
GetType
()
==
DataChangedEventType
::
DISPLAY
))
&&
(
rDCEvt
.
GetFlags
()
&
AllSettingsFlags
::
STYLE
))
{
const
Color
&
rGBColor
=
GetControlBackground
();
if
(
rGBColor
==
COL_TRANSPARENT
)
SetTextColor
(
rStyleSettings
.
GetFieldTextColor
(
)
);
else
{
const
Color
&
rGBColor
=
GetControlBackground
();
if
(
rGBColor
==
COL_TRANSPARENT
)
SetTextColor
(
rStyleSettings
.
GetFieldTextColor
(
)
);
else
{
SetControlBackground
(
rStyleSettings
.
GetHighlightColor
());
SetTextColor
(
rStyleSettings
.
GetHighlightTextColor
(
)
);
}
Invalidate
();
SetControlBackground
(
rStyleSettings
.
GetHighlightColor
());
SetTextColor
(
rStyleSettings
.
GetHighlightTextColor
(
)
);
}
Invalidate
();
}
}
}
// namespace svt
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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