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