LibreOffice Module svx (master) 1
ctredlin.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
21#include <comphelper/string.hxx>
23#include <o3tl/safeint.hxx>
24#include <vcl/svapp.hxx>
25#include <vcl/settings.hxx>
26#include <vcl/weldutils.hxx>
27#include <svtools/ctrlbox.hxx>
29
30#include <helpids.h>
31
32#include <svx/ctredlin.hxx>
33
34#define WRITER_DATE 2
35#define CALC_DATE 3
36
38 : aDateTime(DateTime::EMPTY)
39 , pData(nullptr)
41 , bDisabled(false)
42{
43}
44
46{
47}
48
49SvxRedlinTable::SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
50 std::unique_ptr<weld::TreeView> xCalcControl)
51 : xSorter(new comphelper::string::NaturalStringSorter(::comphelper::getProcessComponentContext(),
52 Application::GetSettings().GetUILanguageTag().getLocale()))
53 , xWriterTreeView(std::move(xWriterControl))
54 , xCalcTreeView(std::move(xCalcControl))
55 , pTreeView(nullptr)
56 , nDatePos(WRITER_DATE)
57 , bAuthor(false)
58 , bDate(false)
59 , bComment(false)
60 , bSorted(false)
61 , nDaTiMode(SvxRedlinDateMode::BEFORE)
62 , aDaTiFirst( DateTime::EMPTY )
63 , aDaTiLast( DateTime::EMPTY )
64 , aDaTiFilterFirst( DateTime::EMPTY )
65 , aDaTiFilterLast( DateTime::EMPTY )
66{
68 {
69 xWriterTreeView->set_size_request(-1, xWriterTreeView->get_height_rows(8));
70 xWriterTreeView->connect_column_clicked(LINK(this, SvxRedlinTable, HeaderBarClick));
71 xWriterTreeView->set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){
72 return ColCompare(rLeft, rRight);
73 });
75 }
76 if (xCalcTreeView)
77 {
78 xCalcTreeView->set_size_request(-1, xCalcTreeView->get_height_rows(8));
79 xCalcTreeView->connect_column_clicked(LINK(this, SvxRedlinTable, HeaderBarClick));
80 xCalcTreeView->set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){
81 return ColCompare(rLeft, rRight);
82 });
84 }
85}
86
88{
89}
90
91IMPL_LINK(SvxRedlinTable, HeaderBarClick, int, nColumn, void)
92{
93 if (!bSorted)
94 {
95 pTreeView->make_sorted();
96 bSorted = true;
97 }
98
99 bool bSortAtoZ = pTreeView->get_sort_order();
100
101 //set new arrow positions in headerbar
102 if (nColumn == pTreeView->get_sort_column())
103 {
104 bSortAtoZ = !bSortAtoZ;
105 pTreeView->set_sort_order(bSortAtoZ);
106 }
107 else
108 {
109 int nOldSortColumn = pTreeView->get_sort_column();
110 if (nOldSortColumn != -1)
111 pTreeView->set_sort_indicator(TRISTATE_INDET, nOldSortColumn);
112 pTreeView->set_sort_column(nColumn);
113 }
114
115 if (nColumn != -1)
116 {
117 //sort lists
118 pTreeView->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
119 }
120}
121
123{
124 sal_Int32 nCompare = 0;
125
126 int nSortCol = pTreeView->get_sort_column();
127
128 if (pTreeView == xWriterTreeView.get() && nSortCol == 0)
129 {
130 RedlinData *pLeftData = weld::fromId<RedlinData*>(pTreeView->get_id(rLeft));
131 RedlinData *pRightData = weld::fromId<RedlinData*>(pTreeView->get_id(rRight));
132
133 if (pLeftData && pRightData)
134 {
135 if (pLeftData->eType < pRightData->eType)
136 nCompare = -1;
137 else if (pLeftData->eType > pRightData->eType)
138 nCompare = 1;
139 return nCompare;
140 }
141 }
142
143 if (nSortCol == nDatePos)
144 {
145 RedlinData *pLeftData = weld::fromId<RedlinData*>(pTreeView->get_id(rLeft));
146 RedlinData *pRightData = weld::fromId<RedlinData*>(pTreeView->get_id(rRight));
147
148 if (pLeftData && pRightData)
149 {
150 if (pLeftData->aDateTime < pRightData->aDateTime)
151 nCompare = -1;
152 else if (pLeftData->aDateTime > pRightData->aDateTime)
153 nCompare = 1;
154 return nCompare;
155 }
156 }
157
158 return xSorter->compare(pTreeView->get_text(rLeft, nSortCol),
159 pTreeView->get_text(rRight, nSortCol));
160}
161
163{
164 Date aDateMax( Date::SYSTEM );
165 aDateMax.AddYears(100);
166 Date aDateMin(1,1,1989);
167 tools::Time aTMin(0);
168 tools::Time aTMax(23,59,59);
169
170 DateTime aDTMin(aDateMin);
171 DateTime aDTMax(aDateMax);
172
173 switch(nDaTiMode)
174 {
176 aDaTiFilterFirst=aDTMin;
178 break;
182 aDaTiFilterLast=aDTMax;
183 break;
189 break;
195 break;
199 break;
201 break;
202 }
203}
204
206{
207 bDate=bFlag;
208}
209
211{
212 nDaTiMode=nMode;
213}
214
216{
217 aDaTiFirst.SetDate(aDate.GetDate());
218}
219
221{
222 aDaTiLast.SetDate(aDate.GetDate());
223}
224
226{
227 aDaTiFirst.SetTime(aTime.GetTime());
228}
229
231{
232 aDaTiLast.SetTime(aTime.GetTime());
233}
234
236{
237 bAuthor=bFlag;
238}
239
240void SvxRedlinTable::SetAuthor(const OUString &aString)
241{
242 aAuthor=aString;
243}
244
246{
247 bComment=bFlag;
248}
249
251{
252 if(pSearchPara!=nullptr)
253 {
254 pCommentSearcher.reset(new utl::TextSearch(*pSearchPara, LANGUAGE_SYSTEM ));
255 }
256}
257
258bool SvxRedlinTable::IsValidEntry(std::u16string_view rAuthorStr,
259 const DateTime &rDateTime,
260 const OUString &rCommentStr)
261{
262 return IsValidEntry(rAuthorStr, rDateTime) && IsValidComment(rCommentStr);
263}
264
265bool SvxRedlinTable::IsValidEntry(std::u16string_view rAuthorStr, const DateTime &rDateTime)
266{
267 if (bAuthor && aAuthor!=rAuthorStr)
268 return false;
269
270 if (!bDate)
271 return true;
272
273 const bool bRes = rDateTime.IsBetween(aDaTiFilterFirst, aDaTiFilterLast);
274 return nDaTiMode!=SvxRedlinDateMode::NOTEQUAL ? bRes : !bRes;
275}
276
277bool SvxRedlinTable::IsValidComment(const OUString &rCommentStr)
278{
279 if (!bComment)
280 return true;
281
282 sal_Int32 nStartPos = 0;
283 sal_Int32 nEndPos = rCommentStr.getLength();
284 return pCommentSearcher->SearchForward( rCommentStr, &nStartPos, &nEndPos);
285}
286
288{
289}
290
292{
293}
294
296 : SvxTPage(pParent, "svx/ui/redlineviewpage.ui", "RedlineViewPage")
297 , bEnableAccept(true)
298 , bEnableAcceptAll(true)
299 , bEnableReject(true)
300 , bEnableRejectAll(true)
301 , bEnableUndo(true)
302 , bEnableClearFormat(false)
303 , bEnableClearFormatAll(false)
304 , m_xAccept(m_xBuilder->weld_button("accept"))
305 , m_xReject(m_xBuilder->weld_button("reject"))
306 , m_xAcceptAll(m_xBuilder->weld_button("acceptall"))
307 , m_xRejectAll(m_xBuilder->weld_button("rejectall"))
308 , m_xUndo(m_xBuilder->weld_button("undo"))
309 , m_xViewData(new SvxRedlinTable(m_xBuilder->weld_tree_view("writerchanges"),
310 m_xBuilder->weld_tree_view("calcchanges")))
311{
312 Link<weld::Button&,void> aLink=LINK( this, SvxTPView, PbClickHdl);
313
314 m_xAccept->connect_clicked(aLink);
315 m_xAcceptAll->connect_clicked(aLink);
316 m_xReject->connect_clicked(aLink);
317 m_xRejectAll->connect_clicked(aLink);
318 m_xUndo->connect_clicked(aLink);
319}
320
322{
323 m_xAccept->set_sensitive(bEnableAccept);
324 m_xReject->set_sensitive(bEnableReject);
325 m_xAcceptAll->set_sensitive(bEnableAcceptAll);
326 m_xRejectAll->set_sensitive(bEnableRejectAll);
327 m_xUndo->set_sensitive(bEnableUndo);
328}
329
331{
332 m_xAccept->set_sensitive(false);
333 m_xReject->set_sensitive(false);
334 m_xAcceptAll->set_sensitive(false);
335 m_xRejectAll->set_sensitive(false);
336 m_xUndo->set_sensitive(false);
337}
338
340{
341}
342
344{
346 if (xCalcTreeView)
347 xCalcTreeView->hide();
348 xWriterTreeView->show();
350
351 auto nDigitWidth = pTreeView->get_approximate_digit_width();
352 std::vector<int> aWidths
353 {
354 o3tl::narrowing<int>(nDigitWidth * 10),
355 o3tl::narrowing<int>(nDigitWidth * 20),
356 o3tl::narrowing<int>(nDigitWidth * 20)
357 };
359}
360
362{
364 if (xWriterTreeView)
365 xWriterTreeView->hide();
366 xCalcTreeView->show();
367 pTreeView = xCalcTreeView.get();
368
369 auto nDigitWidth = pTreeView->get_approximate_digit_width();
370 std::vector<int> aWidths
371 {
372 o3tl::narrowing<int>(nDigitWidth * 20),
373 o3tl::narrowing<int>(nDigitWidth * 20),
374 o3tl::narrowing<int>(nDigitWidth * 20),
375 o3tl::narrowing<int>(nDigitWidth * 20)
376 };
378}
379
381{
382 bEnableAccept = bFlag;
383 m_xAccept->set_sensitive(bFlag);
384}
385
387{
388 bEnableAcceptAll = bFlag;
389 m_xAcceptAll->set_sensitive(bFlag);
390}
391
393{
394 bEnableReject = bFlag;
395 m_xReject->set_sensitive(bFlag);
396}
397
399{
400 bEnableRejectAll = bFlag;
401 m_xRejectAll->set_sensitive(bFlag);
402}
403
405{
406 if (bEnableClearFormat == bFlag)
407 return;
408 bEnableClearFormat = bFlag;
409}
410
412{
413 if (bEnableClearFormatAll == bFlag)
414 return;
415 bEnableClearFormatAll = bFlag;
416}
417
419{
420 m_xUndo->show();
421}
422
423void SvxTPView::EnableUndo(bool bFlag)
424{
425 bEnableUndo = bFlag;
426 m_xUndo->set_sensitive(bFlag);
427}
428
429IMPL_LINK( SvxTPView, PbClickHdl, weld::Button&, rPushB, void)
430{
431 if (&rPushB == m_xAccept.get())
432 {
433 AcceptClickLk.Call(this);
434 }
435 else if (&rPushB == m_xAcceptAll.get())
436 {
437 AcceptAllClickLk.Call(this);
438 }
439 else if (&rPushB == m_xReject.get())
440 {
441 RejectClickLk.Call(this);
442 }
443 else if (&rPushB == m_xRejectAll.get())
444 {
445 RejectAllClickLk.Call(this);
446 }
447 else if (&rPushB == m_xUndo.get())
448 {
449 UndoClickLk.Call(this);
450 }
451}
452
453SvxTPage::SvxTPage(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID)
454 : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription))
455 , m_xContainer(m_xBuilder->weld_container(rID))
456{
457}
458
460 : SvxTPage(pParent, "svx/ui/redlinefilterpage.ui", "RedlineFilterPage")
461 , bModified(false)
462 , m_pRedlinTable(nullptr)
463 , m_xCbDate(m_xBuilder->weld_check_button("date"))
464 , m_xLbDate(m_xBuilder->weld_combo_box("datecond"))
465 , m_xDfDate(new SvtCalendarBox(m_xBuilder->weld_menu_button("startdate")))
466 , m_xTfDate(m_xBuilder->weld_formatted_spin_button("starttime"))
467 , m_xTfDateFormatter(new weld::TimeFormatter(*m_xTfDate))
468 , m_xIbClock(m_xBuilder->weld_button("startclock"))
469 , m_xFtDate2(m_xBuilder->weld_label("and"))
470 , m_xDfDate2(new SvtCalendarBox(m_xBuilder->weld_menu_button("enddate")))
471 , m_xTfDate2(m_xBuilder->weld_formatted_spin_button("endtime"))
472 , m_xTfDate2Formatter(new weld::TimeFormatter(*m_xTfDate2))
473 , m_xIbClock2(m_xBuilder->weld_button("endclock"))
474 , m_xCbAuthor(m_xBuilder->weld_check_button("author"))
475 , m_xLbAuthor(m_xBuilder->weld_combo_box("authorlist"))
476 , m_xCbRange(m_xBuilder->weld_check_button("range"))
477 , m_xEdRange(m_xBuilder->weld_entry("rangeedit"))
478 , m_xBtnRange(m_xBuilder->weld_button("dotdotdot"))
479 , m_xCbAction(m_xBuilder->weld_check_button("action"))
480 , m_xLbAction(m_xBuilder->weld_combo_box("actionlist"))
481 , m_xCbComment(m_xBuilder->weld_check_button("comment"))
482 , m_xEdComment(m_xBuilder->weld_entry("commentedit"))
483{
484 m_xTfDateFormatter->EnableEmptyField(false);
485 m_xTfDate2Formatter->EnableEmptyField(false);
486
487 m_xLbDate->set_active(0);
488 m_xLbDate->connect_changed( LINK( this, SvxTPFilter, SelDateHdl ) );
489 m_xIbClock->connect_clicked( LINK( this, SvxTPFilter, TimeHdl) );
490 m_xIbClock2->connect_clicked( LINK( this, SvxTPFilter,TimeHdl) );
491 m_xBtnRange->connect_clicked( LINK( this, SvxTPFilter, RefHandle));
492
493 Link<weld::Toggleable&,void> aLink=LINK( this, SvxTPFilter, RowEnableHdl) ;
494 m_xCbDate->connect_toggled(aLink);
495 m_xCbAuthor->connect_toggled(aLink);
496 m_xCbRange->connect_toggled(aLink);
497 m_xCbAction->connect_toggled(aLink);
498 m_xCbComment->connect_toggled(aLink);
499
500 Link<SvtCalendarBox&,void> a2Link=LINK(this, SvxTPFilter, ModifyDate);
501 m_xDfDate->connect_activated(a2Link);
502 m_xDfDate2->connect_activated(a2Link);
503
505 m_xTfDate->connect_value_changed(a3Link);
506 m_xTfDate2->connect_value_changed(a3Link);
507
508 Link<weld::Entry&,void> a4Link=LINK( this, SvxTPFilter, ModifyHdl);
509 m_xEdRange->connect_changed(a4Link);
510 m_xEdComment->connect_changed(a4Link);
511 m_xLbAction->connect_changed(LINK( this, SvxTPFilter, ModifyListBoxHdl));
512 m_xLbAuthor->connect_changed(LINK( this, SvxTPFilter, ModifyListBoxHdl));
513
514 RowEnableHdl(*m_xCbDate);
515 RowEnableHdl(*m_xCbAuthor);
516 RowEnableHdl(*m_xCbRange);
517 RowEnableHdl(*m_xCbAction);
518 RowEnableHdl(*m_xCbComment);
519
520 DateTime aDateTime(DateTime::SYSTEM);
521 SetFirstDate(aDateTime);
522 SetLastDate(aDateTime);
523 SetFirstTime(aDateTime);
524 SetLastTime(aDateTime);
525 HideRange();
526 ShowAction();
527 bModified=false;
528}
529
531{
532}
533
535{
536 m_pRedlinTable = pTable;
537}
538
540{
541 if(bFlag && m_xCbDate->get_active())
542 {
543 m_xDfDate->set_sensitive(true);
544 m_xTfDate->set_sensitive(true);
545 m_xIbClock->set_sensitive(true);
546 }
547 else
548 {
549 m_xDfDate->set_sensitive(false);
550 m_xTfDate->set_sensitive(false);
551 m_xIbClock->set_sensitive(false);
552 }
553}
555{
556 if(bFlag && m_xCbDate->get_active())
557 {
558 m_xFtDate2->set_sensitive(true);
559 m_xDfDate2->set_sensitive(true);
560 m_xTfDate2->set_sensitive(true);
561 m_xIbClock2->set_sensitive(true);
562 }
563 else
564 {
565 m_xFtDate2->set_sensitive(false);
566 m_xDfDate2->set_sensitive(false);
567 m_xDfDate2->set_label(OUString());
568 m_xTfDate2->set_sensitive(false);
569 m_xTfDate2->set_text(OUString());
570 m_xIbClock2->set_sensitive(false);
571 }
572}
573
575{
576 return m_xDfDate->get_date();
577}
578
580{
581 m_xDfDate->set_date(aDate);
582}
583
585{
586 return m_xTfDateFormatter->GetTime();
587}
588
590{
591 m_xTfDateFormatter->SetTime(aTime);
592}
593
595{
596 return m_xDfDate2->get_date();
597}
598
600{
601 m_xDfDate2->set_date(aDate);
602}
603
605{
606 return m_xTfDate2Formatter->GetTime();
607}
608
610{
611 m_xTfDate2Formatter->SetTime(aTime);
612}
613
614void SvxTPFilter::SetDateMode(sal_uInt16 nMode)
615{
616 m_xLbDate->set_active(nMode);
617 SelDateHdl(*m_xLbDate);
618}
619
621{
622 return static_cast<SvxRedlinDateMode>(m_xLbDate->get_active());
623}
625{
626 m_xLbAuthor->clear();
627}
628
629void SvxTPFilter::InsertAuthor( const OUString& rString)
630{
631 m_xLbAuthor->append_text(rString);
632}
633
635{
636 return m_xLbAuthor->get_active_text();
637}
638
640{
641 m_xLbAuthor->set_active(nPos);
642}
643
644sal_Int32 SvxTPFilter::SelectAuthor(const OUString& aString)
645{
646 m_xLbAuthor->set_active_text(aString);
647 return m_xLbAuthor->get_active();
648}
649
650void SvxTPFilter::SetRange(const OUString& rString)
651{
652 m_xEdRange->set_text(rString);
653}
654
655OUString SvxTPFilter::GetRange() const
656{
657 return m_xEdRange->get_text();
658}
659
661{
662 m_xEdRange->grab_focus();
663}
664
666{
667 if (bHide)
668 {
669 m_xCbRange->hide();
670 m_xEdRange->hide();
671 m_xBtnRange->hide();
672 }
673 else
674 {
675 ShowAction(false);
676 m_xCbRange->show();
677 m_xEdRange->show();
678 m_xBtnRange->show();
679 }
680}
681
682void SvxTPFilter::SetComment(const OUString &rComment)
683{
684 m_xEdComment->set_text(rComment);
685}
686
688{
689 return m_xEdComment->get_text();
690}
691
693{
694 return m_xCbDate->get_active();
695}
696
698{
699 return m_xCbAuthor->get_active();
700}
701
703{
704 return m_xCbRange->get_active();
705}
706
708{
709 return m_xCbAction->get_active();
710}
711
713{
714 return m_xCbComment->get_active();
715}
716
718{
719 m_xCbDate->set_active(bFlag);
720 RowEnableHdl(*m_xCbDate);
721 bModified=false;
722}
723
725{
726 m_xCbAuthor->set_active(bFlag);
727 RowEnableHdl(*m_xCbAuthor);
728 bModified=false;
729}
730
732{
733 m_xCbRange->set_active(bFlag);
734 RowEnableHdl(*m_xCbRange);
735 bModified=false;
736}
737
739{
740 m_xCbAction->set_active(bFlag);
741 RowEnableHdl(*m_xCbAction);
742 bModified=false;
743}
744
746{
747 m_xCbComment->set_active(bFlag);
748 RowEnableHdl(*m_xCbComment);
749 bModified=false;
750}
751
753{
754 if(!bShow)
755 {
756 m_xCbAction->hide();
757 m_xLbAction->hide();
758 }
759 else
760 {
761 HideRange();
762 m_xCbAction->show();
763 m_xLbAction->show();
764 }
765}
766
768{
769 SvxRedlinDateMode nKind = static_cast<SvxRedlinDateMode>(m_xLbDate->get_active());
770 switch(nKind)
771 {
773 EnableDateLine1(true);
774 EnableDateLine2(false);
775 break;
777 EnableDateLine1(true);
778 EnableDateLine2(false);
779 break;
781 EnableDateLine1(true);
782 m_xTfDate->set_sensitive(false);
783 m_xTfDate->set_text(OUString());
784 EnableDateLine2(false);
785 break;
787 EnableDateLine1(true);
788 m_xTfDate->set_sensitive(false);
789 m_xTfDate->set_text(OUString());
790 EnableDateLine2(false);
791 break;
793 EnableDateLine1(true);
794 EnableDateLine2(true);
795 break;
797 EnableDateLine1(false);
798 EnableDateLine2(false);
799 break;
801 break;
802 }
803 bModified = true;
804}
805
806IMPL_LINK(SvxTPFilter, RowEnableHdl, weld::Toggleable&, rCB, void)
807{
808 if (&rCB == m_xCbDate.get())
809 {
810 m_xLbDate->set_sensitive(m_xCbDate->get_active());
811 EnableDateLine1(false);
812 EnableDateLine2(false);
813 if(m_xCbDate->get_active()) SelDateHdl(*m_xLbDate);
814 }
815 else if (&rCB == m_xCbAuthor.get())
816 {
817 m_xLbAuthor->set_sensitive(m_xCbAuthor->get_active());
818 }
819 else if (&rCB == m_xCbRange.get())
820 {
821 m_xEdRange->set_sensitive(m_xCbRange->get_active());
822 m_xBtnRange->set_sensitive(m_xCbRange->get_active());
823 }
824 else if (&rCB == m_xCbAction.get())
825 {
826 m_xLbAction->set_sensitive(m_xCbAction->get_active());
827 }
828 else if (&rCB == m_xCbComment.get())
829 {
830 m_xEdComment->set_sensitive(m_xCbComment->get_active());
831 }
832 bModified = true;
833}
834
835IMPL_LINK(SvxTPFilter, TimeHdl, weld::Button&, rIB, void)
836{
837 DateTime aDateTime( DateTime::SYSTEM );
838 if (&rIB == m_xIbClock.get())
839 {
840 SetFirstDate(aDateTime);
841 SetFirstTime(aDateTime);
842 }
843 else if (&rIB == m_xIbClock2.get())
844 {
845 SetLastDate(aDateTime);
846 SetLastTime(aDateTime);
847 }
848 bModified=true;
849}
850
852{
853 bModified=true;
854}
855
857{
858 bModified=true;
859}
860
862{
863 if(bModified)
864 {
865 if (m_pRedlinTable)
866 {
875
877
878 utl::SearchParam aSearchParam( m_xEdComment->get_text(),
880
881 m_pRedlinTable->SetCommentParams(&aSearchParam);
882
884 }
885
886 aReadyLink.Call(this);
887 }
888 bModified=false;
889}
890
891void SvxTPFilter::Enable(bool bEnable)
892{
893 m_xContainer->set_sensitive(bEnable);
894 if (m_xCbDate->get_sensitive())
895 {
896 RowEnableHdl(*m_xCbDate);
897 RowEnableHdl(*m_xCbAuthor);
898 RowEnableHdl(*m_xCbRange);
899 RowEnableHdl(*m_xCbComment);
900 }
901}
902
903IMPL_LINK(SvxTPFilter, ModifyDate, SvtCalendarBox&, rTF, void)
904{
905 Date aDate( Date::SYSTEM );
906 if (m_xDfDate.get() == &rTF)
907 {
908 if (m_xDfDate->get_label().isEmpty())
909 m_xDfDate->set_date(aDate);
910
911 if(m_pRedlinTable!=nullptr)
912 m_pRedlinTable->SetFirstDate(m_xDfDate->get_date());
913 }
914 else if (m_xDfDate2.get() == &rTF)
915 {
916 if (m_xDfDate2->get_label().isEmpty())
917 m_xDfDate2->set_date(aDate);
918
919 if (m_pRedlinTable)
920 m_pRedlinTable->SetLastDate(m_xDfDate2->get_date());
921 }
922 bModified=true;
923}
924
926{
927 tools::Time aTime(0);
928 if (m_xTfDate.get() == &rTF)
929 {
930 if (m_xTfDate->get_text().isEmpty())
931 SetFirstTime(aTime);
932
933 if (m_pRedlinTable!=nullptr)
934 m_pRedlinTable->SetFirstTime(GetFirstTime());
935 }
936 else if (m_xTfDate2.get() == &rTF)
937 {
938 if (m_xTfDate2->get_text().isEmpty())
939 SetLastTime(aTime);
940
941 if (m_pRedlinTable!=nullptr)
942 m_pRedlinTable->SetLastTime(GetLastTime());
943
944 }
945 bModified=true;
946}
947
949{
950 aRefLink.Call(this);
951}
952
954 : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/redlinecontrol.ui"))
955 , m_xTabCtrl(m_xBuilder->weld_notebook("tabcontrol"))
956{
957 m_xTabCtrl->connect_enter_page(LINK(this, SvxAcceptChgCtr, ActivatePageHdl));
958 m_xTabCtrl->connect_leave_page(LINK(this, SvxAcceptChgCtr, DeactivatePageHdl));
959
960 m_xTPFilter.reset(new SvxTPFilter(m_xTabCtrl->get_page("filter")));
961 m_xTPView.reset(new SvxTPView(m_xTabCtrl->get_page("view")));
962 m_xTPFilter->SetRedlinTable(m_xTPView->GetTableControl());
963 m_xTabCtrl->set_current_page("view");
964 m_xTabCtrl->set_help_id(HID_REDLINE_CTRL_VIEW);
965 m_xTabCtrl->show();
966}
967
969{
970 m_xTPFilter.reset();
971 m_xTPView.reset();
972}
973
975{
976 m_xTabCtrl->set_current_page("filter");
977}
978
979IMPL_LINK(SvxAcceptChgCtr, ActivatePageHdl, const OString&, rPage, void)
980{
981 if (rPage == "filter")
982 {
983 m_xTPFilter->ActivatePage();
984 m_xTabCtrl->set_help_id(HID_REDLINE_CTRL_FILTER);
985 }
986 else if (rPage == "view")
987 {
988 m_xTPView->ActivatePage();
989 m_xTabCtrl->set_help_id(HID_REDLINE_CTRL_VIEW);
990 }
991}
992
993IMPL_LINK(SvxAcceptChgCtr, DeactivatePageHdl, const OString&, rPage, bool)
994{
995 if (rPage == "filter")
996 m_xTPFilter->DeactivatePage();
997 else if (rPage == "view")
998 m_xTPView->DeactivatePage();
999 return true;
1000}
1001
1002/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsBetween(const DateTime &rFrom, const DateTime &rTo) const
sal_Int32 GetDate() const
void SetDate(sal_Int32 nNewDate)
void AddYears(sal_Int16 nAddYears)
Struct for sorting data.
Definition: ctredlin.hxx:68
RedlineType eType
Definition: ctredlin.hxx:74
DateTime aDateTime
Definition: ctredlin.hxx:72
virtual ~RedlinData()
Definition: ctredlin.cxx:45
std::unique_ptr< SvxTPView > m_xTPView
Definition: ctredlin.hxx:322
std::unique_ptr< weld::Notebook > m_xTabCtrl
Definition: ctredlin.hxx:319
std::unique_ptr< SvxTPFilter > m_xTPFilter
Definition: ctredlin.hxx:321
void ShowFilterPage()
Definition: ctredlin.cxx:974
SvxAcceptChgCtr(weld::Container *pParent)
Definition: ctredlin.cxx:953
std::unique_ptr< comphelper::string::NaturalStringSorter > xSorter
Definition: ctredlin.hxx:81
void SetFilterAuthor(bool bFlag)
Definition: ctredlin.cxx:235
void SetDateTimeMode(SvxRedlinDateMode nMode)
Definition: ctredlin.cxx:210
void SetAuthor(const OUString &)
Definition: ctredlin.cxx:240
void SetFirstTime(const tools::Time &)
Definition: ctredlin.cxx:225
SvxRedlinTable(std::unique_ptr< weld::TreeView > xWriterControl, std::unique_ptr< weld::TreeView > xCalcControl)
Definition: ctredlin.cxx:49
weld::TreeView * pTreeView
Definition: ctredlin.hxx:84
void SetCalcView()
Definition: ctredlin.cxx:361
std::unique_ptr< weld::TreeView > xCalcTreeView
Definition: ctredlin.hxx:83
void SetLastDate(const Date &)
Definition: ctredlin.cxx:220
void SetCommentParams(const utl::SearchParam *pSearchPara)
Definition: ctredlin.cxx:250
DateTime aDaTiFilterLast
Definition: ctredlin.hxx:95
void SetFirstDate(const Date &)
Definition: ctredlin.cxx:215
DateTime aDaTiFilterFirst
Definition: ctredlin.hxx:94
DateTime aDaTiLast
Definition: ctredlin.hxx:93
std::unique_ptr< utl::TextSearch > pCommentSearcher
Definition: ctredlin.hxx:97
void SetLastTime(const tools::Time &)
Definition: ctredlin.cxx:230
bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime, const OUString &rComment)
Definition: ctredlin.cxx:258
SvxRedlinDateMode nDaTiMode
Definition: ctredlin.hxx:91
void UpdateFilterTest()
Definition: ctredlin.cxx:162
void SetFilterDate(bool bFlag)
Definition: ctredlin.cxx:205
void SetWriterView()
Definition: ctredlin.cxx:343
sal_uInt16 nDatePos
Definition: ctredlin.hxx:86
DateTime aDaTiFirst
Definition: ctredlin.hxx:92
bool IsValidComment(const OUString &rComment)
Definition: ctredlin.cxx:277
void SetFilterComment(bool bFlag)
Definition: ctredlin.cxx:245
int ColCompare(const weld::TreeIter &rLeft, const weld::TreeIter &rRight)
Definition: ctredlin.cxx:122
std::unique_ptr< weld::TreeView > xWriterTreeView
Definition: ctredlin.hxx:82
OUString aAuthor
Definition: ctredlin.hxx:96
Tabpage with the filter text entries etc.
Definition: ctredlin.hxx:154
std::unique_ptr< weld::ComboBox > m_xLbAction
Definition: ctredlin.hxx:178
std::unique_ptr< weld::CheckButton > m_xCbComment
Definition: ctredlin.hxx:179
void CheckComment(bool bFlag)
Definition: ctredlin.cxx:745
void ShowAction(bool bShow=true)
Definition: ctredlin.cxx:752
void SetFirstTime(const tools::Time &aTime)
Definition: ctredlin.cxx:589
void DeactivatePage()
Definition: ctredlin.cxx:861
virtual ~SvxTPFilter() override
Definition: ctredlin.cxx:530
void HideRange(bool bHide=true)
Definition: ctredlin.cxx:665
std::unique_ptr< weld::CheckButton > m_xCbDate
Definition: ctredlin.hxx:161
bool IsRange() const
Definition: ctredlin.cxx:702
Date GetLastDate() const
Definition: ctredlin.cxx:594
std::unique_ptr< SvtCalendarBox > m_xDfDate2
Definition: ctredlin.hxx:168
void SetFocusToRange()
Definition: ctredlin.cxx:660
std::unique_ptr< weld::Entry > m_xEdComment
Definition: ctredlin.hxx:180
void SelectedAuthorPos(sal_Int32 nPos)
Definition: ctredlin.cxx:639
void ClearAuthors()
Definition: ctredlin.cxx:624
OUString GetSelectedAuthor() const
Definition: ctredlin.cxx:634
Date GetFirstDate() const
Definition: ctredlin.cxx:574
std::unique_ptr< weld::Button > m_xBtnRange
Definition: ctredlin.hxx:176
Link< SvxTPFilter *, void > aReadyLink
Definition: ctredlin.hxx:155
std::unique_ptr< weld::Entry > m_xEdRange
Definition: ctredlin.hxx:175
void SetRedlinTable(SvxRedlinTable *)
Definition: ctredlin.cxx:534
void SetLastTime(const tools::Time &aTime)
Definition: ctredlin.cxx:609
void CheckAction(bool bFlag)
Definition: ctredlin.cxx:738
bool IsAuthor() const
Definition: ctredlin.cxx:697
bool bModified
Definition: ctredlin.hxx:158
void SetFirstDate(const Date &aDate)
Definition: ctredlin.cxx:579
void CheckDate(bool bFlag)
Definition: ctredlin.cxx:717
std::unique_ptr< weld::ComboBox > m_xLbAuthor
Definition: ctredlin.hxx:173
OUString GetComment() const
Definition: ctredlin.cxx:687
SvxRedlinDateMode GetDateMode() const
Definition: ctredlin.cxx:620
void SetComment(const OUString &rComment)
Definition: ctredlin.cxx:682
void InsertAuthor(const OUString &rString)
Definition: ctredlin.cxx:629
std::unique_ptr< weld::TimeFormatter > m_xTfDateFormatter
Definition: ctredlin.hxx:165
std::unique_ptr< weld::CheckButton > m_xCbAction
Definition: ctredlin.hxx:177
std::unique_ptr< weld::ComboBox > m_xLbDate
Definition: ctredlin.hxx:162
std::unique_ptr< weld::CheckButton > m_xCbAuthor
Definition: ctredlin.hxx:172
void CheckAuthor(bool bFlag)
Definition: ctredlin.cxx:724
void CheckRange(bool bFlag)
Definition: ctredlin.cxx:731
void SetRange(const OUString &rString)
Definition: ctredlin.cxx:650
OUString GetRange() const
Definition: ctredlin.cxx:655
std::unique_ptr< weld::FormattedSpinButton > m_xTfDate2
Definition: ctredlin.hxx:169
std::unique_ptr< weld::Label > m_xFtDate2
Definition: ctredlin.hxx:167
SvxTPFilter(weld::Container *pParent)
Definition: ctredlin.cxx:459
void Enable(bool bEnable=true)
Definition: ctredlin.cxx:891
std::unique_ptr< weld::Button > m_xIbClock
Definition: ctredlin.hxx:166
std::unique_ptr< weld::TimeFormatter > m_xTfDate2Formatter
Definition: ctredlin.hxx:170
bool IsAction() const
Definition: ctredlin.cxx:707
sal_Int32 SelectAuthor(const OUString &aString)
Definition: ctredlin.cxx:644
void EnableDateLine2(bool bFlag)
Definition: ctredlin.cxx:554
void SetDateMode(sal_uInt16 nMode)
Definition: ctredlin.cxx:614
void EnableDateLine1(bool bFlag)
Definition: ctredlin.cxx:539
SvxRedlinTable * m_pRedlinTable
Definition: ctredlin.hxx:160
bool IsComment() const
Definition: ctredlin.cxx:712
tools::Time GetLastTime() const
Definition: ctredlin.cxx:604
std::unique_ptr< weld::CheckButton > m_xCbRange
Definition: ctredlin.hxx:174
bool IsDate() const
Definition: ctredlin.cxx:692
void SetLastDate(const Date &aDate)
Definition: ctredlin.cxx:599
tools::Time GetFirstTime() const
Definition: ctredlin.cxx:584
std::unique_ptr< weld::FormattedSpinButton > m_xTfDate
Definition: ctredlin.hxx:164
std::unique_ptr< SvtCalendarBox > m_xDfDate
Definition: ctredlin.hxx:163
std::unique_ptr< weld::Button > m_xIbClock2
Definition: ctredlin.hxx:171
Tabpage with the redlining entries.
Definition: ctredlin.hxx:257
void EnableRejectAll(bool bFlag)
Definition: ctredlin.cxx:398
SvxTPView(weld::Container *pParent)
Definition: ctredlin.cxx:295
void EnableAccept(bool bFlag)
Definition: ctredlin.cxx:380
bool bEnableUndo
Definition: ctredlin.hxx:270
void DeactivatePage()
Definition: ctredlin.cxx:330
void EnableClearFormat(bool bFlag)
Definition: ctredlin.cxx:404
virtual ~SvxTPView() override
Definition: ctredlin.cxx:339
virtual void ActivatePage() override
Definition: ctredlin.cxx:321
void EnableUndo(bool bFlag=true)
Definition: ctredlin.cxx:423
bool bEnableRejectAll
Definition: ctredlin.hxx:269
void EnableAcceptAll(bool bFlag)
Definition: ctredlin.cxx:386
bool bEnableClearFormatAll
Definition: ctredlin.hxx:273
bool bEnableClearFormat
Definition: ctredlin.hxx:272
bool bEnableAcceptAll
Definition: ctredlin.hxx:267
void EnableReject(bool bFlag)
Definition: ctredlin.cxx:392
std::unique_ptr< weld::Button > m_xRejectAll
Definition: ctredlin.hxx:278
std::unique_ptr< weld::Button > m_xAccept
Definition: ctredlin.hxx:275
std::unique_ptr< weld::Button > m_xReject
Definition: ctredlin.hxx:276
void ShowUndo()
Definition: ctredlin.cxx:418
bool bEnableAccept
Definition: ctredlin.hxx:266
bool bEnableReject
Definition: ctredlin.hxx:268
std::unique_ptr< weld::Button > m_xUndo
Definition: ctredlin.hxx:279
void EnableClearFormatAll(bool bFlag)
Definition: ctredlin.cxx:411
std::unique_ptr< weld::Button > m_xAcceptAll
Definition: ctredlin.hxx:277
virtual ~SvxTPage()
Definition: ctredlin.cxx:287
virtual void ActivatePage()
Definition: ctredlin.cxx:291
std::unique_ptr< weld::Container > m_xContainer
Definition: ctredlin.hxx:139
SvxTPage(weld::Container *pParent, const OUString &rUIXMLDescription, const OString &rID)
Definition: ctredlin.cxx:453
sal_Int64 GetTime() const
void SetTime(sal_Int64 nNewTime)
virtual OUString get_text(int row, int col=-1) const=0
virtual int get_sort_column() const=0
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
virtual OUString get_id(int pos) const=0
virtual float get_approximate_digit_width() const=0
#define WRITER_DATE
Definition: ctredlin.cxx:34
IMPL_LINK_NOARG(SvxTPFilter, SelDateHdl, weld::ComboBox &, void)
Definition: ctredlin.cxx:767
#define CALC_DATE
Definition: ctredlin.cxx:35
IMPL_LINK(SvxRedlinTable, HeaderBarClick, int, nColumn, void)
Definition: ctredlin.cxx:91
SvxRedlinDateMode
Definition: ctredlin.hxx:45
RedlineType
Definition: ctredlin.hxx:50
DocumentType eType
TRISTATE_FALSE
TRISTATE_INDET
TRISTATE_TRUE
constexpr OStringLiteral HID_REDLINE_CTRL_VIEW
Definition: helpids.h:61
constexpr OStringLiteral HID_REDLINE_CTRL_FILTER
Definition: helpids.h:62
#define LANGUAGE_SYSTEM
sal_uInt16 nPos
std::unique_ptr< sal_Int32[]> pData
const LanguageTag & getLocale()
Reference< XComponentContext > getProcessComponentContext()
constexpr OUStringLiteral EMPTY
Reference< XNameAccess > m_xContainer