22#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
23#include <com/sun/star/document/XDocumentEventListener.hpp>
24#include <com/sun/star/util/XChangesListener.hpp>
25#include <com/sun/star/container/XContainerListener.hpp>
26#include <com/sun/star/frame/XFrame.hpp>
27#include <com/sun/star/uno/XComponentContext.hpp>
28#include <com/sun/star/ui/XContextChangeEventListener.hpp>
36#include <rtl/ustring.hxx>
88 static constexpr std::u16string_view RESOURCEURL_PREFIX =
u"private:resource/";
92 size_t nIdx = RESOURCEURL_PREFIX.size();
93 while (nIdx < aResourceURL.size() && aResourceURL[nIdx]==
'/')
95 if (nIdx >= aResourceURL.size())
98 if (nIdx == std::u16string_view::npos)
100 while (nIdx < aResourceURL.size() && aResourceURL[nIdx]==
'/')
102 if (nIdx >= aResourceURL.size())
111 css::uno::Reference< css::uno::XComponentContext >
m_xContext;
116 css::uno::Reference< css::linguistic2::XLanguageGuessing >
const &
GetGuesser()
const;
120 const css::uno::Reference< css::frame::XFrame > &rxFrame,
123 const OUString & rCurLang,
124 const OUString & rKeyboardLang,
125 const OUString & rGuessedTextLang );
143 css::uno::WeakReference<css::container::XContainerListener>
mxOwner;
152 virtual void SAL_CALL
elementInserted(
const css::container::ContainerEvent& rEvent)
override
154 css::uno::Reference<css::container::XContainerListener> xOwner(
mxOwner.get(),
155 css::uno::UNO_QUERY);
157 xOwner->elementInserted(rEvent);
160 virtual void SAL_CALL
elementRemoved(
const css::container::ContainerEvent& rEvent)
override
162 css::uno::Reference<css::container::XContainerListener> xOwner(
mxOwner.get(),
163 css::uno::UNO_QUERY);
165 xOwner->elementRemoved(rEvent);
168 virtual void SAL_CALL
elementReplaced(
const css::container::ContainerEvent& rEvent)
override
170 css::uno::Reference<css::container::XContainerListener> xOwner(
mxOwner.get(),
171 css::uno::UNO_QUERY);
173 xOwner->elementReplaced(rEvent);
177 virtual void SAL_CALL
disposing(
const css::lang::EventObject& rEvent)
override
179 css::uno::Reference<css::container::XContainerListener> xOwner(
mxOwner.get(),
180 css::uno::UNO_QUERY);
182 xOwner->disposing(rEvent);
190 css::uno::WeakReference<css::util::XChangesListener>
mxOwner;
201 css::uno::Reference<css::util::XChangesListener> xOwner(
mxOwner.get(),
202 css::uno::UNO_QUERY);
204 xOwner->changesOccurred(rEvent);
208 virtual void SAL_CALL
disposing(
const css::lang::EventObject& rEvent)
override
210 css::uno::Reference<css::util::XChangesListener> xOwner(
mxOwner.get(),
211 css::uno::UNO_QUERY);
213 xOwner->disposing(rEvent);
221 css::uno::WeakReference<css::document::XDocumentEventListener>
mxOwner;
231 css::uno::Reference<css::document::XDocumentEventListener> xOwner(
mxOwner.get(),
232 css::uno::UNO_QUERY);
234 xOwner->documentEventOccured(rEvent);
239 virtual void SAL_CALL
disposing(
const css::lang::EventObject& rEvent)
override
241 css::uno::Reference<css::document::XDocumentEventListener> xOwner(
mxOwner.get(),
242 css::uno::UNO_QUERY);
244 xOwner->disposing(rEvent);
249css::uno::Reference<css::ui::XContextChangeEventListener>
251 css::uno::Reference<css::uno::XComponentContext>
const & xComponentContext,
252 css::uno::Reference<css::uno::XInterface>
const& xEventFocus,
253 std::function<
bool (css::uno::Reference<css::ui::XContextChangeEventListener>
const&)>
const& rPredicate);
255extern auto (*g_pGetMultiplexerListener)(
256 css::uno::Reference<css::uno::XComponentContext>
const & xComponentContext,
257 css::uno::Reference<css::uno::XInterface>
const&,
258 std::function<bool (css::uno::Reference<css::ui::XContextChangeEventListener>
const&)>
const&)
259 -> css::uno::Reference<css::ui::XContextChangeEventListener>;
css::uno::Reference< css::uno::XComponentContext > m_xContext
css::uno::Reference< css::linguistic2::XLanguageGuessing > const & GetGuesser() const
css::uno::Reference< css::linguistic2::XLanguageGuessing > m_xLanguageGuesser
LanguageGuessingHelper(css::uno::Reference< css::uno::XComponentContext > _xContext)
WeakChangesListener(css::uno::Reference< css::util::XChangesListener > const &xOwner)
virtual void SAL_CALL disposing(const css::lang::EventObject &rEvent) override
css::uno::WeakReference< css::util::XChangesListener > mxOwner
virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent &rEvent) override
WeakContainerListener(css::uno::Reference< css::container::XContainerListener > const &xOwner)
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &rEvent) override
css::uno::WeakReference< css::container::XContainerListener > mxOwner
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &rEvent) override
virtual void SAL_CALL disposing(const css::lang::EventObject &rEvent) override
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &rEvent) override
virtual void SAL_CALL disposing(const css::lang::EventObject &rEvent) override
css::uno::WeakReference< css::document::XDocumentEventListener > mxOwner
WeakDocumentEventListener(css::uno::Reference< css::document::XDocumentEventListener > const &xOwner)
virtual void SAL_CALL documentEventOccured(const css::document::DocumentEvent &rEvent) override
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
@ MID_LANG_PARA_SEPARATOR
void RetrieveTypeNameFromResourceURL(std::u16string_view aResourceURL, OUString &aType, OUString &aName)
bool IsScriptTypeMatchingToLanguage(SvtScriptType nScriptType, LanguageType nLang)
void FillLangItems(std::set< OUString > &rLangItems, const uno::Reference< frame::XFrame > &rxFrame, const LanguageGuessingHelper &rLangGuessHelper, SvtScriptType nScriptType, const OUString &rCurLang, const OUString &rKeyboardLang, const OUString &rGuessedTextLang)
uno::Reference< ui::XContextChangeEventListener > GetFirstListenerWith_Impl(css::uno::Reference< css::uno::XComponentContext > const &xComponentContext, uno::Reference< uno::XInterface > const &xEventFocus, std::function< bool(uno::Reference< ui::XContextChangeEventListener > const &)> const &rPredicate)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
Reference< XComponentContext > _xContext