122de8995SAndre Fischer /************************************************************** 222de8995SAndre Fischer * 322de8995SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 422de8995SAndre Fischer * or more contributor license agreements. See the NOTICE file 522de8995SAndre Fischer * distributed with this work for additional information 622de8995SAndre Fischer * regarding copyright ownership. The ASF licenses this file 722de8995SAndre Fischer * to you under the Apache License, Version 2.0 (the 822de8995SAndre Fischer * "License"); you may not use this file except in compliance 922de8995SAndre Fischer * with the License. You may obtain a copy of the License at 1022de8995SAndre Fischer * 1122de8995SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 1222de8995SAndre Fischer * 1322de8995SAndre Fischer * Unless required by applicable law or agreed to in writing, 1422de8995SAndre Fischer * software distributed under the License is distributed on an 1522de8995SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1622de8995SAndre Fischer * KIND, either express or implied. See the License for the 1722de8995SAndre Fischer * specific language governing permissions and limitations 1822de8995SAndre Fischer * under the License. 1922de8995SAndre Fischer * 2022de8995SAndre Fischer *************************************************************/ 2122de8995SAndre Fischer 2222de8995SAndre Fischer #include "precompiled_sfx2.hxx" 2322de8995SAndre Fischer 2422de8995SAndre Fischer #include "TitleBar.hxx" 25ff12d537SAndre Fischer #include "Paint.hxx" 2622de8995SAndre Fischer 2722de8995SAndre Fischer #include <tools/svborder.hxx> 2822de8995SAndre Fischer #include <vcl/gradient.hxx> 2922de8995SAndre Fischer 30ff12d537SAndre Fischer ToolbarValue::~ToolbarValue (void) {} 3122de8995SAndre Fischer 32ff12d537SAndre Fischer 33ff12d537SAndre Fischer namespace sfx2 { namespace sidebar { 3422de8995SAndre Fischer 3522de8995SAndre Fischer TitleBar::TitleBar ( 3622de8995SAndre Fischer const ::rtl::OUString& rsTitle, 37*7a32b0c8SAndre Fischer Window* pParentWindow, 38*7a32b0c8SAndre Fischer const sidebar::Paint& rInitialBackgroundPaint) 3922de8995SAndre Fischer : Window(pParentWindow), 40*7a32b0c8SAndre Fischer maToolBox(this), 41ff12d537SAndre Fischer msTitle(rsTitle) 4222de8995SAndre Fischer { 43*7a32b0c8SAndre Fischer SetBackground(rInitialBackgroundPaint.GetWallpaper()); 44*7a32b0c8SAndre Fischer 45*7a32b0c8SAndre Fischer maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler)); 4622de8995SAndre Fischer } 4722de8995SAndre Fischer 4822de8995SAndre Fischer 4922de8995SAndre Fischer 5022de8995SAndre Fischer 5122de8995SAndre Fischer TitleBar::~TitleBar (void) 5222de8995SAndre Fischer { 5322de8995SAndre Fischer } 5422de8995SAndre Fischer 5522de8995SAndre Fischer 5622de8995SAndre Fischer 5722de8995SAndre Fischer 5822de8995SAndre Fischer void TitleBar::Paint (const Rectangle& rUpdateArea) 5922de8995SAndre Fischer { 6095a18594SAndre Fischer (void)rUpdateArea; 6195a18594SAndre Fischer 6222de8995SAndre Fischer // Paint title bar background. 6322de8995SAndre Fischer Size aWindowSize( GetOutputSizePixel() ); 64ff12d537SAndre Fischer Rectangle aTitleBarBox( 65ff12d537SAndre Fischer 0, 66ff12d537SAndre Fischer 0, 67ff12d537SAndre Fischer aWindowSize.Width(), 68ff12d537SAndre Fischer aWindowSize.Height() 69ff12d537SAndre Fischer ); 70ff12d537SAndre Fischer 71ff12d537SAndre Fischer PaintDecoration(aTitleBarBox); 72ff12d537SAndre Fischer PaintTitle(GetTitleArea(aTitleBarBox)); 73ff12d537SAndre Fischer } 74ff12d537SAndre Fischer 75ff12d537SAndre Fischer 76ff12d537SAndre Fischer 77b9e67834SAndre Fischer 78*7a32b0c8SAndre Fischer void TitleBar::DataChanged (const DataChangedEvent& rEvent) 79*7a32b0c8SAndre Fischer { 80*7a32b0c8SAndre Fischer (void)rEvent; 81*7a32b0c8SAndre Fischer 82*7a32b0c8SAndre Fischer SetBackground(GetBackgroundPaint().GetWallpaper()); 83*7a32b0c8SAndre Fischer } 84*7a32b0c8SAndre Fischer 85*7a32b0c8SAndre Fischer 86*7a32b0c8SAndre Fischer 87*7a32b0c8SAndre Fischer 88*7a32b0c8SAndre Fischer void TitleBar::SetPosSizePixel ( 89*7a32b0c8SAndre Fischer long nX, 90*7a32b0c8SAndre Fischer long nY, 91*7a32b0c8SAndre Fischer long nWidth, 92*7a32b0c8SAndre Fischer long nHeight, 93*7a32b0c8SAndre Fischer sal_uInt16 nFlags) 94ff12d537SAndre Fischer { 95*7a32b0c8SAndre Fischer Window::SetPosSizePixel(nX,nY,nWidth,nHeight,nFlags); 96*7a32b0c8SAndre Fischer 97*7a32b0c8SAndre Fischer // Place the toolbox. 98*7a32b0c8SAndre Fischer const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth()); 99*7a32b0c8SAndre Fischer maToolBox.SetPosSizePixel(nWidth-nToolBoxWidth,0,nToolBoxWidth,nHeight); 100*7a32b0c8SAndre Fischer maToolBox.Show(); 101*7a32b0c8SAndre Fischer } 102*7a32b0c8SAndre Fischer 103*7a32b0c8SAndre Fischer 104*7a32b0c8SAndre Fischer 105*7a32b0c8SAndre Fischer 106*7a32b0c8SAndre Fischer void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex) 107*7a32b0c8SAndre Fischer { 108*7a32b0c8SAndre Fischer (void)nItemIndex; 109*7a32b0c8SAndre Fischer // Any real processing has to be done in derived class. 110ff12d537SAndre Fischer } 111ff12d537SAndre Fischer 112ff12d537SAndre Fischer 113ff12d537SAndre Fischer 114ff12d537SAndre Fischer 115ff12d537SAndre Fischer void TitleBar::PaintTitle (const Rectangle& rTitleBox) 116ff12d537SAndre Fischer { 117ff12d537SAndre Fischer Push(PUSH_FONT | PUSH_TEXTCOLOR); 11822de8995SAndre Fischer 11922de8995SAndre Fischer // Use a bold font for the deck title. 12022de8995SAndre Fischer Font aFont(GetFont()); 12122de8995SAndre Fischer aFont.SetWeight(WEIGHT_BOLD); 12222de8995SAndre Fischer SetFont(aFont); 12322de8995SAndre Fischer 12422de8995SAndre Fischer // Paint title bar text. 125ff12d537SAndre Fischer SetTextColor(GetTextColor()); 12622de8995SAndre Fischer DrawText( 127ff12d537SAndre Fischer rTitleBox, 12822de8995SAndre Fischer msTitle, 12922de8995SAndre Fischer TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER); 130ff12d537SAndre Fischer 13122de8995SAndre Fischer Pop(); 13222de8995SAndre Fischer } 13322de8995SAndre Fischer 13422de8995SAndre Fischer 135*7a32b0c8SAndre Fischer 136*7a32b0c8SAndre Fischer 137*7a32b0c8SAndre Fischer IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox) 138*7a32b0c8SAndre Fischer { 139*7a32b0c8SAndre Fischer (void)pToolBox; 140*7a32b0c8SAndre Fischer OSL_ASSERT(&maToolBox==pToolBox); 141*7a32b0c8SAndre Fischer const sal_uInt16 nItemId (maToolBox.GetHighlightItemId()); 142*7a32b0c8SAndre Fischer 143*7a32b0c8SAndre Fischer HandleToolBoxItemClick(nItemId); 144*7a32b0c8SAndre Fischer 145*7a32b0c8SAndre Fischer return sal_True; 146*7a32b0c8SAndre Fischer } 147*7a32b0c8SAndre Fischer 148ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 149