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