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 <vcl/settings.hxx>
23 : #include <svtools/headbar.hxx>
24 : #include <svtools/svlbitm.hxx>
25 : #include <svtools/treelistentry.hxx>
26 :
27 : namespace svx
28 : {
29 : // class OptLBoxString_Impl ----------------------------------------------
30 :
31 0 : class OptLBoxString_Impl : public SvLBoxString
32 : {
33 : public:
34 0 : OptLBoxString_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rTxt ) :
35 0 : SvLBoxString( pEntry, nFlags, rTxt ) {}
36 :
37 : virtual void Paint(
38 : const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
39 : };
40 :
41 :
42 :
43 0 : void OptLBoxString_Impl::Paint(
44 : const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
45 : {
46 0 : vcl::Font aOldFont( rDev.GetFont() );
47 0 : vcl::Font aFont( aOldFont );
48 : //detect readonly state by asking for a valid Image
49 0 : if(pEntry && !(!static_cast<OptHeaderTabListBox&>(rDev).GetCollapsedEntryBmp(pEntry)))
50 0 : aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() );
51 0 : rDev.SetFont( aFont );
52 0 : rDev.DrawText( rPos, GetText() );
53 0 : rDev.SetFont( aOldFont );
54 0 : }
55 :
56 :
57 0 : OptHeaderTabListBox::OptHeaderTabListBox(SvSimpleTableContainer& rParent, WinBits nWinStyle)
58 0 : : SvSimpleTable(rParent, 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 = static_cast<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 0 : } // namespace svx
80 :
81 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|