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
3da4ab93
Kaydet (Commit)
3da4ab93
authored
May 18, 2012
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Support separators in the autofilter/pivot table popup window.
Change-Id: Ifde9cee65b2bee731e66a200b3bf68c0e320872f
üst
87ed6c84
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
11 deletions
+142
-11
checklistmenu.cxx
sc/source/ui/cctrl/checklistmenu.cxx
+136
-10
checklistmenu.hxx
sc/source/ui/inc/checklistmenu.hxx
+5
-1
gridwin.cxx
sc/source/ui/view/gridwin.cxx
+1
-0
No files found.
sc/source/ui/cctrl/checklistmenu.cxx
Dosyayı görüntüle @
3da4ab93
...
@@ -49,7 +49,7 @@ using ::boost::unordered_map;
...
@@ -49,7 +49,7 @@ using ::boost::unordered_map;
using
::
std
::
auto_ptr
;
using
::
std
::
auto_ptr
;
ScMenuFloatingWindow
::
MenuItemData
::
MenuItemData
()
:
ScMenuFloatingWindow
::
MenuItemData
::
MenuItemData
()
:
mbEnabled
(
true
),
mbEnabled
(
true
),
mbSeparator
(
false
),
mpAction
(
static_cast
<
ScCheckListMenuWindow
::
Action
*>
(
NULL
)),
mpAction
(
static_cast
<
ScCheckListMenuWindow
::
Action
*>
(
NULL
)),
mpSubMenuWin
(
static_cast
<
ScMenuFloatingWindow
*>
(
NULL
))
mpSubMenuWin
(
static_cast
<
ScMenuFloatingWindow
*>
(
NULL
))
{
{
...
@@ -141,6 +141,12 @@ void ScMenuFloatingWindow::MouseButtonUp(const MouseEvent& rMEvt)
...
@@ -141,6 +141,12 @@ void ScMenuFloatingWindow::MouseButtonUp(const MouseEvent& rMEvt)
void
ScMenuFloatingWindow
::
KeyInput
(
const
KeyEvent
&
rKEvt
)
void
ScMenuFloatingWindow
::
KeyInput
(
const
KeyEvent
&
rKEvt
)
{
{
if
(
maMenuItems
.
empty
())
{
Window
::
KeyInput
(
rKEvt
);
return
;
}
const
KeyCode
&
rKeyCode
=
rKEvt
.
GetKeyCode
();
const
KeyCode
&
rKeyCode
=
rKEvt
.
GetKeyCode
();
bool
bHandled
=
true
;
bool
bHandled
=
true
;
size_t
nSelectedMenu
=
mnSelectedMenu
;
size_t
nSelectedMenu
=
mnSelectedMenu
;
...
@@ -148,18 +154,64 @@ void ScMenuFloatingWindow::KeyInput(const KeyEvent& rKEvt)
...
@@ -148,18 +154,64 @@ void ScMenuFloatingWindow::KeyInput(const KeyEvent& rKEvt)
switch
(
rKeyCode
.
GetCode
())
switch
(
rKeyCode
.
GetCode
())
{
{
case
KEY_UP
:
case
KEY_UP
:
{
if
(
nLastMenuPos
==
0
)
// There is only one menu item. Do nothing.
break
;
size_t
nOldPos
=
nSelectedMenu
;
if
(
nSelectedMenu
==
MENU_NOT_SELECTED
||
nSelectedMenu
==
0
)
if
(
nSelectedMenu
==
MENU_NOT_SELECTED
||
nSelectedMenu
==
0
)
nSelectedMenu
=
nLastMenuPos
;
nSelectedMenu
=
nLastMenuPos
;
else
else
--
nSelectedMenu
;
--
nSelectedMenu
;
// Loop until a non-separator menu item is found.
while
(
nSelectedMenu
!=
nOldPos
)
{
if
(
maMenuItems
[
nSelectedMenu
].
mbSeparator
)
{
if
(
nSelectedMenu
)
--
nSelectedMenu
;
else
nSelectedMenu
=
nLastMenuPos
;
}
else
break
;
}
setSelectedMenuItem
(
nSelectedMenu
,
false
,
false
);
setSelectedMenuItem
(
nSelectedMenu
,
false
,
false
);
}
break
;
break
;
case
KEY_DOWN
:
case
KEY_DOWN
:
{
if
(
nLastMenuPos
==
0
)
// There is only one menu item. Do nothing.
break
;
size_t
nOldPos
=
nSelectedMenu
;
if
(
nSelectedMenu
==
MENU_NOT_SELECTED
||
nSelectedMenu
==
nLastMenuPos
)
if
(
nSelectedMenu
==
MENU_NOT_SELECTED
||
nSelectedMenu
==
nLastMenuPos
)
nSelectedMenu
=
0
;
nSelectedMenu
=
0
;
else
else
++
nSelectedMenu
;
++
nSelectedMenu
;
// Loop until a non-separator menu item is found.
while
(
nSelectedMenu
!=
nOldPos
)
{
if
(
maMenuItems
[
nSelectedMenu
].
mbSeparator
)
{
if
(
nSelectedMenu
==
nLastMenuPos
)
nSelectedMenu
=
0
;
else
++
nSelectedMenu
;
}
else
break
;
}
setSelectedMenuItem
(
nSelectedMenu
,
false
,
false
);
setSelectedMenuItem
(
nSelectedMenu
,
false
,
false
);
}
break
;
break
;
case
KEY_LEFT
:
case
KEY_LEFT
:
if
(
mpParentMenu
)
if
(
mpParentMenu
)
...
@@ -237,6 +289,10 @@ Reference<XAccessible> ScMenuFloatingWindow::CreateAccessible()
...
@@ -237,6 +289,10 @@ Reference<XAccessible> ScMenuFloatingWindow::CreateAccessible()
vector
<
MenuItemData
>::
const_iterator
itr
,
itrBeg
=
maMenuItems
.
begin
(),
itrEnd
=
maMenuItems
.
end
();
vector
<
MenuItemData
>::
const_iterator
itr
,
itrBeg
=
maMenuItems
.
begin
(),
itrEnd
=
maMenuItems
.
end
();
for
(
itr
=
itrBeg
;
itr
!=
itrEnd
;
++
itr
)
for
(
itr
=
itrBeg
;
itr
!=
itrEnd
;
++
itr
)
{
{
if
(
itr
->
mbSeparator
)
// TODO: Handle this correctly.
continue
;
size_t
nPos
=
::
std
::
distance
(
itrBeg
,
itr
);
size_t
nPos
=
::
std
::
distance
(
itrBeg
,
itr
);
p
->
appendMenuItem
(
itr
->
maText
,
itr
->
mbEnabled
,
nPos
);
p
->
appendMenuItem
(
itr
->
maText
,
itr
->
mbEnabled
,
nPos
);
}
}
...
@@ -254,6 +310,13 @@ void ScMenuFloatingWindow::addMenuItem(const OUString& rText, bool bEnabled, Act
...
@@ -254,6 +310,13 @@ void ScMenuFloatingWindow::addMenuItem(const OUString& rText, bool bEnabled, Act
maMenuItems
.
push_back
(
aItem
);
maMenuItems
.
push_back
(
aItem
);
}
}
void
ScMenuFloatingWindow
::
addSeparator
()
{
MenuItemData
aItem
;
aItem
.
mbSeparator
=
true
;
maMenuItems
.
push_back
(
aItem
);
}
ScMenuFloatingWindow
*
ScMenuFloatingWindow
::
addSubMenuItem
(
const
OUString
&
rText
,
bool
bEnabled
)
ScMenuFloatingWindow
*
ScMenuFloatingWindow
::
addSubMenuItem
(
const
OUString
&
rText
,
bool
bEnabled
)
{
{
MenuItemData
aItem
;
MenuItemData
aItem
;
...
@@ -278,7 +341,12 @@ Size ScMenuFloatingWindow::getMenuSize() const
...
@@ -278,7 +341,12 @@ Size ScMenuFloatingWindow::getMenuSize() const
vector
<
MenuItemData
>::
const_iterator
itr
=
maMenuItems
.
begin
(),
itrEnd
=
maMenuItems
.
end
();
vector
<
MenuItemData
>::
const_iterator
itr
=
maMenuItems
.
begin
(),
itrEnd
=
maMenuItems
.
end
();
long
nTextWidth
=
0
;
long
nTextWidth
=
0
;
for
(;
itr
!=
itrEnd
;
++
itr
)
for
(;
itr
!=
itrEnd
;
++
itr
)
{
if
(
itr
->
mbSeparator
)
continue
;
nTextWidth
=
::
std
::
max
(
GetTextWidth
(
itr
->
maText
),
nTextWidth
);
nTextWidth
=
::
std
::
max
(
GetTextWidth
(
itr
->
maText
),
nTextWidth
);
}
size_t
nLastPos
=
maMenuItems
.
size
()
-
1
;
size_t
nLastPos
=
maMenuItems
.
size
()
-
1
;
Point
aPos
;
Point
aPos
;
...
@@ -316,11 +384,64 @@ void ScMenuFloatingWindow::drawMenuItem(size_t nPos)
...
@@ -316,11 +384,64 @@ void ScMenuFloatingWindow::drawMenuItem(size_t nPos)
}
}
}
}
void
ScMenuFloatingWindow
::
drawSeparator
(
size_t
nPos
)
{
Point
aPos
;
Size
aSize
;
getMenuItemPosSize
(
nPos
,
aPos
,
aSize
);
Rectangle
aRegion
(
aPos
,
aSize
);
if
(
IsNativeControlSupported
(
CTRL_MENU_POPUP
,
PART_ENTIRE_CONTROL
))
{
Push
(
PUSH_CLIPREGION
);
IntersectClipRegion
(
aRegion
);
Rectangle
aCtrlRect
(
Point
(
0
,
0
),
GetOutputSizePixel
());
DrawNativeControl
(
CTRL_MENU_POPUP
,
PART_ENTIRE_CONTROL
,
aCtrlRect
,
CTRL_STATE_ENABLED
,
ImplControlValue
(),
OUString
());
Pop
();
}
bool
bNativeDrawn
=
false
;
if
(
IsNativeControlSupported
(
CTRL_MENU_POPUP
,
PART_MENU_SEPARATOR
))
{
ControlState
nState
=
0
;
const
MenuItemData
&
rData
=
maMenuItems
[
nPos
];
if
(
rData
.
mbEnabled
)
nState
|=
CTRL_STATE_ENABLED
;
bNativeDrawn
=
DrawNativeControl
(
CTRL_MENU_POPUP
,
PART_MENU_SEPARATOR
,
aRegion
,
nState
,
ImplControlValue
(),
OUString
());
}
if
(
!
bNativeDrawn
)
{
const
StyleSettings
&
rStyle
=
GetSettings
().
GetStyleSettings
();
Point
aTmpPos
=
aPos
;
aTmpPos
.
Y
()
+=
aSize
.
Height
()
/
2
;
SetLineColor
(
rStyle
.
GetShadowColor
());
DrawLine
(
aTmpPos
,
Point
(
aSize
.
Width
()
+
aTmpPos
.
X
(),
aTmpPos
.
Y
()));
++
aTmpPos
.
Y
();
SetLineColor
(
rStyle
.
GetLightColor
());
DrawLine
(
aTmpPos
,
Point
(
aSize
.
Width
()
+
aTmpPos
.
X
(),
aTmpPos
.
Y
()));
SetLineColor
();
}
}
void
ScMenuFloatingWindow
::
drawAllMenuItems
()
void
ScMenuFloatingWindow
::
drawAllMenuItems
()
{
{
size_t
n
=
maMenuItems
.
size
();
size_t
n
=
maMenuItems
.
size
();
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
highlightMenuItem
(
i
,
i
==
mnSelectedMenu
);
{
if
(
maMenuItems
[
i
].
mbSeparator
)
// Separator
drawSeparator
(
i
);
else
// Normal menu item
highlightMenuItem
(
i
,
i
==
mnSelectedMenu
);
}
}
}
const
Font
&
ScMenuFloatingWindow
::
getLabelFont
()
const
const
Font
&
ScMenuFloatingWindow
::
getLabelFont
()
const
...
@@ -622,18 +743,23 @@ void ScMenuFloatingWindow::highlightMenuItem(size_t nPos, bool bSelected)
...
@@ -622,18 +743,23 @@ void ScMenuFloatingWindow::highlightMenuItem(size_t nPos, bool bSelected)
void
ScMenuFloatingWindow
::
getMenuItemPosSize
(
size_t
nPos
,
Point
&
rPos
,
Size
&
rSize
)
const
void
ScMenuFloatingWindow
::
getMenuItemPosSize
(
size_t
nPos
,
Point
&
rPos
,
Size
&
rSize
)
const
{
{
size_t
nCount
=
maMenuItems
.
size
();
if
(
nPos
>=
nCount
)
return
;
const
sal_uInt16
nLeftMargin
=
5
;
const
sal_uInt16
nLeftMargin
=
5
;
const
sal_uInt16
nTopMargin
=
5
;
const
sal_uInt16
nTopMargin
=
5
;
const
sal_uInt16
nMenuItemHeight
=
static_cast
<
sal_uInt16
>
(
maLabelFont
.
GetHeight
()
*
1.8
);
const
sal_uInt16
nMenuItemHeight
=
static_cast
<
sal_uInt16
>
(
maLabelFont
.
GetHeight
()
*
1.8
);
const
sal_uInt16
nSepHeight
=
static_cast
<
sal_uInt16
>
(
maLabelFont
.
GetHeight
()
*
0.8
);
Size
aWndSize
=
GetSizePixel
();
Point
aPos1
(
nLeftMargin
,
nTopMargin
);
Point
aPos1
(
nLeftMargin
,
nTopMargin
);
Size
aSize1
(
aWndSize
.
Width
()
-
nLeftMargin
*
2
,
nMenuItemHeight
);
rPos
=
aPos1
;
rPos
=
aPos1
;
rPos
.
Y
()
+=
aSize1
.
Height
()
*
nPos
;
for
(
size_t
i
=
0
;
i
<
nPos
;
++
i
)
rSize
=
aSize1
;
rPos
.
Y
()
+=
maMenuItems
[
i
].
mbSeparator
?
nSepHeight
:
nMenuItemHeight
;
Size
aWndSize
=
GetSizePixel
();
sal_uInt16
nH
=
maMenuItems
[
nPos
].
mbSeparator
?
nSepHeight
:
nMenuItemHeight
;
rSize
=
Size
(
aWndSize
.
Width
()
-
nLeftMargin
*
2
,
nH
);
}
}
ScMenuFloatingWindow
*
ScMenuFloatingWindow
::
getParentMenuWindow
()
const
ScMenuFloatingWindow
*
ScMenuFloatingWindow
::
getParentMenuWindow
()
const
...
@@ -651,7 +777,7 @@ size_t ScMenuFloatingWindow::getEnclosingMenuItem(const Point& rPos) const
...
@@ -651,7 +777,7 @@ size_t ScMenuFloatingWindow::getEnclosingMenuItem(const Point& rPos) const
getMenuItemPosSize
(
i
,
aPos
,
aSize
);
getMenuItemPosSize
(
i
,
aPos
,
aSize
);
Rectangle
aRect
(
aPos
,
aSize
);
Rectangle
aRect
(
aPos
,
aSize
);
if
(
aRect
.
IsInside
(
rPos
))
if
(
aRect
.
IsInside
(
rPos
))
return
i
;
return
maMenuItems
[
i
].
mbSeparator
?
MENU_NOT_SELECTED
:
i
;
}
}
return
MENU_NOT_SELECTED
;
return
MENU_NOT_SELECTED
;
}
}
...
...
sc/source/ui/inc/checklistmenu.hxx
Dosyayı görüntüle @
3da4ab93
...
@@ -76,6 +76,8 @@ public:
...
@@ -76,6 +76,8 @@ public:
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
accessibility
::
XAccessible
>
CreateAccessible
();
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
accessibility
::
XAccessible
>
CreateAccessible
();
void
addMenuItem
(
const
::
rtl
::
OUString
&
rText
,
bool
bEnabled
,
Action
*
pAction
);
void
addMenuItem
(
const
::
rtl
::
OUString
&
rText
,
bool
bEnabled
,
Action
*
pAction
);
void
addSeparator
();
ScMenuFloatingWindow
*
addSubMenuItem
(
const
::
rtl
::
OUString
&
rText
,
bool
bEnabled
);
ScMenuFloatingWindow
*
addSubMenuItem
(
const
::
rtl
::
OUString
&
rText
,
bool
bEnabled
);
void
setSelectedMenuItem
(
size_t
nPos
,
bool
bSubMenuTimer
,
bool
bEnsureSubMenu
);
void
setSelectedMenuItem
(
size_t
nPos
,
bool
bSubMenuTimer
,
bool
bEnsureSubMenu
);
void
selectMenuItem
(
size_t
nPos
,
bool
bSelected
,
bool
bSubMenuTimer
);
void
selectMenuItem
(
size_t
nPos
,
bool
bSelected
,
bool
bSubMenuTimer
);
...
@@ -96,6 +98,7 @@ protected:
...
@@ -96,6 +98,7 @@ protected:
Size
getMenuSize
()
const
;
Size
getMenuSize
()
const
;
void
drawMenuItem
(
size_t
nPos
);
void
drawMenuItem
(
size_t
nPos
);
void
drawSeparator
(
size_t
nPos
);
void
drawAllMenuItems
();
void
drawAllMenuItems
();
const
Font
&
getLabelFont
()
const
;
const
Font
&
getLabelFont
()
const
;
...
@@ -159,7 +162,8 @@ private:
...
@@ -159,7 +162,8 @@ private:
struct
MenuItemData
struct
MenuItemData
{
{
::
rtl
::
OUString
maText
;
::
rtl
::
OUString
maText
;
bool
mbEnabled
;
bool
mbEnabled
:
1
;
bool
mbSeparator
:
1
;
::
boost
::
shared_ptr
<
Action
>
mpAction
;
::
boost
::
shared_ptr
<
Action
>
mpAction
;
::
boost
::
shared_ptr
<
ScMenuFloatingWindow
>
mpSubMenuWin
;
::
boost
::
shared_ptr
<
ScMenuFloatingWindow
>
mpSubMenuWin
;
...
...
sc/source/ui/view/gridwin.cxx
Dosyayı görüntüle @
3da4ab93
...
@@ -710,6 +710,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
...
@@ -710,6 +710,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
SC_RESSTR
(
SCSTR_FILTER_EMPTY
),
true
,
new
AutoFilterAction
(
this
,
Empty
));
SC_RESSTR
(
SCSTR_FILTER_EMPTY
),
true
,
new
AutoFilterAction
(
this
,
Empty
));
mpAutoFilterPopup
->
addMenuItem
(
mpAutoFilterPopup
->
addMenuItem
(
SC_RESSTR
(
SCSTR_FILTER_NOTEMPTY
),
true
,
new
AutoFilterAction
(
this
,
NonEmpty
));
SC_RESSTR
(
SCSTR_FILTER_NOTEMPTY
),
true
,
new
AutoFilterAction
(
this
,
NonEmpty
));
mpAutoFilterPopup
->
addSeparator
();
mpAutoFilterPopup
->
addMenuItem
(
mpAutoFilterPopup
->
addMenuItem
(
SC_RESSTR
(
SCSTR_STDFILTER
),
true
,
new
AutoFilterAction
(
this
,
Custom
));
SC_RESSTR
(
SCSTR_STDFILTER
),
true
,
new
AutoFilterAction
(
this
,
Custom
));
...
...
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