Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / cui / source / options / optHeaderTabListbox.cxx
blob7a6351816b6106dcdb3ea89863a5ef2617204054
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include "optHeaderTabListbox.hxx"
21 #include <vcl/svapp.hxx>
22 #include <svtools/headbar.hxx>
23 #include <svtools/svlbitm.hxx>
24 #include "svtools/treelistentry.hxx"
26 namespace svx
28 // class OptLBoxString_Impl ----------------------------------------------
30 class OptLBoxString_Impl : public SvLBoxString
32 public:
33 OptLBoxString_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const String& rTxt ) :
34 SvLBoxString( pEntry, nFlags, rTxt ) {}
36 virtual void Paint(
37 const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
40 // -----------------------------------------------------------------------
42 void OptLBoxString_Impl::Paint(
43 const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
45 Font aOldFont( rDev.GetFont() );
46 Font aFont( aOldFont );
47 //detect readonly state by asking for a valid Image
48 if(pEntry && !(!((OptHeaderTabListBox&)rDev).GetCollapsedEntryBmp(pEntry)))
49 aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() );
50 rDev.SetFont( aFont );
51 rDev.DrawText( rPos, GetText() );
52 rDev.SetFont( aOldFont );
54 // -----------------------------------------------------------------------------
56 OptHeaderTabListBox::OptHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :
58 SvHeaderTabListBox( pParent, nWinStyle )
62 // -----------------------------------------------------------------------
63 void OptHeaderTabListBox::InitEntry( SvTreeListEntry* pEntry, const OUString& rTxt,
64 const Image& rImg1, const Image& rImg2,
65 SvLBoxButtonKind eButtonKind )
67 SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind );
68 sal_uInt16 _nTabCount = TabCount();
70 for ( sal_uInt16 nCol = 1; nCol < _nTabCount; ++nCol )
72 // initialize all columns with own class (column 0 == Bitmap)
73 SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol );
74 OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() );
75 pEntry->ReplaceItem( pStr, nCol );
79 } // namespace svx
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */