2004-07-13 08:39:14 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 16:27:27 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-07-13 08:39:14 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-07-13 08:39:14 -05:00
|
|
|
*
|
2008-04-10 16:27:27 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-07-13 08:39:14 -05:00
|
|
|
*
|
2008-04-10 16:27:27 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-07-13 08:39:14 -05:00
|
|
|
*
|
2008-04-10 16:27:27 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2004-07-13 08:39:14 -05:00
|
|
|
*
|
2008-04-10 16:27:27 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2004-07-13 08:39:14 -05:00
|
|
|
*
|
2008-04-10 16:27:27 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2004-07-13 08:39:14 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 13:15:52 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
|
|
|
|
2005-07-14 04:22:32 -05:00
|
|
|
#include "taskpane/TitleBar.hxx"
|
2004-07-13 08:39:14 -05:00
|
|
|
|
|
|
|
#include "ControlContainerDescriptor.hxx"
|
2004-08-04 02:58:31 -05:00
|
|
|
#include "tools/IconCache.hxx"
|
2005-07-14 04:22:32 -05:00
|
|
|
#include "AccessibleTreeNode.hxx"
|
2004-07-13 08:39:14 -05:00
|
|
|
#include <vcl/decoview.hxx>
|
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <vcl/virdev.hxx>
|
|
|
|
#include <vos/mutex.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include "sdresid.hxx"
|
|
|
|
#include <vcl/bitmap.hxx>
|
|
|
|
#include <vcl/lineinfo.hxx>
|
|
|
|
#include <vcl/bitmapex.hxx>
|
|
|
|
#include <tools/color.hxx>
|
|
|
|
#include <svx/xdash.hxx>
|
2009-10-15 17:05:16 -05:00
|
|
|
#include <svl/itemset.hxx>
|
2004-07-13 08:39:14 -05:00
|
|
|
#include <svx/xlndsit.hxx>
|
|
|
|
#include <svx/xlineit0.hxx>
|
|
|
|
#include <svx/svdobj.hxx>
|
|
|
|
#include <svx/svdpool.hxx>
|
|
|
|
#include <svtools/colorcfg.hxx>
|
|
|
|
#include <svx/xlnclit.hxx>
|
|
|
|
#include <svx/xfillit0.hxx>
|
|
|
|
#include "res_bmp.hrc"
|
|
|
|
|
|
|
|
|
|
|
|
namespace sd { namespace toolpanel {
|
|
|
|
|
|
|
|
const int TitleBar::snIndentationWidth = 16;
|
|
|
|
|
2006-12-12 11:44:35 -06:00
|
|
|
TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eType, bool bIsExpandable)
|
2010-03-17 03:21:56 -05:00
|
|
|
: ::Window (pParent, WB_TABSTOP)
|
2006-12-12 11:44:35 -06:00
|
|
|
, TreeNode(this)
|
|
|
|
, meType(eType)
|
|
|
|
, msTitle(rsTitle)
|
|
|
|
, mbExpanded(false)
|
|
|
|
, mbFocused(false)
|
|
|
|
, mpDevice(new VirtualDevice (*this))
|
|
|
|
, mbIsExpandable (bIsExpandable)
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
|
|
|
EnableMapMode (FALSE);
|
|
|
|
|
|
|
|
SetBackground (Wallpaper());
|
|
|
|
|
|
|
|
// Change the mouse pointer shape so that it acts as a mouse over effect.
|
|
|
|
switch (meType)
|
|
|
|
{
|
|
|
|
case TBT_SUB_CONTROL_HEADLINE:
|
|
|
|
if (mbIsExpandable)
|
|
|
|
SetPointer (POINTER_REFHAND);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TitleBar::~TitleBar (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Size TitleBar::GetPreferredSize (void)
|
|
|
|
{
|
|
|
|
int nWidth = GetOutputSizePixel().Width();
|
|
|
|
Rectangle aTitleBarBox (
|
|
|
|
CalculateTitleBarBox(
|
|
|
|
CalculateTextBoundingBox(nWidth, true),
|
|
|
|
nWidth));
|
|
|
|
|
|
|
|
return aTitleBarBox.GetSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-12-12 11:44:35 -06:00
|
|
|
sal_Int32 TitleBar::GetPreferredWidth (sal_Int32 )
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
|
|
|
Rectangle aTitleBarBox (
|
|
|
|
CalculateTitleBarBox(
|
|
|
|
CalculateTextBoundingBox(0, true),
|
|
|
|
0));
|
|
|
|
return aTitleBarBox.GetWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int32 TitleBar::GetPreferredHeight (sal_Int32 nWidth)
|
|
|
|
{
|
|
|
|
Rectangle aTitleBarBox (
|
|
|
|
CalculateTitleBarBox(
|
|
|
|
CalculateTextBoundingBox(nWidth, true),
|
|
|
|
nWidth));
|
|
|
|
|
|
|
|
return aTitleBarBox.GetHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool TitleBar::IsResizable (void)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
::Window* TitleBar::GetWindow (void)
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int32 TitleBar::GetMinimumWidth (void)
|
|
|
|
{
|
|
|
|
return 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TitleBar::Paint (const Rectangle& rBoundingBox)
|
|
|
|
{
|
|
|
|
mpDevice->SetMapMode(GetMapMode());
|
|
|
|
mpDevice->SetOutputSize (GetOutputSizePixel());
|
2006-04-28 08:59:46 -05:00
|
|
|
mpDevice->SetSettings(GetSettings());
|
|
|
|
mpDevice->SetDrawMode(GetDrawMode());
|
2004-07-13 08:39:14 -05:00
|
|
|
|
|
|
|
switch (meType)
|
|
|
|
{
|
|
|
|
case TBT_SUB_CONTROL_HEADLINE:
|
|
|
|
PaintSubPanelHeadLineBar ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawOutDev (
|
|
|
|
Point(0,0),
|
|
|
|
GetOutputSizePixel(),
|
|
|
|
Point(0,0),
|
|
|
|
GetOutputSizePixel(),
|
|
|
|
*mpDevice);
|
|
|
|
|
|
|
|
::Window::Paint (rBoundingBox);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-03-23 07:03:18 -06:00
|
|
|
bool TitleBar::Expand (bool bFlag)
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
2005-03-23 07:03:18 -06:00
|
|
|
bool bExpansionStateChanged (bFlag!=IsExpanded());
|
2004-07-13 08:39:14 -05:00
|
|
|
mbExpanded = bFlag;
|
|
|
|
Invalidate ();
|
2005-03-23 07:03:18 -06:00
|
|
|
return bExpansionStateChanged;
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-03-23 07:03:18 -06:00
|
|
|
bool TitleBar::IsExpanded (void) const
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
2005-03-23 07:03:18 -06:00
|
|
|
return mbExpanded;
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
slidecopy: initial version of a "Tool Panel"
At the moment, this implementation is parallel to the existing TaskPane implementation, but on the medium term, it is
intended to replace it. No change in functionality is planned for the moment, just the panel selection is done via
a tab bar, instead of the the "jumping drawers".
Pending tasks (as known so far):
- Accessibility. No implementation at all, yet.
- showing/hiding tool panels from the "View" drop down menu
- connection to the resource framework. At the moment, de/activating panels completely bypasses the resource
framework.
- alternative implementation of the PanelDeckLayouter which mimics the old design. To be activated by default, for
the moment.
- removal of the (old, by then) TaskPane implementation. Care needs to be taken that the framework API stays
unchanged, i.e., the current ToolPanel resource must be renamed back to RightPane when RightPane is not
occupied anymore by the old implementation. Same for other resource names.
2010-03-15 07:53:19 -05:00
|
|
|
void TitleBar::SetEnabledState(bool bFlag)
|
|
|
|
{
|
|
|
|
if(bFlag)
|
|
|
|
Enable();
|
|
|
|
else
|
|
|
|
Disable();
|
|
|
|
Invalidate ();
|
|
|
|
}
|
2004-07-13 08:39:14 -05:00
|
|
|
|
|
|
|
|
2010-03-17 03:21:56 -05:00
|
|
|
|
|
|
|
|
|
|
|
void TitleBar::GetFocus()
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
2010-03-17 03:21:56 -05:00
|
|
|
mbFocused = true;
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TitleBar::LoseFocus()
|
|
|
|
{
|
|
|
|
mbFocused = false;
|
|
|
|
Invalidate();
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-08-04 02:58:31 -05:00
|
|
|
bool TitleBar::HasExpansionIndicator (void) const
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
2004-08-04 02:58:31 -05:00
|
|
|
bool bHasExpansionIndicator (false);
|
|
|
|
if (mbIsExpandable)
|
|
|
|
{
|
|
|
|
switch (meType)
|
|
|
|
{
|
|
|
|
case TBT_SUB_CONTROL_HEADLINE:
|
|
|
|
bHasExpansionIndicator = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bHasExpansionIndicator;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Image TitleBar::GetExpansionIndicator (void) const
|
|
|
|
{
|
|
|
|
Image aIndicator;
|
2006-04-28 08:59:46 -05:00
|
|
|
bool bHighContrastMode (GetSettings().GetStyleSettings().GetHighContrastMode() != 0);
|
2004-07-13 08:39:14 -05:00
|
|
|
if (mbIsExpandable)
|
|
|
|
{
|
2004-08-04 02:58:31 -05:00
|
|
|
USHORT nResourceId = 0;
|
2004-07-13 08:39:14 -05:00
|
|
|
switch (meType)
|
|
|
|
{
|
|
|
|
case TBT_SUB_CONTROL_HEADLINE:
|
|
|
|
if (mbExpanded)
|
|
|
|
if (bHighContrastMode)
|
2004-08-04 02:58:31 -05:00
|
|
|
nResourceId = BMP_COLLAPSE_H;
|
2004-07-13 08:39:14 -05:00
|
|
|
else
|
2004-08-04 02:58:31 -05:00
|
|
|
nResourceId = BMP_COLLAPSE;
|
2004-07-13 08:39:14 -05:00
|
|
|
else
|
|
|
|
if (bHighContrastMode)
|
2004-08-04 02:58:31 -05:00
|
|
|
nResourceId = BMP_EXPAND_H;
|
2004-07-13 08:39:14 -05:00
|
|
|
else
|
2004-08-04 02:58:31 -05:00
|
|
|
nResourceId = BMP_EXPAND;
|
|
|
|
|
|
|
|
aIndicator = IconCache::Instance().GetIcon(nResourceId);
|
2004-07-13 08:39:14 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-04 02:58:31 -05:00
|
|
|
return aIndicator;
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TitleBar::PaintSubPanelHeadLineBar (void)
|
|
|
|
{
|
|
|
|
int nWidth (GetOutputSizePixel().Width());
|
|
|
|
Rectangle aTextBox (CalculateTextBoundingBox (nWidth, true));
|
|
|
|
|
|
|
|
Rectangle aTitleBarBox (CalculateTitleBarBox(aTextBox, nWidth));
|
|
|
|
int nVerticalOffset = -aTitleBarBox.Top();
|
|
|
|
aTitleBarBox.Top() += nVerticalOffset;
|
|
|
|
aTitleBarBox.Bottom() += nVerticalOffset;
|
|
|
|
aTextBox.Top() += nVerticalOffset;
|
|
|
|
aTextBox.Bottom() += nVerticalOffset;
|
|
|
|
|
|
|
|
PaintBackground (aTitleBarBox);
|
|
|
|
Rectangle aFocusBox (PaintExpansionIndicator (aTextBox));
|
|
|
|
PaintText (aTextBox);
|
|
|
|
|
|
|
|
aFocusBox.Union (aTextBox);
|
|
|
|
aFocusBox.Left() -= 2;
|
|
|
|
aFocusBox.Right() += 1;
|
|
|
|
PaintFocusIndicator (aFocusBox);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TitleBar::PaintFocusIndicator (const Rectangle& rTextBox)
|
|
|
|
{
|
|
|
|
if (mbFocused)
|
|
|
|
{
|
|
|
|
Rectangle aTextPixelBox (mpDevice->LogicToPixel (rTextBox));
|
|
|
|
mpDevice->EnableMapMode (FALSE);
|
|
|
|
Rectangle aBox (rTextBox);
|
|
|
|
aBox.Top() -= 1;
|
|
|
|
aBox.Bottom() += 1;
|
|
|
|
|
|
|
|
mpDevice->SetFillColor ();
|
|
|
|
|
|
|
|
mpDevice->DrawRect (aTextPixelBox);
|
|
|
|
|
|
|
|
LineInfo aDottedStyle (LINE_DASH);
|
|
|
|
aDottedStyle.SetDashCount (0);
|
|
|
|
aDottedStyle.SetDotCount (1);
|
|
|
|
aDottedStyle.SetDotLen (1);
|
|
|
|
aDottedStyle.SetDistance (1);
|
|
|
|
|
|
|
|
mpDevice->SetLineColor (COL_BLACK);
|
|
|
|
mpDevice->DrawPolyLine (Polygon(aTextPixelBox), aDottedStyle);
|
|
|
|
mpDevice->EnableMapMode (FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
HideFocus ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle TitleBar::PaintExpansionIndicator (const Rectangle& rTextBox)
|
|
|
|
{
|
2004-08-04 02:58:31 -05:00
|
|
|
Rectangle aExpansionIndicatorArea;
|
|
|
|
|
|
|
|
if (HasExpansionIndicator())
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
2004-08-04 02:58:31 -05:00
|
|
|
Image aImage = GetExpansionIndicator();
|
|
|
|
int nHeight (aImage.GetSizePixel().Height());
|
|
|
|
if (nHeight > 0)
|
|
|
|
{
|
|
|
|
Point aPosition (
|
|
|
|
0,
|
|
|
|
rTextBox.Top() + (GetTextHeight() - nHeight) / 2);
|
|
|
|
if (meType == TBT_SUB_CONTROL_HEADLINE)
|
|
|
|
aPosition.X() += 3;
|
|
|
|
mpDevice->DrawImage (aPosition, aImage);
|
|
|
|
|
|
|
|
aExpansionIndicatorArea = Rectangle (
|
|
|
|
aPosition, aImage.GetSizePixel());
|
|
|
|
}
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
2004-08-04 02:58:31 -05:00
|
|
|
|
|
|
|
return aExpansionIndicatorArea;
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TitleBar::PaintText (const Rectangle& rTextBox)
|
|
|
|
{
|
|
|
|
mpDevice->DrawText (rTextBox, msTitle, GetTextStyle());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USHORT TitleBar::GetTextStyle (void)
|
|
|
|
{
|
slidecopy: initial version of a "Tool Panel"
At the moment, this implementation is parallel to the existing TaskPane implementation, but on the medium term, it is
intended to replace it. No change in functionality is planned for the moment, just the panel selection is done via
a tab bar, instead of the the "jumping drawers".
Pending tasks (as known so far):
- Accessibility. No implementation at all, yet.
- showing/hiding tool panels from the "View" drop down menu
- connection to the resource framework. At the moment, de/activating panels completely bypasses the resource
framework.
- alternative implementation of the PanelDeckLayouter which mimics the old design. To be activated by default, for
the moment.
- removal of the (old, by then) TaskPane implementation. Care needs to be taken that the framework API stays
unchanged, i.e., the current ToolPanel resource must be renamed back to RightPane when RightPane is not
occupied anymore by the old implementation. Same for other resource names.
2010-03-15 07:53:19 -05:00
|
|
|
if(IsEnabled())
|
|
|
|
{
|
|
|
|
return TEXT_DRAW_LEFT
|
|
|
|
| TEXT_DRAW_TOP
|
|
|
|
| TEXT_DRAW_MULTILINE
|
|
|
|
| TEXT_DRAW_WORDBREAK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return TEXT_DRAW_DISABLE;
|
|
|
|
}
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TitleBar::PaintBackground (const Rectangle& rTitleBarBox)
|
|
|
|
{
|
|
|
|
// Fill a slightly rounded rectangle.
|
|
|
|
Color aFillColor (GetFillColor());
|
|
|
|
Color aLineColor (GetLineColor());
|
|
|
|
|
|
|
|
switch (meType)
|
|
|
|
{
|
|
|
|
case TBT_SUB_CONTROL_HEADLINE:
|
|
|
|
{
|
|
|
|
Color aColor (GetSettings().GetStyleSettings().GetDialogColor());
|
|
|
|
if (mbExpanded)
|
|
|
|
{
|
|
|
|
// Make the color a little bit darker.
|
2006-12-12 11:44:35 -06:00
|
|
|
aColor.SetRed(UINT8(((UINT16)aColor.GetRed()) * 8 / 10));
|
|
|
|
aColor.SetGreen(UINT8(((UINT16)aColor.GetGreen()) * 8 / 10));
|
|
|
|
aColor.SetBlue(UINT8(((UINT16)aColor.GetBlue()) * 8 / 10));
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mpDevice->SetFillColor (aColor);
|
|
|
|
mpDevice->SetLineColor ();
|
|
|
|
mpDevice->DrawRect (rTitleBarBox);
|
|
|
|
|
|
|
|
// Erase the four corner pixels to make the rectangle appear
|
|
|
|
// rounded.
|
|
|
|
mpDevice->SetLineColor (
|
|
|
|
GetSettings().GetStyleSettings().GetWindowColor());
|
|
|
|
mpDevice->DrawPixel (
|
|
|
|
rTitleBarBox.TopLeft());
|
|
|
|
mpDevice->DrawPixel (
|
|
|
|
Point(rTitleBarBox.Right(), rTitleBarBox.Top()));
|
|
|
|
mpDevice->DrawPixel (
|
|
|
|
Point(rTitleBarBox.Left(), rTitleBarBox.Bottom()));
|
|
|
|
mpDevice->DrawPixel (
|
|
|
|
Point(rTitleBarBox.Right(), rTitleBarBox.Bottom()));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle TitleBar::CalculateTextBoundingBox (
|
|
|
|
int nAvailableWidth,
|
|
|
|
bool bEmphasizeExpanded)
|
|
|
|
{
|
|
|
|
// Show the title of expanded controls in bold font.
|
|
|
|
const Font& rOriginalFont (GetFont());
|
|
|
|
Font aFont (rOriginalFont);
|
|
|
|
if (bEmphasizeExpanded && mbExpanded)
|
|
|
|
aFont.SetWeight (WEIGHT_BOLD);
|
|
|
|
else
|
|
|
|
aFont.SetWeight (WEIGHT_NORMAL);
|
|
|
|
mpDevice->SetFont (aFont);
|
|
|
|
|
|
|
|
// Use the natural width of the text when no width is given.
|
|
|
|
if (nAvailableWidth == 0)
|
|
|
|
nAvailableWidth = GetTextWidth (msTitle);
|
|
|
|
|
|
|
|
Rectangle aTextBox (
|
|
|
|
Point(0,0),
|
|
|
|
Size (nAvailableWidth,
|
2006-04-28 08:59:46 -05:00
|
|
|
GetSettings().GetStyleSettings().GetTitleHeight()));
|
2004-07-13 08:39:14 -05:00
|
|
|
aTextBox.Top() += (aTextBox.GetHeight() - GetTextHeight()) / 2;
|
2004-08-04 02:58:31 -05:00
|
|
|
if (HasExpansionIndicator())
|
2004-07-13 08:39:14 -05:00
|
|
|
aTextBox.Left() += snIndentationWidth;
|
|
|
|
else
|
|
|
|
aTextBox.Left() += 3;
|
|
|
|
aTextBox.Right() -= 1;
|
|
|
|
|
|
|
|
aTextBox = mpDevice->GetTextRect (aTextBox, msTitle, GetTextStyle());
|
|
|
|
|
|
|
|
return aTextBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle TitleBar::CalculateTitleBarBox (
|
|
|
|
const Rectangle& rTextBox,
|
|
|
|
int nWidth)
|
|
|
|
{
|
|
|
|
Rectangle aTitleBarBox (rTextBox);
|
|
|
|
|
|
|
|
switch (meType)
|
|
|
|
{
|
|
|
|
case TBT_SUB_CONTROL_HEADLINE:
|
|
|
|
aTitleBarBox.Top() -= 3;
|
|
|
|
aTitleBarBox.Bottom() += 3;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
aTitleBarBox.Left() = 0;
|
|
|
|
if (aTitleBarBox.GetWidth() < nWidth)
|
|
|
|
aTitleBarBox.Right() = nWidth-1;
|
|
|
|
|
|
|
|
return aTitleBarBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-04-07 15:36:24 -05:00
|
|
|
void TitleBar::MouseMove (const MouseEvent& )
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-12-12 11:44:35 -06:00
|
|
|
void TitleBar::MouseButtonDown (const MouseEvent& )
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
2004-08-04 02:58:31 -05:00
|
|
|
// Do not forward to parent window so that the mouse button handler of
|
|
|
|
// the docking window is not invoked.
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-12-12 11:44:35 -06:00
|
|
|
void TitleBar::MouseButtonUp (const MouseEvent& )
|
2004-07-13 08:39:14 -05:00
|
|
|
{
|
2004-08-04 02:58:31 -05:00
|
|
|
// Do not forward to parent window so that the mouse button handler of
|
|
|
|
// the docking window is not invoked.
|
2004-07-13 08:39:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-04 02:58:31 -05:00
|
|
|
|
2005-03-18 09:58:44 -06:00
|
|
|
|
|
|
|
void TitleBar::DataChanged (const DataChangedEvent& rEvent)
|
|
|
|
{
|
|
|
|
::Window::DataChanged (rEvent);
|
|
|
|
|
|
|
|
switch (rEvent.GetType())
|
|
|
|
{
|
|
|
|
case DATACHANGED_SETTINGS:
|
2005-07-14 04:22:32 -05:00
|
|
|
if ((rEvent.GetFlags() & SETTINGS_STYLE) == 0)
|
2005-03-18 09:58:44 -06:00
|
|
|
break;
|
2006-04-28 08:59:46 -05:00
|
|
|
SetSettings(Application::GetSettings());
|
|
|
|
mpDevice.reset(new VirtualDevice (*this));
|
|
|
|
|
|
|
|
// fall through.
|
|
|
|
|
2005-03-18 09:58:44 -06:00
|
|
|
case DATACHANGED_FONTS:
|
|
|
|
case DATACHANGED_FONTSUBSTITUTION:
|
|
|
|
{
|
2006-04-28 08:59:46 -05:00
|
|
|
const StyleSettings& rStyleSettings (GetSettings().GetStyleSettings());
|
2005-03-18 09:58:44 -06:00
|
|
|
|
|
|
|
// Font.
|
|
|
|
Font aFont = rStyleSettings.GetAppFont();
|
|
|
|
if (IsControlFont())
|
|
|
|
aFont.Merge(GetControlFont());
|
|
|
|
SetZoomedPointFont(aFont);
|
|
|
|
|
|
|
|
// Color.
|
|
|
|
Color aColor;
|
|
|
|
if (IsControlForeground())
|
|
|
|
aColor = GetControlForeground();
|
|
|
|
else
|
|
|
|
aColor = rStyleSettings.GetButtonTextColor();
|
|
|
|
SetTextColor(aColor);
|
|
|
|
SetTextFillColor();
|
|
|
|
|
|
|
|
Resize();
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-14 04:22:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
String TitleBar::GetTitle (void) const
|
|
|
|
{
|
|
|
|
return msTitle;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::accessibility::XAccessible > TitleBar::CreateAccessibleObject (
|
|
|
|
const ::com::sun::star::uno::Reference<
|
2006-12-12 11:44:35 -06:00
|
|
|
::com::sun::star::accessibility::XAccessible>& )
|
2005-07-14 04:22:32 -05:00
|
|
|
{
|
|
|
|
return new ::accessibility::AccessibleTreeNode(
|
|
|
|
*this,
|
|
|
|
GetTitle(),
|
|
|
|
GetTitle(),
|
|
|
|
::com::sun::star::accessibility::AccessibleRole::LABEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-13 08:39:14 -05:00
|
|
|
} } // end of namespace ::sd::toolpanel
|