bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / options / optHeaderTabListbox.cxx
blob404ef64bc7e2a1c7434d148cbd6a185fb7ba5a62
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 <vcl/settings.hxx>
23 #include <svtools/headbar.hxx>
24 #include <svtools/svlbitm.hxx>
25 #include <svtools/treelistentry.hxx>
27 namespace svx
29 // class OptLBoxString_Impl ----------------------------------------------
31 class OptLBoxString_Impl : public SvLBoxString
33 public:
34 OptLBoxString_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rTxt ) :
35 SvLBoxString( pEntry, nFlags, rTxt ) {}
37 virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
38 const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
43 void OptLBoxString_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
44 const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
46 rRenderContext.Push(PushFlags::FONT);
47 vcl::Font aFont(rRenderContext.GetFont());
48 //detect readonly state by asking for a valid Image
49 if (pEntry && !(!SvTreeListBox::GetCollapsedEntryBmp(pEntry)))
50 aFont.SetColor(Application::GetSettings().GetStyleSettings().GetDeactiveTextColor());
51 rRenderContext.SetFont(aFont);
52 rRenderContext.DrawText(rPos, GetText());
53 rRenderContext.Pop();
57 OptHeaderTabListBox::OptHeaderTabListBox(SvSimpleTableContainer& rParent, WinBits nWinStyle)
58 : SvSimpleTable(rParent, nWinStyle)
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 = static_cast<SvLBoxString*>(pEntry->GetItem( nCol ));
74 OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() );
75 pEntry->ReplaceItem( pStr, nCol );
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */