LibreOffice Module vcl (master)  1
calendar.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 <vcl/svapp.hxx>
21 #include <vcl/help.hxx>
22 #include <vcl/menu.hxx>
23 #include <vcl/settings.hxx>
24 #include <vcl/event.hxx>
25 #include <vcl/commandevent.hxx>
28 #include <com/sun/star/i18n/Weekdays.hpp>
29 #include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
30 #include <com/sun/star/i18n/CalendarFieldIndex.hpp>
31 #include <sal/log.hxx>
32 
33 #include <vcl/calendar.hxx>
34 #include <svdata.hxx>
35 #include <strings.hrc>
36 #include <memory>
37 
38 #define DAY_OFFX 4
39 #define DAY_OFFY 2
40 #define MONTH_BORDERX 4
41 #define MONTH_OFFY 3
42 #define WEEKDAY_OFFY 3
43 #define TITLE_OFFY 3
44 #define TITLE_BORDERY 2
45 #define SPIN_OFFX 4
46 #define SPIN_OFFY TITLE_BORDERY
47 
48 #define CALENDAR_HITTEST_DAY (sal_uInt16(0x0001))
49 #define CALENDAR_HITTEST_MONTHTITLE (sal_uInt16(0x0004))
50 #define CALENDAR_HITTEST_PREV (sal_uInt16(0x0008))
51 #define CALENDAR_HITTEST_NEXT (sal_uInt16(0x0010))
52 
53 #define MENU_YEAR_COUNT 3
54 
55 using namespace ::com::sun::star;
56 
57 static void ImplCalendarSelectDate( IntDateSet* pTable, const Date& rDate, bool bSelect )
58 {
59  if ( bSelect )
60  pTable->insert( rDate.GetDate() );
61  else
62  pTable->erase( rDate.GetDate() );
63 }
64 
65 
66 
67 void Calendar::ImplInit( WinBits nWinStyle )
68 {
69  mpSelectTable.reset(new IntDateSet);
70  mnDayCount = 0;
71  mnWinStyle = nWinStyle;
72  mnFirstYear = 0;
73  mnLastYear = 0;
74  mbCalc = true;
75  mbFormat = true;
76  mbDrag = false;
77  mbSelection = false;
78  mbMenuDown = false;
79  mbSpinDown = false;
80  mbPrevIn = false;
81  mbNextIn = false;
82  mbTravelSelect = false;
83  mbAllSel = false;
84 
85  OUString aGregorian( "gregorian");
86  maCalendarWrapper.loadCalendar( aGregorian,
88  if (maCalendarWrapper.getUniqueID() != aGregorian)
89  {
90  SAL_WARN( "vcl.control", "Calendar::ImplInit: No ``gregorian'' calendar available for locale ``"
92  << "'' and other calendars aren't supported. Using en-US fallback." );
93 
94  /* If we ever wanted to support other calendars than Gregorian a lot of
95  * rewrite would be necessary to internally replace use of class Date
96  * with proper class CalendarWrapper methods, get rid of fixed 12
97  * months, fixed 7 days, ... */
98  maCalendarWrapper.loadCalendar( aGregorian, lang::Locale( "en", "US", ""));
99  }
100 
103 
104  // Sonstige Strings erzeugen
105  maDayText = VclResId(STR_SVT_CALENDAR_DAY);
106  maWeekText = VclResId(STR_SVT_CALENDAR_WEEK);
107 
108  // Tagestexte anlegen
109  for (sal_Int32 i = 0; i < 31; ++i)
110  maDayTexts[i] = OUString::number(i+1);
111 
113 }
114 
116 {
117  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
118  maSelColor = rStyleSettings.GetHighlightTextColor();
119  SetPointFont(rRenderContext, rStyleSettings.GetToolFont());
120  rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
121  rRenderContext.SetBackground(Wallpaper(rStyleSettings.GetFieldColor()));
122 }
123 
125 {
126  const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
127  maSelColor = rStyleSettings.GetHighlightTextColor();
128  SetPointFont(*this, rStyleSettings.GetToolFont());
129  SetTextColor(rStyleSettings.GetFieldTextColor());
130  SetBackground(Wallpaper(rStyleSettings.GetFieldColor()));
131 }
132 
133 Calendar::Calendar( vcl::Window* pParent, WinBits nWinStyle ) :
134  Control( pParent, nWinStyle & (WB_TABSTOP | WB_GROUP | WB_BORDER | WB_3DLOOK) ),
135  maCalendarWrapper( Application::GetAppLocaleDataWrapper().getComponentContext() ),
136  maOldFormatFirstDate( 0, 0, 1900 ),
137  maOldFormatLastDate( 0, 0, 1900 ),
138  maFirstDate( 0, 0, 1900 ),
139  maOldFirstDate( 0, 0, 1900 ),
140  maCurDate( Date::SYSTEM ),
141  maOldCurDate( 0, 0, 1900 )
142 {
143  ImplInit( nWinStyle );
144 }
145 
147 {
148  disposeOnce();
149 }
150 
152 {
153  mpSelectTable.reset();
154  mpOldSelectTable.reset();
156 }
157 
159 {
160  // Map i18n::Weekdays to Date DayOfWeek
161  DayOfWeek eDay;
162  sal_Int16 nDay = maCalendarWrapper.getFirstDayOfWeek();
163  switch (nDay)
164  {
165  case i18n::Weekdays::SUNDAY :
166  eDay = SUNDAY;
167  break;
168  case i18n::Weekdays::MONDAY :
169  eDay = MONDAY;
170  break;
171  case i18n::Weekdays::TUESDAY :
172  eDay = TUESDAY;
173  break;
174  case i18n::Weekdays::WEDNESDAY :
175  eDay = WEDNESDAY;
176  break;
177  case i18n::Weekdays::THURSDAY :
178  eDay = THURSDAY;
179  break;
180  case i18n::Weekdays::FRIDAY :
181  eDay = FRIDAY;
182  break;
183  case i18n::Weekdays::SATURDAY :
184  eDay = SATURDAY;
185  break;
186  default:
187  SAL_WARN( "vcl.control", "Calendar::ImplGetWeekStart: broken i18n Gregorian calendar (getFirstDayOfWeek())");
188  eDay = SUNDAY;
189  }
190  return eDay;
191 }
192 
194 {
195  if ( !mbFormat )
196  return;
197 
198  if ( mbCalc )
199  {
200  Size aOutSize = GetOutputSizePixel();
201 
202  if ( (aOutSize.Width() <= 1) || (aOutSize.Height() <= 1) )
203  return;
204 
205  OUString const a99Text("99");
206 
207  long n99TextWidth = GetTextWidth( a99Text );
208  long nTextHeight = GetTextHeight();
209 
210  // calculate width and x-position
211  mnDayWidth = n99TextWidth+DAY_OFFX;
214  mnMonthPerLine = aOutSize.Width() / mnMonthWidth;
215  if ( !mnMonthPerLine )
216  mnMonthPerLine = 1;
217  long nOver = (aOutSize.Width()-(mnMonthPerLine*mnMonthWidth)) / mnMonthPerLine;
218  mnMonthWidth += nOver;
220  mnDaysOffX += nOver/2;
221 
222  // calculate height and y-position
223  mnDayHeight = nTextHeight + DAY_OFFY;
224  mnWeekDayOffY = nTextHeight + TITLE_OFFY + (TITLE_BORDERY*2);
225  mnDaysOffY = mnWeekDayOffY + nTextHeight + WEEKDAY_OFFY;
226  mnMonthHeight = (mnDayHeight*6) + mnDaysOffY;
228  mnLines = aOutSize.Height() / mnMonthHeight;
229  if ( !mnLines )
230  mnLines = 1;
231  mnMonthHeight += (aOutSize.Height()-(mnLines*mnMonthHeight)) / mnLines;
232 
233  // calculate spinfields
234  long nSpinSize = nTextHeight+TITLE_BORDERY-SPIN_OFFY;
236  maPrevRect.SetTop( SPIN_OFFY );
237  maPrevRect.SetRight( maPrevRect.Left()+nSpinSize );
238  maPrevRect.SetBottom( maPrevRect.Top()+nSpinSize );
239  maNextRect.SetLeft( aOutSize.Width()-SPIN_OFFX-nSpinSize-1 );
240  maNextRect.SetTop( SPIN_OFFY );
241  maNextRect.SetRight( maNextRect.Left()+nSpinSize );
242  maNextRect.SetBottom( maNextRect.Top()+nSpinSize );
243 
244  // Calculate DayOfWeekText (gets displayed in a narrow font)
245  maDayOfWeekText.clear();
246  long nStartOffX = 0;
247  sal_Int16 nDay = maCalendarWrapper.getFirstDayOfWeek();
248  for ( sal_Int16 nDayOfWeek = 0; nDayOfWeek < 7; nDayOfWeek++ )
249  {
250  // Use narrow name.
251  OUString aDayOfWeek( maCalendarWrapper.getDisplayName(
252  i18n::CalendarDisplayIndex::DAY, nDay, 2));
253  long nOffX = (mnDayWidth-GetTextWidth( aDayOfWeek ))/2;
254  if ( !nDayOfWeek )
255  nStartOffX = nOffX;
256  else
257  nOffX -= nStartOffX;
258  nOffX += nDayOfWeek * mnDayWidth;
259  mnDayOfWeekAry[nDayOfWeek] = nOffX;
260  maDayOfWeekText += aDayOfWeek;
261  nDay++;
262  nDay %= 7;
263  }
264 
265  mbCalc = false;
266  }
267 
268  // calculate number of days
269 
270  DayOfWeek eStartDay = ImplGetWeekStart();
271 
272  sal_uInt16 nWeekDay;
273  Date aTempDate = GetFirstMonth();
274  maFirstDate = aTempDate;
275  nWeekDay = static_cast<sal_uInt16>(aTempDate.GetDayOfWeek());
276  nWeekDay = (nWeekDay+(7-static_cast<sal_uInt16>(eStartDay))) % 7;
277  maFirstDate.AddDays( -nWeekDay );
278  mnDayCount = nWeekDay;
279  sal_uInt16 nDaysInMonth;
280  sal_uInt16 nMonthCount = static_cast<sal_uInt16>(mnMonthPerLine*mnLines);
281  for ( sal_uInt16 i = 0; i < nMonthCount; i++ )
282  {
283  nDaysInMonth = aTempDate.GetDaysInMonth();
284  mnDayCount += nDaysInMonth;
285  aTempDate.AddDays( nDaysInMonth );
286  }
287  Date aTempDate2 = aTempDate;
288  --aTempDate2;
289  nDaysInMonth = aTempDate2.GetDaysInMonth();
290  aTempDate2.AddDays( -(nDaysInMonth-1) );
291  nWeekDay = static_cast<sal_uInt16>(aTempDate2.GetDayOfWeek());
292  nWeekDay = (nWeekDay+(7-static_cast<sal_uInt16>(eStartDay))) % 7;
293  mnDayCount += 42-nDaysInMonth-nWeekDay;
294 
295  // determine colours
297  if ( maOtherColor.IsRGBEqual( GetBackground().GetColor() ) )
299 
300  Date aLastDate = GetLastDate();
301  if ( (maOldFormatLastDate != aLastDate) ||
303  {
305  maOldFormatLastDate = aLastDate;
306  }
307 
308  // get DateInfo
309  sal_Int16 nNewFirstYear = maFirstDate.GetYear();
310  sal_Int16 nNewLastYear = GetLastDate().GetYear();
311  if ( mnFirstYear )
312  {
313  if ( nNewFirstYear < mnFirstYear )
314  {
315  mnFirstYear = nNewFirstYear;
316  }
317  if ( nNewLastYear > mnLastYear )
318  {
319  mnLastYear = nNewLastYear;
320  }
321  }
322  else
323  {
324  mnFirstYear = nNewFirstYear;
325  mnLastYear = nNewLastYear;
326  }
327 
328  mbFormat = false;
329 }
330 
331 sal_uInt16 Calendar::ImplHitTest( const Point& rPos, Date& rDate ) const
332 {
333  if ( mbFormat )
334  return 0;
335 
336  if ( maPrevRect.IsInside( rPos ) )
337  return CALENDAR_HITTEST_PREV;
338  else if ( maNextRect.IsInside( rPos ) )
339  return CALENDAR_HITTEST_NEXT;
340 
341  long nY;
342  long nOffX;
343  sal_Int32 nDay;
344  DayOfWeek eStartDay = ImplGetWeekStart();
345 
346  rDate = GetFirstMonth();
347  nY = 0;
348  for ( long i = 0; i < mnLines; i++ )
349  {
350  if ( rPos.Y() < nY )
351  return 0;
352 
353  long nX = 0;
354  long nYMonth = nY+mnMonthHeight;
355  for ( long j = 0; j < mnMonthPerLine; j++ )
356  {
357  if ( (rPos.X() < nX) && (rPos.Y() < nYMonth) )
358  return 0;
359 
360  sal_uInt16 nDaysInMonth = rDate.GetDaysInMonth();
361 
362  // matching month was found
363  if ( (rPos.X() > nX) && (rPos.Y() < nYMonth) &&
364  (rPos.X() < nX+mnMonthWidth) )
365  {
366  if ( rPos.Y() < (nY+(TITLE_BORDERY*2)+mnDayHeight))
368  else
369  {
370  long nDayX = nX+mnDaysOffX;
371  long nDayY = nY+mnDaysOffY;
372  if ( rPos.Y() < nDayY )
373  return 0;
374  sal_Int32 nDayIndex = static_cast<sal_Int32>(rDate.GetDayOfWeek());
375  nDayIndex = (nDayIndex+(7-static_cast<sal_Int32>(eStartDay))) % 7;
376  if ( (i == 0) && (j == 0) )
377  {
378  Date aTempDate = rDate;
379  aTempDate.AddDays( -nDayIndex );
380  for ( nDay = 0; nDay < nDayIndex; nDay++ )
381  {
382  nOffX = nDayX + (nDay*mnDayWidth);
383  if ( (rPos.Y() >= nDayY) && (rPos.Y() < nDayY+mnDayHeight) &&
384  (rPos.X() >= nOffX) && (rPos.X() < nOffX+mnDayWidth) )
385  {
386  rDate = aTempDate;
387  rDate.AddDays( nDay );
388  return CALENDAR_HITTEST_DAY;
389  }
390  }
391  }
392  for ( nDay = 1; nDay <= nDaysInMonth; nDay++ )
393  {
394  if ( rPos.Y() < nDayY )
395  {
396  rDate.AddDays( nDayIndex );
397  return 0;
398  }
399  nOffX = nDayX + (nDayIndex*mnDayWidth);
400  if ( (rPos.Y() >= nDayY) && (rPos.Y() < nDayY+mnDayHeight) &&
401  (rPos.X() >= nOffX) && (rPos.X() < nOffX+mnDayWidth) )
402  {
403  rDate.AddDays( nDay-1 );
404  return CALENDAR_HITTEST_DAY;
405  }
406  if ( nDayIndex == 6 )
407  {
408  nDayIndex = 0;
409  nDayY += mnDayHeight;
410  }
411  else
412  nDayIndex++;
413  }
414  if ( (i == mnLines-1) && (j == mnMonthPerLine-1) )
415  {
416  sal_uInt16 nWeekDay = static_cast<sal_uInt16>(rDate.GetDayOfWeek());
417  nWeekDay = (nWeekDay+(7-static_cast<sal_uInt16>(eStartDay))) % 7;
418  sal_Int32 nDayCount = 42-nDaysInMonth-nWeekDay;
419  Date aTempDate = rDate;
420  aTempDate.AddDays( nDaysInMonth );
421  for ( nDay = 1; nDay <= nDayCount; nDay++ )
422  {
423  if ( rPos.Y() < nDayY )
424  {
425  rDate.AddDays( nDayIndex );
426  return 0;
427  }
428  nOffX = nDayX + (nDayIndex*mnDayWidth);
429  if ( (rPos.Y() >= nDayY) && (rPos.Y() < nDayY+mnDayHeight) &&
430  (rPos.X() >= nOffX) && (rPos.X() < nOffX+mnDayWidth) )
431  {
432  rDate = aTempDate;
433  rDate.AddDays( nDay-1 );
434  return CALENDAR_HITTEST_DAY;
435  }
436  if ( nDayIndex == 6 )
437  {
438  nDayIndex = 0;
439  nDayY += mnDayHeight;
440  }
441  else
442  nDayIndex++;
443  }
444  }
445  }
446  }
447 
448  rDate.AddDays( nDaysInMonth );
449  nX += mnMonthWidth;
450  }
451 
452  nY += mnMonthHeight;
453  }
454 
455  return 0;
456 }
457 
458 namespace
459 {
460 
461 void ImplDrawSpinArrow(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, bool bPrev)
462 {
463  long i;
464  long n;
465  long nLines;
466  long nHeight = rRect.GetHeight();
467  long nWidth = rRect.GetWidth();
468  if (nWidth < nHeight)
469  n = nWidth;
470  else
471  n = nHeight;
472  if (!(n & 0x01))
473  n--;
474  nLines = n/2;
475 
476  tools::Rectangle aRect(Point( rRect.Left() + (nWidth / 2) - (nLines / 2),
477  rRect.Top() + (nHeight / 2) ),
478  Size(1, 1));
479  if (!bPrev)
480  {
481  aRect.AdjustLeft(nLines );
482  aRect.AdjustRight(nLines );
483  }
484 
485  rRenderContext.DrawRect(aRect);
486  for (i = 0; i < nLines; i++)
487  {
488  if (bPrev)
489  {
490  aRect.AdjustLeft( 1 );
491  aRect.AdjustRight( 1 );
492  }
493  else
494  {
495  aRect.AdjustLeft( -1 );
496  aRect.AdjustRight( -1 );
497  }
498  aRect.AdjustTop( -1 );
499  aRect.AdjustBottom( 1 );
500  rRenderContext.DrawRect(aRect);
501  }
502 }
503 
504 } //end anonymous namespace
505 
507 {
508  rRenderContext.SetLineColor();
509  rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetButtonTextColor());
510  tools::Rectangle aOutRect = maPrevRect;
511  aOutRect.AdjustLeft(3 );
512  aOutRect.AdjustTop(3 );
513  aOutRect.AdjustRight( -3 );
514  aOutRect.AdjustBottom( -3 );
515  ImplDrawSpinArrow(rRenderContext, aOutRect, true);
516  aOutRect = maNextRect;
517  aOutRect.AdjustLeft(3 );
518  aOutRect.AdjustTop(3 );
519  aOutRect.AdjustRight( -3 );
520  aOutRect.AdjustBottom( -3 );
521  ImplDrawSpinArrow(rRenderContext, aOutRect, false);
522 }
523 
525  long nX, long nY,
526  sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear,
527  bool bOther, sal_Int32 nToday )
528 {
529  Color const * pTextColor = nullptr;
530  const OUString& rDay = maDayTexts[nDay - 1];
531  tools::Rectangle aDateRect(nX, nY, nX + mnDayWidth - 1, nY + mnDayHeight - 1);
532 
533  bool bSel = false;
534  bool bFocus = false;
535  // actual day
536  if ((nDay == maCurDate.GetDay()) &&
537  (nMonth == maCurDate.GetMonth()) &&
538  (nYear == maCurDate.GetYear()))
539  {
540  bFocus = true;
541  }
542  if (mpSelectTable)
543  {
544  if (mpSelectTable->find(Date(nDay, nMonth, nYear).GetDate()) != mpSelectTable->end())
545  bSel = true;
546  }
547 
548  // get textcolour
549  if (bSel)
550  pTextColor = &maSelColor;
551  else if (bOther)
552  pTextColor = &maOtherColor;
553 
554  if (bFocus)
555  HideFocus();
556 
557  // display background
558  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
559  if (bSel)
560  {
561  rRenderContext.SetLineColor();
562  rRenderContext.SetFillColor(rStyleSettings.GetHighlightColor());
563  rRenderContext.DrawRect(aDateRect);
564  }
565 
566  // display text
567  long nTextX = nX + (mnDayWidth - GetTextWidth(rDay)) - (DAY_OFFX / 2);
568  long nTextY = nY + (mnDayHeight - GetTextHeight()) / 2;
569  if (pTextColor)
570  {
571  Color aOldColor = rRenderContext.GetTextColor();
572  rRenderContext.SetTextColor(*pTextColor);
573  rRenderContext.DrawText(Point(nTextX, nTextY), rDay);
574  rRenderContext.SetTextColor(aOldColor);
575  }
576  else
577  rRenderContext.DrawText(Point(nTextX, nTextY), rDay);
578 
579  // today
580  Date aTodayDate(maCurDate);
581  if (nToday)
582  aTodayDate.SetDate(nToday);
583  else
584  aTodayDate = Date(Date::SYSTEM);
585  if ((nDay == aTodayDate.GetDay()) &&
586  (nMonth == aTodayDate.GetMonth()) &&
587  (nYear == aTodayDate.GetYear()))
588  {
589  rRenderContext.SetLineColor(rStyleSettings.GetWindowTextColor());
590  rRenderContext.SetFillColor();
591  rRenderContext.DrawRect(aDateRect);
592  }
593 
594  // if needed do FocusRect
595  if (bFocus && HasFocus())
596  ShowFocus(aDateRect);
597 }
598 
600 {
601  ImplFormat();
602 
603  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
604  Size aOutSize(GetOutputSizePixel());
605  long i;
606  long j;
607  long nY;
608  long nDeltaX;
609  long nDeltaY;
610  long nDayX;
611  long nDayY;
612  sal_Int32 nToday = Date(Date::SYSTEM).GetDate();
613  sal_uInt16 nDay;
614  sal_uInt16 nMonth;
615  sal_Int16 nYear;
616  Date aDate = GetFirstMonth();
617  DayOfWeek eStartDay = ImplGetWeekStart();
618 
619  HideFocus();
620 
621  nY = 0;
622  for (i = 0; i < mnLines; i++)
623  {
624  // display title bar
625  rRenderContext.SetLineColor();
626  rRenderContext.SetFillColor(rStyleSettings.GetFaceColor());
627  tools::Rectangle aTitleRect(0, nY, aOutSize.Width() - 1, nY + mnDayHeight - DAY_OFFY + TITLE_BORDERY * 2);
628  rRenderContext.DrawRect(aTitleRect);
629  Point aTopLeft1(aTitleRect.Left(), aTitleRect.Top());
630  Point aTopLeft2(aTitleRect.Left(), aTitleRect.Top() + 1);
631  Point aBottomRight1(aTitleRect.Right(), aTitleRect.Bottom());
632  Point aBottomRight2(aTitleRect.Right(), aTitleRect.Bottom() - 1);
633  rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
634  rRenderContext.DrawLine(aTopLeft1, Point(aBottomRight1.X(), aTopLeft1.Y()));
635  rRenderContext.SetLineColor(rStyleSettings.GetLightColor() );
636  rRenderContext.DrawLine(aTopLeft2, Point(aBottomRight2.X(), aTopLeft2.Y()));
637  rRenderContext.DrawLine(aTopLeft2, Point(aTopLeft2.X(), aBottomRight2.Y()));
638  rRenderContext.SetLineColor(rStyleSettings.GetShadowColor() );
639  rRenderContext.DrawLine(Point(aTopLeft2.X(), aBottomRight2.Y()), aBottomRight2);
640  rRenderContext.DrawLine(Point(aBottomRight2.X(), aTopLeft2.Y()), aBottomRight2);
641  rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
642  rRenderContext.DrawLine(Point(aTopLeft1.X(), aBottomRight1.Y()), aBottomRight1);
643  Point aSepPos1(0, aTitleRect.Top() + TITLE_BORDERY);
644  Point aSepPos2(0, aTitleRect.Bottom() - TITLE_BORDERY);
645  for (j = 0; j < mnMonthPerLine-1; j++)
646  {
647  aSepPos1.AdjustX(mnMonthWidth-1 );
648  aSepPos2.setX( aSepPos1.X() );
649  rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
650  rRenderContext.DrawLine(aSepPos1, aSepPos2);
651  aSepPos1.AdjustX( 1 );
652  aSepPos2.setX( aSepPos1.X() );
653  rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
654  rRenderContext.DrawLine(aSepPos1, aSepPos2);
655  }
656 
657  long nX = 0;
658  for (j = 0; j < mnMonthPerLine; j++)
659  {
660  nMonth = aDate.GetMonth();
661  nYear = aDate.GetYear();
662 
663  // display month in title bar
664  nDeltaX = nX;
665  nDeltaY = nY + TITLE_BORDERY;
666  OUString aMonthText = maCalendarWrapper.getDisplayName(i18n::CalendarDisplayIndex::MONTH, nMonth - 1, 1)
667  + " "
668  + OUString::number(nYear);
669  long nMonthTextWidth = rRenderContext.GetTextWidth(aMonthText);
670  long nMonthOffX1 = 0;
671  long nMonthOffX2 = 0;
672  if (i == 0)
673  {
674  if (j == 0)
675  nMonthOffX1 = maPrevRect.Right() + 1;
676  if (j == mnMonthPerLine - 1)
677  nMonthOffX2 = aOutSize.Width() - maNextRect.Left() + 1;
678  }
679  long nMaxMonthWidth = mnMonthWidth - nMonthOffX1 - nMonthOffX2 - 4;
680  if (nMonthTextWidth > nMaxMonthWidth)
681  {
682  // Abbreviated month name.
683  aMonthText = maCalendarWrapper.getDisplayName(i18n::CalendarDisplayIndex::MONTH, nMonth - 1, 0)
684  + " "
685  + OUString::number(nYear);
686  nMonthTextWidth = rRenderContext.GetTextWidth(aMonthText);
687  }
688  long nTempOff = (mnMonthWidth - nMonthTextWidth + 1) / 2;
689  if (nTempOff < nMonthOffX1)
690  nDeltaX += nMonthOffX1 + 1;
691  else
692  {
693  if (nTempOff + nMonthTextWidth > mnMonthWidth - nMonthOffX2)
694  nDeltaX += mnMonthWidth - nMonthOffX2 - nMonthTextWidth;
695  else
696  nDeltaX += nTempOff;
697  }
698  rRenderContext.SetTextColor(rStyleSettings.GetButtonTextColor());
699  rRenderContext.DrawText(Point(nDeltaX, nDeltaY), aMonthText);
700  rRenderContext.SetTextColor(rStyleSettings.GetWindowTextColor());
701 
702  // display week bar
703  nDayX = nX + mnDaysOffX;
704  nDayY = nY + mnWeekDayOffY;
705  nDeltaY = nDayY + mnDayHeight;
706  rRenderContext.SetLineColor(rStyleSettings.GetWindowTextColor());
707  Point aStartPos(nDayX, nDeltaY);
708  rRenderContext.DrawLine(aStartPos, Point(nDayX + (7 * mnDayWidth), nDeltaY));
709  rRenderContext.DrawTextArray(Point(nDayX + mnDayOfWeekAry[0], nDayY), maDayOfWeekText, &(mnDayOfWeekAry[1]));
710 
711  // display days
712  sal_uInt16 nDaysInMonth = aDate.GetDaysInMonth();
713  nDayX = nX + mnDaysOffX;
714  nDayY = nY + mnDaysOffY;
715  sal_uInt16 nDayIndex = static_cast<sal_uInt16>(aDate.GetDayOfWeek());
716  nDayIndex = (nDayIndex + (7 - static_cast<sal_uInt16>(eStartDay))) % 7;
717  if (i == 0 && j == 0)
718  {
719  Date aTempDate = aDate;
720  aTempDate.AddDays( -nDayIndex );
721  for (nDay = 0; nDay < nDayIndex; ++nDay)
722  {
723  nDeltaX = nDayX + (nDay * mnDayWidth);
724  ImplDrawDate(rRenderContext, nDeltaX, nDayY, nDay + aTempDate.GetDay(),
725  aTempDate.GetMonth(), aTempDate.GetYear(),
726  true, nToday);
727  }
728  }
729  for (nDay = 1; nDay <= nDaysInMonth; nDay++)
730  {
731  nDeltaX = nDayX + (nDayIndex * mnDayWidth);
732  ImplDrawDate(rRenderContext, nDeltaX, nDayY, nDay, nMonth, nYear,
733  false, nToday);
734  if (nDayIndex == 6)
735  {
736  nDayIndex = 0;
737  nDayY += mnDayHeight;
738  }
739  else
740  nDayIndex++;
741  }
742  if ((i == mnLines - 1) && (j == mnMonthPerLine - 1))
743  {
744  sal_uInt16 nWeekDay = static_cast<sal_uInt16>(aDate.GetDayOfWeek());
745  nWeekDay = (nWeekDay + (7 - static_cast<sal_uInt16>(eStartDay))) % 7;
746  sal_uInt16 nDayCount = 42 - nDaysInMonth - nWeekDay;
747  Date aTempDate = aDate;
748  aTempDate.AddDays( nDaysInMonth );
749  for (nDay = 1; nDay <= nDayCount; ++nDay)
750  {
751  nDeltaX = nDayX + (nDayIndex * mnDayWidth);
752  ImplDrawDate(rRenderContext, nDeltaX, nDayY, nDay,
753  aTempDate.GetMonth(), aTempDate.GetYear(),
754  true, nToday);
755  if (nDayIndex == 6)
756  {
757  nDayIndex = 0;
758  nDayY += mnDayHeight;
759  }
760  else
761  nDayIndex++;
762  }
763  }
764 
765  aDate.AddDays( nDaysInMonth );
766  nX += mnMonthWidth;
767  }
768 
769  nY += mnMonthHeight;
770  }
771 
772  // draw spin buttons
773  ImplDrawSpin(rRenderContext);
774 }
775 
776 void Calendar::ImplUpdateDate( const Date& rDate )
777 {
778  if (IsReallyVisible() && IsUpdateMode())
779  {
780  tools::Rectangle aDateRect(GetDateRect(rDate));
781  if (!aDateRect.IsEmpty())
782  {
783  Invalidate(aDateRect);
784  }
785  }
786 }
787 
789 {
790  IntDateSet* pNew = mpSelectTable.get();
791 
792  for (auto const& nKey : *pOld)
793  {
794  if ( pNew->find(nKey) == pNew->end() )
795  {
796  Date aTempDate(nKey);
797  ImplUpdateDate(aTempDate);
798  }
799  }
800 
801  for (auto const& nKey : *pNew)
802  {
803  if ( pOld->find(nKey) == pOld->end() )
804  {
805  Date aTempDate(nKey);
806  ImplUpdateDate(aTempDate);
807  }
808  }
809 }
810 
811 void Calendar::ImplMouseSelect( const Date& rDate, sal_uInt16 nHitTest )
812 {
813  std::unique_ptr<IntDateSet> pOldSel(new IntDateSet( *mpSelectTable ));
814  Date aOldDate = maCurDate;
815  Date aTempDate = rDate;
816 
817  if ( !(nHitTest & CALENDAR_HITTEST_DAY) )
818  --aTempDate;
819 
820  if ( !(nHitTest & CALENDAR_HITTEST_DAY) )
821  aTempDate = maOldCurDate;
822  if ( aTempDate != maCurDate )
823  {
824  maCurDate = aTempDate;
825  ImplCalendarSelectDate( mpSelectTable.get(), aOldDate, false );
827  }
828 
829  bool bNewSel = *pOldSel != *mpSelectTable;
830  if ( (maCurDate != aOldDate) || bNewSel )
831  {
832  HideFocus();
833  if ( bNewSel )
834  ImplUpdateSelection( pOldSel.get() );
835  if ( !bNewSel || pOldSel->find( aOldDate.GetDate() ) == pOldSel->end() )
836  ImplUpdateDate( aOldDate );
837  // assure focus rectangle is displayed again
838  if ( HasFocus() || !bNewSel
839  || mpSelectTable->find( maCurDate.GetDate() ) == mpSelectTable->end() )
841  }
842 }
843 
844 void Calendar::ImplUpdate( bool bCalcNew )
845 {
846  if (IsReallyVisible() && IsUpdateMode())
847  {
848  if (bCalcNew && !mbCalc)
849  {
850  Invalidate();
851  }
852  else if (!mbFormat && !mbCalc)
853  {
854  Invalidate();
855  }
856  }
857 
858  if (bCalcNew)
859  mbCalc = true;
860  mbFormat = true;
861 }
862 
863 void Calendar::ImplScroll( bool bPrev )
864 {
865  Date aNewFirstMonth = GetFirstMonth();
866  if ( bPrev )
867  {
868  --aNewFirstMonth;
869  aNewFirstMonth.AddDays( -(aNewFirstMonth.GetDaysInMonth()-1));
870  }
871  else
872  aNewFirstMonth.AddDays( aNewFirstMonth.GetDaysInMonth());
873  SetFirstDate( aNewFirstMonth );
874 }
875 
876 void Calendar::ImplShowMenu( const Point& rPos, const Date& rDate )
877 {
878  EndSelection();
879 
880  Date aOldFirstDate = GetFirstMonth();
882  sal_uInt16 nMonthOff;
883  sal_uInt16 nCurItemId;
884  sal_uInt16 nYear = rDate.GetYear()-1;
885  sal_uInt16 i;
886  sal_uInt16 j;
887  sal_uInt16 nYearIdCount = 1000;
888 
889  nMonthOff = (rDate.GetYear()-aOldFirstDate.GetYear())*12;
890  if ( aOldFirstDate.GetMonth() < rDate.GetMonth() )
891  nMonthOff += rDate.GetMonth()-aOldFirstDate.GetMonth();
892  else
893  nMonthOff -= aOldFirstDate.GetMonth()-rDate.GetMonth();
894 
895  // construct menu (include years with different months)
896  for ( i = 0; i < MENU_YEAR_COUNT; i++ )
897  {
898  VclPtrInstance<PopupMenu> pYearPopupMenu;
899  for ( j = 1; j <= 12; j++ )
900  pYearPopupMenu->InsertItem( nYearIdCount+j,
902  i18n::CalendarDisplayIndex::MONTH, j-1, 1));
903  aPopupMenu->InsertItem( 10+i, OUString::number( nYear+i ) );
904  aPopupMenu->SetPopupMenu( 10+i, pYearPopupMenu );
905  nYearIdCount += 1000;
906  }
907 
908  mbMenuDown = true;
909  nCurItemId = aPopupMenu->Execute( this, rPos );
910  mbMenuDown = false;
911 
912  if ( !nCurItemId )
913  return;
914 
915  sal_uInt16 nTempMonthOff = nMonthOff % 12;
916  sal_uInt16 nTempYearOff = nMonthOff / 12;
917  sal_uInt16 nNewMonth = nCurItemId % 1000;
918  sal_uInt16 nNewYear = nYear+((nCurItemId-1000)/1000);
919  if ( nTempMonthOff < nNewMonth )
920  nNewMonth = nNewMonth - nTempMonthOff;
921  else
922  {
923  nNewYear--;
924  nNewMonth = 12-(nTempMonthOff-nNewMonth);
925  }
926  nNewYear = nNewYear - nTempYearOff;
927  SetFirstDate( Date( 1, nNewMonth, nNewYear ) );
928 }
929 
930 void Calendar::ImplTracking( const Point& rPos, bool bRepeat )
931 {
932  Date aTempDate = maCurDate;
933  sal_uInt16 nHitTest = ImplHitTest( rPos, aTempDate );
934 
935  if ( mbSpinDown )
936  {
937  mbPrevIn = (nHitTest & CALENDAR_HITTEST_PREV) != 0;
938  mbNextIn = (nHitTest & CALENDAR_HITTEST_NEXT) != 0;
939 
940  if ( bRepeat && (mbPrevIn || mbNextIn) )
941  {
942  ImplScroll( mbPrevIn );
943  }
944  }
945  else
946  ImplMouseSelect( aTempDate, nHitTest );
947 }
948 
949 void Calendar::ImplEndTracking( bool bCancel )
950 {
951  bool bSelection = mbSelection;
952  bool bSpinDown = mbSpinDown;
953 
954  mbDrag = false;
955  mbSelection = false;
956  mbSpinDown = false;
957  mbPrevIn = false;
958  mbNextIn = false;
959 
960  if ( bCancel )
961  {
962  if ( maOldFirstDate != maFirstDate )
964 
965  if ( !bSpinDown )
966  {
967  std::unique_ptr<IntDateSet> pOldSel(new IntDateSet( *mpSelectTable ));
968  Date aOldDate = maCurDate;
971  HideFocus();
972  ImplUpdateSelection( pOldSel.get() );
973  if ( pOldSel->find( aOldDate.GetDate() ) == pOldSel->end() )
974  ImplUpdateDate( aOldDate );
975  // assure focus rectangle is displayed again
976  if ( HasFocus() || mpSelectTable->find( maCurDate.GetDate() ) == mpSelectTable->end() )
978  }
979  }
980 
981  if ( bSpinDown )
982  return;
983 
984  if ( !bCancel )
985  {
986  // determine if we should scroll the visible area
987  if ( !mpSelectTable->empty() )
988  {
989  Date aFirstSelDate( *mpSelectTable->begin() );
990  Date aLastSelDate( *mpSelectTable->rbegin() );
991  if ( aLastSelDate < GetFirstMonth() )
992  ImplScroll( true );
993  else if ( GetLastMonth() < aFirstSelDate )
994  ImplScroll( false );
995  }
996  }
997 
998  if ( mbAllSel ||
999  (!bCancel && ((maCurDate != maOldCurDate) || (*mpOldSelectTable != *mpSelectTable))) )
1000  Select();
1001 
1002  if ( !bSelection && (mnWinStyle & WB_TABSTOP) && !bCancel )
1003  GrabFocus();
1004 
1005  mpOldSelectTable.reset();
1006 }
1007 
1009 {
1010  if ( rMEvt.IsLeft() && !mbMenuDown )
1011  {
1012  Date aTempDate = maCurDate;
1013  sal_uInt16 nHitTest = ImplHitTest( rMEvt.GetPosPixel(), aTempDate );
1014  if ( nHitTest )
1015  {
1016  if ( nHitTest & CALENDAR_HITTEST_MONTHTITLE )
1017  ImplShowMenu( rMEvt.GetPosPixel(), aTempDate );
1018  else
1019  {
1021 
1022  mbPrevIn = (nHitTest & CALENDAR_HITTEST_PREV) != 0;
1023  mbNextIn = (nHitTest & CALENDAR_HITTEST_NEXT) != 0;
1024  if ( mbPrevIn || mbNextIn )
1025  {
1026  mbSpinDown = true;
1027  ImplScroll( mbPrevIn );
1028  // it should really read BUTTONREPEAT, therefore do not
1029  // change it to SCROLLREPEAT, check with TH,
1030  // why it could be different (71775)
1032  }
1033  else
1034  {
1035  if ( (rMEvt.GetClicks() != 2) || !(nHitTest & CALENDAR_HITTEST_DAY) )
1036  {
1038  mpOldSelectTable.reset(new IntDateSet( *mpSelectTable ));
1039 
1040  if ( !mbSelection )
1041  {
1042  mbDrag = true;
1043  StartTracking();
1044  }
1045 
1046  ImplMouseSelect( aTempDate, nHitTest );
1047  }
1048  if (rMEvt.GetClicks() == 2)
1049  maActivateHdl.Call(this);
1050  }
1051  }
1052  }
1053 
1054  return;
1055  }
1056 
1057  Control::MouseButtonDown( rMEvt );
1058 }
1059 
1061 {
1062  if ( rMEvt.IsLeft() && mbSelection )
1063  ImplEndTracking( false );
1064  else
1065  Control::MouseButtonUp( rMEvt );
1066 }
1067 
1068 void Calendar::MouseMove( const MouseEvent& rMEvt )
1069 {
1070  if ( mbSelection && rMEvt.GetButtons() )
1071  ImplTracking( rMEvt.GetPosPixel(), false );
1072  else
1073  Control::MouseMove( rMEvt );
1074 }
1075 
1076 void Calendar::Tracking( const TrackingEvent& rTEvt )
1077 {
1078  Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
1079 
1080  if ( rTEvt.IsTrackingEnded() )
1082  else
1083  ImplTracking( aMousePos, rTEvt.IsTrackingRepeat() );
1084 }
1085 
1086 void Calendar::KeyInput( const KeyEvent& rKEvt )
1087 {
1088  Date aNewDate = maCurDate;
1089 
1090  switch ( rKEvt.GetKeyCode().GetCode() )
1091  {
1092  case KEY_HOME:
1093  aNewDate.SetDay( 1 );
1094  break;
1095 
1096  case KEY_END:
1097  aNewDate.SetDay( aNewDate.GetDaysInMonth() );
1098  break;
1099 
1100  case KEY_LEFT:
1101  --aNewDate;
1102  break;
1103 
1104  case KEY_RIGHT:
1105  ++aNewDate;
1106  break;
1107 
1108  case KEY_UP:
1109  aNewDate.AddDays( -7 );
1110  break;
1111 
1112  case KEY_DOWN:
1113  aNewDate.AddDays( 7 );
1114  break;
1115 
1116  case KEY_PAGEUP:
1117  {
1118  Date aTempDate = aNewDate;
1119  aTempDate.AddDays( -(aNewDate.GetDay()+1) );
1120  aNewDate.AddDays( -aTempDate.GetDaysInMonth() );
1121  }
1122  break;
1123 
1124  case KEY_PAGEDOWN:
1125  aNewDate.AddDays( aNewDate.GetDaysInMonth() );
1126  break;
1127 
1128  case KEY_RETURN:
1129  break;
1130 
1131  default:
1132  Control::KeyInput( rKEvt );
1133  break;
1134  }
1135 
1136  if ( aNewDate != maCurDate )
1137  {
1138  SetCurDate( aNewDate );
1139  mbTravelSelect = true;
1140  Select();
1141  mbTravelSelect = false;
1142  }
1143 
1144  if (rKEvt.GetKeyCode().GetCode() == KEY_RETURN)
1145  {
1146  if (maActivateHdl.IsSet())
1147  maActivateHdl.Call(this);
1148  else
1149  Control::KeyInput(rKEvt);
1150  }
1151 }
1152 
1153 void Calendar::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& )
1154 {
1155  ImplDraw(rRenderContext);
1156 }
1157 
1159 {
1162 }
1163 
1165 {
1166  HideFocus();
1168 }
1169 
1171 {
1172  ImplUpdate( true );
1173  Control::Resize();
1174 }
1175 
1176 void Calendar::RequestHelp( const HelpEvent& rHEvt )
1177 {
1179  {
1180  Date aDate = maCurDate;
1181  if ( GetDate( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ), aDate ) )
1182  {
1183  tools::Rectangle aDateRect = GetDateRect( aDate );
1184  Point aPt = OutputToScreenPixel( aDateRect.TopLeft() );
1185  aDateRect.SetLeft( aPt.X() );
1186  aDateRect.SetTop( aPt.Y() );
1187  aPt = OutputToScreenPixel( aDateRect.BottomRight() );
1188  aDateRect.SetRight( aPt.X() );
1189  aDateRect.SetBottom( aPt.Y() );
1190 
1191  if ( rHEvt.GetMode() & HelpEventMode::QUICK )
1192  {
1194  sal_uInt16 nWeek = static_cast<sal_uInt16>(maCalendarWrapper.getValue( i18n::CalendarFieldIndex::WEEK_OF_YEAR));
1195  sal_uInt16 nMonth = aDate.GetMonth();
1196  OUString aStr = maDayText
1197  + ": "
1198  + OUString::number(aDate.GetDayOfYear())
1199  + " / "
1200  + maWeekText
1201  + ": "
1202  + OUString::number(nWeek);
1203  // if year is not the same, add it
1204  if ( (nMonth == 12) && (nWeek == 1) )
1205  {
1206  aStr += ", " + OUString::number(aDate.GetNextYear());
1207  }
1208  else if ( (nMonth == 1) && (nWeek > 50) )
1209  {
1210  aStr += ", " + OUString::number(aDate.GetYear()-1);
1211  }
1212  Help::ShowQuickHelp( this, aDateRect, aStr );
1213  return;
1214  }
1215  }
1216  }
1217 
1218  Control::RequestHelp( rHEvt );
1219 }
1220 
1221 void Calendar::Command( const CommandEvent& rCEvt )
1222 {
1223  if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
1224  {
1225  if ( !mbSelection && rCEvt.IsMouseEvent() )
1226  {
1227  Date aTempDate = maCurDate;
1228  sal_uInt16 nHitTest = ImplHitTest( rCEvt.GetMousePosPixel(), aTempDate );
1229  if ( nHitTest & CALENDAR_HITTEST_MONTHTITLE )
1230  {
1231  ImplShowMenu( rCEvt.GetMousePosPixel(), aTempDate );
1232  return;
1233  }
1234  }
1235  }
1236  else if ( rCEvt.GetCommand() == CommandEventId::Wheel )
1237  {
1238  const CommandWheelData* pData = rCEvt.GetWheelData();
1239  if ( pData->GetMode() == CommandWheelMode::SCROLL )
1240  {
1241  long nNotchDelta = pData->GetNotchDelta();
1242  if ( nNotchDelta < 0 )
1243  {
1244  while ( nNotchDelta < 0 )
1245  {
1246  ImplScroll( true );
1247  nNotchDelta++;
1248  }
1249  }
1250  else
1251  {
1252  while ( nNotchDelta > 0 )
1253  {
1254  ImplScroll( false );
1255  nNotchDelta--;
1256  }
1257  }
1258 
1259  return;
1260  }
1261  }
1262 
1263  Control::Command( rCEvt );
1264 }
1265 
1267 {
1268  Control::StateChanged( nType );
1269 
1270  if ( nType == StateChangedType::InitShow )
1271  ImplFormat();
1272 }
1273 
1275 {
1276  Control::DataChanged( rDCEvt );
1277 
1278  if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
1280  ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1281  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
1282  {
1283  ImplInitSettings();
1284  Invalidate();
1285  }
1286 }
1287 
1289 {
1290  maSelectHdl.Call( this );
1291 }
1292 
1294 {
1295  if ( !mpSelectTable->empty() )
1296  return Date( *mpSelectTable->begin() );
1297  else
1298  {
1299  Date aDate( 0, 0, 0 );
1300  return aDate;
1301  }
1302 }
1303 
1304 void Calendar::SetCurDate( const Date& rNewDate )
1305 {
1306  if ( !rNewDate.IsValidAndGregorian() )
1307  return;
1308 
1309  if ( maCurDate == rNewDate )
1310  return;
1311 
1312  bool bUpdate = IsVisible() && IsUpdateMode();
1313  Date aOldDate = maCurDate;
1314  maCurDate = rNewDate;
1315 
1316  ImplCalendarSelectDate( mpSelectTable.get(), aOldDate, false );
1318 
1319  // shift actual date in the visible area
1320  if ( mbFormat || (maCurDate < GetFirstMonth()) )
1322  else if ( maCurDate > GetLastMonth() )
1323  {
1324  Date aTempDate = GetLastMonth();
1325  long nDateOff = maCurDate-aTempDate;
1326  if ( nDateOff < 365 )
1327  {
1328  Date aFirstDate = GetFirstMonth();
1329  aFirstDate.AddDays( aFirstDate.GetDaysInMonth() );
1330  ++aTempDate;
1331  while ( nDateOff > aTempDate.GetDaysInMonth() )
1332  {
1333  aFirstDate.AddDays( aFirstDate.GetDaysInMonth() );
1334  sal_Int32 nDaysInMonth = aTempDate.GetDaysInMonth();
1335  aTempDate.AddDays( nDaysInMonth );
1336  nDateOff -= nDaysInMonth;
1337  }
1338  SetFirstDate( aFirstDate );
1339  }
1340  else
1342  }
1343  else
1344  {
1345  if ( bUpdate )
1346  {
1347  HideFocus();
1348  ImplUpdateDate( aOldDate );
1350  }
1351  }
1352 }
1353 
1354 void Calendar::SetFirstDate( const Date& rNewFirstDate )
1355 {
1356  if ( maFirstDate != rNewFirstDate )
1357  {
1358  maFirstDate = Date( 1, rNewFirstDate.GetMonth(), rNewFirstDate.GetYear() );
1359  ImplUpdate();
1360  }
1361 }
1362 
1364 {
1365  if ( maFirstDate.GetDay() > 1 )
1366  {
1367  if ( maFirstDate.GetMonth() == 12 )
1368  return Date( 1, 1, maFirstDate.GetNextYear() );
1369  else
1370  return Date( 1, maFirstDate.GetMonth()+1, maFirstDate.GetYear() );
1371  }
1372  else
1373  return maFirstDate;
1374 }
1375 
1377 {
1378  Date aDate = GetFirstMonth();
1379  sal_uInt16 nMonthCount = GetMonthCount();
1380  for ( sal_uInt16 i = 0; i < nMonthCount; i++ )
1381  aDate.AddDays( aDate.GetDaysInMonth() );
1382  --aDate;
1383  return aDate;
1384 }
1385 
1386 sal_uInt16 Calendar::GetMonthCount() const
1387 {
1388  if ( mbFormat )
1389  return 1;
1390  else
1391  return static_cast<sal_uInt16>(mnMonthPerLine*mnLines);
1392 }
1393 
1394 bool Calendar::GetDate( const Point& rPos, Date& rDate ) const
1395 {
1396  Date aDate = maCurDate;
1397  sal_uInt16 nHitTest = ImplHitTest( rPos, aDate );
1398  if ( nHitTest & CALENDAR_HITTEST_DAY )
1399  {
1400  rDate = aDate;
1401  return true;
1402  }
1403  else
1404  return false;
1405 }
1406 
1408 {
1409  tools::Rectangle aRect;
1410 
1411  if ( mbFormat || (rDate < maFirstDate) || (rDate > (maFirstDate+mnDayCount)) )
1412  return aRect;
1413 
1414  long nX;
1415  long nY;
1416  sal_Int32 nDaysOff;
1417  sal_uInt16 nDayIndex;
1418  Date aDate = GetFirstMonth();
1419 
1420  if ( rDate < aDate )
1421  {
1422  aRect = GetDateRect( aDate );
1423  nDaysOff = aDate-rDate;
1424  nX = nDaysOff*mnDayWidth;
1425  aRect.AdjustLeft( -nX );
1426  aRect.AdjustRight( -nX );
1427  return aRect;
1428  }
1429  else
1430  {
1431  Date aLastDate = GetLastMonth();
1432  if ( rDate > aLastDate )
1433  {
1434  sal_Int32 nWeekDay = static_cast<sal_Int32>(aLastDate.GetDayOfWeek());
1435  nWeekDay = (nWeekDay+(7-ImplGetWeekStart())) % 7;
1436  aLastDate.AddDays( -nWeekDay );
1437  aRect = GetDateRect( aLastDate );
1438  nDaysOff = rDate-aLastDate;
1439  nDayIndex = 0;
1440  for ( sal_Int32 i = 0; i <= nDaysOff; i++ )
1441  {
1442  if ( aLastDate == rDate )
1443  {
1444  aRect.AdjustLeft(nDayIndex*mnDayWidth );
1445  aRect.SetRight( aRect.Left()+mnDayWidth );
1446  return aRect;
1447  }
1448  if ( nDayIndex == 6 )
1449  {
1450  nDayIndex = 0;
1451  aRect.AdjustTop(mnDayHeight );
1452  aRect.AdjustBottom(mnDayHeight );
1453  }
1454  else
1455  nDayIndex++;
1456  ++aLastDate;
1457  }
1458  }
1459  }
1460 
1461  nY = 0;
1462  for ( long i = 0; i < mnLines; i++ )
1463  {
1464  nX = 0;
1465  for ( long j = 0; j < mnMonthPerLine; j++ )
1466  {
1467  sal_uInt16 nDaysInMonth = aDate.GetDaysInMonth();
1468 
1469  // month is called
1470  if ( (aDate.GetMonth() == rDate.GetMonth()) &&
1471  (aDate.GetYear() == rDate.GetYear()) )
1472  {
1473  long nDayX = nX+mnDaysOffX;
1474  long nDayY = nY+mnDaysOffY;
1475  nDayIndex = static_cast<sal_uInt16>(aDate.GetDayOfWeek());
1476  nDayIndex = (nDayIndex+(7-static_cast<sal_uInt16>(ImplGetWeekStart()))) % 7;
1477  for ( sal_uInt16 nDay = 1; nDay <= nDaysInMonth; nDay++ )
1478  {
1479  if ( nDay == rDate.GetDay() )
1480  {
1481  aRect.SetLeft( nDayX + (nDayIndex*mnDayWidth) );
1482  aRect.SetTop( nDayY );
1483  aRect.SetRight( aRect.Left()+mnDayWidth );
1484  aRect.SetBottom( aRect.Top()+mnDayHeight );
1485  break;
1486  }
1487  if ( nDayIndex == 6 )
1488  {
1489  nDayIndex = 0;
1490  nDayY += mnDayHeight;
1491  }
1492  else
1493  nDayIndex++;
1494  }
1495  }
1496 
1497  aDate.AddDays( nDaysInMonth );
1498  nX += mnMonthWidth;
1499  }
1500 
1501  nY += mnMonthHeight;
1502  }
1503 
1504  return aRect;
1505 }
1506 
1508 {
1510  mpOldSelectTable.reset(new IntDateSet( *mpSelectTable ));
1511 
1512  mbSelection = true;
1513 }
1514 
1516 {
1517  if ( mbDrag || mbSpinDown || mbSelection )
1518  {
1519  if ( !mbSelection )
1520  ReleaseMouse();
1521 
1522  mbDrag = false;
1523  mbSelection = false;
1524  mbSpinDown = false;
1525  mbPrevIn = false;
1526  mbNextIn = false;
1527  }
1528 }
1529 
1531 {
1532  OUString const a99Text("99");
1533 
1534  Size aSize;
1535  long n99TextWidth = GetTextWidth( a99Text );
1536  long nTextHeight = GetTextHeight();
1537 
1538  aSize.AdjustWidth((n99TextWidth+DAY_OFFX)*7);
1539  aSize.AdjustWidth(MONTH_BORDERX*2 );
1540 
1541  aSize.setHeight( nTextHeight + TITLE_OFFY + (TITLE_BORDERY*2) );
1542  aSize.AdjustHeight(nTextHeight + WEEKDAY_OFFY );
1543  aSize.AdjustHeight((nTextHeight+DAY_OFFY)*6);
1544  aSize.AdjustHeight(MONTH_OFFY );
1545 
1546  return aSize;
1547 }
1548 
1550 {
1551  return CalcWindowSizePixel();
1552 }
1553 
1554 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
VCL_DLLPRIVATE void ImplDrawDate(vcl::RenderContext &rRenderContext, long nX, long nY, sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear, bool bOther, sal_Int32 nToday)
Definition: calendar.cxx:524
long Width() const
const Color & GetTextColor() const
Definition: outdev.hxx:1110
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
Definition: text.cxx:781
const Color & GetShadowColor() const
sal_Int16 GetNextYear() const
long GetWidth() const
const Wallpaper & GetBackground() const
Definition: outdev.hxx:631
virtual void LoseFocus() override
Definition: calendar.cxx:1164
bool mbMenuDown
Definition: calendar.hxx:151
void HideFocus()
Definition: window2.cxx:91
bool mbFormat
Definition: calendar.hxx:151
tools::Rectangle maNextRect
Definition: calendar.hxx:127
long GetHeight() const
DayOfWeek GetDayOfWeek() const
VCL_DLLPRIVATE void ImplDraw(vcl::RenderContext &rRenderContext)
Definition: calendar.cxx:599
bool mbDrag
Definition: calendar.hxx:151
long AdjustWidth(long n)
Date maOldCurDate
Definition: calendar.hxx:135
long AdjustX(long nHorzMove)
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:413
#define KEY_PAGEDOWN
Definition: keycodes.hxx:117
const Color & GetHighlightTextColor() const
std::unique_ptr< ContentProperties > pData
sal_Int16 getValue(sal_Int16 nFieldIndex) const
Link< Calendar *, void > maActivateHdl
Definition: calendar.hxx:162
long Height() const
#define KEY_PAGEUP
Definition: keycodes.hxx:116
long mnWeekDayOffY
Definition: calendar.hxx:140
sal_Int16 getFirstDayOfWeek() const
sal_Int16 mnFirstYear
Definition: calendar.hxx:149
long AdjustLeft(long nHorzMoveDelta)
SATURDAY
const StyleSettings & GetStyleSettings() const
const Color & GetFaceColor() const
virtual ~Calendar() override
Definition: calendar.cxx:146
#define CALENDAR_HITTEST_PREV
Definition: calendar.cxx:50
VCL_DLLPRIVATE void ImplUpdate(bool bCalcNew=false)
Definition: calendar.cxx:844
std::unique_ptr< IntDateSet > mpOldSelectTable
Definition: calendar.hxx:121
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:260
sal_Int64 n
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: calendar.cxx:115
VCL_DLLPRIVATE void ImplUpdateDate(const Date &rDate)
Definition: calendar.cxx:776
#define SPIN_OFFY
Definition: calendar.cxx:46
constexpr::Color COL_GRAY(0x80, 0x80, 0x80)
#define CALENDAR_HITTEST_NEXT
Definition: calendar.cxx:51
sal_uInt16 GetCode() const
Definition: keycod.hxx:53
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: calendar.cxx:1274
long GetNotchDelta() const
DataChangedEventType GetType() const
Definition: event.hxx:348
sal_uInt16 Execute(vcl::Window *pWindow, const Point &rPopupPos)
Definition: menu.cxx:2763
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
Size CalcWindowSizePixel() const
Definition: calendar.cxx:1530
const CommandWheelData * GetWheelData() const
FRIDAY
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:420
VCL_DLLPRIVATE void ImplUpdateSelection(IntDateSet *pOld)
Definition: calendar.cxx:788
#define KEY_LEFT
Definition: keycodes.hxx:112
long AdjustHeight(long n)
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
Definition: window2.cxx:244
CalendarWrapper maCalendarWrapper
Definition: calendar.hxx:125
HelpEventMode GetMode() const
Definition: event.hxx:192
#define DAY_OFFX
Definition: calendar.cxx:38
const Color & GetFieldTextColor() const
const Color & GetHighlightColor() const
VCL_DLLPRIVATE void ImplInitSettings()
Definition: calendar.cxx:124
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: calendar.cxx:1153
long AdjustBottom(long nVertMoveDelta)
bool IsTrackingRepeat() const
Definition: event.hxx:252
bool IsEmpty() const
StateChangedType
Definition: window.hxx:311
bool IsValidAndGregorian() const
WEDNESDAY
OUString maWeekText
Definition: calendar.hxx:124
A construction helper for ScopedVclPtr.
Definition: vclptr.hxx:407
sal_uInt16 GetClicks() const
Definition: event.hxx:120
sal_Int64 WinBits
void SetBackground()
bool GetDate(const Point &rPos, Date &rDate) const
Definition: calendar.cxx:1394
void StartSelection()
Definition: calendar.cxx:1507
long Right() const
VCL_DLLPRIVATE void ImplShowMenu(const Point &rPos, const Date &rDate)
Definition: calendar.cxx:876
Color maSelColor
Definition: calendar.hxx:136
sal_uInt16 GetButtons() const
Definition: event.hxx:131
tools::Rectangle GetDateRect(const Date &rDate) const
Definition: calendar.cxx:1407
sal_uInt16 GetMonth() const
virtual void GetFocus() override
Definition: calendar.cxx:1158
#define TITLE_BORDERY
Definition: calendar.cxx:44
bool IsMouseEvent() const
long mnLines
Definition: calendar.hxx:145
AllSettingsFlags GetFlags() const
Definition: event.hxx:349
VCL_DLLPRIVATE sal_uInt16 ImplHitTest(const Point &rPos, Date &rDate) const
Definition: calendar.cxx:331
const Color & GetLightColor() const
THURSDAY
sal_Int32 mnDayCount
Definition: calendar.hxx:138
bool mbPrevIn
Definition: calendar.hxx:151
void setGregorianDateTime(const DateTime &rDateTime)
sal_Int32 GetDate() const
long Top() const
virtual Size GetOptimalSize() const override
Definition: calendar.cxx:1549
bool mbTravelSelect
Definition: calendar.hxx:151
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: calendar.cxx:1008
void DrawLine(const Point &rStartPt, const Point &rEndPt)
Definition: line.cxx:88
void SetDate(sal_Int32 nNewDate)
OUString maDayTexts[31]
Definition: calendar.hxx:122
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:32
static void ImplCalendarSelectDate(IntDateSet *pTable, const Date &rDate, bool bSelect)
Definition: calendar.cxx:57
Date GetFirstMonth() const
Definition: calendar.cxx:1363
void SetPopupMenu(sal_uInt16 nItemId, PopupMenu *pMenu)
Definition: menu.cxx:723
const Point & GetMousePosPixel() const
Definition: event.hxx:191
#define MENU_YEAR_COUNT
Definition: calendar.cxx:53
sal_Int16 GetYear() const
Point BottomRight() const
const Color & GetDarkShadowColor() const
long mnMonthPerLine
Definition: calendar.hxx:144
void DrawTextArray(const Point &rStartPt, const OUString &rStr, const long *pDXAry, sal_Int32 nIndex=0, sal_Int32 nLen=-1, SalLayoutFlags flags=SalLayoutFlags::NONE, const SalLayoutGlyphs *pLayoutCache=nullptr)
Definition: text.cxx:916
void SetLineColor()
OUString getUniqueID() const
sal_uInt16 GetDaysInMonth() const
virtual void Tracking(const TrackingEvent &rMEvt) override
Definition: calendar.cxx:1076
void SetTop(long v)
long mnDayHeight
Definition: calendar.hxx:147
bool mbSpinDown
Definition: calendar.hxx:151
Date maOldFirstDate
Definition: calendar.hxx:133
VCL_DLLPRIVATE void ImplMouseSelect(const Date &rDate, sal_uInt16 nHitTest)
Definition: calendar.cxx:811
void SetDay(sal_uInt16 nNewDay)
VCL_DLLPRIVATE void ImplScroll(bool bPrev)
Definition: calendar.cxx:863
const vcl::Font & GetToolFont() const
std::unique_ptr< IntDateSet > mpSelectTable
Definition: calendar.hxx:120
static const LocaleDataWrapper & GetAppLocaleDataWrapper()
Get the application's locale data wrapper.
Definition: svapp.cxx:1495
tools::Rectangle maPrevRect
Definition: calendar.hxx:126
#define WEEKDAY_OFFY
Definition: calendar.cxx:42
#define MONTH_OFFY
Definition: calendar.cxx:41
Calendar(vcl::Window *pParent, WinBits nWinStyle)
Definition: calendar.cxx:133
int i
CommandWheelMode GetMode() const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1160
sal_uInt16 GetMonthCount() const
Definition: calendar.cxx:1386
TUESDAY
OUString maDayText
Definition: calendar.hxx:123
VCL_DLLPRIVATE void ImplFormat()
Definition: calendar.cxx:193
void SetRight(long v)
bool IsUpdateMode() const
Definition: window2.cxx:1168
void SetFillColor()
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
const Color & GetFieldColor() const
CommandEventId GetCommand() const
void SetTextColor(const Color &rColor)
Definition: text.cxx:664
bool mbNextIn
Definition: calendar.hxx:151
virtual void Resize() override
Definition: calendar.cxx:1170
sal_uInt16 GetDay() const
SUNDAY
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: calendar.cxx:1068
bool IsInside(const Point &rPOINT) const
void AddDays(sal_Int32 nAddDays)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: ctrl.cxx:59
long mnDaysOffY
Definition: calendar.hxx:141
MONDAY
const AllSettings & GetSettings() const
Definition: outdev.hxx:420
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
VCL_DLLPRIVATE void ImplDrawSpin(vcl::RenderContext &rRenderContext)
Definition: calendar.cxx:506
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:237
const LanguageTag & getLanguageTag()
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
virtual void LoseFocus()
Definition: window.cxx:1819
bool IsRGBEqual(const Color &rColor) const
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2821
Date maFirstDate
Definition: calendar.hxx:132
void GrabFocus()
Definition: window.cxx:2977
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: calendar.cxx:1086
VCL_DLLPRIVATE DayOfWeek ImplGetWeekStart() const
Definition: calendar.cxx:158
long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:890
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
Definition: help.cxx:180
virtual void ShowFocus(const tools::Rectangle &rRect)
Definition: window2.cxx:49
long mnDayOfWeekAry[7]
Definition: calendar.hxx:129
long X() const
Date maOldFormatLastDate
Definition: calendar.hxx:131
void SetCurDate(const Date &rNewDate)
Definition: calendar.cxx:1304
bool IsTrackingEnded() const
Definition: event.hxx:254
#define KEY_END
Definition: keycodes.hxx:115
OUString getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) const
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2137
#define DAY_OFFY
Definition: calendar.cxx:39
const Point & GetMousePosPixel() const
void ReleaseMouse()
Definition: mouse.cxx:458
#define MONTH_BORDERX
Definition: calendar.cxx:40
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1769
#define KEY_RETURN
Definition: keycodes.hxx:119
WinBits const WB_3DLOOK
VCL_DLLPRIVATE void ImplInit(WinBits nWinStyle)
Definition: calendar.cxx:67
WinBits mnWinStyle
Definition: calendar.hxx:148
A construction helper for a temporary VclPtr.
Definition: vclptr.hxx:275
#define TITLE_OFFY
Definition: calendar.cxx:43
long mnDaysOffX
Definition: calendar.hxx:139
bool mbSelection
Definition: calendar.hxx:151
void InsertItem(sal_uInt16 nItemId, const OUString &rStr, MenuItemBits nItemBits=MenuItemBits::NONE, const OString &rIdent=OString(), sal_uInt16 nPos=MENU_APPEND)
Definition: menu.cxx:420
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:53
long mnMonthWidth
Definition: calendar.hxx:143
long mnMonthHeight
Definition: calendar.hxx:142
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: calendar.cxx:151
virtual void Resize() override
Definition: ctrl.cxx:74
#define KEY_DOWN
Definition: keycodes.hxx:110
long AdjustRight(long nHorzMoveDelta)
Definition: ctrl.hxx:33
OUString maDayOfWeekText
Definition: calendar.hxx:128
virtual void GetFocus()
Definition: window.cxx:1805
const Color & GetButtonTextColor() const
WinBits const WB_BORDER
DayOfWeek
Date GetLastMonth() const
Definition: calendar.cxx:1376
VCL_DLLPRIVATE void ImplTracking(const Point &rPos, bool bRepeat)
Definition: calendar.cxx:930
bool IsVisible() const
Definition: window2.cxx:1097
Date maOldFormatFirstDate
Definition: calendar.hxx:130
#define SPIN_OFFX
Definition: calendar.cxx:45
VCL_DLLPRIVATE void ImplEndTracking(bool bCancel)
Definition: calendar.cxx:949
bool IsLeft() const
Definition: event.hxx:133
Color maOtherColor
Definition: calendar.hxx:137
void SetFirstDate(const Date &rNewFirstDate)
Definition: calendar.cxx:1354
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition: calendar.cxx:1176
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: calendar.cxx:1060
void SetBottom(long v)
Date GetFirstSelectedDate() const
Definition: calendar.cxx:1293
long AdjustTop(long nVertMoveDelta)
const Point & GetPosPixel() const
Definition: event.hxx:117
long Left() const
Date maCurDate
Definition: calendar.hxx:134
long mnDayWidth
Definition: calendar.hxx:146
long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: text.cxx:879
WinBits const WB_TABSTOP
Date GetLastDate() const
Definition: calendar.hxx:218
Link< Calendar *, void > maSelectHdl
Definition: calendar.hxx:161
bool mbCalc
Definition: calendar.hxx:151
#define KEY_HOME
Definition: keycodes.hxx:114
bool mbAllSel
Definition: calendar.hxx:151
void SetLeft(long v)
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:407
#define SAL_WARN(area, stream)
bool IsTrackingCanceled() const
Definition: event.hxx:256
OUString VclResId(const char *pId)
Definition: svdata.cxx:266
#define CALENDAR_HITTEST_DAY
Definition: calendar.cxx:48
#define CALENDAR_HITTEST_MONTHTITLE
Definition: calendar.cxx:49
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2815
WinBits const WB_GROUP
sal_uInt16 GetDayOfYear() const
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1887
const MouseEvent & GetMouseEvent() const
Definition: event.hxx:250
bool IsReallyVisible() const
Definition: window2.cxx:1102
sal_Int16 mnLastYear
Definition: calendar.hxx:150
bool HasFocus() const
Definition: window.cxx:2982
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1833
std::set< sal_Int32 > IntDateSet
Definition: calendar.hxx:34
void loadCalendar(const OUString &rUniqueID, const css::lang::Locale &rLocale, bool bTimeZoneUTC=true)
aStr
const Color & GetWindowTextColor() const
#define KEY_RIGHT
Definition: keycodes.hxx:113
void EndSelection()
Definition: calendar.cxx:1515
long Y() const
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
void Select()
Definition: calendar.cxx:1288
virtual void StateChanged(StateChangedType nStateChange) override
Definition: calendar.cxx:1266
#define KEY_UP
Definition: keycodes.hxx:111
void setHeight(long nHeight)
virtual void Command(const CommandEvent &rCEvt) override
Definition: calendar.cxx:1221