LibreOffice Module svx (master) 1
frmsel.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_FRMSEL_HXX
21#define INCLUDED_SVX_FRMSEL_HXX
22
23#include <memory>
24#include <vcl/customweld.hxx>
27#include <svx/svxdllapi.h>
29
30class Color;
31
32enum class FrameSelFlags
33{
34 NONE = 0x0000,
36 Left = 0x0001,
38 Right = 0x0002,
40 Top = 0x0004,
42 Bottom = 0x0008,
44 InnerHorizontal = 0x0010,
46 InnerVertical = 0x0020,
48 DiagonalTLBR = 0x0040,
50 DiagonalBLTR = 0x0080,
51
53 Outer = Left | Right | Top | Bottom,
54
56 DontCare = 0x0100
57};
58namespace o3tl
59{
60 template<> struct typed_flags<FrameSelFlags> : is_typed_flags<FrameSelFlags, 0x1ff> {};
61}
62
63namespace svx {
64
65struct FrameSelectorImpl;
66namespace a11y { class AccFrameSelectorChild; }
67
70{
71 Show,
72 Hide,
74};
75
76
77namespace a11y
78{
79 class AccFrameSelector;
80}
81
83{
84public:
86 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
87 virtual ~FrameSelector() override;
88
90 void Initialize( FrameSelFlags nFlags );
91
92 // enabled frame borders
93
95 bool IsBorderEnabled( FrameBorderType eBorder ) const;
97 sal_Int32 GetEnabledBorderCount() const;
99 FrameBorderType GetEnabledBorderType( sal_Int32 nIndex ) const;
100
101 // frame border state and style
102
104 bool SupportsDontCareState() const;
105
107 FrameBorderState GetFrameBorderState( FrameBorderType eBorder ) const;
109 const editeng::SvxBorderLine* GetFrameBorderStyle( FrameBorderType eBorder ) const;
110
112 void ShowBorder( FrameBorderType eBorder, const editeng::SvxBorderLine* pStyle );
114 void SetBorderDontCare( FrameBorderType eBorder );
115
117 bool IsAnyBorderVisible() const;
119 void HideAllBorders();
120
124 bool GetVisibleWidth( tools::Long& rnWidth, SvxBorderLineStyle& rnStyle ) const;
128 bool GetVisibleColor( Color& rColor ) const;
129
130 // frame border selection
131
133 const Link<LinkParamNone*,void>& GetSelectHdl() const;
135 void SetSelectHdl( const Link<LinkParamNone*,void>& rHdl );
136
138 bool IsBorderSelected( FrameBorderType eBorder ) const;
140 void SelectBorder( FrameBorderType eBorder );
142 bool IsAnyBorderSelected() const;
144 void SelectAllBorders( bool bSelect );
146 void DeselectAllBorders() { SelectAllBorders( false ); }
147
149 void SelectAllVisibleBorders();
150
152 void SetStyleToSelection( tools::Long nWidth, SvxBorderLineStyle nStyle );
154 void SetColorToSelection(const Color& rColor, model::ComplexColor const& rComplexColor);
155
156 SvxBorderLineStyle getCurrentStyleLineStyle() const;
157
158 // accessibility
159
160 css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() const { return GetDrawingArea()->get_accessible_parent(); }
161 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
162 a11yrelationset get_accessible_relation_set() const { return GetDrawingArea()->get_accessible_relation_set(); }
163
166 GetChildAccessible( FrameBorderType eBorder );
168 css::uno::Reference< css::accessibility::XAccessible >
169 GetChildAccessible( sal_Int32 nIndex );
171 css::uno::Reference< css::accessibility::XAccessible >
172 GetChildAccessible( const Point& rPos );
173
175 tools::Rectangle GetClickBoundRect( FrameBorderType eBorder ) const;
176
177private:
178 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
179 virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
180 virtual bool KeyInput( const KeyEvent& rKEvt ) override;
181 virtual void GetFocus() override;
182 virtual void LoseFocus() override;
183 virtual void StyleUpdated() override;
184 virtual void Resize() override;
185
187 std::unique_ptr< FrameSelectorImpl > mxImpl;
188};
189
190}
191
192#endif
193
194/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxBorderLineStyle
void DeselectAllBorders()
Deselects all frame borders.
Definition: frmsel.hxx:146
a11yrelationset get_accessible_relation_set() const
Definition: frmsel.hxx:162
std::unique_ptr< FrameSelectorImpl > mxImpl
Pointer to accessibility object of the control.
Definition: frmsel.hxx:187
css::uno::Reference< css::accessibility::XAccessible > getAccessibleParent() const
Definition: frmsel.hxx:160
rtl::Reference< a11y::AccFrameSelector > mxAccess
Definition: frmsel.hxx:186
FrameSelFlags
Definition: frmsel.hxx:33
@ InnerHorizontal
If set, the inner horizontal frame border is enabled.
@ DiagonalBLTR
If set, the bottom-left to top-right diagonal frame border is enabled.
@ DiagonalTLBR
If set, the top-left to bottom-right diagonal frame border is enabled.
@ Outer
If set, all four outer frame borders are enabled.
@ InnerVertical
If set, the inner vertical frame border is enabled.
sal_Int32 nIndex
NONE
FrameBorderType
Enumerates all borders a frame selection control can contain.
FrameBorderState
All possible states of a frame border.
Definition: frmsel.hxx:70
long Long
@ MouseButtonDown
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
Left
Right
#define SAL_WARN_UNUSED
css::uno::Reference< css::accessibility::XAccessibleRelationSet > a11yrelationset