LibreOffice Module svx (master) 1
dlgctrl.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 <vcl/svapp.hxx>
23#include <vcl/settings.hxx>
24#include <vcl/virdev.hxx>
25#include <vcl/event.hxx>
26#include <sfx2/dialoghelper.hxx>
27#include <sfx2/weldutils.hxx>
28#include <svx/relfld.hxx>
29#include <svx/xlineit0.hxx>
30#include <svx/xtable.hxx>
31#include <bitmaps.hlst>
32#include <svx/dlgctrl.hxx>
33#include <tools/debug.hxx>
35#include <svtools/colorcfg.hxx>
39#include <svx/svdorect.hxx>
40#include <svx/svdmodel.hxx>
41#include <svx/svdopath.hxx>
44#include <vcl/BitmapTools.hxx>
45
46#define OUTPUT_DRAWMODE_COLOR (DrawModeFlags::Default)
47#define OUTPUT_DRAWMODE_CONTRAST (DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient)
48
49using namespace ::com::sun::star;
50using namespace ::com::sun::star::uno;
51using namespace ::com::sun::star::lang;
52using namespace ::com::sun::star::accessibility;
53
54// Control for display and selection of the corner points and
55// mid point of an object
56
58{
59 if( !pBitmap )
61
62 return *pBitmap;
63}
64
66 : m_pPage(pPage)
67 , nBorderWidth(Application::GetDefaultDevice()->LogicToPixel(Size(200, 0), MapMode(MapUnit::Map100thMM)).Width())
68 , eRP(RectPoint::MM)
69 , eDefRP(RectPoint::MM)
70 , m_nState(CTL_STATE::NONE)
71 , mbCompleteDisable(false)
72{
73}
74
76{
77 CustomWidgetController::SetDrawingArea(pDrawingArea);
78 Size aSize(pDrawingArea->get_approximate_digit_width() * 25,
79 pDrawingArea->get_text_height() * 5);
80 pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
81 Resize_Impl(aSize);
82}
83
84void SvxRectCtl::SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder)
85{
86 nBorderWidth = Application::GetDefaultDevice()->LogicToPixel(Size(nBorder, 0), MapMode(MapUnit::Map100thMM)).Width();
87 eDefRP = eRpt;
88 Resize();
89}
90
92{
93 pBitmap.reset();
94#if !ENABLE_WASM_STRIP_ACCESSIBILITY
95 pAccContext.clear();
96#endif
97}
98
100{
102}
103
105{
106 aPtLT = Point( 0 + nBorderWidth, 0 + nBorderWidth );
107 aPtMT = Point( rSize.Width() / 2, 0 + nBorderWidth );
108 aPtRT = Point( rSize.Width() - nBorderWidth, 0 + nBorderWidth );
109
110 aPtLM = Point( 0 + nBorderWidth, rSize.Height() / 2 );
111 aPtMM = Point( rSize.Width() / 2, rSize.Height() / 2 );
112 aPtRM = Point( rSize.Width() - nBorderWidth, rSize.Height() / 2 );
113
114 aPtLB = Point( 0 + nBorderWidth, rSize.Height() - nBorderWidth );
115 aPtMB = Point( rSize.Width() / 2, rSize.Height() - nBorderWidth );
116 aPtRB = Point( rSize.Width() - nBorderWidth, rSize.Height() - nBorderWidth );
117
118 Reset();
119 StyleUpdated();
120}
121
123{
124 pBitmap.reset();
125
127 svtools::ColorConfig aColorConfig;
128
129 pBitmap.reset(new BitmapEx(RID_SVXCTRL_RECTBTNS));
130
131 // set bitmap-colors
132 Color aColorAry1[7];
133 Color aColorAry2[7];
134 aColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 ); // light-gray
135 aColorAry1[1] = Color( 0xFF, 0xFF, 0x00 ); // yellow
136 aColorAry1[2] = Color( 0xFF, 0xFF, 0xFF ); // white
137 aColorAry1[3] = Color( 0x80, 0x80, 0x80 ); // dark-gray
138 aColorAry1[4] = Color( 0x00, 0x00, 0x00 ); // black
139 aColorAry1[5] = Color( 0x00, 0xFF, 0x00 ); // green
140 aColorAry1[6] = Color( 0x00, 0x00, 0xFF ); // blue
141 aColorAry2[0] = rStyles.GetDialogColor(); // background
142 aColorAry2[1] = rStyles.GetWindowColor();
143 aColorAry2[2] = rStyles.GetLightColor();
144 aColorAry2[3] = rStyles.GetShadowColor();
145 aColorAry2[4] = rStyles.GetDarkShadowColor();
146 aColorAry2[5] = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
147 aColorAry2[6] = rStyles.GetDialogColor();
148
149#ifdef DBG_UTIL
150 static bool bModify = false;
151 bool& rModify = bModify;
152 if( rModify )
153 {
154 static int n = 0;
155 static sal_uInt8 r = 0xFF;
156 static sal_uInt8 g = 0x00;
157 static sal_uInt8 b = 0xFF;
158 int& rn = n;
159 sal_uInt8& rr = r;
160 sal_uInt8& rg = g;
161 sal_uInt8& rb = b;
162 aColorAry2[ rn ] = Color( rr, rg, rb );
163 }
164#endif
165
166 pBitmap->Replace( aColorAry1, aColorAry2, 7 );
167}
168
170{
171 pBitmap.reset(); // forces new creating of bitmap
172 CustomWidgetController::StyleUpdated();
173}
174
176{
177 svtools::ColorConfig aColorConfig;
178 Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
179 rRenderContext.SetTextColor(aTextColor);
180 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
181 rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
182}
183
184// The clicked rectangle (3 x 3) is determined and the parent (dialog)
185// is notified that the item was changed
187{
188 // CompletelyDisabled() added to have a disabled state for SvxRectCtl
190 {
193 SetActualRP( eRP );
194
195 if (m_pPage)
197 }
198 return true;
199}
200
201bool SvxRectCtl::KeyInput(const KeyEvent& rKeyEvt)
202{
203 // CompletelyDisabled() added to have a disabled state for SvxRectCtl
205 return false;
206
207 RectPoint eNewRP = eRP;
208
209 switch( rKeyEvt.GetKeyCode().GetCode() )
210 {
211 case KEY_DOWN:
212 {
213 if( !(m_nState & CTL_STATE::NOVERT) )
214 switch( eNewRP )
215 {
216 case RectPoint::LT: eNewRP = RectPoint::LM; break;
217 case RectPoint::MT: eNewRP = RectPoint::MM; break;
218 case RectPoint::RT: eNewRP = RectPoint::RM; break;
219 case RectPoint::LM: eNewRP = RectPoint::LB; break;
220 case RectPoint::MM: eNewRP = RectPoint::MB; break;
221 case RectPoint::RM: eNewRP = RectPoint::RB; break;
222 default: ; //prevent warning
223 }
224 }
225 break;
226 case KEY_UP:
227 {
228 if( !(m_nState & CTL_STATE::NOVERT) )
229 switch( eNewRP )
230 {
231 case RectPoint::LM: eNewRP = RectPoint::LT; break;
232 case RectPoint::MM: eNewRP = RectPoint::MT; break;
233 case RectPoint::RM: eNewRP = RectPoint::RT; break;
234 case RectPoint::LB: eNewRP = RectPoint::LM; break;
235 case RectPoint::MB: eNewRP = RectPoint::MM; break;
236 case RectPoint::RB: eNewRP = RectPoint::RM; break;
237 default: ; //prevent warning
238 }
239 }
240 break;
241 case KEY_LEFT:
242 {
243 if( !(m_nState & CTL_STATE::NOHORZ) )
244 switch( eNewRP )
245 {
246 case RectPoint::MT: eNewRP = RectPoint::LT; break;
247 case RectPoint::RT: eNewRP = RectPoint::MT; break;
248 case RectPoint::MM: eNewRP = RectPoint::LM; break;
249 case RectPoint::RM: eNewRP = RectPoint::MM; break;
250 case RectPoint::MB: eNewRP = RectPoint::LB; break;
251 case RectPoint::RB: eNewRP = RectPoint::MB; break;
252 default: ; //prevent warning
253 }
254 }
255 break;
256 case KEY_RIGHT:
257 {
258 if( !(m_nState & CTL_STATE::NOHORZ) )
259 switch( eNewRP )
260 {
261 case RectPoint::LT: eNewRP = RectPoint::MT; break;
262 case RectPoint::MT: eNewRP = RectPoint::RT; break;
263 case RectPoint::LM: eNewRP = RectPoint::MM; break;
264 case RectPoint::MM: eNewRP = RectPoint::RM; break;
265 case RectPoint::LB: eNewRP = RectPoint::MB; break;
266 case RectPoint::MB: eNewRP = RectPoint::RB; break;
267 default: ; //prevent warning
268 }
269 }
270 break;
271 default:
272 return false;
273 }
274 if( eNewRP != eRP )
275 {
276 SetActualRP( eNewRP );
277
278 if (m_pPage)
280 }
281 return true;
282}
283
284// the control (rectangle with 9 circles)
286{
287 InitSettings(rRenderContext);
288
289 Point aPtDiff(1, 1);
290
292
293 rRenderContext.SetLineColor(rStyles.GetDialogColor());
294 rRenderContext.SetFillColor(rStyles.GetDialogColor());
295 rRenderContext.DrawRect(tools::Rectangle(Point(0,0), rRenderContext.GetOutputSize()));
296
297 if (IsEnabled())
298 rRenderContext.SetLineColor(rStyles.GetLabelTextColor());
299 else
300 rRenderContext.SetLineColor(rStyles.GetShadowColor());
301
302 rRenderContext.SetFillColor();
303
304 if (!IsEnabled())
305 {
306 Color aOldCol = rRenderContext.GetLineColor();
307 rRenderContext.SetLineColor(rStyles.GetLightColor());
308 rRenderContext.DrawRect(tools::Rectangle(aPtLT + aPtDiff, aPtRB + aPtDiff));
309 rRenderContext.SetLineColor(aOldCol);
310 }
311 rRenderContext.DrawRect(tools::Rectangle(aPtLT, aPtRB));
312
313 rRenderContext.SetFillColor(rRenderContext.GetBackground().GetColor());
314
315 Size aBtnSize(11, 11);
316 Size aDstBtnSize(aBtnSize);
317 Point aToCenter(aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1);
318 Point aBtnPnt1(IsEnabled() ? 0 : 22, 0);
319 Point aBtnPnt2(11, 0);
320 Point aBtnPnt3(22, 0);
321
322 bool bNoHorz = bool(m_nState & CTL_STATE::NOHORZ);
323 bool bNoVert = bool(m_nState & CTL_STATE::NOVERT);
324
325 BitmapEx& rBitmap = GetRectBitmap();
326
327 // CompletelyDisabled() added to have a disabled state for SvxRectCtl
329 {
330 rRenderContext.DrawBitmapEx(aPtLT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
331 rRenderContext.DrawBitmapEx(aPtMT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
332 rRenderContext.DrawBitmapEx(aPtRT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
333 rRenderContext.DrawBitmapEx(aPtLM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
334 rRenderContext.DrawBitmapEx(aPtMM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
335 rRenderContext.DrawBitmapEx(aPtRM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
336 rRenderContext.DrawBitmapEx(aPtLB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
337 rRenderContext.DrawBitmapEx(aPtMB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
338 rRenderContext.DrawBitmapEx(aPtRB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap);
339 }
340 else
341 {
342 rRenderContext.DrawBitmapEx(aPtLT - aToCenter, aDstBtnSize, (bNoHorz || bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap);
343 rRenderContext.DrawBitmapEx(aPtMT - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap);
344 rRenderContext.DrawBitmapEx(aPtRT - aToCenter, aDstBtnSize, (bNoHorz || bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap);
345 rRenderContext.DrawBitmapEx(aPtLM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap);
346
347 // Center for rectangle and line
348 rRenderContext.DrawBitmapEx(aPtMM - aToCenter, aDstBtnSize, aBtnPnt1, aBtnSize, rBitmap);
349
350 rRenderContext.DrawBitmapEx(aPtRM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap);
351 rRenderContext.DrawBitmapEx(aPtLB - aToCenter, aDstBtnSize, (bNoHorz || bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap);
352 rRenderContext.DrawBitmapEx(aPtMB - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap);
353 rRenderContext.DrawBitmapEx(aPtRB - aToCenter, aDstBtnSize, (bNoHorz || bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap);
354 }
355
356 // draw active button, avoid center pos for angle
357 // CompletelyDisabled() added to have a disabled state for SvxRectCtl
359 {
360 if (IsEnabled())
361 {
362 Point aCenterPt(aPtNew);
363 aCenterPt -= aToCenter;
364
365 rRenderContext.DrawBitmapEx(aCenterPt, aDstBtnSize, aBtnPnt2, aBtnSize, rBitmap);
366 }
367 }
368}
369
371{
372 tools::Rectangle aRet;
373 if (HasFocus())
375 return aRet;
376}
377
378// Convert RectPoint Point
379
381{
382 switch( _eRP )
383 {
384 case RectPoint::LT: return aPtLT;
385 case RectPoint::MT: return aPtMT;
386 case RectPoint::RT: return aPtRT;
387 case RectPoint::LM: return aPtLM;
388 case RectPoint::MM: return aPtMM;
389 case RectPoint::RM: return aPtRM;
390 case RectPoint::LB: return aPtLB;
391 case RectPoint::MB: return aPtMB;
392 case RectPoint::RB: return aPtRB;
393 }
394 return aPtMM; // default
395}
396
398{
399 Point aPtLast = aPtNew;
400 aPtNew = GetPointFromRP( eNewRP );
401
403 aPtNew.setX( aPtMM.X() );
404
406 aPtNew.setY( aPtMM.Y() );
407
408 // fdo#74751 this fix reverse base point on RTL UI.
409 bool bRTL = AllSettings::GetLayoutRTL();
410 eNewRP = GetRPFromPoint( aPtNew, bRTL );
411
412 eDefRP = eNewRP;
413 eRP = eNewRP;
414
415 return aPtLast;
416}
417
419{
420 Invalidate();
421
422#if !ENABLE_WASM_STRIP_ACCESSIBILITY
423 // Send accessibility event.
424 if (pAccContext.is())
425 {
426 pAccContext->FireChildFocus(GetActualRP());
427 }
428#endif
429}
430
432{
433 Invalidate();
434}
435
437{
438 Point aPt = rPt;
441
442 Size aSize(GetOutputSizePixel());
443
444 if( !( m_nState & CTL_STATE::NOHORZ ) )
445 {
446 if( aPt.X() < aSize.Width() / 3 )
447 x = aPtLT.X();
448 else if( aPt.X() < aSize.Width() * 2 / 3 )
449 x = aPtMM.X();
450 else
451 x = aPtRB.X();
452 }
453 else
454 x = aPtMM.X();
455
456 if( !( m_nState & CTL_STATE::NOVERT ) )
457 {
458 if( aPt.Y() < aSize.Height() / 3 )
459 y = aPtLT.Y();
460 else if( aPt.Y() < aSize.Height() * 2 / 3 )
461 y = aPtMM.Y();
462 else
463 y = aPtRB.Y();
464 }
465 else
466 y = aPtMM.Y();
467
468 return Point( x, y );
469}
470
471
472// Converts Point in RectPoint
473
475{
476 RectPoint rPoint = RectPoint::MM; // default
477
478 if (aPt == aPtLT) rPoint = bRTL ? RectPoint::RT : RectPoint::LT;
479 else if( aPt == aPtMT) rPoint = RectPoint::MT;
480 else if( aPt == aPtRT) rPoint = bRTL ? RectPoint::LT : RectPoint::RT;
481 else if( aPt == aPtLM) rPoint = bRTL ? RectPoint::RM : RectPoint::LM;
482 else if( aPt == aPtRM) rPoint = bRTL ? RectPoint::LM : RectPoint::RM;
483 else if( aPt == aPtLB) rPoint = bRTL ? RectPoint::RB : RectPoint::LB;
484 else if( aPt == aPtMB) rPoint = RectPoint::MB;
485 else if( aPt == aPtRB) rPoint = bRTL ? RectPoint::LB : RectPoint::RB;
486
487 return rPoint;
488}
489
490// Resets to the original state of the control
491
493{
495 eRP = eDefRP;
496 Invalidate();
497}
498
499// Returns the currently selected RectPoint
500
501
503{
505
506 Invalidate();
507
508#if !ENABLE_WASM_STRIP_ACCESSIBILITY
509 // notify accessibility object about change
510 if (pAccContext.is())
511 pAccContext->selectChild( eNewRP /* MT, bFireFocus */ );
512#endif
513}
514
516{
518
519 Point aPtLast( GetPointFromRP( eRP ) );
520 Point _aPtNew( aPtLast );
521
523 _aPtNew.setX( aPtMM.X() );
524
526 _aPtNew.setY( aPtMM.Y() );
527
528 eRP = GetRPFromPoint( _aPtNew );
529 Invalidate();
530
531 if (m_pPage)
533}
534
536{
537 Size aDstBtnSize(15, 15);
538 return tools::Rectangle( aPtNew - Point( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1 ), aDstBtnSize );
539}
540
542{
543 tools::Rectangle aRet;
544 RectPoint eOldRectPoint = GetActualRP();
545
546 if( eOldRectPoint == eRectPoint )
548 else
549 {
550 SvxRectCtl* pThis = const_cast<SvxRectCtl*>(this);
551
552 pThis->SetActualRPWithoutInvalidate( eRectPoint ); // no invalidation because it's only temporary!
554
555 pThis->SetActualRPWithoutInvalidate( eOldRectPoint ); // no invalidation because nothing has changed!
556 }
557
558 return aRet;
559}
560
561Reference< XAccessible > SvxRectCtl::CreateAccessible()
562{
563#if !ENABLE_WASM_STRIP_ACCESSIBILITY
565#endif
566 return pAccContext;
567}
568
569RectPoint SvxRectCtl::GetApproxRPFromPixPt( const css::awt::Point& r ) const
570{
571 return GetRPFromPoint( GetApproxLogPtFromPixPt( Point( r.X, r.Y ) ) );
572}
573
574// CompletelyDisabled() added to have a disabled state for SvxRectCtl
576{
577 mbCompleteDisable = bNew;
578 Invalidate();
579}
580
581// Control for editing bitmaps
582
583css::uno::Reference< css::accessibility::XAccessible > SvxPixelCtl::CreateAccessible()
584{
585#if !ENABLE_WASM_STRIP_ACCESSIBILITY
586 if (!m_xAccess.is())
588#endif
589 return m_xAccess;
590}
591
593{
594 tools::Long nX = aPt.X() * nLines / aRectSize.Width();
595 tools::Long nY = aPt.Y() * nLines / aRectSize.Height();
596
597 return nX + nY * nLines ;
598}
599
601{
602 DBG_ASSERT(nIndex >= 0 && nIndex < nSquares ," Check Index");
603
604 sal_Int32 nXIndex = nIndex % nLines;
605 sal_Int32 nYIndex = nIndex / nLines;
606
607 Point aPtTl;
608 aPtTl.setY( aRectSize.Height() * nYIndex / nLines + 1 );
609 aPtTl.setX( aRectSize.Width() * nXIndex / nLines + 1 );
610
611 return aPtTl;
612}
613
615{
617}
618
620{
621 sal_Int32 nX = rPt.X() * nLines / aRectSize.Width();
622 sal_Int32 nY = rPt.Y() * nLines / aRectSize.Height();
623
624 ChangePixel( nX + nY * nLines );
625
626 //Solution:Set new focus position and repaint
630
631 if (m_pPage)
632 m_pPage->PointChanged(GetDrawingArea(), RectPoint::MM ); // RectPoint is dummy
633
634 return GetFocusPosIndex();
635
636}
637
639 : m_pPage(pPage)
640 , bPaintable(true)
641 , aFocusPosition(0,0)
642{
643 maPixelData.fill(0);
644}
645
647{
648 CustomWidgetController::Resize();
650}
651
653{
654 CustomWidgetController::SetDrawingArea(pDrawingArea);
655 pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 25,
656 pDrawingArea->get_text_height() * 10);
657}
658
660{
661}
662
663// Changes the foreground or Background color
664
665void SvxPixelCtl::ChangePixel( sal_uInt16 nPixel )
666{
667 if( maPixelData[nPixel] == 0 )
668 maPixelData[nPixel] = 1; // could be extended to more colors
669 else
670 maPixelData[nPixel] = 0;
671}
672
673// The clicked rectangle is identified, to change its color
674
676{
677 if (!aRectSize.Width() || !aRectSize.Height())
678 return true;
679
680 //Grab focus when click in window
681 if (!HasFocus())
682 {
683 GrabFocus();
684 }
685
687
688#if !ENABLE_WASM_STRIP_ACCESSIBILITY
689 if(m_xAccess.is())
690 {
691 m_xAccess->NotifyChild(nIndex,true, true);
692 }
693#else
694 (void)nIndex;
695#endif
696
697 return true;
698}
699
701{
702 tools::Rectangle aRet;
703 //Draw visual focus when has focus
704 if (HasFocus())
706 return aRet;
707}
708
709// Draws the Control (Rectangle with nine circles)
711{
712 if (!aRectSize.Width() || !aRectSize.Height())
713 return;
714
715 sal_uInt16 i, j, nTmp;
716 Point aPtTl, aPtBr;
717
718 if (bPaintable)
719 {
720 // Draw lines
721 rRenderContext.SetLineColor(Color());
722 for (i = 1; i < nLines; i++)
723 {
724 // horizontal
725 nTmp = static_cast<sal_uInt16>(aRectSize.Height() * i / nLines);
726 rRenderContext.DrawLine(Point(0, nTmp), Point(aRectSize.Width(), nTmp));
727 // vertically
728 nTmp = static_cast<sal_uInt16>( aRectSize.Width() * i / nLines );
729 rRenderContext.DrawLine(Point(nTmp, 0), Point(nTmp, aRectSize.Height()));
730 }
731
732 //Draw Rectangles (squares)
733 rRenderContext.SetLineColor();
734 sal_uInt16 nLastPixel = maPixelData[0] ? 0 : 1;
735
736 for (i = 0; i < nLines; i++)
737 {
738 aPtTl.setY( aRectSize.Height() * i / nLines + 1 );
739 aPtBr.setY( aRectSize.Height() * (i + 1) / nLines - 1 );
740
741 for (j = 0; j < nLines; j++)
742 {
743 aPtTl.setX( aRectSize.Width() * j / nLines + 1 );
744 aPtBr.setX( aRectSize.Width() * (j + 1) / nLines - 1 );
745
746 if (maPixelData[i * nLines + j] != nLastPixel)
747 {
748 nLastPixel = maPixelData[i * nLines + j];
749 // Change color: 0 -> Background color
750 rRenderContext.SetFillColor(nLastPixel ? aPixelColor : aBackgroundColor);
751 }
752 rRenderContext.DrawRect(tools::Rectangle(aPtTl, aPtBr));
753 }
754 }
755 }
756 else
757 {
758 rRenderContext.SetBackground(Wallpaper(COL_LIGHTGRAY));
759 rRenderContext.SetLineColor(COL_LIGHTRED);
760 rRenderContext.DrawLine(Point(0, 0), Point(aRectSize.Width(), aRectSize.Height()));
761 rRenderContext.DrawLine(Point(0, aRectSize.Height()), Point(aRectSize.Width(), 0));
762 }
763}
764
765//Calculate visual focus rectangle via focus position
767{
768 tools::Long nLeft,nTop,nRight,nBottom;
769 tools::Long i,j;
770 i = aPosition.Y();
771 j = aPosition.X();
772 nLeft = aRectSize.Width() * j / nLines + 1;
773 nRight = aRectSize.Width() * (j + 1) / nLines - 1;
774 nTop = aRectSize.Height() * i / nLines + 1;
775 nBottom = aRectSize.Height() * (i + 1) / nLines - 1;
776 return tools::Rectangle(nLeft,nTop,nRight,nBottom);
777}
778
779//Solution:Keyboard function
780bool SvxPixelCtl::KeyInput( const KeyEvent& rKEvt )
781{
782 vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
783 sal_uInt16 nCode = aKeyCode.GetCode();
784 bool bIsMod = aKeyCode.IsShift() || aKeyCode.IsMod1() || aKeyCode.IsMod2();
785
786 if( !bIsMod )
787 {
788 Point aRepaintPoint( aRectSize.Width() *( aFocusPosition.getX() - 1)/ nLines - 1,
790 );
791 Size aRepaintSize( aRectSize.Width() *3/ nLines + 2,aRectSize.Height() *3/ nLines + 2);
792 tools::Rectangle aRepaintRect( aRepaintPoint, aRepaintSize );
793 bool bFocusPosChanged=false;
794 switch(nCode)
795 {
796 case KEY_LEFT:
797 if(aFocusPosition.getX() >= 1)
798 {
800 Invalidate(aRepaintRect);
801 bFocusPosChanged=true;
802 }
803 break;
804 case KEY_RIGHT:
805 if( aFocusPosition.getX() < (nLines - 1) )
806 {
808 Invalidate(aRepaintRect);
809 bFocusPosChanged=true;
810 }
811 break;
812 case KEY_UP:
813 if(aFocusPosition.getY() >= 1)
814 {
816 Invalidate(aRepaintRect);
817 bFocusPosChanged=true;
818 }
819 break;
820 case KEY_DOWN:
821 if( aFocusPosition.getY() < ( nLines - 1 ) )
822 {
824 Invalidate(aRepaintRect);
825 bFocusPosChanged=true;
826 }
827 break;
828 case KEY_SPACE:
831 break;
832 default:
833 return CustomWidgetController::KeyInput( rKEvt );
834 }
835#if !ENABLE_WASM_STRIP_ACCESSIBILITY
836 if(m_xAccess.is())
837 {
839 switch(nCode)
840 {
841 case KEY_LEFT:
842 case KEY_RIGHT:
843 case KEY_UP:
844 case KEY_DOWN:
845 if (bFocusPosChanged)
846 {
847 m_xAccess->NotifyChild(nIndex,false,false);
848 }
849 break;
850 case KEY_SPACE:
851 m_xAccess->NotifyChild(nIndex,false,true);
852 break;
853 default:
854 break;
855 }
856 }
857#else
858 (void)bFocusPosChanged;
859#endif
860 return true;
861 }
862 else
863 {
864 return CustomWidgetController::KeyInput( rKEvt );
865 }
866}
867
868//Draw focus when get focus
870{
872
873#if !ENABLE_WASM_STRIP_ACCESSIBILITY
874 if (m_xAccess.is())
875 {
876 m_xAccess->NotifyChild(GetFocusPosIndex(),true,false);
877 }
878#endif
879}
880
882{
883 Invalidate();
884}
885
886void SvxPixelCtl::SetXBitmap(const BitmapEx& rBitmapEx)
887{
889 {
890 for (sal_uInt16 i = 0; i < nSquares; i++)
891 {
892 Color aColor = rBitmapEx.GetPixelColor(i%8, i/8);
893 maPixelData[i] = (aColor == aBackgroundColor) ? 0 : 1;
894 }
895 }
896}
897
898// Returns a specific pixel
899
900sal_uInt8 SvxPixelCtl::GetBitmapPixel( const sal_uInt16 nPixel ) const
901{
902 return maPixelData[nPixel];
903}
904
905// Resets to the original state of the control
906
908{
909 // clear pixel area
910 maPixelData.fill(0);
911 Invalidate();
912}
913
914SvxLineLB::SvxLineLB(std::unique_ptr<weld::ComboBox> pControl)
915 : m_xControl(std::move(pControl))
916 , mbAddStandardFields(true)
917{
918}
919
921{
922 if(getAddStandardFields() != bNew)
923 {
924 mbAddStandardFields = bNew;
925 }
926}
927
928// Fills the listbox (provisional) with strings
929
930void SvxLineLB::Fill( const XDashListRef &pList )
931{
932 m_xControl->clear();
933
934 if( !pList.is() )
935 return;
936
938
940 {
941 // entry for 'none'
942 m_xControl->append_text(pList->GetStringForUiNoLine());
943
944 // entry for solid line
945 const BitmapEx aBitmap = pList->GetBitmapForUISolidLine();
946 const Size aBmpSize(aBitmap.GetSizePixel());
947 pVD->SetOutputSizePixel(aBmpSize, false);
948 pVD->DrawBitmapEx(Point(), aBitmap);
949 m_xControl->append("", pList->GetStringForUiSolidLine(), *pVD);
950 }
951
952 // entries for dashed lines
953
954 tools::Long nCount = pList->Count();
955 m_xControl->freeze();
956
957 for( tools::Long i = 0; i < nCount; i++ )
958 {
959 const XDashEntry* pEntry = pList->GetDash(i);
960 const BitmapEx aBitmap = pList->GetUiBitmap( i );
961 if( !aBitmap.IsEmpty() )
962 {
963 const Size aBmpSize(aBitmap.GetSizePixel());
964 pVD->SetOutputSizePixel(aBmpSize, false);
965 pVD->DrawBitmapEx(Point(), aBitmap);
966 m_xControl->append("", pEntry->GetName(), *pVD);
967 }
968 else
969 {
970 m_xControl->append_text(pEntry->GetName());
971 }
972 }
973
974 m_xControl->thaw();
975}
976
977void SvxLineLB::Append( const XDashEntry& rEntry, const BitmapEx& rBitmap )
978{
979 if (!rBitmap.IsEmpty())
980 {
982
983 const Size aBmpSize(rBitmap.GetSizePixel());
984 pVD->SetOutputSizePixel(aBmpSize, false);
985 pVD->DrawBitmapEx(Point(), rBitmap);
986 m_xControl->append("", rEntry.GetName(), *pVD);
987 }
988 else
989 {
990 m_xControl->append_text(rEntry.GetName());
991 }
992}
993
994void SvxLineLB::Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap)
995{
996 m_xControl->remove(nPos);
997
998 if (!rBitmap.IsEmpty())
999 {
1001
1002 const Size aBmpSize(rBitmap.GetSizePixel());
1003 pVD->SetOutputSizePixel(aBmpSize, false);
1004 pVD->DrawBitmapEx(Point(), rBitmap);
1005 m_xControl->insert(nPos, rEntry.GetName(), nullptr, nullptr, pVD);
1006 }
1007 else
1008 {
1009 m_xControl->insert_text(nPos, rEntry.GetName());
1010 }
1011}
1012
1013SvxLineEndLB::SvxLineEndLB(std::unique_ptr<weld::ComboBox> pControl)
1014 : m_xControl(std::move(pControl))
1015{
1016}
1017
1018void SvxLineEndLB::Fill( const XLineEndListRef &pList, bool bStart )
1019{
1020 if( !pList.is() )
1021 return;
1022
1023 tools::Long nCount = pList->Count();
1025 m_xControl->freeze();
1026
1027 for( tools::Long i = 0; i < nCount; i++ )
1028 {
1029 const XLineEndEntry* pEntry = pList->GetLineEnd(i);
1030 const BitmapEx aBitmap = pList->GetUiBitmap( i );
1031 if( !aBitmap.IsEmpty() )
1032 {
1033 const Size aBmpSize(aBitmap.GetSizePixel());
1034 pVD->SetOutputSizePixel(Size(aBmpSize.Width() / 2, aBmpSize.Height()), false);
1035 pVD->DrawBitmapEx(bStart ? Point() : Point(-aBmpSize.Width() / 2, 0), aBitmap);
1036 m_xControl->append("", pEntry->GetName(), *pVD);
1037 }
1038 else
1039 m_xControl->append_text(pEntry->GetName());
1040 }
1041
1042 m_xControl->thaw();
1043}
1044
1045void SvxLineEndLB::Append( const XLineEndEntry& rEntry, const BitmapEx& rBitmap )
1046{
1047 if(!rBitmap.IsEmpty())
1048 {
1050
1051 const Size aBmpSize(rBitmap.GetSizePixel());
1052 pVD->SetOutputSizePixel(Size(aBmpSize.Width() / 2, aBmpSize.Height()), false);
1053 pVD->DrawBitmapEx(Point(-aBmpSize.Width() / 2, 0), rBitmap);
1054 m_xControl->append("", rEntry.GetName(), *pVD);
1055 }
1056 else
1057 {
1058 m_xControl->append_text(rEntry.GetName());
1059 }
1060}
1061
1062void SvxLineEndLB::Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap )
1063{
1064 m_xControl->remove(nPos);
1065
1066 if(!rBitmap.IsEmpty())
1067 {
1069
1070 const Size aBmpSize(rBitmap.GetSizePixel());
1071 pVD->SetOutputSizePixel(Size(aBmpSize.Width() / 2, aBmpSize.Height()), false);
1072 pVD->DrawBitmapEx(Point(-aBmpSize.Width() / 2, 0), rBitmap);
1073 m_xControl->insert(nPos, rEntry.GetName(), nullptr, nullptr, pVD);
1074 }
1075 else
1076 {
1077 m_xControl->insert_text(nPos, rEntry.GetName());
1078 }
1079}
1080
1082{
1084
1085 const Size aOutputSize(GetOutputSize());
1086 const sal_Int32 nDistance(500);
1087 const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance));
1088
1089 // create DrawObjectA
1090 const sal_Int32 aYPosA(aOutputSize.Height() / 2);
1091 const basegfx::B2DPoint aPointA1( nDistance, aYPosA);
1092 const basegfx::B2DPoint aPointA2( aPointA1.getX() + ((nAvailableLength * 14) / 20), aYPosA );
1093 basegfx::B2DPolygon aPolygonA;
1094 aPolygonA.append(aPointA1);
1095 aPolygonA.append(aPointA2);
1096 mpLineObjA->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonA));
1097
1098 // create DrawObjectB
1099 const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4);
1100 const sal_Int32 aYPosB2((aOutputSize.Height() * 1) / 4);
1101 const basegfx::B2DPoint aPointB1( aPointA2.getX() + nDistance, aYPosB1);
1102 const basegfx::B2DPoint aPointB2( aPointB1.getX() + ((nAvailableLength * 2) / 20), aYPosB2 );
1103 const basegfx::B2DPoint aPointB3( aPointB2.getX() + ((nAvailableLength * 2) / 20), aYPosB1 );
1104 basegfx::B2DPolygon aPolygonB;
1105 aPolygonB.append(aPointB1);
1106 aPolygonB.append(aPointB2);
1107 aPolygonB.append(aPointB3);
1108 mpLineObjB->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonB));
1109
1110 // create DrawObjectC
1111 basegfx::B2DPolygon aPolygonC;
1112 const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance, aYPosB1);
1113 const basegfx::B2DPoint aPointC2( aPointC1.getX() + ((nAvailableLength * 1) / 20), aYPosB2 );
1114 const basegfx::B2DPoint aPointC3( aPointC2.getX() + ((nAvailableLength * 1) / 20), aYPosB1 );
1115 aPolygonC.append(aPointC1);
1116 aPolygonC.append(aPointC2);
1117 aPolygonC.append(aPointC3);
1118 mpLineObjC->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonC));
1119}
1120
1122 : mpGraphic(nullptr)
1123 , mbWithSymbol(false)
1124{
1125}
1126
1128{
1129 SvxPreviewBase::SetDrawingArea(pDrawingArea);
1130
1134
1135 Resize();
1136 Invalidate();
1137}
1138
1140{
1141}
1142
1144{
1145 mpGraphic = p;
1146 maSymbolSize = s;
1147}
1148
1150{
1151 if ( s != maSymbolSize )
1152 {
1153 maSymbolSize = s;
1154 Invalidate();
1155 }
1156}
1157
1159{
1160 // Set ItemSet at objects
1161 mpLineObjA->SetMergedItemSet(rItemSet);
1162
1163 // At line joints, do not use arrows
1164 SfxItemSet aTempSet(rItemSet);
1165 aTempSet.ClearItem(XATTR_LINESTART);
1166 aTempSet.ClearItem(XATTR_LINEEND);
1167
1168 mpLineObjB->SetMergedItemSet(aTempSet);
1169 mpLineObjC->SetMergedItemSet(aTempSet);
1170}
1171
1173{
1174 LocalPrePaint(rRenderContext);
1175
1176 // paint objects to buffer device
1177 sdr::contact::SdrObjectVector aObjectVector;
1178 aObjectVector.push_back(mpLineObjA.get());
1179 aObjectVector.push_back(mpLineObjB.get());
1180 aObjectVector.push_back(mpLineObjC.get());
1181
1182 sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), std::move(aObjectVector), nullptr);
1183 sdr::contact::DisplayInfo aDisplayInfo;
1184
1185 // do processing
1186 aPainter.ProcessDisplay(aDisplayInfo);
1187
1188 if ( mbWithSymbol && mpGraphic )
1189 {
1190 const Size aOutputSize(GetOutputSize());
1191 Point aPos( aOutputSize.Width() / 3, aOutputSize.Height() / 2 );
1192 aPos.AdjustX( -(maSymbolSize.Width() / 2) );
1193 aPos.AdjustY( -(maSymbolSize.Height() / 2) );
1195 }
1196
1197 LocalPostPaint(rRenderContext);
1198}
1199
1201{
1202}
1203
1205{
1206 SvxPreviewBase::SetDrawingArea(pDrawingArea);
1207 InitSettings();
1208
1209 // prepare size
1210 Size aSize = GetPreviewSize().GetSize();
1211 aSize.setWidth( aSize.Width() / 3 );
1212 aSize.setHeight( aSize.Height() / 3 );
1213
1214 // create RectangleObject
1215 const tools::Rectangle aObjectSize( Point( aSize.Width(), aSize.Height() ), aSize );
1217 getModel(),
1218 aObjectSize);
1219
1220 // create ShadowObject
1221 const tools::Rectangle aShadowSize( Point( aSize.Width(), aSize.Height() ), aSize );
1223 getModel(),
1224 aShadowSize);
1225}
1226
1228{
1229}
1230
1232{
1233 mpRectangleObject->SetMergedItemSet(rItemSet, true);
1234 mpRectangleObject->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1235}
1236
1238{
1239 mpRectangleShadow->SetMergedItemSet(rItemSet, true);
1240 mpRectangleShadow->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1241}
1242
1244{
1245 maShadowOffset = rPos;
1246}
1247
1249{
1250 rRenderContext.Push(vcl::PushFlags::MAPMODE);
1251 rRenderContext.SetMapMode(MapMode(MapUnit::Map100thMM));
1252
1253 LocalPrePaint(rRenderContext);
1254
1255 // prepare size
1256 Size aSize = rRenderContext.GetOutputSize();
1257 aSize.setWidth( aSize.Width() / 3 );
1258 aSize.setHeight( aSize.Height() / 3 );
1259
1260 tools::Rectangle aObjectRect(Point(aSize.Width(), aSize.Height()), aSize);
1261 mpRectangleObject->SetSnapRect(aObjectRect);
1262 aObjectRect.Move(maShadowOffset.X(), maShadowOffset.Y());
1263 mpRectangleShadow->SetSnapRect(aObjectRect);
1264
1265 sdr::contact::SdrObjectVector aObjectVector;
1266
1267 aObjectVector.push_back(mpRectangleShadow.get());
1268 aObjectVector.push_back(mpRectangleObject.get());
1269
1270 sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), std::move(aObjectVector), nullptr);
1271 sdr::contact::DisplayInfo aDisplayInfo;
1272
1273 aPainter.ProcessDisplay(aDisplayInfo);
1274
1275 LocalPostPaint(rRenderContext);
1276
1277 rRenderContext.Pop();
1278}
1279
1281{
1282 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1283
1284 svtools::ColorConfig aColorConfig;
1285 Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
1286 getBufferDevice().SetTextColor(aTextColor);
1287
1288 getBufferDevice().SetBackground(rStyleSettings.GetWindowColor());
1289
1291
1292 Invalidate();
1293}
1294
1296 : mpModel(new SdrModel(nullptr, nullptr, true))
1297{
1298 // init model
1299 mpModel->GetItemPool().FreezeIdRanges();
1300}
1301
1303{
1304 CustomWidgetController::SetDrawingArea(pDrawingArea);
1305 Size aSize(getPreviewStripSize(pDrawingArea->get_ref_device()));
1306 pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
1307 SetOutputSizePixel(aSize);
1308
1310 mpBufferDevice->SetMapMode(MapMode(MapUnit::Map100thMM));
1311}
1312
1314{
1315 mpModel.reset();
1317}
1318
1320{
1321 // init BufferDevice
1322 if (mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel())
1323 mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel());
1324 mpBufferDevice->SetAntialiasing(rRenderContext.GetAntialiasing());
1325
1326 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1327
1328 if (rStyleSettings.GetPreviewUsesCheckeredBackground())
1329 {
1330 const Point aNull(0, 0);
1331 static const sal_uInt32 nLen(8);
1332 static const Color aW(COL_WHITE);
1333 static const Color aG(0xef, 0xef, 0xef);
1334 const bool bWasEnabled(mpBufferDevice->IsMapModeEnabled());
1335
1336 mpBufferDevice->EnableMapMode(false);
1337 mpBufferDevice->DrawCheckered(aNull, mpBufferDevice->GetOutputSizePixel(), nLen, aW, aG);
1338 mpBufferDevice->EnableMapMode(bWasEnabled);
1339 }
1340 else
1341 {
1342 mpBufferDevice->Erase();
1343 }
1344}
1345
1347{
1348 // copy to front (in pixel mode)
1349 const bool bWasEnabledSrc(mpBufferDevice->IsMapModeEnabled());
1350 const bool bWasEnabledDst(rRenderContext.IsMapModeEnabled());
1351 const Point aEmptyPoint;
1352
1353 mpBufferDevice->EnableMapMode(false);
1354 rRenderContext.EnableMapMode(false);
1355
1356 rRenderContext.DrawOutDev(aEmptyPoint, GetOutputSizePixel(),
1357 aEmptyPoint, GetOutputSizePixel(),
1359
1360 mpBufferDevice->EnableMapMode(bWasEnabledSrc);
1361 rRenderContext.EnableMapMode(bWasEnabledDst);
1362}
1363
1365{
1366 InitSettings();
1367 CustomWidgetController::StyleUpdated();
1368}
1369
1371{
1372}
1373
1375{
1376 tools::Rectangle aObjectSize(Point(), getBufferDevice().PixelToLogic(GetOutputSizePixel()));
1377 return aObjectSize;
1378}
1379
1381{
1382 SvxPreviewBase::SetDrawingArea(pDrawingArea);
1383 InitSettings();
1384
1385 // create RectangleObject
1387}
1388
1390{
1392 if (pOrigObject)
1393 {
1395 SetAttributes(pOrigObject->GetMergedItemSet());
1396 pOrigObject.clear();
1397 }
1399}
1400
1402{
1403}
1404
1406{
1407 mpRectangleObject->SetMergedItemSet(rItemSet, true);
1408 mpRectangleObject->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1409}
1410
1412{
1413 rRenderContext.Push(vcl::PushFlags::MAPMODE);
1414 rRenderContext.SetMapMode(MapMode(MapUnit::Map100thMM));
1415 LocalPrePaint(rRenderContext);
1416
1417 sdr::contact::SdrObjectVector aObjectVector;
1418
1419 aObjectVector.push_back(mpRectangleObject.get());
1420
1421 sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), std::move(aObjectVector), nullptr);
1422 sdr::contact::DisplayInfo aDisplayInfo;
1423
1424 aPainter.ProcessDisplay(aDisplayInfo);
1425
1426 LocalPostPaint(rRenderContext);
1427 rRenderContext.Pop();
1428}
1429
1431{
1432 // space is limited in the sidebar, so limit MetricSpinButtons to a width of 4 digits
1433 const int nMaxDigits = 4;
1434 rSpinButton.set_width_chars(std::min(rSpinButton.get_width_chars(), nMaxDigits));
1435}
1436
1438{
1439 weld::SpinButton& rSpinButton = rMetricSpinButton.get_widget();
1440 limitWidthForSidebar(rSpinButton);
1441}
1442
1443void padWidthForSidebar(weld::Toolbar& rToolbar, const css::uno::Reference<css::frame::XFrame>& rFrame)
1444{
1445 static int nColumnWidth = -1;
1446 static vcl::ImageType eSize;
1447 if (nColumnWidth != -1 && eSize != rToolbar.get_icon_size())
1448 nColumnWidth = -1;
1449 if (nColumnWidth == -1)
1450 {
1451 // use the, filled-in by dispatcher, width of measurewidth as the width
1452 // of a "standard" column in a two column panel
1453 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(&rToolbar, "svx/ui/measurewidthbar.ui"));
1454 std::unique_ptr<weld::Toolbar> xToolbar1(xBuilder->weld_toolbar("measurewidth1"));
1455 ToolbarUnoDispatcher aDispatcher1(*xToolbar1, *xBuilder, rFrame);
1456 std::unique_ptr<weld::Toolbar> xToolbar2(xBuilder->weld_toolbar("measurewidth2"));
1457 ToolbarUnoDispatcher aDispatcher2(*xToolbar2, *xBuilder, rFrame);
1458 nColumnWidth = std::max(xToolbar1->get_preferred_size().Width(), xToolbar2->get_preferred_size().Width());
1459 eSize = rToolbar.get_icon_size();
1460 }
1461 rToolbar.set_size_request(nColumnWidth, -1);
1462}
1463
1464/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr int nBorderWidth
const StyleSettings & GetStyleSettings() const
static bool GetLayoutRTL()
static OutputDevice * GetDefaultDevice()
static const AllSettings & GetSettings()
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
::Color GetPixelColor(sal_Int32 nX, sal_Int32 nY) const
bool IsEmpty() const
const Size & GetSizePixel() const
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
const vcl::KeyCode & GetKeyCode() const
const Point & GetPosPixel() const
Size GetOutputSize() const
void EnableMapMode(bool bEnable=true)
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
const Wallpaper & GetBackground() const
void SetLineColor()
void SetMapMode()
void SetTextColor(const Color &rColor)
void SetFillColor()
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
const Color & GetLineColor() const
SAL_DLLPRIVATE void DrawOutDev(const Point &, const Size &, const Point &, const Size &, const Printer &)=delete
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void SetBackground()
void SetDrawMode(DrawModeFlags nDrawMode)
AntialiasingFlags GetAntialiasing() const
bool IsMapModeEnabled() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetDarkShadowColor() const
const Color & GetWindowColor() const
bool GetPreviewUsesCheckeredBackground() const
bool GetHighContrastMode() const
const Color & GetShadowColor() const
const Color & GetLabelTextColor() const
const Color & GetLightColor() const
const Color & GetDialogColor() const
void Append(const XLineEndEntry &rEntry, const BitmapEx &rBitmap)
Definition: dlgctrl.cxx:1045
SvxLineEndLB(std::unique_ptr< weld::ComboBox > pControl)
Definition: dlgctrl.cxx:1013
void Modify(const XLineEndEntry &rEntry, sal_Int32 nPos, const BitmapEx &rBitmap)
Definition: dlgctrl.cxx:1062
std::unique_ptr< weld::ComboBox > m_xControl
Definition: dlgctrl.hxx:249
void Fill(const XLineEndListRef &pList, bool bStart=true)
Definition: dlgctrl.cxx:1018
void Append(const XDashEntry &rEntry, const BitmapEx &rBitmap)
Definition: dlgctrl.cxx:977
std::unique_ptr< weld::ComboBox > m_xControl
Definition: dlgctrl.hxx:216
bool getAddStandardFields() const
Definition: dlgctrl.hxx:225
void setAddStandardFields(bool bNew)
Definition: dlgctrl.cxx:920
bool mbAddStandardFields
defines if standard fields (none, solid) are added, default is true
Definition: dlgctrl.hxx:219
void Modify(const XDashEntry &rEntry, sal_Int32 nPos, const BitmapEx &rBitmap)
Definition: dlgctrl.cxx:994
SvxLineLB(std::unique_ptr< weld::ComboBox > pControl)
Definition: dlgctrl.cxx:914
void Fill(const XDashListRef &pList)
Definition: dlgctrl.cxx:930
bool bPaintable
Definition: dlgctrl.hxx:154
tools::Rectangle implCalFocusRect(const Point &aPosition)
Definition: dlgctrl.cxx:766
virtual tools::Rectangle GetFocusRect() override
Definition: dlgctrl.cxx:700
Point IndexToPoint(tools::Long nIndex) const
Definition: dlgctrl.cxx:600
virtual ~SvxPixelCtl() override
Definition: dlgctrl.cxx:659
SvxPixelCtl(SvxPixelCtl const &)=delete
virtual void LoseFocus() override
Definition: dlgctrl.cxx:881
virtual void GetFocus() override
Definition: dlgctrl.cxx:869
Color aPixelColor
Definition: dlgctrl.hxx:150
Size aRectSize
Definition: dlgctrl.hxx:152
std::array< sal_uInt8, nSquares > maPixelData
Definition: dlgctrl.hxx:153
virtual void Resize() override
Definition: dlgctrl.cxx:646
sal_uInt8 GetBitmapPixel(const sal_uInt16 nPixelNumber) const
Definition: dlgctrl.cxx:900
Point aFocusPosition
Definition: dlgctrl.hxx:156
rtl::Reference< SvxPixelCtlAccessible > m_xAccess
Definition: dlgctrl.hxx:157
tools::Long ShowPosition(const Point &pt)
Definition: dlgctrl.cxx:619
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctrl.cxx:710
void ChangePixel(sal_uInt16 nPixel)
Definition: dlgctrl.cxx:665
static sal_uInt16 constexpr nLines
Definition: dlgctrl.hxx:145
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition: dlgctrl.cxx:583
void Reset()
Definition: dlgctrl.cxx:907
void SetXBitmap(const BitmapEx &rBitmapEx)
Definition: dlgctrl.cxx:886
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctrl.cxx:652
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: dlgctrl.cxx:780
tools::Long PointToIndex(const Point &pt) const
Definition: dlgctrl.cxx:592
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgctrl.cxx:675
tools::Long GetFocusPosIndex() const
Definition: dlgctrl.cxx:614
SvxTabPage * m_pPage
Definition: dlgctrl.hxx:148
Color aBackgroundColor
Definition: dlgctrl.hxx:151
static sal_uInt16 constexpr nSquares
Definition: dlgctrl.hxx:146
OutputDevice & getBufferDevice() const
Definition: dlgctrl.hxx:318
tools::Rectangle GetPreviewSize() const
Definition: dlgctrl.cxx:1374
std::unique_ptr< SdrModel > mpModel
Definition: dlgctrl.hxx:281
virtual void StyleUpdated() override
Definition: dlgctrl.cxx:1364
VclPtr< VirtualDevice > mpBufferDevice
Definition: dlgctrl.hxx:282
void InitSettings()
Definition: dlgctrl.cxx:1280
SdrModel & getModel() const
Definition: dlgctrl.hxx:314
virtual void SetDrawingArea(weld::DrawingArea *) override
Definition: dlgctrl.cxx:1302
virtual ~SvxPreviewBase() override
Definition: dlgctrl.cxx:1313
void LocalPrePaint(vcl::RenderContext const &rRenderContext)
Definition: dlgctrl.cxx:1319
void LocalPostPaint(vcl::RenderContext &rRenderContext)
Definition: dlgctrl.cxx:1346
Size GetOutputSize() const
Definition: dlgctrl.hxx:308
RectPoint eRP
Definition: dlgctrl.hxx:83
Point aPtRM
Definition: dlgctrl.hxx:80
RectPoint GetRPFromPoint(Point, bool bRTL=false) const
Definition: dlgctrl.cxx:474
virtual ~SvxRectCtl() override
Definition: dlgctrl.cxx:91
void SetState(CTL_STATE nState)
Definition: dlgctrl.cxx:515
virtual void GetFocus() override
Definition: dlgctrl.cxx:418
SvxRectCtl(const SvxRectCtl &)=delete
std::unique_ptr< BitmapEx > pBitmap
Definition: dlgctrl.hxx:84
SVX_DLLPRIVATE void Resize_Impl(const Size &rSize)
Definition: dlgctrl.cxx:104
Point aPtNew
Definition: dlgctrl.hxx:82
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition: dlgctrl.cxx:561
rtl::Reference< SvxRectCtlAccessibleContext > pAccContext
Definition: dlgctrl.hxx:77
Point GetApproxLogPtFromPixPt(const Point &rRoughPixelPoint) const
Definition: dlgctrl.cxx:436
void Reset()
Definition: dlgctrl.cxx:492
Point aPtMB
Definition: dlgctrl.hxx:81
tools::Rectangle CalculateFocusRectangle() const
Definition: dlgctrl.cxx:535
virtual void LoseFocus() override
Definition: dlgctrl.cxx:431
void SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder)
Definition: dlgctrl.cxx:84
CTL_STATE m_nState
Definition: dlgctrl.hxx:85
virtual bool KeyInput(const KeyEvent &) override
Definition: dlgctrl.cxx:201
SVX_DLLPRIVATE BitmapEx & GetRectBitmap()
Definition: dlgctrl.cxx:57
bool mbCompleteDisable
Definition: dlgctrl.hxx:86
SvxTabPage * m_pPage
Definition: dlgctrl.hxx:76
RectPoint GetApproxRPFromPixPt(const css::awt::Point &rPixelPoint) const
Definition: dlgctrl.cxx:569
Point aPtLB
Definition: dlgctrl.hxx:81
void DoCompletelyDisable(bool bNew)
Definition: dlgctrl.cxx:575
Point aPtMT
Definition: dlgctrl.hxx:79
static SVX_DLLPRIVATE void InitSettings(vcl::RenderContext &rRenderContext)
Definition: dlgctrl.cxx:175
virtual void Resize() override
Definition: dlgctrl.cxx:99
Point aPtLT
Definition: dlgctrl.hxx:79
virtual tools::Rectangle GetFocusRect() override
Definition: dlgctrl.cxx:370
void SetActualRP(RectPoint eNewRP)
Definition: dlgctrl.cxx:502
bool IsCompletelyDisabled() const
Definition: dlgctrl.hxx:134
virtual bool MouseButtonDown(const MouseEvent &) override
Definition: dlgctrl.cxx:186
virtual void StyleUpdated() override
Definition: dlgctrl.cxx:169
Point aPtRB
Definition: dlgctrl.hxx:81
sal_uInt16 nBorderWidth
Definition: dlgctrl.hxx:78
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctrl.cxx:75
Point aPtLM
Definition: dlgctrl.hxx:80
RectPoint GetActualRP() const
Definition: dlgctrl.hxx:118
const Point & GetPointFromRP(RectPoint) const
Definition: dlgctrl.cxx:380
Point aPtRT
Definition: dlgctrl.hxx:79
RectPoint eDefRP
Definition: dlgctrl.hxx:83
Point aPtMM
Definition: dlgctrl.hxx:80
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
Definition: dlgctrl.cxx:285
Point SetActualRPWithoutInvalidate(RectPoint eNewRP)
Definition: dlgctrl.cxx:397
SVX_DLLPRIVATE void InitRectBitmap()
Definition: dlgctrl.cxx:122
weld::SpinButton & get_widget()
Definition: relfld.hxx:61
virtual void PointChanged(weld::DrawingArea *pArea, RectPoint eRP)=0
void SetSymbol(Graphic *p, const Size &s)
Definition: dlgctrl.cxx:1143
rtl::Reference< SdrPathObj > mpLineObjC
Definition: dlgctrl.hxx:336
virtual ~SvxXLinePreview() override
Definition: dlgctrl.cxx:1139
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctrl.cxx:1127
void SetLineAttributes(const SfxItemSet &rItemSet)
Definition: dlgctrl.cxx:1158
void ResizeSymbol(const Size &s)
Definition: dlgctrl.cxx:1149
virtual void Resize() override
Definition: dlgctrl.cxx:1081
rtl::Reference< SdrPathObj > mpLineObjA
Definition: dlgctrl.hxx:334
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctrl.cxx:1172
Graphic * mpGraphic
Definition: dlgctrl.hxx:338
rtl::Reference< SdrPathObj > mpLineObjB
Definition: dlgctrl.hxx:335
virtual void Resize() override
Definition: dlgctrl.cxx:1389
rtl::Reference< SdrObject > mpRectangleObject
Definition: dlgctrl.hxx:360
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctrl.cxx:1411
void SetAttributes(const SfxItemSet &rItemSet)
Definition: dlgctrl.cxx:1405
virtual ~SvxXRectPreview() override
Definition: dlgctrl.cxx:1401
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctrl.cxx:1380
void SetShadowAttributes(const SfxItemSet &rItemSet)
Definition: dlgctrl.cxx:1237
void SetShadowPosition(const Point &rPos)
Definition: dlgctrl.cxx:1243
rtl::Reference< SdrObject > mpRectangleShadow
Definition: dlgctrl.hxx:385
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctrl.cxx:1248
rtl::Reference< SdrObject > mpRectangleObject
Definition: dlgctrl.hxx:384
virtual ~SvxXShadowPreview() override
Definition: dlgctrl.cxx:1227
void SetRectangleAttributes(const SfxItemSet &rItemSet)
Definition: dlgctrl.cxx:1231
Point maShadowOffset
Definition: dlgctrl.hxx:382
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctrl.cxx:1204
void disposeAndClear()
static VclPtr< reference_type > Create(Arg &&... arg)
const Color & GetColor() const
const OUString & GetName() const
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
TYPE getX() const
virtual void ProcessDisplay(DisplayInfo &rDisplayInfo) override
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
constexpr Size GetSize() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
bool IsMod1() const
sal_uInt16 GetCode() const
bool IsShift() const
bool IsMod2() const
weld::DrawingArea * GetDrawingArea() const
void SetOutputSizePixel(const Size &rSize)
Size const & GetOutputSizePixel() const
virtual OutputDevice & get_ref_device()=0
virtual int get_width_chars() const=0
virtual void set_width_chars(int nChars)=0
virtual vcl::ImageType get_icon_size() const=0
virtual int get_text_height() const=0
virtual void set_size_request(int nWidth, int nHeight)=0
virtual float get_approximate_digit_width() const=0
constexpr ::Color COL_LIGHTRED(0xFF, 0x00, 0x00)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
int nCount
#define DBG_ASSERT(sCon, aError)
Size SFX2_DLLPUBLIC getPreviewStripSize(const OutputDevice &rReference)
void padWidthForSidebar(weld::Toolbar &rToolbar, const css::uno::Reference< css::frame::XFrame > &rFrame)
Definition: dlgctrl.cxx:1443
void limitWidthForSidebar(weld::SpinButton &rSpinButton)
Definition: dlgctrl.cxx:1430
#define OUTPUT_DRAWMODE_CONTRAST
Definition: dlgctrl.cxx:47
#define OUTPUT_DRAWMODE_COLOR
Definition: dlgctrl.cxx:46
CTL_STATE
Definition: dlgctrl.hxx:60
float y
float x
sal_Int32 nState
sal_Int32 nIndex
void * p
sal_Int64 n
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
sal_uInt16 nPos
MapUnit
NONE
tools::Long const nBorder
int i
class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) ObjectContactPainter typedef ::std::vector< SdrObject * > SdrObjectVector
long Long
bool isHistorical8x8(const BitmapEx &rBitmapEx, Color &o_rBack, Color &o_rFront)
RectPoint
Definition: rectenum.hxx:23
#define nPixel
@ Line
object group
@ PolyLine
polygon, PolyPolygon
unsigned char sal_uInt8
Reference< XControl > m_xControl
constexpr TypedWhichId< XLineEndItem > XATTR_LINEEND(XATTR_LINE_FIRST+5)
constexpr TypedWhichId< XLineStartItem > XATTR_LINESTART(XATTR_LINE_FIRST+4)