70 double fSin = sin( fAngle );
71 double fCos = cos( fAngle );
75 if ( !rText.isEmpty() )
84 long nX =
static_cast< long >(
mnCenterX - fWidth * fCos - fHeight * fSin );
85 long nY =
static_cast< long >(
mnCenterY + fWidth * fSin - fHeight * fCos );
87 DrawText( aRect, rText,
mbEnabled ? DrawTextFlags::NONE : DrawTextFlags::Disable );
95 Point pt2( pt1.X() + nDx, pt1.Y() + nDy);
103 bool bMain = (nAngle % 4500) != 0;
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);
183 aColor.IncreaseLuminance( nDiff );
187 aColor.IncreaseLuminance( nDiff );
198 aLightColor.
Merge( aFullColor, 128 );
200 for(
int nAngle = 0; nAngle < 360; nAngle += 15 )
202 SetLineColor( (nAngle % 45) ? aLightColor : aFullColor );
204 long nX =
static_cast< long >( -
mnCenterX * cos( fAngle ) );
205 long nY =
static_cast< long >(
mnCenterY * sin( fAngle ) );
214 aEllipseRect.
shrink(DIAL_OUTER_WIDTH);
223 mpLinkField( nullptr ),
224 mnLinkedFieldValueMultiplyer( 0 ),
235 maWinFont = rWinFont;
237 mxBmpBuffered->InitBitmap(maWinFont);
245 long nMin = (std::min(rWinSize.
Width(), rWinSize.
Height()) - 1) | 1;
247 maWinSize =
Size( nMin, nMin );
249 mnCenterX = maWinSize.Width() / 2;
250 mnCenterY = maWinSize.Height() / 2;
252 mxBmpEnabled->DrawBackground( maWinSize,
true );
253 mxBmpDisabled->DrawBackground( maWinSize,
false );
254 mxBmpBuffered->SetSize( maWinSize );
279 if( nStateChange == StateChangedType::Enable )
286 switch( nStateChange )
288 case StateChangedType::Visible: rField.
Show(
IsVisible() );
break;
299 if( (rDCEvt.
GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.
GetFlags() & AllSettingsFlags::STYLE) )
332 mpImpl->mpLinkField->GrabFocus();
370 mpImpl->maModifyHdl = rLink;
375 mpImpl->Init( rWinSize, rWinFont );
387 DefaultFontType::UI_SANS,
Application::GetSettings().GetUILanguageTag().getLanguageType(), GetDefaultFontFlags::OnlyOne ) );
390 Init( rWinSize, aFont );
403 bool bOldSel =
mpImpl->mbNoRot;
409 if( !bOldSel || (
mpImpl->mnAngle != nAngle) )
416 mpImpl->maModifyHdl.Call(
this );
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 );
427 double fAngle = acos( nX / fH );
428 sal_Int32 nAngle =
static_cast<sal_Int32
>(
basegfx::rad2deg(fAngle) * 100.0);
430 nAngle = 36000 - nAngle;
432 nAngle = ((nAngle + 750) / 1500) * 1500;
434 nAngle = (((nAngle + 50) / 100) * 100) % 36000;
446 mpImpl->mpLinkField->GrabFocus();
454 mpLinkField( nullptr ),
455 mnLinkedFieldValueMultiplyer( 0 ),
467 maWinFont = rWinFont;
469 mxBmpBuffered->InitBitmap(maWinFont);
477 long nMin = (std::min(rWinSize.
Width(), rWinSize.
Height()) - 1) | 1;
479 maWinSize =
Size( nMin, nMin );
481 mnCenterX = maWinSize.Width() / 2;
482 mnCenterY = maWinSize.Height() / 2;
484 mxBmpEnabled->DrawBackground( maWinSize,
true );
485 mxBmpDisabled->DrawBackground( maWinSize,
false );
486 mxBmpBuffered->SetSize( maWinSize );
491 CustomWidgetController::SetDrawingArea(pDrawingArea);
515 CustomWidgetController::StyleUpdated();
545 mpImpl->mpLinkField->grab_focus();
558 return CustomWidgetController::KeyInput(rKEvt);
579 mpImpl->mpLinkField->set_text(
"");
590 mpImpl->mnLinkedFieldValueMultiplyer = 100 / std::pow(10.0,
double(nDecimalPlaces));
599 mpImpl->mpLinkField = pField;
631 mpImpl->Init( rWinSize, rWinFont );
642 DefaultFontType::UI_SANS,
Application::GetSettings().GetUILanguageTag().getLanguageType(), GetDefaultFontFlags::OnlyOne ) );
645 Init( rWinSize, aFont );
658 bool bOldSel =
mpImpl->mbNoRot;
664 if (!bOldSel || (
mpImpl->mnAngle != nAngle))
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 );
680 double fAngle = acos( nX / fH );
681 sal_Int32 nAngle =
static_cast<sal_Int32
>(
basegfx::rad2deg(fAngle) * 100.0);
683 nAngle = 36000 - nAngle;
685 nAngle = ((nAngle + 750) / 1500) * 1500;
687 nAngle = (((nAngle + 50) / 100) * 100) % 36000;
699 mpImpl->mpLinkField->grab_focus();
#define LINK(Instance, Class, Member)
DialControl_Impl(vcl::Window &rParent)
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)
virtual void EnableRTL(bool bEnable=true) override
const Color & GetButtonLineColor() const
virtual void MouseMove(const MouseEvent &rMEvt) override
void Init(const Size &rWinSize, const vcl::Font &rWinFont)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
void Init(const Size &rWinSize, const vcl::Font &rWinFont)
const Color & GetDialogColor() const
IMPL_LINK_NOARG(SuggestionDisplay, SelectSuggestionValueSetHdl, SvtValueSet *, void)
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 LinkedFieldModifyHdl()
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.
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
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)
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
void InitBitmap(const vcl::Font &rFont)
virtual void StyleUpdated() override
void CopyBackground(const DialControlBmp &rSrc)
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
std::unique_ptr< DialControl_Impl > mpImpl
AllSettingsFlags GetFlags() const
bool IsValueModified() const
Compare value with the saved value.
const Color & GetTextColor() const
virtual void SetOutputSizePixel(const Size &rNewSize)
sal_uInt16 GetModifier() const
virtual OUString GetText() const
virtual OutputDevice & get_ref_device()=0
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)
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
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
virtual void Resize() override
constexpr double deg2rad(double v)
bool IsMouseCaptured() const
const long DIAL_OUTER_WIDTH
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)
Color GetBackgroundColor() const override
long GetTextHeight() const
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
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
virtual void KeyInput(const KeyEvent &rKEvt)
virtual bool MouseMove(const MouseEvent &rMEvt) override
std::unique_ptr< DialControl_Impl > mpImpl
const vcl::KeyCode & GetKeyCode() const
virtual void Resize() override
void SetSize(const Size &rWinSize)
const Color & GetButtonTextColor() const
void SetFont(const vcl::Font &rNewFont)
void SetTransparent(bool bTransparent)
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.
virtual void MouseMove(const MouseEvent &rMEvt)
DialControlBmp(OutputDevice &rReference)
const Color & GetButtonFillColor(bool bMain) const
virtual void KeyInput(const KeyEvent &rKEvt) override
BaseContainerNodeSharedPtr & mrParent
DialControl_Impl(OutputDevice &rReference)
virtual void DataChanged(const DataChangedEvent &rDCEvt)
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).