1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SD_TASKPANE_TITLE_BAR_HXX
21 #define SD_TASKPANE_TITLE_BAR_HXX
23 #include "taskpane/TaskPaneTreeNode.hxx"
24 #include <vcl/image.hxx>
25 #include <tools/string.hxx>
26 #include <vcl/window.hxx>
33 namespace sd
{ namespace toolpanel
{
36 /** The title bar above a control in a sub tool panel.
38 <p>The title bar shows two kinds of indicators: 1) Expansion is
39 displayed by two sets of two bitmaps, a triangle pointing to the right
40 resp. a minus in a square indicates that the control is collapsed, a
41 triangle pointing down resp. a plus in a square stands for an expanded
42 control. 2) Keyboard focus is indicated by a dotted rectangle.
50 TBT_SUB_CONTROL_HEADLINE
53 /** Create a new title bar whose content, the given title string,
54 will be formatted according to the given type.
58 const String
& rsTitle
,
61 virtual ~TitleBar (void);
63 virtual Size
GetPreferredSize (void);
64 virtual sal_Int32
GetPreferredWidth (sal_Int32 nHeight
);
65 virtual sal_Int32
GetPreferredHeight (sal_Int32 nWidth
);
66 virtual bool IsResizable (void);
67 virtual ::Window
* GetWindow (void);
68 virtual sal_Int32
GetMinimumWidth (void);
70 virtual void Paint (const Rectangle
& rBoundingBox
);
71 virtual bool Expand (bool bFlag
= true);
72 virtual bool IsExpanded (void) const;
73 virtual void SetEnabledState(bool bFlag
);
74 virtual void GetFocus (void);
75 virtual void LoseFocus (void);
77 virtual void MouseMove(const MouseEvent
& rEvent
);
78 /** Empty implementation prevents forwarding to docking window.
80 virtual void MouseButtonDown (const MouseEvent
& rEvent
);
81 /** Empty implementation prevents forwarding to docking window.
83 virtual void MouseButtonUp (const MouseEvent
& rEvent
);
85 virtual void DataChanged (const DataChangedEvent
& rEvent
);
87 String
GetTitle (void) const;
89 ::com::sun::star::uno::Reference
<
90 ::com::sun::star::accessibility::XAccessible
> CreateAccessibleObject (
91 const ::com::sun::star::uno::Reference
<
92 ::com::sun::star::accessibility::XAccessible
>& rxParent
);
99 // Size of the bounding box that encloses the title string.
100 SAL_WNODEPRECATED_DECLARATIONS_PUSH
101 ::std::auto_ptr
<VirtualDevice
> mpDevice
;
102 SAL_WNODEPRECATED_DECLARATIONS_POP
105 /** Return whether this TitleBar object has an expansion indicator
106 bitmap. It is safe to call GetExpansionIndicator() when this method
107 returns <FALSE/> but unnecessary.
109 bool HasExpansionIndicator (void) const;
111 /** Return the image of the expansion indicator.
113 When there is no expansion indictor for this TitleBar object,
114 then an empty Image is returned. You better call
115 HasExpansionIndicator() to prevent this.
117 Image
GetExpansionIndicator (void) const;
119 /** Calculate the bounding box of the title text. This takes into
120 account indentation due to an expansion indicator and the given
121 available width. When the text can not be displayed on one line, it
122 is broken into multiple lines.
123 @param nAvailableWidth
124 When 0 is given then the natural text width is used, i.e. the
125 text is not broken into multiple lines.
127 Rectangle
CalculateTextBoundingBox (
129 bool bEmphasizeExpanded
);
131 /** Add some space to the given text box and return the bounding box of
134 Rectangle
CalculateTitleBarBox (
135 const Rectangle
& rTextBox
,
138 void PaintSubPanelHeadLineBar (void);
140 void PaintBackground (const Rectangle
& rTextBox
);
142 /// Paint a focus indicator that encloses the given rectangle.
143 void PaintFocusIndicator (const Rectangle
& rIndicatorBox
);
145 Rectangle
PaintExpansionIndicator (const Rectangle
& rTextBox
);
147 void PaintText (const Rectangle
& rTextBox
);
149 sal_uInt16
GetTextStyle (void);
151 const static int snIndentationWidth
;
153 // Default constructor, copy constructor, and assignment are not supported.
155 TitleBar (const TitleBar
&);
156 TitleBar
& operator= (const TitleBar
&);
158 using Window::GetWindow
;
161 } } // end of namespace ::sd::toolpanel
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */