21 #include <unosrch.hxx>
25 #include <osl/diagnose.h>
30 #include <com/sun/star/util/SearchAlgorithms2.hpp>
31 #include <com/sun/star/util/SearchFlags.hpp>
32 #include <com/sun/star/beans/PropertyAttribute.hpp>
38 #include <unordered_map>
44 std::unordered_map<OUString, beans::PropertyValue>
maValues;
56 void SetProperties(
const uno::Sequence< beans::PropertyValue >& aSearchAttribs);
73 for(
const beans::PropertyValue& rSearchAttrib : aSearchAttribs)
75 const OUString&
sName = rSearchAttrib.Name;
77 throw beans::UnknownPropertyException(sName);
84 uno::Sequence< beans::PropertyValue > aRet(
maValues.size());
85 beans::PropertyValue* pProps = aRet.getArray();
86 sal_Int32 nPropCount = 0;
89 pProps[nPropCount++] = rPair.second;
97 std::unique_ptr<SfxPoolItem> pBoxItem,
145 auto funcClone = [&rSet](sal_uInt16 nWID, std::unique_ptr<SfxPoolItem> & rpPoolItem)
149 return rpPoolItem.get();
155 assert(pPropEntry &&
"SetProperties only enters values into maValues if mrMap.hasPropertyByName() wass true");
157 sal_uInt16 nWID = rPropEntry.
nWID;
161 pTempItem = funcClone(nWID, pBoxItem);
164 pTempItem = funcClone(nWID, pCharBoxItem);
167 pTempItem = funcClone(nWID, pBreakItem);
170 pTempItem = funcClone(nWID, pAutoKernItem);
173 pTempItem = funcClone(nWID, pBrushItem);
176 pTempItem = funcClone(nWID, pCasemapItem);
179 pTempItem = funcClone(nWID, pCharColorItem);
182 pTempItem = funcClone(nWID, pContourItem);
185 pTempItem = funcClone(nWID, pCrossedOutItem);
188 pTempItem = funcClone(nWID, pEscItem);
191 pTempItem = funcClone(nWID, pBlinkItem);
194 pTempItem = funcClone(nWID, pFontItem);
197 pTempItem = funcClone(nWID, pFontSizeItem);
200 pTempItem = funcClone(nWID, pKernItem);
203 pTempItem = funcClone(nWID, pLangItem);
206 pTempItem = funcClone(nWID, pNHyphItem);
209 pTempItem = funcClone(nWID, pPostItem);
212 pTempItem = funcClone(nWID, pShadItem);
215 pTempItem = funcClone(nWID, pCharFormatItem);
218 pTempItem = funcClone(nWID, pULineItem);
221 pTempItem = funcClone(nWID, pOLineItem);
224 pTempItem = funcClone(nWID, pWeightItem);
227 pTempItem = funcClone(nWID, pDropItem);
230 pTempItem = funcClone(nWID, pInetItem);
233 pTempItem = funcClone(nWID, pDescItem);
236 pTempItem = funcClone(nWID, pAdjItem);
239 pTempItem = funcClone(nWID, pBackItem);
242 pTempItem = funcClone(nWID, pULItem);
245 pTempItem = funcClone(nWID, pLRItem);
248 pTempItem = funcClone(nWID, pKeepItem);
251 pTempItem = funcClone(nWID, pLineNumItem);
254 pTempItem = funcClone(nWID, pLineSpaceItem);
257 pTempItem = funcClone(nWID, pRegItem);
260 pTempItem = funcClone(nWID, pSplitItem);
263 pTempItem = funcClone(nWID, pTabItem);
266 pTempItem = funcClone(nWID, pWLineItem);
269 pTempItem = funcClone(nWID, pFontCJKItem);
272 pTempItem = funcClone(nWID, pFontSizeCJKItem);
275 pTempItem = funcClone(nWID, pCJKLangItem);
278 pTempItem = funcClone(nWID, pCJKPostureItem);
281 pTempItem = funcClone(nWID, pCJKWeightItem);
284 pTempItem = funcClone(nWID, pFontCTLItem);
287 pTempItem = funcClone(nWID, pFontSizeCTLItem);
290 pTempItem = funcClone(nWID, pCTLLangItem);
293 pTempItem = funcClone(nWID, pCTLPostureItem);
296 pTempItem = funcClone(nWID, pCTLWeightItem);
299 pTempItem = funcClone(nWID, pShadowItem);
307 rSet.
Put(*pTempItem);
330 m_bSimilarity(
false),
335 m_bIsValueSearch(true)
352 return theSwXTextSearchUnoTunnelId.
getSeq();
395 throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > (
this ) );
397 if ( pEntry->
nFlags & beans::PropertyAttribute::READONLY)
398 throw beans::PropertyVetoException (
"Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > (
this ) );
428 throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > (
this ) );
458 OSL_FAIL(
"not implemented");
463 OSL_FAIL(
"not implemented");
468 OSL_FAIL(
"not implemented");
473 OSL_FAIL(
"not implemented");
530 return "SwXTextSearch";
540 return {
"com.sun.star.util.SearchDescriptor",
"com.sun.star.util.ReplaceDescriptor" };
547 rSearchOpt.
algorithmType = util::SearchAlgorithms_APPROXIMATE;
553 rSearchOpt.
searchFlag |= util::SearchFlags::LEV_RELAXED;
573 rSearchOpt.
searchFlag |= util::SearchFlags::NORM_WORD_ONLY;
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
constexpr TypedWhichId< SvxBlinkItem > RES_CHRATR_BLINK(18)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
bool HasReplaceAttributes() const
#define PROPERTY_MAP_TEXT_CURSOR
bool HasSearchAttributes() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(110)
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
#define WID_SIMILARITY_RELAX
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
virtual void SAL_CALL setSearchString(const OUString &aString) override
void FillSearchOptions(i18nutil::SearchOptions2 &rSearchOpt) const
constexpr TypedWhichId< SwRegisterItem > RES_PARATR_REGISTER(71)
virtual ~SwXTextSearch() override
void InvalidateItem(sal_uInt16 nWhich)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
constexpr TypedWhichId< SvxAutoKernItem > RES_CHRATR_AUTOKERN(17)
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getReplaceAttributes() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
constexpr TypedWhichId< SvxBoxItem > RES_CHRATR_BOX(40)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
#define WID_CASE_SENSITIVE
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
std::unique_ptr< SwSearchProperties_Impl > m_pSearchProperties
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
bool hasPropertyByName(std::u16string_view rName) const
SwSearchProperties_Impl()
constexpr TypedWhichId< SvxCaseMapItem > RES_CHRATR_CASEMAP(RES_CHRATR_BEGIN)
constexpr TypedWhichId< SvxShadowItem > RES_CHRATR_SHADOW(41)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SwFormatDrop > RES_PARATR_DROP(70)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL setValueSearch(sal_Bool ValueSearch_) override
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
const SfxItemPropertySet * m_pPropSet
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
const css::uno::Sequence< sal_Int8 > & getSeq() const
#define WID_SIMILARITY_REMOVE
#define WID_SIMILARITY_EXCHANGE
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
std::unique_ptr< SwSearchProperties_Impl > m_pReplaceProperties
virtual OUString SAL_CALL getReplaceString() override
TransliterationFlags transliterateFlags
constexpr TypedWhichId< SvxShadowedItem > RES_CHRATR_SHADOWED(13)
const SfxItemPropertyMap & getPropertyMap() const
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
constexpr TypedWhichId< SvxOverlineItem > RES_CHRATR_OVERLINE(38)
virtual OUString SAL_CALL getImplementationName() override
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
css::util::SearchAlgorithms algorithmType
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getSearchAttributes() override
bool HasAttributes() const
const LanguageTag & GetAppLanguageTag()
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
SwSearchProperties_Impl & operator=(const SwSearchProperties_Impl &)=delete
void FillReplaceItemSet(SfxItemSet &rSet) const
std::unordered_map< OUString, beans::PropertyValue > maValues
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
#define WID_REGULAR_EXPRESSION
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
constexpr TypedWhichId< SvxFormatSplitItem > RES_PARATR_SPLIT(65)
#define PROPERTY_MAP_TEXT_SEARCH
constexpr TypedWhichId< SvxWordLineModeItem > RES_CHRATR_WORDLINEMODE(16)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
virtual OUString SAL_CALL getSearchString() override
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
void SetProperties(const uno::Sequence< beans::PropertyValue > &aSearchAttribs)
virtual sal_Bool SAL_CALL getValueSearch() override
SwUnoPropertyMapProvider aSwMapProvider
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
virtual void SAL_CALL setReplaceString(const OUString &aReplaceString) override
virtual void SAL_CALL setReplaceAttributes(const css::uno::Sequence< css::beans::PropertyValue > &aSearchAttribs) override
constexpr TypedWhichId< SwFormatLineNumber > RES_LINENUMBER(116)
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
constexpr TypedWhichId< SvxNoHyphenItem > RES_CHRATR_NOHYPHEN(19)
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
void FillItemSet(SfxItemSet &rSet, bool bIsValueSearch) const
void FillSearchItemSet(SfxItemSet &rSet) const
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxKerningItem > RES_CHRATR_KERNING(9)
#define WID_SIMILARITY_ADD
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
uno::Sequence< beans::PropertyValue > GetProperties() const
bool m_bDetectedRangeSegmentation false
virtual void SAL_CALL setSearchAttributes(const css::uno::Sequence< css::beans::PropertyValue > &aSearchAttribs) override
constexpr TypedWhichId< SvxContourItem > RES_CHRATR_CONTOUR(4)