2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include <CellBorderUpdater.hxx>
20 #include <vcl/bmpacc.hxx>
21 #include <vcl/svapp.hxx>
23 namespace sc
{ namespace sidebar
{
25 CellBorderUpdater::CellBorderUpdater(
33 CellBorderUpdater::~CellBorderUpdater()
37 void CellBorderUpdater::UpdateCellBorder(bool bTop
, bool bBot
, bool bLeft
, bool bRight
, Image aImg
, bool bVer
, bool bHor
)
39 BitmapEx
aBmpEx( aImg
.GetBitmapEx() );
40 Bitmap
aBmp( aBmpEx
.GetBitmap() );
41 BitmapWriteAccess
* pBmpAcc
= aBmp
.AcquireWriteAccess();
42 const Size maBmpSize
= aBmp
.GetSizePixel();
47 BitmapWriteAccess
* pMskAcc
;
49 if( aBmpEx
.IsAlpha() )
50 pMskAcc
= ( aMsk
= aBmpEx
.GetAlpha().GetBitmap() ).AcquireWriteAccess();
51 else if( aBmpEx
.IsTransparent() )
52 pMskAcc
= ( aMsk
= aBmpEx
.GetMask() ).AcquireWriteAccess();
56 pBmpAcc
->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ;
57 pBmpAcc
->SetFillColor( COL_BLACK
);
59 if(maBmpSize
.Width() == 43 && maBmpSize
.Height() == 43)
61 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);
64 pMskAcc
->SetLineColor( COL_BLACK
);
65 pMskAcc
->SetFillColor( COL_BLACK
);
69 pBmpAcc
->DrawLine( aTL
,aBL
);
71 pMskAcc
->DrawLine( aTL
,aBL
);
75 pBmpAcc
->DrawLine( aTR
,aBR
);
77 pMskAcc
->DrawLine( aTR
,aBR
);
81 pBmpAcc
->DrawLine( aTL
,aTR
);
83 pMskAcc
->DrawLine( aTL
,aTR
);
87 pBmpAcc
->DrawLine( aBL
,aBR
);
89 pMskAcc
->DrawLine( aBL
,aBR
);
93 pBmpAcc
->DrawLine( aVT
,aVB
);
95 pMskAcc
->DrawLine( aVT
,aVB
);
99 pBmpAcc
->DrawLine( aHL
,aHR
);
101 pMskAcc
->DrawLine( aHL
,aHR
);
105 aBmp
.ReleaseAccess( pBmpAcc
);
107 aMsk
.ReleaseAccess( pMskAcc
);
109 if( aBmpEx
.IsAlpha() )
110 aBmpEx
= BitmapEx( aBmp
, AlphaMask( aMsk
) );
111 else if( aBmpEx
.IsTransparent() )
112 aBmpEx
= BitmapEx( aBmp
, aMsk
);
116 mrTbx
.SetItemImage( mnBtnId
, Image( aBmpEx
) );
120 } } // end of namespace svx::sidebar