1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include "SidebarDialControlBmp.hxx"
23 
24 #include <sfx2/sidebar/Theme.hxx>
25 
26 #include <vcl/svapp.hxx>
27 
28 #include "PosSizePropertyPanel.hrc"
29 #include <svx/dialogs.hrc>
30 #include <svx/dialmgr.hxx>
31 #include <svx/svdstr.hrc>
32 
33 namespace svx { namespace sidebar {
34 
35 SidebarDialControlBmp::SidebarDialControlBmp (Window& rParent)
36     : DialControlBmp(rParent)
37 {
38 }
39 
40 
41 
42 
43 SidebarDialControlBmp::~SidebarDialControlBmp (void)
44 {
45 }
46 
47 
48 
49 
50 void SidebarDialControlBmp::DrawElements (
51     const String& rText,
52     sal_Int32 nAngle)
53 {
54     if (Application::GetSettings().GetLayoutRTL())
55         nAngle = 18000 - nAngle;
56     double fAngle = nAngle * F_PI180 / 100.0;
57     double fSin = sin( fAngle );
58     double fCos = cos( fAngle );
59     DrawText( maRect, String(), mbEnabled ? 0 : TEXT_DRAW_DISABLE );
60     const sal_Int32 nDx (fCos * (maRect.GetWidth()-4) / 2);
61     const sal_Int32 nDy (-fSin * (maRect.GetHeight()-4) / 2);
62     Point pt1( maRect.Center() );
63     Point pt2( pt1.X() + nDx, pt1.Y() + nDy);
64     if ( ! sfx2::sidebar::Theme::IsHighContrastMode())
65         SetLineColor( Color( 60, 93, 138 ) );
66     else
67         SetLineColor(COL_BLACK);//Application::GetSettings().GetStyleSettings().GetFieldTextColor()
68     DrawLine( pt1, pt2 );
69 }
70 
71 
72 
73 
74 void SidebarDialControlBmp::DrawBackground()
75 {
76     SetLineColor();
77     SetFillColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground));
78     DrawRect(maRect);
79 
80     const BitmapEx aBitmapEx(
81         sfx2::sidebar::Theme::IsHighContrastMode()
82             ? SVX_RES(IMG_DIACONTROL_H)
83             : SVX_RES(IMG_DIACONTROL_NORMAL));
84     // Size aImageSize(aBitmapEx.GetSizePixel());
85     //    aImageSize.Width() -= 1;
86     //    aImageSize.Height() -= 1;
87     SetAntialiasing(ANTIALIASING_ENABLE_B2DDRAW |  ANTIALIASING_PIXELSNAPHAIRLINE);
88     DrawBitmapEx(maRect.TopLeft(), /*aImageSize,*/ aBitmapEx);
89 }
90 
91 
92 } } // end of namespace svx::sidebar
93