1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "CellBorderUpdater.hxx"
21 #include <vcl/bmpacc.hxx>
22 #include <vcl/svapp.hxx>
23 #include <vcl/settings.hxx>
25 namespace sc
{ namespace sidebar
{
27 CellBorderUpdater::CellBorderUpdater(
35 CellBorderUpdater::~CellBorderUpdater()
39 void CellBorderUpdater::UpdateCellBorder(bool bTop
, bool bBot
, bool bLeft
, bool bRight
, Image aImg
, bool bVer
, bool bHor
)
41 BitmapEx
aBmpEx( aImg
.GetBitmapEx() );
42 Bitmap
aBmp( aBmpEx
.GetBitmap() );
43 BitmapWriteAccess
* pBmpAcc
= aBmp
.AcquireWriteAccess();
44 const Size maBmpSize
= aBmp
.GetSizePixel();
49 BitmapWriteAccess
* pMskAcc
;
51 if( aBmpEx
.IsAlpha() )
52 pMskAcc
= ( aMsk
= aBmpEx
.GetAlpha().GetBitmap() ).AcquireWriteAccess();
53 else if( aBmpEx
.IsTransparent() )
54 pMskAcc
= ( aMsk
= aBmpEx
.GetMask() ).AcquireWriteAccess();
58 pBmpAcc
->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ;
59 pBmpAcc
->SetFillColor( COL_BLACK
);
61 if(maBmpSize
.Width() == 43 && maBmpSize
.Height() == 43)
63 Point
aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41);
66 pMskAcc
->SetLineColor( COL_BLACK
);
67 pMskAcc
->SetFillColor( COL_BLACK
);
71 pBmpAcc
->DrawLine( aTL
,aBL
);
73 pMskAcc
->DrawLine( aTL
,aBL
);
77 pBmpAcc
->DrawLine( aTR
,aBR
);
79 pMskAcc
->DrawLine( aTR
,aBR
);
83 pBmpAcc
->DrawLine( aTL
,aTR
);
85 pMskAcc
->DrawLine( aTL
,aTR
);
89 pBmpAcc
->DrawLine( aBL
,aBR
);
91 pMskAcc
->DrawLine( aBL
,aBR
);
95 pBmpAcc
->DrawLine( aVT
,aVB
);
97 pMskAcc
->DrawLine( aVT
,aVB
);
101 pBmpAcc
->DrawLine( aHL
,aHR
);
103 pMskAcc
->DrawLine( aHL
,aHR
);
107 Bitmap::ReleaseAccess( pBmpAcc
);
109 Bitmap::ReleaseAccess( pMskAcc
);
111 if( aBmpEx
.IsAlpha() )
112 aBmpEx
= BitmapEx( aBmp
, AlphaMask( aMsk
) );
113 else if( aBmpEx
.IsTransparent() )
114 aBmpEx
= BitmapEx( aBmp
, aMsk
);
118 mrTbx
.SetItemImage( mnBtnId
, Image( aBmpEx
) );
122 } } // end of namespace svx::sidebar
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */