LibreOffice Module sc (master) 1
tpusrlst.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#undef SC_DLLIMPLEMENTATION
21
22#include <comphelper/string.hxx>
23#include <tools/lineend.hxx>
24#include <vcl/svapp.hxx>
25#include <vcl/weld.hxx>
26#include <osl/diagnose.h>
27#include <o3tl/string_view.hxx>
28
29#include <document.hxx>
30#include <tabvwsh.hxx>
31#include <viewdata.hxx>
32#include <uiitems.hxx>
33#include <userlist.hxx>
34#include <rangeutl.hxx>
35#include <crdlg.hxx>
36#include <sc.hrc>
37#include <globstr.hrc>
38#include <scresid.hxx>
39#include <tpusrlst.hxx>
40#include <scui_def.hxx>
41
42#define CR u'\x000D'
43#define LF u'\x000A'
44
46
47// Benutzerdefinierte Listen:
48
50 const SfxItemSet& rCoreAttrs )
51 : SfxTabPage(pPage, pController, "modules/scalc/ui/optsortlists.ui", "OptSortLists",
52 &rCoreAttrs )
53 , mxFtLists(m_xBuilder->weld_label("listslabel"))
54 , mxLbLists(m_xBuilder->weld_tree_view("lists"))
55 , mxFtEntries(m_xBuilder->weld_label("entrieslabel"))
56 , mxEdEntries(m_xBuilder->weld_text_view("entries"))
57 , mxFtCopyFrom(m_xBuilder->weld_label("copyfromlabel"))
58 , mxEdCopyFrom(m_xBuilder->weld_entry("copyfrom"))
59 , mxBtnNew(m_xBuilder->weld_button("new"))
60 , mxBtnDiscard(m_xBuilder->weld_button("discard"))
61 , mxBtnAdd(m_xBuilder->weld_button("add"))
62 , mxBtnModify(m_xBuilder->weld_button("modify"))
63 , mxBtnRemove(m_xBuilder->weld_button("delete"))
64 , mxBtnCopy(m_xBuilder->weld_button("copy"))
65 , aStrQueryRemove ( ScResId( STR_QUERYREMOVE ) )
66 , aStrCopyList ( ScResId( STR_COPYLIST ) )
67 , aStrCopyFrom ( ScResId( STR_COPYFROM ) )
68 , aStrCopyErr ( ScResId( STR_COPYERR ) )
69 , nWhichUserLists ( GetWhich( SID_SCUSERLISTS ) )
70 , pDoc ( nullptr )
71 , pViewData ( nullptr )
72 , bModifyMode ( false )
73 , bCancelMode ( false )
74 , bCopyDone ( false )
75 , nCancelPos ( 0 )
76{
78 Init();
79 Reset(&rCoreAttrs);
80}
81
83{
84}
85
87{
89 ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSh );
90
91 mxLbLists->connect_changed ( LINK( this, ScTpUserLists, LbSelectHdl ) );
92 mxBtnNew->connect_clicked ( LINK( this, ScTpUserLists, BtnClickHdl ) );
93 mxBtnDiscard->connect_clicked ( LINK( this, ScTpUserLists, BtnClickHdl ) );
94 mxBtnAdd->connect_clicked ( LINK( this, ScTpUserLists, BtnClickHdl ) );
95 mxBtnModify->connect_clicked ( LINK( this, ScTpUserLists, BtnClickHdl ) );
96 mxBtnRemove->connect_clicked ( LINK( this, ScTpUserLists, BtnClickHdl ) );
97 mxEdEntries->connect_changed ( LINK( this, ScTpUserLists, EdEntriesModHdl ) );
98
99 if ( pViewSh )
100 {
101 SCTAB nStartTab = 0;
102 SCTAB nEndTab = 0;
103 SCCOL nStartCol = 0;
104 SCROW nStartRow = 0;
105 SCCOL nEndCol = 0;
106 SCROW nEndRow = 0;
107
108 pViewData = &pViewSh->GetViewData();
110
111 pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
112 nEndCol, nEndRow, nEndTab );
113
114 PutInOrder( nStartCol, nEndCol );
115 PutInOrder( nStartRow, nEndRow );
116 PutInOrder( nStartTab, nEndTab );
117
118 aStrSelectedArea = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab
120
121 mxBtnCopy->connect_clicked ( LINK( this, ScTpUserLists, BtnClickHdl ) );
122 mxBtnCopy->set_sensitive(true);
123 }
124 else
125 {
126 mxBtnCopy->set_sensitive(false);
127 mxFtCopyFrom->set_sensitive(false);
128 mxEdCopyFrom->set_sensitive(false);
129 }
130
131}
132
133std::unique_ptr<SfxTabPage> ScTpUserLists::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
134{
135 return std::make_unique<ScTpUserLists>(pPage, pController, *rAttrSet);
136}
137
138void ScTpUserLists::Reset( const SfxItemSet* rCoreAttrs )
139{
140 const ScUserListItem& rUserListItem = static_cast<const ScUserListItem&>(
141 rCoreAttrs->Get( nWhichUserLists ));
142 const ScUserList* pCoreList = rUserListItem.GetUserList();
143
144 OSL_ENSURE( pCoreList, "UserList not found :-/" );
145
146 if ( pCoreList )
147 {
148 if ( !pUserLists )
149 pUserLists.reset( new ScUserList( *pCoreList ) );
150 else
151 *pUserLists = *pCoreList;
152
153 if ( UpdateUserListBox() > 0 )
154 {
155 mxLbLists->select( 0 );
156 UpdateEntries( 0 );
157 }
158 }
159 else if ( !pUserLists )
160 pUserLists.reset( new ScUserList );
161
162 mxEdCopyFrom->set_text( aStrSelectedArea );
163
164 if ( mxLbLists->n_children() == 0 )
165 {
166 mxFtLists->set_sensitive(false);
167 mxLbLists->set_sensitive(false);
168 mxFtEntries->set_sensitive(false);
169 mxEdEntries->set_sensitive(false);
170 mxBtnRemove->set_sensitive(false);
171 }
172
173 mxBtnNew->show();
174 mxBtnDiscard->hide();
175 mxBtnAdd->show();
176 mxBtnModify->hide();
177 mxBtnAdd->set_sensitive(false);
178 mxBtnModify->set_sensitive(false);
179
180 if ( !bCopyDone && pViewData )
181 {
182 mxFtCopyFrom->set_sensitive(true);
183 mxEdCopyFrom->set_sensitive(true);
184 mxBtnCopy->set_sensitive(true);
185 }
186}
187
189{
190 // Changes aren't saved?
191 // -> simulate click of Add-Button
192
193 if ( bModifyMode || bCancelMode )
194 BtnClickHdl(*mxBtnAdd);
195
196 const ScUserListItem& rUserListItem = static_cast<const ScUserListItem&>(
198
199 ScUserList* pCoreList = rUserListItem.GetUserList();
200 bool bDataModified = false;
201
202 if ( (pUserLists == nullptr) && (pCoreList == nullptr) )
203 {
204 bDataModified = false;
205 }
206 else if ( pUserLists != nullptr )
207 {
208 if ( pCoreList != nullptr )
209 bDataModified = (*pUserLists != *pCoreList);
210 else
211 bDataModified = true;
212 }
213
214 if ( bDataModified )
215 {
217
218 if ( pUserLists )
219 aULItem.SetUserList( *pUserLists );
220
221 rCoreAttrs->Put( aULItem );
222 }
223
224 return bDataModified;
225}
226
228{
229 if ( pSetP )
230 FillItemSet( pSetP );
231
232 return DeactivateRC::LeavePage;
233}
234
236{
237 mxLbLists->clear();
238
239 if ( !pUserLists ) return 0;
240
241 size_t nCount = pUserLists->size();
242 OUString aEntry;
243
244 for ( size_t i=0; i<nCount; ++i )
245 {
246 aEntry = (*pUserLists)[i].GetString();
247 OSL_ENSURE( !aEntry.isEmpty(), "Empty UserList-entry :-/" );
248 mxLbLists->append_text( aEntry );
249 }
250
251 return nCount;
252}
253
255{
256 if ( !pUserLists ) return;
257
258 if ( nList < pUserLists->size() )
259 {
260 const ScUserListData& rList = (*pUserLists)[nList];
261 std::size_t nSubCount = rList.GetSubCount();
262 OUStringBuffer aEntryListStr;
263
264 for ( size_t i=0; i<nSubCount; i++ )
265 {
266 if ( i!=0 )
267 aEntryListStr.append(CR);
268 aEntryListStr.append(rList.GetSubStr(i));
269 }
270
271 mxEdEntries->set_text(convertLineEnd(aEntryListStr.makeStringAndClear(), GetSystemLineEnd()));
272 }
273 else
274 {
275 OSL_FAIL( "Invalid ListIndex :-/" );
276 }
277}
278
279void ScTpUserLists::MakeListStr( OUString& rListStr )
280{
281 if (rListStr.isEmpty())
282 return;
283
284 OUStringBuffer aStr;
285
286 for(sal_Int32 nIdx=0; nIdx>=0;)
287 {
288 aStr.append(comphelper::string::strip(o3tl::getToken(rListStr, 0, LF, nIdx), ' '));
289 aStr.append(cDelimiter);
290 }
291
292 aStr.strip(cDelimiter);
293 sal_Int32 nLen = aStr.getLength();
294
295 rListStr.clear();
296
297 // delete all duplicates of cDelimiter
298 sal_Int32 c = 0;
299 while ( c < nLen )
300 {
301 rListStr += OUStringChar(aStr[c]);
302 ++c;
303
304 if ((c < nLen) && (aStr[c] == cDelimiter))
305 {
306 rListStr += OUStringChar(aStr[c]);
307
308 while ((c < nLen) && (aStr[c] == cDelimiter))
309 ++c;
310 }
311 }
312
313}
314
315void ScTpUserLists::AddNewList( const OUString& rEntriesStr )
316{
317 OUString theEntriesStr( rEntriesStr );
318
319 if ( !pUserLists )
320 pUserLists.reset( new ScUserList );
321
322 MakeListStr( theEntriesStr );
323
324 pUserLists->push_back(new ScUserListData(theEntriesStr));
325}
326
328 const ScRefAddress& rEndPos )
329{
330 if ( bCopyDone ) return;
331
332 SCTAB nTab = rStartPos.Tab();
333 SCCOL nStartCol = rStartPos.Col();
334 SCROW nStartRow = rStartPos.Row();
335 SCCOL nEndCol = rEndPos.Col();
336 SCROW nEndRow = rEndPos.Row();
337 sal_uInt16 nCellDir = SCRET_COLS;
338
339 if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) )
340 {
342 nCellDir = aDialog.run();
343 }
344 else if ( nStartCol != nEndCol )
345 nCellDir = SCRET_ROWS;
346 else
347 nCellDir = SCRET_COLS;
348
349 if ( nCellDir != RET_CANCEL )
350 {
351 bool bValueIgnored = false;
352
353 if ( nCellDir == SCRET_COLS )
354 {
355 for ( SCCOL col=nStartCol; col<=nEndCol; col++ )
356 {
357 OUStringBuffer aStrList;
358 for ( SCROW row=nStartRow; row<=nEndRow; row++ )
359 {
360 if ( pDoc->HasStringData( col, row, nTab ) )
361 {
362 OUString aStrField = pDoc->GetString(col, row, nTab);
363
364 if ( !aStrField.isEmpty() )
365 {
366 aStrList.append(aStrField + "\n");
367 }
368 }
369 else
370 bValueIgnored = true;
371 }
372 if ( !aStrList.isEmpty() )
373 AddNewList( aStrList.makeStringAndClear() );
374 }
375 }
376 else
377 {
378 for ( SCROW row=nStartRow; row<=nEndRow; row++ )
379 {
380 OUStringBuffer aStrList;
381 for ( SCCOL col=nStartCol; col<=nEndCol; col++ )
382 {
383 if ( pDoc->HasStringData( col, row, nTab ) )
384 {
385 OUString aStrField = pDoc->GetString(col, row, nTab);
386
387 if ( !aStrField.isEmpty() )
388 {
389 aStrList.append(aStrField + "\n");
390 }
391 }
392 else
393 bValueIgnored = true;
394 }
395 if ( !aStrList.isEmpty() )
396 AddNewList( aStrList.makeStringAndClear() );
397 }
398 }
399
400 if ( bValueIgnored )
401 {
402 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
403 VclMessageType::Info, VclButtonsType::Ok,
404 aStrCopyErr));
405 xInfoBox->run();
406 }
407 }
408
409 bCopyDone = true;
410
411}
412
413void ScTpUserLists::ModifyList( size_t nSelList,
414 const OUString& rEntriesStr )
415{
416 if ( !pUserLists ) return;
417
418 OUString theEntriesStr( rEntriesStr );
419
420 MakeListStr( theEntriesStr );
421
422 (*pUserLists)[nSelList].SetString( theEntriesStr );
423}
424
425void ScTpUserLists::RemoveList( size_t nList )
426{
427 if (pUserLists && nList < pUserLists->size())
428 {
429 ScUserList::iterator itr = pUserLists->begin();
430 ::std::advance(itr, nList);
431 pUserLists->erase(itr);
432 }
433}
434
435// Handler:
436
437IMPL_LINK( ScTpUserLists, LbSelectHdl, weld::TreeView&, rLb, void )
438{
439 if ( &rLb != mxLbLists.get() )
440 return;
441
442 sal_Int32 nSelPos = mxLbLists->get_selected_index();
443 if ( nSelPos == -1 )
444 return;
445
446 if ( !mxFtEntries->get_sensitive() ) mxFtEntries->set_sensitive(true);
447 if ( !mxEdEntries->get_sensitive() ) mxEdEntries->set_sensitive(true);
448 if ( !mxBtnRemove->get_sensitive() ) mxBtnRemove->set_sensitive(true);
449 if ( mxBtnAdd->get_sensitive() )
450 {
451 mxBtnAdd->set_sensitive(false);
452 mxBtnModify->set_sensitive(false);
453 }
454
455 UpdateEntries( nSelPos );
456}
457
458IMPL_LINK( ScTpUserLists, BtnClickHdl, weld::Button&, rBtn, void )
459{
460 if (&rBtn == mxBtnNew.get() || &rBtn == mxBtnDiscard.get())
461 {
462 if ( !bCancelMode )
463 {
464 nCancelPos = ( mxLbLists->n_children() > 0 )
465 ? mxLbLists->get_selected_index()
466 : 0;
467 mxLbLists->unselect_all();
468 mxFtLists->set_sensitive(false);
469 mxLbLists->set_sensitive(false);
470 mxFtEntries->set_sensitive(true);
471 mxEdEntries->set_sensitive(true);
472 mxEdEntries->set_text( OUString() );
473 mxEdEntries->grab_focus();
474 mxBtnAdd->set_sensitive(false);
475 mxBtnModify->set_sensitive(false);
476 mxBtnRemove->set_sensitive(false);
477
478 if ( mxBtnCopy->get_sensitive() )
479 {
480 mxBtnCopy->set_sensitive(false);
481 mxFtCopyFrom->set_sensitive(false);
482 mxEdCopyFrom->set_sensitive(false);
483 }
484 mxBtnNew->hide();
485 mxBtnDiscard->show();
486 bCancelMode = true;
487 }
488 else // if ( bCancelMode )
489 {
490 if ( mxLbLists->n_children() > 0 )
491 {
492 mxLbLists->select( nCancelPos );
493 LbSelectHdl( *mxLbLists );
494 mxFtLists->set_sensitive(true);
495 mxLbLists->set_sensitive(true);
496 }
497 else
498 {
499 mxFtEntries->set_sensitive(false);
500 mxEdEntries->set_sensitive(false);
501 mxEdEntries->set_text( OUString() );
502 mxBtnRemove->set_sensitive(false);
503 }
504 mxBtnAdd->set_sensitive(false);
505 mxBtnModify->set_sensitive(false);
506
507 if ( pViewData && !bCopyDone )
508 {
509 mxBtnCopy->set_sensitive(true);
510 mxFtCopyFrom->set_sensitive(true);
511 mxEdCopyFrom->set_sensitive(true);
512 }
513 mxBtnNew->show();
514 mxBtnDiscard->hide();
515 bCancelMode = false;
516 bModifyMode = false;
517 }
518 }
519 else if (&rBtn == mxBtnAdd.get() || &rBtn == mxBtnModify.get())
520 {
521 OUString theEntriesStr( mxEdEntries->get_text() );
522
523 if ( !bModifyMode )
524 {
525 if ( !theEntriesStr.isEmpty() )
526 {
527 AddNewList( theEntriesStr );
528 UpdateUserListBox();
529 mxLbLists->select( mxLbLists->n_children()-1 );
530 LbSelectHdl( *mxLbLists );
531 mxFtLists->set_sensitive(true);
532 mxLbLists->set_sensitive(true);
533 }
534 else
535 {
536 if ( mxLbLists->n_children() > 0 )
537 {
538 mxLbLists->select( nCancelPos );
539 LbSelectHdl( *mxLbLists );
540 mxLbLists->set_sensitive(true);
541 mxLbLists->set_sensitive(true);
542 }
543 }
544
545 mxBtnAdd->set_sensitive(false);
546 mxBtnModify->set_sensitive(false);
547 mxBtnRemove->set_sensitive(true);
548 mxBtnNew->show();
549 mxBtnDiscard->hide();
550 bCancelMode = false;
551 }
552 else // if ( bModifyMode )
553 {
554 sal_Int32 nSelList = mxLbLists->get_selected_index();
555
556 OSL_ENSURE( nSelList != -1 , "Modify without List :-/" );
557
558 if ( !theEntriesStr.isEmpty() )
559 {
560 ModifyList( nSelList, theEntriesStr );
561 UpdateUserListBox();
562 mxLbLists->select( nSelList );
563 }
564 else
565 {
566 mxLbLists->select( 0 );
567 LbSelectHdl( *mxLbLists );
568 }
569
570 mxBtnNew->show();
571 mxBtnDiscard->hide();
572 bCancelMode = false;
573 mxBtnAdd->show();
574 mxBtnModify->show();
575 mxBtnAdd->set_sensitive(false);
576 mxBtnModify->set_sensitive(false);
577 bModifyMode = false;
578 mxBtnRemove->set_sensitive(true);
579 mxFtLists->set_sensitive(true);
580 mxLbLists->set_sensitive(true);
581 }
582
583 if ( pViewData && !bCopyDone )
584 {
585 mxBtnCopy->set_sensitive(true);
586 mxFtCopyFrom->set_sensitive(true);
587 mxEdCopyFrom->set_sensitive(true);
588 }
589 }
590 else if ( &rBtn == mxBtnRemove.get() )
591 {
592 if ( mxLbLists->n_children() > 0 )
593 {
594 sal_Int32 nRemovePos = mxLbLists->get_selected_index();
595 OUString aMsg = o3tl::getToken(aStrQueryRemove, 0, '#' )
596 + mxLbLists->get_text( nRemovePos )
597 + o3tl::getToken(aStrQueryRemove, 1, '#' );
598
599 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
600 VclMessageType::Question, VclButtonsType::YesNo,
601 aMsg));
602 xQueryBox->set_default_response(RET_YES);
603
604 if (RET_YES == xQueryBox->run())
605 {
606 RemoveList( nRemovePos );
607 UpdateUserListBox();
608
609 if ( mxLbLists->n_children() > 0 )
610 {
611 mxLbLists->select(
612 ( nRemovePos >= mxLbLists->n_children() )
613 ? mxLbLists->n_children()-1
614 : nRemovePos );
615 LbSelectHdl( *mxLbLists );
616 }
617 else
618 {
619 mxFtLists->set_sensitive(false);
620 mxLbLists->set_sensitive(false);
621 mxFtEntries->set_sensitive(false);
622 mxEdEntries->set_sensitive(false);
623 mxEdEntries->set_text( OUString() );
624 mxBtnRemove->set_sensitive(false);
625 }
626 }
627
628 if ( pViewData && !bCopyDone && !mxBtnCopy->get_sensitive() )
629 {
630 mxBtnCopy->set_sensitive(true);
631 mxFtCopyFrom->set_sensitive(true);
632 mxEdCopyFrom->set_sensitive(true);
633 }
634 }
635 }
636 else if ( pViewData && (&rBtn == mxBtnCopy.get()) )
637 {
638 if ( bCopyDone )
639 return;
640
641 ScRefAddress theStartPos;
642 ScRefAddress theEndPos;
643 OUString theAreaStr( mxEdCopyFrom->get_text() );
644 bool bAreaOk = false;
645
646 if ( !theAreaStr.isEmpty() )
647 {
648 bAreaOk = ScRangeUtil::IsAbsArea( theAreaStr,
649 *pDoc,
650 pViewData->GetTabNo(),
651 &theAreaStr,
652 &theStartPos,
653 &theEndPos,
654 pDoc->GetAddressConvention() );
655 if ( !bAreaOk )
656 {
657 bAreaOk = ScRangeUtil::IsAbsPos( theAreaStr,
658 *pDoc,
659 pViewData->GetTabNo(),
660 &theAreaStr,
661 &theStartPos,
662 pDoc->GetAddressConvention() );
663 theEndPos = theStartPos;
664 }
665 }
666
667 if ( bAreaOk )
668 {
669 CopyListFromArea( theStartPos, theEndPos );
670 UpdateUserListBox();
671 mxLbLists->select( mxLbLists->n_children()-1 );
672 LbSelectHdl( *mxLbLists );
673 mxEdCopyFrom->set_text( theAreaStr );
674 mxEdCopyFrom->set_sensitive(false);
675 mxBtnCopy->set_sensitive(false);
676 mxFtCopyFrom->set_sensitive(false);
677 }
678 else
679 {
680 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
681 VclMessageType::Warning, VclButtonsType::Ok,
682 ScResId(STR_INVALID_TABREF)));
683
684 xBox->run();
685 mxEdCopyFrom->grab_focus();
686 mxEdCopyFrom->select_region(0, -1);
687 }
688 }
689}
690
691IMPL_LINK( ScTpUserLists, EdEntriesModHdl, weld::TextView&, rEd, void )
692{
693 if ( &rEd != mxEdEntries.get() )
694 return;
695
696 if ( mxBtnCopy->get_sensitive() )
697 {
698 mxBtnCopy->set_sensitive(false);
699 mxFtCopyFrom->set_sensitive(false);
700 mxEdCopyFrom->set_sensitive(false);
701 }
702
703 if ( !mxEdEntries->get_text().isEmpty() )
704 {
705 if ( !bCancelMode && !bModifyMode )
706 {
707 mxBtnNew->hide();
708 mxBtnDiscard->show();
709 bCancelMode = true;
710 mxBtnAdd->hide();
711 mxBtnAdd->set_sensitive(true);
712 mxBtnModify->show();
713 mxBtnModify->set_sensitive(true);
714 bModifyMode = true;
715 mxBtnRemove->set_sensitive(false);
716 mxFtLists->set_sensitive(false);
717 mxLbLists->set_sensitive(false);
718 }
719 else // if ( bCancelMode || bModifyMode )
720 {
721 if ( !mxBtnAdd->get_sensitive() )
722 {
723 mxBtnAdd->set_sensitive(true);
724 mxBtnModify->set_sensitive(true);
725 }
726 }
727 }
728 else
729 {
730 if ( mxBtnAdd->get_sensitive() )
731 {
732 mxBtnAdd->set_sensitive(false);
733 mxBtnModify->set_sensitive(false);
734 }
735 }
736}
737
738/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void PutInOrder(T &nStart, T &nEnd)
Definition: address.hxx:150
#define GetWhich(nSlot)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
SC_DLLPUBLIC bool HasStringData(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3797
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3544
static bool IsAbsArea(const OUString &rAreaStr, const ScDocument &rDoc, SCTAB nTab, OUString *pCompleteStr, ScRefAddress *pStartPos=nullptr, ScRefAddress *pEndPos=nullptr, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1)
Definition: rangeutl.cxx:169
static bool IsAbsPos(const OUString &rPosStr, const ScDocument &rDoc, SCTAB nTab, OUString *pCompleteStr, ScRefAddress *pPosTripel=nullptr, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1)
Definition: rangeutl.cxx:208
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2170
SCCOL Col() const
Definition: address.hxx:886
SCTAB Tab() const
Definition: address.hxx:894
SCROW Row() const
Definition: address.hxx:890
ScViewData & GetViewData()
Definition: tabview.hxx:335
virtual ~ScTpUserLists() override
Definition: tpusrlst.cxx:82
ScTpUserLists(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpusrlst.cxx:49
bool bCopyDone
Definition: tpusrlst.hxx:68
std::unique_ptr< weld::TextView > mxEdEntries
Definition: tpusrlst.hxx:44
virtual bool FillItemSet(SfxItemSet *rCoreAttrs) override
Definition: tpusrlst.cxx:188
const sal_uInt16 nWhichUserLists
Definition: tpusrlst.hxx:59
std::unique_ptr< weld::Button > mxBtnDiscard
Definition: tpusrlst.hxx:48
std::unique_ptr< ScUserList > pUserLists
Definition: tpusrlst.hxx:60
const OUString aStrCopyErr
Definition: tpusrlst.hxx:57
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: tpusrlst.cxx:133
ScDocument * pDoc
Definition: tpusrlst.hxx:62
std::unique_ptr< weld::Label > mxFtCopyFrom
Definition: tpusrlst.hxx:45
void UpdateEntries(size_t nList)
Definition: tpusrlst.cxx:254
bool bCancelMode
Definition: tpusrlst.hxx:67
std::unique_ptr< weld::Label > mxFtLists
Definition: tpusrlst.hxx:41
const OUString aStrCopyFrom
Definition: tpusrlst.hxx:56
OUString aStrSelectedArea
Definition: tpusrlst.hxx:64
std::unique_ptr< weld::Button > mxBtnModify
Definition: tpusrlst.hxx:50
const OUString aStrCopyList
Definition: tpusrlst.hxx:55
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tpusrlst.cxx:227
std::unique_ptr< weld::Button > mxBtnNew
Definition: tpusrlst.hxx:47
std::unique_ptr< weld::Button > mxBtnAdd
Definition: tpusrlst.hxx:49
virtual void Reset(const SfxItemSet *rCoreAttrs) override
Definition: tpusrlst.cxx:138
ScViewData * pViewData
Definition: tpusrlst.hxx:63
void AddNewList(const OUString &rEntriesStr)
Definition: tpusrlst.cxx:315
bool bModifyMode
Definition: tpusrlst.hxx:66
std::unique_ptr< weld::Label > mxFtEntries
Definition: tpusrlst.hxx:43
void CopyListFromArea(const ScRefAddress &rStartPos, const ScRefAddress &rEndPos)
Definition: tpusrlst.cxx:327
void RemoveList(size_t nList)
Definition: tpusrlst.cxx:425
std::unique_ptr< weld::Button > mxBtnCopy
Definition: tpusrlst.hxx:52
std::unique_ptr< weld::Entry > mxEdCopyFrom
Definition: tpusrlst.hxx:46
static void MakeListStr(OUString &rListStr)
Definition: tpusrlst.cxx:279
void Init()
Definition: tpusrlst.cxx:86
std::unique_ptr< weld::Button > mxBtnRemove
Definition: tpusrlst.hxx:51
void ModifyList(size_t nSelList, const OUString &rEntriesStr)
Definition: tpusrlst.cxx:413
std::unique_ptr< weld::TreeView > mxLbLists
Definition: tpusrlst.hxx:42
size_t UpdateUserListBox()
Definition: tpusrlst.cxx:235
Stores individual user-defined sort list.
Definition: userlist.hxx:33
OUString GetSubStr(sal_uInt16 nIndex) const
Definition: userlist.cxx:141
size_t GetSubCount() const
Definition: userlist.cxx:110
ScUserList * GetUserList() const
Definition: uiitems.hxx:205
void SetUserList(const ScUserList &rUserList)
Definition: uiitems.cxx:316
Collection of user-defined sort lists.
Definition: userlist.hxx:67
DataType::iterator iterator
Definition: userlist.hxx:72
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1181
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SfxItemSet & GetItemSet() const
void SetExchangeSupport()
weld::Window * GetFrameWeld() const
static SfxViewShell * Current()
virtual short run()
int nCount
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
LineEnd GetSystemLineEnd()
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
aStr
size
OString strip(const OString &rIn, char c)
int i
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SCRET_ROWS
Definition: scui_def.hxx:25
#define SCRET_COLS
Definition: scui_def.hxx:24
DeactivateRC
#define LF
Definition: tpusrlst.cxx:43
#define CR
Definition: tpusrlst.cxx:42
const sal_Unicode cDelimiter
Definition: tpusrlst.cxx:45
IMPL_LINK(ScTpUserLists, LbSelectHdl, weld::TreeView &, rLb, void)
Definition: tpusrlst.cxx:437
sal_uInt16 sal_Unicode
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
RET_CANCEL
RET_YES