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>
25 #include <editeng/borderline.hxx>
26 #include <svx/framebordertype.hxx>
27 #include <svx/svxdllapi.h>
28 #include <o3tl/typed_flags_set.hxx>
29 
30 class Color;
31 
32 enum 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 };
58 namespace o3tl
59 {
60  template<> struct typed_flags<FrameSelFlags> : is_typed_flags<FrameSelFlags, 0x1ff> {};
61 }
62 
63 namespace svx {
64 
65 struct FrameSelectorImpl;
66 namespace a11y { class AccFrameSelectorChild; }
67 
69 enum class FrameBorderState
70 {
71  Show,
72  Hide,
73  DontCare
74 };
75 
76 
77 namespace a11y
78 {
79  class AccFrameSelector;
80 }
81 
83 {
84 public:
85  FrameSelector();
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( 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( long nWidth, SvxBorderLineStyle nStyle );
154  void SetColorToSelection( const Color& rColor );
155 
156  // accessibility
157 
158  css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() const { return GetDrawingArea()->get_accessible_parent(); }
159  virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
160  a11yrelationset get_accessible_relation_set() const { return GetDrawingArea()->get_accessible_relation_set(); }
161 
164  GetChildAccessible( FrameBorderType eBorder );
166  css::uno::Reference< css::accessibility::XAccessible >
167  GetChildAccessible( sal_Int32 nIndex );
169  css::uno::Reference< css::accessibility::XAccessible >
170  GetChildAccessible( const Point& rPos );
171 
173  tools::Rectangle GetClickBoundRect( FrameBorderType eBorder ) const;
174 
175 private:
176  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
177  virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
178  virtual bool KeyInput( const KeyEvent& rKEvt ) override;
179  virtual void GetFocus() override;
180  virtual void LoseFocus() override;
181  virtual void StyleUpdated() override;
182  virtual void Resize() override;
183 
185  std::unique_ptr< FrameSelectorImpl > mxImpl;
186 };
187 
188 }
189 
190 #endif
191 
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
If set, the top frame border is enabled.
sal_Int32 nIndex
If set, the inner horizontal frame border is enabled.
css::uno::Reference< css::accessibility::XAccessibleRelationSet > a11yrelationset
If set, the right frame border is enabled.
If set, the inner vertical frame border is enabled.
If set, the bottom-left to top-right diagonal frame border is enabled.
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
SvxBorderLineStyle
Frame border has a visible style.
FrameBorderState
All possible states of a frame border.
Definition: frmsel.hxx:69
Frame border is hidden (off).
If set, the top-left to bottom-right diagonal frame border is enabled.
a11yrelationset get_accessible_relation_set() const
Definition: frmsel.hxx:160
std::unique_ptr< FrameSelectorImpl > mxImpl
Pointer to accessibility object of the control.
Definition: frmsel.hxx:185
If set, the bottom frame border is enabled.
FrameBorderType
Enumerates all borders a frame selection control can contain.
#define SAL_WARN_UNUSED
FrameSelFlags
Definition: frmsel.hxx:32
css::uno::Reference< css::accessibility::XAccessible > getAccessibleParent() const
Definition: frmsel.hxx:158
If set, all four outer frame borders are enabled.
If set, the left frame border is enabled.
rtl::Reference< a11y::AccFrameSelector > mxAccess
Definition: frmsel.hxx:184
void DeselectAllBorders()
Deselects all frame borders.
Definition: frmsel.hxx:146