[Libreoffice-commits] core.git: 9 commits - dbaccess/source desktop/source include/vcl sd/source vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Sat May 16 07:14:17 PDT 2015
dbaccess/source/ui/app/AppDetailPageHelper.cxx | 12
dbaccess/source/ui/app/AppDetailView.cxx | 12
dbaccess/source/ui/browser/dataview.cxx | 28
dbaccess/source/ui/control/marktree.cxx | 6
dbaccess/source/ui/inc/ConnectionLine.hxx | 2
dbaccess/source/ui/inc/JoinTableView.hxx | 2
dbaccess/source/ui/inc/TableConnection.hxx | 2
dbaccess/source/ui/inc/TableWindow.hxx | 2
dbaccess/source/ui/querydesign/JoinTableView.cxx | 14
dbaccess/source/ui/querydesign/TableConnection.cxx | 4
dbaccess/source/ui/querydesign/TableWindow.cxx | 26
dbaccess/source/ui/relationdesign/RTableConnection.cxx | 25
dbaccess/source/ui/relationdesign/RTableConnection.hxx | 2
dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx | 14
desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 148 ++--
desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 101 +--
desktop/source/splash/splash.cxx | 22
include/vcl/menu.hxx | 533 ++++++++---------
sd/source/ui/animations/CustomAnimationList.cxx | 25
sd/source/ui/dlg/RemoteDialogClientBox.cxx | 84 +-
sd/source/ui/dlg/RemoteDialogClientBox.hxx | 136 ++--
vcl/source/control/tabctrl.cxx | 165 ++---
vcl/source/window/floatwin.cxx | 55 -
vcl/source/window/menu.cxx | 411 +++++--------
vcl/source/window/menubarwindow.cxx | 92 +-
vcl/source/window/menubarwindow.hxx | 4
vcl/source/window/menufloatingwindow.cxx | 151 ++--
vcl/source/window/menufloatingwindow.hxx | 129 ++--
28 files changed, 1077 insertions(+), 1130 deletions(-)
New commits:
commit 1902ebaa4b14c62ecec80b525fb43b7011fa4c29
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sat May 16 21:55:53 2015 +0900
cleanup FloatWindow
Change-Id: I214322303ae0f7c1a0e3cee0fea112f06a38f06c
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 413aeef..f7aca45 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -65,55 +65,58 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle )
mbInCleanUp = false;
mbGrabFocus = false;
- DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL!" );
+ DBG_ASSERT(pParent, "FloatWindow::FloatingWindow(): - pParent == NULL!");
- if ( !pParent )
+ if (!pParent)
pParent = ImplGetSVData()->maWinData.mpAppWin;
- DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists" );
+ DBG_ASSERT(pParent, "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists");
// no Border, then we dont need a border window
- if ( !nStyle )
+ if (!nStyle)
{
mpWindowImpl->mbOverlapWin = true;
nStyle |= WB_DIALOGCONTROL;
- SystemWindow::ImplInit( pParent, nStyle, NULL );
+ SystemWindow::ImplInit(pParent, nStyle, NULL);
}
else
{
- if ( !(nStyle & WB_NODIALOGCONTROL) )
+ if (!(nStyle & WB_NODIALOGCONTROL))
nStyle |= WB_DIALOGCONTROL;
- if( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE)
- && !(nStyle & WB_OWNERDRAWDECORATION) )
+ if (nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE)
+ && !(nStyle & WB_OWNERDRAWDECORATION))
{
WinBits nFloatWinStyle = nStyle;
// #99154# floaters are not closeable by default anymore, eg fullscreen floater
// nFloatWinStyle |= WB_CLOSEABLE;
mpWindowImpl->mbFrame = true;
mpWindowImpl->mbOverlapWin = true;
- SystemWindow::ImplInit( pParent, nFloatWinStyle & ~WB_BORDER, NULL );
+ SystemWindow::ImplInit(pParent, nFloatWinStyle & ~WB_BORDER, NULL);
}
else
{
- ImplBorderWindow* pBorderWin;
- sal_uInt16 nBorderStyle = BORDERWINDOW_STYLE_BORDER | BORDERWINDOW_STYLE_FLOAT;
+ ImplBorderWindow* pBorderWin;
+ sal_uInt16 nBorderStyle = BORDERWINDOW_STYLE_BORDER | BORDERWINDOW_STYLE_FLOAT;
- if( nStyle & WB_OWNERDRAWDECORATION ) nBorderStyle |= BORDERWINDOW_STYLE_FRAME;
- else nBorderStyle |= BORDERWINDOW_STYLE_OVERLAP;
+ if (nStyle & WB_OWNERDRAWDECORATION)
+ nBorderStyle |= BORDERWINDOW_STYLE_FRAME;
+ else
+ nBorderStyle |= BORDERWINDOW_STYLE_OVERLAP;
- if ( (nStyle & WB_SYSTEMWINDOW) && !(nStyle & (WB_MOVEABLE | WB_SIZEABLE)) )
+ if ((nStyle & WB_SYSTEMWINDOW) && !(nStyle & (WB_MOVEABLE | WB_SIZEABLE)))
{
nBorderStyle |= BORDERWINDOW_STYLE_FRAME;
nStyle |= WB_CLOSEABLE; // make undecorated floaters closeable
}
- pBorderWin = VclPtr<ImplBorderWindow>::Create( pParent, nStyle, nBorderStyle );
- SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
+ pBorderWin = VclPtr<ImplBorderWindow>::Create(pParent, nStyle, nBorderStyle);
+ SystemWindow::ImplInit(pBorderWin, nStyle & ~WB_BORDER, NULL);
pBorderWin->mpWindowImpl->mpClientWindow = this;
- pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
- pBorderWin->SetDisplayActive( true );
- mpWindowImpl->mpBorderWindow = pBorderWin;
- mpWindowImpl->mpRealParent = pParent;
+ pBorderWin->GetBorder(mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder,
+ mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder);
+ pBorderWin->SetDisplayActive(true);
+ mpWindowImpl->mpBorderWindow = pBorderWin;
+ mpWindowImpl->mpRealParent = pParent;
}
}
SetActivateMode( 0 );
@@ -138,19 +141,19 @@ void FloatingWindow::ImplInitSettings()
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Color aColor;
- if ( IsControlBackground() )
+ if (IsControlBackground())
aColor = GetControlBackground();
- else if ( Window::GetStyle() & WB_3DLOOK )
+ else if (Window::GetStyle() & WB_3DLOOK)
aColor = rStyleSettings.GetFaceColor();
else
aColor = rStyleSettings.GetWindowColor();
- SetBackground( aColor );
+ SetBackground(aColor);
}
-FloatingWindow::FloatingWindow( vcl::Window* pParent, WinBits nStyle ) :
- SystemWindow( WINDOW_FLOATINGWINDOW )
+FloatingWindow::FloatingWindow(vcl::Window* pParent, WinBits nStyle) :
+ SystemWindow(WINDOW_FLOATINGWINDOW)
{
- ImplInit( pParent, nStyle );
+ ImplInit(pParent, nStyle);
}
FloatingWindow::FloatingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame)
commit 71ede9d1f9eb493fcabfc8238b88354856413b8d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sat May 16 21:51:02 2015 +0900
menu: remember old Background and restore later
Change-Id: I1c2bc60729117ea0a4e03a231b4dcce083ecf959
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 0f600bc..7a32856 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1765,6 +1765,8 @@ void Menu::ImplPaintMenuTitle(vcl::RenderContext& rRenderContext, const Rectangl
{
// Save previous graphical settings, set new one
rRenderContext.Push(PushFlags::FONT | PushFlags::FILLCOLOR);
+ Wallpaper aOldBackground = rRenderContext.GetBackground();
+
Color aBackgroundColor = rRenderContext.GetSettings().GetStyleSettings().GetMenuBarColor();
rRenderContext.SetBackground(Wallpaper(aBackgroundColor));
rRenderContext.SetFillColor(aBackgroundColor);
@@ -1789,8 +1791,8 @@ void Menu::ImplPaintMenuTitle(vcl::RenderContext& rRenderContext, const Rectangl
rRenderContext.DrawText(aTextTopLeft, aTitleText, 0, aTitleText.getLength());
// Restore
- rRenderContext.SetBackground();
rRenderContext.Pop();
+ rRenderContext.SetBackground(aOldBackground);
}
void Menu::ImplPaint(vcl::RenderContext& rRenderContext,
commit 7de50fd4b37a2280d08ce6e3b0b03c227a5d315e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sat May 16 21:50:19 2015 +0900
refactor CustomAnimationList to use RenderContext
Change-Id: I2a9e713ccc2bf4468f86bdcf6efdf91e4e41c8d6
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 0f88370..6f93769 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -202,11 +202,12 @@ static OUString getDescription( const Any& rTarget, bool bWithText = true )
class CustomAnimationListEntryItem : public SvLBoxString
{
public:
- CustomAnimationListEntryItem( SvTreeListEntry*,sal_uInt16 nFlags, const OUString& aDescription, CustomAnimationEffectPtr pEffect, CustomAnimationList* pParent );
- virtual ~CustomAnimationListEntryItem();
- void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* ) SAL_OVERRIDE;
- SvLBoxItem* Create() const SAL_OVERRIDE;
- void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE;
+ CustomAnimationListEntryItem(SvTreeListEntry*, sal_uInt16 nFlags, const OUString& aDescription,
+ CustomAnimationEffectPtr pEffect, CustomAnimationList* pParent);
+ virtual ~CustomAnimationListEntryItem();
+ void InitViewData(SvTreeListBox*,SvTreeListEntry*,SvViewDataItem*) SAL_OVERRIDE;
+ SvLBoxItem* Create() const SAL_OVERRIDE;
+ void Clone(SvLBoxItem* pSource) SAL_OVERRIDE;
virtual void Paint(const Point&, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
const SvViewDataEntry* pView,const SvTreeListEntry* pEntry) SAL_OVERRIDE;
@@ -938,21 +939,21 @@ void CustomAnimationList::Paint(vcl::RenderContext& rRenderContext, const Rectan
// draw help text if list box is still empty
if( First() == 0 )
{
- Color aOldColor( GetTextColor() );
- SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() );
- ::Point aOffset( LogicToPixel( Point( 6, 6 ), MAP_APPFONT ) );
+ Color aOldColor(rRenderContext.GetTextColor());
+ rRenderContext.SetTextColor(rRenderContext.GetSettings().GetStyleSettings().GetDisableColor());
+ ::Point aOffset(rRenderContext.LogicToPixel(Point(6, 6), MAP_APPFONT));
- Rectangle aRect( Point( 0,0 ), GetOutputSizePixel() );
+ Rectangle aRect(Point(0,0), rRenderContext.GetOutputSizePixel());
aRect.Left() += aOffset.X();
aRect.Top() += aOffset.Y();
aRect.Right() -= aOffset.X();
aRect.Bottom() -= aOffset.Y();
- DrawText( aRect, SD_RESSTR(STR_CUSTOMANIMATION_LIST_HELPTEXT),
- TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK | TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER );
+ rRenderContext.DrawText(aRect, SD_RESSTR(STR_CUSTOMANIMATION_LIST_HELPTEXT),
+ TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK | TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER );
- SetTextColor( aOldColor );
+ rRenderContext.SetTextColor(aOldColor);
}
}
commit 579b9d92c4451f86469a62a4531b026358dd52c7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sat May 16 21:48:32 2015 +0900
refactor ClientBox to use RenderContext
Change-Id: I028da90804992a30a8d547198aa15bcc2f32e365
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
index bc95d25..24a5821 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
@@ -282,73 +282,71 @@ void ClientBox::selectEntry( const long nPos )
guard.clear();
}
-void ClientBox::DrawRow( const Rectangle& rRect, const TClientBoxEntry& rEntry )
+void ClientBox::DrawRow(vcl::RenderContext& rRenderContext, const Rectangle& rRect, const TClientBoxEntry& rEntry)
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- if ( rEntry->m_bActive )
- SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ if (rEntry->m_bActive)
+ SetTextColor(rStyleSettings.GetHighlightTextColor());
else
- SetTextColor( rStyleSettings.GetFieldTextColor() );
+ SetTextColor(rStyleSettings.GetFieldTextColor());
- if ( rEntry->m_bActive )
+ if (rEntry->m_bActive)
{
- SetLineColor();
- SetFillColor( rStyleSettings.GetHighlightColor() );
- DrawRect( rRect );
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor(rStyleSettings.GetHighlightColor());
+ rRenderContext.DrawRect(rRect);
}
else
{
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
+ if(IsControlBackground())
+ SetBackground(GetControlBackground());
else
- SetBackground( rStyleSettings.GetFieldColor() );
+ SetBackground(rStyleSettings.GetFieldColor());
- SetTextFillColor();
- Erase( rRect );
+ rRenderContext.SetTextFillColor();
+ rRenderContext.Erase(rRect);
}
// FIXME: draw bluetooth or wifi icon
- Point aPos( rRect.TopLeft() );
+ Point aPos(rRect.TopLeft());
// Setup fonts
- vcl::Font aStdFont( GetFont() );
- vcl::Font aBoldFont( aStdFont );
- aBoldFont.SetWeight( WEIGHT_BOLD );
- SetFont( aBoldFont );
- long aTextHeight = GetTextHeight();
+ vcl::Font aStdFont(rRenderContext.GetFont());
+ vcl::Font aBoldFont(aStdFont);
+ aBoldFont.SetWeight(WEIGHT_BOLD);
+ rRenderContext.SetFont(aBoldFont);
+ long aTextHeight = rRenderContext.GetTextHeight();
// Get max title width
long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
- long aTitleWidth = GetTextWidth( rEntry->m_pClientInfo->mName ) + (aTextHeight / 3);
+ long aTitleWidth = rRenderContext.GetTextWidth(rEntry->m_pClientInfo->mName) + (aTextHeight / 3);
- aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
+ aPos = rRect.TopLeft() + Point(ICON_OFFSET, TOP_OFFSET);
- if ( aTitleWidth > nMaxTitleWidth )
+ if (aTitleWidth > nMaxTitleWidth)
{
aTitleWidth = nMaxTitleWidth - (aTextHeight / 3);
- OUString aShortTitle = GetEllipsisString( rEntry->m_pClientInfo->mName,
- aTitleWidth );
- DrawText( aPos, aShortTitle );
+ OUString aShortTitle = rRenderContext.GetEllipsisString(rEntry->m_pClientInfo->mName, aTitleWidth );
+ rRenderContext.DrawText(aPos, aShortTitle);
aTitleWidth += (aTextHeight / 3);
}
else
- DrawText( aPos, rEntry->m_pClientInfo->mName );
+ rRenderContext.DrawText(aPos, rEntry->m_pClientInfo->mName);
- SetFont( aStdFont );
+ SetFont(aStdFont);
aPos.Y() += aTextHeight;
- if ( rEntry->m_bActive )
+ if (rEntry->m_bActive)
{
OUString sPinText(SD_RESSTR(STR_ENTER_PIN));
- DrawText( m_sPinTextRect,
- sPinText, 0 );
+ DrawText(m_sPinTextRect, sPinText, 0);
}
- SetLineColor( Color( COL_LIGHTGRAY ) );
- DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
+ rRenderContext.SetLineColor(Color(COL_LIGHTGRAY));
+ rRenderContext.DrawLine(rRect.BottomLeft(), rRect.BottomRight());
}
void ClientBox::RecalcAll()
@@ -486,28 +484,28 @@ bool ClientBox::HandleCursorKey( sal_uInt16 nKeyCode )
return true;
}
-void ClientBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle &/*rPaintRect*/ )
+void ClientBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle &/*rPaintRect*/)
{
- if ( !m_bInDelete )
+ if (!m_bInDelete)
DeleteRemoved();
- if ( m_bNeedsRecalc )
+ if (m_bNeedsRecalc)
RecalcAll();
- Point aStart( 0, -m_nTopIndex );
- Size aSize( GetOutputSizePixel() );
+ Point aStart(0, -m_nTopIndex);
+ Size aSize(rRenderContext.GetOutputSizePixel());
- if ( m_bHasScrollBar )
+ if (m_bHasScrollBar)
aSize.Width() -= m_aScrollBar->GetSizePixel().Width();
- const ::osl::MutexGuard aGuard( m_entriesMutex );
+ const ::osl::MutexGuard aGuard(m_entriesMutex);
typedef std::vector< TClientBoxEntry >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ for (ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex)
{
aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
- Rectangle aEntryRect( aStart, aSize );
- DrawRow( aEntryRect, *iIndex );
+ Rectangle aEntryRect(aStart, aSize);
+ DrawRow(rRenderContext, aEntryRect, *iIndex);
aStart.Y() += aSize.Height();
}
}
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
index f27d159..5f60f857 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
@@ -52,14 +52,14 @@ namespace sd {
struct ClientBoxEntry;
struct ClientInfo;
-typedef ::boost::shared_ptr< ClientBoxEntry > TClientBoxEntry;
+typedef boost::shared_ptr<ClientBoxEntry> TClientBoxEntry;
struct ClientBoxEntry
{
- bool m_bActive :1;
- ::boost::shared_ptr<ClientInfo> m_pClientInfo;
+ bool m_bActive :1;
+ boost::shared_ptr<ClientInfo> m_pClientInfo;
- ClientBoxEntry( ::boost::shared_ptr<ClientInfo> pClientInfo );
+ ClientBoxEntry(boost::shared_ptr<ClientInfo> pClientInfo);
~ClientBoxEntry();
};
@@ -67,47 +67,49 @@ struct ClientBoxEntry
// class ExtensionBox_Impl
class ClientBox;
-class ClientRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+class ClientRemovedListener : public ::cppu::WeakImplHelper1<css::lang::XEventListener>
{
- VclPtr<ClientBox> m_pParent;
+ VclPtr<ClientBox> m_pParent;
public:
- ClientRemovedListener( ClientBox *pParent ) { m_pParent = pParent; }
- virtual ~ClientRemovedListener();
+ ClientRemovedListener(ClientBox *pParent)
+ {
+ m_pParent = pParent;
+ }
+ virtual ~ClientRemovedListener();
// XEventListener
- virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual void SAL_CALL disposing(css::lang::EventObject const & evt)
+ throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
};
-class ClientBox:
- public Control
+class ClientBox : public Control
{
- bool m_bHasScrollBar;
- bool m_bHasActive;
- bool m_bNeedsRecalc;
- bool m_bInCheckMode;
- bool m_bAdjustActive;
- bool m_bInDelete;
+ bool m_bHasScrollBar : 1;
+ bool m_bHasActive : 1;
+ bool m_bNeedsRecalc : 1;
+ bool m_bInCheckMode : 1;
+ bool m_bAdjustActive : 1;
+ bool m_bInDelete : 1;
//Must be guarded together with m_vEntries to ensure a valid index at all times.
//Use m_entriesMutex as guard.
- long m_nActive;
- long m_nTopIndex;
- long m_nStdHeight;
- long m_nActiveHeight;
- long m_nExtraHeight;
+ long m_nActive;
+ long m_nTopIndex;
+ long m_nStdHeight;
+ long m_nActiveHeight;
+ long m_nExtraHeight;
Size m_aOutputSize;
Link<> m_aClickHdl;
Link<> m_aDeauthoriseHdl;
- VclPtr<NumericBox> m_aPinBox;
- VclPtr<PushButton> m_aDeauthoriseButton;
- Rectangle m_sPinTextRect;
+ VclPtr<NumericBox> m_aPinBox;
+ VclPtr<PushButton> m_aDeauthoriseButton;
+ Rectangle m_sPinTextRect;
- VclPtr<ScrollBar> m_aScrollBar;
+ VclPtr<ScrollBar> m_aScrollBar;
- com::sun::star::uno::Reference< ClientRemovedListener > m_xRemoveListener;
+ css::uno::Reference< ClientRemovedListener > m_xRemoveListener;
//This mutex is used for synchronizing access to m_vEntries.
//Currently it is used to synchronize adding, removing entries and
@@ -120,13 +122,13 @@ class ClientBox:
std::vector< TClientBoxEntry > m_vEntries;
std::vector< TClientBoxEntry > m_vRemovedEntries;
- void CalcActiveHeight( const long nPos );
- long GetTotalHeight() const;
- void SetupScrollBar();
- void DrawRow(const Rectangle& rRect, const TClientBoxEntry& rEntry);
- bool HandleTabKey( bool bReverse );
- bool HandleCursorKey( sal_uInt16 nKeyCode );
- void DeleteRemoved();
+ void CalcActiveHeight( const long nPos );
+ long GetTotalHeight() const;
+ void SetupScrollBar();
+ void DrawRow(vcl::RenderContext& rRenderContext, const Rectangle& rRect, const TClientBoxEntry& rEntry);
+ bool HandleTabKey( bool bReverse );
+ bool HandleCursorKey( sal_uInt16 nKeyCode );
+ void DeleteRemoved();
DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar* );
DECL_DLLPRIVATE_LINK( DeauthoriseHdl, void * );
@@ -135,42 +137,42 @@ class ClientBox:
void checkIndex(sal_Int32 pos) const;
public:
- ClientBox( vcl::Window* pParent, WinBits nStyle );
- virtual ~ClientBox();
- virtual void dispose() SAL_OVERRIDE;
-
- void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- void Paint( vcl::RenderContext& rRenderContext, const Rectangle &rPaintRect ) SAL_OVERRIDE;
- void Resize() SAL_OVERRIDE;
- Size GetOptimalSize() const SAL_OVERRIDE;
- bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
-
- const Size GetMinOutputSizePixel() const;
- void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
- TClientBoxEntry GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
- long GetActiveEntryIndex();
- long GetEntryCount() { return (long) m_vEntries.size(); }
- Rectangle GetEntryRect( const long nPos ) const;
- bool HasActive() { return m_bHasActive; }
- long PointToPos( const Point& rPos );
- void SetScrollHdl( const Link<>& rLink );
- void DoScroll( long nDelta );
- void SetHyperlinkHdl( const Link<>& rLink ){ m_aClickHdl = rLink; }
- void RecalcAll();
- void RemoveUnlocked();
-
- void selectEntry( const long nPos );
- long addEntry( ::boost::shared_ptr<ClientInfo> pClientInfo );
- void clearEntries();
-
- void prepareChecking();
- void checkEntries();
+ ClientBox( vcl::Window* pParent, WinBits nStyle );
+ virtual ~ClientBox();
+ virtual void dispose() SAL_OVERRIDE;
+
+ void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
+ void Paint( vcl::RenderContext& rRenderContext, const Rectangle &rPaintRect ) SAL_OVERRIDE;
+ void Resize() SAL_OVERRIDE;
+ Size GetOptimalSize() const SAL_OVERRIDE;
+ bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
+
+ const Size GetMinOutputSizePixel() const;
+ void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
+ TClientBoxEntry GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
+ long GetActiveEntryIndex();
+ long GetEntryCount() { return (long) m_vEntries.size(); }
+ Rectangle GetEntryRect( const long nPos ) const;
+ bool HasActive() { return m_bHasActive; }
+ long PointToPos( const Point& rPos );
+ void SetScrollHdl( const Link<>& rLink );
+ void DoScroll( long nDelta );
+ void SetHyperlinkHdl( const Link<>& rLink ){ m_aClickHdl = rLink; }
+ void RecalcAll();
+ void RemoveUnlocked();
+
+ void selectEntry( const long nPos );
+ long addEntry(boost::shared_ptr<ClientInfo> pClientInfo);
+ void clearEntries();
+
+ void prepareChecking();
+ void checkEntries();
OUString getPin();
- void populateEntries();
+ void populateEntries();
};
-}
+} // end namespace sd
#endif // INCLUDED_SD_SOURCE_UI_DLG_REMOTEDIALOGCLIENTBOX_HXX
commit d346ea574726459559044e9d4870e9b7b9815d13
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sat May 16 12:32:59 2015 +0900
refactor Tab item drawing to RenderContext
Change-Id: I70e7548a427b7e365b5cc5749ad7a7b6717921cc
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 419f636..c39b34d 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -756,15 +756,15 @@ void TabControl::ImplShowFocus()
ShowFocus( aRect );
}
-void TabControl::ImplDrawItem(vcl::RenderContext& /*rRenderContext*/, ImplTabItem* pItem, const Rectangle& rCurRect,
+void TabControl::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplTabItem* pItem, const Rectangle& rCurRect,
bool bLayout, bool bFirstInGroup, bool bLastInGroup, bool /* bIsCurrentItem */ )
{
- if ( pItem->maRect.IsEmpty() )
+ if (pItem->maRect.IsEmpty())
return;
- if( bLayout )
+ if (bLayout)
{
- if( !HasLayoutData() )
+ if (!HasLayoutData())
{
mpControlData->mpLayoutData = new vcl::ControlLayoutData();
mpTabCtrlData->maLayoutLineToPageId.clear();
@@ -773,70 +773,70 @@ void TabControl::ImplDrawItem(vcl::RenderContext& /*rRenderContext*/, ImplTabIte
}
}
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- Rectangle aRect = pItem->maRect;
- long nLeftBottom = aRect.Bottom();
- long nRightBottom = aRect.Bottom();
- bool bLeftBorder = true;
- bool bRightBorder = true;
- sal_uInt16 nOff;
- bool bNativeOK = false;
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ Rectangle aRect = pItem->maRect;
+ long nLeftBottom = aRect.Bottom();
+ long nRightBottom = aRect.Bottom();
+ bool bLeftBorder = true;
+ bool bRightBorder = true;
+ sal_uInt16 nOff;
+ bool bNativeOK = false;
sal_uInt16 nOff2 = 0;
sal_uInt16 nOff3 = 0;
- if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ if (!(rStyleSettings.GetOptions() & STYLE_OPTION_MONO))
nOff = 1;
else
nOff = 0;
// if this is the active Page, we have to draw a little more
- if ( pItem->mnId == mnCurPageId )
+ if (pItem->mnId == mnCurPageId)
{
nOff2 = 2;
- if( ! ImplGetSVData()->maNWFData.mbNoActiveTabTextRaise )
+ if (!ImplGetSVData()->maNWFData.mbNoActiveTabTextRaise)
nOff3 = 1;
}
else
{
Point aLeftTestPos = aRect.BottomLeft();
Point aRightTestPos = aRect.BottomRight();
- if ( aLeftTestPos.Y() == rCurRect.Bottom() )
+ if (aLeftTestPos.Y() == rCurRect.Bottom())
{
aLeftTestPos.X() -= 2;
- if ( rCurRect.IsInside( aLeftTestPos ) )
+ if (rCurRect.IsInside(aLeftTestPos))
bLeftBorder = false;
aRightTestPos.X() += 2;
- if ( rCurRect.IsInside( aRightTestPos ) )
+ if (rCurRect.IsInside(aRightTestPos))
bRightBorder = false;
}
else
{
- if ( rCurRect.IsInside( aLeftTestPos ) )
+ if (rCurRect.IsInside(aLeftTestPos))
nLeftBottom -= 2;
- if ( rCurRect.IsInside( aRightTestPos ) )
+ if (rCurRect.IsInside(aRightTestPos))
nRightBottom -= 2;
}
}
ControlState nState = ControlState::NONE;
- if( pItem->mnId == mnCurPageId )
+ if (pItem->mnId == mnCurPageId)
{
nState |= ControlState::SELECTED;
// only the selected item can be focussed
- if ( HasFocus() )
+ if (HasFocus())
nState |= ControlState::FOCUSED;
}
- if ( IsEnabled() )
+ if (IsEnabled())
nState |= ControlState::ENABLED;
- if( IsMouseOver() && pItem->maRect.IsInside( GetPointerPosPixel() ) )
+ if (IsMouseOver() && pItem->maRect.IsInside(GetPointerPosPixel()))
{
nState |= ControlState::ROLLOVER;
- for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin();
- it != mpTabCtrlData->maItemList.end(); ++it )
+ for (std::vector<ImplTabItem>::iterator it = mpTabCtrlData->maItemList.begin();
+ it != mpTabCtrlData->maItemList.end(); ++it)
{
- if( (&(*it) != pItem) && (it->maRect.IsInside( GetPointerPosPixel() ) ) )
+ if( (&(*it) != pItem) && (it->maRect.IsInside(GetPointerPosPixel())))
{
nState &= ~ControlState::ROLLOVER; // avoid multiple highlighted tabs
break;
@@ -844,7 +844,7 @@ void TabControl::ImplDrawItem(vcl::RenderContext& /*rRenderContext*/, ImplTabIte
}
}
- if( !bLayout && (bNativeOK = IsNativeControlSupported(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL)) )
+ if (!bLayout && (bNativeOK = rRenderContext.IsNativeControlSupported(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL)))
{
TabitemValue tiValue(Rectangle(pItem->maRect.Left() + TAB_TABOFFSET_X,
pItem->maRect.Right() - TAB_TABOFFSET_X,
@@ -860,56 +860,56 @@ void TabControl::ImplDrawItem(vcl::RenderContext& /*rRenderContext*/, ImplTabIte
tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP;
Rectangle aCtrlRegion( pItem->maRect );
- bNativeOK = DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, aCtrlRegion, nState,
- tiValue, OUString() );
+ bNativeOK = rRenderContext.DrawNativeControl(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL,
+ aCtrlRegion, nState, tiValue, OUString() );
}
- if( ! bLayout && !bNativeOK )
+ if (!bLayout && !bNativeOK)
{
- if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ if (!(rStyleSettings.GetOptions() & STYLE_OPTION_MONO))
{
- SetLineColor( rStyleSettings.GetLightColor() );
- DrawPixel( Point( aRect.Left()+1-nOff2, aRect.Top()+1-nOff2 ) ); // diagonally indented top-left pixel
- if ( bLeftBorder )
+ rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
+ rRenderContext.DrawPixel(Point(aRect.Left() + 1 - nOff2, aRect.Top() + 1 - nOff2)); // diagonally indented top-left pixel
+ if (bLeftBorder)
{
- DrawLine( Point( aRect.Left()-nOff2, aRect.Top()+2-nOff2 ),
- Point( aRect.Left()-nOff2, nLeftBottom-1 ) );
+ rRenderContext.DrawLine(Point(aRect.Left() - nOff2, aRect.Top() + 2 - nOff2),
+ Point(aRect.Left() - nOff2, nLeftBottom - 1));
}
- DrawLine( Point( aRect.Left()+2-nOff2, aRect.Top()-nOff2 ), // top line starting 2px from left border
- Point( aRect.Right()+nOff2-3, aRect.Top()-nOff2 ) ); // ending 3px from right border
+ rRenderContext.DrawLine(Point(aRect.Left() + 2 - nOff2, aRect.Top() - nOff2), // top line starting 2px from left border
+ Point(aRect.Right() + nOff2 - 3, aRect.Top() - nOff2)); // ending 3px from right border
- if ( bRightBorder )
+ if (bRightBorder)
{
- SetLineColor( rStyleSettings.GetShadowColor() );
- DrawLine( Point( aRect.Right()+nOff2-2, aRect.Top()+1-nOff2 ),
- Point( aRect.Right()+nOff2-2, nRightBottom-1 ) );
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawLine(Point(aRect.Right() + nOff2 - 2, aRect.Top() + 1 - nOff2),
+ Point(aRect.Right() + nOff2 - 2, nRightBottom - 1));
- SetLineColor( rStyleSettings.GetDarkShadowColor() );
- DrawLine( Point( aRect.Right()+nOff2-1, aRect.Top()+3-nOff2 ),
- Point( aRect.Right()+nOff2-1, nRightBottom-1 ) );
+ rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
+ rRenderContext.DrawLine(Point(aRect.Right() + nOff2 - 1, aRect.Top() + 3 - nOff2),
+ Point(aRect.Right() + nOff2 - 1, nRightBottom - 1));
}
}
else
{
- SetLineColor( Color( COL_BLACK ) );
- DrawPixel( Point( aRect.Left()+1-nOff2, aRect.Top()+1-nOff2 ) );
- DrawPixel( Point( aRect.Right()+nOff2-2, aRect.Top()+1-nOff2 ) );
- if ( bLeftBorder )
+ rRenderContext.SetLineColor(Color(COL_BLACK));
+ rRenderContext.DrawPixel(Point(aRect.Left() + 1 - nOff2, aRect.Top() + 1 - nOff2));
+ rRenderContext.DrawPixel(Point(aRect.Right() + nOff2 - 2, aRect.Top() + 1 - nOff2));
+ if (bLeftBorder)
{
- DrawLine( Point( aRect.Left()-nOff2, aRect.Top()+2-nOff2 ),
- Point( aRect.Left()-nOff2, nLeftBottom-1 ) );
+ rRenderContext.DrawLine(Point(aRect.Left() - nOff2, aRect.Top() + 2 - nOff2),
+ Point(aRect.Left() - nOff2, nLeftBottom - 1));
}
- DrawLine( Point( aRect.Left()+2-nOff2, aRect.Top()-nOff2 ),
- Point( aRect.Right()-3, aRect.Top()-nOff2 ) );
- if ( bRightBorder )
+ rRenderContext.DrawLine(Point(aRect.Left() + 2 - nOff2, aRect.Top() - nOff2),
+ Point(aRect.Right() - 3, aRect.Top() - nOff2));
+ if (bRightBorder)
{
- DrawLine( Point( aRect.Right()+nOff2-1, aRect.Top()+2-nOff2 ),
- Point( aRect.Right()+nOff2-1, nRightBottom-1 ) );
+ rRenderContext.DrawLine(Point(aRect.Right() + nOff2 - 1, aRect.Top() + 2 - nOff2),
+ Point(aRect.Right() + nOff2 - 1, nRightBottom - 1));
}
}
}
- if( bLayout )
+ if (bLayout)
{
int nLine = mpControlData->mpLayoutData->m_aLineIndices.size();
mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.getLength() );
@@ -920,26 +920,26 @@ void TabControl::ImplDrawItem(vcl::RenderContext& /*rRenderContext*/, ImplTabIte
// set font accordingly, current item is painted bold
// we set the font attributes always before drawing to be re-entrant (DrawNativeControl may trigger additional paints)
- vcl::Font aFont( GetFont() );
- aFont.SetTransparent( true );
- SetFont( aFont );
+ vcl::Font aFont(rRenderContext.GetFont());
+ aFont.SetTransparent(true);
+ rRenderContext.SetFont(aFont);
Size aTabSize = aRect.GetSize();
- Size aImageSize( 0, 0 );
- long nTextHeight = GetTextHeight();
- long nTextWidth = GetCtrlTextWidth( pItem->maFormatText );
- if( !! pItem->maTabImage )
+ Size aImageSize(0, 0);
+ long nTextHeight = rRenderContext.GetTextHeight();
+ long nTextWidth = rRenderContext.GetCtrlTextWidth(pItem->maFormatText);
+ if (!!pItem->maTabImage)
{
aImageSize = pItem->maTabImage.GetSizePixel();
- if( !pItem->maFormatText.isEmpty() )
- aImageSize.Width() += GetTextHeight()/4;
+ if (!pItem->maFormatText.isEmpty())
+ aImageSize.Width() += GetTextHeight() / 4;
}
- long nXPos = aRect.Left()+((aTabSize.Width()-nTextWidth-aImageSize.Width())/2)-nOff-nOff3;
- long nYPos = aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-nOff3;
- if( !pItem->maFormatText.isEmpty() )
+ long nXPos = aRect.Left() + ((aTabSize.Width() - nTextWidth - aImageSize.Width()) / 2) - nOff - nOff3;
+ long nYPos = aRect.Top() + ((aTabSize.Height() - nTextHeight) / 2) - nOff3;
+ if (!pItem->maFormatText.isEmpty())
{
sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC;
- if( ! pItem->mbEnabled )
+ if (!pItem->mbEnabled)
nStyle |= TEXT_DRAW_DISABLE;
Color aColor(rStyleSettings.GetTabTextColor());
@@ -948,27 +948,24 @@ void TabControl::ImplDrawItem(vcl::RenderContext& /*rRenderContext*/, ImplTabIte
else if (nState & ControlState::ROLLOVER)
aColor = rStyleSettings.GetTabRolloverTextColor();
- OutputDevice* pDev = GetOutDev();
- Color aOldColor(pDev->GetTextColor());
- pDev->SetTextColor(aColor);
+ Color aOldColor(rRenderContext.GetTextColor());
+ rRenderContext.SetTextColor(aColor);
Rectangle aOutRect(nXPos + aImageSize.Width(), nYPos,
nXPos + aImageSize.Width() + nTextWidth, nYPos + nTextHeight);
- DrawControlText( *pDev, aOutRect,
- pItem->maFormatText, nStyle,
- bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL,
- bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL
- );
+ DrawControlText(rRenderContext, aOutRect, pItem->maFormatText, nStyle,
+ bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL,
+ bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL);
- pDev->SetTextColor(aOldColor);
+ rRenderContext.SetTextColor(aOldColor);
}
- if( !! pItem->maTabImage )
+ if (!!pItem->maTabImage)
{
Point aImgTL( nXPos, aRect.Top() );
- if( aImageSize.Height() < aRect.GetHeight() )
- aImgTL.Y() += (aRect.GetHeight() - aImageSize.Height())/2;
- DrawImage( aImgTL, pItem->maTabImage, pItem->mbEnabled ? 0 : IMAGE_DRAW_DISABLE );
+ if (aImageSize.Height() < aRect.GetHeight())
+ aImgTL.Y() += (aRect.GetHeight() - aImageSize.Height()) / 2;
+ rRenderContext.DrawImage(aImgTL, pItem->maTabImage, pItem->mbEnabled ? 0 : IMAGE_DRAW_DISABLE );
}
}
commit 13c9a2f151a4ee0503335edc5a6243c6ef05271e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri May 15 21:58:07 2015 +0900
additional refactoring of Menu to use RenderContext
Change-Id: Idd52c17dffcfd809f775cf3662c9410878019591
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index f4d57a4..2a4abcf 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -51,21 +51,14 @@ class IMenuBarWindow;
struct SystemMenuData;
enum class FloatWinPopupFlags;
-namespace com {
-namespace sun {
-namespace star {
-namespace accessibility {
+namespace com { namespace sun { namespace star { namespace accessibility {
class XAccessible;
}}}}
namespace vcl { struct MenuLayoutData; }
-
-// - Menu-Types -
-
-
-#define MENU_APPEND ((sal_uInt16)0xFFFF)
-#define MENU_ITEM_NOTFOUND ((sal_uInt16)0xFFFF)
+#define MENU_APPEND (sal_uInt16(0xFFFF))
+#define MENU_ITEM_NOTFOUND (sal_uInt16(0xFFFF))
// Must match the definitions in css::awt::PopupMenuDirection.idl
enum class PopupMenuFlags
@@ -83,6 +76,7 @@ enum class PopupMenuFlags
//the menu beside that rectangle
NoHorzPlacement = 0x0020,
};
+
namespace o3tl
{
template<> struct typed_flags<PopupMenuFlags> : is_typed_flags<PopupMenuFlags, 0x003f> {};
@@ -96,14 +90,14 @@ enum class MenuFlags
// overrides default hiding of disabled entries in popup menus
AlwaysShowDisabledEntries = 0x0004,
};
+
namespace o3tl
{
template<> struct typed_flags<MenuFlags> : is_typed_flags<MenuFlags, 0x0007> {};
}
-
/// Invalid menu item id
-#define ITEMPOS_INVALID 0xFFFF
+#define ITEMPOS_INVALID 0xFFFF
struct ImplMenuDelData
{
@@ -116,15 +110,11 @@ struct ImplMenuDelData
bool isDeleted() const { return mpMenu == 0; }
};
-
-// - Menu -
-
-
struct MenuLogo
{
- BitmapEx aBitmap;
- Color aStartColor;
- Color aEndColor;
+ BitmapEx aBitmap;
+ Color aStartColor;
+ Color aEndColor;
};
typedef void (*MenuUserDataReleaseFunction)(sal_uLong);
@@ -139,74 +129,76 @@ class VCL_DLLPUBLIC Menu : public Resource
friend class SystemWindow;
friend struct ImplMenuDelData;
private:
- ImplMenuDelData* mpFirstDel;
- MenuItemList* pItemList; // Liste mit den MenuItems
- MenuLogo* pLogo;
- Menu* pStartedFrom;
+ ImplMenuDelData* mpFirstDel;
+ MenuItemList* pItemList; // Liste mit den MenuItems
+ MenuLogo* pLogo;
+ Menu* pStartedFrom;
VclPtr<vcl::Window> pWindow;
- Link<Menu *, bool> aActivateHdl; // Active-Handler
- Link<Menu *, bool> aDeactivateHdl; // Deactivate-Handler
- Link<Menu *, bool> aHighlightHdl; // Highlight-Handler
- Link<> aSelectHdl; // Highlight-Handler
+ Link<Menu*, bool> aActivateHdl; // Active-Handler
+ Link<Menu*, bool> aDeactivateHdl; // Deactivate-Handler
+ Link<Menu*, bool> aHighlightHdl; // Highlight-Handler
+ Link<> aSelectHdl; // Highlight-Handler
VclEventListeners maEventListeners;
VclEventListeners maChildEventListeners;
- OUString aTitleText; // PopupMenu text
- sal_uInt16 nTitleHeight;
+ OUString aTitleText; // PopupMenu text
+ sal_uInt16 nTitleHeight;
- ImplSVEvent * nEventId;
- sal_uInt16 mnHighlightedItemPos; // for native menus: keeps track of the highlighted item
- MenuFlags nMenuFlags;
- sal_uInt16 nDefaultItem; // Id of default item
- sal_uInt16 nSelectedId;
+ ImplSVEvent* nEventId;
+ sal_uInt16 mnHighlightedItemPos; // for native menus: keeps track of the highlighted item
+ MenuFlags nMenuFlags;
+ sal_uInt16 nDefaultItem; // Id of default item
+ sal_uInt16 nSelectedId;
// for output:
- sal_uInt16 nImgOrChkPos;
- sal_uInt16 nTextPos;
+ sal_uInt16 nImgOrChkPos;
+ sal_uInt16 nTextPos;
- bool bCanceled : 1, ///< Terminated during a callback
- bInCallback : 1, ///< In Activate/Deactivate
- bKilled : 1; ///< Killed
+ bool bCanceled : 1; ///< Terminated during a callback
+ bool bInCallback : 1; ///< In Activate/Deactivate
+ bool bKilled : 1; ///< Killed
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
+ css::uno::Reference<css::accessibility::XAccessible > mxAccessible;
mutable vcl::MenuLayoutData* mpLayoutData;
- SalMenu* mpSalMenu;
+ SalMenu* mpSalMenu;
protected:
- SAL_DLLPRIVATE Menu* ImplGetStartMenu();
- SAL_DLLPRIVATE Menu* ImplFindSelectMenu();
- SAL_DLLPRIVATE Menu* ImplFindMenu( sal_uInt16 nId );
- SAL_DLLPRIVATE Size ImplCalcSize( vcl::Window* pWin );
- SAL_DLLPRIVATE bool ImplIsVisible( sal_uInt16 nPos ) const;
- SAL_DLLPRIVATE bool ImplIsSelectable( sal_uInt16 nPos ) const;
- SAL_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
- SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisible() const;
- SAL_DLLPRIVATE sal_uInt16 ImplGetPrevVisible( sal_uInt16 nPos ) const;
- SAL_DLLPRIVATE sal_uInt16 ImplGetNextVisible( sal_uInt16 nPos ) const;
- SAL_DLLPRIVATE void ImplPaint( vcl::Window* pWin, sal_uInt16 nBorder, long nOffY = 0, MenuItemData* pThisDataOnly = 0, bool bHighlighted = false, bool bLayout = false, bool bRollover = false ) const;
- SAL_DLLPRIVATE void ImplPaintMenuTitle(vcl::RenderContext&, const Rectangle& rRect) const;
- SAL_DLLPRIVATE void ImplSelect();
- SAL_DLLPRIVATE void ImplCallHighlight( sal_uInt16 nHighlightItem );
- SAL_DLLPRIVATE void ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos );
- DECL_DLLPRIVATE_LINK( ImplCallSelect, void* );
-
- SAL_DLLPRIVATE void ImplFillLayoutData() const;
- SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu; }
- SAL_DLLPRIVATE void ImplSetSalMenu( SalMenu *pMenu );
- SAL_DLLPRIVATE OUString ImplGetHelpText( sal_uInt16 nItemId ) const;
+ SAL_DLLPRIVATE Menu* ImplGetStartMenu();
+ SAL_DLLPRIVATE Menu* ImplFindSelectMenu();
+ SAL_DLLPRIVATE Menu* ImplFindMenu( sal_uInt16 nId );
+ SAL_DLLPRIVATE Size ImplCalcSize( vcl::Window* pWin );
+ SAL_DLLPRIVATE bool ImplIsVisible( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE bool ImplIsSelectable( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisible() const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetPrevVisible( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplGetNextVisible( sal_uInt16 nPos ) const;
+ SAL_DLLPRIVATE void ImplPaint(vcl::RenderContext& rRenderContext,
+ sal_uInt16 nBorder, long nOffY = 0, MenuItemData* pThisDataOnly = 0,
+ bool bHighlighted = false, bool bLayout = false, bool bRollover = false ) const;
+ SAL_DLLPRIVATE void ImplPaintMenuTitle(vcl::RenderContext&, const Rectangle& rRect) const;
+ SAL_DLLPRIVATE void ImplSelect();
+ SAL_DLLPRIVATE void ImplCallHighlight( sal_uInt16 nHighlightItem );
+ SAL_DLLPRIVATE void ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos );
+ DECL_DLLPRIVATE_LINK(ImplCallSelect, void* );
+
+ SAL_DLLPRIVATE void ImplFillLayoutData() const;
+ SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu; }
+ SAL_DLLPRIVATE void ImplSetSalMenu( SalMenu *pMenu );
+ SAL_DLLPRIVATE OUString ImplGetHelpText( sal_uInt16 nItemId ) const;
// returns native check and option menu symbol height in rCheckHeight and rRadioHeight
// return value is maximum width and height of checkboxes and radiobuttons
- SAL_DLLPRIVATE Size ImplGetNativeCheckAndRadioSize( const vcl::Window*, long& rCheckHeight, long& rRadioHeight ) const;
+ SAL_DLLPRIVATE Size ImplGetNativeCheckAndRadioSize(vcl::RenderContext& rRenderContext, long& rCheckHeight, long& rRadioHeight) const;
// returns native submenu arrow size and spacing from right border
// return value is whether it's supported natively
- SAL_DLLPRIVATE bool ImplGetNativeSubmenuArrowSize( vcl::Window* pWin, Size& rArrowSize, long& rArrowSpacing ) const;
+ SAL_DLLPRIVATE bool ImplGetNativeSubmenuArrowSize(vcl::RenderContext& rRenderContext, Size& rArrowSize, long& rArrowSpacing) const;
- SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel );
- SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel );
+ SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel );
+ SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel );
SAL_DLLPRIVATE MenuItemData* NbcInsertItem(sal_uInt16 nId, MenuItemBits nBits,
const OUString& rStr, Menu* pMenu,
@@ -222,10 +214,10 @@ protected:
virtual void MenuBarKeyInput(const KeyEvent& rEvent);
public:
- SAL_DLLPRIVATE void ImplKillLayoutData() const;
- SAL_DLLPRIVATE Menu* ImplGetStartedFrom() const { return pStartedFrom; }
+ SAL_DLLPRIVATE void ImplKillLayoutData() const;
+ SAL_DLLPRIVATE Menu* ImplGetStartedFrom() const { return pStartedFrom; }
- SAL_DLLPRIVATE vcl::Window* ImplGetWindow() const { return pWindow; }
+ SAL_DLLPRIVATE vcl::Window* ImplGetWindow() const { return pWindow; }
void ImplSelectWithStart( Menu* pStartMenu = NULL );
protected:
@@ -238,135 +230,157 @@ protected:
Menu();
public:
- virtual ~Menu();
-
- void Activate();
- void Deactivate();
- virtual void Highlight();
- virtual void Select();
-
- void InsertItem( sal_uInt16 nItemId, const OUString& rStr,
- MenuItemBits nItemBits = MenuItemBits::NONE,
- const OString &rIdent = OString(),
- sal_uInt16 nPos = MENU_APPEND );
- void InsertItem( sal_uInt16 nItemId, const Image& rImage,
- MenuItemBits nItemBits = MenuItemBits::NONE,
- const OString &rIdent = OString(),
- sal_uInt16 nPos = MENU_APPEND );
- void InsertItem( sal_uInt16 nItemId,
- const OUString& rString, const Image& rImage,
- MenuItemBits nItemBits = MenuItemBits::NONE,
- const OString &rIdent = OString(),
- sal_uInt16 nPos = MENU_APPEND );
- void InsertItem( const ResId& rResId, sal_uInt16 nPos = MENU_APPEND );
- void InsertSeparator( const OString &rIdent = OString(),
- sal_uInt16 nPos = MENU_APPEND );
- void RemoveItem( sal_uInt16 nPos );
- void CopyItem( const Menu& rMenu, sal_uInt16 nPos,
- sal_uInt16 nNewPos = MENU_APPEND );
- void Clear();
-
- void CreateAutoMnemonics();
-
- void SetMenuFlags( MenuFlags nFlags ) { nMenuFlags = nFlags; }
- MenuFlags GetMenuFlags() const { return nMenuFlags; }
-
- sal_uInt16 GetItemCount() const;
- sal_uInt16 GetItemId(sal_uInt16 nPos) const;
- sal_uInt16 GetItemId(const OString &rIdent) const;
- sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
- OString GetItemIdent(sal_uInt16 nItemId) const;
- MenuItemType GetItemType( sal_uInt16 nPos ) const;
- sal_uInt16 GetCurItemId() const { return nSelectedId;}
- OString GetCurItemIdent() const;
-
- void SetDefaultItem( sal_uInt16 nItemId ) { nDefaultItem = nItemId; }
- sal_uInt16 GetDefaultItem() const { return nDefaultItem; }
-
- void SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits );
- MenuItemBits GetItemBits( sal_uInt16 nItemId ) const;
-
- void SetUserValue(sal_uInt16 nItemId, sal_uLong nValue, MenuUserDataReleaseFunction aFunc=0);
- sal_uLong GetUserValue(sal_uInt16 nItemId) const;
-
- void SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu );
- PopupMenu* GetPopupMenu( sal_uInt16 nItemId ) const;
-
- void SetAccelKey( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode );
- vcl::KeyCode GetAccelKey( sal_uInt16 nItemId ) const;
-
- void CheckItem( sal_uInt16 nItemId, bool bCheck = true );
- bool IsItemChecked( sal_uInt16 nItemId ) const;
-
- virtual void SelectItem(sal_uInt16 nItemId) = 0;
- void DeSelect() { SelectItem( 0xFFFF ); } // MENUITEMPOS_INVALID
-
- void EnableItem( sal_uInt16 nItemId, bool bEnable = true );
- void EnableItem(const OString &rIdent, bool bEnable = true)
+ virtual ~Menu();
+
+ void Activate();
+ void Deactivate();
+ virtual void Highlight();
+ virtual void Select();
+
+ void InsertItem(sal_uInt16 nItemId, const OUString& rStr,
+ MenuItemBits nItemBits = MenuItemBits::NONE,
+ const OString &rIdent = OString(),
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertItem(sal_uInt16 nItemId, const Image& rImage,
+ MenuItemBits nItemBits = MenuItemBits::NONE,
+ const OString &rIdent = OString(),
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertItem(sal_uInt16 nItemId,
+ const OUString& rString, const Image& rImage,
+ MenuItemBits nItemBits = MenuItemBits::NONE,
+ const OString &rIdent = OString(),
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertItem(const ResId& rResId, sal_uInt16 nPos = MENU_APPEND );
+ void InsertSeparator(const OString &rIdent = OString(), sal_uInt16 nPos = MENU_APPEND);
+ void RemoveItem( sal_uInt16 nPos );
+ void CopyItem(const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 nNewPos = MENU_APPEND );
+ void Clear();
+
+ void CreateAutoMnemonics();
+
+ void SetMenuFlags( MenuFlags nFlags ) { nMenuFlags = nFlags; }
+ MenuFlags GetMenuFlags() const { return nMenuFlags; }
+
+ sal_uInt16 GetItemCount() const;
+ sal_uInt16 GetItemId(sal_uInt16 nPos) const;
+ sal_uInt16 GetItemId(const OString &rIdent) const;
+ sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
+ OString GetItemIdent(sal_uInt16 nItemId) const;
+ MenuItemType GetItemType( sal_uInt16 nPos ) const;
+ sal_uInt16 GetCurItemId() const { return nSelectedId;}
+ OString GetCurItemIdent() const;
+
+ void SetDefaultItem( sal_uInt16 nItemId ) { nDefaultItem = nItemId; }
+ sal_uInt16 GetDefaultItem() const { return nDefaultItem; }
+
+ void SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits );
+ MenuItemBits GetItemBits( sal_uInt16 nItemId ) const;
+
+ void SetUserValue(sal_uInt16 nItemId, sal_uLong nValue, MenuUserDataReleaseFunction aFunc=0);
+ sal_uLong GetUserValue(sal_uInt16 nItemId) const;
+
+ void SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu );
+ PopupMenu* GetPopupMenu( sal_uInt16 nItemId ) const;
+
+ void SetAccelKey( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode );
+ vcl::KeyCode GetAccelKey( sal_uInt16 nItemId ) const;
+
+ void CheckItem( sal_uInt16 nItemId, bool bCheck = true );
+ bool IsItemChecked( sal_uInt16 nItemId ) const;
+
+ virtual void SelectItem(sal_uInt16 nItemId) = 0;
+ void DeSelect() { SelectItem( 0xFFFF ); } // MENUITEMPOS_INVALID
+
+ void EnableItem( sal_uInt16 nItemId, bool bEnable = true );
+ void EnableItem(const OString &rIdent, bool bEnable = true)
{
EnableItem(GetItemId(rIdent), bEnable);
}
- bool IsItemEnabled( sal_uInt16 nItemId ) const;
+ bool IsItemEnabled( sal_uInt16 nItemId ) const;
- void ShowItem( sal_uInt16 nItemId, bool bVisible = true );
- void HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, false ); }
+ void ShowItem( sal_uInt16 nItemId, bool bVisible = true );
+ void HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, false ); }
- bool IsItemPosVisible( sal_uInt16 nItemPos ) const;
- bool IsMenuVisible() const;
- virtual bool IsMenuBar() const = 0;
+ bool IsItemPosVisible( sal_uInt16 nItemPos ) const;
+ bool IsMenuVisible() const;
+ virtual bool IsMenuBar() const = 0;
- void RemoveDisabledEntries( bool bCheckPopups = true, bool bRemoveEmptyPopups = false );
- bool HasValidEntries( bool bCheckPopups = true );
+ void RemoveDisabledEntries( bool bCheckPopups = true, bool bRemoveEmptyPopups = false );
+ bool HasValidEntries( bool bCheckPopups = true );
- void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
- OUString GetItemText( sal_uInt16 nItemId ) const;
+ void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetItemText( sal_uInt16 nItemId ) const;
- void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
- Image GetItemImage( sal_uInt16 nItemId ) const;
- void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
- void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror );
+ void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
+ Image GetItemImage( sal_uInt16 nItemId ) const;
+ void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
+ void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror );
- void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
- OUString GetItemCommand( sal_uInt16 nItemId ) const;
+ void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
+ OUString GetItemCommand( sal_uInt16 nItemId ) const;
- void SetHelpText( sal_uInt16 nItemId, const OUString& rString );
- OUString GetHelpText( sal_uInt16 nItemId ) const;
+ void SetHelpText( sal_uInt16 nItemId, const OUString& rString );
+ OUString GetHelpText( sal_uInt16 nItemId ) const;
- void SetTipHelpText( sal_uInt16 nItemId, const OUString& rString );
- OUString GetTipHelpText( sal_uInt16 nItemId ) const;
+ void SetTipHelpText( sal_uInt16 nItemId, const OUString& rString );
+ OUString GetTipHelpText( sal_uInt16 nItemId ) const;
- void SetHelpCommand( sal_uInt16 nItemId, const OUString& rString );
- OUString GetHelpCommand( sal_uInt16 nItemId ) const;
+ void SetHelpCommand( sal_uInt16 nItemId, const OUString& rString );
+ OUString GetHelpCommand( sal_uInt16 nItemId ) const;
- void SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
- OString GetHelpId( sal_uInt16 nItemId ) const;
+ void SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
+ OString GetHelpId( sal_uInt16 nItemId ) const;
- void SetActivateHdl( const Link<Menu *, bool>& rLink ) { aActivateHdl = rLink; }
+ void SetActivateHdl( const Link<Menu *, bool>& rLink )
+ {
+ aActivateHdl = rLink;
+ }
- void SetDeactivateHdl( const Link<Menu *, bool>& rLink ) { aDeactivateHdl = rLink; }
+ void SetDeactivateHdl( const Link<Menu *, bool>& rLink )
+ {
+ aDeactivateHdl = rLink;
+ }
- void SetHighlightHdl( const Link<Menu *, bool>& rLink ) { aHighlightHdl = rLink; }
+ void SetHighlightHdl( const Link<Menu *, bool>& rLink )
+ {
+ aHighlightHdl = rLink;
+ }
- void SetSelectHdl( const Link<>& rLink ) { aSelectHdl = rLink; }
- const Link<>& GetSelectHdl() const { return aSelectHdl; }
+ void SetSelectHdl( const Link<>& rLink )
+ {
+ aSelectHdl = rLink;
+ }
+ const Link<>& GetSelectHdl() const
+ {
+ return aSelectHdl;
+ }
- bool HasLogo() const { return pLogo != nullptr; }
+ bool HasLogo() const
+ {
+ return pLogo != nullptr;
+ }
- sal_uInt16 GetTitleHeight() { return nTitleHeight; }
+ sal_uInt16 GetTitleHeight()
+ {
+ return nTitleHeight;
+ }
- void AddEventListener( const Link<>& rEventListener );
- void RemoveEventListener( const Link<>& rEventListener );
- void AddChildEventListener( const Link<>& rEventListener );
- void RemoveChildEventListener( const Link<>& rEventListener );
+ void AddEventListener( const Link<>& rEventListener );
+ void RemoveEventListener( const Link<>& rEventListener );
+ void AddChildEventListener( const Link<>& rEventListener );
+ void RemoveChildEventListener( const Link<>& rEventListener );
- Menu& operator =( const Menu& rMenu );
+ Menu& operator =( const Menu& rMenu );
// Fuer Menu-'Funktionen'
- MenuItemList* GetItemList() const { return pItemList; }
+ MenuItemList* GetItemList() const
+ {
+ return pItemList;
+ }
// returns the system's menu handle if native menus are supported
// pData must point to a SystemMenuData structure
- bool GetSystemMenuData( SystemMenuData* pData ) const;
+ bool GetSystemMenuData( SystemMenuData* pData ) const;
// accessibility helpers
@@ -380,46 +394,41 @@ public:
// returns the bounding rectangle for an item at pos nItemPos
Rectangle GetBoundingRectangle( sal_uInt16 nItemPos ) const;
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible();
- void SetAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible );
+ css::uno::Reference<css::accessibility::XAccessible> GetAccessible();
+ void SetAccessible(const css::uno::Reference<css::accessibility::XAccessible >& rxAccessible);
// gets the activation key of the specified item
- KeyEvent GetActivationKey( sal_uInt16 nItemId ) const;
+ KeyEvent GetActivationKey( sal_uInt16 nItemId ) const;
- vcl::Window* GetWindow() const { return pWindow; }
+ vcl::Window* GetWindow() const { return pWindow; }
- void SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr );
- OUString GetAccessibleName( sal_uInt16 nItemId ) const;
+ void SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetAccessibleName( sal_uInt16 nItemId ) const;
// returns whether the item a position nItemPos is highlighted or not.
- bool IsHighlighted( sal_uInt16 nItemPos ) const;
+ bool IsHighlighted( sal_uInt16 nItemPos ) const;
- void HighlightItem( sal_uInt16 nItemPos );
- void DeHighlight() { HighlightItem( 0xFFFF ); } // MENUITEMPOS_INVALID
+ void HighlightItem( sal_uInt16 nItemPos );
+ void DeHighlight() { HighlightItem( 0xFFFF ); } // MENUITEMPOS_INVALID
};
-namespace vcl
-{
- namespace MenuInvalidator
- {
- VCL_DLLPUBLIC VclEventListeners2* GetMenuInvalidateListeners();
- VCL_DLLPUBLIC void Invalidated();
- };
-}
+namespace vcl { namespace MenuInvalidator {
-// - MenuBar -
+VCL_DLLPUBLIC VclEventListeners2* GetMenuInvalidateListeners();
+VCL_DLLPUBLIC void Invalidated();
+}}
class VCL_DLLPUBLIC MenuBar : public Menu
{
- Link<> maCloseHdl;
- Link<> maFloatHdl;
- Link<> maHideHdl;
- bool mbCloseBtnVisible;
- bool mbFloatBtnVisible;
- bool mbHideBtnVisible;
- bool mbDisplayable;
+ Link<> maCloseHdl;
+ Link<> maFloatHdl;
+ Link<> maHideHdl;
+ bool mbCloseBtnVisible : 1;
+ bool mbFloatBtnVisible : 1;
+ bool mbHideBtnVisible : 1;
+ bool mbDisplayable : 1;
friend class Application;
friend class Menu;
@@ -427,9 +436,10 @@ class VCL_DLLPUBLIC MenuBar : public Menu
friend class MenuFloatingWindow;
friend class SystemWindow;
- SAL_DLLPRIVATE static vcl::Window* ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu, const css::uno::Reference<css::frame::XFrame> &rFrame);
- SAL_DLLPRIVATE static void ImplDestroy( MenuBar* pMenu, bool bDelete );
- SAL_DLLPRIVATE bool ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu = true );
+ SAL_DLLPRIVATE static vcl::Window* ImplCreate(vcl::Window* pParent, vcl::Window* pWindow,
+ MenuBar* pMenu, const css::uno::Reference<css::frame::XFrame> &rFrame);
+ SAL_DLLPRIVATE static void ImplDestroy(MenuBar* pMenu, bool bDelete);
+ SAL_DLLPRIVATE bool ImplHandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true);
protected:
@@ -437,13 +447,13 @@ protected:
IMenuBarWindow* getMenuBarWindow();
public:
- MenuBar();
- MenuBar( const MenuBar& rMenu );
- virtual ~MenuBar();
+ MenuBar();
+ MenuBar( const MenuBar& rMenu );
+ virtual ~MenuBar();
- MenuBar& operator =( const MenuBar& rMenu );
+ MenuBar& operator =( const MenuBar& rMenu );
- virtual bool IsMenuBar() const SAL_OVERRIDE { return true; }
+ virtual bool IsMenuBar() const SAL_OVERRIDE { return true; }
/// Close the 'pStartedFrom' menu window.
virtual void ClosePopup(Menu* pMenu) SAL_OVERRIDE;
@@ -454,65 +464,60 @@ public:
/// Forward the KeyInput call to the MenuBar.
virtual void MenuBarKeyInput(const KeyEvent& rEvent) SAL_OVERRIDE;
- void ShowCloseButton( bool bShow = true );
- bool HasCloseButton() const { return mbCloseBtnVisible; }
- bool HasFloatButton() const { return mbFloatBtnVisible; }
- bool HasHideButton() const { return mbHideBtnVisible; }
- void ShowButtons( bool bClose, bool bFloat, bool bHide );
-
- virtual void SelectItem(sal_uInt16 nId) SAL_OVERRIDE;
- bool HandleMenuActivateEvent(Menu *pMenu) const;
- bool HandleMenuDeActivateEvent(Menu *pMenu) const;
- bool HandleMenuHighlightEvent(Menu *pMenu, sal_uInt16 nEventId) const;
- bool HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const;
- bool HandleMenuButtonEvent(Menu *pMenu, sal_uInt16 nEventId);
-
- void SetCloseButtonClickHdl( const Link<>& rLink ) { maCloseHdl = rLink; }
- const Link<>& GetCloseButtonClickHdl() const { return maCloseHdl; }
- void SetFloatButtonClickHdl( const Link<>& rLink ) { maFloatHdl = rLink; }
- const Link<>& GetFloatButtonClickHdl() const { return maFloatHdl; }
- void SetHideButtonClickHdl( const Link<>& rLink ) { maHideHdl = rLink; }
- const Link<>& GetHideButtonClickHdl() const { return maHideHdl; }
+ void ShowCloseButton( bool bShow = true );
+ bool HasCloseButton() const { return mbCloseBtnVisible; }
+ bool HasFloatButton() const { return mbFloatBtnVisible; }
+ bool HasHideButton() const { return mbHideBtnVisible; }
+ void ShowButtons( bool bClose, bool bFloat, bool bHide );
+
+ virtual void SelectItem(sal_uInt16 nId) SAL_OVERRIDE;
+ bool HandleMenuActivateEvent(Menu *pMenu) const;
+ bool HandleMenuDeActivateEvent(Menu *pMenu) const;
+ bool HandleMenuHighlightEvent(Menu *pMenu, sal_uInt16 nEventId) const;
+ bool HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const;
+ bool HandleMenuButtonEvent(Menu *pMenu, sal_uInt16 nEventId);
+
+ void SetCloseButtonClickHdl( const Link<>& rLink ) { maCloseHdl = rLink; }
+ const Link<>& GetCloseButtonClickHdl() const { return maCloseHdl; }
+ void SetFloatButtonClickHdl( const Link<>& rLink ) { maFloatHdl = rLink; }
+ const Link<>& GetFloatButtonClickHdl() const { return maFloatHdl; }
+ void SetHideButtonClickHdl( const Link<>& rLink ) { maHideHdl = rLink; }
+ const Link<>& GetHideButtonClickHdl() const { return maHideHdl; }
// - by default a menubar is displayable
// - if a menubar is not displayable, its MenuBarWindow will never be shown
// and it will be hidden if it was visible before
// - note: if a menubar is diplayable, this does not necessarily mean that it is currently visible
- void SetDisplayable( bool bDisplayable );
- bool IsDisplayable() const { return mbDisplayable; }
+ void SetDisplayable( bool bDisplayable );
+ bool IsDisplayable() const { return mbDisplayable; }
struct MenuBarButtonCallbackArg
{
- sal_uInt16 nId; // Id of the button
- bool bHighlight; // highlight on/off
- MenuBar* pMenuBar; // menubar the button belongs to
+ sal_uInt16 nId; // Id of the button
+ bool bHighlight; // highlight on/off
+ MenuBar* pMenuBar; // menubar the button belongs to
};
// add an arbitrary button to the menubar (will appear next to closer)
// passed link will be call with a MenuBarButtonCallbackArg on press
// passed string will be set as tooltip
- sal_uInt16 AddMenuBarButton( const Image&, const Link<>&, const OUString&, sal_uInt16 nPos = 0 );
+ sal_uInt16 AddMenuBarButton( const Image&, const Link<>&, const OUString&, sal_uInt16 nPos = 0 );
// set the highlight link for additional button with ID nId
// highlight link will be called with a MenuBarButtonHighlightArg
// the bHighlight member of that struct shall contain the new state
- void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& );
+ void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& );
// returns the rectangle occupied by the additional button named nId
// coordinates are relative to the systemwindiow the menubar is attached to
// if the menubar is unattached an empty rectangle is returned
- Rectangle GetMenuBarButtonRectPixel( sal_uInt16 nId );
- void RemoveMenuBarButton( sal_uInt16 nId );
+ Rectangle GetMenuBarButtonRectPixel( sal_uInt16 nId );
+ void RemoveMenuBarButton( sal_uInt16 nId );
};
-inline MenuBar& MenuBar::operator =( const MenuBar& rMenu )
+inline MenuBar& MenuBar::operator=( const MenuBar& rMenu )
{
- Menu::operator =( rMenu );
+ Menu::operator=(rMenu);
return *this;
}
-
-
-// - PopupMenu -
-
-
class VCL_DLLPUBLIC PopupMenu : public Menu
{
friend class Menu;
@@ -521,46 +526,52 @@ class VCL_DLLPUBLIC PopupMenu : public Menu
friend struct MenuItemData;
private:
- Menu** pRefAutoSubMenu; // keeps track if a pointer to this Menu is stored in the MenuItemData
+ Menu** pRefAutoSubMenu; // keeps track if a pointer to this Menu is stored in the MenuItemData
SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
protected:
- SAL_DLLPRIVATE sal_uInt16 ImplExecute( vcl::Window* pWindow, const Rectangle& rRect, FloatWinPopupFlags nPopupFlags, Menu* pStaredFrom, bool bPreSelectFirst );
- SAL_DLLPRIVATE long ImplCalcHeight( sal_uInt16 nEntries ) const;
- SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( long nMaxHeight, sal_uInt16 nStartEntry = 0, sal_uInt16* pLastVisible = NULL ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplExecute( vcl::Window* pWindow, const Rectangle& rRect, FloatWinPopupFlags nPopupFlags, Menu* pStaredFrom, bool bPreSelectFirst );
+ SAL_DLLPRIVATE long ImplCalcHeight( sal_uInt16 nEntries ) const;
+ SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( long nMaxHeight, sal_uInt16 nStartEntry = 0, sal_uInt16* pLastVisible = NULL ) const;
public:
- PopupMenu();
- PopupMenu( const PopupMenu& rMenu );
- explicit PopupMenu( const ResId& );
- virtual ~PopupMenu();
+ PopupMenu();
+ PopupMenu( const PopupMenu& rMenu );
+ explicit PopupMenu( const ResId& );
+ virtual ~PopupMenu();
- virtual bool IsMenuBar() const SAL_OVERRIDE { return false; }
+ virtual bool IsMenuBar() const SAL_OVERRIDE { return false; }
/// Close the 'pStartedFrom' menu window.
virtual void ClosePopup(Menu* pMenu) SAL_OVERRIDE;
- void SetText( const OUString& rTitle ) { aTitleText = rTitle; }
- const OUString& GetText() const { return aTitleText; }
+ void SetText( const OUString& rTitle )
+ {
+ aTitleText = rTitle;
+ }
+ const OUString& GetText() const
+ {
+ return aTitleText;
+ }
- sal_uInt16 Execute( vcl::Window* pWindow, const Point& rPopupPos );
- sal_uInt16 Execute( vcl::Window* pWindow, const Rectangle& rRect, PopupMenuFlags nFlags = PopupMenuFlags::NONE );
+ sal_uInt16 Execute( vcl::Window* pWindow, const Point& rPopupPos );
+ sal_uInt16 Execute( vcl::Window* pWindow, const Rectangle& rRect, PopupMenuFlags nFlags = PopupMenuFlags::NONE );
// Fuer das TestTool
- void EndExecute( sal_uInt16 nSelect = 0 );
- virtual void SelectItem(sal_uInt16 nId) SAL_OVERRIDE;
- void SetSelectedEntry( sal_uInt16 nId ); // for use by native submenu only
+ void EndExecute( sal_uInt16 nSelect = 0 );
+ virtual void SelectItem(sal_uInt16 nId) SAL_OVERRIDE;
+ void SetSelectedEntry( sal_uInt16 nId ); // for use by native submenu only
- static bool IsInExecute();
- static PopupMenu* GetActivePopupMenu();
+ static bool IsInExecute();
+ static PopupMenu* GetActivePopupMenu();
- PopupMenu& operator =( const PopupMenu& rMenu );
+ PopupMenu& operator=( const PopupMenu& rMenu );
};
-inline PopupMenu& PopupMenu::operator =( const PopupMenu& rMenu )
+inline PopupMenu& PopupMenu::operator=( const PopupMenu& rMenu )
{
- Menu::operator =( rMenu );
+ Menu::operator=( rMenu );
return *this;
}
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 1fc1a38..0f600bc 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1365,7 +1365,7 @@ bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const
return bSelectable;
}
-::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > Menu::GetAccessible()
+css::uno::Reference<css::accessibility::XAccessible> Menu::GetAccessible()
{
// Since PopupMenu are sometimes shared by different instances of MenuBar, the mxAccessible member gets
// overwritten and may contain a disposed object when the initial menubar gets set again. So use the
@@ -1377,11 +1377,11 @@ bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const
sal_uInt16 nItemId = pStartedFrom->GetItemId( i );
if ( static_cast< Menu* >( pStartedFrom->GetPopupMenu( nItemId ) ) == this )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xParent = pStartedFrom->GetAccessible();
+ css::uno::Reference<css::accessibility::XAccessible> xParent = pStartedFrom->GetAccessible();
if ( xParent.is() )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
- if ( xParentContext.is() )
+ css::uno::Reference<css::accessibility::XAccessibleContext> xParentContext( xParent->getAccessibleContext() );
+ if (xParentContext.is())
return xParentContext->getAccessibleChild( i );
}
}
@@ -1397,12 +1397,12 @@ bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const
return mxAccessible;
}
-void Menu::SetAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible )
+void Menu::SetAccessible(const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible )
{
mxAccessible = rxAccessible;
}
-Size Menu::ImplGetNativeCheckAndRadioSize( const vcl::Window* pWin, long& rCheckHeight, long& rRadioHeight ) const
+Size Menu::ImplGetNativeCheckAndRadioSize(vcl::RenderContext& rRenderContext, long& rCheckHeight, long& rRadioHeight ) const
{
long nCheckWidth = 0, nRadioWidth = 0;
rCheckHeight = rRadioHeight = 0;
@@ -1412,35 +1412,23 @@ Size Menu::ImplGetNativeCheckAndRadioSize( const vcl::Window* pWin, long& rCheck
ImplControlValue aVal;
Rectangle aNativeBounds;
Rectangle aNativeContent;
- Point tmp( 0, 0 );
- Rectangle aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) );
- if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) )
+
+ Rectangle aCtrlRegion(Rectangle(Point(), Size(100, 15)));
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK))
{
- if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP),
- ControlPart(PART_MENU_ITEM_CHECK_MARK),
- aCtrlRegion,
- ControlState(ControlState::ENABLED),
- aVal,
- OUString(),
- aNativeBounds,
- aNativeContent )
- )
+ if (rRenderContext.GetNativeControlRegion(ControlType(CTRL_MENU_POPUP), ControlPart(PART_MENU_ITEM_CHECK_MARK),
+ aCtrlRegion, ControlState(ControlState::ENABLED), aVal, OUString(),
+ aNativeBounds, aNativeContent))
{
rCheckHeight = aNativeBounds.GetHeight();
nCheckWidth = aNativeContent.GetWidth();
}
}
- if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) )
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK))
{
- if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP),
- ControlPart(PART_MENU_ITEM_RADIO_MARK),
- aCtrlRegion,
- ControlState(ControlState::ENABLED),
- aVal,
- OUString(),
- aNativeBounds,
- aNativeContent )
- )
+ if (rRenderContext.GetNativeControlRegion(ControlType(CTRL_MENU_POPUP), ControlPart(PART_MENU_ITEM_RADIO_MARK),
+ aCtrlRegion, ControlState(ControlState::ENABLED), aVal, OUString(),
+ aNativeBounds, aNativeContent))
{
rRadioHeight = aNativeBounds.GetHeight();
nRadioWidth = aNativeContent.GetWidth();
@@ -1450,34 +1438,24 @@ Size Menu::ImplGetNativeCheckAndRadioSize( const vcl::Window* pWin, long& rCheck
return Size(std::max(nCheckWidth, nRadioWidth), std::max(rCheckHeight, rRadioHeight));
}
-bool Menu::ImplGetNativeSubmenuArrowSize( vcl::Window* pWin, Size& rArrowSize, long& rArrowSpacing ) const
+bool Menu::ImplGetNativeSubmenuArrowSize(vcl::RenderContext& rRenderContext, Size& rArrowSize, long& rArrowSpacing) const
{
ImplControlValue aVal;
Rectangle aNativeBounds;
Rectangle aNativeContent;
- Point tmp( 0, 0 );
- Rectangle aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) );
- if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP,
- PART_MENU_SUBMENU_ARROW ) )
+ Rectangle aCtrlRegion(Rectangle(Point(), Size(100, 15)));
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_SUBMENU_ARROW))
+ {
+ if (rRenderContext.GetNativeControlRegion(ControlType(CTRL_MENU_POPUP), ControlPart(PART_MENU_SUBMENU_ARROW),
+ aCtrlRegion, ControlState(ControlState::ENABLED),
+ aVal, OUString(), aNativeBounds, aNativeContent))
{
- if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP),
- ControlPart(PART_MENU_SUBMENU_ARROW),
- aCtrlRegion,
- ControlState(ControlState::ENABLED),
- aVal,
- OUString(),
- aNativeBounds,
- aNativeContent )
- )
- {
- Size aSize( Size ( aNativeContent.GetWidth(),
- aNativeContent.GetHeight() ) );
- rArrowSize = aSize;
- rArrowSpacing = aNativeBounds.GetWidth() - aNativeContent.GetWidth();
-
- return true;
- }
+ Size aSize(aNativeContent.GetWidth(), aNativeContent.GetHeight());
+ rArrowSize = aSize;
+ rArrowSpacing = aNativeBounds.GetWidth() - aNativeContent.GetWidth();
+ return true;
}
+ }
return false;
}
@@ -1521,7 +1499,7 @@ Size Menu::ImplCalcSize( vcl::Window* pWin )
long nMinMenuItemHeight = nFontHeight;
long nCheckHeight = 0, nRadioHeight = 0;
- Size aMaxSize = ImplGetNativeCheckAndRadioSize(pWin, nCheckHeight, nRadioHeight);
+ Size aMaxSize = ImplGetNativeCheckAndRadioSize(*pWin, nCheckHeight, nRadioHeight); // FIXME
if( aMaxSize.Height() > nMinMenuItemHeight )
nMinMenuItemHeight = aMaxSize.Height();
@@ -1739,39 +1717,39 @@ Size Menu::ImplCalcSize( vcl::Window* pWin )
return aSz;
}
-static void ImplPaintCheckBackground( vcl::Window* i_pWindow, const Rectangle& i_rRect, bool i_bHighlight )
+static void ImplPaintCheckBackground(vcl::RenderContext& rRenderContext, vcl::Window& rWindow, const Rectangle& i_rRect, bool i_bHighlight)
{
bool bNativeOk = false;
- if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
+ if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_BUTTON))
{
ImplControlValue aControlValue;
Rectangle aCtrlRegion( i_rRect );
ControlState nState = ControlState::PRESSED | ControlState::ENABLED;
- aControlValue.setTristateVal( BUTTONVALUE_ON );
+ aControlValue.setTristateVal(BUTTONVALUE_ON);
- bNativeOk = i_pWindow->DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON,
- aCtrlRegion, nState, aControlValue,
- OUString() );
+ bNativeOk = rRenderContext.DrawNativeControl(CTRL_TOOLBAR, PART_BUTTON,
+ aCtrlRegion, nState, aControlValue,
+ OUString());
}
- if( ! bNativeOk )
+ if (!bNativeOk)
{
- const StyleSettings& rSettings = i_pWindow->GetSettings().GetStyleSettings();
+ const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings();
Color aColor( i_bHighlight ? rSettings.GetMenuHighlightTextColor() : rSettings.GetHighlightColor() );
- i_pWindow->DrawSelectionBackground( i_rRect, 0, i_bHighlight, true, false, 2, NULL, &aColor );
+ RenderTools::DrawSelectionBackground(rRenderContext, rWindow, i_rRect, 0, i_bHighlight, true, false, NULL, 2, &aColor);
}
}
-static OUString getShortenedString( const OUString& i_rLong, vcl::Window* i_pWin, long i_nMaxWidth )
+static OUString getShortenedString( const OUString& i_rLong, vcl::RenderContext& rRenderContext, long i_nMaxWidth )
{
sal_Int32 nPos = -1;
- OUString aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) );
- aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS );
+ OUString aNonMnem(OutputDevice::GetNonMnemonicString(i_rLong, nPos));
+ aNonMnem = rRenderContext.GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS);
// re-insert mnemonic
- if( nPos != -1 )
+ if (nPos != -1)
{
- if( nPos < aNonMnem.getLength() && i_rLong[nPos+1] == aNonMnem[nPos] )
+ if (nPos < aNonMnem.getLength() && i_rLong[nPos+1] == aNonMnem[nPos])
{
OUStringBuffer aBuf( i_rLong.getLength() );
aBuf.append( aNonMnem.copy( 0, nPos) );
@@ -1815,22 +1793,23 @@ void Menu::ImplPaintMenuTitle(vcl::RenderContext& rRenderContext, const Rectangl
rRenderContext.Pop();
}
-void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemData* pThisItemOnly,
+void Menu::ImplPaint(vcl::RenderContext& rRenderContext,
+ sal_uInt16 nBorder, long nStartY, MenuItemData* pThisItemOnly,
bool bHighlighted, bool bLayout, bool bRollover) const
{
// for symbols: nFontHeight x nFontHeight
- long nFontHeight = pWin->GetTextHeight();
+ long nFontHeight = rRenderContext.GetTextHeight();
long nExtra = nFontHeight / 4;
long nCheckHeight = 0, nRadioHeight = 0;
- ImplGetNativeCheckAndRadioSize( pWin, nCheckHeight, nRadioHeight );
+ ImplGetNativeCheckAndRadioSize(rRenderContext, nCheckHeight, nRadioHeight);
- DecorationView aDecoView( pWin );
- const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings();
+ DecorationView aDecoView(&rRenderContext);
+ const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings();
Point aTopLeft, aTmpPos;
- if ( pLogo )
+ if (pLogo)
aTopLeft.X() = pLogo->aBitmap.GetSizePixel().Width();
int nOuterSpaceX = 0;
@@ -1841,54 +1820,54 @@ void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuIt
aTopLeft.Y() += ImplGetSVData()->maNWFData.mnMenuFormatBorderY;
}
- Size aOutSz = pWin->GetOutputSizePixel();
+ Size aOutSz = rRenderContext.GetOutputSizePixel();
size_t nCount = pItemList->size();
- if( bLayout )
+ if (bLayout)
mpLayoutData->m_aVisibleItemBoundRects.clear();
// Paint title
if (!pThisItemOnly && !IsMenuBar() && nTitleHeight > 0)
- ImplPaintMenuTitle(*pWin/*rRenderContext*/, Rectangle(aTopLeft, aOutSz));
+ ImplPaintMenuTitle(rRenderContext, Rectangle(aTopLeft, aOutSz));
- for ( size_t n = 0; n < nCount; n++ )
+ for (size_t n = 0; n < nCount; n++)
{
MenuItemData* pData = pItemList->GetDataFromPos( n );
- if ( ImplIsVisible( n ) && ( !pThisItemOnly || ( pData == pThisItemOnly ) ) )
+ if (ImplIsVisible(n) && (!pThisItemOnly || (pData == pThisItemOnly)))
{
- if ( pThisItemOnly )
+ if (pThisItemOnly)
{
if (IsMenuBar())
{
if (bRollover)
- pWin->SetTextColor(rSettings.GetMenuBarRolloverTextColor());
+ rRenderContext.SetTextColor(rSettings.GetMenuBarRolloverTextColor());
else if (bHighlighted)
- pWin->SetTextColor(rSettings.GetMenuBarHighlightTextColor());
+ rRenderContext.SetTextColor(rSettings.GetMenuBarHighlightTextColor());
}
else
{
if (bHighlighted)
- pWin->SetTextColor(rSettings.GetMenuHighlightTextColor());
+ rRenderContext.SetTextColor(rSettings.GetMenuHighlightTextColor());
}
}
- Point aPos( aTopLeft );
+ Point aPos(aTopLeft);
aPos.Y() += nBorder;
aPos.Y() += nStartY;
- if ( aPos.Y() >= 0 )
+ if (aPos.Y() >= 0)
{
- long nTextOffsetY = ((pData->aSz.Height()-nFontHeight)/2);
+ long nTextOffsetY = ((pData->aSz.Height() - nFontHeight) / 2);
if (IsMenuBar())
nTextOffsetY += (aOutSz.Height()-pData->aSz.Height()) / 2;
- sal_uInt16 nTextStyle = 0;
+ sal_uInt16 nTextStyle = 0;
DrawSymbolFlags nSymbolStyle = DrawSymbolFlags::NONE;
- sal_uInt16 nImageStyle = 0;
+ sal_uInt16 nImageStyle = 0;
// submenus without items are not disabled when no items are
// contained. The application itself should check for this!
// Otherwise it could happen entries are disabled due to
// asynchronous loading
- if ( !pData->bEnabled )
+ if (!pData->bEnabled)
{
nTextStyle |= TEXT_DRAW_DISABLE;
nSymbolStyle |= DrawSymbolFlags::Disable;
@@ -1899,42 +1878,39 @@ void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuIt
if (!bLayout && !IsMenuBar() && (pData->eType == MenuItemType::SEPARATOR))
{
bool bNativeOk = false;
- if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP,
- PART_MENU_SEPARATOR ) )
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_SEPARATOR))
{
ControlState nState = ControlState::NONE;
- if ( pData->bEnabled )
+ if (pData->bEnabled)
nState |= ControlState::ENABLED;
- if ( bHighlighted )
+ if (bHighlighted)
nState |= ControlState::SELECTED;
- Size aSz( pData->aSz );
- aSz.Width() = aOutSz.Width() - 2*nOuterSpaceX;
- Rectangle aItemRect( aPos, aSz );
- MenupopupValue aVal( nTextPos-GUTTERBORDER, aItemRect );
- bNativeOk = pWin->DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_SEPARATOR,
- aItemRect,
- nState,
- aVal,
- OUString() );
+ Size aSz(pData->aSz);
+ aSz.Width() = aOutSz.Width() - 2 * nOuterSpaceX;
+ Rectangle aItemRect(aPos, aSz);
+ MenupopupValue aVal(nTextPos - GUTTERBORDER, aItemRect);
+ bNativeOk = rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_MENU_SEPARATOR,
+ aItemRect, nState, aVal, OUString());
}
- if( ! bNativeOk )
+ if (!bNativeOk)
{
- aTmpPos.Y() = aPos.Y() + ((pData->aSz.Height()-2)/2);
+ aTmpPos.Y() = aPos.Y() + ((pData->aSz.Height() - 2) / 2);
aTmpPos.X() = aPos.X() + 2 + nOuterSpaceX;
- pWin->SetLineColor( rSettings.GetShadowColor() );
- pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpaceX, aTmpPos.Y() ) );
+ rRenderContext.SetLineColor(rSettings.GetShadowColor());
+ rRenderContext.DrawLine(aTmpPos, Point(aOutSz.Width() - 3 - 2 * nOuterSpaceX, aTmpPos.Y()));
aTmpPos.Y()++;
- pWin->SetLineColor( rSettings.GetLightColor() );
- pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpaceX, aTmpPos.Y() ) );
- pWin->SetLineColor();
+ rRenderContext.SetLineColor(rSettings.GetLightColor());
+ rRenderContext.DrawLine(aTmpPos, Point(aOutSz.Width() - 3 - 2 * nOuterSpaceX, aTmpPos.Y()));
+ rRenderContext.SetLineColor();
}
}
- Rectangle aOuterCheckRect( Point( aPos.X()+nImgOrChkPos, aPos.Y() ), Size( pData->aSz.Height(), pData->aSz.Height() ) );
- aOuterCheckRect.Left() += 1;
- aOuterCheckRect.Right() -= 1;
- aOuterCheckRect.Top() += 1;
- aOuterCheckRect.Bottom() -= 1;
+ Rectangle aOuterCheckRect(Point(aPos.X()+nImgOrChkPos, aPos.Y()),
+ Size(pData->aSz.Height(), pData->aSz.Height()));
+ aOuterCheckRect.Left() += 1;
+ aOuterCheckRect.Right() -= 1;
+ aOuterCheckRect.Top() += 1;
+ aOuterCheckRect.Bottom() -= 1;
// CheckMark
if (!bLayout && !IsMenuBar() && pData->HasCheck())
@@ -1945,12 +1921,12 @@ void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuIt
// however do not do this if native checks will be painted since
// the selection color too often does not fit the theme's check and/or radio
- if( ! ( ( pData->eType == MenuItemType::IMAGE ) || ( pData->eType == MenuItemType::STRINGIMAGE ) ) )
+ if( !((pData->eType == MenuItemType::IMAGE) || (pData->eType == MenuItemType::STRINGIMAGE)))
{
- if ( pWin->IsNativeControlSupported( CTRL_MENU_POPUP,
- (pData->nBits & MenuItemBits::RADIOCHECK)
- ? PART_MENU_ITEM_CHECK_MARK
- : PART_MENU_ITEM_RADIO_MARK ) )
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP,
+ (pData->nBits & MenuItemBits::RADIOCHECK)
+ ? PART_MENU_ITEM_CHECK_MARK
+ : PART_MENU_ITEM_RADIO_MARK))
{
ControlPart nPart = ((pData->nBits & MenuItemBits::RADIOCHECK)
? PART_MENU_ITEM_RADIO_MARK
@@ -1958,50 +1934,47 @@ void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuIt
ControlState nState = ControlState::NONE;
- if ( pData->bChecked )
+ if (pData->bChecked)
nState |= ControlState::PRESSED;
- if ( pData->bEnabled )
+ if (pData->bEnabled)
nState |= ControlState::ENABLED;
- if ( bHighlighted )
+ if (bHighlighted)
nState |= ControlState::SELECTED;
long nCtrlHeight = (pData->nBits & MenuItemBits::RADIOCHECK) ? nCheckHeight : nRadioHeight;
- aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - nCtrlHeight)/2;
- aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2;
-
- Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) );
- Size aSz( pData->aSz );
- aSz.Width() = aOutSz.Width() - 2*nOuterSpaceX;
- Rectangle aItemRect( aPos, aSz );
- MenupopupValue aVal( nTextPos-GUTTERBORDER, aItemRect );
- pWin->DrawNativeControl( CTRL_MENU_POPUP, nPart,
- aCheckRect,
- nState,
- aVal,
- OUString() );
+ aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - nCtrlHeight) / 2;
+ aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight) / 2;
+
+ Rectangle aCheckRect(aTmpPos, Size(nCtrlHeight, nCtrlHeight));
+ Size aSz(pData->aSz);
+ aSz.Width() = aOutSz.Width() - 2 * nOuterSpaceX;
+ Rectangle aItemRect(aPos, aSz);
+ MenupopupValue aVal(nTextPos - GUTTERBORDER, aItemRect);
+ rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, nPart, aCheckRect,
+ nState, aVal, OUString());
}
- else if ( pData->bChecked ) // by default do nothing for unchecked items
+ else if (pData->bChecked) // by default do nothing for unchecked items
{
- ImplPaintCheckBackground( pWin, aOuterCheckRect, pThisItemOnly && bHighlighted );
+ ImplPaintCheckBackground(rRenderContext, *pWindow, aOuterCheckRect, pThisItemOnly && bHighlighted);
SymbolType eSymbol;
Size aSymbolSize;
- if ( pData->nBits & MenuItemBits::RADIOCHECK )
+ if (pData->nBits & MenuItemBits::RADIOCHECK)
{
eSymbol = SymbolType::RADIOCHECKMARK;
- aSymbolSize = Size( nFontHeight/2, nFontHeight/2 );
+ aSymbolSize = Size(nFontHeight / 2, nFontHeight / 2);
}
else
{
eSymbol = SymbolType::CHECKMARK;
- aSymbolSize = Size( (nFontHeight*25)/40, nFontHeight/2 );
+ aSymbolSize = Size((nFontHeight * 25) / 40, nFontHeight / 2);
}
- aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - aSymbolSize.Width())/2;
- aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - aSymbolSize.Height())/2;
- Rectangle aRect( aTmpPos, aSymbolSize );
- aDecoView.DrawSymbol( aRect, eSymbol, pWin->GetTextColor(), nSymbolStyle );
+ aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - aSymbolSize.Width()) / 2;
+ aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - aSymbolSize.Height()) / 2;
+ Rectangle aRect(aTmpPos, aSymbolSize);
+ aDecoView.DrawSymbol(aRect, eSymbol, rRenderContext.GetTextColor(), nSymbolStyle);
}
}
}
@@ -2010,12 +1983,12 @@ void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuIt
if (!bLayout && !IsMenuBar() && ((pData->eType == MenuItemType::IMAGE) || (pData->eType == MenuItemType::STRINGIMAGE)))
{
// Don't render an image for a check thing
- if( pData->bChecked )
- ImplPaintCheckBackground( pWin, aOuterCheckRect, pThisItemOnly && bHighlighted );
+ if (pData->bChecked)
+ ImplPaintCheckBackground(rRenderContext, *pWindow, aOuterCheckRect, pThisItemOnly && bHighlighted);
Image aImage = pData->aImage;
- sal_Int32 nScaleFactor = pWindow->GetDPIScaleFactor();
+ sal_Int32 nScaleFactor = rRenderContext.GetDPIScaleFactor();
if (nScaleFactor != 1)
{
BitmapEx aBitmap = aImage.GetBitmapEx();
@@ -2025,174 +1998,164 @@ void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuIt
aTmpPos = aOuterCheckRect.TopLeft();
aTmpPos.X() += (aOuterCheckRect.GetWidth() - aImage.GetSizePixel().Width()) / 2;
aTmpPos.Y() += (aOuterCheckRect.GetHeight() - aImage.GetSizePixel().Height()) / 2;
- pWin->DrawImage(aTmpPos, aImage, nImageStyle);
+ rRenderContext.DrawImage(aTmpPos, aImage, nImageStyle);
}
// Text:
- if ( ( pData->eType == MenuItemType::STRING ) || ( pData->eType == MenuItemType::STRINGIMAGE ) )
+ if ((pData->eType == MenuItemType::STRING ) || (pData->eType == MenuItemType::STRINGIMAGE))
{
aTmpPos.X() = aPos.X() + nTextPos;
aTmpPos.Y() = aPos.Y();
aTmpPos.Y() += nTextOffsetY;
- sal_uInt16 nStyle = nTextStyle|TEXT_DRAW_MNEMONIC;
- if ( pData->bIsTemporary )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list