LibreOffice Module svx (master) 1
frmselimpl.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_SOURCE_INC_FRMSELIMPL_HXX
21#define INCLUDED_SVX_SOURCE_INC_FRMSELIMPL_HXX
22
23#include <vcl/virdev.hxx>
24#include <vcl/image.hxx>
25#include <svx/frmsel.hxx>
26#include <svx/framelink.hxx>
29
30namespace svx {
31
32namespace a11y {
33 class AccFrameSelector;
34 class AccFrameSelectorChild;
35}
36
38{
39public:
41 static double GetDefaultPatternScale() { return 0.05; }
42
44 {
45 return meType;
46 }
47
48 bool IsEnabled() const
49 {
50 return mbEnabled;
51 }
52 void Enable(FrameSelFlags nFlags);
53
55 {
56 return meState;
57 }
58 void SetState(FrameBorderState eState);
59
60 bool IsSelected() const { return mbSelected; }
61 void Select( bool bSelect ) { mbSelected = bSelect; }
62
64 void SetCoreStyle( const editeng::SvxBorderLine* pStyle );
65
66 void SetUIColorPrim( const Color& rColor ) {maUIStyle.SetColorPrim( rColor ); }
67 void SetUIColorSecn( const Color& rColor ) {maUIStyle.SetColorSecn( rColor ); }
68 const frame::Style& GetUIStyle() const { return maUIStyle; }
69
71 void AddFocusPolygon( const tools::Polygon& rFocus );
72 void MergeFocusToPolyPolygon( tools::PolyPolygon& rPPoly ) const;
73
75 void AddClickRect( const tools::Rectangle& rRect );
76 bool ContainsClickPoint( const Point& rPos ) const;
78
80 FrameBorderType eTop, FrameBorderType eBottom);
81 FrameBorderType GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const;
82
83private:
94 bool mbEnabled : 1;
95 bool mbSelected : 1;
96};
97
98
99typedef std::vector< FrameBorder* > FrameBorderPtrVec;
100
102{
105 std::vector<Image> maArrows;
111
122
127
134
135 bool mbHor;
136 bool mbVer;
137 bool mbTLBR;
138 bool mbBLTR;
141 bool mbHCMode;
142
143 std::vector<rtl::Reference<a11y::AccFrameSelectorChild>>
145 explicit FrameSelectorImpl( FrameSelector& rFrameSel );
147
148 // initialization
150 void Initialize( FrameSelFlags nFlags );
151
153 void InitColors();
155 void InitArrowImageList();
157 void InitGlobalGeometry();
159 void InitBorderGeometry();
161 void InitVirtualDevice();
163 void sizeChanged();
164
165 // frame border access
167 const FrameBorder& GetBorder( FrameBorderType eBorder ) const;
170
171 // drawing
173 void DrawBackground();
174
176 void DrawArrows( const FrameBorder& rBorder );
177
179 Color GetDrawLineColor( const Color& rColor ) const;
181 void DrawAllFrameBorders();
182
184 void DrawVirtualDevice();
186 void CopyVirDevToControl(vcl::RenderContext& rRenderContext);
187
189 void DrawAllTrackingRects(vcl::RenderContext& rRenderContext);
190
192 Point GetDevPosFromMousePos( const Point& rMousePos ) const;
193
196 void DoInvalidate( bool bFullRepaint );
197
198 // frame border state and style
200 void SetBorderState( FrameBorder& rBorder, FrameBorderState eState );
202 void SetBorderCoreStyle( FrameBorder& rBorder, const editeng::SvxBorderLine* pStyle );
203
205 void ToggleBorderState( FrameBorder& rBorder );
206
207 // frame border selection
209 void SelectBorder( FrameBorder& rBorder, bool bSelect );
211 void SilentGrabFocus();
212
214 bool SelectedBordersEqual() const;
215};
216
217
220{
221 bool operator()( const FrameBorder* ) const { return true; }
222};
223
226{
227 bool operator()( const FrameBorder* pBorder ) const { return pBorder->GetState() == FrameBorderState::Show; }
228};
229
232{
233 bool operator()( const FrameBorder* pBorder ) const { return pBorder->IsSelected(); }
234};
235
237template< typename Cont, typename Iter, typename Pred >
239{
240public:
241 typedef Cont container_type;
242 typedef Iter iterator_type;
243 typedef typename Cont::value_type value_type;
245
246 explicit FrameBorderIterBase( container_type& rCont );
247 bool Is() const { return maIt != maEnd; }
249 value_type operator*() const { return *maIt; }
250
251private:
254 Pred maPred;
255};
256
260
264
268
272
276
280
281}
282
283#endif
284
285/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Template class for all types of frame border iterators.
Definition: frmselimpl.hxx:239
Cont::value_type value_type
Definition: frmselimpl.hxx:243
this_type & operator++()
Definition: frmsel.cxx:1297
value_type operator*() const
Definition: frmselimpl.hxx:249
FrameBorderIterBase(container_type &rCont)
Definition: frmsel.cxx:1289
FrameBorderIterBase< Cont, Iter, Pred > this_type
Definition: frmselimpl.hxx:244
tools::Rectangle GetClickBoundRect() const
Definition: frmsel.cxx:187
void MergeFocusToPolyPolygon(tools::PolyPolygon &rPPoly) const
Definition: frmsel.cxx:172
const frame::Style & GetUIStyle() const
Definition: frmselimpl.hxx:68
void AddFocusPolygon(const tools::Polygon &rFocus)
Definition: frmsel.cxx:167
FrameBorderType meKeyLeft
Internal style to draw lines.
Definition: frmselimpl.hxx:88
bool ContainsClickPoint(const Point &rPos) const
Definition: frmsel.cxx:182
bool IsSelected() const
Definition: frmselimpl.hxx:60
bool mbSelected
true = Border enabled in control.
Definition: frmselimpl.hxx:95
FrameBorderType GetType() const
Definition: frmselimpl.hxx:43
void AddClickRect(const tools::Rectangle &rRect)
Definition: frmsel.cxx:177
void SetCoreStyle(const editeng::SvxBorderLine *pStyle)
Definition: frmsel.cxx:136
FrameBorderType meKeyRight
Left neighbor for keyboard control.
Definition: frmselimpl.hxx:89
frame::Style maUIStyle
Core style from application.
Definition: frmselimpl.hxx:87
void SetState(FrameBorderState eState)
Definition: frmsel.cxx:148
bool IsEnabled() const
Definition: frmselimpl.hxx:48
bool mbEnabled
Mouse click areas.
Definition: frmselimpl.hxx:94
FrameBorderType meKeyTop
Right neighbor for keyboard control.
Definition: frmselimpl.hxx:90
void Select(bool bSelect)
Definition: frmselimpl.hxx:61
tools::PolyPolygon maFocusArea
Lower neighbor for keyboard control.
Definition: frmselimpl.hxx:92
editeng::SvxBorderLine maCoreStyle
Frame border state (on/off/don't care).
Definition: frmselimpl.hxx:86
void SetUIColorPrim(const Color &rColor)
Definition: frmselimpl.hxx:66
FrameBorderState meState
Frame border type (position in control).
Definition: frmselimpl.hxx:85
void SetKeyboardNeighbors(FrameBorderType eLeft, FrameBorderType eRight, FrameBorderType eTop, FrameBorderType eBottom)
Definition: frmsel.cxx:192
FrameBorderType GetKeyboardNeighbor(sal_uInt16 nKeyCode) const
Definition: frmsel.cxx:201
void SetUIColorSecn(const Color &rColor)
Definition: frmselimpl.hxx:67
FrameBorderType meKeyBottom
Upper neighbor for keyboard control.
Definition: frmselimpl.hxx:91
void ClearFocusArea()
Definition: frmselimpl.hxx:70
FrameBorder(FrameBorderType eType)
Definition: frmsel.cxx:117
FrameBorderState GetState() const
Definition: frmselimpl.hxx:54
static double GetDefaultPatternScale()
Definition: frmselimpl.hxx:41
const FrameBorderType meType
Definition: frmselimpl.hxx:84
void Enable(FrameSelFlags nFlags)
Definition: frmsel.cxx:129
void ClearClickArea()
Definition: frmselimpl.hxx:74
tools::PolyPolygon maClickArea
Focus drawing areas.
Definition: frmselimpl.hxx:93
const editeng::SvxBorderLine & GetCoreStyle() const
Definition: frmselimpl.hxx:63
Stores frame styles of an array of cells, supports merged ranges.
Contains the widths of primary and secondary line of a frame style.
Definition: framelink.hxx:99
void SetColorSecn(const Color &rColor)
Definition: framelink.hxx:154
void SetColorPrim(const Color &rColor)
Sets a new color, does not modify other settings.
Definition: framelink.hxx:153
DocumentType eType
FrameSelFlags
Definition: frmsel.hxx:33
std::vector< FrameBorder * > FrameBorderPtrVec
Definition: frmselimpl.hxx:99
FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderDummy_Pred > FrameBorderCIter
Iterator for constant svx::FrameBorder containers, iterates over all borders.
Definition: frmselimpl.hxx:259
FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderVisible_Pred > VisFrameBorderCIter
Iterator for constant svx::FrameBorder containers, iterates over visible borders.
Definition: frmselimpl.hxx:267
FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderSelected_Pred > SelFrameBorderIter
Iterator for mutable svx::FrameBorder containers, iterates over selected borders.
Definition: frmselimpl.hxx:279
FrameBorderType
Enumerates all borders a frame selection control can contain.
FrameBorderState
All possible states of a frame border.
Definition: frmsel.hxx:70
FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderSelected_Pred > SelFrameBorderCIter
Iterator for constant svx::FrameBorder containers, iterates over selected borders.
Definition: frmselimpl.hxx:275
FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderDummy_Pred > FrameBorderIter
Iterator for mutable svx::FrameBorder containers, iterates over all borders.
Definition: frmselimpl.hxx:263
FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderVisible_Pred > VisFrameBorderIter
Iterator for mutable svx::FrameBorder containers, iterates over visible borders.
Definition: frmselimpl.hxx:271
long Long
Dummy predicate for frame border iterators to use all borders in a container.
Definition: frmselimpl.hxx:220
bool operator()(const FrameBorder *) const
Definition: frmselimpl.hxx:221
Predicate for frame border iterators to use only selected borders in a container.
Definition: frmselimpl.hxx:232
bool operator()(const FrameBorder *pBorder) const
Definition: frmselimpl.hxx:233
Predicate for frame border iterators to use only visible borders in a container.
Definition: frmselimpl.hxx:226
bool operator()(const FrameBorder *pBorder) const
Definition: frmselimpl.hxx:227
frame::Array maArray
Current style and color for new borders.
Definition: frmselimpl.hxx:121
FrameSelectorImpl(FrameSelector &rFrameSel)
Pointers to accessibility objects for frame borders.
Definition: frmsel.cxx:215
Link< LinkParamNone *, void > maSelectHdl
Pointers to enables frame borders.
Definition: frmselimpl.hxx:126
void InitBorderGeometry()
Initializes coordinates of all frame borders.
Definition: frmsel.cxx:383
bool mbTLBR
true = Inner vertical frame border enabled.
Definition: frmselimpl.hxx:137
void DrawBackground()
Draws the background of the entire control (the gray areas between borders).
Definition: frmsel.cxx:550
void DrawAllFrameBorders()
Draws all frame borders.
Definition: frmsel.cxx:637
bool SelectedBordersEqual() const
Returns true, if all selected frame borders are equal (or if nothing is selected).
Definition: frmsel.cxx:823
bool mbFullRepaint
true = Bottom-left to top-right frame border enabled.
Definition: frmselimpl.hxx:139
void DrawVirtualDevice()
Draws all contents of the control.
Definition: frmsel.cxx:706
tools::Long mnLine2
Middle of left/top frame borders.
Definition: frmselimpl.hxx:131
Color maBackCol
Arrows in current system colors.
Definition: frmselimpl.hxx:106
void SetBorderCoreStyle(FrameBorder &rBorder, const editeng::SvxBorderLine *pStyle)
Sets the core style of the specified frame border, or hides the frame border, if pStyle is 0.
Definition: frmsel.cxx:781
tools::Long mnCtrlSize
Selection handler.
Definition: frmselimpl.hxx:128
tools::Long mnArrowSize
Size of the control (always square).
Definition: frmselimpl.hxx:129
FrameBorder maBLTR
All data of top-left to bottom-right frame border.
Definition: frmselimpl.hxx:119
void SelectBorder(FrameBorder &rBorder, bool bSelect)
Selects a frame border and schedules redraw.
Definition: frmsel.cxx:807
void InitGlobalGeometry()
Initializes global coordinates.
Definition: frmsel.cxx:359
void InitColors()
Fills all color members from current style settings.
Definition: frmsel.cxx:302
void InitVirtualDevice()
Draws the entire control into the internal virtual device.
Definition: frmsel.cxx:516
FrameBorder & GetBorderAccess(FrameBorderType eBorder)
Returns the object representing the specified frame border (write access).
Definition: frmsel.cxx:544
void DrawAllTrackingRects(vcl::RenderContext &rRenderContext)
Draws tracking rectangles for all selected frame borders.
Definition: frmsel.cxx:722
Point GetDevPosFromMousePos(const Point &rMousePos) const
Converts a mouse position to the virtual device position.
Definition: frmsel.cxx:741
FrameBorderPtrVec maEnabBorders
Pointers to all frame borders.
Definition: frmselimpl.hxx:125
bool mbHor
Offset from frame border middle to draw focus.
Definition: frmselimpl.hxx:135
FrameBorder maLeft
Position of virtual device in the control.
Definition: frmselimpl.hxx:112
Color maArrowCol
Background color.
Definition: frmselimpl.hxx:107
FrameBorder maTLBR
All data of inner vertical frame border.
Definition: frmselimpl.hxx:118
editeng::SvxBorderLine maCurrStyle
All data of bottom-left to top-right frame border.
Definition: frmselimpl.hxx:120
Point maVirDevPos
High contrast line color.
Definition: frmselimpl.hxx:110
tools::Long mnLine3
Middle of inner frame borders.
Definition: frmselimpl.hxx:132
bool mbBLTR
true = Top-left to bottom-right frame border enabled.
Definition: frmselimpl.hxx:138
std::vector< rtl::Reference< a11y::AccFrameSelectorChild > > maChildVec
true = High contrast mode.
Definition: frmselimpl.hxx:144
Color maMarkCol
Selection arrow color.
Definition: frmselimpl.hxx:108
void Initialize(FrameSelFlags nFlags)
Initializes the control, enables/disables frame borders according to flags.
Definition: frmsel.cxx:283
Color maHCLineCol
Selection marker color.
Definition: frmselimpl.hxx:109
void DrawArrows(const FrameBorder &rBorder)
Draws selection arrows for the specified frame border.
Definition: frmsel.cxx:573
FrameBorderPtrVec maAllBorders
Flags for enabled frame borders.
Definition: frmselimpl.hxx:124
bool mbVer
true = Inner horizontal frame border enabled.
Definition: frmselimpl.hxx:136
bool mbHCMode
true = Auto select a frame border, if focus reaches control.
Definition: frmselimpl.hxx:141
bool mbAutoSelect
Used for repainting (false = only copy virtual device).
Definition: frmselimpl.hxx:140
Color GetDrawLineColor(const Color &rColor) const
Returns the color that has to be used to draw a frame border.
Definition: frmsel.cxx:629
void InitArrowImageList()
Creates the image list with selection arrows regarding current style settings.
Definition: frmsel.cxx:333
void SilentGrabFocus()
Grabs focus without auto-selection of a frame border, if no border selected.
Definition: frmsel.cxx:815
std::vector< Image > maArrows
For all buffered drawing operations.
Definition: frmselimpl.hxx:105
void DoInvalidate(bool bFullRepaint)
Invalidates the control.
Definition: frmsel.cxx:746
void sizeChanged()
call this to recalculate based on parent size
Definition: frmsel.cxx:525
void SetBorderState(FrameBorder &rBorder, FrameBorderState eState)
Sets the state of the specified frame border.
Definition: frmsel.cxx:753
FrameBorder maVer
All data of inner horizontal frame border.
Definition: frmselimpl.hxx:117
tools::Long mnLine1
Size of an arrow image.
Definition: frmselimpl.hxx:130
FrameBorder maHor
All data of bottom frame border.
Definition: frmselimpl.hxx:116
FrameSelFlags mnFlags
Frame link array to draw an array of frame borders.
Definition: frmselimpl.hxx:123
FrameBorder maRight
All data of left frame border.
Definition: frmselimpl.hxx:113
const FrameBorder & GetBorder(FrameBorderType eBorder) const
Returns the object representing the specified frame border.
Definition: frmsel.cxx:535
FrameBorder maBottom
All data of top frame border.
Definition: frmselimpl.hxx:115
tools::Long mnFocusOffs
Middle of right/bottom frame borders.
Definition: frmselimpl.hxx:133
void CopyVirDevToControl(vcl::RenderContext &rRenderContext)
Copies contents of the virtual device to the control.
Definition: frmsel.cxx:715
ScopedVclPtr< VirtualDevice > mpVirDev
The control itself.
Definition: frmselimpl.hxx:104
void ToggleBorderState(FrameBorder &rBorder)
Changes the state of a frame border after a control event (mouse/keyboard).
Definition: frmsel.cxx:788
FrameSelector & mrFrameSel
Definition: frmselimpl.hxx:103
FrameBorder maTop
All data of right frame border.
Definition: frmselimpl.hxx:114