Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "optHeaderTabListbox.hxx"
21 : #include <vcl/svapp.hxx>
22 : #include <svtools/headbar.hxx>
23 : #include <svtools/svlbitm.hxx>
24 : #include "svtools/treelistentry.hxx"
25 :
26 : namespace svx
27 : {
28 : // class OptLBoxString_Impl ----------------------------------------------
29 :
30 0 : class OptLBoxString_Impl : public SvLBoxString
31 : {
32 : public:
33 0 : OptLBoxString_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const String& rTxt ) :
34 0 : SvLBoxString( pEntry, nFlags, rTxt ) {}
35 :
36 : virtual void Paint(
37 : const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
38 : };
39 :
40 : // -----------------------------------------------------------------------
41 :
42 0 : void OptLBoxString_Impl::Paint(
43 : const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
44 : {
45 0 : Font aOldFont( rDev.GetFont() );
46 0 : Font aFont( aOldFont );
47 : //detect readonly state by asking for a valid Image
48 0 : if(pEntry && !(!((OptHeaderTabListBox&)rDev).GetCollapsedEntryBmp(pEntry)))
49 0 : aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() );
50 0 : rDev.SetFont( aFont );
51 0 : rDev.DrawText( rPos, GetText() );
52 0 : rDev.SetFont( aOldFont );
53 0 : }
54 : // -----------------------------------------------------------------------------
55 :
56 0 : OptHeaderTabListBox::OptHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :
57 :
58 0 : SvHeaderTabListBox( pParent, nWinStyle )
59 : {
60 0 : }
61 :
62 : // -----------------------------------------------------------------------
63 0 : void OptHeaderTabListBox::InitEntry( SvTreeListEntry* pEntry, const OUString& rTxt,
64 : const Image& rImg1, const Image& rImg2,
65 : SvLBoxButtonKind eButtonKind )
66 : {
67 0 : SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind );
68 0 : sal_uInt16 _nTabCount = TabCount();
69 :
70 0 : for ( sal_uInt16 nCol = 1; nCol < _nTabCount; ++nCol )
71 : {
72 : // initialize all columns with own class (column 0 == Bitmap)
73 0 : SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol );
74 0 : OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() );
75 0 : pEntry->ReplaceItem( pStr, nCol );
76 : }
77 0 : }
78 :
79 : } // namespace svx
80 :
81 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|