17#include <document.hxx>
27 , aSkipped(
ScResId(SCSTR_SKIPPED))
28 , mpBindings(_pBindings)
31 , mxList(m_xBuilder->weld_tree_view(
"results"))
32 , mxSearchResults(m_xBuilder->weld_label(
"lbSearchResults"))
33 , mxShowDialog(m_xBuilder->weld_check_button(
"cbShow"))
35 mxList->set_size_request(
mxList->get_approximate_digit_width() * 50,
mxList->get_height_rows(15));
37 std::vector<int> aWidths
39 o3tl::narrowing<int>(
mxList->get_approximate_digit_width() * 10),
40 o3tl::narrowing<int>(
mxList->get_approximate_digit_width() * 10)
42 mxList->set_column_fixed_widths(aWidths);
55 SvxSearchDialogWrapper::GetChildWindowId());
70 static const size_t mnMaximum = 1000;
81 void Insert(
const OUString &rTabName,
84 const OUString &rText)
86 if (mnCount++ < mnMaximum)
91 nullptr, eConvention), 1);
99 bool bEmptyCells,
bool bMatchedRangesWereClamped )
101 ListWrapper aList(*
mxList);
103 SCTAB nTabCount = aTabNames.size();
106 size_t nMatchMax = rMatchedRanges.
size();
107 if (nMatchMax > ListWrapper::mnMaximum)
108 nMatchMax = ListWrapper::mnMaximum;
110 if (bCellNotes || bEmptyCells)
112 for (
size_t i = 0,
n = nMatchMax;
i <
n; ++
i)
114 ScRange const & rRange( rMatchedRanges[
i] );
120 if (aPos.
Tab() >= nTabCount)
130 aList.Insert(aTabNames[aPos.
Tab()], aPos,
136 aList.Insert(aTabNames[aPos.
Tab()], aPos,
147 for (
size_t i = 0,
n = nMatchMax;
i <
n; ++
i)
150 for (
bool bHas = aIter.
first(); bHas; bHas = aIter.
next())
153 if (aPos.
Tab() >= nTabCount)
157 aList.Insert(aTabNames[aPos.
Tab()], aPos,
164 OUString aSearchResultsMsg;
165 if (bMatchedRangesWereClamped)
167 aSearchResultsMsg =
ScResId(SCSTR_RESULTS_CLAMPED);
168 aSearchResultsMsg = aSearchResultsMsg.replaceFirst(
"%1", OUString::number(1000));
172 OUString aTotal(
ScResId(SCSTR_TOTAL, aList.mnCount));
173 aSearchResultsMsg = aTotal.replaceFirst(
"%1", OUString::number(aList.mnCount));
174 if (aList.mnCount > ListWrapper::mnMaximum)
189 SfxBoolItem aItem(SID_SEARCH_RESULTS_DIALOG,
false);
193 SfxCallMode::SYNCHRON | SfxCallMode::RECORD, { &aItem });
204 mxList->make_sorted();
208 bool bSortAtoZ = mxList->get_sort_order();
211 if (nColumn == mxList->get_sort_column())
213 bSortAtoZ = !bSortAtoZ;
214 mxList->set_sort_order(bSortAtoZ);
218 int nOldSortColumn = mxList->get_sort_column();
219 if (nOldSortColumn != -1)
221 mxList->set_sort_column(nColumn);
236 int nEntry = mxList->get_selected_index();
237 OUString aTabStr = mxList->get_text(nEntry, 0);
238 OUString aPosStr = mxList->get_text(nEntry, 1);
241 if (!mpDoc->GetTable(aTabStr, nTab))
246 ScRefFlags nRes = aPos.
Parse(aPosStr, *mpDoc, mpDoc->GetAddressConvention());
Reference< XExecutableDialog > m_xDialog
void IncTab(SCTAB nDelta=1)
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
void IncCol(SCCOL nDelta=1)
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)
void IncRow(SCROW nDelta=1)
Walk through all cells in an area.
const ScAddress & GetPos() const
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC std::vector< OUString > GetAllTableNames() const
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
static SC_DLLPUBLIC OUString ReplaceOrAppend(const OUString &rString, std::u16string_view rPlaceholder, const OUString &rReplacement)
Replaces the first occurrence of rPlaceholder in rString with rReplacement, or if rPlaceholder is not...
Additional class containing cell annotation data.
OUString GetText() const
Returns the caption text of this note.
static ScTabViewShell * GetActiveViewShell()
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
ScViewData & GetViewData()
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
void SetOptions(const ScViewOptions &rOpt)
const ScViewOptions & GetOptions() const
void SetOption(ScViewOption eOpt, bool bNew)
SfxDispatcher * GetDispatcher() const
void SetController(std::shared_ptr< SfxDialogController > controller)
std::shared_ptr< SfxDialogController > & GetController()
virtual SfxChildWinInfo GetInfo() const
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
SfxViewFrame * GetFrame() const
SfxChildWindow * GetChildWindow(sal_uInt16)
std::shared_ptr< SearchResultsDlg > m_xDialog
virtual ~SearchResultsDlgWrapper() override
SearchResultsDlgWrapper(vcl::Window *_pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
void FillResults(ScDocument &rDoc, const ScRangeList &rMatchedRanges, bool bCellNotes, bool bEmptyCells, bool bMatchedRangesWereClamped)
virtual void Close() override
virtual ~SearchResultsDlg() override
std::unique_ptr< weld::Label > mxSearchResults
SearchResultsDlg(SfxBindings *_pBindings, weld::Window *pParent)
std::unique_ptr< weld::TreeView > mxList
std::unique_ptr< weld::CheckButton > mxShowDialog
virtual void set_text(int row, const OUString &rText, int col=-1)=0
void append_text(const OUString &rStr)
virtual int n_children() const=0
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
#define LINK(Instance, Class, Member)
std::shared_ptr< T > make_shared(Args &&... args)
CAUTION! The following defines must be in the same namespace as the respective type.
IMPL_LINK_NOARG(SharedStringPoolPurge, timerHandler, Timer *, void)
IMPL_STATIC_LINK(SearchResultsDlg, OnShowToggled, weld::Toggleable &, rButton, void)
IMPL_LINK(SearchResultsDlg, HeaderBarClick, int, nColumn, void)
SFX_IMPL_CHILDWINDOW_WITHID(SearchResultsDlgWrapper, SID_SEARCH_RESULTS_DIALOG)
OUString ScResId(TranslateId aId)