LibreOffice Module extensions (master) 1
grid.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 <sal/config.h>
21#include <o3tl/sprintf.hxx>
22#include <osl/thread.h>
23#include <rtl/math.hxx>
24
25#include <bitmaps.hlst>
26#include <cmath>
27
28#include "grid.hxx"
29#include <vcl/bitmapex.hxx>
30#include <vcl/customweld.hxx>
31#include <vcl/event.hxx>
32#include <vcl/settings.hxx>
33#include <vcl/svapp.hxx>
34
35#include <algorithm>
36#include <limits>
37#include <memory>
38
40{
41 // helper class for handles
42 struct impHandle
43 {
45 sal_uInt16 mnOffX;
46 sal_uInt16 mnOffY;
47
48 impHandle(const Point& rPos, sal_uInt16 nX, sal_uInt16 nY)
49 : maPos(rPos), mnOffX(nX), mnOffY(nY)
50 {
51 }
52
53 bool operator<(const impHandle& rComp) const
54 {
55 return (maPos.X() < rComp.maPos.X());
56 }
57
58 void draw(vcl::RenderContext& rRenderContext, const BitmapEx& rBitmapEx)
59 {
60 const Point aOffset(rRenderContext.PixelToLogic(Point(mnOffX, mnOffY)));
61 rRenderContext.DrawBitmapEx(maPos - aOffset, rBitmapEx);
62 }
63
64 bool isHit(OutputDevice const & rWin, const Point& rPos)
65 {
66 const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
67 const tools::Rectangle aTarget(maPos - aOffset, maPos + aOffset);
68 return aTarget.Contains(rPos);
69 }
70 };
71
73
74 double m_fMinX;
75 double m_fMinY;
76 double m_fMaxX;
77 double m_fMaxY;
78
79 double m_fChunkX;
81 double m_fChunkY;
83
84 double* m_pXValues;
87 std::unique_ptr<double[]> m_pNewYValues;
88
89 sal_uInt16 m_BmOffX;
90 sal_uInt16 m_BmOffY;
91
93
94 // stuff for handles
95 using Handles = std::vector<impHandle>;
96 static constexpr auto npos = std::numeric_limits<Handles::size_type>::max();
98 Handles::size_type m_nDragIndex;
99
101
102 Point transform( double x, double y );
103 void transform( const Point& rOriginal, double& x, double& y );
104
105 double findMinX();
106 double findMinY();
107 double findMaxX();
108 double findMaxY();
109
110 void drawGrid(vcl::RenderContext& rRenderContext);
111 void drawOriginal(vcl::RenderContext& rRenderContext);
112 void drawNew(vcl::RenderContext& rRenderContext);
113 void drawHandles(vcl::RenderContext& rRenderContext);
114
115 void computeExtremes();
116 static void computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut );
117 void computeNew();
118 static double interpolate( double x, double const * pNodeX, double const * pNodeY, int nNodes );
119
120 virtual bool MouseMove( const MouseEvent& ) override;
121 virtual bool MouseButtonDown( const MouseEvent& ) override;
122 virtual bool MouseButtonUp( const MouseEvent& ) override;
123 void onResize();
124 virtual void Resize() override;
125 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
126 void drawLine(vcl::RenderContext& rRenderContext, double x1, double y1, double x2, double y2);
127public:
128 GridWindow();
129 void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap);
130 virtual ~GridWindow() override;
131
132 void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
133
134 double* getNewYValues() { return m_pNewYValues.get(); }
135
136 void ChangeMode(ResetType nType);
137
138 virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect ) override;
139};
140
142 : m_aGridArea(50, 15, 100, 100)
143 , m_fMinX(0.0)
144 , m_fMinY(0.0)
145 , m_fMaxX(0.0)
146 , m_fMaxY(0.0)
147 , m_fChunkX(0.0)
148 , m_fMinChunkX(0.0)
149 , m_fChunkY(0.0)
150 , m_fMinChunkY(0.0)
151 , m_pXValues(nullptr)
152 , m_pOrigYValues(nullptr)
153 , m_nValues(0)
154 , m_BmOffX(0)
155 , m_BmOffY(0)
156 , m_bCutValues(false)
157 , m_nDragIndex(npos)
158{
159}
160
161void GridWindow::Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap)
162{
163 m_aMarkerBitmap = rMarkerBitmap;
164 m_pXValues = pXValues;
165 m_pOrigYValues = pYValues;
166 m_nValues = nValues;
167 m_bCutValues = bCutValues;
168
169 onResize();
170
172 {
173 m_pNewYValues.reset(new double[ m_nValues ]);
174 memcpy( m_pNewYValues.get(), m_pOrigYValues, sizeof( double ) * m_nValues );
175 }
176
177 setBoundings( 0, 0, 1023, 1023 );
179
180 // create left and right marker as first and last entry
181 m_BmOffX = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Width() >> 1);
182 m_BmOffY = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Height() >> 1);
185}
186
188{
189 onResize();
190}
191
193{
194 Size aSize = GetOutputSizePixel();
195 m_aGridArea.setWidth( aSize.Width() - 80 );
196 m_aGridArea.setHeight( aSize.Height() - 40 );
197}
198
200{
201 Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(240, 200), MapMode(MapUnit::MapAppFont)));
202 pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
203 CustomWidgetController::SetDrawingArea(pDrawingArea);
204 SetOutputSizePixel(aSize);
205}
206
207GridDialog::GridDialog(weld::Window* pParent, double* pXValues, double* pYValues, int nValues)
208 : GenericDialogController(pParent, "modules/scanner/ui/griddialog.ui", "GridDialog")
209 , m_xResetTypeBox(m_xBuilder->weld_combo_box("resetTypeCombobox"))
210 , m_xResetButton(m_xBuilder->weld_button("resetButton"))
211 , m_xGridWindow(new GridWindow)
212 , m_xGridWindowWND(new weld::CustomWeld(*m_xBuilder, "gridwindow", *m_xGridWindow))
213{
214 m_xGridWindow->Init(pXValues, pYValues, nValues, true/*bCutValues*/, BitmapEx(RID_SCANNER_HANDLE));
215 m_xResetTypeBox->set_active(0);
216 m_xResetButton->connect_clicked( LINK( this, GridDialog, ClickButtonHdl ) );
217}
218
220{
221}
222
224{
225 m_pNewYValues.reset();
226}
227
229{
230 if( ! m_pXValues )
231 return 0.0;
232 double fMin = m_pXValues[0];
233 for( int i = 1; i < m_nValues; i++ )
234 if( m_pXValues[ i ] < fMin )
235 fMin = m_pXValues[ i ];
236 return fMin;
237}
238
240{
241 if( ! m_pNewYValues )
242 return 0.0;
243 double fMin = m_pNewYValues[0];
244 for( int i = 1; i < m_nValues; i++ )
245 if( m_pNewYValues[ i ] < fMin )
246 fMin = m_pNewYValues[ i ];
247 return fMin;
248}
249
250
252{
253 if( ! m_pXValues )
254 return 0.0;
255 double fMax = m_pXValues[0];
256 for( int i = 1; i < m_nValues; i++ )
257 if( m_pXValues[ i ] > fMax )
258 fMax = m_pXValues[ i ];
259 return fMax;
260}
261
262
264{
265 if( ! m_pNewYValues )
266 return 0.0;
267 double fMax = m_pNewYValues[0];
268 for( int i = 1; i < m_nValues; i++ )
269 if( m_pNewYValues[ i ] > fMax )
270 fMax = m_pNewYValues[ i ];
271 return fMax;
272}
273
274
276{
277 if( !(m_nValues && m_pXValues && m_pOrigYValues) )
278 return;
279
282 for( int i = 1; i < m_nValues; i++ )
283 {
284 if( m_pXValues[ i ] > m_fMaxX )
285 m_fMaxX = m_pXValues[ i ];
286 else if( m_pXValues[ i ] < m_fMinX )
287 m_fMinX = m_pXValues[ i ];
288 if( m_pOrigYValues[ i ] > m_fMaxY )
290 else if( m_pOrigYValues[ i ] < m_fMinY )
292 }
294}
295
296
297Point GridWindow::transform( double x, double y )
298{
299 Point aRet;
300
301 aRet.setX( static_cast<tools::Long>( ( x - m_fMinX ) *
302 static_cast<double>(m_aGridArea.GetWidth()) / ( m_fMaxX - m_fMinX )
303 + m_aGridArea.Left() ) );
304 aRet.setY( static_cast<tools::Long>(
306 ( y - m_fMinY ) *
307 static_cast<double>(m_aGridArea.GetHeight()) / ( m_fMaxY - m_fMinY ) ) );
308 return aRet;
309}
310
311void GridWindow::transform( const Point& rOriginal, double& x, double& y )
312{
313 const tools::Long nWidth = m_aGridArea.GetWidth();
314 const tools::Long nHeight = m_aGridArea.GetHeight();
315 if (!nWidth || !nHeight)
316 return;
317 x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / static_cast<double>(nWidth) + m_fMinX;
318 y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / static_cast<double>(nHeight) + m_fMinY;
319}
320
321void GridWindow::drawLine(vcl::RenderContext& rRenderContext, double x1, double y1, double x2, double y2 )
322{
323 rRenderContext.DrawLine(transform(x1, y1), transform(x2, y2));
324}
325
326void GridWindow::computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut )
327{
328 // get a nice chunk size like 10, 100, 25 or such
329 fChunkOut = ( fMax - fMin ) / 6.0;
330 int logchunk = static_cast<int>(std::log10( fChunkOut ));
331 int nChunk = static_cast<int>( fChunkOut / std::exp( static_cast<double>(logchunk-1) * M_LN10 ) );
332 if( nChunk >= 75 )
333 nChunk = 100;
334 else if( nChunk >= 35 )
335 nChunk = 50;
336 else if ( nChunk > 20 )
337 nChunk = 25;
338 else if ( nChunk >= 13 )
339 nChunk = 20;
340 else if( nChunk > 5 )
341 nChunk = 10;
342 else
343 nChunk = 5;
344 fChunkOut = static_cast<double>(nChunk) * exp( static_cast<double>(logchunk-1) * M_LN10 );
345 // compute whole chunks fitting into fMin
346 nChunk = static_cast<int>( fMin / fChunkOut );
347 fMinChunkOut = static_cast<double>(nChunk) * fChunkOut;
348 while( fMinChunkOut < fMin )
349 fMinChunkOut += fChunkOut;
350}
351
352
354{
355 if(2 == m_aHandles.size())
356 {
357 // special case: only left and right markers
358 double xleft, yleft;
359 double xright, yright;
360 transform(m_aHandles[0].maPos, xleft, yleft);
361 transform(m_aHandles[1].maPos, xright, yright );
362 double factor = (yright-yleft)/(xright-xleft);
363 for( int i = 0; i < m_nValues; i++ )
364 {
365 m_pNewYValues[ i ] = yleft + ( m_pXValues[ i ] - xleft )*factor;
366 }
367 }
368 else
369 {
370 // sort markers
371 std::sort(m_aHandles.begin(), m_aHandles.end());
372 const int nSorted = m_aHandles.size();
373 int i;
374
375 // get node arrays
376 std::unique_ptr<double[]> nodex(new double[ nSorted ]);
377 std::unique_ptr<double[]> nodey(new double[ nSorted ]);
378
379 for( i = 0; i < nSorted; i++ )
380 transform( m_aHandles[i].maPos, nodex[ i ], nodey[ i ] );
381
382 for( i = 0; i < m_nValues; i++ )
383 {
384 double x = m_pXValues[ i ];
385 m_pNewYValues[ i ] = interpolate( x, nodex.get(), nodey.get(), nSorted );
386 if( m_bCutValues )
387 {
388 if( m_pNewYValues[ i ] > m_fMaxY )
390 else if( m_pNewYValues[ i ] < m_fMinY )
392 }
393 }
394 }
395}
396
397
399 double x,
400 double const * pNodeX,
401 double const * pNodeY,
402 int nNodes )
403{
404 // compute Lagrange interpolation
405 double ret = 0;
406 for( int i = 0; i < nNodes; i++ )
407 {
408 double sum = pNodeY[ i ];
409 for( int n = 0; n < nNodes; n++ )
410 {
411 if( n != i )
412 {
413 sum *= x - pNodeX[ n ];
414 sum /= pNodeX[ i ] - pNodeX[ n ];
415 }
416 }
417 ret += sum;
418 }
419 return ret;
420}
421
422void GridDialog::setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY)
423{
424 m_xGridWindow->setBoundings(fMinX, fMinY, fMaxX, fMaxY);
425}
426
427void GridWindow::setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY)
428{
429 m_fMinX = fMinX;
430 m_fMinY = fMinY;
431 m_fMaxX = fMaxX;
432 m_fMaxY = fMaxY;
433
436}
437
439{
440 char pBuf[256];
441 rRenderContext.SetLineColor(COL_BLACK);
442 // draw vertical lines
443 for (double fX = m_fMinChunkX; fX < m_fMaxX; fX += m_fChunkX)
444 {
445 drawLine(rRenderContext, fX, m_fMinY, fX, m_fMaxY);
446 // draw tickmarks
447 Point aPt = transform(fX, m_fMinY);
448 o3tl::sprintf(pBuf, "%g", fX);
449 OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding());
450 Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight());
451 aPt.AdjustX( -(aTextSize.Width() / 2) );
452 aPt.AdjustY(aTextSize.Height() / 2 );
453 rRenderContext.DrawText(aPt, aMark);
454 }
455 // draw horizontal lines
456 for (double fY = m_fMinChunkY; fY < m_fMaxY; fY += m_fChunkY)
457 {
458 drawLine(rRenderContext, m_fMinX, fY, m_fMaxX, fY);
459 // draw tickmarks
460 Point aPt = transform(m_fMinX, fY);
461 o3tl::sprintf(pBuf, "%g", fY);
462 OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding());
463 Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight());
464 aPt.AdjustX( -(aTextSize.Width() + 2) );
465 aPt.AdjustY( -(aTextSize.Height() / 2) );
466 rRenderContext.DrawText(aPt, aMark);
467 }
468
469 // draw boundings
470 drawLine(rRenderContext, m_fMinX, m_fMinY, m_fMaxX, m_fMinY);
471 drawLine(rRenderContext, m_fMinX, m_fMaxY, m_fMaxX, m_fMaxY);
472 drawLine(rRenderContext, m_fMinX, m_fMinY, m_fMinX, m_fMaxY);
473 drawLine(rRenderContext, m_fMaxX, m_fMinY, m_fMaxX, m_fMaxY);
474}
475
477{
479 {
480 rRenderContext.SetLineColor(COL_RED);
481 for (int i = 0; i < m_nValues - 1; i++)
482 {
483 drawLine(rRenderContext,
485 m_pXValues[i + 1], m_pOrigYValues[i + 1]);
486 }
487 }
488}
489
491{
493 {
494 rRenderContext.SetClipRegion(vcl::Region(m_aGridArea));
495 rRenderContext.SetLineColor(COL_YELLOW);
496 for (int i = 0; i < m_nValues - 1; i++)
497 {
498 drawLine(rRenderContext,
500 m_pXValues[i + 1], m_pNewYValues[i + 1]);
501 }
502 rRenderContext.SetClipRegion();
503 }
504}
505
507{
508 for(impHandle & rHandle : m_aHandles)
509 {
510 rHandle.draw(rRenderContext, m_aMarkerBitmap);
511 }
512}
513
515{
516 rRenderContext.SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetDialogColor()));
517 drawGrid(rRenderContext);
518 drawOriginal(rRenderContext);
519 drawNew(rRenderContext);
520 drawHandles(rRenderContext);
521}
522
524{
525 if( rEvt.GetButtons() != MOUSE_LEFT || m_nDragIndex == npos )
526 return false;
527
528 Point aPoint( rEvt.GetPosPixel() );
529
530 if( m_nDragIndex == 0 || m_nDragIndex == m_aHandles.size() - 1)
531 {
532 aPoint.setX( m_aHandles[m_nDragIndex].maPos.X() );
533 }
534 else
535 {
536 if(aPoint.X() < m_aGridArea.Left())
537 aPoint.setX( m_aGridArea.Left() );
538 else if(aPoint.X() > m_aGridArea.Right())
539 aPoint.setX( m_aGridArea.Right() );
540 }
541
542 if( aPoint.Y() < m_aGridArea.Top() )
543 aPoint.setY( m_aGridArea.Top() );
544 else if( aPoint.Y() > m_aGridArea.Bottom() )
545 aPoint.setY( m_aGridArea.Bottom() );
546
547 if( aPoint != m_aHandles[m_nDragIndex].maPos )
548 {
549 m_aHandles[m_nDragIndex].maPos = aPoint;
551 }
552
553 return false;
554}
555
557{
558 if( rEvt.GetButtons() == MOUSE_LEFT )
559 {
560 if( m_nDragIndex != npos )
561 {
563 computeNew();
565 }
566 }
567
568 return false;
569}
570
572{
573 Point aPoint( rEvt.GetPosPixel() );
574 Handles::size_type nMarkerIndex = npos;
575
576 for(Handles::size_type a(0); nMarkerIndex == npos && a < m_aHandles.size(); a++)
577 {
578 if(m_aHandles[a].isHit(GetDrawingArea()->get_ref_device(), aPoint))
579 {
580 nMarkerIndex = a;
581 }
582 }
583
584 if( rEvt.GetButtons() == MOUSE_LEFT )
585 {
586 // user wants to drag a button
587 if( nMarkerIndex != npos )
588 {
589 m_nDragIndex = nMarkerIndex;
590 }
591 }
592 else if( rEvt.GetButtons() == MOUSE_RIGHT )
593 {
594 // user wants to add/delete a button
595 if( nMarkerIndex != npos )
596 {
597 if( nMarkerIndex != 0 && nMarkerIndex != m_aHandles.size() - 1)
598 {
599 // delete marker under mouse
600 if( m_nDragIndex == nMarkerIndex )
602
603 m_aHandles.erase(m_aHandles.begin() + nMarkerIndex);
604 }
605 }
606 else
607 {
608 m_BmOffX = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Width() >> 1);
609 m_BmOffY = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Height() >> 1);
610 m_aHandles.push_back(impHandle(aPoint, m_BmOffX, m_BmOffY));
611 }
612
613 computeNew();
615 }
616
617 return false;
618}
619
621{
622 switch( nType )
623 {
625 {
626 for( int i = 0; i < m_nValues; i++ )
627 {
629 }
630 }
631 break;
633 {
634 for( int i = 0; i < m_nValues; i++ )
635 {
637 }
638 }
639 break;
640 case ResetType::RESET:
641 {
643 memcpy( m_pNewYValues.get(), m_pOrigYValues, m_nValues*sizeof(double) );
644 }
645 break;
647 {
648 for( int i = 0; i < m_nValues; i++ )
649 {
650 m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(std::expm1((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX)))/(M_E-1.0);
651 }
652 }
653 break;
654
655 default:
656 break;
657 }
658
659 if (m_pNewYValues)
660 {
661 for(size_t i(0); i < m_aHandles.size(); i++)
662 {
663 // find nearest xvalue
664 double x, y;
665 transform( m_aHandles[i].maPos, x, y );
666 int nIndex = 0;
667 double delta = std::fabs( x-m_pXValues[0] );
668 for( int n = 1; n < m_nValues; n++ )
669 {
670 if( delta > std::fabs( x - m_pXValues[ n ] ) )
671 {
672 delta = std::fabs( x - m_pXValues[ n ] );
673 nIndex = n;
674 }
675 }
676 if( 0 == i )
678 else if( m_aHandles.size() - 1 == i )
680 else
682 }
683 }
684
685 Invalidate();
686}
687
689{
690 int nType = m_xResetTypeBox->get_active();
691 m_xGridWindow->ChangeMode(static_cast<ResetType>(nType));
692}
693
695{
696 return m_xGridWindow->getNewYValues();
697}
698
699/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static const AllSettings & GetSettings()
const Size & GetSizePixel() const
virtual ~GridDialog() override
Definition: grid.cxx:219
std::unique_ptr< weld::ComboBox > m_xResetTypeBox
Definition: grid.hxx:36
std::unique_ptr< GridWindow > m_xGridWindow
Definition: grid.hxx:38
std::unique_ptr< weld::Button > m_xResetButton
Definition: grid.hxx:37
GridDialog(weld::Window *pParent, double *pXValues, double *pYValues, int nValues)
Definition: grid.cxx:207
void setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY)
Definition: grid.cxx:422
double * getNewYValues()
Definition: grid.cxx:694
std::unique_ptr< double[]> m_pNewYValues
Definition: grid.cxx:87
Handles::size_type m_nDragIndex
Definition: grid.cxx:98
double * getNewYValues()
Definition: grid.cxx:134
double findMinY()
Definition: grid.cxx:239
double findMaxY()
Definition: grid.cxx:263
static constexpr auto npos
Definition: grid.cxx:96
void computeNew()
Definition: grid.cxx:353
Handles m_aHandles
Definition: grid.cxx:97
void computeExtremes()
Definition: grid.cxx:275
void onResize()
Definition: grid.cxx:192
double m_fMaxX
Definition: grid.cxx:76
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
Definition: grid.cxx:514
double m_fMinX
Definition: grid.cxx:74
static void computeChunk(double fMin, double fMax, double &fChunkOut, double &fMinChunkOut)
Definition: grid.cxx:326
void drawNew(vcl::RenderContext &rRenderContext)
Definition: grid.cxx:490
double * m_pXValues
Definition: grid.cxx:84
void ChangeMode(ResetType nType)
Definition: grid.cxx:620
void drawGrid(vcl::RenderContext &rRenderContext)
Definition: grid.cxx:438
double m_fMaxY
Definition: grid.cxx:77
Point transform(double x, double y)
Definition: grid.cxx:297
sal_uInt16 m_BmOffY
Definition: grid.cxx:90
double * m_pOrigYValues
Definition: grid.cxx:85
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: grid.cxx:199
void setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY)
Definition: grid.cxx:427
virtual bool MouseButtonDown(const MouseEvent &) override
Definition: grid.cxx:571
double m_fMinChunkX
Definition: grid.cxx:80
bool m_bCutValues
Definition: grid.cxx:92
sal_uInt16 m_BmOffX
Definition: grid.cxx:89
virtual ~GridWindow() override
Definition: grid.cxx:223
void drawOriginal(vcl::RenderContext &rRenderContext)
Definition: grid.cxx:476
void Init(double *pXValues, double *pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap)
Definition: grid.cxx:161
std::vector< impHandle > Handles
Definition: grid.cxx:95
double m_fChunkX
Definition: grid.cxx:79
double findMaxX()
Definition: grid.cxx:251
virtual bool MouseButtonUp(const MouseEvent &) override
Definition: grid.cxx:556
static double interpolate(double x, double const *pNodeX, double const *pNodeY, int nNodes)
Definition: grid.cxx:398
tools::Rectangle m_aGridArea
Definition: grid.cxx:72
void drawHandles(vcl::RenderContext &rRenderContext)
Definition: grid.cxx:506
int m_nValues
Definition: grid.cxx:86
BitmapEx m_aMarkerBitmap
Definition: grid.cxx:100
void drawLine(vcl::RenderContext &rRenderContext, double x1, double y1, double x2, double y2)
Definition: grid.cxx:321
virtual void Resize() override
Definition: grid.cxx:187
GridWindow()
Definition: grid.cxx:141
double m_fChunkY
Definition: grid.cxx:81
virtual bool MouseMove(const MouseEvent &) override
Definition: grid.cxx:523
double m_fMinY
Definition: grid.cxx:75
double findMinX()
Definition: grid.cxx:228
double m_fMinChunkY
Definition: grid.cxx:82
sal_uInt16 GetButtons() const
const Point & GetPosPixel() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetLineColor()
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
void SetClipRegion()
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
tools::Long GetTextHeight() const
void SetBackground()
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
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 Height() const
constexpr tools::Long Width() const
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr tools::Long Top() const
void setWidth(tools::Long n)
constexpr tools::Long Right() const
constexpr tools::Long GetHeight() const
void setHeight(tools::Long n)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
weld::DrawingArea * GetDrawingArea() const
void SetOutputSizePixel(const Size &rSize)
Size const & GetOutputSizePixel() const
virtual OutputDevice & get_ref_device()=0
virtual void set_size_request(int nWidth, int nHeight)=0
constexpr ::Color COL_YELLOW(0xFF, 0xFF, 0x00)
constexpr ::Color COL_RED(0x80, 0x00, 0x00)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
float y
float x
#define MOUSE_LEFT
#define MOUSE_RIGHT
IMPL_LINK_NOARG(GridDialog, ClickButtonHdl, weld::Button &, void)
Definition: grid.cxx:688
ResetType
Definition: grid.hxx:27
@ LINEAR_DESCENDING
@ LINEAR_ASCENDING
sal_Int32 nIndex
sal_Int64 n
uno_Any a
int i
int sprintf(char(&s)[N], char const *format, T &&... arguments)
long Long
QPRO_FUNC_TYPE nType
sal_uInt16 mnOffX
Definition: grid.cxx:45
bool isHit(OutputDevice const &rWin, const Point &rPos)
Definition: grid.cxx:64
impHandle(const Point &rPos, sal_uInt16 nX, sal_uInt16 nY)
Definition: grid.cxx:48
bool operator<(const impHandle &rComp) const
Definition: grid.cxx:53
void draw(vcl::RenderContext &rRenderContext, const BitmapEx &rBitmapEx)
Definition: grid.cxx:58
sal_uInt16 mnOffY
Definition: grid.cxx:46