Update ooo320-m1
[ooovba.git] / svx / source / cui / optHeaderTabListbox.cxx
blobe7cc607a611b4897a32bb13b1b735f395bbe8663
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: optHeaderTabListbox.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
36 #endif
37 #include "optHeaderTabListbox.hxx"
38 #include <vcl/svapp.hxx>
39 #include <svtools/headbar.hxx>
42 namespace svx
44 // class OptLBoxString_Impl ----------------------------------------------
46 class OptLBoxString_Impl : public SvLBoxString
48 public:
49 OptLBoxString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rTxt ) :
50 SvLBoxString( pEntry, nFlags, rTxt ) {}
52 virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry );
55 // -----------------------------------------------------------------------
57 void OptLBoxString_Impl::Paint( const Point& rPos, SvLBox& rDev, USHORT, SvLBoxEntry* pEntry )
59 Font aOldFont( rDev.GetFont() );
60 Font aFont( aOldFont );
61 //detect readonly state by asking for a valid Image
62 if(pEntry && !(!((OptHeaderTabListBox&)rDev).GetCollapsedEntryBmp(pEntry)))
63 aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() );
64 rDev.SetFont( aFont );
65 rDev.DrawText( rPos, GetText() );
66 rDev.SetFont( aOldFont );
68 // -----------------------------------------------------------------------------
70 OptHeaderTabListBox::OptHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :
72 SvHeaderTabListBox( pParent, nWinStyle )
76 // -----------------------------------------------------------------------
77 void OptHeaderTabListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt,
78 const Image& rImg1, const Image& rImg2,
79 SvLBoxButtonKind eButtonKind )
81 SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind );
82 USHORT _nTabCount = TabCount();
84 for ( USHORT nCol = 1; nCol < _nTabCount; ++nCol )
86 // alle Spalten mit eigener Klasse initialisieren (Spalte 0 == Bitmap)
87 SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol );
88 OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() );
89 pEntry->ReplaceItem( pStr, nCol );
93 } // namespace svx