Branch data 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 : :
21 : : #include "listviewitems.hxx"
22 : : //........................................................................
23 : : namespace dbaui
24 : : {
25 : : //........................................................................
26 : :
27 : : //========================================================================
28 : : // class OBoldListboxString
29 : : //========================================================================
30 : : //------------------------------------------------------------------------
31 : 120 : void OBoldListboxString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* _pViewData)
32 : : {
33 [ + - ]: 120 : SvLBoxString::InitViewData( pView, pEntry, _pViewData );
34 [ + + ]: 120 : if ( !m_bEmphasized )
35 : 120 : return;
36 [ + - ]: 48 : if (!_pViewData)
37 [ + - ]: 48 : _pViewData = pView->GetViewDataItem( pEntry, this );
38 [ + - ]: 48 : pView->Push(PUSH_ALL);
39 [ + - ]: 48 : Font aFont( pView->GetFont());
40 [ + - ]: 48 : aFont.SetWeight(WEIGHT_BOLD);
41 [ + - ]: 48 : pView->SetFont( aFont );
42 [ + - ][ + - ]: 48 : _pViewData->aSize = Size(pView->GetTextWidth(GetText()), pView->GetTextHeight());
[ + - ][ + - ]
43 [ + - ][ + - ]: 120 : pView->Pop();
44 : : }
45 : :
46 : : //------------------------------------------------------------------------
47 : 73 : sal_uInt16 OBoldListboxString::IsA()
48 : : {
49 : 73 : return SV_ITEM_ID_BOLDLBSTRING;
50 : : }
51 : :
52 : : //------------------------------------------------------------------------
53 : 41 : void OBoldListboxString::Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry )
54 : : {
55 [ + + ]: 41 : if (m_bEmphasized)
56 : : {
57 [ + - ]: 19 : rDev.Push(PUSH_ALL);
58 [ + - ]: 19 : Font aFont( rDev.GetFont());
59 [ + - ]: 19 : aFont.SetWeight(WEIGHT_BOLD);
60 [ + - ]: 19 : rDev.SetFont( aFont );
61 : 19 : Point aPos(rPos);
62 [ + - ][ + - ]: 19 : rDev.DrawText( aPos, GetText() );
[ + - ]
63 [ + - ][ + - ]: 19 : rDev.Pop();
64 : : }
65 : : else
66 : 22 : SvLBoxString::Paint(rPos, rDev, nFlags, pEntry);
67 : 41 : }
68 : :
69 : : //........................................................................
70 : : } // namespace dbaui
71 : : //........................................................................
72 : :
73 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|