LibreOffice Module svx (master) 1
|
#include <fmsrcimp.hxx>
Classes | |
struct | FieldInfo |
Public Member Functions | |
void | SetCaseSensitive (bool bSet) |
bool | GetCaseSensitive () const |
void | SetFormatterUsing (bool bSet) |
bool | GetFormatterUsing () const |
void | SetDirection (bool bForward) |
bool | GetDirection () const |
void | SetWildcard (bool bSet) |
bool | GetWildcard () const |
void | SetRegular (bool bSet) |
bool | GetRegular () const |
void | SetLevenshtein (bool bSet) |
bool | GetLevenshtein () const |
void | SetIgnoreWidthCJK (bool bSet) |
bool | GetIgnoreWidthCJK () const |
void | SetTransliteration (bool bSet) |
bool | GetTransliteration () const |
void | SetLevRelaxed (bool bSet) |
bool | GetLevRelaxed () const |
void | SetLevOther (sal_uInt16 nHowMuch) |
sal_uInt16 | GetLevOther () const |
void | SetLevShorter (sal_uInt16 nHowMuch) |
sal_uInt16 | GetLevShorter () const |
void | SetLevLonger (sal_uInt16 nHowMuch) |
sal_uInt16 | GetLevLonger () const |
void | SetTransliterationFlags (TransliterationFlags _nFlags) |
TransliterationFlags | GetTransliterationFlags () const |
void | SetPosition (sal_uInt16 nValue) |
sal_uInt16 | GetPosition () const |
FmSearchEngine (const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const css::uno::Reference< css::sdbc::XResultSet > &xCursor, std::u16string_view strVisibleFields, const InterfaceArray &arrFields) | |
two constructs, both analogical to FmSearchDialog, therefore look this up for explanations... xCursor has to implement css::data::DatabaseCursor service each time. More... | |
void | SetProgressHandler (Link< const FmSearchProgress *, void > aHdl) |
the link will be called on every record and after the completion of the search, the parameter is a pointer to a FmSearchProgress structure the handler should be in any case thread-safe More... | |
void | SearchNext (const OUString &strExpression) |
search for the next appearance (for nDirection values check DIRECTION_*-defines) More... | |
void | SearchNextSpecial (bool _bSearchForNull) |
analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL" More... | |
void | StartOver (const OUString &strExpression) |
search for the next appearance, dependent on nDirection from the start or end More... | |
void | StartOverSpecial (bool _bSearchForNull) |
analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL" More... | |
void | InvalidatePreviousLoc () |
invalidate previous search reference More... | |
void | RebuildUsedFields (sal_Int32 nFieldIndex, bool bForce=false) |
rebuilds m_arrUsedFields (nFieldIndex==-1 means all fields, otherwise it specifies the field index) if bForce is not set, nothing will happen in case of nFieldIndex == m_nCurrentFieldIndex (calls InvalidatePreviousLoc) More... | |
OUString | FormatField (sal_Int32 nWhich) |
void | CancelSearch () |
returns directly; once it was really aborted, ProgressHandler is called with STATE_CANCELED More... | |
void | SwitchToContext (const css::uno::Reference< css::sdbc::XResultSet > &xCursor, std::u16string_view strVisibleFields, const InterfaceArray &arrFields, sal_Int32 nFieldIndex) |
only valid, if not an (asynchronous) search is running, the next search will then be executed on top of the new iterator with the new parameter More... | |
Private Types | |
enum class | SearchResult { Found , NotFound , Error , Cancelled } |
enum class | SearchFor { String , Null , NotNull } |
typedef std::vector< FieldInfo > | FieldCollection |
Private Member Functions | |
SVX_DLLPRIVATE bool | CancelRequested () |
void | Init (std::u16string_view strVisibleFields) |
void | SearchNextImpl () |
void | ImplStartNextSearch () |
SVX_DLLPRIVATE void | fillControlTexts (const InterfaceArray &arrFields) |
SVX_DLLPRIVATE SearchResult | SearchSpecial (bool _bSearchForNull, sal_Int32 &nFieldPos, FieldCollection::iterator &iterFieldLoop, const FieldCollection::iterator &iterBegin, const FieldCollection::iterator &iterEnd) |
SVX_DLLPRIVATE SearchResult | SearchWildcard (std::u16string_view strExpression, sal_Int32 &nFieldPos, FieldCollection::iterator &iterFieldLoop, const FieldCollection::iterator &iterBegin, const FieldCollection::iterator &iterEnd) |
SVX_DLLPRIVATE SearchResult | SearchRegularApprox (const OUString &strExpression, sal_Int32 &nFieldPos, FieldCollection::iterator &iterFieldLoop, const FieldCollection::iterator &iterBegin, const FieldCollection::iterator &iterEnd) |
SVX_DLLPRIVATE void | PropagateProgress (bool _bDontPropagateOverflow) |
SVX_DLLPRIVATE bool | MoveCursor () |
SVX_DLLPRIVATE bool | MoveField (sal_Int32 &nPos, FieldCollection::iterator &iter, const FieldCollection::iterator &iterBegin, const FieldCollection::iterator &iterEnd) |
SVX_DLLPRIVATE void | BuildAndInsertFieldInfo (const css::uno::Reference< css::container::XIndexAccess > &xAllFields, sal_Int32 nField) |
void | OnSearchTerminated () |
DECL_DLLPRIVATE_LINK (OnNewRecordCount, sal_Int32, void) | |
Private Attributes | |
CursorWrapper | m_xSearchCursor |
std::deque< sal_Int32 > | m_arrFieldMapping |
CharClass | m_aCharacterClassficator |
CollatorWrapper | m_aStringCompare |
FieldCollection | m_arrUsedFields |
sal_Int32 | m_nCurrentFieldIndex |
std::vector< std::unique_ptr< svxform::ControlTextWrapper > > | m_aControlTexts |
CursorWrapper | m_xOriginalIterator |
CursorWrapper | m_xClonedIterator |
css::uno::Any | m_aPreviousLocBookmark |
FieldCollection::iterator | m_iterPreviousLocField |
OUString | m_strSearchExpression |
SearchFor | m_eSearchForType |
SearchResult | m_srResult |
Link< const FmSearchProgress *, void > | m_aProgressHandler |
std::atomic< bool > | m_bCancelAsynchRequest |
bool | m_bSearchingCurrently: 1 |
bool | m_bFormatter: 1 |
bool | m_bForward: 1 |
bool | m_bWildcard: 1 |
bool | m_bRegular: 1 |
bool | m_bLevenshtein: 1 |
bool | m_bTransliteration: 1 |
bool | m_bLevRelaxed: 1 |
sal_uInt16 | m_nLevOther |
sal_uInt16 | m_nLevShorter |
sal_uInt16 | m_nLevLonger |
sal_uInt16 | m_nPosition |
TransliterationFlags | m_nTransliterationFlags |
Friends | |
class | FmSearchThread |
Definition at line 154 of file fmsrcimp.hxx.
|
private |
Definition at line 175 of file fmsrcimp.hxx.
|
strongprivate |
Enumerator | |
---|---|
String | |
Null | |
NotNull |
Definition at line 159 of file fmsrcimp.hxx.
|
strongprivate |
Enumerator | |
---|---|
Found | |
NotFound | |
Error | |
Cancelled |
Definition at line 158 of file fmsrcimp.hxx.
FmSearchEngine::FmSearchEngine | ( | const css::uno::Reference< css::uno::XComponentContext > & | _rxContext, |
const css::uno::Reference< css::sdbc::XResultSet > & | xCursor, | ||
std::u16string_view | strVisibleFields, | ||
const InterfaceArray & | arrFields | ||
) |
two constructs, both analogical to FmSearchDialog, therefore look this up for explanations... xCursor has to implement css::data::DatabaseCursor service each time.
If eMode == SM_USETHREAD, a ProgressHandler should be set, because in this case the result forwarding will be done by this handler. If eMode != SM_USETHREAD, SearchNext and StarOver won't return, until the search has finished (independently of its success), only then the result can be requested. If additionally the ProgressHandler is set, it will be called for every record as well as at the end of the search.
Definition at line 540 of file fmsrcimp.cxx.
References fillControlTexts(), Init(), m_nPosition, NONE, and String.
|
private |
Definition at line 254 of file fmsrcimp.cxx.
References DBG_ASSERT, and FmSearchEngine::FieldInfo::xContents.
Referenced by RebuildUsedFields().
|
private |
Definition at line 917 of file fmsrcimp.cxx.
References m_bCancelAsynchRequest.
void FmSearchEngine::CancelSearch | ( | ) |
returns directly; once it was really aborted, ProgressHandler is called with STATE_CANCELED
Definition at line 924 of file fmsrcimp.cxx.
References m_bCancelAsynchRequest.
|
private |
|
private |
Definition at line 602 of file fmsrcimp.cxx.
References DBG_ASSERT, and m_aControlTexts.
Referenced by FmSearchEngine(), and SwitchToContext().
OUString FmSearchEngine::FormatField | ( | sal_Int32 | nWhich | ) |
Definition at line 276 of file fmsrcimp.cxx.
References DBG_ASSERT, and o3tl::make_unsigned().
bool FmSearchEngine::GetCaseSensitive | ( | ) | const |
Definition at line 596 of file fmsrcimp.cxx.
References m_nTransliterationFlags.
Referenced by SearchNextImpl().
|
inline |
Definition at line 229 of file fmsrcimp.hxx.
|
inline |
Definition at line 226 of file fmsrcimp.hxx.
bool FmSearchEngine::GetIgnoreWidthCJK | ( | ) | const |
Definition at line 581 of file fmsrcimp.cxx.
References m_nTransliterationFlags.
|
inline |
Definition at line 238 of file fmsrcimp.hxx.
|
inline |
Definition at line 253 of file fmsrcimp.hxx.
|
inline |
Definition at line 249 of file fmsrcimp.hxx.
|
inline |
Definition at line 247 of file fmsrcimp.hxx.
|
inline |
Definition at line 251 of file fmsrcimp.hxx.
|
inline |
Definition at line 261 of file fmsrcimp.hxx.
References m_nPosition.
|
inline |
Definition at line 235 of file fmsrcimp.hxx.
|
inline |
Definition at line 244 of file fmsrcimp.hxx.
|
inline |
Definition at line 258 of file fmsrcimp.hxx.
|
inline |
Definition at line 232 of file fmsrcimp.hxx.
|
private |
Definition at line 948 of file fmsrcimp.cxx.
References m_bCancelAsynchRequest, m_bSearchingCurrently, OnSearchTerminated(), and SearchNextImpl().
Referenced by SearchNext(), and SearchNextSpecial().
|
private |
Definition at line 633 of file fmsrcimp.cxx.
References DBG_ASSERT, Exception, FM_PROP_ACTIVE_CONNECTION, getLocale(), o3tl::getToken(), IFACECAST, CollatorWrapper::loadDefaultCollator(), m_arrFieldMapping, m_aStringCompare, m_xSearchCursor, nIndex, and TOOLS_WARN_EXCEPTION.
Referenced by FmSearchEngine(), and SwitchToContext().
void FmSearchEngine::InvalidatePreviousLoc | ( | ) |
invalidate previous search reference
Definition at line 1013 of file fmsrcimp.cxx.
References m_aPreviousLocBookmark, m_arrUsedFields, and m_iterPreviousLocField.
Referenced by RebuildUsedFields(), SearchNextImpl(), StartOver(), and StartOverSpecial().
|
private |
Definition at line 188 of file fmsrcimp.cxx.
References Exception, LINK, and TOOLS_WARN_EXCEPTION.
|
private |
|
private |
Definition at line 863 of file fmsrcimp.cxx.
References FmSearchProgress::aBookmark, FmSearchProgress::aSearchState, Link< typename Arg, typename Ret >::Call(), FmSearchProgress::Canceled, Cancelled, DBG_UNHANDLED_EXCEPTION, FmSearchProgress::Error, Error, Exception, Found, CursorWrapper::getBookmark(), CursorWrapper::getRow(), Link< typename Arg, typename Ret >::IsSet(), m_aPreviousLocBookmark, m_aProgressHandler, m_arrUsedFields, m_bSearchingCurrently, m_iterPreviousLocField, m_srResult, m_xSearchCursor, FmSearchProgress::nCurrentRecord, FmSearchProgress::nFieldIndex, NotFound, FmSearchProgress::NothingFound, and FmSearchProgress::Successful.
Referenced by ImplStartNextSearch().
|
private |
Definition at line 740 of file fmsrcimp.cxx.
References FmSearchProgress::aSearchState, FmSearchProgress::bOverflow, Link< typename Arg, typename Ret >::Call(), DBG_UNHANDLED_EXCEPTION, Exception, CursorWrapper::getRow(), CursorWrapper::isFirst(), CursorWrapper::isLast(), Link< typename Arg, typename Ret >::IsSet(), m_aProgressHandler, m_bForward, m_xSearchCursor, FmSearchProgress::nCurrentRecord, and FmSearchProgress::Progress.
Referenced by SearchNextImpl().
void FmSearchEngine::RebuildUsedFields | ( | sal_Int32 | nFieldIndex, |
bool | bForce = false |
||
) |
rebuilds m_arrUsedFields (nFieldIndex==-1 means all fields, otherwise it specifies the field index) if bForce is not set, nothing will happen in case of nFieldIndex == m_nCurrentFieldIndex (calls InvalidatePreviousLoc)
Definition at line 1020 of file fmsrcimp.cxx.
References BuildAndInsertFieldInfo(), DBG_ASSERT, i, IFACECAST, InvalidatePreviousLoc(), m_arrFieldMapping, m_arrUsedFields, m_nCurrentFieldIndex, m_xSearchCursor, and o3tl::make_unsigned().
Referenced by SetFormatterUsing(), and SwitchToContext().
void FmSearchEngine::SearchNext | ( | const OUString & | strExpression | ) |
search for the next appearance (for nDirection values check DIRECTION_*-defines)
Definition at line 958 of file fmsrcimp.cxx.
References ImplStartNextSearch(), m_eSearchForType, m_strSearchExpression, and String.
Referenced by StartOver().
|
private |
Definition at line 764 of file fmsrcimp.cxx.
References DBG_ASSERT, DBG_UNHANDLED_EXCEPTION, EQUAL_BOOKMARKS, Error, Exception, Found, CursorWrapper::getBookmark(), GetCaseSensitive(), InvalidatePreviousLoc(), CursorWrapper::is(), CharClass::lowercase(), m_aCharacterClassficator, m_aPreviousLocBookmark, m_arrUsedFields, m_bForward, m_bLevenshtein, m_bRegular, m_bWildcard, m_eSearchForType, m_iterPreviousLocField, m_nPosition, m_srResult, m_strSearchExpression, m_xSearchCursor, MATCHING_ANYWHERE, MATCHING_BEGINNING, MATCHING_END, MATCHING_WHOLETEXT, MoveField(), Null, PropagateProgress(), SearchRegularApprox(), SearchSpecial(), SearchWildcard(), and String.
Referenced by ImplStartNextSearch().
void FmSearchEngine::SearchNextSpecial | ( | bool | _bSearchForNull | ) |
analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL"
Definition at line 966 of file fmsrcimp.cxx.
References ImplStartNextSearch(), m_eSearchForType, NotNull, and Null.
Referenced by StartOverSpecial().
|
private |
Definition at line 422 of file fmsrcimp.cxx.
References i18nutil::SearchOptions2::AlgorithmType2, Any, i18nutil::SearchOptions2::changedChars, DBG_ASSERT, DBG_UNHANDLED_EXCEPTION, i18nutil::SearchOptions2::deletedChars, EQUAL_BOOKMARKS, Exception, SvtSysLocale::GetLanguageTag(), LanguageTag::getLocale(), GetTransliterationFlags(), i18nutil::SearchOptions2::insertedChars, i18nutil::SearchOptions2::Locale, m_nPosition, MATCHING_BEGINNING, MATCHING_END, MATCHING_WHOLETEXT, Application::Reschedule(), i18nutil::SearchOptions2::searchFlag, utl::TextSearch::SearchForward(), i18nutil::SearchOptions2::searchString, and i18nutil::SearchOptions2::transliterateFlags.
Referenced by SearchNextImpl().
|
private |
Definition at line 295 of file fmsrcimp.cxx.
References Any, DBG_UNHANDLED_EXCEPTION, EQUAL_BOOKMARKS, Exception, and Application::Reschedule().
Referenced by SearchNextImpl().
|
private |
Definition at line 352 of file fmsrcimp.cxx.
References Any, DBG_UNHANDLED_EXCEPTION, EQUAL_BOOKMARKS, Exception, WildCard::Matches(), and Application::Reschedule().
Referenced by SearchNextImpl().
void FmSearchEngine::SetCaseSensitive | ( | bool | bSet | ) |
Definition at line 587 of file fmsrcimp.cxx.
References m_nTransliterationFlags.
|
inline |
Definition at line 228 of file fmsrcimp.hxx.
void FmSearchEngine::SetFormatterUsing | ( | bool | bSet | ) |
Definition at line 706 of file fmsrcimp.cxx.
References DBG_ASSERT, DBG_UNHANDLED_EXCEPTION, Exception, CursorWrapper::getBookmark(), m_bFormatter, m_nCurrentFieldIndex, m_xClonedIterator, m_xOriginalIterator, m_xSearchCursor, CursorWrapper::moveToBookmark(), and RebuildUsedFields().
void FmSearchEngine::SetIgnoreWidthCJK | ( | bool | bSet | ) |
Definition at line 572 of file fmsrcimp.cxx.
References m_nTransliterationFlags.
|
inline |
Definition at line 237 of file fmsrcimp.hxx.
|
inline |
Definition at line 252 of file fmsrcimp.hxx.
|
inline |
Definition at line 248 of file fmsrcimp.hxx.
|
inline |
Definition at line 246 of file fmsrcimp.hxx.
|
inline |
Definition at line 250 of file fmsrcimp.hxx.
|
inline |
Definition at line 260 of file fmsrcimp.hxx.
References m_nPosition, and nValue.
|
inline |
the link will be called on every record and after the completion of the search, the parameter is a pointer to a FmSearchProgress structure the handler should be in any case thread-safe
Definition at line 283 of file fmsrcimp.hxx.
|
inline |
Definition at line 234 of file fmsrcimp.hxx.
|
inline |
Definition at line 243 of file fmsrcimp.hxx.
|
inline |
Definition at line 256 of file fmsrcimp.hxx.
|
inline |
Definition at line 231 of file fmsrcimp.hxx.
void FmSearchEngine::StartOver | ( | const OUString & | strExpression | ) |
search for the next appearance, dependent on nDirection from the start or end
Definition at line 973 of file fmsrcimp.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, CursorWrapper::first(), InvalidatePreviousLoc(), CursorWrapper::last(), m_bForward, m_xSearchCursor, and SearchNext().
void FmSearchEngine::StartOverSpecial | ( | bool | _bSearchForNull | ) |
analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL"
Definition at line 993 of file fmsrcimp.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, CursorWrapper::first(), InvalidatePreviousLoc(), CursorWrapper::last(), m_bForward, m_xSearchCursor, and SearchNextSpecial().
void FmSearchEngine::SwitchToContext | ( | const css::uno::Reference< css::sdbc::XResultSet > & | xCursor, |
std::u16string_view | strVisibleFields, | ||
const InterfaceArray & | arrFields, | ||
sal_Int32 | nFieldIndex | ||
) |
only valid, if not an (asynchronous) search is running, the next search will then be executed on top of the new iterator with the new parameter
Definition at line 930 of file fmsrcimp.cxx.
References DBG_ASSERT, fillControlTexts(), Init(), m_bSearchingCurrently, m_xClonedIterator, m_xOriginalIterator, m_xSearchCursor, and RebuildUsedFields().
|
friend |
Definition at line 156 of file fmsrcimp.hxx.
|
private |
Definition at line 166 of file fmsrcimp.hxx.
Referenced by SearchNextImpl().
|
private |
Definition at line 180 of file fmsrcimp.hxx.
Referenced by fillControlTexts().
|
private |
Definition at line 186 of file fmsrcimp.hxx.
Referenced by InvalidatePreviousLoc(), OnSearchTerminated(), and SearchNextImpl().
|
private |
Definition at line 195 of file fmsrcimp.hxx.
Referenced by OnSearchTerminated(), and PropagateProgress().
|
private |
Definition at line 162 of file fmsrcimp.hxx.
Referenced by Init(), and RebuildUsedFields().
|
private |
Definition at line 176 of file fmsrcimp.hxx.
Referenced by InvalidatePreviousLoc(), OnSearchTerminated(), RebuildUsedFields(), and SearchNextImpl().
|
private |
Definition at line 167 of file fmsrcimp.hxx.
Referenced by Init().
|
private |
Definition at line 196 of file fmsrcimp.hxx.
Referenced by CancelRequested(), CancelSearch(), and ImplStartNextSearch().
|
private |
Definition at line 200 of file fmsrcimp.hxx.
Referenced by SetFormatterUsing().
|
private |
Definition at line 201 of file fmsrcimp.hxx.
Referenced by PropagateProgress(), SearchNextImpl(), StartOver(), and StartOverSpecial().
|
private |
Definition at line 204 of file fmsrcimp.hxx.
Referenced by SearchNextImpl().
|
private |
Definition at line 207 of file fmsrcimp.hxx.
|
private |
Definition at line 203 of file fmsrcimp.hxx.
Referenced by SearchNextImpl().
|
private |
Definition at line 199 of file fmsrcimp.hxx.
Referenced by ImplStartNextSearch(), OnSearchTerminated(), and SwitchToContext().
|
private |
Definition at line 205 of file fmsrcimp.hxx.
|
private |
Definition at line 202 of file fmsrcimp.hxx.
Referenced by SearchNextImpl().
|
private |
Definition at line 191 of file fmsrcimp.hxx.
Referenced by SearchNext(), SearchNextImpl(), and SearchNextSpecial().
|
private |
Definition at line 187 of file fmsrcimp.hxx.
Referenced by InvalidatePreviousLoc(), OnSearchTerminated(), and SearchNextImpl().
|
private |
Definition at line 177 of file fmsrcimp.hxx.
Referenced by RebuildUsedFields(), and SetFormatterUsing().
|
private |
Definition at line 210 of file fmsrcimp.hxx.
|
private |
Definition at line 208 of file fmsrcimp.hxx.
|
private |
Definition at line 209 of file fmsrcimp.hxx.
|
private |
Definition at line 212 of file fmsrcimp.hxx.
Referenced by SearchNextImpl().
|
private |
Definition at line 214 of file fmsrcimp.hxx.
Referenced by GetCaseSensitive(), GetIgnoreWidthCJK(), SetCaseSensitive(), and SetIgnoreWidthCJK().
|
private |
Definition at line 192 of file fmsrcimp.hxx.
Referenced by OnSearchTerminated(), and SearchNextImpl().
|
private |
Definition at line 190 of file fmsrcimp.hxx.
Referenced by SearchNext(), and SearchNextImpl().
|
private |
Definition at line 183 of file fmsrcimp.hxx.
Referenced by SetFormatterUsing(), and SwitchToContext().
|
private |
Definition at line 182 of file fmsrcimp.hxx.
Referenced by SetFormatterUsing(), and SwitchToContext().
|
private |
Definition at line 161 of file fmsrcimp.hxx.
Referenced by Init(), OnSearchTerminated(), PropagateProgress(), RebuildUsedFields(), SearchNextImpl(), SetFormatterUsing(), StartOver(), StartOverSpecial(), and SwitchToContext().