LibreOffice Module svx (master) 1
dialcontrol.hxx
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#ifndef INCLUDED_SVX_DIALCONTROL_HXX
21#define INCLUDED_SVX_DIALCONTROL_HXX
22
23#include <memory>
24#include <vcl/customweld.hxx>
25#include <vcl/virdev.hxx>
26#include <svx/svxdllapi.h>
27
28class Edit;
29
30namespace svx {
31
32
34{
35public:
36 explicit DialControlBmp(OutputDevice& rReference);
37
38 void InitBitmap(const vcl::Font& rFont);
39 void SetSize(const Size& rSize);
40 void CopyBackground( const DialControlBmp& rSrc );
41 void DrawBackground( const Size& rSize, bool bEnabled );
42 void DrawBackground();
43 void DrawElements( const OUString& rText, Degree100 nAngle );
44 Color GetBackgroundColor() const override;
45
46private:
47 const Color& GetTextColor() const;
48 const Color& GetScaleLineColor() const;
49 const Color& GetButtonLineColor() const;
50 const Color& GetButtonFillColor( bool bMain ) const;
51
52 void Init();
53
59};
60
76{
77public:
78 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
79
80 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
81
82 virtual void StyleUpdated() override;
83
84 virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
85 virtual bool MouseMove( const MouseEvent& rMEvt ) override;
86 virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override;
87 virtual bool KeyInput(const KeyEvent& rKEvt) override;
88 virtual void LoseFocus() override;
89
90 virtual void Resize() override;
91
93 Degree100 GetRotation() const;
95 void SetRotation( Degree100 nAngle );
97 bool HasRotation() const;
99 void SetNoRotation();
100
107 void SetLinkedField(weld::MetricSpinButton* pField, sal_Int32 nDecimalPlaces = 0);
108
110 void SaveValue();
111
113 bool IsValueModified() const;
114
115 const OUString& GetText() const { return mpImpl->maText; }
116 void SetText(const OUString& rText) { mpImpl->maText = rText; }
117
118 void SetModifyHdl( const Link<DialControl&,void>& rLink );
119
120 void Init( const Size& rWinSize );
121
122 void set_visible(bool bVisible)
123 {
124 if (bVisible)
125 Show();
126 else
127 Hide();
128 }
129private:
130 struct SAL_DLLPRIVATE DialControl_Impl
131 {
136 OUString maText;
147
148 explicit DialControl_Impl(OutputDevice& rReference);
149 void Init( const Size& rWinSize, const vcl::Font& rWinFont );
150 void SetSize( const Size& rWinSize );
151 };
152 std::unique_ptr< DialControl_Impl > mpImpl;
153
154 void HandleMouseEvent( const Point& rPos, bool bInitial );
155 void HandleEscapeEvent();
156
157 void SetRotation( Degree100 nAngle, bool bBroadcast );
158
159 void Init( const Size& rWinSize, const vcl::Font& rWinFont );
160
161 void InvalidateControl();
162
163 DECL_DLLPRIVATE_LINK(LinkedFieldModifyHdl, weld::MetricSpinButton&, void);
164};
165
166}
167
168#endif
169
170/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long mnCenterY
Definition: dialcontrol.hxx:58
OutputDevice & mrParent
Definition: dialcontrol.hxx:56
tools::Rectangle maRect
Definition: dialcontrol.hxx:54
tools::Long mnCenterX
Definition: dialcontrol.hxx:57
This control allows to input a rotation angle, visualized by a dial.
Definition: dialcontrol.hxx:76
const OUString & GetText() const
std::unique_ptr< DialControl_Impl > mpImpl
void SetText(const OUString &rText)
void set_visible(bool bVisible)
DECL_DLLPRIVATE_LINK(LinkedFieldModifyHdl, weld::MetricSpinButton &, void)
void Init()
long Long
Color GetTextColor(Color const &rColor, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
@ MouseButtonDown
weld::MetricSpinButton * mpLinkField
ScopedVclPtr< DialControlBmp > mxBmpEnabled
ScopedVclPtr< DialControlBmp > mxBmpBuffered
Link< DialControl &, void > maModifyHdl
ScopedVclPtr< DialControlBmp > mxBmpDisabled
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
bool bVisible
#define SAL_WARN_UNUSED