TitleBar.cxx (54eaaa32) TitleBar.cxx (65908a7e)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 12 unchanged lines hidden (view full) ---

21
22#include "precompiled_sfx2.hxx"
23
24#include "TitleBar.hxx"
25#include "Paint.hxx"
26
27#include <tools/svborder.hxx>
28#include <vcl/gradient.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 12 unchanged lines hidden (view full) ---

21
22#include "precompiled_sfx2.hxx"
23
24#include "TitleBar.hxx"
25#include "Paint.hxx"
26
27#include <tools/svborder.hxx>
28#include <vcl/gradient.hxx>
29#include <vcl/lineinfo.hxx>
29
30ToolbarValue::~ToolbarValue (void) {}
31
32
33namespace sfx2 { namespace sidebar {
34
35TitleBar::TitleBar (
36 const ::rtl::OUString& rsTitle,

--- 27 unchanged lines hidden (view full) ---

64
65
66
67void TitleBar::Paint (const Rectangle& rUpdateArea)
68{
69 (void)rUpdateArea;
70
71 // Paint title bar background.
30
31ToolbarValue::~ToolbarValue (void) {}
32
33
34namespace sfx2 { namespace sidebar {
35
36TitleBar::TitleBar (
37 const ::rtl::OUString& rsTitle,

--- 27 unchanged lines hidden (view full) ---

65
66
67
68void TitleBar::Paint (const Rectangle& rUpdateArea)
69{
70 (void)rUpdateArea;
71
72 // Paint title bar background.
72 Size aWindowSize( GetOutputSizePixel() );
73 Size aWindowSize (GetOutputSizePixel());
73 Rectangle aTitleBarBox(
74 0,
75 0,
76 aWindowSize.Width(),
77 aWindowSize.Height()
78 );
79
80 PaintDecoration(aTitleBarBox);
74 Rectangle aTitleBarBox(
75 0,
76 0,
77 aWindowSize.Width(),
78 aWindowSize.Height()
79 );
80
81 PaintDecoration(aTitleBarBox);
81 PaintTitle(GetTitleArea(aTitleBarBox));
82 const Rectangle aTitleBox (GetTitleArea(aTitleBarBox));
83 PaintTitle(aTitleBox);
84 if (HasFocus())
85 PaintFocus(aTitleBox);
82}
83
84
85
86
87void TitleBar::DataChanged (const DataChangedEvent& rEvent)
88{
89 (void)rEvent;

--- 17 unchanged lines hidden (view full) ---

107 const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth());
108 maToolBox.SetPosSizePixel(nWidth-nToolBoxWidth,0,nToolBoxWidth,nHeight);
109 maToolBox.Show();
110}
111
112
113
114
86}
87
88
89
90
91void TitleBar::DataChanged (const DataChangedEvent& rEvent)
92{
93 (void)rEvent;

--- 17 unchanged lines hidden (view full) ---

111 const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth());
112 maToolBox.SetPosSizePixel(nWidth-nToolBoxWidth,0,nToolBoxWidth,nHeight);
113 maToolBox.Show();
114}
115
116
117
118
119ToolBox& TitleBar::GetToolBox (void)
120{
121 return maToolBox;
122}
123
124
125
126
115void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
116{
117 (void)nItemIndex;
118 // Any real processing has to be done in derived class.
119}
120
121
122
123
124void TitleBar::PaintTitle (const Rectangle& rTitleBox)
125{
126 Push(PUSH_FONT | PUSH_TEXTCOLOR);
127
127void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
128{
129 (void)nItemIndex;
130 // Any real processing has to be done in derived class.
131}
132
133
134
135
136void TitleBar::PaintTitle (const Rectangle& rTitleBox)
137{
138 Push(PUSH_FONT | PUSH_TEXTCOLOR);
139
128 // Use a bold font for the deck title.
129 Font aFont(GetFont());
140 Font aFont(GetFont());
130 aFont.SetWeight(WEIGHT_BOLD);
131 SetFont(aFont);
132
133 // Paint title bar text.
134 SetTextColor(GetTextColor());
135 DrawText(
136 rTitleBox,
137 msTitle,
138 TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER);
141 SetFont(aFont);
142
143 // Paint title bar text.
144 SetTextColor(GetTextColor());
145 DrawText(
146 rTitleBox,
147 msTitle,
148 TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER);
149
150 Pop();
151}
152
153
154
155
156void TitleBar::PaintFocus (const Rectangle& rFocusBox)
157{
158 Push(PUSH_FONT | PUSH_TEXTCOLOR | PUSH_LINECOLOR | PUSH_FILLCOLOR);
159
160 const Rectangle aTextBox (
161 GetTextRect(
162 rFocusBox,
163 msTitle,
164 TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER));
165 const Rectangle aLargerTextBox (
166 aTextBox.Left() - 2,
167 aTextBox.Top() - 2,
168 aTextBox.Right() + 2,
169 aTextBox.Bottom() + 2);
170
171 LineInfo aDottedStyle (LINE_DASH);
172 aDottedStyle.SetDashCount(0);
173 aDottedStyle.SetDotCount(1);
174 aDottedStyle.SetDotLen(1);
175 aDottedStyle.SetDistance(1);
139
176
177 SetFillColor();
178 SetLineColor(COL_BLACK);
179 DrawPolyLine(Polygon(aLargerTextBox), aDottedStyle);
180
140 Pop();
141}
142
143
144
145
146IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox)
147{
148 (void)pToolBox;
149 OSL_ASSERT(&maToolBox==pToolBox);
150 const sal_uInt16 nItemId (maToolBox.GetHighlightItemId());
151
152 HandleToolBoxItemClick(nItemId);
153
154 return sal_True;
155}
156
157} } // end of namespace sfx2::sidebar
181 Pop();
182}
183
184
185
186
187IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox)
188{
189 (void)pToolBox;
190 OSL_ASSERT(&maToolBox==pToolBox);
191 const sal_uInt16 nItemId (maToolBox.GetHighlightItemId());
192
193 HandleToolBoxItemClick(nItemId);
194
195 return sal_True;
196}
197
198} } // end of namespace sfx2::sidebar