LibreOffice Module svx (master) 1
frmsel.cxx
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#include <config_wasm_strip.h>
21
22#include <sal/config.h>
23
24#include <o3tl/safeint.hxx>
25#include <svx/frmsel.hxx>
26#include <vcl/event.hxx>
27#include <sal/log.hxx>
28#include <tools/debug.hxx>
29#include <svtools/colorcfg.hxx>
30
31#include <algorithm>
32#include <math.h>
33
34#include <frmselimpl.hxx>
36#include <com/sun/star/accessibility/AccessibleEventId.hpp>
37#include <com/sun/star/accessibility/AccessibleStateType.hpp>
38#include <vcl/settings.hxx>
39#include <vcl/svapp.hxx>
42
43#include <bitmaps.hlst>
44
45using namespace ::com::sun::star;
46using namespace ::editeng;
47
48namespace svx {
49
50using ::com::sun::star::uno::Reference;
51using ::com::sun::star::uno::Any;
52using ::com::sun::star::accessibility::XAccessible;
53using namespace ::com::sun::star::accessibility;
54
55// global functions from framebordertype.hxx
56
58{
60 "svx::GetFrameBorderTypeFromIndex - invalid index" );
61 return static_cast< FrameBorderType >( nIndex + 1 );
62}
63
65{
67 "svx::GetIndexFromFrameBorderType - invalid frame border type" );
68 return static_cast< size_t >( eBorder ) - 1;
69}
70
71namespace
72{
73
75const tools::Long FRAMESEL_GEOM_OUTER = 2;
76
78const tools::Long FRAMESEL_GEOM_INNER = 3;
79
81const tools::Long FRAMESEL_GEOM_WIDTH = 9;
82
84const tools::Long FRAMESEL_GEOM_ADD_CLICK_OUTER = 5;
85
87const tools::Long FRAMESEL_GEOM_ADD_CLICK_INNER = 2;
88
89
91FrameSelFlags lclGetFlagFromType( FrameBorderType eBorder )
92{
93 switch( eBorder )
94 {
103 case FrameBorderType::NONE : break;
104 }
105 return FrameSelFlags::NONE;
106}
107
109void lclPolyPolyUnion( tools::PolyPolygon& rDest, const tools::PolyPolygon& rSource )
110{
111 const tools::PolyPolygon aTmp( rDest );
112 aTmp.GetUnion( rSource, rDest );
113}
114
115} // namespace
116
118 meType( eType ),
119 meState( FrameBorderState::Hide ),
120 meKeyLeft( FrameBorderType::NONE ),
121 meKeyRight( FrameBorderType::NONE ),
122 meKeyTop( FrameBorderType::NONE ),
123 meKeyBottom( FrameBorderType::NONE ),
124 mbEnabled( false ),
125 mbSelected( false )
126{
127}
128
130{
131 mbEnabled = bool(nFlags & lclGetFlagFromType( meType ));
132 if( !mbEnabled )
134}
135
136void FrameBorder::SetCoreStyle( const SvxBorderLine* pStyle )
137{
138 if( pStyle )
139 maCoreStyle = *pStyle;
140 else
141 maCoreStyle = SvxBorderLine();
142
143 // from twips to points
146}
147
149{
150 meState = eState;
151 switch( meState )
152 {
154 SAL_WARN( "svx.dialog", "svx::FrameBorder::SetState - use SetCoreStyle to make border visible" );
155 break;
157 maCoreStyle = SvxBorderLine();
159 break;
161 maCoreStyle = SvxBorderLine();
162 maUIStyle = frame::Style(3, 0, 0, SvxBorderLineStyle::SOLID, FrameBorder::GetDefaultPatternScale()); //OBJ_FRAMESTYLE_DONTCARE
163 break;
164 }
165}
166
168{
169 lclPolyPolyUnion( maFocusArea, tools::PolyPolygon(rFocus) );
170}
171
173{
174 lclPolyPolyUnion( rPPoly, maFocusArea );
175}
176
178{
179 lclPolyPolyUnion( maClickArea, tools::PolyPolygon( rRect ) );
180}
181
182bool FrameBorder::ContainsClickPoint( const Point& rPos ) const
183{
184 return vcl::Region( maClickArea ).Contains( rPos );
185}
186
188{
189 return maClickArea.GetBoundRect();
190}
191
194{
195 meKeyLeft = eLeft;
196 meKeyRight = eRight;
197 meKeyTop = eTop;
198 meKeyBottom = eBottom;
199}
200
202{
204 switch( nKeyCode )
205 {
206 case KEY_LEFT: eBorder = meKeyLeft; break;
207 case KEY_RIGHT: eBorder = meKeyRight; break;
208 case KEY_UP: eBorder = meKeyTop; break;
209 case KEY_DOWN: eBorder = meKeyBottom; break;
210 default: SAL_WARN( "svx.dialog", "svx::FrameBorder::GetKeyboardNeighbor - unknown key code" );
211 }
212 return eBorder;
213}
214
216 mrFrameSel( rFrameSel ),
222 maHor( FrameBorderType::Horizontal ),
223 maVer( FrameBorderType::Vertical ),
227 mnCtrlSize( 0 ),
228 mnArrowSize( 0 ),
229 mnLine1( 0 ),
230 mnLine2( 0 ),
231 mnLine3( 0 ),
232 mnFocusOffs( 0 ),
233 mbHor( false ),
234 mbVer( false ),
235 mbTLBR( false ),
236 mbBLTR( false ),
237 mbFullRepaint( true ),
238 mbAutoSelect( true ),
239 mbHCMode( false )
240#if !ENABLE_WASM_STRIP_ACCESSIBILITY
241 ,maChildVec( 8 )
242#endif
243{
244 maAllBorders.resize( FRAMEBORDERTYPE_COUNT, nullptr );
253#if OSL_DEBUG_LEVEL >= 2
254 {
255 bool bOk = true;
256 for( FrameBorderCIter aIt( maAllBorders ); bOk && aIt.Is(); bOk = (*aIt != 0), ++aIt );
257 DBG_ASSERT( bOk, "svx::FrameSelectorImpl::FrameSelectorImpl - missing entry in maAllBorders" );
258 }
259#endif
260 // left neighbor right neighbor upper neighbor lower neighbor
269
271}
272
274{
275#if !ENABLE_WASM_STRIP_ACCESSIBILITY
276 for( auto& rpChild : maChildVec )
277 if( rpChild.is() )
278 rpChild->Invalidate();
279#endif
280}
281
282// initialization
284{
285 mnFlags = nFlags;
286
287 maEnabBorders.clear();
288 for( FrameBorderIter aIt( maAllBorders ); aIt.Is(); ++aIt )
289 {
290 (*aIt)->Enable( mnFlags );
291 if( (*aIt)->IsEnabled() )
292 maEnabBorders.push_back( *aIt );
293 }
298
300}
301
303{
305 svtools::ColorConfig aColorConfig;
307 mbHCMode = rSettings.GetHighContrastMode();
311}
312
313constexpr rtl::OUStringConstExpr aImageIds[] =
314{
315 RID_SVXBMP_FRMSEL_ARROW1,
316 RID_SVXBMP_FRMSEL_ARROW2,
317 RID_SVXBMP_FRMSEL_ARROW3,
318 RID_SVXBMP_FRMSEL_ARROW4,
319 RID_SVXBMP_FRMSEL_ARROW5,
320 RID_SVXBMP_FRMSEL_ARROW6,
321 RID_SVXBMP_FRMSEL_ARROW7,
322 RID_SVXBMP_FRMSEL_ARROW8,
323 RID_SVXBMP_FRMSEL_ARROW9,
324 RID_SVXBMP_FRMSEL_ARROW10,
325 RID_SVXBMP_FRMSEL_ARROW11,
326 RID_SVXBMP_FRMSEL_ARROW12,
327 RID_SVXBMP_FRMSEL_ARROW13,
328 RID_SVXBMP_FRMSEL_ARROW14,
329 RID_SVXBMP_FRMSEL_ARROW15,
330 RID_SVXBMP_FRMSEL_ARROW16
331};
332
334{
335 maArrows.clear();
336
337 /* Build the arrow images bitmap with current colors. */
338 Color pColorAry1[3];
339 Color pColorAry2[3];
340 pColorAry1[0] = Color( 0, 0, 0 );
341 pColorAry2[0] = maArrowCol; // black -> arrow color
342 pColorAry1[1] = Color( 0, 255, 0 );
343 pColorAry2[1] = maMarkCol; // green -> marker color
344 pColorAry1[2] = Color( 255, 0, 255 );
345 pColorAry2[2] = maBackCol; // magenta -> background
346
347 assert(SAL_N_ELEMENTS(aImageIds) == 16);
348 for (size_t i = 0; i < SAL_N_ELEMENTS(aImageIds); ++i)
349 {
350 BitmapEx aBmpEx { OUString(aImageIds[i]) };
351 aBmpEx.Replace(pColorAry1, pColorAry2, 3);
352 maArrows.emplace_back(aBmpEx);
353 }
354 assert(maArrows.size() == 16);
355
356 mnArrowSize = maArrows[0].GetSizePixel().Height();
357}
358
360{
362 /* nMinSize is the lower of width and height (control will always be squarish).
363 FRAMESEL_GEOM_OUTER is the minimal distance between inner control border
364 and any element. */
365 tools::Long nMinSize = std::min( aCtrlSize.Width(), aCtrlSize.Height() ) - 2 * FRAMESEL_GEOM_OUTER;
366 /* nFixedSize is the size all existing elements need in one direction:
367 the diag. arrow, space betw. arrow and frame border, outer frame border,
368 inner frame border, other outer frame border, space betw. frame border
369 and arrow, the other arrow. */
370 tools::Long nFixedSize = 2 * mnArrowSize + 2 * FRAMESEL_GEOM_INNER + 3 * FRAMESEL_GEOM_WIDTH;
371 /* nBetwBordersSize contains the size between an outer and inner frame border (made odd). */
372 tools::Long nBetwBordersSize = (((nMinSize - nFixedSize) / 2) - 1) | 1;
373
374 /* The final size of the usable area. At least do not get negative */
375 mnCtrlSize = 2 * nBetwBordersSize + nFixedSize;
376 mnCtrlSize = std::max(mnCtrlSize, static_cast<tools::Long>(0));
377 mpVirDev->SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) );
378
379 /* Center the virtual device in the control. */
380 maVirDevPos = Point( (aCtrlSize.Width() - mnCtrlSize) / 2, (aCtrlSize.Height() - mnCtrlSize) / 2 );
381}
382
384{
385 size_t nCol, nCols, nRow, nRows;
386
387 // Global border geometry values
388 /* mnLine* is the middle point inside a frame border (i.e. mnLine1 is mid X inside left border). */
389 mnLine1 = mnArrowSize + FRAMESEL_GEOM_INNER + FRAMESEL_GEOM_WIDTH / 2;
390 mnLine2 = mnCtrlSize / 2;
391 mnLine3 = 2 * mnLine2 - mnLine1;
392
393 // Frame helper array
394 maArray.Initialize( mbVer ? 2 : 1, mbHor ? 2 : 1 );
395
398
401
402 // Focus polygons
403 /* Width for focus rectangles from center of frame borders. */
404 mnFocusOffs = FRAMESEL_GEOM_WIDTH / 2 + 1;
405
412
419
422
423 for( nCol = 0, nCols = maArray.GetColCount(); nCol < nCols; ++nCol )
424 {
425 for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
426 {
427 const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
428 const tools::Rectangle aRect(
429 basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
430 basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
431 const double fHorDiagAngle(atan2(fabs(aCellRange.getHeight()), fabs(aCellRange.getWidth())));
432 const double fVerDiagAngle(fHorDiagAngle > 0.0 ? M_PI_2 - fHorDiagAngle : 0.0);
433 const tools::Long nDiagFocusOffsX(basegfx::fround(-mnFocusOffs / tan(fHorDiagAngle) + mnFocusOffs / sin(fHorDiagAngle)));
434 const tools::Long nDiagFocusOffsY(basegfx::fround(-mnFocusOffs / tan(fVerDiagAngle) + mnFocusOffs / sin(fVerDiagAngle)));
435
436 std::vector< Point > aFocusVec;
437 aFocusVec.emplace_back( aRect.Left() - mnFocusOffs, aRect.Top() + nDiagFocusOffsY );
438 aFocusVec.emplace_back( aRect.Left() - mnFocusOffs, aRect.Top() - mnFocusOffs );
439 aFocusVec.emplace_back( aRect.Left() + nDiagFocusOffsX, aRect.Top() - mnFocusOffs );
440 aFocusVec.emplace_back( aRect.Right() + mnFocusOffs, aRect.Bottom() - nDiagFocusOffsY );
441 aFocusVec.emplace_back( aRect.Right() + mnFocusOffs, aRect.Bottom() + mnFocusOffs );
442 aFocusVec.emplace_back( aRect.Right() - nDiagFocusOffsX, aRect.Bottom() + mnFocusOffs );
443 maTLBR.AddFocusPolygon( tools::Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), aFocusVec.data() ) );
444
445 aFocusVec.clear();
446 aFocusVec.emplace_back( aRect.Right() + mnFocusOffs, aRect.Top() + nDiagFocusOffsY );
447 aFocusVec.emplace_back( aRect.Right() + mnFocusOffs, aRect.Top() - mnFocusOffs );
448 aFocusVec.emplace_back( aRect.Right() - nDiagFocusOffsX, aRect.Top() - mnFocusOffs );
449 aFocusVec.emplace_back( aRect.Left() - mnFocusOffs, aRect.Bottom() - nDiagFocusOffsY );
450 aFocusVec.emplace_back( aRect.Left() - mnFocusOffs, aRect.Bottom() + mnFocusOffs );
451 aFocusVec.emplace_back( aRect.Left() + nDiagFocusOffsX, aRect.Bottom() + mnFocusOffs );
452 maBLTR.AddFocusPolygon( tools::Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), aFocusVec.data() ) );
453 }
454 }
455
456 // Click areas
457 for( FrameBorderIter aIt( maAllBorders ); aIt.Is(); ++aIt )
458 (*aIt)->ClearClickArea();
459
460 /* Additional space for click area: is added to the space available to draw
461 the frame borders. For instance left frame border:
462 - To left, top, and bottom always big additional space (outer area).
463 - To right: Dependent on existence of inner vertical frame border
464 (if enabled, use less space).
465 */
466 tools::Long nClO = FRAMESEL_GEOM_WIDTH / 2 + FRAMESEL_GEOM_ADD_CLICK_OUTER;
467 tools::Long nClI = (mbTLBR && mbBLTR) ? (FRAMESEL_GEOM_WIDTH / 2 + FRAMESEL_GEOM_ADD_CLICK_INNER) : nClO;
468 tools::Long nClH = mbHor ? nClI : nClO; // additional space dependent of horizontal inner border
469 tools::Long nClV = mbVer ? nClI : nClO; // additional space dependent of vertical inner border
470
471 maLeft.AddClickRect( tools::Rectangle( mnLine1 - nClO, mnLine1 - nClO, mnLine1 + nClV, mnLine3 + nClO ) );
472 maVer.AddClickRect( tools::Rectangle( mnLine2 - nClI, mnLine1 - nClO, mnLine2 + nClI, mnLine3 + nClO ) );
473 maRight.AddClickRect( tools::Rectangle( mnLine3 - nClV, mnLine1 - nClO, mnLine3 + nClO, mnLine3 + nClO ) );
474 maTop.AddClickRect( tools::Rectangle( mnLine1 - nClO, mnLine1 - nClO, mnLine3 + nClO, mnLine1 + nClH ) );
475 maHor.AddClickRect( tools::Rectangle( mnLine1 - nClO, mnLine2 - nClI, mnLine3 + nClO, mnLine2 + nClI ) );
476 maBottom.AddClickRect( tools::Rectangle( mnLine1 - nClO, mnLine3 - nClH, mnLine3 + nClO, mnLine3 + nClO ) );
477
478 /* Diagonal frame borders use the remaining space between outer and inner frame borders. */
479 if( !(mbTLBR || mbBLTR) )
480 return;
481
482 for( nCol = 0, nCols = maArray.GetColCount(); nCol < nCols; ++nCol )
483 {
484 for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
485 {
486 // the usable area between horizontal/vertical frame borders of current quadrant
487 const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
488 const tools::Rectangle aRect(
489 basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1,
490 basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1);
491
492 /* Both diagonal frame borders enabled. */
493 if( mbTLBR && mbBLTR )
494 {
495 // single areas
496 Point aMid( aRect.Center() );
497 maTLBR.AddClickRect( tools::Rectangle( aRect.TopLeft(), aMid ) );
498 maTLBR.AddClickRect( tools::Rectangle( aMid + Point( 1, 1 ), aRect.BottomRight() ) );
499 maBLTR.AddClickRect( tools::Rectangle( aRect.Left(), aMid.Y() + 1, aMid.X(), aRect.Bottom() ) );
500 maBLTR.AddClickRect( tools::Rectangle( aMid.X() + 1, aRect.Top(), aRect.Right(), aMid.Y() ) );
501 // centered rectangle for both frame borders
502 tools::Rectangle aMidRect( aRect.TopLeft(), Size( aRect.GetWidth() / 3, aRect.GetHeight() / 3 ) );
503 aMidRect.Move( (aRect.GetWidth() - aMidRect.GetWidth()) / 2, (aRect.GetHeight() - aMidRect.GetHeight()) / 2 );
504 maTLBR.AddClickRect( aMidRect );
505 maBLTR.AddClickRect( aMidRect );
506 }
507 /* One of the diagonal frame borders enabled - use entire rectangle. */
508 else if( mbTLBR && !mbBLTR ) // top-left to bottom-right only
509 maTLBR.AddClickRect( aRect );
510 else if( !mbTLBR && mbBLTR ) // bottom-left to top-right only
511 maBLTR.AddClickRect( aRect );
512 }
513 }
514}
515
517{
518 // initialize resources
519 InitColors();
521
522 sizeChanged();
523}
524
526{
527 // initialize geometry
530
531 DoInvalidate( true );
532}
533
534// frame border access
536{
537 size_t nIndex = GetIndexFromFrameBorderType( eBorder );
538 if( nIndex < maAllBorders.size() )
539 return *maAllBorders[ nIndex ];
540 SAL_WARN( "svx.dialog", "svx::FrameSelectorImpl::GetBorder - unknown border type" );
541 return maTop;
542}
543
545{
546 return const_cast< FrameBorder& >( GetBorder( eBorder ) );
547}
548
549// drawing
551{
552 // clear the area
553 mpVirDev->SetLineColor();
554 mpVirDev->SetFillColor( maBackCol );
555 mpVirDev->DrawRect( tools::Rectangle( Point( 0, 0 ), mpVirDev->GetOutputSizePixel() ) );
556
557 // draw the inner gray (or whatever color) rectangle
558 mpVirDev->SetLineColor();
559 mpVirDev->SetFillColor( maMarkCol );
560 mpVirDev->DrawRect( tools::Rectangle(
562
563 // draw the white space for enabled frame borders
564 tools::PolyPolygon aPPoly;
565 for( FrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
566 (*aIt)->MergeFocusToPolyPolygon( aPPoly );
567 aPPoly.Optimize( PolyOptimizeFlags::CLOSE );
568 mpVirDev->SetLineColor( maBackCol );
569 mpVirDev->SetFillColor( maBackCol );
570 mpVirDev->DrawPolyPolygon( aPPoly );
571}
572
574{
575 DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::DrawArrows - access to disabled border" );
576
577 tools::Long nLinePos = 0;
578 switch( rBorder.GetType() )
579 {
581 case FrameBorderType::Top: nLinePos = mnLine1; break;
583 case FrameBorderType::Horizontal: nLinePos = mnLine2; break;
585 case FrameBorderType::Bottom: nLinePos = mnLine3; break;
586 default: ; //prevent warning
587 }
588 nLinePos -= mnArrowSize / 2;
589
590 tools::Long nTLPos = 0;
592 Point aPos1, aPos2;
593 int nImgIndex1 = -1, nImgIndex2 = -1;
594 switch( rBorder.GetType() )
595 {
599 aPos1 = Point( nLinePos, nTLPos ); nImgIndex1 = 0;
600 aPos2 = Point( nLinePos, nBRPos ); nImgIndex2 = 1;
601 break;
602
606 aPos1 = Point( nTLPos, nLinePos ); nImgIndex1 = 2;
607 aPos2 = Point( nBRPos, nLinePos ); nImgIndex2 = 3;
608 break;
609
611 aPos1 = Point( nTLPos, nTLPos ); nImgIndex1 = 4;
612 aPos2 = Point( nBRPos, nBRPos ); nImgIndex2 = 5;
613 break;
615 aPos1 = Point( nTLPos, nBRPos ); nImgIndex1 = 6;
616 aPos2 = Point( nBRPos, nTLPos ); nImgIndex2 = 7;
617 break;
618 default: ; //prevent warning
619 }
620
621 // Arrow or marker? Do not draw arrows into disabled control.
622 sal_uInt16 nSelectAdd = (mrFrameSel.IsEnabled() && rBorder.IsSelected()) ? 0 : 8;
623 if (nImgIndex1 >= 0)
624 mpVirDev->DrawImage(aPos1, maArrows[nImgIndex1 + nSelectAdd]);
625 if (nImgIndex2 >= 0)
626 mpVirDev->DrawImage(aPos2, maArrows[nImgIndex2 + nSelectAdd]);
627}
628
630{
631 Color aColor( mbHCMode ? maHCLineCol : rColor );
632 if( aColor == maBackCol )
633 aColor.Invert();
634 return aColor;
635}
636
638{
639 // Translate core colors to current UI colors (regards current background and HC mode).
640 for( FrameBorderIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
641 {
642 Color aCoreColorPrim = ((*aIt)->GetState() == FrameBorderState::DontCare) ? maMarkCol : (*aIt)->GetCoreStyle().GetColorOut();
643 Color aCoreColorSecn = ((*aIt)->GetState() == FrameBorderState::DontCare) ? maMarkCol : (*aIt)->GetCoreStyle().GetColorIn();
644 (*aIt)->SetUIColorPrim( GetDrawLineColor( aCoreColorPrim ) );
645 (*aIt)->SetUIColorSecn( GetDrawLineColor( aCoreColorSecn ) );
646 }
647
648 // Copy all frame border styles to the helper array
651
652 // Invert the style for the right line
653 const frame::Style rRightStyle = maRight.GetUIStyle( );
654 frame::Style rInvertedRight( rRightStyle.GetColorPrim(),
655 rRightStyle.GetColorSecn(), rRightStyle.GetColorGap(),
656 rRightStyle.UseGapColor(),
657 rRightStyle.Secn(), rRightStyle.Dist(), rRightStyle.Prim( ),
658 rRightStyle.Type( ), rRightStyle.PatternScale() );
659 maArray.SetColumnStyleRight( mbVer ? 1 : 0, rInvertedRight );
660
662 if( mbHor )
663 {
664 // Invert the style for the hor line to match the real borders
665 const frame::Style rHorStyle = maHor.GetUIStyle();
666 frame::Style rInvertedHor( rHorStyle.GetColorPrim(),
667 rHorStyle.GetColorSecn(), rHorStyle.GetColorGap(),
668 rHorStyle.UseGapColor(),
669 rHorStyle.Secn(), rHorStyle.Dist(), rHorStyle.Prim( ),
670 rHorStyle.Type(), rHorStyle.PatternScale() );
671 maArray.SetRowStyleTop( 1, rInvertedHor );
672 }
673
674 // Invert the style for the bottom line
675 const frame::Style rBottomStyle = maBottom.GetUIStyle( );
676 frame::Style rInvertedBottom( rBottomStyle.GetColorPrim(),
677 rBottomStyle.GetColorSecn(), rBottomStyle.GetColorGap(),
678 rBottomStyle.UseGapColor(),
679 rBottomStyle.Secn(), rBottomStyle.Dist(), rBottomStyle.Prim( ),
680 rBottomStyle.Type(), rBottomStyle.PatternScale() );
681 maArray.SetRowStyleBottom( mbHor ? 1 : 0, rInvertedBottom );
682
683 for( sal_Int32 nCol = 0; nCol < maArray.GetColCount(); ++nCol )
684 for( sal_Int32 nRow = 0; nRow < maArray.GetRowCount(); ++nRow )
686
687 // This is used in the dialog/control for 'Border' attributes. When using
688 // the original paint below instead of primitives, the advantage currently
689 // is the correct visualization of diagonal line(s) including overlaying,
690 // but the rest is bad. Since the edit views use primitives and the preview
691 // should be 'real' I opt for also changing this to primitives. I will
692 // keep the old solution and add a switch (above) based on a static bool so
693 // that interested people may test this out in the debugger.
694 // This is one more hint to enhance the primitive visualization further to
695 // support diagonals better - that's the way to go.
696 const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
697 std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
699 *mpVirDev,
700 aNewViewInformation2D));
701
702 pProcessor2D->process(maArray.CreateB2DPrimitiveArray());
703 pProcessor2D.reset();
704}
705
707{
709 for(FrameBorderCIter aIt(maEnabBorders); aIt.Is(); ++aIt)
710 DrawArrows(**aIt);
712 mbFullRepaint = false;
713}
714
716{
717 if (mbFullRepaint)
719 rRenderContext.DrawBitmapEx(maVirDevPos, mpVirDev->GetBitmapEx(Point(0, 0), mpVirDev->GetOutputSizePixel()));
720}
721
723{
724 tools::PolyPolygon aPPoly;
726 {
727 for(SelFrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt)
728 (*aIt)->MergeFocusToPolyPolygon(aPPoly);
729 aPPoly.Move(maVirDevPos.X(), maVirDevPos.Y());
730 }
731 else
732 // no frame border selected -> draw tracking rectangle around entire control
733 aPPoly.Insert( tools::Polygon(tools::Rectangle(maVirDevPos, mpVirDev->GetOutputSizePixel())));
734
735 aPPoly.Optimize(PolyOptimizeFlags::CLOSE);
736
737 for(sal_uInt16 nIdx = 0, nCount = aPPoly.Count(); nIdx < nCount; ++nIdx)
738 rRenderContext.Invert(aPPoly.GetObject(nIdx), InvertFlags::TrackFrame);
739}
740
742{
743 return rMousePos - maVirDevPos;
744}
745
746void FrameSelectorImpl::DoInvalidate( bool bFullRepaint )
747{
748 mbFullRepaint |= bFullRepaint;
750}
751
752// frame border state and style
754{
755 DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderState - access to disabled border" );
756 Any aOld;
757 Any aNew;
758 Any& rMod = eState == FrameBorderState::Show ? aNew : aOld;
759 rMod <<= AccessibleStateType::CHECKED;
760
761#if !ENABLE_WASM_STRIP_ACCESSIBILITY
763 size_t nVecIdx = static_cast< size_t >( rBorder.GetType() );
764 if( GetBorder(rBorder.GetType()).IsEnabled() && (1 <= nVecIdx) && (nVecIdx <= maChildVec.size()) )
765 xRet = maChildVec[ --nVecIdx ].get();
766#endif
767
768 if( eState == FrameBorderState::Show )
769 SetBorderCoreStyle( rBorder, &maCurrStyle );
770 else
771 rBorder.SetState( eState );
772
773#if !ENABLE_WASM_STRIP_ACCESSIBILITY
774 if (xRet.is())
775 xRet->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOld, aNew );
776#endif
777
778 DoInvalidate( true );
779}
780
781void FrameSelectorImpl::SetBorderCoreStyle( FrameBorder& rBorder, const SvxBorderLine* pStyle )
782{
783 DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderCoreStyle - access to disabled border" );
784 rBorder.SetCoreStyle( pStyle );
785 DoInvalidate( true );
786}
787
789{
790 bool bDontCare = mrFrameSel.SupportsDontCareState();
791 switch( rBorder.GetState() )
792 {
793 // same order as tristate check box: visible -> don't care -> hidden
796 break;
799 break;
802 break;
803 }
804}
805
806// frame border selection
807void FrameSelectorImpl::SelectBorder( FrameBorder& rBorder, bool bSelect )
808{
809 DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SelectBorder - access to disabled border" );
810 rBorder.Select( bSelect );
811 DrawArrows( rBorder );
812 DoInvalidate( false );
813}
814
816{
817 bool bOldAuto = mbAutoSelect;
818 mbAutoSelect = false;
820 mbAutoSelect = bOldAuto;
821}
822
824{
825 bool bEqual = true;
827 if( aIt.Is() )
828 {
829 const SvxBorderLine& rFirstStyle = (*aIt)->GetCoreStyle();
830 for( ++aIt; bEqual && aIt.Is(); ++aIt )
831 bEqual = ((*aIt)->GetCoreStyle() == rFirstStyle);
832 }
833 return bEqual;
834}
835
837{
838}
839
841{
842 CustomWidgetController::SetDrawingArea(pDrawingArea);
843 mxImpl.reset( new FrameSelectorImpl( *this ) );
844 Size aPrefSize = pDrawingArea->get_ref_device().LogicToPixel(Size(61, 65), MapMode(MapUnit::MapAppFont));
845 pDrawingArea->set_size_request(aPrefSize.Width(), aPrefSize.Height());
846 EnableRTL( false ); // #107808# don't mirror the mouse handling
847}
848
850{
851#if !ENABLE_WASM_STRIP_ACCESSIBILITY
852 if( mxAccess.is() )
853 mxAccess->Invalidate();
854#endif
855}
856
858{
859 mxImpl->Initialize( nFlags );
860 Show();
861}
862
863// enabled frame borders
865{
866 return mxImpl->GetBorder( eBorder ).IsEnabled();
867}
868
870{
871 return static_cast< sal_Int32 >( mxImpl->maEnabBorders.size() );
872}
873
875{
877 if( nIndex >= 0 )
878 {
879 size_t nVecIdx = static_cast< size_t >( nIndex );
880 if( nVecIdx < mxImpl->maEnabBorders.size() )
881 eBorder = mxImpl->maEnabBorders[ nVecIdx ]->GetType();
882 }
883 return eBorder;
884}
885
886// frame border state and style
888{
889 return bool(mxImpl->mnFlags & FrameSelFlags::DontCare);
890}
891
893{
894 return mxImpl->GetBorder( eBorder ).GetState();
895}
896
897const SvxBorderLine* FrameSelector::GetFrameBorderStyle( FrameBorderType eBorder ) const
898{
899 const SvxBorderLine& rStyle = mxImpl->GetBorder( eBorder ).GetCoreStyle();
900 // rest of the world uses null pointer for invisible frame border
901 return rStyle.GetOutWidth() ? &rStyle : nullptr;
902}
903
904void FrameSelector::ShowBorder( FrameBorderType eBorder, const SvxBorderLine* pStyle )
905{
906 mxImpl->SetBorderCoreStyle( mxImpl->GetBorderAccess( eBorder ), pStyle );
907}
908
910{
911 mxImpl->SetBorderState( mxImpl->GetBorderAccess( eBorder ), FrameBorderState::DontCare );
912}
913
915{
916 bool bIsSet = false;
917 for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); !bIsSet && aIt.Is(); ++aIt )
918 bIsSet = ((*aIt)->GetState() == FrameBorderState::Show);
919 return bIsSet;
920}
921
923{
924 for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
925 mxImpl->SetBorderState( **aIt, FrameBorderState::Hide );
926}
927
929{
930 VisFrameBorderCIter aIt( mxImpl->maEnabBorders );
931 if( !aIt.Is() )
932 return false;
933
934 const SvxBorderLine& rStyle = (*aIt)->GetCoreStyle();
935 bool bFound = true;
936 for( ++aIt; bFound && aIt.Is(); ++aIt )
937 {
938 bFound =
939 (rStyle.GetWidth() == (*aIt)->GetCoreStyle().GetWidth()) &&
940 (rStyle.GetBorderLineStyle() ==
941 (*aIt)->GetCoreStyle().GetBorderLineStyle());
942 }
943
944 if( bFound )
945 {
946 rnWidth = rStyle.GetWidth();
947 rnStyle = rStyle.GetBorderLineStyle();
948 }
949 return bFound;
950}
951
953{
954 VisFrameBorderCIter aIt( mxImpl->maEnabBorders );
955 if( !aIt.Is() )
956 return false;
957
958 const SvxBorderLine& rStyle = (*aIt)->GetCoreStyle();
959 bool bFound = true;
960 for( ++aIt; bFound && aIt.Is(); ++aIt )
961 bFound = (rStyle.GetColor() == (*aIt)->GetCoreStyle().GetColor());
962
963 if( bFound )
964 rColor = rStyle.GetColor();
965 return bFound;
966}
967
968// frame border selection
970{
971 return mxImpl->maSelectHdl;
972}
973
975{
976 mxImpl->maSelectHdl = rHdl;
977}
978
980{
981 return mxImpl->GetBorder( eBorder ).IsSelected();
982}
983
985{
986 mxImpl->SelectBorder( mxImpl->GetBorderAccess( eBorder ), true/*bSelect*/ );
987#if !ENABLE_WASM_STRIP_ACCESSIBILITY
988 // MT: bFireFox as API parameter is ugly...
989 // if (bFocus)
990 {
992 if (xRet.is())
993 {
994 Any aOldValue, aNewValue;
995 aNewValue <<= AccessibleStateType::FOCUSED;
996 xRet->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
997 }
998 }
999#endif
1000}
1001
1003{
1004 // Construct an iterator for selected borders. If it is valid, there is a selected border.
1005 return SelFrameBorderCIter( mxImpl->maEnabBorders ).Is();
1006}
1007
1009{
1010 for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1011 mxImpl->SelectBorder( **aIt, bSelect );
1012}
1013
1015{
1016 for( VisFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1017 mxImpl->SelectBorder( **aIt, true/*bSelect*/ );
1018}
1019
1021{
1022 mxImpl->maCurrStyle.SetBorderLineStyle( nStyle );
1023 mxImpl->maCurrStyle.SetWidth( nWidth );
1024 for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1025 mxImpl->SetBorderState( **aIt, FrameBorderState::Show );
1026}
1027
1028void FrameSelector::SetColorToSelection(const Color& rColor, model::ComplexColor const& rComplexColor)
1029{
1030 mxImpl->maCurrStyle.SetColor(rColor);
1031 mxImpl->maCurrStyle.setComplexColor(rComplexColor);
1032
1033 for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1034 mxImpl->SetBorderState( **aIt, FrameBorderState::Show );
1035}
1036
1038{
1039 return mxImpl->maCurrStyle.GetBorderLineStyle();
1040}
1041
1042// accessibility
1043Reference< XAccessible > FrameSelector::CreateAccessible()
1044{
1045#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1046 if( !mxAccess.is() )
1047 mxAccess = new a11y::AccFrameSelector(*this);
1048#endif
1049 return mxAccess;
1050}
1051
1053{
1055 size_t nVecIdx = static_cast< size_t >( eBorder );
1056 if( IsBorderEnabled( eBorder ) && (1 <= nVecIdx) && (nVecIdx <= mxImpl->maChildVec.size()) )
1057 {
1058 --nVecIdx;
1059 if( !mxImpl->maChildVec[ nVecIdx ].is() )
1060 mxImpl->maChildVec[ nVecIdx ] = new a11y::AccFrameSelectorChild( *this, eBorder );
1061 xRet = mxImpl->maChildVec[ nVecIdx ].get();
1062 }
1063 return xRet;
1064}
1065
1066Reference< XAccessible > FrameSelector::GetChildAccessible( sal_Int32 nIndex )
1067{
1069}
1070
1071Reference< XAccessible > FrameSelector::GetChildAccessible( const Point& rPos )
1072{
1073 Reference< XAccessible > xRet;
1074 for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); !xRet.is() && aIt.Is(); ++aIt )
1075 if( (*aIt)->ContainsClickPoint( rPos ) )
1076 xRet = GetChildAccessible( (*aIt)->GetType() ).get();
1077 return xRet;
1078}
1079
1081{
1082 tools::Rectangle aRect;
1083 const FrameBorder& rBorder = mxImpl->GetBorder( eBorder );
1084 if( rBorder.IsEnabled() )
1085 aRect = rBorder.GetClickBoundRect();
1086 return aRect;
1087}
1088
1089// virtual functions from base class
1091{
1092 mxImpl->CopyVirDevToControl(rRenderContext);
1093 if (HasFocus())
1094 mxImpl->DrawAllTrackingRects(rRenderContext);
1095}
1096
1098{
1099 /* Mouse handling:
1100 * Click on an unselected frame border:
1101 Set current style/color, make frame border visible, deselect all
1102 other frame borders.
1103 * Click on a selected frame border:
1104 Toggle state of the frame border (visible -> don't care -> hidden),
1105 deselect all other frame borders.
1106 * SHIFT+Click or CTRL+Click on an unselected frame border:
1107 Extend selection, set current style/color to all selected frame
1108 borders independent of the state/style/color of the borders.
1109 * SHIFT+Click or CTRL+Click on a selected frame border:
1110 If all frame borders have same style/color, toggle state of all
1111 borders (see above), otherwise set current style/color to all
1112 borders.
1113 * Click on unused area: Do not modify selection and selected frame
1114 borders.
1115 */
1116
1117 // #107394# do not auto-select a frame border
1118 mxImpl->SilentGrabFocus();
1119
1120 if( rMEvt.IsLeft() )
1121 {
1122 Point aPos( mxImpl->GetDevPosFromMousePos( rMEvt.GetPosPixel() ) );
1123 FrameBorderPtrVec aDeselectBorders;
1124
1125 bool bAnyClicked = false; // Any frame border clicked?
1126 bool bNewSelected = false; // Any unselected frame border selected?
1127
1128 /* If frame borders are set to "don't care" and the control does not
1129 support this state, hide them on first mouse click.
1130 DR 2004-01-30: Why are the borders set to "don't care" then?!? */
1131 bool bHideDontCare = !SupportsDontCareState();
1132
1133 for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1134 {
1135 if( (*aIt)->ContainsClickPoint( aPos ) )
1136 {
1137 // frame border is clicked
1138 bAnyClicked = true;
1139 if( !(*aIt)->IsSelected() )
1140 {
1141 bNewSelected = true;
1142 //mxImpl->SelectBorder( **aIt, true );
1143 SelectBorder((**aIt).GetType());
1144 }
1145 }
1146 else
1147 {
1148 // hide a "don't care" frame border only if it is not clicked
1149 if( bHideDontCare && ((*aIt)->GetState() == FrameBorderState::DontCare) )
1150 mxImpl->SetBorderState( **aIt, FrameBorderState::Hide );
1151
1152 // deselect frame borders not clicked (if SHIFT or CTRL are not pressed)
1153 if( !rMEvt.IsShift() && !rMEvt.IsMod1() )
1154 aDeselectBorders.push_back( *aIt );
1155 }
1156 }
1157
1158 if( bAnyClicked )
1159 {
1160 // any valid frame border clicked? -> deselect other frame borders
1161 for( FrameBorderIter aIt( aDeselectBorders ); aIt.Is(); ++aIt )
1162 mxImpl->SelectBorder( **aIt, false );
1163
1164 if( bNewSelected || !mxImpl->SelectedBordersEqual() )
1165 {
1166 // new frame border selected, selection extended, or selected borders different? -> show
1167 for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1168 // SetBorderState() sets current style and color to the frame border
1169 mxImpl->SetBorderState( **aIt, FrameBorderState::Show );
1170 }
1171 else
1172 {
1173 // all selected frame borders are equal -> toggle state
1174 for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1175 mxImpl->ToggleBorderState( **aIt );
1176 }
1177
1178 GetSelectHdl().Call( nullptr );
1179 }
1180 }
1181
1182 return true;
1183}
1184
1186{
1187 bool bHandled = false;
1188 vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
1189 if( !aKeyCode.GetModifier() )
1190 {
1191 sal_uInt16 nCode = aKeyCode.GetCode();
1192 switch( nCode )
1193 {
1194 case KEY_SPACE:
1195 {
1196 for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1197 mxImpl->ToggleBorderState( **aIt );
1198 bHandled = true;
1199 }
1200 break;
1201
1202 case KEY_UP:
1203 case KEY_DOWN:
1204 case KEY_LEFT:
1205 case KEY_RIGHT:
1206 {
1207 if( !mxImpl->maEnabBorders.empty() )
1208 {
1209 // start from first selected frame border
1210 SelFrameBorderCIter aIt( mxImpl->maEnabBorders );
1211 FrameBorderType eBorder = aIt.Is() ? (*aIt)->GetType() : mxImpl->maEnabBorders.front()->GetType();
1212
1213 // search for next enabled frame border
1214 do
1215 {
1216 eBorder = mxImpl->GetBorder( eBorder ).GetKeyboardNeighbor( nCode );
1217 }
1218 while( (eBorder != FrameBorderType::NONE) && !IsBorderEnabled( eBorder ) );
1219
1220 // select the frame border
1221 if( eBorder != FrameBorderType::NONE )
1222 {
1224 SelectBorder( eBorder );
1225 }
1226 bHandled = true;
1227 }
1228 }
1229 break;
1230 }
1231 }
1232 if (bHandled)
1233 return true;
1234 return CustomWidgetController::KeyInput(rKEvt);
1235}
1236
1238{
1239 // auto-selection of a frame border, if focus reaches control, and nothing is selected
1240 if( mxImpl->mbAutoSelect && !IsAnyBorderSelected() && !mxImpl->maEnabBorders.empty() )
1241 mxImpl->SelectBorder( *mxImpl->maEnabBorders.front(), true );
1242
1243 mxImpl->DoInvalidate( false );
1244 if (IsAnyBorderSelected())
1245 {
1247 if (mxImpl->maLeft.IsSelected())
1248 borderType = FrameBorderType::Left;
1249 else if (mxImpl->maRight.IsSelected())
1250 borderType = FrameBorderType::Right;
1251 else if (mxImpl->maTop.IsSelected())
1252 borderType = FrameBorderType::Top;
1253 else if (mxImpl->maBottom.IsSelected())
1254 borderType = FrameBorderType::Bottom;
1255 else if (mxImpl->maHor.IsSelected())
1256 borderType = FrameBorderType::Horizontal;
1257 else if (mxImpl->maVer.IsSelected())
1258 borderType = FrameBorderType::Vertical;
1259 else if (mxImpl->maTLBR.IsSelected())
1260 borderType = FrameBorderType::TLBR;
1261 else if (mxImpl->maBLTR.IsSelected())
1262 borderType = FrameBorderType::BLTR;
1263 SelectBorder(borderType);
1264 }
1265 for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
1266 mxImpl->SetBorderState( **aIt, FrameBorderState::Show );
1267 CustomWidgetController::GetFocus();
1268}
1269
1271{
1272 mxImpl->DoInvalidate( false );
1273 CustomWidgetController::LoseFocus();
1274}
1275
1277{
1278 mxImpl->InitVirtualDevice();
1279 CustomWidgetController::StyleUpdated();
1280}
1281
1283{
1284 CustomWidgetController::Resize();
1285 mxImpl->sizeChanged();
1286}
1287
1288template< typename Cont, typename Iter, typename Pred >
1290 maIt( rCont.begin() ),
1291 maEnd( rCont.end() )
1292{
1293 while( Is() && !maPred( *maIt ) ) ++maIt;
1294}
1295
1296template< typename Cont, typename Iter, typename Pred >
1298{
1299 do { ++maIt; } while( Is() && !maPred( *maIt ) );
1300 return *this;
1301}
1302
1303}
1304
1305/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Point maEnd
SvxBorderLineStyle
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
void Replace(const Color &rSearchColor, const Color &rReplaceColor)
void Invert()
const vcl::KeyCode & GetKeyCode() const
bool IsMod1() const
const Point & GetPosPixel() const
bool IsLeft() const
bool IsShift() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
void Invert(const tools::Rectangle &rRect, InvertFlags nFlags=InvertFlags::NONE)
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
bool GetHighContrastMode() const
TYPE getMaxX() const
TYPE getWidth() const
TYPE getMinX() const
TYPE getMinY() const
TYPE getMaxY() const
TYPE getHeight() const
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
Template class for all types of frame border iterators.
Definition: frmselimpl.hxx:239
this_type & operator++()
Definition: frmsel.cxx:1297
FrameBorderIterBase(container_type &rCont)
Definition: frmsel.cxx:1289
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
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
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
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
tools::PolyPolygon maClickArea
Focus drawing areas.
Definition: frmselimpl.hxx:93
const Link< LinkParamNone *, void > & GetSelectHdl() const
Returns the current selection handler.
Definition: frmsel.cxx:969
void SetColorToSelection(const Color &rColor, model::ComplexColor const &rComplexColor)
Sets the passed color to all selected frame borders.
Definition: frmsel.cxx:1028
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: frmsel.cxx:1097
const editeng::SvxBorderLine * GetFrameBorderStyle(FrameBorderType eBorder) const
Returns the style of the specified frame border, if it is visible.
Definition: frmsel.cxx:897
virtual void StyleUpdated() override
Definition: frmsel.cxx:1276
void DeselectAllBorders()
Deselects all frame borders.
Definition: frmsel.hxx:146
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition: frmsel.cxx:1043
bool IsAnyBorderVisible() const
Returns true, if any enabled frame border has a visible style (not "don't care").
Definition: frmsel.cxx:914
FrameBorderType GetEnabledBorderType(sal_Int32 nIndex) const
Returns the border type from the passed index (counts only enabled frame borders).
Definition: frmsel.cxx:874
bool IsBorderSelected(FrameBorderType eBorder) const
Returns true, if the specified frame border is selected.
Definition: frmsel.cxx:979
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: frmsel.cxx:1185
virtual void Resize() override
Definition: frmsel.cxx:1282
void SetBorderDontCare(FrameBorderType eBorder)
Sets the specified frame border to "don't care" state.
Definition: frmsel.cxx:909
tools::Rectangle GetClickBoundRect(FrameBorderType eBorder) const
Returns the bounding rectangle of the specified frame border (if enabled).
Definition: frmsel.cxx:1080
void HideAllBorders()
Hides all enabled frame borders.
Definition: frmsel.cxx:922
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: frmsel.cxx:1090
bool GetVisibleWidth(tools::Long &rnWidth, SvxBorderLineStyle &rnStyle) const
Returns true, if all visible frame borders have equal widths.
Definition: frmsel.cxx:928
void SelectBorder(FrameBorderType eBorder)
Selects or deselects the specified frame border.
Definition: frmsel.cxx:984
void ShowBorder(FrameBorderType eBorder, const editeng::SvxBorderLine *pStyle)
Shows the specified frame border using the passed style, or hides it, if pStyle is 0.
Definition: frmsel.cxx:904
void SelectAllBorders(bool bSelect)
Selects or deselects all frame borders.
Definition: frmsel.cxx:1008
bool SupportsDontCareState() const
Returns true, if the control supports the "don't care" frame border state.
Definition: frmsel.cxx:887
SvxBorderLineStyle getCurrentStyleLineStyle() const
Definition: frmsel.cxx:1037
std::unique_ptr< FrameSelectorImpl > mxImpl
Pointer to accessibility object of the control.
Definition: frmsel.hxx:187
sal_Int32 GetEnabledBorderCount() const
Returns the number of enabled frame borders.
Definition: frmsel.cxx:869
virtual void LoseFocus() override
Definition: frmsel.cxx:1270
FrameBorderState GetFrameBorderState(FrameBorderType eBorder) const
Returns the state (visible/hidden/don't care) of the specified frame border.
Definition: frmsel.cxx:892
void SetStyleToSelection(tools::Long nWidth, SvxBorderLineStyle nStyle)
Sets the passed line widths to all selected frame borders (in twips).
Definition: frmsel.cxx:1020
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: frmsel.cxx:840
bool IsAnyBorderSelected() const
Returns true, if any of the enabled frame borders is selected.
Definition: frmsel.cxx:1002
virtual void GetFocus() override
Definition: frmsel.cxx:1237
void SetSelectHdl(const Link< LinkParamNone *, void > &rHdl)
Sets the passed handler that is called if the selection of the control changes.
Definition: frmsel.cxx:974
virtual ~FrameSelector() override
Definition: frmsel.cxx:849
bool IsBorderEnabled(FrameBorderType eBorder) const
Returns true, if the specified frame border is enabled.
Definition: frmsel.cxx:864
void Initialize(FrameSelFlags nFlags)
Initializes the control, enables/disables frame borders according to flags.
Definition: frmsel.cxx:857
rtl::Reference< a11y::AccFrameSelector > mxAccess
Definition: frmsel.hxx:186
rtl::Reference< a11y::AccFrameSelectorChild > GetChildAccessible(FrameBorderType eBorder)
Returns the accessibility child object of the specified frame border (if enabled).
Definition: frmsel.cxx:1052
bool GetVisibleColor(Color &rColor) const
Returns true, if all visible frame borders have equal color.
Definition: frmsel.cxx:952
void SelectAllVisibleBorders()
Selects or deselects all visible frame borders (ignores hidden and "don't care" borders).
Definition: frmsel.cxx:1014
void SetXOffset(sal_Int32 nXOffset)
Sets the X output coordinate of the left column.
basegfx::B2DRange GetCellRange(sal_Int32 nCol, sal_Int32 nRow) const
Returns the output range of the cell (nCol,nRow).
void Initialize(sal_Int32 nWidth, sal_Int32 nHeight)
Reinitializes the array with the specified size.
void SetColumnStyleLeft(sal_Int32 nCol, const Style &rStyle)
Sets the left frame style of the specified column.
void SetRowStyleTop(sal_Int32 nRow, const Style &rStyle)
Sets the top frame style of the specified row.
void SetYOffset(sal_Int32 nYOffset)
Sets the Y output coordinate of the top row.
void SetCellStyleDiag(sal_Int32 nCol, sal_Int32 nRow, const Style &rTLBR, const Style &rBLTR)
Sets both diagonal frame styles of the specified cell (nCol,nRow).
drawinglayer::primitive2d::Primitive2DContainer CreateB2DPrimitiveArray() const
Draws the part of the array, that is inside the clipping range.
void SetAllColWidths(sal_Int32 nWidth)
Sets the same output width for all columns.
void SetRowStyleBottom(sal_Int32 nRow, const Style &rStyle)
Sets the bottom frame style of the specified row.
sal_Int32 GetColCount() const
Returns the number of columns in the array.
void SetColumnStyleRight(sal_Int32 nCol, const Style &rStyle)
Sets the right frame style of the specified column.
void SetAllRowHeights(sal_Int32 nHeight)
Sets the same output height for all rows.
sal_Int32 GetRowCount() const
Returns the number of rows in the array.
Contains the widths of primary and secondary line of a frame style.
Definition: framelink.hxx:99
double Secn() const
Definition: framelink.hxx:130
void Clear()
Sets the frame style to invisible state.
Definition: framelink.cxx:60
void Set(double nP, double nD, double nS)
Sets the frame style to the passed line widths.
Definition: framelink.cxx:75
Color GetColorGap() const
Definition: framelink.hxx:126
Color GetColorSecn() const
Definition: framelink.hxx:125
Color GetColorPrim() const
Definition: framelink.hxx:124
bool UseGapColor() const
Definition: framelink.hxx:127
double Prim() const
Definition: framelink.hxx:128
SvxBorderLineStyle Type() const
Definition: framelink.hxx:132
bool IsUsed() const
Check if this style is used - this depends on it having any width definition.
Definition: framelink.hxx:136
double PatternScale() const
Definition: framelink.hxx:131
double Dist() const
Definition: framelink.hxx:129
sal_uInt16 Count() const
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void Insert(const tools::Polygon &rPoly, sal_uInt16 nPos=POLYPOLY_APPEND)
const tools::Polygon & GetObject(sal_uInt16 nPos) const
tools::Rectangle GetBoundRect() const
void Optimize(PolyOptimizeFlags nOptimizeFlags)
constexpr Point Center() const
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
constexpr Point BottomRight() const
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
bool Contains(const Point &rPoint) const
void EnableRTL(bool bEnable)
Size const & GetOutputSizePixel() const
virtual OutputDevice & get_ref_device()=0
virtual void set_size_request(int nWidth, int nHeight)=0
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
int nCount
#define DBG_ASSERT(sCon, aError)
DocumentType eType
FuncFlags mnFlags
Style maLeft
Style maTLBR
Style maBLTR
Style maTop
Style maRight
Style maBottom
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.
@ Bottom
If set, the bottom frame border is enabled.
@ DiagonalTLBR
If set, the top-left to bottom-right diagonal frame border is enabled.
@ DontCare
If set, all frame borders will support the don't care state.
@ Right
If set, the right frame border is enabled.
@ Left
If set, the left frame border is enabled.
@ Top
If set, the top 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
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_SPACE
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
NONE
B2IRange fround(const B2DRange &rRange)
std::unique_ptr< BaseProcessor2D > createPixelProcessor2DFromOutputDevice(OutputDevice &rTargetOutDev, const drawinglayer::geometry::ViewInformation2D &rViewInformation2D)
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
enumrange< T >::Iterator begin(enumrange< T >)
end
std::vector< FrameBorder * > FrameBorderPtrVec
Definition: frmselimpl.hxx:99
size_t GetIndexFromFrameBorderType(FrameBorderType eBorder)
Returns the zero-based index of a valid frame border type.
Definition: frmsel.cxx:64
FrameBorderType GetFrameBorderTypeFromIndex(size_t nIndex)
Returns the frame border type from a 0-based integer index.
Definition: frmsel.cxx:57
FrameBorderType
Enumerates all borders a frame selection control can contain.
@ Vertical
Inner horizontal frame border.
@ Bottom
Top frame border.
@ TLBR
Inner vertical frame border.
@ Right
Left frame border.
@ Left
No border (special state).
@ Top
Right frame border.
@ Horizontal
Bottom frame border.
@ BLTR
Top-left to bottom-right frame border.
FrameBorderState
All possible states of a frame border.
Definition: frmsel.hxx:70
@ DontCare
Frame border is hidden (off).
@ Hide
Frame border has a visible style.
constexpr rtl::OUStringConstExpr aImageIds[]
Definition: frmsel.cxx:313
FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderSelected_Pred > SelFrameBorderCIter
Iterator for constant svx::FrameBorder containers, iterates over selected borders.
Definition: frmselimpl.hxx:275
const int FRAMEBORDERTYPE_COUNT
The number of valid frame border types (excluding FrameBorderType::NONE).
long Long
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
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
VclPtr< VirtualDevice > mpVirDev
Left
Right
RedlineType meType