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
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26
27 #include "optHeaderTabListbox.hxx"
28 #include <vcl/svapp.hxx>
29 #include <svtools/headbar.hxx>
30
31
32 namespace svx
33 {
34 // class OptLBoxString_Impl ----------------------------------------------
35
36 class OptLBoxString_Impl : public SvLBoxString
37 {
38 public:
OptLBoxString_Impl(SvLBoxEntry * pEntry,sal_uInt16 nFlags,const String & rTxt)39 OptLBoxString_Impl( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rTxt ) :
40 SvLBoxString( pEntry, nFlags, rTxt ) {}
41
42 virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry );
43 };
44
45 // -----------------------------------------------------------------------
46
Paint(const Point & rPos,SvLBox & rDev,sal_uInt16,SvLBoxEntry * pEntry)47 void OptLBoxString_Impl::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* pEntry )
48 {
49 Font aOldFont( rDev.GetFont() );
50 Font aFont( aOldFont );
51 //detect readonly state by asking for a valid Image
52 if(pEntry && !(!((OptHeaderTabListBox&)rDev).GetCollapsedEntryBmp(pEntry)))
53 aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() );
54 rDev.SetFont( aFont );
55 rDev.DrawText( rPos, GetText() );
56 rDev.SetFont( aOldFont );
57 }
58 // -----------------------------------------------------------------------------
59
OptHeaderTabListBox(Window * pParent,WinBits nWinStyle)60 OptHeaderTabListBox::OptHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :
61
62 SvHeaderTabListBox( pParent, nWinStyle )
63 {
64 }
65
66 // -----------------------------------------------------------------------
InitEntry(SvLBoxEntry * pEntry,const XubString & rTxt,const Image & rImg1,const Image & rImg2,SvLBoxButtonKind eButtonKind)67 void OptHeaderTabListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt,
68 const Image& rImg1, const Image& rImg2,
69 SvLBoxButtonKind eButtonKind )
70 {
71 SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind );
72 sal_uInt16 _nTabCount = TabCount();
73
74 for ( sal_uInt16 nCol = 1; nCol < _nTabCount; ++nCol )
75 {
76 // alle Spalten mit eigener Klasse initialisieren (Spalte 0 == Bitmap)
77 SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol );
78 OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() );
79 pEntry->ReplaceItem( pStr, nCol );
80 }
81 }
82
83 } // namespace svx
84