LibreOffice Module svx (master)  1
dialcontrol.cxx
Go to the documentation of this file.
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 #include <svx/dialcontrol.hxx>
21 #include <cmath>
22 #include <vcl/virdev.hxx>
23 #include <vcl/svapp.hxx>
24 #include <vcl/bitmapex.hxx>
25 #include <vcl/event.hxx>
26 #include <vcl/settings.hxx>
27 #include <svtools/colorcfg.hxx>
29 
30 namespace svx {
31 
32 const long DIAL_OUTER_WIDTH = 8;
33 
36  , mbEnabled(true)
37  , mrParent(rReference)
38  , mnCenterX(0)
39  , mnCenterY(0)
40 {
41  EnableRTL(false);
42 }
43 
45 {
46  Init();
47  SetFont(rFont);
48 }
49 
51 {
52  Init();
53  SetSize(rSrc.maRect.GetSize());
54  mbEnabled = rSrc.mbEnabled;
55  Point aPos;
56  DrawBitmapEx( aPos, rSrc.GetBitmapEx( aPos, maRect.GetSize() ) );
57 }
58 
59 void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled )
60 {
61  Init();
62  SetSize(rSize);
63  mbEnabled = bEnabled;
65 }
66 
67 void DialControlBmp::DrawElements( const OUString& rText, sal_Int32 nAngle )
68 {
69  double fAngle = basegfx::deg2rad(nAngle) / 100.0;
70  double fSin = sin( fAngle );
71  double fCos = cos( fAngle );
72  double fWidth = GetTextWidth( rText ) / 2.0;
73  double fHeight = GetTextHeight() / 2.0;
74 
75  if ( !rText.isEmpty() )
76  {
77  // rotated text
78  vcl::Font aFont( GetFont() );
79  aFont.SetColor( GetTextColor() );
80  aFont.SetOrientation( static_cast< short >( (nAngle + 5) / 10 ) ); // Font uses 1/10 degrees
81  aFont.SetWeight( WEIGHT_BOLD );
82  SetFont( aFont );
83 
84  long nX = static_cast< long >( mnCenterX - fWidth * fCos - fHeight * fSin );
85  long nY = static_cast< long >( mnCenterY + fWidth * fSin - fHeight * fCos );
86  tools::Rectangle aRect( nX, nY, 2 * mnCenterX - nX, 2 * mnCenterY - nY );
87  DrawText( aRect, rText, mbEnabled ? DrawTextFlags::NONE : DrawTextFlags::Disable );
88  }
89  else
90  {
91  // only a line
92  const sal_Int32 nDx (fCos * (maRect.GetWidth()-4) / 2);
93  const sal_Int32 nDy (-fSin * (maRect.GetHeight()-4) / 2);
94  Point pt1( maRect.Center() );
95  Point pt2( pt1.X() + nDx, pt1.Y() + nDy);
96 
98  DrawLine( pt1, pt2 );
99  }
100 
101  // *** drag button ***
102 
103  bool bMain = (nAngle % 4500) != 0;
105  SetFillColor( GetButtonFillColor( bMain ) );
106 
107  long nX = mnCenterX - static_cast< long >( (DIAL_OUTER_WIDTH / 2 - mnCenterX) * fCos );
108  long nY = mnCenterY - static_cast< long >( (mnCenterY - DIAL_OUTER_WIDTH / 2) * fSin );
109  long nSize = bMain ? (DIAL_OUTER_WIDTH / 4) : (DIAL_OUTER_WIDTH / 2 - 1);
110  DrawEllipse( tools::Rectangle( nX - nSize, nY - nSize, nX + nSize, nY + nSize ) );
111 }
112 
114 {
116 }
117 
119 {
121 }
122 
124 {
125  const StyleSettings& rSett = GetSettings().GetStyleSettings();
126  return mbEnabled ? rSett.GetButtonTextColor() : rSett.GetDisableColor();
127 }
128 
130 {
131  const StyleSettings& rSett = GetSettings().GetStyleSettings();
132  return mbEnabled ? rSett.GetButtonTextColor() : rSett.GetDisableColor();
133 }
134 
135 const Color& DialControlBmp::GetButtonFillColor( bool bMain ) const
136 {
137  const StyleSettings& rSett = GetSettings().GetStyleSettings();
138  return mbEnabled ? (bMain ? rSett.GetMenuColor() : rSett.GetHighlightColor()) : rSett.GetDisableColor();
139 }
140 
142 {
145 }
146 
147 void DialControlBmp::SetSize( const Size& rSize )
148 {
149  maRect.SetPos( Point( 0, 0 ) );
150  maRect.SetSize( rSize );
151  mnCenterX = rSize.Width() / 2;
152  mnCenterY = rSize.Height() / 2;
153  SetOutputSize( rSize );
154 }
155 
157 {
158  // *** background with 3D effect ***
159 
160  SetLineColor();
161  SetFillColor();
162  Erase();
163 
164  EnableRTL(); // draw 3D effect in correct direction
165 
166  sal_uInt8 nDiff = mbEnabled ? 0x18 : 0x10;
167  Color aColor;
168 
169  aColor = GetBackgroundColor();
170  SetFillColor( aColor );
173 
174  aColor.DecreaseLuminance( nDiff );
175  SetFillColor( aColor );
177 
178  aColor.DecreaseLuminance( nDiff );
179  SetFillColor( aColor );
181 
182  aColor = GetBackgroundColor();
183  aColor.IncreaseLuminance( nDiff );
184  SetFillColor( aColor );
186 
187  aColor.IncreaseLuminance( nDiff );
188  SetFillColor( aColor );
190 
191  EnableRTL( false );
192 
193  // *** calibration ***
194 
195  Point aStartPos( mnCenterX, mnCenterY );
196  Color aFullColor( GetScaleLineColor() );
197  Color aLightColor( GetBackgroundColor() );
198  aLightColor.Merge( aFullColor, 128 );
199 
200  for( int nAngle = 0; nAngle < 360; nAngle += 15 )
201  {
202  SetLineColor( (nAngle % 45) ? aLightColor : aFullColor );
203  double fAngle = basegfx::deg2rad(nAngle);
204  long nX = static_cast< long >( -mnCenterX * cos( fAngle ) );
205  long nY = static_cast< long >( mnCenterY * sin( fAngle ) );
206  DrawLine( aStartPos, Point( mnCenterX - nX, mnCenterY - nY ) );
207  }
208 
209  // *** clear inner area ***
210 
211  SetLineColor();
213  tools::Rectangle aEllipseRect = maRect;
214  aEllipseRect.shrink(DIAL_OUTER_WIDTH);
215  DrawEllipse( aEllipseRect );
216 }
217 
218 
220  mxBmpEnabled(VclPtr<DialControlBmp>::Create(rParent)),
221  mxBmpDisabled(VclPtr<DialControlBmp>::Create(rParent)),
222  mxBmpBuffered(VclPtr<DialControlBmp>::Create(rParent)),
223  mpLinkField( nullptr ),
224  mnLinkedFieldValueMultiplyer( 0 ),
225  mnAngle( 0 ),
226  mnOldAngle( 0 ),
227  mnCenterX( 0 ),
228  mnCenterY( 0 ),
229  mbNoRot( false )
230 {
231 }
232 
233 void DialControl::DialControl_Impl::Init( const Size& rWinSize, const vcl::Font& rWinFont )
234 {
235  maWinFont = rWinFont;
236  maWinFont.SetTransparent(true);
237  mxBmpBuffered->InitBitmap(maWinFont);
238  SetSize(rWinSize);
239 }
240 
242 {
243  // make the control squared, and adjusted so that we have a well-defined
244  // center ["(x - 1) | 1" creates odd value <= x]
245  long nMin = (std::min(rWinSize.Width(), rWinSize.Height()) - 1) | 1;
246 
247  maWinSize = Size( nMin, nMin );
248 
249  mnCenterX = maWinSize.Width() / 2;
250  mnCenterY = maWinSize.Height() / 2;
251 
252  mxBmpEnabled->DrawBackground( maWinSize, true );
253  mxBmpDisabled->DrawBackground( maWinSize, false );
254  mxBmpBuffered->SetSize( maWinSize );
255 }
256 
257 
259  Control( pParent, nBits ),
260  mpImpl( new DialControl_Impl( *this ) )
261 {
263 }
264 
266 {
267  mpImpl->SetSize(GetOutputSizePixel());
269 }
270 
272 {
273  Point aPos;
274  rRenderContext.DrawBitmapEx(aPos, mpImpl->mxBmpBuffered->GetBitmapEx(aPos, mpImpl->maWinSize));
275 }
276 
278 {
279  if( nStateChange == StateChangedType::Enable )
281 
282  // update the linked edit field
283  if( mpImpl->mpLinkField )
284  {
285  NumericField& rField = *mpImpl->mpLinkField;
286  switch( nStateChange )
287  {
288  case StateChangedType::Visible: rField.Show( IsVisible() ); break;
289  case StateChangedType::Enable: rField.Enable( IsEnabled() ); break;
290  default:;
291  }
292  }
293 
294  Control::StateChanged( nStateChange );
295 }
296 
298 {
299  if( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
300  {
301  Init( mpImpl->maWinSize, mpImpl->maWinFont );
303  }
304  Control::DataChanged( rDCEvt );
305 }
306 
308 {
309  if( rMEvt.IsLeft() )
310  {
311  GrabFocus();
312  CaptureMouse();
313  mpImpl->mnOldAngle = mpImpl->mnAngle;
314  HandleMouseEvent( rMEvt.GetPosPixel(), true );
315  }
316  Control::MouseButtonDown( rMEvt );
317 }
318 
319 void DialControl::MouseMove( const MouseEvent& rMEvt )
320 {
321  if( IsMouseCaptured() && rMEvt.IsLeft() )
322  HandleMouseEvent( rMEvt.GetPosPixel(), false );
323  Control::MouseMove(rMEvt );
324 }
325 
327 {
328  if( IsMouseCaptured() )
329  {
330  ReleaseMouse();
331  if( mpImpl->mpLinkField )
332  mpImpl->mpLinkField->GrabFocus();
333  }
334  Control::MouseButtonUp( rMEvt );
335 }
336 
337 void DialControl::KeyInput( const KeyEvent& rKEvt )
338 {
339  const vcl::KeyCode& rKCode = rKEvt.GetKeyCode();
340  if( !rKCode.GetModifier() && (rKCode.GetCode() == KEY_ESCAPE) )
342  else
343  Control::KeyInput( rKEvt );
344 }
345 
347 {
348  // release captured mouse
351 }
352 
353 sal_Int32 DialControl::GetRotation() const
354 {
355  return mpImpl->mnAngle;
356 }
357 
359 {
360  return LogicToPixel(Size(42, 43), MapMode(MapUnit::MapAppFont));
361 }
362 
363 void DialControl::SetRotation( sal_Int32 nAngle )
364 {
365  SetRotation( nAngle, false );
366 }
367 
369 {
370  mpImpl->maModifyHdl = rLink;
371 }
372 
373 void DialControl::Init( const Size& rWinSize, const vcl::Font& rWinFont )
374 {
375  mpImpl->Init( rWinSize, rWinFont );
376  EnableRTL( false ); // don't mirror mouse handling
377  SetOutputSizePixel( mpImpl->maWinSize );
378  SetBackground();
379 }
380 
381 void DialControl::Init( const Size& rWinSize )
382 {
383  //hidpi TODO: GetDefaultFont() picks a font size too small, so fix it here.
384  vcl::Font aDefaultSize = GetFont();
385 
387  DefaultFontType::UI_SANS, Application::GetSettings().GetUILanguageTag().getLanguageType(), GetDefaultFontFlags::OnlyOne ) );
388 
389  aFont.SetFontHeight(aDefaultSize.GetFontHeight());
390  Init( rWinSize, aFont );
391 }
392 
394 {
395  mpImpl->mxBmpBuffered->CopyBackground( IsEnabled() ? *mpImpl->mxBmpEnabled : *mpImpl->mxBmpDisabled );
396  if( !mpImpl->mbNoRot )
397  mpImpl->mxBmpBuffered->DrawElements( GetText(), mpImpl->mnAngle );
398  Invalidate();
399 }
400 
401 void DialControl::SetRotation( sal_Int32 nAngle, bool bBroadcast )
402 {
403  bool bOldSel = mpImpl->mbNoRot;
404  mpImpl->mbNoRot = false;
405 
406  while( nAngle < 0 )
407  nAngle += 36000;
408 
409  if( !bOldSel || (mpImpl->mnAngle != nAngle) )
410  {
411  mpImpl->mnAngle = nAngle;
413  if( mpImpl->mpLinkField )
414  mpImpl->mpLinkField->SetValue( static_cast< long >( GetRotation() / mpImpl->mnLinkedFieldValueMultiplyer ) );
415  if( bBroadcast )
416  mpImpl->maModifyHdl.Call( this );
417  }
418 }
419 
420 void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial )
421 {
422  long nX = rPos.X() - mpImpl->mnCenterX;
423  long nY = mpImpl->mnCenterY - rPos.Y();
424  double fH = sqrt( static_cast< double >( nX ) * nX + static_cast< double >( nY ) * nY );
425  if( fH != 0.0 )
426  {
427  double fAngle = acos( nX / fH );
428  sal_Int32 nAngle = static_cast<sal_Int32>(basegfx::rad2deg(fAngle) * 100.0);
429  if( nY < 0 )
430  nAngle = 36000 - nAngle;
431  if( bInitial ) // round to entire 15 degrees
432  nAngle = ((nAngle + 750) / 1500) * 1500;
433  // Round up to 1 degree
434  nAngle = (((nAngle + 50) / 100) * 100) % 36000;
435  SetRotation( nAngle, true );
436  }
437 }
438 
440 {
441  if( IsMouseCaptured() )
442  {
443  ReleaseMouse();
444  SetRotation( mpImpl->mnOldAngle, true );
445  if( mpImpl->mpLinkField )
446  mpImpl->mpLinkField->GrabFocus();
447  }
448 }
449 
451  mxBmpEnabled(VclPtr<DialControlBmp>::Create(rReference)),
452  mxBmpDisabled(VclPtr<DialControlBmp>::Create(rReference)),
453  mxBmpBuffered(VclPtr<DialControlBmp>::Create(rReference)),
454  mpLinkField( nullptr ),
455  mnLinkedFieldValueMultiplyer( 0 ),
456  mnAngle( 0 ),
457  mnInitialAngle( 0 ),
458  mnOldAngle( 0 ),
459  mnCenterX( 0 ),
460  mnCenterY( 0 ),
461  mbNoRot( false )
462 {
463 }
464 
465 void SvxDialControl::DialControl_Impl::Init( const Size& rWinSize, const vcl::Font& rWinFont )
466 {
467  maWinFont = rWinFont;
468  maWinFont.SetTransparent(true);
469  mxBmpBuffered->InitBitmap(maWinFont);
470  SetSize(rWinSize);
471 }
472 
474 {
475  // make the control squared, and adjusted so that we have a well-defined
476  // center ["(x - 1) | 1" creates odd value <= x]
477  long nMin = (std::min(rWinSize.Width(), rWinSize.Height()) - 1) | 1;
478 
479  maWinSize = Size( nMin, nMin );
480 
481  mnCenterX = maWinSize.Width() / 2;
482  mnCenterY = maWinSize.Height() / 2;
483 
484  mxBmpEnabled->DrawBackground( maWinSize, true );
485  mxBmpDisabled->DrawBackground( maWinSize, false );
486  mxBmpBuffered->SetSize( maWinSize );
487 }
488 
490 {
491  CustomWidgetController::SetDrawingArea(pDrawingArea);
492  //use same logic as DialControl_Impl::SetSize
493  int nDim = (std::min<int>(pDrawingArea->get_approximate_digit_width() * 12,
494  pDrawingArea->get_text_height() * 6) - 1) | 1;
495  pDrawingArea->set_size_request(nDim, nDim);
496  mpImpl.reset(new DialControl_Impl(pDrawingArea->get_ref_device()));
497  //set size and use that
499 }
500 
502 {
503  mpImpl->SetSize(GetOutputSizePixel());
505 }
506 
508 {
509  Point aPos;
510  rRenderContext.DrawBitmapEx(aPos, mpImpl->mxBmpBuffered->GetBitmapEx(aPos, mpImpl->maWinSize));
511 }
512 
514 {
515  CustomWidgetController::StyleUpdated();
516  Init( mpImpl->maWinSize, mpImpl->maWinFont );
518 }
519 
521 {
522  if( rMEvt.IsLeft() )
523  {
524  GrabFocus();
525  CaptureMouse();
526  mpImpl->mnOldAngle = mpImpl->mnAngle;
527  HandleMouseEvent( rMEvt.GetPosPixel(), true );
528  }
529  return true;
530 }
531 
533 {
534  if( IsMouseCaptured() && rMEvt.IsLeft() )
535  HandleMouseEvent( rMEvt.GetPosPixel(), false );
536  return true;
537 }
538 
540 {
541  if( IsMouseCaptured() )
542  {
543  ReleaseMouse();
544  if( mpImpl->mpLinkField )
545  mpImpl->mpLinkField->grab_focus();
546  }
547  return true;
548 }
549 
550 bool SvxDialControl::KeyInput( const KeyEvent& rKEvt )
551 {
552  const vcl::KeyCode& rKCode = rKEvt.GetKeyCode();
553  if( !rKCode.GetModifier() && (rKCode.GetCode() == KEY_ESCAPE) )
554  {
556  return true;
557  }
558  return CustomWidgetController::KeyInput(rKEvt);
559 }
560 
562 {
563  // release captured mouse
565 }
566 
568 {
569  return !mpImpl->mbNoRot;
570 }
571 
573 {
574  if( !mpImpl->mbNoRot )
575  {
576  mpImpl->mbNoRot = true;
578  if (mpImpl->mpLinkField)
579  mpImpl->mpLinkField->set_text("");
580  }
581 }
582 
584 {
585  return mpImpl->mnAngle;
586 }
587 
588 void SvxDialControl::SetLinkedField(weld::SpinButton* pField, sal_Int32 nDecimalPlaces)
589 {
590  mpImpl->mnLinkedFieldValueMultiplyer = 100 / std::pow(10.0, double(nDecimalPlaces));
591 
592  // remove modify handler from old linked field
593  if( mpImpl->mpLinkField )
594  {
595  weld::SpinButton& rField = *mpImpl->mpLinkField;
597  }
598  // remember the new linked field
599  mpImpl->mpLinkField = pField;
600  // set modify handler at new linked field
601  if( mpImpl->mpLinkField )
602  {
603  weld::SpinButton& rField = *mpImpl->mpLinkField;
605  }
606 }
607 
609 {
611 }
612 
614 {
615  if( mpImpl->mpLinkField )
616  SetRotation(mpImpl->mpLinkField->get_value() * mpImpl->mnLinkedFieldValueMultiplyer);
617 }
618 
620 {
621  mpImpl->mnInitialAngle = mpImpl->mnAngle;
622 }
623 
625 {
626  return mpImpl->mnInitialAngle != mpImpl->mnAngle;
627 }
628 
629 void SvxDialControl::Init( const Size& rWinSize, const vcl::Font& rWinFont )
630 {
631  mpImpl->Init( rWinSize, rWinFont );
632  EnableRTL( false ); // don't mirror mouse handling
633  SetOutputSizePixel( mpImpl->maWinSize );
634 }
635 
636 void SvxDialControl::Init( const Size& rWinSize )
637 {
638  //hidpi TODO: GetDefaultFont() picks a font size too small, so fix it here.
640 
642  DefaultFontType::UI_SANS, Application::GetSettings().GetUILanguageTag().getLanguageType(), GetDefaultFontFlags::OnlyOne ) );
643 
644  aFont.SetFontHeight(aDefaultSize.GetFontHeight());
645  Init( rWinSize, aFont );
646 }
647 
649 {
650  mpImpl->mxBmpBuffered->CopyBackground( IsEnabled() ? *mpImpl->mxBmpEnabled : *mpImpl->mxBmpDisabled );
651  if( !mpImpl->mbNoRot )
652  mpImpl->mxBmpBuffered->DrawElements(GetText(), mpImpl->mnAngle);
653  Invalidate();
654 }
655 
656 void SvxDialControl::SetRotation(sal_Int32 nAngle)
657 {
658  bool bOldSel = mpImpl->mbNoRot;
659  mpImpl->mbNoRot = false;
660 
661  while (nAngle < 0)
662  nAngle += 36000;
663 
664  if (!bOldSel || (mpImpl->mnAngle != nAngle))
665  {
666  mpImpl->mnAngle = nAngle;
668  if( mpImpl->mpLinkField )
669  mpImpl->mpLinkField->set_value(GetRotation() / mpImpl->mnLinkedFieldValueMultiplyer);
670  }
671 }
672 
673 void SvxDialControl::HandleMouseEvent( const Point& rPos, bool bInitial )
674 {
675  long nX = rPos.X() - mpImpl->mnCenterX;
676  long nY = mpImpl->mnCenterY - rPos.Y();
677  double fH = sqrt( static_cast< double >( nX ) * nX + static_cast< double >( nY ) * nY );
678  if( fH != 0.0 )
679  {
680  double fAngle = acos( nX / fH );
681  sal_Int32 nAngle = static_cast<sal_Int32>(basegfx::rad2deg(fAngle) * 100.0);
682  if( nY < 0 )
683  nAngle = 36000 - nAngle;
684  if( bInitial ) // round to entire 15 degrees
685  nAngle = ((nAngle + 750) / 1500) * 1500;
686  // Round up to 1 degree
687  nAngle = (((nAngle + 50) / 100) * 100) % 36000;
688  SetRotation( nAngle );
689  }
690 }
691 
693 {
694  if( IsMouseCaptured() )
695  {
696  ReleaseMouse();
697  SetRotation( mpImpl->mnOldAngle );
698  if( mpImpl->mpLinkField )
699  mpImpl->mpLinkField->grab_focus();
700  }
701 }
702 
703 }
704 
705 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
DialControl_Impl(vcl::Window &rParent)
long Width() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
void SetPos(const Point &rPoint)
virtual void EnableRTL(bool bEnable=true) override
const Color & GetButtonLineColor() const
virtual void MouseMove(const MouseEvent &rMEvt) override
long GetWidth() const
void Init(const Size &rWinSize, const vcl::Font &rWinFont)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
void CaptureMouse()
void Init(const Size &rWinSize, const vcl::Font &rWinFont)
const Color & GetDialogColor() const
IMPL_LINK_NOARG(SuggestionDisplay, SelectSuggestionValueSetHdl, SvtValueSet *, void)
long GetHeight() const
virtual void LoseFocus() override
void SetSize(const Size &rSize)
long GetFontHeight() const
void SetNoRotation()
Sets the control to "don't care" state.
virtual void MouseButtonDown(const MouseEvent &rMEvt)
void Merge(const Color &rMergeColor, sal_uInt8 cTransparency)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
void SetModifyHdl(const Link< DialControl *, void > &rLink)
The passed handler is called whenever the rotation value changes.
long Height() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
Point BottomLeft() const
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
void SetLinkedField(weld::SpinButton *pField, sal_Int32 nDecimalPlaces=0)
Links the passed numeric edit field to the control (bi-directional).
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
virtual void StateChanged(StateChangedType nStateChange) override
void SetSize(const Size &rWinSize)
void SetWeight(FontWeight)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
const Color & GetScaleLineColor() const
sal_uInt16 GetCode() const
DataChangedEventType GetType() const
const Color & GetLabelTextColor() const
virtual void SetSettings(const AllSettings &rSettings)
tools::Rectangle maRect
Definition: dialcontrol.hxx:56
virtual void MouseButtonUp(const MouseEvent &rMEvt)
void SetOrientation(short nLineOrientation)
constexpr double rad2deg(double v)
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
const Color & GetHighlightColor() const
Size const & GetOutputSizePixel() const
void InitBitmap(const vcl::Font &rFont)
Definition: dialcontrol.cxx:44
virtual void StyleUpdated() override
Point RightCenter() const
WEIGHT_BOLD
StateChangedType
sal_Int64 WinBits
void SetBackground()
void CopyBackground(const DialControlBmp &rSrc)
Definition: dialcontrol.cxx:50
virtual void StateChanged(StateChangedType nStateChange) override
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
void Enable(bool bEnable=true, bool bChild=true)
const vcl::Font & GetLabelFont() const
const vcl::Font & GetFont() const
Point BottomCenter() const
std::unique_ptr< DialControl_Impl > mpImpl
AllSettingsFlags GetFlags() const
bool IsValueModified() const
Compare value with the saved value.
OutputDevice & mrParent
Definition: dialcontrol.hxx:58
const Color & GetTextColor() const
virtual void SetOutputSizePixel(const Size &rNewSize)
sal_uInt16 GetModifier() const
virtual OUString GetText() const
virtual OutputDevice & get_ref_device()=0
Point LeftCenter() const
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SaveValue()
Save value for later comparison.
const Color & GetMenuColor() const
void DrawElements(const OUString &rText, sal_Int32 nAngle)
Definition: dialcontrol.cxx:67
Point BottomRight() const
void SetLineColor()
const Color & GetDisableColor() const
void SetRotation(sal_Int32 nAngle)
Sets the rotation to the passed value (in 1/100 degrees).
virtual void HandleMouseEvent(const Point &rPos, bool bInitial)
void HandleMouseEvent(const Point &rPos, bool bInitial)
void DecreaseLuminance(sal_uInt8 cLumDec)
virtual Size GetOptimalSize() const override
virtual void EnableRTL(bool bEnable=true) override
void SetSize(const Size &rSize)
void InvalidateControl()
#define KEY_ESCAPE
bool HasRotation() const
Returns true, if the control is not in "don't care" state.
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
bool SetOutputSize(const Size &rNewSize)
virtual bool KeyInput(const KeyEvent &rKEvt) override
void SetFillColor()
virtual void Resize() override
constexpr double deg2rad(double v)
bool IsMouseCaptured() const
const long DIAL_OUTER_WIDTH
Definition: dialcontrol.cxx:32
const AllSettings & GetSettings() const
Size GetOutputSizePixel() const
void DrawPie(const tools::Rectangle &rRect, const Point &rStartPt, const Point &rEndPt)
void Init(const Size &rWinSize, const vcl::Font &rWinFont)
virtual void LoseFocus()
void GrabFocus()
Color GetBackgroundColor() const override
long GetTextHeight() const
void SetOutputSizePixel(const Size &rSize)
long X() const
Size GetSize() const
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
void shrink(long nShrinkBy)
DialControl(vcl::Window *pParent, WinBits nBits)
const OUString & GetText() const
void SetColor(const Color &)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Point LogicToPixel(const Point &rLogicPt) const
void ReleaseMouse()
virtual void KeyInput(const KeyEvent &rKEvt)
virtual bool MouseMove(const MouseEvent &rMEvt) override
DeviceFormat
std::unique_ptr< DialControl_Impl > mpImpl
const vcl::KeyCode & GetKeyCode() const
virtual void Resize() override
void HandleEscapeEvent()
void SetSize(const Size &rWinSize)
const Color & GetButtonTextColor() const
unsigned char sal_uInt8
void SetFont(const vcl::Font &rNewFont)
void SetTransparent(bool bTransparent)
bool IsVisible() const
bool IsLeft() const
virtual int get_text_height() const =0
virtual void LoseFocus() override
void SetFontHeight(long nHeight)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
const Point & GetPosPixel() const
sal_Int32 GetRotation() const
Returns the current rotation angle in 1/100 degrees.
long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
void DrawEllipse(const tools::Rectangle &rRect)
BitmapEx GetBitmapEx(const Point &rSrcPt, const Size &rSize) const
void Init(const Size &rWinSize, const vcl::Font &rWinFont)
sal_Int32 GetRotation() const
Returns the current rotation angle in 1/100 degrees.
bool IsEnabled() const
virtual void MouseMove(const MouseEvent &rMEvt)
DialControlBmp(OutputDevice &rReference)
Definition: dialcontrol.cxx:34
const Color & GetButtonFillColor(bool bMain) const
virtual void set_size_request(int nWidth, int nHeight)=0
virtual void KeyInput(const KeyEvent &rKEvt) override
BaseContainerNodeSharedPtr & mrParent
Point TopRight() const
virtual float get_approximate_digit_width() const =0
sal_Int32 mnAngle
Point Center() const
long Y() const
void connect_value_changed(const Link< SpinButton &, void > &rLink)
Point TopCenter() const
DialControl_Impl(OutputDevice &rReference)
virtual void DataChanged(const DataChangedEvent &rDCEvt)
void EnableRTL(bool bEnable)
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
void SetRotation(sal_Int32 nAngle)
Sets the rotation to the passed value (in 1/100 degrees).