16#include <document.hxx>
27 std::unique_ptr<weld::ScrolledWindow> xWindow,
28 std::unique_ptr<weld::Container> xGrid)
29 : mxScrollWindow(
std::move(xWindow))
30 , mxGrid(
std::move(xGrid))
34 , mpDialogParent(pDialogParent)
38 mxGrid->set_stack_background();
83 if( pColorScale->
size() == 2 )
166 pFormat->AddEntry(pEntry);
185 item->set_grid_top_attach(
nIndex - 1);
186 nWheelScroll = std::min(nWheelScroll, item->get_preferred_height());
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())
244 mpDialogParent->InvalidateRefData();
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())
271 switch((*itr)->GetType())
285 mpDialogParent->InvalidateRefData();
294 mpDialogParent->InvalidateRefData();
303 mpDialogParent->InvalidateRefData();
312 mpDialogParent->InvalidateRefData();
325 for(
auto& rxEntry : maEntries)
327 rxEntry->SetInactive();
329 mpDialogParent->InvalidateRefData();
330 maEntries.back()->SetActive();
331 mpDialogParent->OnSelectionChange(maEntries.size() - 1, maEntries.size());
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())
343 maEntries.erase(itr);
345 mpDialogParent->InvalidateRefData();
346 mpDialogParent->OnSelectionChange(0, maEntries.size(),
false);
355 for (
size_t i = 0;
i < maEntries.size();
i++)
357 auto& widget = maEntries[
i];
358 if (widget->IsSelected() &&
i > 0)
360 std::swap(maEntries[
i], maEntries[
i - 1]);
365 mpDialogParent->InvalidateRefData();
366 mpDialogParent->OnSelectionChange(
index, maEntries.size());
375 for (
size_t i = 0;
i < maEntries.size();
i++)
377 auto& widget = maEntries[
i];
378 if (widget->IsSelected())
381 if (
i < maEntries.size()-1)
383 std::swap(maEntries[
i], maEntries[
i + 1]);
389 mpDialogParent->InvalidateRefData();
390 mpDialogParent->OnSelectionChange(
index, maEntries.size());
397 if(rEntry.IsSelected())
402 for(
size_t i = 0;
i < maEntries.size();
i++)
404 if (maEntries[
i].
get() == &rEntry)
408 maEntries[
i]->SetInactive();
410 mpDialogParent->InvalidateRefData();
411 mpDialogParent->OnSelectionChange(
index, maEntries.size());
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")))
445 pFormat =
mpDlgItem->GetConditionalFormatList()->GetFormat(
mnKey);
482 OUString aRangeString;
535 return mxEdRange->GetWidget()->get_sensitive();
557 OUString aRefStr(rRef.
Format(rDoc, nFlags,
563 sel.
Max() = sel.
Min() + aRefStr.getLength();
574 OUString aRangeStr =
mxEdRange->GetText();
575 if(aRangeStr.isEmpty())
582 std::unique_ptr<ScConditionalFormat> pFormat =
mxCondFormList->GetConditionalFormat();
585 pFormat->SetRange(aRange);
601 DoClose( ScCondFormatDlgWrapper::GetChildWindowId() );
614 auto& rRangeList = pFormat->GetRange();
616 std::move(pFormat),
maPos.
Tab(), rRangeList);
625 sal_uInt32 nKey =
mnKey;
634 pFormat->SetKey(nKey);
642 SfxCallMode::ASYNCHRON );
657 SfxCallMode::ASYNCHRON );
664 if (nSize <= 1 || !bSelected)
678 OUString aRangeStr = rEdit.GetText();
681 mpViewData->GetDocument().GetAddressConvention());
685 mxBtnOk->set_sensitive(
true);
690 mxBtnOk->set_sensitive(
false);
698 mpLastEdit = &rControl;
703 if (&rBtn == mxBtnOk.get())
705 else if (&rBtn == mxBtnCancel.get())
Reference< XExecutableDialog > m_xDialog
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
ScConditionMode GetOperation() const
void ReplaceConditionalFormat(sal_uLong nOldIndex, std::unique_ptr< ScConditionalFormat > pFormat, SCTAB nTab, const ScRangeList &rRanges)
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
virtual Type GetType() const =0
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
ScAddress GetTopLeftCorner() const
void Format(OUString &, ScRefFlags nFlags, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, sal_Unicode cDelimiter=0, bool bFullAddressNotation=false) const
void push_back(const ScRange &rRange)
ScRefFlags Parse(std::u16string_view, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, SCTAB nDefaultTab=0, sal_Unicode cDelimiter=0)
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...
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
virtual void RefInputDone(bool bForced=false) override
bool DoClose(sal_uInt16 nId)
void SetDispatcherLock(bool bLock)
ScMarkData & GetMarkData()
ScDocument & GetDocument() const
ScDocShell * GetDocShell() const
ScTabViewShell * GetViewShell() 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
virtual int get_active() const=0
virtual void replace_selection(const OUString &rText)=0
#define LINK(Instance, Class, Member)
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)