20#undef SC_DLLIMPLEMENTATION
28#include <osl/diagnose.h>
33#include <document.hxx>
72 :
SfxTabPage(pPage, pController,
"modules/scalc/ui/sortcriteriapage.ui",
"SortCriteriaPage", &rArgSet)
75 m_aIdle(
"ScTabPageSortFields Scroll To End Idle"),
76 aStrUndefined (
ScResId( SCSTR_UNDEFINED ) ),
77 aStrColumn (
ScResId( SCSTR_COLUMN ) ),
78 aStrRow (
ScResId( SCSTR_ROW ) ),
79 aStrRowLabel (
ScResId( SCSTR_ROW_LABEL ) ),
80 aStrColLabel (
ScResId( SCSTR_COL_LABEL ) ),
82 nWhichSort ( rArgSet.GetPool()->
GetWhich( SID_SORT ) ),
83 pViewData ( nullptr ),
84 aSortData ( rArgSet.
Get( nWhichSort ).GetSortData() ),
87 nSortKeyCount(
std::
max(aSortData.GetSortKeyCount(), static_cast<sal_uInt16>(
DEFSORT)))
89 , m_xTop(m_xBuilder->weld_container(
"TopWindow"))
90 , m_xBtnHeader(m_xBuilder->weld_check_button(
"cbHeader"))
91 , m_xBtnTopDown(m_xBuilder->weld_radio_button(
"rbTopDown"))
92 , m_xBtnLeftRight(m_xBuilder->weld_radio_button(
"rbLeftRight"))
93 , m_xScrolledWindow(m_xBuilder->weld_scrolled_window(
"SortCriteriaPage"))
94 , m_xBox(m_xBuilder->weld_container(
"SortKeyWindow"))
95 , m_aSortWin(m_xBox.
get())
146 OSL_ENSURE(
pViewData,
"ViewData not found!" );
160 return std::make_unique<ScTabPageSortFields>(pPage, pController, *pArgSet);
250 aNewSortData = aTempData;
256 std::vector<sal_Int32> nSortPos;
261 if (nSortPos[
i] == -1) nSortPos[
i] = 0;
267 if ( nSortPos[0] > 0 )
303 return DeactivateRC::LeavePage;
355 aFieldName = rDoc.
GetString(nFirstSortCol, row, nTab);
357 aFieldName = OUString::number( row+1);
377 sal_uInt16 nFieldPos = 0;
415 if ( (m_xBtnTopDown->get_active() != aSortData.bByRow) || (m_xBtnHeader->get_active() != aSortData.bHasHeader))
417 if (m_xBtnTopDown->get_active())
418 m_xBtnHeader->set_label(aStrColLabel);
420 m_xBtnHeader->set_label(aStrRowLabel);
422 aSortData.bByRow = m_xBtnTopDown->get_active();
423 aSortData.bHasHeader = m_xBtnHeader->get_active();
426 std::vector<sal_uInt16> nCurSel;
427 for ( sal_uInt16
i=0;
i<nSortKeyCount;
i++ )
428 nCurSel.push_back( m_aSortWin.m_aSortKeyItems[
i]->m_xLbSort->get_active() );
432 for ( sal_uInt16
i=0;
i<nSortKeyCount;
i++ )
433 m_aSortWin.m_aSortKeyItems[
i]->m_xLbSort->set_active(nCurSel[
i]);
439 OUString aSelEntry = rLb.get_active_text();
440 ScSortKeyItems::iterator pIter;
443 if (m_aSortWin.m_aSortKeyItems.back()->m_xLbSort.get() == &rLb)
445 if ( aSelEntry != aStrUndefined )
447 SetLastSortKey( nSortKeyCount );
453 pIter = std::find_if(m_aSortWin.m_aSortKeyItems.begin(), m_aSortWin.m_aSortKeyItems.end(),
454 [&rLb](
const ScSortKeyItems::value_type& rItem) { return rItem->m_xLbSort.get() == &rLb; });
456 if (pIter == m_aSortWin.m_aSortKeyItems.end())
461 if ( std::distance(m_aSortWin.m_aSortKeyItems.begin(), pIter) >= nSortKeyCount )
464 if ( aSelEntry == aStrUndefined )
466 for ( ; pIter != m_aSortWin.m_aSortKeyItems.end(); ++pIter )
468 (*pIter)->m_xLbSort->set_active(0);
470 (*pIter)->DisableField();
475 (*pIter)->EnableField();
481 m_xScrolledWindow->vadjustment_set_value(m_xScrolledWindow->vadjustment_get_upper());
493 :
SfxTabPage(pPage, pController,
"modules/scalc/ui/sortoptionspage.ui",
"SortOptionsPage", &rArgSet)
494 , aStrUndefined(
ScResId(SCSTR_UNDEFINED))
495 , aStrCommentsRowLabel(
ScResId(SCSTR_NOTES_ROW_LABEL))
496 , aStrCommentsColLabel(
ScResId(SCSTR_NOTES_COL_LABEL))
497 , aStrImgRowLabel(
ScResId(SCSTR_IMAGES_ROW_LABEL))
498 , aStrImgColLabel(
ScResId(SCSTR_IMAGES_COL_LABEL))
499 , nWhichSort(rArgSet.GetPool()->
GetWhich(SID_SORT))
500 , aSortData(rArgSet.
Get(nWhichSort).GetSortData())
503 , m_xBtnCase(m_xBuilder->weld_check_button(
"case"))
504 , m_xBtnFormats(m_xBuilder->weld_check_button(
"formats"))
505 , m_xBtnNaturalSort(m_xBuilder->weld_check_button(
"naturalsort"))
506 , m_xBtnCopyResult(m_xBuilder->weld_check_button(
"copyresult"))
507 , m_xLbOutPos(m_xBuilder->weld_combo_box(
"outarealb"))
508 , m_xEdOutPos(m_xBuilder->weld_entry(
"outareaed"))
509 , m_xBtnSortUser(m_xBuilder->weld_check_button(
"sortuser"))
510 , m_xLbSortUser(m_xBuilder->weld_combo_box(
"sortuserlb"))
511 , m_xLbLanguage(new
SvxLanguageBox(m_xBuilder->weld_combo_box(
"language")))
512 , m_xFtAlgorithm(m_xBuilder->weld_label(
"algorithmft"))
513 , m_xLbAlgorithm(m_xBuilder->weld_combo_box(
"algorithmlb"))
514 , m_xBtnIncComments(m_xBuilder->weld_check_button(
"includenotes"))
515 , m_xBtnIncImages(m_xBuilder->weld_check_button(
"includeimages"))
541 OSL_ENSURE(
pViewData,
"ViewData not found! :-/" );
571 m_xLbLanguage->SetLanguageList( SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN,
false );
577 return std::make_unique<ScTabPageSortOptions>(pPage, pController, *rArgSet);
646 aNewSortData = pSortItem->GetSortData();
670 uno::Sequence<OUString> aAlgos =
m_oColWrap->listCollatorAlgorithms(
673 if ( nSel < aAlgos.getLength() )
706 bool bPosInputOk =
true;
712 sal_Int32 nColonPos = thePosStr.indexOf(
':' );
714 if ( -1 != nColonPos )
715 thePosStr = thePosStr.copy( 0, nColonPos );
731 VclMessageType::Warning, VclButtonsType::Ok,
745 if ( pSetP && bPosInputOk )
748 return bPosInputOk ? DeactivateRC::LeavePage : DeactivateRC::KeepPage;
768 if (&rButton == m_xBtnCopyResult.get())
770 if (rButton.get_active())
772 m_xLbOutPos->set_sensitive(
true);
773 m_xEdOutPos->set_sensitive(
true);
774 m_xEdOutPos->grab_focus();
778 m_xLbOutPos->set_sensitive(
false);
779 m_xEdOutPos->set_sensitive(
false);
782 else if (&rButton == m_xBtnSortUser.get())
784 if (rButton.get_active())
786 m_xLbSortUser->set_sensitive(
true);
787 m_xLbSortUser->grab_focus();
790 m_xLbSortUser->set_sensitive(
false);
796 if (&rLb == m_xLbOutPos.get())
799 const int nSelPos = m_xLbOutPos->get_active();
802 aString = m_xLbOutPos->get_id(nSelPos);
804 m_xEdOutPos->set_text(aString);
823 bFound = (theCurPosStr ==
aStr);
851 const uno::Sequence<OUString> aAlgos =
m_oColWrap->listCollatorAlgorithms( aLocale );
853 nCount = aAlgos.getLength();
854 for (
const OUString& sAlg : aAlgos)
856 OUString sUser =
m_xColRes->GetTranslation( sAlg );
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
virtual void Start(bool bStartTimer=true) override
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
bool Next(OUString &rName, ScRange &rRange)
const ScDBData * GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
ScSheetLimits & GetSheetLimits() const
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
SC_DLLPUBLIC SCCOL ClampToAllocatedColumns(SCTAB nTab, SCCOL nCol) const
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
static SC_DLLPUBLIC ScUserList * GetUserList()
ScViewData * GetViewData() const
void AddSortKey(sal_uInt16 nItem)
ScSortKeyItems m_aSortKeyItems
virtual ~ScTabPageSortFields() override
virtual void ActivatePage(const SfxItemSet &rSet) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
void FillFieldLists(sal_uInt16 nStartField)
void AddSortKey(sal_uInt16 nItem)
sal_uInt16 GetFieldSelPos(SCCOLROW nField)
virtual bool FillItemSet(SfxItemSet *rArgSet) override
ScTabPageSortFields(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
TypedWhichId< ScSortItem > nWhichSort
std::vector< SCCOLROW > nFieldArr
void SetLastSortKey(sal_uInt16 nItem)
std::unique_ptr< weld::Container > m_xBox
virtual void Reset(const SfxItemSet *rArgSet) override
ScSortKeyWindow m_aSortWin
std::unique_ptr< weld::CheckButton > m_xBtnHeader
std::unique_ptr< weld::RadioButton > m_xBtnLeftRight
std::unique_ptr< weld::RadioButton > m_xBtnTopDown
std::unique_ptr< weld::ScrolledWindow > m_xScrolledWindow
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
std::unique_ptr< CollatorResource > m_xColRes
void FillUserSortListBox()
std::unique_ptr< weld::CheckButton > m_xBtnSortUser
OUString aStrCommentsRowLabel
std::unique_ptr< weld::ComboBox > m_xLbOutPos
std::unique_ptr< weld::CheckButton > m_xBtnNaturalSort
std::unique_ptr< weld::CheckButton > m_xBtnFormats
std::unique_ptr< weld::CheckButton > m_xBtnIncComments
virtual bool FillItemSet(SfxItemSet *rArgSet) override
std::unique_ptr< weld::ComboBox > m_xLbSortUser
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
virtual void ActivatePage(const SfxItemSet &rSet) override
virtual void Reset(const SfxItemSet *rArgSet) override
std::unique_ptr< SvxLanguageBox > m_xLbLanguage
std::unique_ptr< weld::Label > m_xFtAlgorithm
std::unique_ptr< weld::CheckButton > m_xBtnIncImages
OUString aStrCommentsColLabel
TypedWhichId< ScSortItem > nWhichSort
ScTabPageSortOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *pArgSet)
std::unique_ptr< weld::CheckButton > m_xBtnCase
std::unique_ptr< weld::Entry > m_xEdOutPos
std::unique_ptr< weld::ComboBox > m_xLbAlgorithm
std::unique_ptr< weld::CheckButton > m_xBtnCopyResult
std::optional< CollatorWrapper > m_oColWrap
Collection of user-defined sort lists.
ScDocument & GetDocument() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SfxItemSet & GetItemSet() const
SfxOkDialogController * GetDialogController() const
void SetExchangeSupport()
const SfxItemSet * GetDialogExampleSet() const
weld::Window * GetFrameWeld() const
void SetInvokeHandler(const Link< Timer *, void > &rLink)
#define LANGUAGE_DONTKNOW
#define LINK(Instance, Class, Member)
RttiCompleteObjectLocator col
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
Reference< XComponentContext > getProcessComponentContext()
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString ScResId(TranslateId aId)
::std::vector< ScSortKeyState > maKeyState
OUString aCollatorAlgorithm
ScDataAreaExtras aDataAreaExtras
css::lang::Locale aCollatorLocale
sal_uInt16 GetSortKeyCount() const
IMPL_LINK_NOARG(ScTabPageSortFields, SortDirHdl, weld::Toggleable &, void)
IMPL_LINK(ScTabPageSortFields, SelectHdl, weld::ComboBox &, rLb, void)
SCCOL SC_MAXFIELDS(const ScSheetLimits &rLimits)
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW