LibreOffice Module sc (master) 1
condformatdlg.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
10#include <condformatdlg.hxx>
11
12#include <sfx2/dispatch.hxx>
13#include <vcl/svapp.hxx>
14
15#include <anyrefdg.hxx>
16#include <document.hxx>
17#include <conditio.hxx>
18#include <tabvwsh.hxx>
19#include <colorscale.hxx>
20#include <reffact.hxx>
21#include <docsh.hxx>
22#include <docfunc.hxx>
24#include <condformatdlgitem.hxx>
25
27 std::unique_ptr<weld::ScrolledWindow> xWindow,
28 std::unique_ptr<weld::Container> xGrid)
29 : mxScrollWindow(std::move(xWindow))
30 , mxGrid(std::move(xGrid))
31 , mbFrozen(false)
32 , mbNewEntry(false)
33 , mpDoc(nullptr)
34 , mpDialogParent(pDialogParent)
35{
36 mxScrollWindow->set_size_request(mxScrollWindow->get_approximate_digit_width() * 85,
37 mxScrollWindow->get_text_height() * 23);
38 mxGrid->set_stack_background();
39}
40
42{
43 return mpDialogParent->getDialog();
44}
45
47{
48 Freeze();
49}
50
52 const ScConditionalFormat* pFormat, const ScRangeList& rRanges,
54{
55 mpDoc = &rDoc;
56 maPos = rPos;
57 maRanges = rRanges;
58
59 Freeze();
60
61 if(pFormat)
62 {
63 size_t nCount = pFormat->size();
64 for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
65 {
66 const ScFormatEntry* pEntry = pFormat->GetEntry(nIndex);
67 switch(pEntry->GetType())
68 {
71 {
72 const ScCondFormatEntry* pConditionEntry = static_cast<const ScCondFormatEntry*>( pEntry );
73 if(pConditionEntry->GetOperation() != ScConditionMode::Direct)
74 maEntries.emplace_back(new ScConditionFrmtEntry( this, mpDoc, mpDialogParent, maPos, pConditionEntry ) );
75 else
76 maEntries.emplace_back(new ScFormulaFrmtEntry( this, mpDoc, mpDialogParent, maPos, pConditionEntry ) );
77
78 }
79 break;
81 {
82 const ScColorScaleFormat* pColorScale = static_cast<const ScColorScaleFormat*>( pEntry );
83 if( pColorScale->size() == 2 )
84 maEntries.emplace_back(new ScColorScale2FrmtEntry( this, mpDoc, maPos, pColorScale ) );
85 else
86 maEntries.emplace_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos, pColorScale ) );
87 }
88 break;
90 maEntries.emplace_back(new ScDataBarFrmtEntry( this, mpDoc, maPos, static_cast<const ScDataBarFormat*>( pEntry ) ) );
91 break;
93 maEntries.emplace_back(new ScIconSetFrmtEntry( this, mpDoc, maPos, static_cast<const ScIconSetFormat*>( pEntry ) ) );
94 break;
96 maEntries.emplace_back(new ScDateFrmtEntry( this, mpDoc, static_cast<const ScCondDateFormatEntry*>( pEntry ) ) );
97 break;
98 }
99 }
100 if(nCount)
101 EntrySelectHdl(*maEntries[0]);
102 }
103 else
104 {
105 switch(eType)
106 {
108 maEntries.emplace_back(new ScConditionFrmtEntry( this, mpDoc, mpDialogParent, maPos ));
109 break;
111 maEntries.emplace_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos ));
112 break;
114 maEntries.emplace_back(new ScDataBarFrmtEntry( this, mpDoc, maPos ));
115 break;
117 maEntries.emplace_back(new ScIconSetFrmtEntry( this, mpDoc, maPos ));
118 break;
120 maEntries.emplace_back(new ScDateFrmtEntry( this, mpDoc ));
121 break;
123 break;
124 }
125 mbNewEntry = true;
126 }
127 Thaw();
128 RecalcAll();
129 if (!maEntries.empty())
130 {
131 (*maEntries.begin())->SetActive();
133 }
134
135 RecalcAll();
136}
137
139{
140 maRanges = rRange;
141}
142
143std::unique_ptr<ScConditionalFormat> ScCondFormatList::GetConditionalFormat() const
144{
145 if(maEntries.empty())
146 return nullptr;
147
148 std::unique_ptr<ScConditionalFormat> pFormat(new ScConditionalFormat(0, mpDoc));
149 pFormat->SetRange(maRanges);
150
151 for(auto & rEntry: maEntries)
152 {
153 // tdf#119178: Sometimes initial apply-to range (the one this dialog
154 // was opened with) is different from the final apply-to range
155 // (as edited by the user)
156
157 // If this format entry is new, take top-left corner of the final range
158 // and use it to create the initial entry (token array therein, if applicable)
159 if (mbNewEntry)
160 rEntry->SetPos(maRanges.GetTopLeftCorner());
161 // else do nothing: setting new position when editing recompiles formulas
162 // in entries and nobody wants that
163
164 ScFormatEntry* pEntry = rEntry->GetEntry();
165 if(pEntry)
166 pFormat->AddEntry(pEntry);
167 }
168
169 return pFormat;
170}
171
173{
174 if (mbFrozen)
175 return;
176
177 int nWheelScroll = SAL_MAX_INT32;
178
179 sal_Int32 nIndex = 1;
180 for (const auto& item : maEntries)
181 {
182 if (!item)
183 continue;
184 item->SetIndex(nIndex);
185 item->set_grid_top_attach(nIndex - 1);
186 nWheelScroll = std::min(nWheelScroll, item->get_preferred_height());
187 ++nIndex;
188 }
189
190 if (nWheelScroll != SAL_MAX_INT32)
191 {
192 // tdf#118482 set a scroll step of the height of a collapsed entry
193 mxScrollWindow->vadjustment_set_step_increment(nWheelScroll);
194 }
195}
196
197IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, weld::ComboBox&, rBox, void)
198{
199 Application::PostUserEvent(LINK(this, ScCondFormatList, AfterColFormatTypeHdl), &rBox);
200}
201
202IMPL_LINK(ScCondFormatList, AfterColFormatTypeHdl, void*, p, void)
203{
204 weld::ComboBox* pBox = static_cast<weld::ComboBox*>(p);
205 EntryContainer::iterator itr = std::find_if(maEntries.begin(), maEntries.end(),
206 [](const std::unique_ptr<ScCondFrmtEntry>& widget) { return widget->IsSelected(); });
207 if(itr == maEntries.end())
208 return;
209
210 sal_Int32 nPos = pBox->get_active();
211 switch(nPos)
212 {
213 case 0:
214 if((*itr)->GetType() == condformat::entry::COLORSCALE2)
215 return;
216
217 Freeze();
218 itr->reset(new ScColorScale2FrmtEntry(this, mpDoc, maPos));
219 break;
220 case 1:
221 if((*itr)->GetType() == condformat::entry::COLORSCALE3)
222 return;
223
224 Freeze();
225 itr->reset(new ScColorScale3FrmtEntry(this, mpDoc, maPos));
226 break;
227 case 2:
228 if((*itr)->GetType() == condformat::entry::DATABAR)
229 return;
230
231 Freeze();
232 itr->reset(new ScDataBarFrmtEntry(this, mpDoc, maPos));
233 break;
234 case 3:
235 if((*itr)->GetType() == condformat::entry::ICONSET)
236 return;
237
238 Freeze();
239 itr->reset(new ScIconSetFrmtEntry(this, mpDoc, maPos));
240 break;
241 default:
242 break;
243 }
244 mpDialogParent->InvalidateRefData();
245 (*itr)->SetActive();
246 Thaw();
247 RecalcAll();
248}
249
250IMPL_LINK(ScCondFormatList, TypeListHdl, weld::ComboBox&, rBox, void)
251{
252 //Resolves: fdo#79021 At this point we are still inside the ListBox Select.
253 //If we call maEntries.replace here then the pBox will be deleted before it
254 //has finished Select and will crash on accessing its deleted this. So Post
255 //to do the real work after the Select has completed
256 Application::PostUserEvent(LINK(this, ScCondFormatList, AfterTypeListHdl), &rBox);
257}
258
259IMPL_LINK(ScCondFormatList, AfterTypeListHdl, void*, p, void)
260{
261 weld::ComboBox* pBox = static_cast<weld::ComboBox*>(p);
262 EntryContainer::iterator itr = std::find_if(maEntries.begin(), maEntries.end(),
263 [](const std::unique_ptr<ScCondFrmtEntry>& widget) { return widget->IsSelected(); });
264 if(itr == maEntries.end())
265 return;
266
267 sal_Int32 nPos = pBox->get_active();
268 switch(nPos)
269 {
270 case 0:
271 switch((*itr)->GetType())
272 {
276 break;
281 return;
282 }
283 Freeze();
284 itr->reset(new ScColorScale3FrmtEntry(this, mpDoc, maPos));
285 mpDialogParent->InvalidateRefData();
286 (*itr)->SetActive();
287 break;
288 case 1:
289 if((*itr)->GetType() == condformat::entry::CONDITION)
290 return;
291
292 Freeze();
293 itr->reset(new ScConditionFrmtEntry(this, mpDoc, mpDialogParent, maPos));
294 mpDialogParent->InvalidateRefData();
295 (*itr)->SetActive();
296 break;
297 case 2:
298 if((*itr)->GetType() == condformat::entry::FORMULA)
299 return;
300
301 Freeze();
302 itr->reset(new ScFormulaFrmtEntry(this, mpDoc, mpDialogParent, maPos));
303 mpDialogParent->InvalidateRefData();
304 (*itr)->SetActive();
305 break;
306 case 3:
307 if((*itr)->GetType() == condformat::entry::DATE)
308 return;
309
310 Freeze();
311 itr->reset(new ScDateFrmtEntry( this, mpDoc ));
312 mpDialogParent->InvalidateRefData();
313 (*itr)->SetActive();
314 break;
315
316 }
317 Thaw();
318 RecalcAll();
319}
320
322{
323 Freeze();
324 maEntries.emplace_back(new ScConditionFrmtEntry(this, mpDoc, mpDialogParent, maPos));
325 for(auto& rxEntry : maEntries)
326 {
327 rxEntry->SetInactive();
328 }
329 mpDialogParent->InvalidateRefData();
330 maEntries.back()->SetActive();
331 mpDialogParent->OnSelectionChange(maEntries.size() - 1, maEntries.size());
332 Thaw();
333 RecalcAll();
334}
335
337{
338 Freeze();
339 auto itr = std::find_if(maEntries.begin(), maEntries.end(),
340 [](const std::unique_ptr<ScCondFrmtEntry>& widget) { return widget->IsSelected(); });
341 if (itr != maEntries.end())
342 {
343 maEntries.erase(itr);
344 }
345 mpDialogParent->InvalidateRefData();
346 mpDialogParent->OnSelectionChange(0, maEntries.size(), false);
347 Thaw();
348 RecalcAll();
349}
350
352{
353 Freeze();
354 size_t index = 0;
355 for (size_t i = 0; i < maEntries.size(); i++)
356 {
357 auto& widget = maEntries[i];
358 if (widget->IsSelected() && i > 0)
359 {
360 std::swap(maEntries[i], maEntries[i - 1]);
361 index = i - 1;
362 break;
363 }
364 }
365 mpDialogParent->InvalidateRefData();
366 mpDialogParent->OnSelectionChange(index, maEntries.size());
367 Thaw();
368 RecalcAll();
369}
370
372{
373 Freeze();
374 size_t index = 0;
375 for (size_t i = 0; i < maEntries.size(); i++)
376 {
377 auto& widget = maEntries[i];
378 if (widget->IsSelected())
379 {
380 index = i;
381 if (i < maEntries.size()-1)
382 {
383 std::swap(maEntries[i], maEntries[i + 1]);
384 index = i + 1;
385 break;
386 }
387 }
388 }
389 mpDialogParent->InvalidateRefData();
390 mpDialogParent->OnSelectionChange(index, maEntries.size());
391 Thaw();
392 RecalcAll();
393}
394
395IMPL_LINK( ScCondFormatList, EntrySelectHdl, ScCondFrmtEntry&, rEntry, void )
396{
397 if(rEntry.IsSelected())
398 return;
399
400 Freeze();
401 size_t index = 0;
402 for(size_t i = 0; i < maEntries.size(); i++)
403 {
404 if (maEntries[i].get() == &rEntry)
405 {
406 index = i;
407 }
408 maEntries[i]->SetInactive();
409 }
410 mpDialogParent->InvalidateRefData();
411 mpDialogParent->OnSelectionChange(index, maEntries.size());
412 rEntry.SetActive();
413 Thaw();
414 RecalcAll();
415}
416
418 weld::Window* pParent, ScViewData* pViewData,
419 const ScCondFormatDlgItem* pItem)
420 : ScAnyRefDlgController(pB, pCW, pParent,
421 (SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone())?OUString("modules/scalc/ui/conditionalformatdialogmobile.ui"):OUString("modules/scalc/ui/conditionalformatdialog.ui"),
422 "ConditionalFormatDialog")
423 , mpViewData(pViewData)
424 , mpDlgItem(pItem->Clone())
425 , mpLastEdit(nullptr)
426 , mxBtnOk(m_xBuilder->weld_button("ok"))
427 , mxBtnAdd(m_xBuilder->weld_button("add"))
428 , mxBtnRemove(m_xBuilder->weld_button("delete"))
429 , mxBtnUp(m_xBuilder->weld_button("up"))
430 , mxBtnDown(m_xBuilder->weld_button("down"))
431 , mxBtnCancel(m_xBuilder->weld_button("cancel"))
432 , mxFtRange(m_xBuilder->weld_label("ftassign"))
433 , mxEdRange(new formula::RefEdit(m_xBuilder->weld_entry("edassign")))
434 , mxRbRange(new formula::RefButton(m_xBuilder->weld_button("rbassign")))
435 , mxCondFormList(new ScCondFormatList(this, m_xBuilder->weld_scrolled_window("listwindow"),
436 m_xBuilder->weld_container("list")))
437{
438 mxEdRange->SetReferences(this, mxFtRange.get());
439 mxRbRange->SetReferences(this, mxEdRange.get());
440
441 ScConditionalFormat* pFormat = nullptr;
442 mnKey = mpDlgItem->GetIndex();
443 if (mpDlgItem->IsManaged() && mpDlgItem->GetConditionalFormatList())
444 {
445 pFormat = mpDlgItem->GetConditionalFormatList()->GetFormat(mnKey);
446 }
447 else if (!mpDlgItem->IsManaged())
448 {
450 pFormat = rDoc.GetCondFormList(mpViewData->GetTabNo())->GetFormat ( mnKey );
451 }
452
453 ScRangeList aRange;
454 if (pFormat)
455 {
456 aRange = pFormat->GetRange();
457 }
458 else
459 {
460 // this is for adding a new entry
462 if(aRange.empty())
463 {
465 aRange.push_back(ScRange(aPos));
466 }
467 mnKey = 0;
468 }
469 maPos = aRange.GetTopLeftCorner();
470
471 mxCondFormList->init(mpViewData->GetDocument(), pFormat, aRange, maPos, mpDlgItem->GetDialogType());
472
473 mxBtnOk->connect_clicked(LINK(this, ScCondFormatDlg, BtnPressedHdl ) );
474 mxBtnAdd->connect_clicked( LINK( mxCondFormList.get(), ScCondFormatList, AddBtnHdl ) );
475 mxBtnRemove->connect_clicked( LINK( mxCondFormList.get(), ScCondFormatList, RemoveBtnHdl ) );
476 mxBtnUp->connect_clicked(LINK(mxCondFormList.get(), ScCondFormatList, UpBtnHdl));
477 mxBtnDown->connect_clicked(LINK(mxCondFormList.get(), ScCondFormatList, DownBtnHdl));
478 mxBtnCancel->connect_clicked( LINK(this, ScCondFormatDlg, BtnPressedHdl ) );
479 mxEdRange->SetModifyHdl( LINK( this, ScCondFormatDlg, EdRangeModifyHdl ) );
480 mxEdRange->SetGetFocusHdl( LINK( this, ScCondFormatDlg, RangeGetFocusHdl ) );
481
482 OUString aRangeString;
483 const ScDocument& rDoc = pViewData->GetDocument();
484 aRange.Format(aRangeString, ScRefFlags::VALID, rDoc, rDoc.GetAddressConvention());
485 mxEdRange->SetText(aRangeString);
486
487 msBaseTitle = m_xDialog->get_title();
488 updateTitle();
489}
490
492{
493 OUString aTitle = msBaseTitle + " " + mxEdRange->GetText();
494
495 m_xDialog->set_title(aTitle);
496}
497
499{
500}
501
503{
504 if(mpLastEdit)
506 else
507 mxEdRange->GrabFocus();
508
509 RefInputDone();
510}
511
513{
515
516 // ScAnyRefModalDlg::RefInputDone resets the title back
517 // to its original state.
518 // I.e. if we open the dialog normally, and then click into the sheet
519 // to modify the selection, the title is updated such that the range
520 // is only a single cell (e.g. $A$1), after which the dialog switches
521 // into the RefInput mode. During the RefInput mode the title is updated
522 // as expected, however at the end RefInputDone overwrites the title
523 // with the initial (now incorrect) single cell range. Hence we correct
524 // it here.
525 updateTitle();
526}
527
529{
530 return !mpLastEdit || mpLastEdit == mxEdRange.get();
531}
532
534{
535 return mxEdRange->GetWidget()->get_sensitive();
536}
537
539{
541 if (!mpLastEdit)
542 pEdit = mxEdRange.get();
543
544 if (!pEdit->GetWidget()->get_sensitive())
545 return;
546
547 if(rRef.aStart != rRef.aEnd)
548 RefInputStart(pEdit);
549
550 ScRefFlags nFlags;
551 if (mpLastEdit && mpLastEdit != mxEdRange.get())
553 else
554 nFlags = ScRefFlags::RANGE_ABS;
555
556 const ScDocument& rDoc = mpViewData->GetDocument();
557 OUString aRefStr(rRef.Format(rDoc, nFlags,
559 if (pEdit != mxEdRange.get())
560 {
561 Selection sel = pEdit->GetSelection();
562 sel.Normalize(); // in case of RTL selection
563 sel.Max() = sel.Min() + aRefStr.getLength();
564 pEdit->GetWidget()->replace_selection(aRefStr);
565 pEdit->SetSelection(sel); // to replace it again with next drag event
566 }
567 else
568 pEdit->SetRefString( aRefStr );
569 updateTitle();
570}
571
572std::unique_ptr<ScConditionalFormat> ScCondFormatDlg::GetConditionalFormat() const
573{
574 OUString aRangeStr = mxEdRange->GetText();
575 if(aRangeStr.isEmpty())
576 return nullptr;
577
578 ScRangeList aRange;
579 ScRefFlags nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(),
581 mxCondFormList->SetRange(aRange);
582 std::unique_ptr<ScConditionalFormat> pFormat = mxCondFormList->GetConditionalFormat();
583
584 if((nFlags & ScRefFlags::VALID) && !aRange.empty() && pFormat)
585 pFormat->SetRange(aRange);
586 else
587 pFormat.reset();
588
589 return pFormat;
590}
591
593{
594 mpLastEdit = nullptr;
595}
596
597// Close the Conditional Format Dialog
598//
600{
601 DoClose( ScCondFormatDlgWrapper::GetChildWindowId() );
602}
603
604// Occurs when the Conditional Format Dialog the OK button is pressed.
605//
607{
608 std::unique_ptr<ScConditionalFormat> pFormat = GetConditionalFormat();
609
610 if (!mpDlgItem->IsManaged())
611 {
612 if(pFormat)
613 {
614 auto& rRangeList = pFormat->GetRange();
616 std::move(pFormat), maPos.Tab(), rRangeList);
617 }
618 else
620 nullptr, maPos.Tab(), ScRangeList());
621 }
622 else
623 {
624 ScConditionalFormatList* pList = mpDlgItem->GetConditionalFormatList();
625 sal_uInt32 nKey = mnKey;
626 if (mnKey == 0)
627 {
628 nKey = pList->getMaxKey() + 1;
629 }
630
631 pList->erase(nKey);
632 if (pFormat)
633 {
634 pFormat->SetKey(nKey);
635 pList->InsertNew(std::move(pFormat));
636 }
638
639 SetDispatcherLock( false );
640 // Queue message to open Conditional Format Manager Dialog
641 GetBindings().GetDispatcher()->Execute( SID_OPENDLG_CONDFRMT_MANAGER,
642 SfxCallMode::ASYNCHRON );
643 }
644 m_xDialog->response(RET_OK);
645}
646
647// Occurs when the Conditional Format Dialog is cancelled.
648//
650{
651 if ( mpDlgItem->IsManaged() )
652 {
654 SetDispatcherLock( false );
655 // Queue message to open Conditional Format Manager Dialog
656 GetBindings().GetDispatcher()->Execute( SID_OPENDLG_CONDFRMT_MANAGER,
657 SfxCallMode::ASYNCHRON );
658 }
659 m_xDialog->response(RET_CANCEL);
660}
661
662void ScCondFormatDlg::OnSelectionChange(size_t nIndex, size_t nSize, bool bSelected)
663{
664 if (nSize <= 1 || !bSelected)
665 {
666 mxBtnUp->set_sensitive(false);
667 mxBtnDown->set_sensitive(false);
668 }
669 else
670 {
671 mxBtnUp->set_sensitive(nIndex != 0);
672 mxBtnDown->set_sensitive(nIndex < nSize - 1);
673 }
674}
675
676IMPL_LINK(ScCondFormatDlg, EdRangeModifyHdl, formula::RefEdit&, rEdit, void)
677{
678 OUString aRangeStr = rEdit.GetText();
679 ScRangeList aRange;
680 ScRefFlags nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(),
681 mpViewData->GetDocument().GetAddressConvention());
682 if(nFlags & ScRefFlags::VALID)
683 {
684 rEdit.GetWidget()->set_message_type(weld::EntryMessageType::Normal);
685 mxBtnOk->set_sensitive(true);
686 }
687 else
688 {
689 rEdit.GetWidget()->set_message_type(weld::EntryMessageType::Error);
690 mxBtnOk->set_sensitive(false);
691 }
692
693 updateTitle();
694}
695
696IMPL_LINK(ScCondFormatDlg, RangeGetFocusHdl, formula::RefEdit&, rControl, void)
697{
698 mpLastEdit = &rControl;
699}
700
701IMPL_LINK( ScCondFormatDlg, BtnPressedHdl, weld::Button&, rBtn, void)
702{
703 if (&rBtn == mxBtnOk.get())
704 OkPressed();
705 else if (&rBtn == mxBtnCancel.get())
706 CancelPressed();
707}
708
709/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScRefFlags
Definition: address.hxx:158
Reference< XExecutableDialog > m_xDialog
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
SCTAB Tab() const
Definition: address.hxx:283
size_t size() const
Definition: colorscale.cxx:744
ScViewData * mpViewData
std::unique_ptr< ScConditionalFormat > GetConditionalFormat() const
std::unique_ptr< weld::Button > mxBtnCancel
std::unique_ptr< weld::Button > mxBtnRemove
std::unique_ptr< weld::Button > mxBtnDown
std::unique_ptr< weld::Label > mxFtRange
std::unique_ptr< formula::RefButton > mxRbRange
std::unique_ptr< ScCondFormatList > mxCondFormList
std::unique_ptr< formula::RefEdit > mxEdRange
virtual void SetActive() override
virtual void RefInputDone(bool bForced=false) override
virtual bool IsTableLocked() const override
std::unique_ptr< weld::Button > mxBtnOk
std::shared_ptr< ScCondFormatDlgItem > mpDlgItem
OUString msBaseTitle
std::unique_ptr< weld::Button > mxBtnAdd
std::unique_ptr< weld::Button > mxBtnUp
ScCondFormatDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pWindow, ScViewData *pViewData, const ScCondFormatDlgItem *pDlgItem)
virtual bool IsRefInputMode() const override
virtual void Close() override
formula::RefEdit * mpLastEdit
virtual void SetReference(const ScRange &, ScDocument &) override
virtual ~ScCondFormatDlg() override
void OnSelectionChange(size_t nIndex, size_t nSize, bool bSelected=true)
EntryContainer maEntries
ScCondFormatList(ScCondFormatDlg *pParent, std::unique_ptr< weld::ScrolledWindow > xWindow, std::unique_ptr< weld::Container > xGrid)
ScCondFormatDlg * mpDialogParent
weld::Window * GetFrameWeld()
ScDocument * mpDoc
std::unique_ptr< weld::ScrolledWindow > mxScrollWindow
std::unique_ptr< weld::Container > mxGrid
void init(ScDocument &rDoc, const ScConditionalFormat *pFormat, const ScRangeList &rRanges, const ScAddress &rPos, condformat::dialog::ScCondFormatDialogType eType)
std::unique_ptr< ScConditionalFormat > GetConditionalFormat() const
void SetRange(const ScRangeList &rRange)
ScRangeList maRanges
ScConditionMode GetOperation() const
Definition: conditio.hxx:369
ScConditionalFormat * GetFormat(sal_uInt32 nKey)
Definition: conditio.cxx:2098
void InsertNew(std::unique_ptr< ScConditionalFormat > pNew)
Definition: conditio.cxx:2093
sal_uInt32 getMaxKey() const
Definition: conditio.cxx:2328
void erase(sal_uLong nIndex)
Definition: conditio.cxx:2292
const ScRangeList & GetRange() const
Definition: conditio.hxx:559
const ScFormatEntry * GetEntry(sal_uInt16 nPos) const
Definition: conditio.cxx:1802
size_t size() const
Definition: conditio.cxx:1788
void ReplaceConditionalFormat(sal_uLong nOldIndex, std::unique_ptr< ScConditionalFormat > pFormat, SCTAB nTab, const ScRangeList &rRanges)
Definition: docfunc.cxx:5603
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:221
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:492
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
Definition: documen4.cxx:860
virtual Type GetType() const =0
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
Definition: markdata.cxx:372
ScAddress GetTopLeftCorner() const
Definition: rangelst.cxx:1150
void Format(OUString &, ScRefFlags nFlags, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, sal_Unicode cDelimiter=0, bool bFullAddressNotation=false) const
Definition: rangelst.cxx:132
bool empty() const
Definition: rangelst.hxx:88
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1137
ScRefFlags Parse(std::u16string_view, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, SCTAB nDefaultTab=0, sal_Unicode cDelimiter=0)
Definition: rangelst.cxx:92
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
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: anyrefdg.cxx:745
virtual void RefInputDone(bool bForced=false) override
Definition: anyrefdg.cxx:775
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:714
void SetDispatcherLock(bool bLock)
Definition: anyrefdg.cxx:720
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3146
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
SCROW GetCurY() const
Definition: viewdata.hxx:402
SCCOL GetCurX() const
Definition: viewdata.hxx:401
tools::Long Min() const
void Normalize()
tools::Long Max() const
SfxDispatcher * GetDispatcher() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
SfxBindings & GetBindings() const
SfxItemPool & GetPool() const
void SetSelection(const Selection &rSelection)
weld::Entry * GetWidget() const
Selection GetSelection() const
void SetRefString(const OUString &rStr)
virtual int get_active() const=0
virtual void replace_selection(const OUString &rText)=0
virtual bool get_sensitive() const=0
IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, weld::ComboBox &, rBox, void)
IMPL_LINK_NOARG(ScCondFormatList, AddBtnHdl, weld::Button &, void)
int nCount
DocumentType eType
sal_Int32 nIndex
void * p
sal_uInt16 nPos
int i
index
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define SAL_MAX_INT32
RET_OK
RET_CANCEL